| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723 |
- function Ule(t,e){for(var n=0;n<e.length;n++){const r=e[n];if(typeof r!="string"&&!Array.isArray(r)){for(const a in r)if(a!=="default"&&!(a in t)){const s=Object.getOwnPropertyDescriptor(r,a);s&&Object.defineProperty(t,a,s.get?s:{enumerable:!0,get:()=>r[a]})}}}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 a of document.querySelectorAll('link[rel="modulepreload"]'))r(a);new MutationObserver(a=>{for(const s of a)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(a){const s={};return a.integrity&&(s.integrity=a.integrity),a.referrerPolicy&&(s.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?s.credentials="include":a.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(a){if(a.ep)return;a.ep=!0;const s=n(a);fetch(a.href,s)}})();var yS=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Pl(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var $A={exports:{}},py={};var aB;function Ble(){if(aB)return py;aB=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function n(r,a,s){var o=null;if(s!==void 0&&(o=""+s),a.key!==void 0&&(o=""+a.key),"key"in a){s={};for(var l in a)l!=="key"&&(s[l]=a[l])}else s=a;return a=s.ref,{$$typeof:t,type:r,key:o,ref:a!==void 0?a:null,props:s}}return py.Fragment=e,py.jsx=n,py.jsxs=n,py}var sB;function Hle(){return sB||(sB=1,$A.exports=Ble()),$A.exports}var i=Hle(),qA={exports:{}},On={};var oB;function $le(){if(oB)return On;oB=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),s=Symbol.for("react.consumer"),o=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),c=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),u=Symbol.for("react.lazy"),m=Symbol.for("react.activity"),p=Symbol.iterator;function f(X){return X===null||typeof X!="object"?null:(X=p&&X[p]||X["@@iterator"],typeof X=="function"?X:null)}var y={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},x=Object.assign,b={};function v(X,ie,le){this.props=X,this.context=ie,this.refs=b,this.updater=le||y}v.prototype.isReactComponent={},v.prototype.setState=function(X,ie){if(typeof X!="object"&&typeof X!="function"&&X!=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,X,ie,"setState")},v.prototype.forceUpdate=function(X){this.updater.enqueueForceUpdate(this,X,"forceUpdate")};function _(){}_.prototype=v.prototype;function k(X,ie,le){this.props=X,this.context=ie,this.refs=b,this.updater=le||y}var P=k.prototype=new _;P.constructor=k,x(P,v.prototype),P.isPureReactComponent=!0;var C=Array.isArray;function T(){}var N={H:null,A:null,T:null,S:null},R=Object.prototype.hasOwnProperty;function A(X,ie,le){var pe=le.ref;return{$$typeof:t,type:X,key:ie,ref:pe!==void 0?pe:null,props:le}}function D(X,ie){return A(X.type,ie,X.props)}function $(X){return typeof X=="object"&&X!==null&&X.$$typeof===t}function U(X){var ie={"=":"=0",":":"=2"};return"$"+X.replace(/[=:]/g,function(le){return ie[le]})}var G=/\/+/g;function L(X,ie){return typeof X=="object"&&X!==null&&X.key!=null?U(""+X.key):ie.toString(36)}function te(X){switch(X.status){case"fulfilled":return X.value;case"rejected":throw X.reason;default:switch(typeof X.status=="string"?X.then(T,T):(X.status="pending",X.then(function(ie){X.status==="pending"&&(X.status="fulfilled",X.value=ie)},function(ie){X.status==="pending"&&(X.status="rejected",X.reason=ie)})),X.status){case"fulfilled":return X.value;case"rejected":throw X.reason}}throw X}function re(X,ie,le,pe,Ce){var q=typeof X;(q==="undefined"||q==="boolean")&&(X=null);var Z=!1;if(X===null)Z=!0;else switch(q){case"bigint":case"string":case"number":Z=!0;break;case"object":switch(X.$$typeof){case t:case e:Z=!0;break;case u:return Z=X._init,re(Z(X._payload),ie,le,pe,Ce)}}if(Z)return Ce=Ce(X),Z=pe===""?"."+L(X,0):pe,C(Ce)?(le="",Z!=null&&(le=Z.replace(G,"$&/")+"/"),re(Ce,ie,le,"",function(I){return I})):Ce!=null&&($(Ce)&&(Ce=D(Ce,le+(Ce.key==null||X&&X.key===Ce.key?"":(""+Ce.key).replace(G,"$&/")+"/")+Z)),ie.push(Ce)),1;Z=0;var j=pe===""?".":pe+":";if(C(X))for(var E=0;E<X.length;E++)pe=X[E],q=j+L(pe,E),Z+=re(pe,ie,le,q,Ce);else if(E=f(X),typeof E=="function")for(X=E.call(X),E=0;!(pe=X.next()).done;)pe=pe.value,q=j+L(pe,E++),Z+=re(pe,ie,le,q,Ce);else if(q==="object"){if(typeof X.then=="function")return re(te(X),ie,le,pe,Ce);throw ie=String(X),Error("Objects are not valid as a React child (found: "+(ie==="[object Object]"?"object with keys {"+Object.keys(X).join(", ")+"}":ie)+"). If you meant to render a collection of children, use an array instead.")}return Z}function J(X,ie,le){if(X==null)return X;var pe=[],Ce=0;return re(X,pe,"","",function(q){return ie.call(le,q,Ce++)}),pe}function ue(X){if(X._status===-1){var ie=X._result;ie=ie(),ie.then(function(le){(X._status===0||X._status===-1)&&(X._status=1,X._result=le)},function(le){(X._status===0||X._status===-1)&&(X._status=2,X._result=le)}),X._status===-1&&(X._status=0,X._result=ie)}if(X._status===1)return X._result.default;throw X._result}var me=typeof reportError=="function"?reportError:function(X){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var ie=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof X=="object"&&X!==null&&typeof X.message=="string"?String(X.message):String(X),error:X});if(!window.dispatchEvent(ie))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",X);return}console.error(X)},ge={map:J,forEach:function(X,ie,le){J(X,function(){ie.apply(this,arguments)},le)},count:function(X){var ie=0;return J(X,function(){ie++}),ie},toArray:function(X){return J(X,function(ie){return ie})||[]},only:function(X){if(!$(X))throw Error("React.Children.only expected to receive a single React element child.");return X}};return On.Activity=m,On.Children=ge,On.Component=v,On.Fragment=n,On.Profiler=a,On.PureComponent=k,On.StrictMode=r,On.Suspense=c,On.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=N,On.__COMPILER_RUNTIME={__proto__:null,c:function(X){return N.H.useMemoCache(X)}},On.cache=function(X){return function(){return X.apply(null,arguments)}},On.cacheSignal=function(){return null},On.cloneElement=function(X,ie,le){if(X==null)throw Error("The argument must be a React element, but you passed "+X+".");var pe=x({},X.props),Ce=X.key;if(ie!=null)for(q in ie.key!==void 0&&(Ce=""+ie.key),ie)!R.call(ie,q)||q==="key"||q==="__self"||q==="__source"||q==="ref"&&ie.ref===void 0||(pe[q]=ie[q]);var q=arguments.length-2;if(q===1)pe.children=le;else if(1<q){for(var Z=Array(q),j=0;j<q;j++)Z[j]=arguments[j+2];pe.children=Z}return A(X.type,Ce,pe)},On.createContext=function(X){return X={$$typeof:o,_currentValue:X,_currentValue2:X,_threadCount:0,Provider:null,Consumer:null},X.Provider=X,X.Consumer={$$typeof:s,_context:X},X},On.createElement=function(X,ie,le){var pe,Ce={},q=null;if(ie!=null)for(pe in ie.key!==void 0&&(q=""+ie.key),ie)R.call(ie,pe)&&pe!=="key"&&pe!=="__self"&&pe!=="__source"&&(Ce[pe]=ie[pe]);var Z=arguments.length-2;if(Z===1)Ce.children=le;else if(1<Z){for(var j=Array(Z),E=0;E<Z;E++)j[E]=arguments[E+2];Ce.children=j}if(X&&X.defaultProps)for(pe in Z=X.defaultProps,Z)Ce[pe]===void 0&&(Ce[pe]=Z[pe]);return A(X,q,Ce)},On.createRef=function(){return{current:null}},On.forwardRef=function(X){return{$$typeof:l,render:X}},On.isValidElement=$,On.lazy=function(X){return{$$typeof:u,_payload:{_status:-1,_result:X},_init:ue}},On.memo=function(X,ie){return{$$typeof:d,type:X,compare:ie===void 0?null:ie}},On.startTransition=function(X){var ie=N.T,le={};N.T=le;try{var pe=X(),Ce=N.S;Ce!==null&&Ce(le,pe),typeof pe=="object"&&pe!==null&&typeof pe.then=="function"&&pe.then(T,me)}catch(q){me(q)}finally{ie!==null&&le.types!==null&&(ie.types=le.types),N.T=ie}},On.unstable_useCacheRefresh=function(){return N.H.useCacheRefresh()},On.use=function(X){return N.H.use(X)},On.useActionState=function(X,ie,le){return N.H.useActionState(X,ie,le)},On.useCallback=function(X,ie){return N.H.useCallback(X,ie)},On.useContext=function(X){return N.H.useContext(X)},On.useDebugValue=function(){},On.useDeferredValue=function(X,ie){return N.H.useDeferredValue(X,ie)},On.useEffect=function(X,ie){return N.H.useEffect(X,ie)},On.useEffectEvent=function(X){return N.H.useEffectEvent(X)},On.useId=function(){return N.H.useId()},On.useImperativeHandle=function(X,ie,le){return N.H.useImperativeHandle(X,ie,le)},On.useInsertionEffect=function(X,ie){return N.H.useInsertionEffect(X,ie)},On.useLayoutEffect=function(X,ie){return N.H.useLayoutEffect(X,ie)},On.useMemo=function(X,ie){return N.H.useMemo(X,ie)},On.useOptimistic=function(X,ie){return N.H.useOptimistic(X,ie)},On.useReducer=function(X,ie,le){return N.H.useReducer(X,ie,le)},On.useRef=function(X){return N.H.useRef(X)},On.useState=function(X){return N.H.useState(X)},On.useSyncExternalStore=function(X,ie,le){return N.H.useSyncExternalStore(X,ie,le)},On.useTransition=function(){return N.H.useTransition()},On.version="19.2.4",On}var lB;function pf(){return lB||(lB=1,qA.exports=$le()),qA.exports}var w=pf();const Kr=Pl(w),qle=Ule({__proto__:null,default:Kr},[w]);var VA={exports:{}},fy={},GA={exports:{}},WA={};var cB;function Vle(){return cB||(cB=1,(function(t){function e(re,J){var ue=re.length;re.push(J);e:for(;0<ue;){var me=ue-1>>>1,ge=re[me];if(0<a(ge,J))re[me]=J,re[ue]=ge,ue=me;else break e}}function n(re){return re.length===0?null:re[0]}function r(re){if(re.length===0)return null;var J=re[0],ue=re.pop();if(ue!==J){re[0]=ue;e:for(var me=0,ge=re.length,X=ge>>>1;me<X;){var ie=2*(me+1)-1,le=re[ie],pe=ie+1,Ce=re[pe];if(0>a(le,ue))pe<ge&&0>a(Ce,le)?(re[me]=Ce,re[pe]=ue,me=pe):(re[me]=le,re[ie]=ue,me=ie);else if(pe<ge&&0>a(Ce,ue))re[me]=Ce,re[pe]=ue,me=pe;else break e}}return J}function a(re,J){var ue=re.sortIndex-J.sortIndex;return ue!==0?ue:re.id-J.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var s=performance;t.unstable_now=function(){return s.now()}}else{var o=Date,l=o.now();t.unstable_now=function(){return o.now()-l}}var c=[],d=[],u=1,m=null,p=3,f=!1,y=!1,x=!1,b=!1,v=typeof setTimeout=="function"?setTimeout:null,_=typeof clearTimeout=="function"?clearTimeout:null,k=typeof setImmediate<"u"?setImmediate:null;function P(re){for(var J=n(d);J!==null;){if(J.callback===null)r(d);else if(J.startTime<=re)r(d),J.sortIndex=J.expirationTime,e(c,J);else break;J=n(d)}}function C(re){if(x=!1,P(re),!y)if(n(c)!==null)y=!0,T||(T=!0,U());else{var J=n(d);J!==null&&te(C,J.startTime-re)}}var T=!1,N=-1,R=5,A=-1;function D(){return b?!0:!(t.unstable_now()-A<R)}function $(){if(b=!1,T){var re=t.unstable_now();A=re;var J=!0;try{e:{y=!1,x&&(x=!1,_(N),N=-1),f=!0;var ue=p;try{t:{for(P(re),m=n(c);m!==null&&!(m.expirationTime>re&&D());){var me=m.callback;if(typeof me=="function"){m.callback=null,p=m.priorityLevel;var ge=me(m.expirationTime<=re);if(re=t.unstable_now(),typeof ge=="function"){m.callback=ge,P(re),J=!0;break t}m===n(c)&&r(c),P(re)}else r(c);m=n(c)}if(m!==null)J=!0;else{var X=n(d);X!==null&&te(C,X.startTime-re),J=!1}}break e}finally{m=null,p=ue,f=!1}J=void 0}}finally{J?U():T=!1}}}var U;if(typeof k=="function")U=function(){k($)};else if(typeof MessageChannel<"u"){var G=new MessageChannel,L=G.port2;G.port1.onmessage=$,U=function(){L.postMessage(null)}}else U=function(){v($,0)};function te(re,J){N=v(function(){re(t.unstable_now())},J)}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(re){re.callback=null},t.unstable_forceFrameRate=function(re){0>re||125<re?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):R=0<re?Math.floor(1e3/re):5},t.unstable_getCurrentPriorityLevel=function(){return p},t.unstable_next=function(re){switch(p){case 1:case 2:case 3:var J=3;break;default:J=p}var ue=p;p=J;try{return re()}finally{p=ue}},t.unstable_requestPaint=function(){b=!0},t.unstable_runWithPriority=function(re,J){switch(re){case 1:case 2:case 3:case 4:case 5:break;default:re=3}var ue=p;p=re;try{return J()}finally{p=ue}},t.unstable_scheduleCallback=function(re,J,ue){var me=t.unstable_now();switch(typeof ue=="object"&&ue!==null?(ue=ue.delay,ue=typeof ue=="number"&&0<ue?me+ue:me):ue=me,re){case 1:var ge=-1;break;case 2:ge=250;break;case 5:ge=1073741823;break;case 4:ge=1e4;break;default:ge=5e3}return ge=ue+ge,re={id:u++,callback:J,priorityLevel:re,startTime:ue,expirationTime:ge,sortIndex:-1},ue>me?(re.sortIndex=ue,e(d,re),n(c)===null&&re===n(d)&&(x?(_(N),N=-1):x=!0,te(C,ue-me))):(re.sortIndex=ge,e(c,re),y||f||(y=!0,T||(T=!0,U()))),re},t.unstable_shouldYield=D,t.unstable_wrapCallback=function(re){var J=p;return function(){var ue=p;p=J;try{return re.apply(this,arguments)}finally{p=ue}}}})(WA)),WA}var dB;function Gle(){return dB||(dB=1,GA.exports=Vle()),GA.exports}var KA={exports:{}},rs={};var uB;function Wle(){if(uB)return rs;uB=1;var t=pf();function e(c){var d="https://react.dev/errors/"+c;if(1<arguments.length){d+="?args[]="+encodeURIComponent(arguments[1]);for(var u=2;u<arguments.length;u++)d+="&args[]="+encodeURIComponent(arguments[u])}return"Minified React error #"+c+"; visit "+d+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var r={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},a=Symbol.for("react.portal");function s(c,d,u){var m=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:m==null?null:""+m,children:c,containerInfo:d,implementation:u}}var o=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function l(c,d){if(c==="font")return"";if(typeof d=="string")return d==="use-credentials"?d:""}return rs.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,rs.createPortal=function(c,d){var u=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!d||d.nodeType!==1&&d.nodeType!==9&&d.nodeType!==11)throw Error(e(299));return s(c,d,null,u)},rs.flushSync=function(c){var d=o.T,u=r.p;try{if(o.T=null,r.p=2,c)return c()}finally{o.T=d,r.p=u,r.d.f()}},rs.preconnect=function(c,d){typeof c=="string"&&(d?(d=d.crossOrigin,d=typeof d=="string"?d==="use-credentials"?d:"":void 0):d=null,r.d.C(c,d))},rs.prefetchDNS=function(c){typeof c=="string"&&r.d.D(c)},rs.preinit=function(c,d){if(typeof c=="string"&&d&&typeof d.as=="string"){var u=d.as,m=l(u,d.crossOrigin),p=typeof d.integrity=="string"?d.integrity:void 0,f=typeof d.fetchPriority=="string"?d.fetchPriority:void 0;u==="style"?r.d.S(c,typeof d.precedence=="string"?d.precedence:void 0,{crossOrigin:m,integrity:p,fetchPriority:f}):u==="script"&&r.d.X(c,{crossOrigin:m,integrity:p,fetchPriority:f,nonce:typeof d.nonce=="string"?d.nonce:void 0})}},rs.preinitModule=function(c,d){if(typeof c=="string")if(typeof d=="object"&&d!==null){if(d.as==null||d.as==="script"){var u=l(d.as,d.crossOrigin);r.d.M(c,{crossOrigin:u,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0})}}else d==null&&r.d.M(c)},rs.preload=function(c,d){if(typeof c=="string"&&typeof d=="object"&&d!==null&&typeof d.as=="string"){var u=d.as,m=l(u,d.crossOrigin);r.d.L(c,u,{crossOrigin:m,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0,type:typeof d.type=="string"?d.type:void 0,fetchPriority:typeof d.fetchPriority=="string"?d.fetchPriority:void 0,referrerPolicy:typeof d.referrerPolicy=="string"?d.referrerPolicy:void 0,imageSrcSet:typeof d.imageSrcSet=="string"?d.imageSrcSet:void 0,imageSizes:typeof d.imageSizes=="string"?d.imageSizes:void 0,media:typeof d.media=="string"?d.media:void 0})}},rs.preloadModule=function(c,d){if(typeof c=="string")if(d){var u=l(d.as,d.crossOrigin);r.d.m(c,{as:typeof d.as=="string"&&d.as!=="script"?d.as:void 0,crossOrigin:u,integrity:typeof d.integrity=="string"?d.integrity:void 0})}else r.d.m(c)},rs.requestFormReset=function(c){r.d.r(c)},rs.unstable_batchedUpdates=function(c,d){return c(d)},rs.useFormState=function(c,d,u){return o.H.useFormState(c,d,u)},rs.useFormStatus=function(){return o.H.useHostTransitionStatus()},rs.version="19.2.4",rs}var mB;function WK(){if(mB)return KA.exports;mB=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(),KA.exports=Wle(),KA.exports}var hB;function Kle(){if(hB)return fy;hB=1;var t=Gle(),e=pf(),n=WK();function r(h){var g="https://react.dev/errors/"+h;if(1<arguments.length){g+="?args[]="+encodeURIComponent(arguments[1]);for(var S=2;S<arguments.length;S++)g+="&args[]="+encodeURIComponent(arguments[S])}return"Minified React error #"+h+"; visit "+g+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function a(h){return!(!h||h.nodeType!==1&&h.nodeType!==9&&h.nodeType!==11)}function s(h){var g=h,S=h;if(h.alternate)for(;g.return;)g=g.return;else{h=g;do g=h,(g.flags&4098)!==0&&(S=g.return),h=g.return;while(h)}return g.tag===3?S:null}function o(h){if(h.tag===13){var g=h.memoizedState;if(g===null&&(h=h.alternate,h!==null&&(g=h.memoizedState)),g!==null)return g.dehydrated}return null}function l(h){if(h.tag===31){var g=h.memoizedState;if(g===null&&(h=h.alternate,h!==null&&(g=h.memoizedState)),g!==null)return g.dehydrated}return null}function c(h){if(s(h)!==h)throw Error(r(188))}function d(h){var g=h.alternate;if(!g){if(g=s(h),g===null)throw Error(r(188));return g!==h?null:h}for(var S=h,M=g;;){var H=S.return;if(H===null)break;var Y=H.alternate;if(Y===null){if(M=H.return,M!==null){S=M;continue}break}if(H.child===Y.child){for(Y=H.child;Y;){if(Y===S)return c(H),h;if(Y===M)return c(H),g;Y=Y.sibling}throw Error(r(188))}if(S.return!==M.return)S=H,M=Y;else{for(var we=!1,Oe=H.child;Oe;){if(Oe===S){we=!0,S=H,M=Y;break}if(Oe===M){we=!0,M=H,S=Y;break}Oe=Oe.sibling}if(!we){for(Oe=Y.child;Oe;){if(Oe===S){we=!0,S=Y,M=H;break}if(Oe===M){we=!0,M=Y,S=H;break}Oe=Oe.sibling}if(!we)throw Error(r(189))}}if(S.alternate!==M)throw Error(r(190))}if(S.tag!==3)throw Error(r(188));return S.stateNode.current===S?h:g}function u(h){var g=h.tag;if(g===5||g===26||g===27||g===6)return h;for(h=h.child;h!==null;){if(g=u(h),g!==null)return g;h=h.sibling}return null}var m=Object.assign,p=Symbol.for("react.element"),f=Symbol.for("react.transitional.element"),y=Symbol.for("react.portal"),x=Symbol.for("react.fragment"),b=Symbol.for("react.strict_mode"),v=Symbol.for("react.profiler"),_=Symbol.for("react.consumer"),k=Symbol.for("react.context"),P=Symbol.for("react.forward_ref"),C=Symbol.for("react.suspense"),T=Symbol.for("react.suspense_list"),N=Symbol.for("react.memo"),R=Symbol.for("react.lazy"),A=Symbol.for("react.activity"),D=Symbol.for("react.memo_cache_sentinel"),$=Symbol.iterator;function U(h){return h===null||typeof h!="object"?null:(h=$&&h[$]||h["@@iterator"],typeof h=="function"?h:null)}var G=Symbol.for("react.client.reference");function L(h){if(h==null)return null;if(typeof h=="function")return h.$$typeof===G?null:h.displayName||h.name||null;if(typeof h=="string")return h;switch(h){case x:return"Fragment";case v:return"Profiler";case b:return"StrictMode";case C:return"Suspense";case T:return"SuspenseList";case A:return"Activity"}if(typeof h=="object")switch(h.$$typeof){case y:return"Portal";case k:return h.displayName||"Context";case _:return(h._context.displayName||"Context")+".Consumer";case P:var g=h.render;return h=h.displayName,h||(h=g.displayName||g.name||"",h=h!==""?"ForwardRef("+h+")":"ForwardRef"),h;case N:return g=h.displayName||null,g!==null?g:L(h.type)||"Memo";case R:g=h._payload,h=h._init;try{return L(h(g))}catch{}}return null}var te=Array.isArray,re=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,J=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ue={pending:!1,data:null,method:null,action:null},me=[],ge=-1;function X(h){return{current:h}}function ie(h){0>ge||(h.current=me[ge],me[ge]=null,ge--)}function le(h,g){ge++,me[ge]=h.current,h.current=g}var pe=X(null),Ce=X(null),q=X(null),Z=X(null);function j(h,g){switch(le(q,g),le(Ce,h),le(pe,null),g.nodeType){case 9:case 11:h=(h=g.documentElement)&&(h=h.namespaceURI)?PU(h):0;break;default:if(h=g.tagName,g=g.namespaceURI)g=PU(g),h=AU(g,h);else switch(h){case"svg":h=1;break;case"math":h=2;break;default:h=0}}ie(pe),le(pe,h)}function E(){ie(pe),ie(Ce),ie(q)}function I(h){h.memoizedState!==null&&le(Z,h);var g=pe.current,S=AU(g,h.type);g!==S&&(le(Ce,h),le(pe,S))}function W(h){Ce.current===h&&(ie(pe),ie(Ce)),Z.current===h&&(ie(Z),dy._currentValue=ue)}var B,ae;function z(h){if(B===void 0)try{throw Error()}catch(S){var g=S.stack.trim().match(/\n( *(at )?)/);B=g&&g[1]||"",ae=-1<S.stack.indexOf(`
- at`)?" (<anonymous>)":-1<S.stack.indexOf("@")?"@unknown:0:0":""}return`
- `+B+h+ae}var V=!1;function ee(h,g){if(!h||V)return"";V=!0;var S=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var M={DetermineComponentFrameRoot:function(){try{if(g){var Et=function(){throw Error()};if(Object.defineProperty(Et.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Et,[])}catch(_t){var vt=_t}Reflect.construct(h,[],Et)}else{try{Et.call()}catch(_t){vt=_t}h.call(Et.prototype)}}else{try{throw Error()}catch(_t){vt=_t}(Et=h())&&typeof Et.catch=="function"&&Et.catch(function(){})}}catch(_t){if(_t&&vt&&typeof _t.stack=="string")return[_t.stack,vt.stack]}return[null,null]}};M.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var H=Object.getOwnPropertyDescriptor(M.DetermineComponentFrameRoot,"name");H&&H.configurable&&Object.defineProperty(M.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var Y=M.DetermineComponentFrameRoot(),we=Y[0],Oe=Y[1];if(we&&Oe){var Qe=we.split(`
- `),xt=Oe.split(`
- `);for(H=M=0;M<Qe.length&&!Qe[M].includes("DetermineComponentFrameRoot");)M++;for(;H<xt.length&&!xt[H].includes("DetermineComponentFrameRoot");)H++;if(M===Qe.length||H===xt.length)for(M=Qe.length-1,H=xt.length-1;1<=M&&0<=H&&Qe[M]!==xt[H];)H--;for(;1<=M&&0<=H;M--,H--)if(Qe[M]!==xt[H]){if(M!==1||H!==1)do if(M--,H--,0>H||Qe[M]!==xt[H]){var Ct=`
- `+Qe[M].replace(" at new "," at ");return h.displayName&&Ct.includes("<anonymous>")&&(Ct=Ct.replace("<anonymous>",h.displayName)),Ct}while(1<=M&&0<=H);break}}}finally{V=!1,Error.prepareStackTrace=S}return(S=h?h.displayName||h.name:"")?z(S):""}function K(h,g){switch(h.tag){case 26:case 27:case 5:return z(h.type);case 16:return z("Lazy");case 13:return h.child!==g&&g!==null?z("Suspense Fallback"):z("Suspense");case 19:return z("SuspenseList");case 0:case 15:return ee(h.type,!1);case 11:return ee(h.type.render,!1);case 1:return ee(h.type,!0);case 31:return z("Activity");default:return""}}function ne(h){try{var g="",S=null;do g+=K(h,S),S=h,h=h.return;while(h);return g}catch(M){return`
- Error generating stack: `+M.message+`
- `+M.stack}}var se=Object.prototype.hasOwnProperty,ce=t.unstable_scheduleCallback,fe=t.unstable_cancelCallback,oe=t.unstable_shouldYield,O=t.unstable_requestPaint,F=t.unstable_now,Q=t.unstable_getCurrentPriorityLevel,ve=t.unstable_ImmediatePriority,he=t.unstable_UserBlockingPriority,de=t.unstable_NormalPriority,Ae=t.unstable_LowPriority,_e=t.unstable_IdlePriority,ze=t.log,Be=t.unstable_setDisableYieldValue,Ue=null,Ne=null;function Ee(h){if(typeof ze=="function"&&Be(h),Ne&&typeof Ne.setStrictMode=="function")try{Ne.setStrictMode(Ue,h)}catch{}}var ke=Math.clz32?Math.clz32:xe,Me=Math.log,Ge=Math.LN2;function xe(h){return h>>>=0,h===0?32:31-(Me(h)/Ge|0)|0}var He=256,Pe=262144,Ve=4194304;function je(h){var g=h&42;if(g!==0)return g;switch(h&-h){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 h&261888;case 262144:case 524288:case 1048576:case 2097152:return h&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return h&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return h}}function ye(h,g,S){var M=h.pendingLanes;if(M===0)return 0;var H=0,Y=h.suspendedLanes,we=h.pingedLanes;h=h.warmLanes;var Oe=M&134217727;return Oe!==0?(M=Oe&~Y,M!==0?H=je(M):(we&=Oe,we!==0?H=je(we):S||(S=Oe&~h,S!==0&&(H=je(S))))):(Oe=M&~Y,Oe!==0?H=je(Oe):we!==0?H=je(we):S||(S=M&~h,S!==0&&(H=je(S)))),H===0?0:g!==0&&g!==H&&(g&Y)===0&&(Y=H&-H,S=g&-g,Y>=S||Y===32&&(S&4194048)!==0)?g:H}function $e(h,g){return(h.pendingLanes&~(h.suspendedLanes&~h.pingedLanes)&g)===0}function Ye(h,g){switch(h){case 1:case 2:case 4:case 8:case 64:return g+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 g+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 lt(){var h=Ve;return Ve<<=1,(Ve&62914560)===0&&(Ve=4194304),h}function St(h){for(var g=[],S=0;31>S;S++)g.push(h);return g}function ot(h,g){h.pendingLanes|=g,g!==268435456&&(h.suspendedLanes=0,h.pingedLanes=0,h.warmLanes=0)}function ft(h,g,S,M,H,Y){var we=h.pendingLanes;h.pendingLanes=S,h.suspendedLanes=0,h.pingedLanes=0,h.warmLanes=0,h.expiredLanes&=S,h.entangledLanes&=S,h.errorRecoveryDisabledLanes&=S,h.shellSuspendCounter=0;var Oe=h.entanglements,Qe=h.expirationTimes,xt=h.hiddenUpdates;for(S=we&~S;0<S;){var Ct=31-ke(S),Et=1<<Ct;Oe[Ct]=0,Qe[Ct]=-1;var vt=xt[Ct];if(vt!==null)for(xt[Ct]=null,Ct=0;Ct<vt.length;Ct++){var _t=vt[Ct];_t!==null&&(_t.lane&=-536870913)}S&=~Et}M!==0&&qe(h,M,0),Y!==0&&H===0&&h.tag!==0&&(h.suspendedLanes|=Y&~(we&~g))}function qe(h,g,S){h.pendingLanes|=g,h.suspendedLanes&=~g;var M=31-ke(g);h.entangledLanes|=g,h.entanglements[M]=h.entanglements[M]|1073741824|S&261930}function ht(h,g){var S=h.entangledLanes|=g;for(h=h.entanglements;S;){var M=31-ke(S),H=1<<M;H&g|h[M]&g&&(h[M]|=g),S&=~H}}function yt(h,g){var S=g&-g;return S=(S&42)!==0?1:Bt(S),(S&(h.suspendedLanes|g))!==0?0:S}function Bt(h){switch(h){case 2:h=1;break;case 8:h=4;break;case 32:h=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:h=128;break;case 268435456:h=134217728;break;default:h=0}return h}function Yt(h){return h&=-h,2<h?8<h?(h&134217727)!==0?32:268435456:8:2}function xn(){var h=J.p;return h!==0?h:(h=window.event,h===void 0?32:ZU(h.type))}function Xt(h,g){var S=J.p;try{return J.p=h,g()}finally{J.p=S}}var $t=Math.random().toString(36).slice(2),nn="__reactFiber$"+$t,on="__reactProps$"+$t,cn="__reactContainer$"+$t,pn="__reactEvents$"+$t,Ie="__reactListeners$"+$t,De="__reactHandles$"+$t,Xe="__reactResources$"+$t,at="__reactMarker$"+$t;function Ke(h){delete h[nn],delete h[on],delete h[pn],delete h[Ie],delete h[De]}function It(h){var g=h[nn];if(g)return g;for(var S=h.parentNode;S;){if(g=S[cn]||S[nn]){if(S=g.alternate,g.child!==null||S!==null&&S.child!==null)for(h=LU(h);h!==null;){if(S=h[nn])return S;h=LU(h)}return g}h=S,S=h.parentNode}return null}function Te(h){if(h=h[nn]||h[cn]){var g=h.tag;if(g===5||g===6||g===13||g===31||g===26||g===27||g===3)return h}return null}function We(h){var g=h.tag;if(g===5||g===26||g===27||g===6)return h.stateNode;throw Error(r(33))}function et(h){var g=h[Xe];return g||(g=h[Xe]={hoistableStyles:new Map,hoistableScripts:new Map}),g}function Ze(h){h[at]=!0}var Le=new Set,mt={};function st(h,g){tt(h,g),tt(h+"Capture",g)}function tt(h,g){for(mt[h]=g,h=0;h<g.length;h++)Le.add(g[h])}var Nt=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={},jt={};function Ft(h){return se.call(jt,h)?!0:se.call(Rt,h)?!1:Nt.test(h)?jt[h]=!0:(Rt[h]=!0,!1)}function mn(h,g,S){if(Ft(g))if(S===null)h.removeAttribute(g);else{switch(typeof S){case"undefined":case"function":case"symbol":h.removeAttribute(g);return;case"boolean":var M=g.toLowerCase().slice(0,5);if(M!=="data-"&&M!=="aria-"){h.removeAttribute(g);return}}h.setAttribute(g,""+S)}}function rn(h,g,S){if(S===null)h.removeAttribute(g);else{switch(typeof S){case"undefined":case"function":case"symbol":case"boolean":h.removeAttribute(g);return}h.setAttribute(g,""+S)}}function vn(h,g,S,M){if(M===null)h.removeAttribute(S);else{switch(typeof M){case"undefined":case"function":case"symbol":case"boolean":h.removeAttribute(S);return}h.setAttributeNS(g,S,""+M)}}function Dn(h){switch(typeof h){case"bigint":case"boolean":case"number":case"string":case"undefined":return h;case"object":return h;default:return""}}function Bn(h){var g=h.type;return(h=h.nodeName)&&h.toLowerCase()==="input"&&(g==="checkbox"||g==="radio")}function en(h,g,S){var M=Object.getOwnPropertyDescriptor(h.constructor.prototype,g);if(!h.hasOwnProperty(g)&&typeof M<"u"&&typeof M.get=="function"&&typeof M.set=="function"){var H=M.get,Y=M.set;return Object.defineProperty(h,g,{configurable:!0,get:function(){return H.call(this)},set:function(we){S=""+we,Y.call(this,we)}}),Object.defineProperty(h,g,{enumerable:M.enumerable}),{getValue:function(){return S},setValue:function(we){S=""+we},stopTracking:function(){h._valueTracker=null,delete h[g]}}}}function kn(h){if(!h._valueTracker){var g=Bn(h)?"checked":"value";h._valueTracker=en(h,g,""+h[g])}}function _n(h){if(!h)return!1;var g=h._valueTracker;if(!g)return!0;var S=g.getValue(),M="";return h&&(M=Bn(h)?h.checked?"true":"false":h.value),h=M,h!==S?(g.setValue(h),!0):!1}function vr(h){if(h=h||(typeof document<"u"?document:void 0),typeof h>"u")return null;try{return h.activeElement||h.body}catch{return h.body}}var wn=/[\n"\\]/g;function lr(h){return h.replace(wn,function(g){return"\\"+g.charCodeAt(0).toString(16)+" "})}function ci(h,g,S,M,H,Y,we,Oe){h.name="",we!=null&&typeof we!="function"&&typeof we!="symbol"&&typeof we!="boolean"?h.type=we:h.removeAttribute("type"),g!=null?we==="number"?(g===0&&h.value===""||h.value!=g)&&(h.value=""+Dn(g)):h.value!==""+Dn(g)&&(h.value=""+Dn(g)):we!=="submit"&&we!=="reset"||h.removeAttribute("value"),g!=null?gi(h,we,Dn(g)):S!=null?gi(h,we,Dn(S)):M!=null&&h.removeAttribute("value"),H==null&&Y!=null&&(h.defaultChecked=!!Y),H!=null&&(h.checked=H&&typeof H!="function"&&typeof H!="symbol"),Oe!=null&&typeof Oe!="function"&&typeof Oe!="symbol"&&typeof Oe!="boolean"?h.name=""+Dn(Oe):h.removeAttribute("name")}function zn(h,g,S,M,H,Y,we,Oe){if(Y!=null&&typeof Y!="function"&&typeof Y!="symbol"&&typeof Y!="boolean"&&(h.type=Y),g!=null||S!=null){if(!(Y!=="submit"&&Y!=="reset"||g!=null)){kn(h);return}S=S!=null?""+Dn(S):"",g=g!=null?""+Dn(g):S,Oe||g===h.value||(h.value=g),h.defaultValue=g}M=M??H,M=typeof M!="function"&&typeof M!="symbol"&&!!M,h.checked=Oe?h.checked:!!M,h.defaultChecked=!!M,we!=null&&typeof we!="function"&&typeof we!="symbol"&&typeof we!="boolean"&&(h.name=we),kn(h)}function gi(h,g,S){g==="number"&&vr(h.ownerDocument)===h||h.defaultValue===""+S||(h.defaultValue=""+S)}function tr(h,g,S,M){if(h=h.options,g){g={};for(var H=0;H<S.length;H++)g["$"+S[H]]=!0;for(S=0;S<h.length;S++)H=g.hasOwnProperty("$"+h[S].value),h[S].selected!==H&&(h[S].selected=H),H&&M&&(h[S].defaultSelected=!0)}else{for(S=""+Dn(S),g=null,H=0;H<h.length;H++){if(h[H].value===S){h[H].selected=!0,M&&(h[H].defaultSelected=!0);return}g!==null||h[H].disabled||(g=h[H])}g!==null&&(g.selected=!0)}}function bi(h,g,S){if(g!=null&&(g=""+Dn(g),g!==h.value&&(h.value=g),S==null)){h.defaultValue!==g&&(h.defaultValue=g);return}h.defaultValue=S!=null?""+Dn(S):""}function ni(h,g,S,M){if(g==null){if(M!=null){if(S!=null)throw Error(r(92));if(te(M)){if(1<M.length)throw Error(r(93));M=M[0]}S=M}S==null&&(S=""),g=S}S=Dn(g),h.defaultValue=S,M=h.textContent,M===S&&M!==""&&M!==null&&(h.value=M),kn(h)}function Fr(h,g){if(g){var S=h.firstChild;if(S&&S===h.lastChild&&S.nodeType===3){S.nodeValue=g;return}}h.textContent=g}var xi=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 _h(h,g,S){var M=g.indexOf("--")===0;S==null||typeof S=="boolean"||S===""?M?h.setProperty(g,""):g==="float"?h.cssFloat="":h[g]="":M?h.setProperty(g,S):typeof S!="number"||S===0||xi.has(g)?g==="float"?h.cssFloat=S:h[g]=(""+S).trim():h[g]=S+"px"}function kf(h,g,S){if(g!=null&&typeof g!="object")throw Error(r(62));if(h=h.style,S!=null){for(var M in S)!S.hasOwnProperty(M)||g!=null&&g.hasOwnProperty(M)||(M.indexOf("--")===0?h.setProperty(M,""):M==="float"?h.cssFloat="":h[M]="");for(var H in g)M=g[H],g.hasOwnProperty(H)&&S[H]!==M&&_h(h,H,M)}else for(var Y in g)g.hasOwnProperty(Y)&&_h(h,Y,g[Y])}function za(h){if(h.indexOf("-")===-1)return!1;switch(h){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 Nf=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"]]),dc=/^[\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 uc(h){return dc.test(""+h)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":h}function Ki(){}var Ss=null;function _s(h){return h=h.target||h.srcElement||window,h.correspondingUseElement&&(h=h.correspondingUseElement),h.nodeType===3?h.parentNode:h}var $s=null,jl=null;function Cf(h){var g=Te(h);if(g&&(h=g.stateNode)){var S=h[on]||null;e:switch(h=g.stateNode,g.type){case"input":if(ci(h,S.value,S.defaultValue,S.defaultValue,S.checked,S.defaultChecked,S.type,S.name),g=S.name,S.type==="radio"&&g!=null){for(S=h;S.parentNode;)S=S.parentNode;for(S=S.querySelectorAll('input[name="'+lr(""+g)+'"][type="radio"]'),g=0;g<S.length;g++){var M=S[g];if(M!==h&&M.form===h.form){var H=M[on]||null;if(!H)throw Error(r(90));ci(M,H.value,H.defaultValue,H.defaultValue,H.checked,H.defaultChecked,H.type,H.name)}}for(g=0;g<S.length;g++)M=S[g],M.form===h.form&&_n(M)}break e;case"textarea":bi(h,S.value,S.defaultValue);break e;case"select":g=S.value,g!=null&&tr(h,!!S.multiple,g,!1)}}}var kh=!1;function mc(h,g,S){if(kh)return h(g,S);kh=!0;try{var M=h(g);return M}finally{if(kh=!1,($s!==null||jl!==null)&&(Qw(),$s&&(g=$s,h=jl,jl=$s=null,Cf(g),h)))for(g=0;g<h.length;g++)Cf(h[g])}}function Dl(h,g){var S=h.stateNode;if(S===null)return null;var M=S[on]||null;if(M===null)return null;S=M[g];e:switch(g){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(M=!M.disabled)||(h=h.type,M=!(h==="button"||h==="input"||h==="select"||h==="textarea")),h=!M;break e;default:h=!1}if(h)return null;if(S&&typeof S!="function")throw Error(r(231,g,typeof S));return S}var ka=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),rd=!1;if(ka)try{var Rl={};Object.defineProperty(Rl,"passive",{get:function(){rd=!0}}),window.addEventListener("test",Rl,Rl),window.removeEventListener("test",Rl,Rl)}catch{rd=!1}var bt=null,Ot=null,dn=null;function kt(){if(dn)return dn;var h,g=Ot,S=g.length,M,H="value"in bt?bt.value:bt.textContent,Y=H.length;for(h=0;h<S&&g[h]===H[h];h++);var we=S-h;for(M=1;M<=we&&g[S-M]===H[Y-M];M++);return dn=H.slice(h,1<M?1-M:void 0)}function Pn(h){var g=h.keyCode;return"charCode"in h?(h=h.charCode,h===0&&g===13&&(h=13)):h=g,h===10&&(h=13),32<=h||h===13?h:0}function Nr(){return!0}function Ht(){return!1}function wr(h){function g(S,M,H,Y,we){this._reactName=S,this._targetInst=H,this.type=M,this.nativeEvent=Y,this.target=we,this.currentTarget=null;for(var Oe in h)h.hasOwnProperty(Oe)&&(S=h[Oe],this[Oe]=S?S(Y):Y[Oe]);return this.isDefaultPrevented=(Y.defaultPrevented!=null?Y.defaultPrevented:Y.returnValue===!1)?Nr:Ht,this.isPropagationStopped=Ht,this}return m(g.prototype,{preventDefault:function(){this.defaultPrevented=!0;var S=this.nativeEvent;S&&(S.preventDefault?S.preventDefault():typeof S.returnValue!="unknown"&&(S.returnValue=!1),this.isDefaultPrevented=Nr)},stopPropagation:function(){var S=this.nativeEvent;S&&(S.stopPropagation?S.stopPropagation():typeof S.cancelBubble!="unknown"&&(S.cancelBubble=!0),this.isPropagationStopped=Nr)},persist:function(){},isPersistent:Nr}),g}var yi={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(h){return h.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},sn=wr(yi),Rn=m({},yi,{view:0,detail:0}),qs=wr(Rn),Vs,go,Se,Dt=m({},Rn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:KT,button:0,buttons:0,relatedTarget:function(h){return h.relatedTarget===void 0?h.fromElement===h.srcElement?h.toElement:h.fromElement:h.relatedTarget},movementX:function(h){return"movementX"in h?h.movementX:(h!==Se&&(Se&&h.type==="mousemove"?(Vs=h.screenX-Se.screenX,go=h.screenY-Se.screenY):go=Vs=0,Se=h),Vs)},movementY:function(h){return"movementY"in h?h.movementY:go}}),Cn=wr(Dt),nr=m({},Dt,{dataTransfer:0}),ri=wr(nr),Na=m({},Rn,{relatedTarget:0}),Yi=wr(Na),Xn=m({},yi,{animationName:0,elapsedTime:0,pseudoElement:0}),ks=wr(Xn),Tf=m({},yi,{clipboardData:function(h){return"clipboardData"in h?h.clipboardData:window.clipboardData}}),vi=wr(Tf),id=m({},yi,{data:0}),Pu=wr(id),Tn={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Kse={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"},Yse={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Xse(h){var g=this.nativeEvent;return g.getModifierState?g.getModifierState(h):(h=Yse[h])?!!g[h]:!1}function KT(){return Xse}var Qse=m({},Rn,{key:function(h){if(h.key){var g=Tn[h.key]||h.key;if(g!=="Unidentified")return g}return h.type==="keypress"?(h=Pn(h),h===13?"Enter":String.fromCharCode(h)):h.type==="keydown"||h.type==="keyup"?Kse[h.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:KT,charCode:function(h){return h.type==="keypress"?Pn(h):0},keyCode:function(h){return h.type==="keydown"||h.type==="keyup"?h.keyCode:0},which:function(h){return h.type==="keypress"?Pn(h):h.type==="keydown"||h.type==="keyup"?h.keyCode:0}}),Zse=wr(Qse),Jse=m({},Dt,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),DI=wr(Jse),eoe=m({},Rn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:KT}),toe=wr(eoe),noe=m({},yi,{propertyName:0,elapsedTime:0,pseudoElement:0}),roe=wr(noe),ioe=m({},Dt,{deltaX:function(h){return"deltaX"in h?h.deltaX:"wheelDeltaX"in h?-h.wheelDeltaX:0},deltaY:function(h){return"deltaY"in h?h.deltaY:"wheelDeltaY"in h?-h.wheelDeltaY:"wheelDelta"in h?-h.wheelDelta:0},deltaZ:0,deltaMode:0}),aoe=wr(ioe),soe=m({},yi,{newState:0,oldState:0}),ooe=wr(soe),loe=[9,13,27,32],YT=ka&&"CompositionEvent"in window,Ex=null;ka&&"documentMode"in document&&(Ex=document.documentMode);var coe=ka&&"TextEvent"in window&&!Ex,RI=ka&&(!YT||Ex&&8<Ex&&11>=Ex),FI=" ",LI=!1;function OI(h,g){switch(h){case"keyup":return loe.indexOf(g.keyCode)!==-1;case"keydown":return g.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function II(h){return h=h.detail,typeof h=="object"&&"data"in h?h.data:null}var Pf=!1;function doe(h,g){switch(h){case"compositionend":return II(g);case"keypress":return g.which!==32?null:(LI=!0,FI);case"textInput":return h=g.data,h===FI&&LI?null:h;default:return null}}function uoe(h,g){if(Pf)return h==="compositionend"||!YT&&OI(h,g)?(h=kt(),dn=Ot=bt=null,Pf=!1,h):null;switch(h){case"paste":return null;case"keypress":if(!(g.ctrlKey||g.altKey||g.metaKey)||g.ctrlKey&&g.altKey){if(g.char&&1<g.char.length)return g.char;if(g.which)return String.fromCharCode(g.which)}return null;case"compositionend":return RI&&g.locale!=="ko"?null:g.data;default:return null}}var moe={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 zI(h){var g=h&&h.nodeName&&h.nodeName.toLowerCase();return g==="input"?!!moe[h.type]:g==="textarea"}function UI(h,g,S,M){$s?jl?jl.push(M):jl=[M]:$s=M,g=iS(g,"onChange"),0<g.length&&(S=new sn("onChange","change",null,S,M),h.push({event:S,listeners:g}))}var jx=null,Dx=null;function hoe(h){SU(h,0)}function gw(h){var g=We(h);if(_n(g))return h}function BI(h,g){if(h==="change")return g}var HI=!1;if(ka){var XT;if(ka){var QT="oninput"in document;if(!QT){var $I=document.createElement("div");$I.setAttribute("oninput","return;"),QT=typeof $I.oninput=="function"}XT=QT}else XT=!1;HI=XT&&(!document.documentMode||9<document.documentMode)}function qI(){jx&&(jx.detachEvent("onpropertychange",VI),Dx=jx=null)}function VI(h){if(h.propertyName==="value"&&gw(Dx)){var g=[];UI(g,Dx,h,_s(h)),mc(hoe,g)}}function poe(h,g,S){h==="focusin"?(qI(),jx=g,Dx=S,jx.attachEvent("onpropertychange",VI)):h==="focusout"&&qI()}function foe(h){if(h==="selectionchange"||h==="keyup"||h==="keydown")return gw(Dx)}function goe(h,g){if(h==="click")return gw(g)}function boe(h,g){if(h==="input"||h==="change")return gw(g)}function xoe(h,g){return h===g&&(h!==0||1/h===1/g)||h!==h&&g!==g}var bo=typeof Object.is=="function"?Object.is:xoe;function Rx(h,g){if(bo(h,g))return!0;if(typeof h!="object"||h===null||typeof g!="object"||g===null)return!1;var S=Object.keys(h),M=Object.keys(g);if(S.length!==M.length)return!1;for(M=0;M<S.length;M++){var H=S[M];if(!se.call(g,H)||!bo(h[H],g[H]))return!1}return!0}function GI(h){for(;h&&h.firstChild;)h=h.firstChild;return h}function WI(h,g){var S=GI(h);h=0;for(var M;S;){if(S.nodeType===3){if(M=h+S.textContent.length,h<=g&&M>=g)return{node:S,offset:g-h};h=M}e:{for(;S;){if(S.nextSibling){S=S.nextSibling;break e}S=S.parentNode}S=void 0}S=GI(S)}}function KI(h,g){return h&&g?h===g?!0:h&&h.nodeType===3?!1:g&&g.nodeType===3?KI(h,g.parentNode):"contains"in h?h.contains(g):h.compareDocumentPosition?!!(h.compareDocumentPosition(g)&16):!1:!1}function YI(h){h=h!=null&&h.ownerDocument!=null&&h.ownerDocument.defaultView!=null?h.ownerDocument.defaultView:window;for(var g=vr(h.document);g instanceof h.HTMLIFrameElement;){try{var S=typeof g.contentWindow.location.href=="string"}catch{S=!1}if(S)h=g.contentWindow;else break;g=vr(h.document)}return g}function ZT(h){var g=h&&h.nodeName&&h.nodeName.toLowerCase();return g&&(g==="input"&&(h.type==="text"||h.type==="search"||h.type==="tel"||h.type==="url"||h.type==="password")||g==="textarea"||h.contentEditable==="true")}var yoe=ka&&"documentMode"in document&&11>=document.documentMode,Af=null,JT=null,Fx=null,eP=!1;function XI(h,g,S){var M=S.window===S?S.document:S.nodeType===9?S:S.ownerDocument;eP||Af==null||Af!==vr(M)||(M=Af,"selectionStart"in M&&ZT(M)?M={start:M.selectionStart,end:M.selectionEnd}:(M=(M.ownerDocument&&M.ownerDocument.defaultView||window).getSelection(),M={anchorNode:M.anchorNode,anchorOffset:M.anchorOffset,focusNode:M.focusNode,focusOffset:M.focusOffset}),Fx&&Rx(Fx,M)||(Fx=M,M=iS(JT,"onSelect"),0<M.length&&(g=new sn("onSelect","select",null,g,S),h.push({event:g,listeners:M}),g.target=Af)))}function Nh(h,g){var S={};return S[h.toLowerCase()]=g.toLowerCase(),S["Webkit"+h]="webkit"+g,S["Moz"+h]="moz"+g,S}var Mf={animationend:Nh("Animation","AnimationEnd"),animationiteration:Nh("Animation","AnimationIteration"),animationstart:Nh("Animation","AnimationStart"),transitionrun:Nh("Transition","TransitionRun"),transitionstart:Nh("Transition","TransitionStart"),transitioncancel:Nh("Transition","TransitionCancel"),transitionend:Nh("Transition","TransitionEnd")},tP={},QI={};ka&&(QI=document.createElement("div").style,"AnimationEvent"in window||(delete Mf.animationend.animation,delete Mf.animationiteration.animation,delete Mf.animationstart.animation),"TransitionEvent"in window||delete Mf.transitionend.transition);function Ch(h){if(tP[h])return tP[h];if(!Mf[h])return h;var g=Mf[h],S;for(S in g)if(g.hasOwnProperty(S)&&S in QI)return tP[h]=g[S];return h}var ZI=Ch("animationend"),JI=Ch("animationiteration"),e5=Ch("animationstart"),voe=Ch("transitionrun"),woe=Ch("transitionstart"),Soe=Ch("transitioncancel"),t5=Ch("transitionend"),n5=new Map,nP="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(" ");nP.push("scrollEnd");function Fl(h,g){n5.set(h,g),st(g,[h])}var bw=typeof reportError=="function"?reportError:function(h){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var g=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(g))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",h);return}console.error(h)},Bo=[],Ef=0,rP=0;function xw(){for(var h=Ef,g=rP=Ef=0;g<h;){var S=Bo[g];Bo[g++]=null;var M=Bo[g];Bo[g++]=null;var H=Bo[g];Bo[g++]=null;var Y=Bo[g];if(Bo[g++]=null,M!==null&&H!==null){var we=M.pending;we===null?H.next=H:(H.next=we.next,we.next=H),M.pending=H}Y!==0&&r5(S,H,Y)}}function yw(h,g,S,M){Bo[Ef++]=h,Bo[Ef++]=g,Bo[Ef++]=S,Bo[Ef++]=M,rP|=M,h.lanes|=M,h=h.alternate,h!==null&&(h.lanes|=M)}function iP(h,g,S,M){return yw(h,g,S,M),vw(h)}function Th(h,g){return yw(h,null,null,g),vw(h)}function r5(h,g,S){h.lanes|=S;var M=h.alternate;M!==null&&(M.lanes|=S);for(var H=!1,Y=h.return;Y!==null;)Y.childLanes|=S,M=Y.alternate,M!==null&&(M.childLanes|=S),Y.tag===22&&(h=Y.stateNode,h===null||h._visibility&1||(H=!0)),h=Y,Y=Y.return;return h.tag===3?(Y=h.stateNode,H&&g!==null&&(H=31-ke(S),h=Y.hiddenUpdates,M=h[H],M===null?h[H]=[g]:M.push(g),g.lane=S|536870912),Y):null}function vw(h){if(50<ry)throw ry=0,hA=null,Error(r(185));for(var g=h.return;g!==null;)h=g,g=h.return;return h.tag===3?h.stateNode:null}var jf={};function _oe(h,g,S,M){this.tag=h,this.key=S,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=g,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=M,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function xo(h,g,S,M){return new _oe(h,g,S,M)}function aP(h){return h=h.prototype,!(!h||!h.isReactComponent)}function ad(h,g){var S=h.alternate;return S===null?(S=xo(h.tag,g,h.key,h.mode),S.elementType=h.elementType,S.type=h.type,S.stateNode=h.stateNode,S.alternate=h,h.alternate=S):(S.pendingProps=g,S.type=h.type,S.flags=0,S.subtreeFlags=0,S.deletions=null),S.flags=h.flags&65011712,S.childLanes=h.childLanes,S.lanes=h.lanes,S.child=h.child,S.memoizedProps=h.memoizedProps,S.memoizedState=h.memoizedState,S.updateQueue=h.updateQueue,g=h.dependencies,S.dependencies=g===null?null:{lanes:g.lanes,firstContext:g.firstContext},S.sibling=h.sibling,S.index=h.index,S.ref=h.ref,S.refCleanup=h.refCleanup,S}function i5(h,g){h.flags&=65011714;var S=h.alternate;return S===null?(h.childLanes=0,h.lanes=g,h.child=null,h.subtreeFlags=0,h.memoizedProps=null,h.memoizedState=null,h.updateQueue=null,h.dependencies=null,h.stateNode=null):(h.childLanes=S.childLanes,h.lanes=S.lanes,h.child=S.child,h.subtreeFlags=0,h.deletions=null,h.memoizedProps=S.memoizedProps,h.memoizedState=S.memoizedState,h.updateQueue=S.updateQueue,h.type=S.type,g=S.dependencies,h.dependencies=g===null?null:{lanes:g.lanes,firstContext:g.firstContext}),h}function ww(h,g,S,M,H,Y){var we=0;if(M=h,typeof h=="function")aP(h)&&(we=1);else if(typeof h=="string")we=Ple(h,S,pe.current)?26:h==="html"||h==="head"||h==="body"?27:5;else e:switch(h){case A:return h=xo(31,S,g,H),h.elementType=A,h.lanes=Y,h;case x:return Ph(S.children,H,Y,g);case b:we=8,H|=24;break;case v:return h=xo(12,S,g,H|2),h.elementType=v,h.lanes=Y,h;case C:return h=xo(13,S,g,H),h.elementType=C,h.lanes=Y,h;case T:return h=xo(19,S,g,H),h.elementType=T,h.lanes=Y,h;default:if(typeof h=="object"&&h!==null)switch(h.$$typeof){case k:we=10;break e;case _:we=9;break e;case P:we=11;break e;case N:we=14;break e;case R:we=16,M=null;break e}we=29,S=Error(r(130,h===null?"null":typeof h,"")),M=null}return g=xo(we,S,g,H),g.elementType=h,g.type=M,g.lanes=Y,g}function Ph(h,g,S,M){return h=xo(7,h,M,g),h.lanes=S,h}function sP(h,g,S){return h=xo(6,h,null,g),h.lanes=S,h}function a5(h){var g=xo(18,null,null,0);return g.stateNode=h,g}function oP(h,g,S){return g=xo(4,h.children!==null?h.children:[],h.key,g),g.lanes=S,g.stateNode={containerInfo:h.containerInfo,pendingChildren:null,implementation:h.implementation},g}var s5=new WeakMap;function Ho(h,g){if(typeof h=="object"&&h!==null){var S=s5.get(h);return S!==void 0?S:(g={value:h,source:g,stack:ne(g)},s5.set(h,g),g)}return{value:h,source:g,stack:ne(g)}}var Df=[],Rf=0,Sw=null,Lx=0,$o=[],qo=0,Au=null,hc=1,pc="";function sd(h,g){Df[Rf++]=Lx,Df[Rf++]=Sw,Sw=h,Lx=g}function o5(h,g,S){$o[qo++]=hc,$o[qo++]=pc,$o[qo++]=Au,Au=h;var M=hc;h=pc;var H=32-ke(M)-1;M&=~(1<<H),S+=1;var Y=32-ke(g)+H;if(30<Y){var we=H-H%5;Y=(M&(1<<we)-1).toString(32),M>>=we,H-=we,hc=1<<32-ke(g)+H|S<<H|M,pc=Y+h}else hc=1<<Y|S<<H|M,pc=h}function lP(h){h.return!==null&&(sd(h,1),o5(h,1,0))}function cP(h){for(;h===Sw;)Sw=Df[--Rf],Df[Rf]=null,Lx=Df[--Rf],Df[Rf]=null;for(;h===Au;)Au=$o[--qo],$o[qo]=null,pc=$o[--qo],$o[qo]=null,hc=$o[--qo],$o[qo]=null}function l5(h,g){$o[qo++]=hc,$o[qo++]=pc,$o[qo++]=Au,hc=g.id,pc=g.overflow,Au=h}var Ua=null,ii=null,ur=!1,Mu=null,Vo=!1,dP=Error(r(519));function Eu(h){var g=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Ox(Ho(g,h)),dP}function c5(h){var g=h.stateNode,S=h.type,M=h.memoizedProps;switch(g[nn]=h,g[on]=M,S){case"dialog":ar("cancel",g),ar("close",g);break;case"iframe":case"object":case"embed":ar("load",g);break;case"video":case"audio":for(S=0;S<ay.length;S++)ar(ay[S],g);break;case"source":ar("error",g);break;case"img":case"image":case"link":ar("error",g),ar("load",g);break;case"details":ar("toggle",g);break;case"input":ar("invalid",g),zn(g,M.value,M.defaultValue,M.checked,M.defaultChecked,M.type,M.name,!0);break;case"select":ar("invalid",g);break;case"textarea":ar("invalid",g),ni(g,M.value,M.defaultValue,M.children)}S=M.children,typeof S!="string"&&typeof S!="number"&&typeof S!="bigint"||g.textContent===""+S||M.suppressHydrationWarning===!0||CU(g.textContent,S)?(M.popover!=null&&(ar("beforetoggle",g),ar("toggle",g)),M.onScroll!=null&&ar("scroll",g),M.onScrollEnd!=null&&ar("scrollend",g),M.onClick!=null&&(g.onclick=Ki),g=!0):g=!1,g||Eu(h,!0)}function d5(h){for(Ua=h.return;Ua;)switch(Ua.tag){case 5:case 31:case 13:Vo=!1;return;case 27:case 3:Vo=!0;return;default:Ua=Ua.return}}function Ff(h){if(h!==Ua)return!1;if(!ur)return d5(h),ur=!0,!1;var g=h.tag,S;if((S=g!==3&&g!==27)&&((S=g===5)&&(S=h.type,S=!(S!=="form"&&S!=="button")||PA(h.type,h.memoizedProps)),S=!S),S&&ii&&Eu(h),d5(h),g===13){if(h=h.memoizedState,h=h!==null?h.dehydrated:null,!h)throw Error(r(317));ii=FU(h)}else if(g===31){if(h=h.memoizedState,h=h!==null?h.dehydrated:null,!h)throw Error(r(317));ii=FU(h)}else g===27?(g=ii,Vu(h.type)?(h=DA,DA=null,ii=h):ii=g):ii=Ua?Wo(h.stateNode.nextSibling):null;return!0}function Ah(){ii=Ua=null,ur=!1}function uP(){var h=Mu;return h!==null&&(Ys===null?Ys=h:Ys.push.apply(Ys,h),Mu=null),h}function Ox(h){Mu===null?Mu=[h]:Mu.push(h)}var mP=X(null),Mh=null,od=null;function ju(h,g,S){le(mP,g._currentValue),g._currentValue=S}function ld(h){h._currentValue=mP.current,ie(mP)}function hP(h,g,S){for(;h!==null;){var M=h.alternate;if((h.childLanes&g)!==g?(h.childLanes|=g,M!==null&&(M.childLanes|=g)):M!==null&&(M.childLanes&g)!==g&&(M.childLanes|=g),h===S)break;h=h.return}}function pP(h,g,S,M){var H=h.child;for(H!==null&&(H.return=h);H!==null;){var Y=H.dependencies;if(Y!==null){var we=H.child;Y=Y.firstContext;e:for(;Y!==null;){var Oe=Y;Y=H;for(var Qe=0;Qe<g.length;Qe++)if(Oe.context===g[Qe]){Y.lanes|=S,Oe=Y.alternate,Oe!==null&&(Oe.lanes|=S),hP(Y.return,S,h),M||(we=null);break e}Y=Oe.next}}else if(H.tag===18){if(we=H.return,we===null)throw Error(r(341));we.lanes|=S,Y=we.alternate,Y!==null&&(Y.lanes|=S),hP(we,S,h),we=null}else we=H.child;if(we!==null)we.return=H;else for(we=H;we!==null;){if(we===h){we=null;break}if(H=we.sibling,H!==null){H.return=we.return,we=H;break}we=we.return}H=we}}function Lf(h,g,S,M){h=null;for(var H=g,Y=!1;H!==null;){if(!Y){if((H.flags&524288)!==0)Y=!0;else if((H.flags&262144)!==0)break}if(H.tag===10){var we=H.alternate;if(we===null)throw Error(r(387));if(we=we.memoizedProps,we!==null){var Oe=H.type;bo(H.pendingProps.value,we.value)||(h!==null?h.push(Oe):h=[Oe])}}else if(H===Z.current){if(we=H.alternate,we===null)throw Error(r(387));we.memoizedState.memoizedState!==H.memoizedState.memoizedState&&(h!==null?h.push(dy):h=[dy])}H=H.return}h!==null&&pP(g,h,S,M),g.flags|=262144}function _w(h){for(h=h.firstContext;h!==null;){if(!bo(h.context._currentValue,h.memoizedValue))return!0;h=h.next}return!1}function Eh(h){Mh=h,od=null,h=h.dependencies,h!==null&&(h.firstContext=null)}function Ba(h){return u5(Mh,h)}function kw(h,g){return Mh===null&&Eh(h),u5(h,g)}function u5(h,g){var S=g._currentValue;if(g={context:g,memoizedValue:S,next:null},od===null){if(h===null)throw Error(r(308));od=g,h.dependencies={lanes:0,firstContext:g},h.flags|=524288}else od=od.next=g;return S}var koe=typeof AbortController<"u"?AbortController:function(){var h=[],g=this.signal={aborted:!1,addEventListener:function(S,M){h.push(M)}};this.abort=function(){g.aborted=!0,h.forEach(function(S){return S()})}},Noe=t.unstable_scheduleCallback,Coe=t.unstable_NormalPriority,Xi={$$typeof:k,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function fP(){return{controller:new koe,data:new Map,refCount:0}}function Ix(h){h.refCount--,h.refCount===0&&Noe(Coe,function(){h.controller.abort()})}var zx=null,gP=0,Of=0,If=null;function Toe(h,g){if(zx===null){var S=zx=[];gP=0,Of=yA(),If={status:"pending",value:void 0,then:function(M){S.push(M)}}}return gP++,g.then(m5,m5),g}function m5(){if(--gP===0&&zx!==null){If!==null&&(If.status="fulfilled");var h=zx;zx=null,Of=0,If=null;for(var g=0;g<h.length;g++)(0,h[g])()}}function Poe(h,g){var S=[],M={status:"pending",value:null,reason:null,then:function(H){S.push(H)}};return h.then(function(){M.status="fulfilled",M.value=g;for(var H=0;H<S.length;H++)(0,S[H])(g)},function(H){for(M.status="rejected",M.reason=H,H=0;H<S.length;H++)(0,S[H])(void 0)}),M}var h5=re.S;re.S=function(h,g){Xz=F(),typeof g=="object"&&g!==null&&typeof g.then=="function"&&Toe(h,g),h5!==null&&h5(h,g)};var jh=X(null);function bP(){var h=jh.current;return h!==null?h:Wr.pooledCache}function Nw(h,g){g===null?le(jh,jh.current):le(jh,g.pool)}function p5(){var h=bP();return h===null?null:{parent:Xi._currentValue,pool:h}}var zf=Error(r(460)),xP=Error(r(474)),Cw=Error(r(542)),Tw={then:function(){}};function f5(h){return h=h.status,h==="fulfilled"||h==="rejected"}function g5(h,g,S){switch(S=h[S],S===void 0?h.push(g):S!==g&&(g.then(Ki,Ki),g=S),g.status){case"fulfilled":return g.value;case"rejected":throw h=g.reason,x5(h),h;default:if(typeof g.status=="string")g.then(Ki,Ki);else{if(h=Wr,h!==null&&100<h.shellSuspendCounter)throw Error(r(482));h=g,h.status="pending",h.then(function(M){if(g.status==="pending"){var H=g;H.status="fulfilled",H.value=M}},function(M){if(g.status==="pending"){var H=g;H.status="rejected",H.reason=M}})}switch(g.status){case"fulfilled":return g.value;case"rejected":throw h=g.reason,x5(h),h}throw Rh=g,zf}}function Dh(h){try{var g=h._init;return g(h._payload)}catch(S){throw S!==null&&typeof S=="object"&&typeof S.then=="function"?(Rh=S,zf):S}}var Rh=null;function b5(){if(Rh===null)throw Error(r(459));var h=Rh;return Rh=null,h}function x5(h){if(h===zf||h===Cw)throw Error(r(483))}var Uf=null,Ux=0;function Pw(h){var g=Ux;return Ux+=1,Uf===null&&(Uf=[]),g5(Uf,h,g)}function Bx(h,g){g=g.props.ref,h.ref=g!==void 0?g:null}function Aw(h,g){throw g.$$typeof===p?Error(r(525)):(h=Object.prototype.toString.call(g),Error(r(31,h==="[object Object]"?"object with keys {"+Object.keys(g).join(", ")+"}":h)))}function y5(h){function g(dt,nt){if(h){var gt=dt.deletions;gt===null?(dt.deletions=[nt],dt.flags|=16):gt.push(nt)}}function S(dt,nt){if(!h)return null;for(;nt!==null;)g(dt,nt),nt=nt.sibling;return null}function M(dt){for(var nt=new Map;dt!==null;)dt.key!==null?nt.set(dt.key,dt):nt.set(dt.index,dt),dt=dt.sibling;return nt}function H(dt,nt){return dt=ad(dt,nt),dt.index=0,dt.sibling=null,dt}function Y(dt,nt,gt){return dt.index=gt,h?(gt=dt.alternate,gt!==null?(gt=gt.index,gt<nt?(dt.flags|=67108866,nt):gt):(dt.flags|=67108866,nt)):(dt.flags|=1048576,nt)}function we(dt){return h&&dt.alternate===null&&(dt.flags|=67108866),dt}function Oe(dt,nt,gt,At){return nt===null||nt.tag!==6?(nt=sP(gt,dt.mode,At),nt.return=dt,nt):(nt=H(nt,gt),nt.return=dt,nt)}function Qe(dt,nt,gt,At){var hn=gt.type;return hn===x?Ct(dt,nt,gt.props.children,At,gt.key):nt!==null&&(nt.elementType===hn||typeof hn=="object"&&hn!==null&&hn.$$typeof===R&&Dh(hn)===nt.type)?(nt=H(nt,gt.props),Bx(nt,gt),nt.return=dt,nt):(nt=ww(gt.type,gt.key,gt.props,null,dt.mode,At),Bx(nt,gt),nt.return=dt,nt)}function xt(dt,nt,gt,At){return nt===null||nt.tag!==4||nt.stateNode.containerInfo!==gt.containerInfo||nt.stateNode.implementation!==gt.implementation?(nt=oP(gt,dt.mode,At),nt.return=dt,nt):(nt=H(nt,gt.children||[]),nt.return=dt,nt)}function Ct(dt,nt,gt,At,hn){return nt===null||nt.tag!==7?(nt=Ph(gt,dt.mode,At,hn),nt.return=dt,nt):(nt=H(nt,gt),nt.return=dt,nt)}function Et(dt,nt,gt){if(typeof nt=="string"&&nt!==""||typeof nt=="number"||typeof nt=="bigint")return nt=sP(""+nt,dt.mode,gt),nt.return=dt,nt;if(typeof nt=="object"&&nt!==null){switch(nt.$$typeof){case f:return gt=ww(nt.type,nt.key,nt.props,null,dt.mode,gt),Bx(gt,nt),gt.return=dt,gt;case y:return nt=oP(nt,dt.mode,gt),nt.return=dt,nt;case R:return nt=Dh(nt),Et(dt,nt,gt)}if(te(nt)||U(nt))return nt=Ph(nt,dt.mode,gt,null),nt.return=dt,nt;if(typeof nt.then=="function")return Et(dt,Pw(nt),gt);if(nt.$$typeof===k)return Et(dt,kw(dt,nt),gt);Aw(dt,nt)}return null}function vt(dt,nt,gt,At){var hn=nt!==null?nt.key:null;if(typeof gt=="string"&>!==""||typeof gt=="number"||typeof gt=="bigint")return hn!==null?null:Oe(dt,nt,""+gt,At);if(typeof gt=="object"&>!==null){switch(gt.$$typeof){case f:return gt.key===hn?Qe(dt,nt,gt,At):null;case y:return gt.key===hn?xt(dt,nt,gt,At):null;case R:return gt=Dh(gt),vt(dt,nt,gt,At)}if(te(gt)||U(gt))return hn!==null?null:Ct(dt,nt,gt,At,null);if(typeof gt.then=="function")return vt(dt,nt,Pw(gt),At);if(gt.$$typeof===k)return vt(dt,nt,kw(dt,gt),At);Aw(dt,gt)}return null}function _t(dt,nt,gt,At,hn){if(typeof At=="string"&&At!==""||typeof At=="number"||typeof At=="bigint")return dt=dt.get(gt)||null,Oe(nt,dt,""+At,hn);if(typeof At=="object"&&At!==null){switch(At.$$typeof){case f:return dt=dt.get(At.key===null?gt:At.key)||null,Qe(nt,dt,At,hn);case y:return dt=dt.get(At.key===null?gt:At.key)||null,xt(nt,dt,At,hn);case R:return At=Dh(At),_t(dt,nt,gt,At,hn)}if(te(At)||U(At))return dt=dt.get(gt)||null,Ct(nt,dt,At,hn,null);if(typeof At.then=="function")return _t(dt,nt,gt,Pw(At),hn);if(At.$$typeof===k)return _t(dt,nt,gt,kw(nt,At),hn);Aw(nt,At)}return null}function Jt(dt,nt,gt,At){for(var hn=null,gr=null,an=nt,Hn=nt=0,dr=null;an!==null&&Hn<gt.length;Hn++){an.index>Hn?(dr=an,an=null):dr=an.sibling;var br=vt(dt,an,gt[Hn],At);if(br===null){an===null&&(an=dr);break}h&&an&&br.alternate===null&&g(dt,an),nt=Y(br,nt,Hn),gr===null?hn=br:gr.sibling=br,gr=br,an=dr}if(Hn===gt.length)return S(dt,an),ur&&sd(dt,Hn),hn;if(an===null){for(;Hn<gt.length;Hn++)an=Et(dt,gt[Hn],At),an!==null&&(nt=Y(an,nt,Hn),gr===null?hn=an:gr.sibling=an,gr=an);return ur&&sd(dt,Hn),hn}for(an=M(an);Hn<gt.length;Hn++)dr=_t(an,dt,Hn,gt[Hn],At),dr!==null&&(h&&dr.alternate!==null&&an.delete(dr.key===null?Hn:dr.key),nt=Y(dr,nt,Hn),gr===null?hn=dr:gr.sibling=dr,gr=dr);return h&&an.forEach(function(Xu){return g(dt,Xu)}),ur&&sd(dt,Hn),hn}function Sn(dt,nt,gt,At){if(gt==null)throw Error(r(151));for(var hn=null,gr=null,an=nt,Hn=nt=0,dr=null,br=gt.next();an!==null&&!br.done;Hn++,br=gt.next()){an.index>Hn?(dr=an,an=null):dr=an.sibling;var Xu=vt(dt,an,br.value,At);if(Xu===null){an===null&&(an=dr);break}h&&an&&Xu.alternate===null&&g(dt,an),nt=Y(Xu,nt,Hn),gr===null?hn=Xu:gr.sibling=Xu,gr=Xu,an=dr}if(br.done)return S(dt,an),ur&&sd(dt,Hn),hn;if(an===null){for(;!br.done;Hn++,br=gt.next())br=Et(dt,br.value,At),br!==null&&(nt=Y(br,nt,Hn),gr===null?hn=br:gr.sibling=br,gr=br);return ur&&sd(dt,Hn),hn}for(an=M(an);!br.done;Hn++,br=gt.next())br=_t(an,dt,Hn,br.value,At),br!==null&&(h&&br.alternate!==null&&an.delete(br.key===null?Hn:br.key),nt=Y(br,nt,Hn),gr===null?hn=br:gr.sibling=br,gr=br);return h&&an.forEach(function(zle){return g(dt,zle)}),ur&&sd(dt,Hn),hn}function Ir(dt,nt,gt,At){if(typeof gt=="object"&>!==null&>.type===x&>.key===null&&(gt=gt.props.children),typeof gt=="object"&>!==null){switch(gt.$$typeof){case f:e:{for(var hn=gt.key;nt!==null;){if(nt.key===hn){if(hn=gt.type,hn===x){if(nt.tag===7){S(dt,nt.sibling),At=H(nt,gt.props.children),At.return=dt,dt=At;break e}}else if(nt.elementType===hn||typeof hn=="object"&&hn!==null&&hn.$$typeof===R&&Dh(hn)===nt.type){S(dt,nt.sibling),At=H(nt,gt.props),Bx(At,gt),At.return=dt,dt=At;break e}S(dt,nt);break}else g(dt,nt);nt=nt.sibling}gt.type===x?(At=Ph(gt.props.children,dt.mode,At,gt.key),At.return=dt,dt=At):(At=ww(gt.type,gt.key,gt.props,null,dt.mode,At),Bx(At,gt),At.return=dt,dt=At)}return we(dt);case y:e:{for(hn=gt.key;nt!==null;){if(nt.key===hn)if(nt.tag===4&&nt.stateNode.containerInfo===gt.containerInfo&&nt.stateNode.implementation===gt.implementation){S(dt,nt.sibling),At=H(nt,gt.children||[]),At.return=dt,dt=At;break e}else{S(dt,nt);break}else g(dt,nt);nt=nt.sibling}At=oP(gt,dt.mode,At),At.return=dt,dt=At}return we(dt);case R:return gt=Dh(gt),Ir(dt,nt,gt,At)}if(te(gt))return Jt(dt,nt,gt,At);if(U(gt)){if(hn=U(gt),typeof hn!="function")throw Error(r(150));return gt=hn.call(gt),Sn(dt,nt,gt,At)}if(typeof gt.then=="function")return Ir(dt,nt,Pw(gt),At);if(gt.$$typeof===k)return Ir(dt,nt,kw(dt,gt),At);Aw(dt,gt)}return typeof gt=="string"&>!==""||typeof gt=="number"||typeof gt=="bigint"?(gt=""+gt,nt!==null&&nt.tag===6?(S(dt,nt.sibling),At=H(nt,gt),At.return=dt,dt=At):(S(dt,nt),At=sP(gt,dt.mode,At),At.return=dt,dt=At),we(dt)):S(dt,nt)}return function(dt,nt,gt,At){try{Ux=0;var hn=Ir(dt,nt,gt,At);return Uf=null,hn}catch(an){if(an===zf||an===Cw)throw an;var gr=xo(29,an,null,dt.mode);return gr.lanes=At,gr.return=dt,gr}}}var Fh=y5(!0),v5=y5(!1),Du=!1;function yP(h){h.updateQueue={baseState:h.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function vP(h,g){h=h.updateQueue,g.updateQueue===h&&(g.updateQueue={baseState:h.baseState,firstBaseUpdate:h.firstBaseUpdate,lastBaseUpdate:h.lastBaseUpdate,shared:h.shared,callbacks:null})}function Ru(h){return{lane:h,tag:0,payload:null,callback:null,next:null}}function Fu(h,g,S){var M=h.updateQueue;if(M===null)return null;if(M=M.shared,(Sr&2)!==0){var H=M.pending;return H===null?g.next=g:(g.next=H.next,H.next=g),M.pending=g,g=vw(h),r5(h,null,S),g}return yw(h,M,g,S),vw(h)}function Hx(h,g,S){if(g=g.updateQueue,g!==null&&(g=g.shared,(S&4194048)!==0)){var M=g.lanes;M&=h.pendingLanes,S|=M,g.lanes=S,ht(h,S)}}function wP(h,g){var S=h.updateQueue,M=h.alternate;if(M!==null&&(M=M.updateQueue,S===M)){var H=null,Y=null;if(S=S.firstBaseUpdate,S!==null){do{var we={lane:S.lane,tag:S.tag,payload:S.payload,callback:null,next:null};Y===null?H=Y=we:Y=Y.next=we,S=S.next}while(S!==null);Y===null?H=Y=g:Y=Y.next=g}else H=Y=g;S={baseState:M.baseState,firstBaseUpdate:H,lastBaseUpdate:Y,shared:M.shared,callbacks:M.callbacks},h.updateQueue=S;return}h=S.lastBaseUpdate,h===null?S.firstBaseUpdate=g:h.next=g,S.lastBaseUpdate=g}var SP=!1;function $x(){if(SP){var h=If;if(h!==null)throw h}}function qx(h,g,S,M){SP=!1;var H=h.updateQueue;Du=!1;var Y=H.firstBaseUpdate,we=H.lastBaseUpdate,Oe=H.shared.pending;if(Oe!==null){H.shared.pending=null;var Qe=Oe,xt=Qe.next;Qe.next=null,we===null?Y=xt:we.next=xt,we=Qe;var Ct=h.alternate;Ct!==null&&(Ct=Ct.updateQueue,Oe=Ct.lastBaseUpdate,Oe!==we&&(Oe===null?Ct.firstBaseUpdate=xt:Oe.next=xt,Ct.lastBaseUpdate=Qe))}if(Y!==null){var Et=H.baseState;we=0,Ct=xt=Qe=null,Oe=Y;do{var vt=Oe.lane&-536870913,_t=vt!==Oe.lane;if(_t?(cr&vt)===vt:(M&vt)===vt){vt!==0&&vt===Of&&(SP=!0),Ct!==null&&(Ct=Ct.next={lane:0,tag:Oe.tag,payload:Oe.payload,callback:null,next:null});e:{var Jt=h,Sn=Oe;vt=g;var Ir=S;switch(Sn.tag){case 1:if(Jt=Sn.payload,typeof Jt=="function"){Et=Jt.call(Ir,Et,vt);break e}Et=Jt;break e;case 3:Jt.flags=Jt.flags&-65537|128;case 0:if(Jt=Sn.payload,vt=typeof Jt=="function"?Jt.call(Ir,Et,vt):Jt,vt==null)break e;Et=m({},Et,vt);break e;case 2:Du=!0}}vt=Oe.callback,vt!==null&&(h.flags|=64,_t&&(h.flags|=8192),_t=H.callbacks,_t===null?H.callbacks=[vt]:_t.push(vt))}else _t={lane:vt,tag:Oe.tag,payload:Oe.payload,callback:Oe.callback,next:null},Ct===null?(xt=Ct=_t,Qe=Et):Ct=Ct.next=_t,we|=vt;if(Oe=Oe.next,Oe===null){if(Oe=H.shared.pending,Oe===null)break;_t=Oe,Oe=_t.next,_t.next=null,H.lastBaseUpdate=_t,H.shared.pending=null}}while(!0);Ct===null&&(Qe=Et),H.baseState=Qe,H.firstBaseUpdate=xt,H.lastBaseUpdate=Ct,Y===null&&(H.shared.lanes=0),Uu|=we,h.lanes=we,h.memoizedState=Et}}function w5(h,g){if(typeof h!="function")throw Error(r(191,h));h.call(g)}function S5(h,g){var S=h.callbacks;if(S!==null)for(h.callbacks=null,h=0;h<S.length;h++)w5(S[h],g)}var Bf=X(null),Mw=X(0);function _5(h,g){h=bd,le(Mw,h),le(Bf,g),bd=h|g.baseLanes}function _P(){le(Mw,bd),le(Bf,Bf.current)}function kP(){bd=Mw.current,ie(Bf),ie(Mw)}var yo=X(null),Go=null;function Lu(h){var g=h.alternate;le(Bi,Bi.current&1),le(yo,h),Go===null&&(g===null||Bf.current!==null||g.memoizedState!==null)&&(Go=h)}function NP(h){le(Bi,Bi.current),le(yo,h),Go===null&&(Go=h)}function k5(h){h.tag===22?(le(Bi,Bi.current),le(yo,h),Go===null&&(Go=h)):Ou()}function Ou(){le(Bi,Bi.current),le(yo,yo.current)}function vo(h){ie(yo),Go===h&&(Go=null),ie(Bi)}var Bi=X(0);function Ew(h){for(var g=h;g!==null;){if(g.tag===13){var S=g.memoizedState;if(S!==null&&(S=S.dehydrated,S===null||EA(S)||jA(S)))return g}else if(g.tag===19&&(g.memoizedProps.revealOrder==="forwards"||g.memoizedProps.revealOrder==="backwards"||g.memoizedProps.revealOrder==="unstable_legacy-backwards"||g.memoizedProps.revealOrder==="together")){if((g.flags&128)!==0)return g}else if(g.child!==null){g.child.return=g,g=g.child;continue}if(g===h)break;for(;g.sibling===null;){if(g.return===null||g.return===h)return null;g=g.return}g.sibling.return=g.return,g=g.sibling}return null}var cd=0,Un=null,Lr=null,Qi=null,jw=!1,Hf=!1,Lh=!1,Dw=0,Vx=0,$f=null,Aoe=0;function Ti(){throw Error(r(321))}function CP(h,g){if(g===null)return!1;for(var S=0;S<g.length&&S<h.length;S++)if(!bo(h[S],g[S]))return!1;return!0}function TP(h,g,S,M,H,Y){return cd=Y,Un=g,g.memoizedState=null,g.updateQueue=null,g.lanes=0,re.H=h===null||h.memoizedState===null?oz:HP,Lh=!1,Y=S(M,H),Lh=!1,Hf&&(Y=C5(g,S,M,H)),N5(h),Y}function N5(h){re.H=Kx;var g=Lr!==null&&Lr.next!==null;if(cd=0,Qi=Lr=Un=null,jw=!1,Vx=0,$f=null,g)throw Error(r(300));h===null||Zi||(h=h.dependencies,h!==null&&_w(h)&&(Zi=!0))}function C5(h,g,S,M){Un=h;var H=0;do{if(Hf&&($f=null),Vx=0,Hf=!1,25<=H)throw Error(r(301));if(H+=1,Qi=Lr=null,h.updateQueue!=null){var Y=h.updateQueue;Y.lastEffect=null,Y.events=null,Y.stores=null,Y.memoCache!=null&&(Y.memoCache.index=0)}re.H=lz,Y=g(S,M)}while(Hf);return Y}function Moe(){var h=re.H,g=h.useState()[0];return g=typeof g.then=="function"?Gx(g):g,h=h.useState()[0],(Lr!==null?Lr.memoizedState:null)!==h&&(Un.flags|=1024),g}function PP(){var h=Dw!==0;return Dw=0,h}function AP(h,g,S){g.updateQueue=h.updateQueue,g.flags&=-2053,h.lanes&=~S}function MP(h){if(jw){for(h=h.memoizedState;h!==null;){var g=h.queue;g!==null&&(g.pending=null),h=h.next}jw=!1}cd=0,Qi=Lr=Un=null,Hf=!1,Vx=Dw=0,$f=null}function Ns(){var h={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Qi===null?Un.memoizedState=Qi=h:Qi=Qi.next=h,Qi}function Hi(){if(Lr===null){var h=Un.alternate;h=h!==null?h.memoizedState:null}else h=Lr.next;var g=Qi===null?Un.memoizedState:Qi.next;if(g!==null)Qi=g,Lr=h;else{if(h===null)throw Un.alternate===null?Error(r(467)):Error(r(310));Lr=h,h={memoizedState:Lr.memoizedState,baseState:Lr.baseState,baseQueue:Lr.baseQueue,queue:Lr.queue,next:null},Qi===null?Un.memoizedState=Qi=h:Qi=Qi.next=h}return Qi}function Rw(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Gx(h){var g=Vx;return Vx+=1,$f===null&&($f=[]),h=g5($f,h,g),g=Un,(Qi===null?g.memoizedState:Qi.next)===null&&(g=g.alternate,re.H=g===null||g.memoizedState===null?oz:HP),h}function Fw(h){if(h!==null&&typeof h=="object"){if(typeof h.then=="function")return Gx(h);if(h.$$typeof===k)return Ba(h)}throw Error(r(438,String(h)))}function EP(h){var g=null,S=Un.updateQueue;if(S!==null&&(g=S.memoCache),g==null){var M=Un.alternate;M!==null&&(M=M.updateQueue,M!==null&&(M=M.memoCache,M!=null&&(g={data:M.data.map(function(H){return H.slice()}),index:0})))}if(g==null&&(g={data:[],index:0}),S===null&&(S=Rw(),Un.updateQueue=S),S.memoCache=g,S=g.data[g.index],S===void 0)for(S=g.data[g.index]=Array(h),M=0;M<h;M++)S[M]=D;return g.index++,S}function dd(h,g){return typeof g=="function"?g(h):g}function Lw(h){var g=Hi();return jP(g,Lr,h)}function jP(h,g,S){var M=h.queue;if(M===null)throw Error(r(311));M.lastRenderedReducer=S;var H=h.baseQueue,Y=M.pending;if(Y!==null){if(H!==null){var we=H.next;H.next=Y.next,Y.next=we}g.baseQueue=H=Y,M.pending=null}if(Y=h.baseState,H===null)h.memoizedState=Y;else{g=H.next;var Oe=we=null,Qe=null,xt=g,Ct=!1;do{var Et=xt.lane&-536870913;if(Et!==xt.lane?(cr&Et)===Et:(cd&Et)===Et){var vt=xt.revertLane;if(vt===0)Qe!==null&&(Qe=Qe.next={lane:0,revertLane:0,gesture:null,action:xt.action,hasEagerState:xt.hasEagerState,eagerState:xt.eagerState,next:null}),Et===Of&&(Ct=!0);else if((cd&vt)===vt){xt=xt.next,vt===Of&&(Ct=!0);continue}else Et={lane:0,revertLane:xt.revertLane,gesture:null,action:xt.action,hasEagerState:xt.hasEagerState,eagerState:xt.eagerState,next:null},Qe===null?(Oe=Qe=Et,we=Y):Qe=Qe.next=Et,Un.lanes|=vt,Uu|=vt;Et=xt.action,Lh&&S(Y,Et),Y=xt.hasEagerState?xt.eagerState:S(Y,Et)}else vt={lane:Et,revertLane:xt.revertLane,gesture:xt.gesture,action:xt.action,hasEagerState:xt.hasEagerState,eagerState:xt.eagerState,next:null},Qe===null?(Oe=Qe=vt,we=Y):Qe=Qe.next=vt,Un.lanes|=Et,Uu|=Et;xt=xt.next}while(xt!==null&&xt!==g);if(Qe===null?we=Y:Qe.next=Oe,!bo(Y,h.memoizedState)&&(Zi=!0,Ct&&(S=If,S!==null)))throw S;h.memoizedState=Y,h.baseState=we,h.baseQueue=Qe,M.lastRenderedState=Y}return H===null&&(M.lanes=0),[h.memoizedState,M.dispatch]}function DP(h){var g=Hi(),S=g.queue;if(S===null)throw Error(r(311));S.lastRenderedReducer=h;var M=S.dispatch,H=S.pending,Y=g.memoizedState;if(H!==null){S.pending=null;var we=H=H.next;do Y=h(Y,we.action),we=we.next;while(we!==H);bo(Y,g.memoizedState)||(Zi=!0),g.memoizedState=Y,g.baseQueue===null&&(g.baseState=Y),S.lastRenderedState=Y}return[Y,M]}function T5(h,g,S){var M=Un,H=Hi(),Y=ur;if(Y){if(S===void 0)throw Error(r(407));S=S()}else S=g();var we=!bo((Lr||H).memoizedState,S);if(we&&(H.memoizedState=S,Zi=!0),H=H.queue,LP(M5.bind(null,M,H,h),[h]),H.getSnapshot!==g||we||Qi!==null&&Qi.memoizedState.tag&1){if(M.flags|=2048,qf(9,{destroy:void 0},A5.bind(null,M,H,S,g),null),Wr===null)throw Error(r(349));Y||(cd&127)!==0||P5(M,g,S)}return S}function P5(h,g,S){h.flags|=16384,h={getSnapshot:g,value:S},g=Un.updateQueue,g===null?(g=Rw(),Un.updateQueue=g,g.stores=[h]):(S=g.stores,S===null?g.stores=[h]:S.push(h))}function A5(h,g,S,M){g.value=S,g.getSnapshot=M,E5(g)&&j5(h)}function M5(h,g,S){return S(function(){E5(g)&&j5(h)})}function E5(h){var g=h.getSnapshot;h=h.value;try{var S=g();return!bo(h,S)}catch{return!0}}function j5(h){var g=Th(h,2);g!==null&&Xs(g,h,2)}function RP(h){var g=Ns();if(typeof h=="function"){var S=h;if(h=S(),Lh){Ee(!0);try{S()}finally{Ee(!1)}}}return g.memoizedState=g.baseState=h,g.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:dd,lastRenderedState:h},g}function D5(h,g,S,M){return h.baseState=S,jP(h,Lr,typeof M=="function"?M:dd)}function Eoe(h,g,S,M,H){if(zw(h))throw Error(r(485));if(h=g.action,h!==null){var Y={payload:H,action:h,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(we){Y.listeners.push(we)}};re.T!==null?S(!0):Y.isTransition=!1,M(Y),S=g.pending,S===null?(Y.next=g.pending=Y,R5(g,Y)):(Y.next=S.next,g.pending=S.next=Y)}}function R5(h,g){var S=g.action,M=g.payload,H=h.state;if(g.isTransition){var Y=re.T,we={};re.T=we;try{var Oe=S(H,M),Qe=re.S;Qe!==null&&Qe(we,Oe),F5(h,g,Oe)}catch(xt){FP(h,g,xt)}finally{Y!==null&&we.types!==null&&(Y.types=we.types),re.T=Y}}else try{Y=S(H,M),F5(h,g,Y)}catch(xt){FP(h,g,xt)}}function F5(h,g,S){S!==null&&typeof S=="object"&&typeof S.then=="function"?S.then(function(M){L5(h,g,M)},function(M){return FP(h,g,M)}):L5(h,g,S)}function L5(h,g,S){g.status="fulfilled",g.value=S,O5(g),h.state=S,g=h.pending,g!==null&&(S=g.next,S===g?h.pending=null:(S=S.next,g.next=S,R5(h,S)))}function FP(h,g,S){var M=h.pending;if(h.pending=null,M!==null){M=M.next;do g.status="rejected",g.reason=S,O5(g),g=g.next;while(g!==M)}h.action=null}function O5(h){h=h.listeners;for(var g=0;g<h.length;g++)(0,h[g])()}function I5(h,g){return g}function z5(h,g){if(ur){var S=Wr.formState;if(S!==null){e:{var M=Un;if(ur){if(ii){t:{for(var H=ii,Y=Vo;H.nodeType!==8;){if(!Y){H=null;break t}if(H=Wo(H.nextSibling),H===null){H=null;break t}}Y=H.data,H=Y==="F!"||Y==="F"?H:null}if(H){ii=Wo(H.nextSibling),M=H.data==="F!";break e}}Eu(M)}M=!1}M&&(g=S[0])}}return S=Ns(),S.memoizedState=S.baseState=g,M={pending:null,lanes:0,dispatch:null,lastRenderedReducer:I5,lastRenderedState:g},S.queue=M,S=iz.bind(null,Un,M),M.dispatch=S,M=RP(!1),Y=BP.bind(null,Un,!1,M.queue),M=Ns(),H={state:g,dispatch:null,action:h,pending:null},M.queue=H,S=Eoe.bind(null,Un,H,Y,S),H.dispatch=S,M.memoizedState=h,[g,S,!1]}function U5(h){var g=Hi();return B5(g,Lr,h)}function B5(h,g,S){if(g=jP(h,g,I5)[0],h=Lw(dd)[0],typeof g=="object"&&g!==null&&typeof g.then=="function")try{var M=Gx(g)}catch(we){throw we===zf?Cw:we}else M=g;g=Hi();var H=g.queue,Y=H.dispatch;return S!==g.memoizedState&&(Un.flags|=2048,qf(9,{destroy:void 0},joe.bind(null,H,S),null)),[M,Y,h]}function joe(h,g){h.action=g}function H5(h){var g=Hi(),S=Lr;if(S!==null)return B5(g,S,h);Hi(),g=g.memoizedState,S=Hi();var M=S.queue.dispatch;return S.memoizedState=h,[g,M,!1]}function qf(h,g,S,M){return h={tag:h,create:S,deps:M,inst:g,next:null},g=Un.updateQueue,g===null&&(g=Rw(),Un.updateQueue=g),S=g.lastEffect,S===null?g.lastEffect=h.next=h:(M=S.next,S.next=h,h.next=M,g.lastEffect=h),h}function $5(){return Hi().memoizedState}function Ow(h,g,S,M){var H=Ns();Un.flags|=h,H.memoizedState=qf(1|g,{destroy:void 0},S,M===void 0?null:M)}function Iw(h,g,S,M){var H=Hi();M=M===void 0?null:M;var Y=H.memoizedState.inst;Lr!==null&&M!==null&&CP(M,Lr.memoizedState.deps)?H.memoizedState=qf(g,Y,S,M):(Un.flags|=h,H.memoizedState=qf(1|g,Y,S,M))}function q5(h,g){Ow(8390656,8,h,g)}function LP(h,g){Iw(2048,8,h,g)}function Doe(h){Un.flags|=4;var g=Un.updateQueue;if(g===null)g=Rw(),Un.updateQueue=g,g.events=[h];else{var S=g.events;S===null?g.events=[h]:S.push(h)}}function V5(h){var g=Hi().memoizedState;return Doe({ref:g,nextImpl:h}),function(){if((Sr&2)!==0)throw Error(r(440));return g.impl.apply(void 0,arguments)}}function G5(h,g){return Iw(4,2,h,g)}function W5(h,g){return Iw(4,4,h,g)}function K5(h,g){if(typeof g=="function"){h=h();var S=g(h);return function(){typeof S=="function"?S():g(null)}}if(g!=null)return h=h(),g.current=h,function(){g.current=null}}function Y5(h,g,S){S=S!=null?S.concat([h]):null,Iw(4,4,K5.bind(null,g,h),S)}function OP(){}function X5(h,g){var S=Hi();g=g===void 0?null:g;var M=S.memoizedState;return g!==null&&CP(g,M[1])?M[0]:(S.memoizedState=[h,g],h)}function Q5(h,g){var S=Hi();g=g===void 0?null:g;var M=S.memoizedState;if(g!==null&&CP(g,M[1]))return M[0];if(M=h(),Lh){Ee(!0);try{h()}finally{Ee(!1)}}return S.memoizedState=[M,g],M}function IP(h,g,S){return S===void 0||(cd&1073741824)!==0&&(cr&261930)===0?h.memoizedState=g:(h.memoizedState=S,h=Zz(),Un.lanes|=h,Uu|=h,S)}function Z5(h,g,S,M){return bo(S,g)?S:Bf.current!==null?(h=IP(h,S,M),bo(h,g)||(Zi=!0),h):(cd&42)===0||(cd&1073741824)!==0&&(cr&261930)===0?(Zi=!0,h.memoizedState=S):(h=Zz(),Un.lanes|=h,Uu|=h,g)}function J5(h,g,S,M,H){var Y=J.p;J.p=Y!==0&&8>Y?Y:8;var we=re.T,Oe={};re.T=Oe,BP(h,!1,g,S);try{var Qe=H(),xt=re.S;if(xt!==null&&xt(Oe,Qe),Qe!==null&&typeof Qe=="object"&&typeof Qe.then=="function"){var Ct=Poe(Qe,M);Wx(h,g,Ct,_o(h))}else Wx(h,g,M,_o(h))}catch(Et){Wx(h,g,{then:function(){},status:"rejected",reason:Et},_o())}finally{J.p=Y,we!==null&&Oe.types!==null&&(we.types=Oe.types),re.T=we}}function Roe(){}function zP(h,g,S,M){if(h.tag!==5)throw Error(r(476));var H=ez(h).queue;J5(h,H,g,ue,S===null?Roe:function(){return tz(h),S(M)})}function ez(h){var g=h.memoizedState;if(g!==null)return g;g={memoizedState:ue,baseState:ue,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:dd,lastRenderedState:ue},next:null};var S={};return g.next={memoizedState:S,baseState:S,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:dd,lastRenderedState:S},next:null},h.memoizedState=g,h=h.alternate,h!==null&&(h.memoizedState=g),g}function tz(h){var g=ez(h);g.next===null&&(g=h.alternate.memoizedState),Wx(h,g.next.queue,{},_o())}function UP(){return Ba(dy)}function nz(){return Hi().memoizedState}function rz(){return Hi().memoizedState}function Foe(h){for(var g=h.return;g!==null;){switch(g.tag){case 24:case 3:var S=_o();h=Ru(S);var M=Fu(g,h,S);M!==null&&(Xs(M,g,S),Hx(M,g,S)),g={cache:fP()},h.payload=g;return}g=g.return}}function Loe(h,g,S){var M=_o();S={lane:M,revertLane:0,gesture:null,action:S,hasEagerState:!1,eagerState:null,next:null},zw(h)?az(g,S):(S=iP(h,g,S,M),S!==null&&(Xs(S,h,M),sz(S,g,M)))}function iz(h,g,S){var M=_o();Wx(h,g,S,M)}function Wx(h,g,S,M){var H={lane:M,revertLane:0,gesture:null,action:S,hasEagerState:!1,eagerState:null,next:null};if(zw(h))az(g,H);else{var Y=h.alternate;if(h.lanes===0&&(Y===null||Y.lanes===0)&&(Y=g.lastRenderedReducer,Y!==null))try{var we=g.lastRenderedState,Oe=Y(we,S);if(H.hasEagerState=!0,H.eagerState=Oe,bo(Oe,we))return yw(h,g,H,0),Wr===null&&xw(),!1}catch{}if(S=iP(h,g,H,M),S!==null)return Xs(S,h,M),sz(S,g,M),!0}return!1}function BP(h,g,S,M){if(M={lane:2,revertLane:yA(),gesture:null,action:M,hasEagerState:!1,eagerState:null,next:null},zw(h)){if(g)throw Error(r(479))}else g=iP(h,S,M,2),g!==null&&Xs(g,h,2)}function zw(h){var g=h.alternate;return h===Un||g!==null&&g===Un}function az(h,g){Hf=jw=!0;var S=h.pending;S===null?g.next=g:(g.next=S.next,S.next=g),h.pending=g}function sz(h,g,S){if((S&4194048)!==0){var M=g.lanes;M&=h.pendingLanes,S|=M,g.lanes=S,ht(h,S)}}var Kx={readContext:Ba,use:Fw,useCallback:Ti,useContext:Ti,useEffect:Ti,useImperativeHandle:Ti,useLayoutEffect:Ti,useInsertionEffect:Ti,useMemo:Ti,useReducer:Ti,useRef:Ti,useState:Ti,useDebugValue:Ti,useDeferredValue:Ti,useTransition:Ti,useSyncExternalStore:Ti,useId:Ti,useHostTransitionStatus:Ti,useFormState:Ti,useActionState:Ti,useOptimistic:Ti,useMemoCache:Ti,useCacheRefresh:Ti};Kx.useEffectEvent=Ti;var oz={readContext:Ba,use:Fw,useCallback:function(h,g){return Ns().memoizedState=[h,g===void 0?null:g],h},useContext:Ba,useEffect:q5,useImperativeHandle:function(h,g,S){S=S!=null?S.concat([h]):null,Ow(4194308,4,K5.bind(null,g,h),S)},useLayoutEffect:function(h,g){return Ow(4194308,4,h,g)},useInsertionEffect:function(h,g){Ow(4,2,h,g)},useMemo:function(h,g){var S=Ns();g=g===void 0?null:g;var M=h();if(Lh){Ee(!0);try{h()}finally{Ee(!1)}}return S.memoizedState=[M,g],M},useReducer:function(h,g,S){var M=Ns();if(S!==void 0){var H=S(g);if(Lh){Ee(!0);try{S(g)}finally{Ee(!1)}}}else H=g;return M.memoizedState=M.baseState=H,h={pending:null,lanes:0,dispatch:null,lastRenderedReducer:h,lastRenderedState:H},M.queue=h,h=h.dispatch=Loe.bind(null,Un,h),[M.memoizedState,h]},useRef:function(h){var g=Ns();return h={current:h},g.memoizedState=h},useState:function(h){h=RP(h);var g=h.queue,S=iz.bind(null,Un,g);return g.dispatch=S,[h.memoizedState,S]},useDebugValue:OP,useDeferredValue:function(h,g){var S=Ns();return IP(S,h,g)},useTransition:function(){var h=RP(!1);return h=J5.bind(null,Un,h.queue,!0,!1),Ns().memoizedState=h,[!1,h]},useSyncExternalStore:function(h,g,S){var M=Un,H=Ns();if(ur){if(S===void 0)throw Error(r(407));S=S()}else{if(S=g(),Wr===null)throw Error(r(349));(cr&127)!==0||P5(M,g,S)}H.memoizedState=S;var Y={value:S,getSnapshot:g};return H.queue=Y,q5(M5.bind(null,M,Y,h),[h]),M.flags|=2048,qf(9,{destroy:void 0},A5.bind(null,M,Y,S,g),null),S},useId:function(){var h=Ns(),g=Wr.identifierPrefix;if(ur){var S=pc,M=hc;S=(M&~(1<<32-ke(M)-1)).toString(32)+S,g="_"+g+"R_"+S,S=Dw++,0<S&&(g+="H"+S.toString(32)),g+="_"}else S=Aoe++,g="_"+g+"r_"+S.toString(32)+"_";return h.memoizedState=g},useHostTransitionStatus:UP,useFormState:z5,useActionState:z5,useOptimistic:function(h){var g=Ns();g.memoizedState=g.baseState=h;var S={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return g.queue=S,g=BP.bind(null,Un,!0,S),S.dispatch=g,[h,g]},useMemoCache:EP,useCacheRefresh:function(){return Ns().memoizedState=Foe.bind(null,Un)},useEffectEvent:function(h){var g=Ns(),S={impl:h};return g.memoizedState=S,function(){if((Sr&2)!==0)throw Error(r(440));return S.impl.apply(void 0,arguments)}}},HP={readContext:Ba,use:Fw,useCallback:X5,useContext:Ba,useEffect:LP,useImperativeHandle:Y5,useInsertionEffect:G5,useLayoutEffect:W5,useMemo:Q5,useReducer:Lw,useRef:$5,useState:function(){return Lw(dd)},useDebugValue:OP,useDeferredValue:function(h,g){var S=Hi();return Z5(S,Lr.memoizedState,h,g)},useTransition:function(){var h=Lw(dd)[0],g=Hi().memoizedState;return[typeof h=="boolean"?h:Gx(h),g]},useSyncExternalStore:T5,useId:nz,useHostTransitionStatus:UP,useFormState:U5,useActionState:U5,useOptimistic:function(h,g){var S=Hi();return D5(S,Lr,h,g)},useMemoCache:EP,useCacheRefresh:rz};HP.useEffectEvent=V5;var lz={readContext:Ba,use:Fw,useCallback:X5,useContext:Ba,useEffect:LP,useImperativeHandle:Y5,useInsertionEffect:G5,useLayoutEffect:W5,useMemo:Q5,useReducer:DP,useRef:$5,useState:function(){return DP(dd)},useDebugValue:OP,useDeferredValue:function(h,g){var S=Hi();return Lr===null?IP(S,h,g):Z5(S,Lr.memoizedState,h,g)},useTransition:function(){var h=DP(dd)[0],g=Hi().memoizedState;return[typeof h=="boolean"?h:Gx(h),g]},useSyncExternalStore:T5,useId:nz,useHostTransitionStatus:UP,useFormState:H5,useActionState:H5,useOptimistic:function(h,g){var S=Hi();return Lr!==null?D5(S,Lr,h,g):(S.baseState=h,[h,S.queue.dispatch])},useMemoCache:EP,useCacheRefresh:rz};lz.useEffectEvent=V5;function $P(h,g,S,M){g=h.memoizedState,S=S(M,g),S=S==null?g:m({},g,S),h.memoizedState=S,h.lanes===0&&(h.updateQueue.baseState=S)}var qP={enqueueSetState:function(h,g,S){h=h._reactInternals;var M=_o(),H=Ru(M);H.payload=g,S!=null&&(H.callback=S),g=Fu(h,H,M),g!==null&&(Xs(g,h,M),Hx(g,h,M))},enqueueReplaceState:function(h,g,S){h=h._reactInternals;var M=_o(),H=Ru(M);H.tag=1,H.payload=g,S!=null&&(H.callback=S),g=Fu(h,H,M),g!==null&&(Xs(g,h,M),Hx(g,h,M))},enqueueForceUpdate:function(h,g){h=h._reactInternals;var S=_o(),M=Ru(S);M.tag=2,g!=null&&(M.callback=g),g=Fu(h,M,S),g!==null&&(Xs(g,h,S),Hx(g,h,S))}};function cz(h,g,S,M,H,Y,we){return h=h.stateNode,typeof h.shouldComponentUpdate=="function"?h.shouldComponentUpdate(M,Y,we):g.prototype&&g.prototype.isPureReactComponent?!Rx(S,M)||!Rx(H,Y):!0}function dz(h,g,S,M){h=g.state,typeof g.componentWillReceiveProps=="function"&&g.componentWillReceiveProps(S,M),typeof g.UNSAFE_componentWillReceiveProps=="function"&&g.UNSAFE_componentWillReceiveProps(S,M),g.state!==h&&qP.enqueueReplaceState(g,g.state,null)}function Oh(h,g){var S=g;if("ref"in g){S={};for(var M in g)M!=="ref"&&(S[M]=g[M])}if(h=h.defaultProps){S===g&&(S=m({},S));for(var H in h)S[H]===void 0&&(S[H]=h[H])}return S}function uz(h){bw(h)}function mz(h){console.error(h)}function hz(h){bw(h)}function Uw(h,g){try{var S=h.onUncaughtError;S(g.value,{componentStack:g.stack})}catch(M){setTimeout(function(){throw M})}}function pz(h,g,S){try{var M=h.onCaughtError;M(S.value,{componentStack:S.stack,errorBoundary:g.tag===1?g.stateNode:null})}catch(H){setTimeout(function(){throw H})}}function VP(h,g,S){return S=Ru(S),S.tag=3,S.payload={element:null},S.callback=function(){Uw(h,g)},S}function fz(h){return h=Ru(h),h.tag=3,h}function gz(h,g,S,M){var H=S.type.getDerivedStateFromError;if(typeof H=="function"){var Y=M.value;h.payload=function(){return H(Y)},h.callback=function(){pz(g,S,M)}}var we=S.stateNode;we!==null&&typeof we.componentDidCatch=="function"&&(h.callback=function(){pz(g,S,M),typeof H!="function"&&(Bu===null?Bu=new Set([this]):Bu.add(this));var Oe=M.stack;this.componentDidCatch(M.value,{componentStack:Oe!==null?Oe:""})})}function Ooe(h,g,S,M,H){if(S.flags|=32768,M!==null&&typeof M=="object"&&typeof M.then=="function"){if(g=S.alternate,g!==null&&Lf(g,S,H,!0),S=yo.current,S!==null){switch(S.tag){case 31:case 13:return Go===null?Zw():S.alternate===null&&Pi===0&&(Pi=3),S.flags&=-257,S.flags|=65536,S.lanes=H,M===Tw?S.flags|=16384:(g=S.updateQueue,g===null?S.updateQueue=new Set([M]):g.add(M),gA(h,M,H)),!1;case 22:return S.flags|=65536,M===Tw?S.flags|=16384:(g=S.updateQueue,g===null?(g={transitions:null,markerInstances:null,retryQueue:new Set([M])},S.updateQueue=g):(S=g.retryQueue,S===null?g.retryQueue=new Set([M]):S.add(M)),gA(h,M,H)),!1}throw Error(r(435,S.tag))}return gA(h,M,H),Zw(),!1}if(ur)return g=yo.current,g!==null?((g.flags&65536)===0&&(g.flags|=256),g.flags|=65536,g.lanes=H,M!==dP&&(h=Error(r(422),{cause:M}),Ox(Ho(h,S)))):(M!==dP&&(g=Error(r(423),{cause:M}),Ox(Ho(g,S))),h=h.current.alternate,h.flags|=65536,H&=-H,h.lanes|=H,M=Ho(M,S),H=VP(h.stateNode,M,H),wP(h,H),Pi!==4&&(Pi=2)),!1;var Y=Error(r(520),{cause:M});if(Y=Ho(Y,S),ny===null?ny=[Y]:ny.push(Y),Pi!==4&&(Pi=2),g===null)return!0;M=Ho(M,S),S=g;do{switch(S.tag){case 3:return S.flags|=65536,h=H&-H,S.lanes|=h,h=VP(S.stateNode,M,h),wP(S,h),!1;case 1:if(g=S.type,Y=S.stateNode,(S.flags&128)===0&&(typeof g.getDerivedStateFromError=="function"||Y!==null&&typeof Y.componentDidCatch=="function"&&(Bu===null||!Bu.has(Y))))return S.flags|=65536,H&=-H,S.lanes|=H,H=fz(H),gz(H,h,S,M),wP(S,H),!1}S=S.return}while(S!==null);return!1}var GP=Error(r(461)),Zi=!1;function Ha(h,g,S,M){g.child=h===null?v5(g,null,S,M):Fh(g,h.child,S,M)}function bz(h,g,S,M,H){S=S.render;var Y=g.ref;if("ref"in M){var we={};for(var Oe in M)Oe!=="ref"&&(we[Oe]=M[Oe])}else we=M;return Eh(g),M=TP(h,g,S,we,Y,H),Oe=PP(),h!==null&&!Zi?(AP(h,g,H),ud(h,g,H)):(ur&&Oe&&lP(g),g.flags|=1,Ha(h,g,M,H),g.child)}function xz(h,g,S,M,H){if(h===null){var Y=S.type;return typeof Y=="function"&&!aP(Y)&&Y.defaultProps===void 0&&S.compare===null?(g.tag=15,g.type=Y,yz(h,g,Y,M,H)):(h=ww(S.type,null,M,g,g.mode,H),h.ref=g.ref,h.return=g,g.child=h)}if(Y=h.child,!eA(h,H)){var we=Y.memoizedProps;if(S=S.compare,S=S!==null?S:Rx,S(we,M)&&h.ref===g.ref)return ud(h,g,H)}return g.flags|=1,h=ad(Y,M),h.ref=g.ref,h.return=g,g.child=h}function yz(h,g,S,M,H){if(h!==null){var Y=h.memoizedProps;if(Rx(Y,M)&&h.ref===g.ref)if(Zi=!1,g.pendingProps=M=Y,eA(h,H))(h.flags&131072)!==0&&(Zi=!0);else return g.lanes=h.lanes,ud(h,g,H)}return WP(h,g,S,M,H)}function vz(h,g,S,M){var H=M.children,Y=h!==null?h.memoizedState:null;if(h===null&&g.stateNode===null&&(g.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),M.mode==="hidden"){if((g.flags&128)!==0){if(Y=Y!==null?Y.baseLanes|S:S,h!==null){for(M=g.child=h.child,H=0;M!==null;)H=H|M.lanes|M.childLanes,M=M.sibling;M=H&~Y}else M=0,g.child=null;return wz(h,g,Y,S,M)}if((S&536870912)!==0)g.memoizedState={baseLanes:0,cachePool:null},h!==null&&Nw(g,Y!==null?Y.cachePool:null),Y!==null?_5(g,Y):_P(),k5(g);else return M=g.lanes=536870912,wz(h,g,Y!==null?Y.baseLanes|S:S,S,M)}else Y!==null?(Nw(g,Y.cachePool),_5(g,Y),Ou(),g.memoizedState=null):(h!==null&&Nw(g,null),_P(),Ou());return Ha(h,g,H,S),g.child}function Yx(h,g){return h!==null&&h.tag===22||g.stateNode!==null||(g.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),g.sibling}function wz(h,g,S,M,H){var Y=bP();return Y=Y===null?null:{parent:Xi._currentValue,pool:Y},g.memoizedState={baseLanes:S,cachePool:Y},h!==null&&Nw(g,null),_P(),k5(g),h!==null&&Lf(h,g,M,!0),g.childLanes=H,null}function Bw(h,g){return g=$w({mode:g.mode,children:g.children},h.mode),g.ref=h.ref,h.child=g,g.return=h,g}function Sz(h,g,S){return Fh(g,h.child,null,S),h=Bw(g,g.pendingProps),h.flags|=2,vo(g),g.memoizedState=null,h}function Ioe(h,g,S){var M=g.pendingProps,H=(g.flags&128)!==0;if(g.flags&=-129,h===null){if(ur){if(M.mode==="hidden")return h=Bw(g,M),g.lanes=536870912,Yx(null,h);if(NP(g),(h=ii)?(h=RU(h,Vo),h=h!==null&&h.data==="&"?h:null,h!==null&&(g.memoizedState={dehydrated:h,treeContext:Au!==null?{id:hc,overflow:pc}:null,retryLane:536870912,hydrationErrors:null},S=a5(h),S.return=g,g.child=S,Ua=g,ii=null)):h=null,h===null)throw Eu(g);return g.lanes=536870912,null}return Bw(g,M)}var Y=h.memoizedState;if(Y!==null){var we=Y.dehydrated;if(NP(g),H)if(g.flags&256)g.flags&=-257,g=Sz(h,g,S);else if(g.memoizedState!==null)g.child=h.child,g.flags|=128,g=null;else throw Error(r(558));else if(Zi||Lf(h,g,S,!1),H=(S&h.childLanes)!==0,Zi||H){if(M=Wr,M!==null&&(we=yt(M,S),we!==0&&we!==Y.retryLane))throw Y.retryLane=we,Th(h,we),Xs(M,h,we),GP;Zw(),g=Sz(h,g,S)}else h=Y.treeContext,ii=Wo(we.nextSibling),Ua=g,ur=!0,Mu=null,Vo=!1,h!==null&&l5(g,h),g=Bw(g,M),g.flags|=4096;return g}return h=ad(h.child,{mode:M.mode,children:M.children}),h.ref=g.ref,g.child=h,h.return=g,h}function Hw(h,g){var S=g.ref;if(S===null)h!==null&&h.ref!==null&&(g.flags|=4194816);else{if(typeof S!="function"&&typeof S!="object")throw Error(r(284));(h===null||h.ref!==S)&&(g.flags|=4194816)}}function WP(h,g,S,M,H){return Eh(g),S=TP(h,g,S,M,void 0,H),M=PP(),h!==null&&!Zi?(AP(h,g,H),ud(h,g,H)):(ur&&M&&lP(g),g.flags|=1,Ha(h,g,S,H),g.child)}function _z(h,g,S,M,H,Y){return Eh(g),g.updateQueue=null,S=C5(g,M,S,H),N5(h),M=PP(),h!==null&&!Zi?(AP(h,g,Y),ud(h,g,Y)):(ur&&M&&lP(g),g.flags|=1,Ha(h,g,S,Y),g.child)}function kz(h,g,S,M,H){if(Eh(g),g.stateNode===null){var Y=jf,we=S.contextType;typeof we=="object"&&we!==null&&(Y=Ba(we)),Y=new S(M,Y),g.memoizedState=Y.state!==null&&Y.state!==void 0?Y.state:null,Y.updater=qP,g.stateNode=Y,Y._reactInternals=g,Y=g.stateNode,Y.props=M,Y.state=g.memoizedState,Y.refs={},yP(g),we=S.contextType,Y.context=typeof we=="object"&&we!==null?Ba(we):jf,Y.state=g.memoizedState,we=S.getDerivedStateFromProps,typeof we=="function"&&($P(g,S,we,M),Y.state=g.memoizedState),typeof S.getDerivedStateFromProps=="function"||typeof Y.getSnapshotBeforeUpdate=="function"||typeof Y.UNSAFE_componentWillMount!="function"&&typeof Y.componentWillMount!="function"||(we=Y.state,typeof Y.componentWillMount=="function"&&Y.componentWillMount(),typeof Y.UNSAFE_componentWillMount=="function"&&Y.UNSAFE_componentWillMount(),we!==Y.state&&qP.enqueueReplaceState(Y,Y.state,null),qx(g,M,Y,H),$x(),Y.state=g.memoizedState),typeof Y.componentDidMount=="function"&&(g.flags|=4194308),M=!0}else if(h===null){Y=g.stateNode;var Oe=g.memoizedProps,Qe=Oh(S,Oe);Y.props=Qe;var xt=Y.context,Ct=S.contextType;we=jf,typeof Ct=="object"&&Ct!==null&&(we=Ba(Ct));var Et=S.getDerivedStateFromProps;Ct=typeof Et=="function"||typeof Y.getSnapshotBeforeUpdate=="function",Oe=g.pendingProps!==Oe,Ct||typeof Y.UNSAFE_componentWillReceiveProps!="function"&&typeof Y.componentWillReceiveProps!="function"||(Oe||xt!==we)&&dz(g,Y,M,we),Du=!1;var vt=g.memoizedState;Y.state=vt,qx(g,M,Y,H),$x(),xt=g.memoizedState,Oe||vt!==xt||Du?(typeof Et=="function"&&($P(g,S,Et,M),xt=g.memoizedState),(Qe=Du||cz(g,S,Qe,M,vt,xt,we))?(Ct||typeof Y.UNSAFE_componentWillMount!="function"&&typeof Y.componentWillMount!="function"||(typeof Y.componentWillMount=="function"&&Y.componentWillMount(),typeof Y.UNSAFE_componentWillMount=="function"&&Y.UNSAFE_componentWillMount()),typeof Y.componentDidMount=="function"&&(g.flags|=4194308)):(typeof Y.componentDidMount=="function"&&(g.flags|=4194308),g.memoizedProps=M,g.memoizedState=xt),Y.props=M,Y.state=xt,Y.context=we,M=Qe):(typeof Y.componentDidMount=="function"&&(g.flags|=4194308),M=!1)}else{Y=g.stateNode,vP(h,g),we=g.memoizedProps,Ct=Oh(S,we),Y.props=Ct,Et=g.pendingProps,vt=Y.context,xt=S.contextType,Qe=jf,typeof xt=="object"&&xt!==null&&(Qe=Ba(xt)),Oe=S.getDerivedStateFromProps,(xt=typeof Oe=="function"||typeof Y.getSnapshotBeforeUpdate=="function")||typeof Y.UNSAFE_componentWillReceiveProps!="function"&&typeof Y.componentWillReceiveProps!="function"||(we!==Et||vt!==Qe)&&dz(g,Y,M,Qe),Du=!1,vt=g.memoizedState,Y.state=vt,qx(g,M,Y,H),$x();var _t=g.memoizedState;we!==Et||vt!==_t||Du||h!==null&&h.dependencies!==null&&_w(h.dependencies)?(typeof Oe=="function"&&($P(g,S,Oe,M),_t=g.memoizedState),(Ct=Du||cz(g,S,Ct,M,vt,_t,Qe)||h!==null&&h.dependencies!==null&&_w(h.dependencies))?(xt||typeof Y.UNSAFE_componentWillUpdate!="function"&&typeof Y.componentWillUpdate!="function"||(typeof Y.componentWillUpdate=="function"&&Y.componentWillUpdate(M,_t,Qe),typeof Y.UNSAFE_componentWillUpdate=="function"&&Y.UNSAFE_componentWillUpdate(M,_t,Qe)),typeof Y.componentDidUpdate=="function"&&(g.flags|=4),typeof Y.getSnapshotBeforeUpdate=="function"&&(g.flags|=1024)):(typeof Y.componentDidUpdate!="function"||we===h.memoizedProps&&vt===h.memoizedState||(g.flags|=4),typeof Y.getSnapshotBeforeUpdate!="function"||we===h.memoizedProps&&vt===h.memoizedState||(g.flags|=1024),g.memoizedProps=M,g.memoizedState=_t),Y.props=M,Y.state=_t,Y.context=Qe,M=Ct):(typeof Y.componentDidUpdate!="function"||we===h.memoizedProps&&vt===h.memoizedState||(g.flags|=4),typeof Y.getSnapshotBeforeUpdate!="function"||we===h.memoizedProps&&vt===h.memoizedState||(g.flags|=1024),M=!1)}return Y=M,Hw(h,g),M=(g.flags&128)!==0,Y||M?(Y=g.stateNode,S=M&&typeof S.getDerivedStateFromError!="function"?null:Y.render(),g.flags|=1,h!==null&&M?(g.child=Fh(g,h.child,null,H),g.child=Fh(g,null,S,H)):Ha(h,g,S,H),g.memoizedState=Y.state,h=g.child):h=ud(h,g,H),h}function Nz(h,g,S,M){return Ah(),g.flags|=256,Ha(h,g,S,M),g.child}var KP={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function YP(h){return{baseLanes:h,cachePool:p5()}}function XP(h,g,S){return h=h!==null?h.childLanes&~S:0,g&&(h|=So),h}function Cz(h,g,S){var M=g.pendingProps,H=!1,Y=(g.flags&128)!==0,we;if((we=Y)||(we=h!==null&&h.memoizedState===null?!1:(Bi.current&2)!==0),we&&(H=!0,g.flags&=-129),we=(g.flags&32)!==0,g.flags&=-33,h===null){if(ur){if(H?Lu(g):Ou(),(h=ii)?(h=RU(h,Vo),h=h!==null&&h.data!=="&"?h:null,h!==null&&(g.memoizedState={dehydrated:h,treeContext:Au!==null?{id:hc,overflow:pc}:null,retryLane:536870912,hydrationErrors:null},S=a5(h),S.return=g,g.child=S,Ua=g,ii=null)):h=null,h===null)throw Eu(g);return jA(h)?g.lanes=32:g.lanes=536870912,null}var Oe=M.children;return M=M.fallback,H?(Ou(),H=g.mode,Oe=$w({mode:"hidden",children:Oe},H),M=Ph(M,H,S,null),Oe.return=g,M.return=g,Oe.sibling=M,g.child=Oe,M=g.child,M.memoizedState=YP(S),M.childLanes=XP(h,we,S),g.memoizedState=KP,Yx(null,M)):(Lu(g),QP(g,Oe))}var Qe=h.memoizedState;if(Qe!==null&&(Oe=Qe.dehydrated,Oe!==null)){if(Y)g.flags&256?(Lu(g),g.flags&=-257,g=ZP(h,g,S)):g.memoizedState!==null?(Ou(),g.child=h.child,g.flags|=128,g=null):(Ou(),Oe=M.fallback,H=g.mode,M=$w({mode:"visible",children:M.children},H),Oe=Ph(Oe,H,S,null),Oe.flags|=2,M.return=g,Oe.return=g,M.sibling=Oe,g.child=M,Fh(g,h.child,null,S),M=g.child,M.memoizedState=YP(S),M.childLanes=XP(h,we,S),g.memoizedState=KP,g=Yx(null,M));else if(Lu(g),jA(Oe)){if(we=Oe.nextSibling&&Oe.nextSibling.dataset,we)var xt=we.dgst;we=xt,M=Error(r(419)),M.stack="",M.digest=we,Ox({value:M,source:null,stack:null}),g=ZP(h,g,S)}else if(Zi||Lf(h,g,S,!1),we=(S&h.childLanes)!==0,Zi||we){if(we=Wr,we!==null&&(M=yt(we,S),M!==0&&M!==Qe.retryLane))throw Qe.retryLane=M,Th(h,M),Xs(we,h,M),GP;EA(Oe)||Zw(),g=ZP(h,g,S)}else EA(Oe)?(g.flags|=192,g.child=h.child,g=null):(h=Qe.treeContext,ii=Wo(Oe.nextSibling),Ua=g,ur=!0,Mu=null,Vo=!1,h!==null&&l5(g,h),g=QP(g,M.children),g.flags|=4096);return g}return H?(Ou(),Oe=M.fallback,H=g.mode,Qe=h.child,xt=Qe.sibling,M=ad(Qe,{mode:"hidden",children:M.children}),M.subtreeFlags=Qe.subtreeFlags&65011712,xt!==null?Oe=ad(xt,Oe):(Oe=Ph(Oe,H,S,null),Oe.flags|=2),Oe.return=g,M.return=g,M.sibling=Oe,g.child=M,Yx(null,M),M=g.child,Oe=h.child.memoizedState,Oe===null?Oe=YP(S):(H=Oe.cachePool,H!==null?(Qe=Xi._currentValue,H=H.parent!==Qe?{parent:Qe,pool:Qe}:H):H=p5(),Oe={baseLanes:Oe.baseLanes|S,cachePool:H}),M.memoizedState=Oe,M.childLanes=XP(h,we,S),g.memoizedState=KP,Yx(h.child,M)):(Lu(g),S=h.child,h=S.sibling,S=ad(S,{mode:"visible",children:M.children}),S.return=g,S.sibling=null,h!==null&&(we=g.deletions,we===null?(g.deletions=[h],g.flags|=16):we.push(h)),g.child=S,g.memoizedState=null,S)}function QP(h,g){return g=$w({mode:"visible",children:g},h.mode),g.return=h,h.child=g}function $w(h,g){return h=xo(22,h,null,g),h.lanes=0,h}function ZP(h,g,S){return Fh(g,h.child,null,S),h=QP(g,g.pendingProps.children),h.flags|=2,g.memoizedState=null,h}function Tz(h,g,S){h.lanes|=g;var M=h.alternate;M!==null&&(M.lanes|=g),hP(h.return,g,S)}function JP(h,g,S,M,H,Y){var we=h.memoizedState;we===null?h.memoizedState={isBackwards:g,rendering:null,renderingStartTime:0,last:M,tail:S,tailMode:H,treeForkCount:Y}:(we.isBackwards=g,we.rendering=null,we.renderingStartTime=0,we.last=M,we.tail=S,we.tailMode=H,we.treeForkCount=Y)}function Pz(h,g,S){var M=g.pendingProps,H=M.revealOrder,Y=M.tail;M=M.children;var we=Bi.current,Oe=(we&2)!==0;if(Oe?(we=we&1|2,g.flags|=128):we&=1,le(Bi,we),Ha(h,g,M,S),M=ur?Lx:0,!Oe&&h!==null&&(h.flags&128)!==0)e:for(h=g.child;h!==null;){if(h.tag===13)h.memoizedState!==null&&Tz(h,S,g);else if(h.tag===19)Tz(h,S,g);else if(h.child!==null){h.child.return=h,h=h.child;continue}if(h===g)break e;for(;h.sibling===null;){if(h.return===null||h.return===g)break e;h=h.return}h.sibling.return=h.return,h=h.sibling}switch(H){case"forwards":for(S=g.child,H=null;S!==null;)h=S.alternate,h!==null&&Ew(h)===null&&(H=S),S=S.sibling;S=H,S===null?(H=g.child,g.child=null):(H=S.sibling,S.sibling=null),JP(g,!1,H,S,Y,M);break;case"backwards":case"unstable_legacy-backwards":for(S=null,H=g.child,g.child=null;H!==null;){if(h=H.alternate,h!==null&&Ew(h)===null){g.child=H;break}h=H.sibling,H.sibling=S,S=H,H=h}JP(g,!0,S,null,Y,M);break;case"together":JP(g,!1,null,null,void 0,M);break;default:g.memoizedState=null}return g.child}function ud(h,g,S){if(h!==null&&(g.dependencies=h.dependencies),Uu|=g.lanes,(S&g.childLanes)===0)if(h!==null){if(Lf(h,g,S,!1),(S&g.childLanes)===0)return null}else return null;if(h!==null&&g.child!==h.child)throw Error(r(153));if(g.child!==null){for(h=g.child,S=ad(h,h.pendingProps),g.child=S,S.return=g;h.sibling!==null;)h=h.sibling,S=S.sibling=ad(h,h.pendingProps),S.return=g;S.sibling=null}return g.child}function eA(h,g){return(h.lanes&g)!==0?!0:(h=h.dependencies,!!(h!==null&&_w(h)))}function zoe(h,g,S){switch(g.tag){case 3:j(g,g.stateNode.containerInfo),ju(g,Xi,h.memoizedState.cache),Ah();break;case 27:case 5:I(g);break;case 4:j(g,g.stateNode.containerInfo);break;case 10:ju(g,g.type,g.memoizedProps.value);break;case 31:if(g.memoizedState!==null)return g.flags|=128,NP(g),null;break;case 13:var M=g.memoizedState;if(M!==null)return M.dehydrated!==null?(Lu(g),g.flags|=128,null):(S&g.child.childLanes)!==0?Cz(h,g,S):(Lu(g),h=ud(h,g,S),h!==null?h.sibling:null);Lu(g);break;case 19:var H=(h.flags&128)!==0;if(M=(S&g.childLanes)!==0,M||(Lf(h,g,S,!1),M=(S&g.childLanes)!==0),H){if(M)return Pz(h,g,S);g.flags|=128}if(H=g.memoizedState,H!==null&&(H.rendering=null,H.tail=null,H.lastEffect=null),le(Bi,Bi.current),M)break;return null;case 22:return g.lanes=0,vz(h,g,S,g.pendingProps);case 24:ju(g,Xi,h.memoizedState.cache)}return ud(h,g,S)}function Az(h,g,S){if(h!==null)if(h.memoizedProps!==g.pendingProps)Zi=!0;else{if(!eA(h,S)&&(g.flags&128)===0)return Zi=!1,zoe(h,g,S);Zi=(h.flags&131072)!==0}else Zi=!1,ur&&(g.flags&1048576)!==0&&o5(g,Lx,g.index);switch(g.lanes=0,g.tag){case 16:e:{var M=g.pendingProps;if(h=Dh(g.elementType),g.type=h,typeof h=="function")aP(h)?(M=Oh(h,M),g.tag=1,g=kz(null,g,h,M,S)):(g.tag=0,g=WP(null,g,h,M,S));else{if(h!=null){var H=h.$$typeof;if(H===P){g.tag=11,g=bz(null,g,h,M,S);break e}else if(H===N){g.tag=14,g=xz(null,g,h,M,S);break e}}throw g=L(h)||h,Error(r(306,g,""))}}return g;case 0:return WP(h,g,g.type,g.pendingProps,S);case 1:return M=g.type,H=Oh(M,g.pendingProps),kz(h,g,M,H,S);case 3:e:{if(j(g,g.stateNode.containerInfo),h===null)throw Error(r(387));M=g.pendingProps;var Y=g.memoizedState;H=Y.element,vP(h,g),qx(g,M,null,S);var we=g.memoizedState;if(M=we.cache,ju(g,Xi,M),M!==Y.cache&&pP(g,[Xi],S,!0),$x(),M=we.element,Y.isDehydrated)if(Y={element:M,isDehydrated:!1,cache:we.cache},g.updateQueue.baseState=Y,g.memoizedState=Y,g.flags&256){g=Nz(h,g,M,S);break e}else if(M!==H){H=Ho(Error(r(424)),g),Ox(H),g=Nz(h,g,M,S);break e}else for(h=g.stateNode.containerInfo,h.nodeType===9?h=h.body:h=h.nodeName==="HTML"?h.ownerDocument.body:h,ii=Wo(h.firstChild),Ua=g,ur=!0,Mu=null,Vo=!0,S=v5(g,null,M,S),g.child=S;S;)S.flags=S.flags&-3|4096,S=S.sibling;else{if(Ah(),M===H){g=ud(h,g,S);break e}Ha(h,g,M,S)}g=g.child}return g;case 26:return Hw(h,g),h===null?(S=UU(g.type,null,g.pendingProps,null))?g.memoizedState=S:ur||(S=g.type,h=g.pendingProps,M=aS(q.current).createElement(S),M[nn]=g,M[on]=h,$a(M,S,h),Ze(M),g.stateNode=M):g.memoizedState=UU(g.type,h.memoizedProps,g.pendingProps,h.memoizedState),null;case 27:return I(g),h===null&&ur&&(M=g.stateNode=OU(g.type,g.pendingProps,q.current),Ua=g,Vo=!0,H=ii,Vu(g.type)?(DA=H,ii=Wo(M.firstChild)):ii=H),Ha(h,g,g.pendingProps.children,S),Hw(h,g),h===null&&(g.flags|=4194304),g.child;case 5:return h===null&&ur&&((H=M=ii)&&(M=fle(M,g.type,g.pendingProps,Vo),M!==null?(g.stateNode=M,Ua=g,ii=Wo(M.firstChild),Vo=!1,H=!0):H=!1),H||Eu(g)),I(g),H=g.type,Y=g.pendingProps,we=h!==null?h.memoizedProps:null,M=Y.children,PA(H,Y)?M=null:we!==null&&PA(H,we)&&(g.flags|=32),g.memoizedState!==null&&(H=TP(h,g,Moe,null,null,S),dy._currentValue=H),Hw(h,g),Ha(h,g,M,S),g.child;case 6:return h===null&&ur&&((h=S=ii)&&(S=gle(S,g.pendingProps,Vo),S!==null?(g.stateNode=S,Ua=g,ii=null,h=!0):h=!1),h||Eu(g)),null;case 13:return Cz(h,g,S);case 4:return j(g,g.stateNode.containerInfo),M=g.pendingProps,h===null?g.child=Fh(g,null,M,S):Ha(h,g,M,S),g.child;case 11:return bz(h,g,g.type,g.pendingProps,S);case 7:return Ha(h,g,g.pendingProps,S),g.child;case 8:return Ha(h,g,g.pendingProps.children,S),g.child;case 12:return Ha(h,g,g.pendingProps.children,S),g.child;case 10:return M=g.pendingProps,ju(g,g.type,M.value),Ha(h,g,M.children,S),g.child;case 9:return H=g.type._context,M=g.pendingProps.children,Eh(g),H=Ba(H),M=M(H),g.flags|=1,Ha(h,g,M,S),g.child;case 14:return xz(h,g,g.type,g.pendingProps,S);case 15:return yz(h,g,g.type,g.pendingProps,S);case 19:return Pz(h,g,S);case 31:return Ioe(h,g,S);case 22:return vz(h,g,S,g.pendingProps);case 24:return Eh(g),M=Ba(Xi),h===null?(H=bP(),H===null&&(H=Wr,Y=fP(),H.pooledCache=Y,Y.refCount++,Y!==null&&(H.pooledCacheLanes|=S),H=Y),g.memoizedState={parent:M,cache:H},yP(g),ju(g,Xi,H)):((h.lanes&S)!==0&&(vP(h,g),qx(g,null,null,S),$x()),H=h.memoizedState,Y=g.memoizedState,H.parent!==M?(H={parent:M,cache:M},g.memoizedState=H,g.lanes===0&&(g.memoizedState=g.updateQueue.baseState=H),ju(g,Xi,M)):(M=Y.cache,ju(g,Xi,M),M!==H.cache&&pP(g,[Xi],S,!0))),Ha(h,g,g.pendingProps.children,S),g.child;case 29:throw g.pendingProps}throw Error(r(156,g.tag))}function md(h){h.flags|=4}function tA(h,g,S,M,H){if((g=(h.mode&32)!==0)&&(g=!1),g){if(h.flags|=16777216,(H&335544128)===H)if(h.stateNode.complete)h.flags|=8192;else if(nU())h.flags|=8192;else throw Rh=Tw,xP}else h.flags&=-16777217}function Mz(h,g){if(g.type!=="stylesheet"||(g.state.loading&4)!==0)h.flags&=-16777217;else if(h.flags|=16777216,!VU(g))if(nU())h.flags|=8192;else throw Rh=Tw,xP}function qw(h,g){g!==null&&(h.flags|=4),h.flags&16384&&(g=h.tag!==22?lt():536870912,h.lanes|=g,Kf|=g)}function Xx(h,g){if(!ur)switch(h.tailMode){case"hidden":g=h.tail;for(var S=null;g!==null;)g.alternate!==null&&(S=g),g=g.sibling;S===null?h.tail=null:S.sibling=null;break;case"collapsed":S=h.tail;for(var M=null;S!==null;)S.alternate!==null&&(M=S),S=S.sibling;M===null?g||h.tail===null?h.tail=null:h.tail.sibling=null:M.sibling=null}}function ai(h){var g=h.alternate!==null&&h.alternate.child===h.child,S=0,M=0;if(g)for(var H=h.child;H!==null;)S|=H.lanes|H.childLanes,M|=H.subtreeFlags&65011712,M|=H.flags&65011712,H.return=h,H=H.sibling;else for(H=h.child;H!==null;)S|=H.lanes|H.childLanes,M|=H.subtreeFlags,M|=H.flags,H.return=h,H=H.sibling;return h.subtreeFlags|=M,h.childLanes=S,g}function Uoe(h,g,S){var M=g.pendingProps;switch(cP(g),g.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return ai(g),null;case 1:return ai(g),null;case 3:return S=g.stateNode,M=null,h!==null&&(M=h.memoizedState.cache),g.memoizedState.cache!==M&&(g.flags|=2048),ld(Xi),E(),S.pendingContext&&(S.context=S.pendingContext,S.pendingContext=null),(h===null||h.child===null)&&(Ff(g)?md(g):h===null||h.memoizedState.isDehydrated&&(g.flags&256)===0||(g.flags|=1024,uP())),ai(g),null;case 26:var H=g.type,Y=g.memoizedState;return h===null?(md(g),Y!==null?(ai(g),Mz(g,Y)):(ai(g),tA(g,H,null,M,S))):Y?Y!==h.memoizedState?(md(g),ai(g),Mz(g,Y)):(ai(g),g.flags&=-16777217):(h=h.memoizedProps,h!==M&&md(g),ai(g),tA(g,H,h,M,S)),null;case 27:if(W(g),S=q.current,H=g.type,h!==null&&g.stateNode!=null)h.memoizedProps!==M&&md(g);else{if(!M){if(g.stateNode===null)throw Error(r(166));return ai(g),null}h=pe.current,Ff(g)?c5(g):(h=OU(H,M,S),g.stateNode=h,md(g))}return ai(g),null;case 5:if(W(g),H=g.type,h!==null&&g.stateNode!=null)h.memoizedProps!==M&&md(g);else{if(!M){if(g.stateNode===null)throw Error(r(166));return ai(g),null}if(Y=pe.current,Ff(g))c5(g);else{var we=aS(q.current);switch(Y){case 1:Y=we.createElementNS("http://www.w3.org/2000/svg",H);break;case 2:Y=we.createElementNS("http://www.w3.org/1998/Math/MathML",H);break;default:switch(H){case"svg":Y=we.createElementNS("http://www.w3.org/2000/svg",H);break;case"math":Y=we.createElementNS("http://www.w3.org/1998/Math/MathML",H);break;case"script":Y=we.createElement("div"),Y.innerHTML="<script><\/script>",Y=Y.removeChild(Y.firstChild);break;case"select":Y=typeof M.is=="string"?we.createElement("select",{is:M.is}):we.createElement("select"),M.multiple?Y.multiple=!0:M.size&&(Y.size=M.size);break;default:Y=typeof M.is=="string"?we.createElement(H,{is:M.is}):we.createElement(H)}}Y[nn]=g,Y[on]=M;e:for(we=g.child;we!==null;){if(we.tag===5||we.tag===6)Y.appendChild(we.stateNode);else if(we.tag!==4&&we.tag!==27&&we.child!==null){we.child.return=we,we=we.child;continue}if(we===g)break e;for(;we.sibling===null;){if(we.return===null||we.return===g)break e;we=we.return}we.sibling.return=we.return,we=we.sibling}g.stateNode=Y;e:switch($a(Y,H,M),H){case"button":case"input":case"select":case"textarea":M=!!M.autoFocus;break e;case"img":M=!0;break e;default:M=!1}M&&md(g)}}return ai(g),tA(g,g.type,h===null?null:h.memoizedProps,g.pendingProps,S),null;case 6:if(h&&g.stateNode!=null)h.memoizedProps!==M&&md(g);else{if(typeof M!="string"&&g.stateNode===null)throw Error(r(166));if(h=q.current,Ff(g)){if(h=g.stateNode,S=g.memoizedProps,M=null,H=Ua,H!==null)switch(H.tag){case 27:case 5:M=H.memoizedProps}h[nn]=g,h=!!(h.nodeValue===S||M!==null&&M.suppressHydrationWarning===!0||CU(h.nodeValue,S)),h||Eu(g,!0)}else h=aS(h).createTextNode(M),h[nn]=g,g.stateNode=h}return ai(g),null;case 31:if(S=g.memoizedState,h===null||h.memoizedState!==null){if(M=Ff(g),S!==null){if(h===null){if(!M)throw Error(r(318));if(h=g.memoizedState,h=h!==null?h.dehydrated:null,!h)throw Error(r(557));h[nn]=g}else Ah(),(g.flags&128)===0&&(g.memoizedState=null),g.flags|=4;ai(g),h=!1}else S=uP(),h!==null&&h.memoizedState!==null&&(h.memoizedState.hydrationErrors=S),h=!0;if(!h)return g.flags&256?(vo(g),g):(vo(g),null);if((g.flags&128)!==0)throw Error(r(558))}return ai(g),null;case 13:if(M=g.memoizedState,h===null||h.memoizedState!==null&&h.memoizedState.dehydrated!==null){if(H=Ff(g),M!==null&&M.dehydrated!==null){if(h===null){if(!H)throw Error(r(318));if(H=g.memoizedState,H=H!==null?H.dehydrated:null,!H)throw Error(r(317));H[nn]=g}else Ah(),(g.flags&128)===0&&(g.memoizedState=null),g.flags|=4;ai(g),H=!1}else H=uP(),h!==null&&h.memoizedState!==null&&(h.memoizedState.hydrationErrors=H),H=!0;if(!H)return g.flags&256?(vo(g),g):(vo(g),null)}return vo(g),(g.flags&128)!==0?(g.lanes=S,g):(S=M!==null,h=h!==null&&h.memoizedState!==null,S&&(M=g.child,H=null,M.alternate!==null&&M.alternate.memoizedState!==null&&M.alternate.memoizedState.cachePool!==null&&(H=M.alternate.memoizedState.cachePool.pool),Y=null,M.memoizedState!==null&&M.memoizedState.cachePool!==null&&(Y=M.memoizedState.cachePool.pool),Y!==H&&(M.flags|=2048)),S!==h&&S&&(g.child.flags|=8192),qw(g,g.updateQueue),ai(g),null);case 4:return E(),h===null&&_A(g.stateNode.containerInfo),ai(g),null;case 10:return ld(g.type),ai(g),null;case 19:if(ie(Bi),M=g.memoizedState,M===null)return ai(g),null;if(H=(g.flags&128)!==0,Y=M.rendering,Y===null)if(H)Xx(M,!1);else{if(Pi!==0||h!==null&&(h.flags&128)!==0)for(h=g.child;h!==null;){if(Y=Ew(h),Y!==null){for(g.flags|=128,Xx(M,!1),h=Y.updateQueue,g.updateQueue=h,qw(g,h),g.subtreeFlags=0,h=S,S=g.child;S!==null;)i5(S,h),S=S.sibling;return le(Bi,Bi.current&1|2),ur&&sd(g,M.treeForkCount),g.child}h=h.sibling}M.tail!==null&&F()>Yw&&(g.flags|=128,H=!0,Xx(M,!1),g.lanes=4194304)}else{if(!H)if(h=Ew(Y),h!==null){if(g.flags|=128,H=!0,h=h.updateQueue,g.updateQueue=h,qw(g,h),Xx(M,!0),M.tail===null&&M.tailMode==="hidden"&&!Y.alternate&&!ur)return ai(g),null}else 2*F()-M.renderingStartTime>Yw&&S!==536870912&&(g.flags|=128,H=!0,Xx(M,!1),g.lanes=4194304);M.isBackwards?(Y.sibling=g.child,g.child=Y):(h=M.last,h!==null?h.sibling=Y:g.child=Y,M.last=Y)}return M.tail!==null?(h=M.tail,M.rendering=h,M.tail=h.sibling,M.renderingStartTime=F(),h.sibling=null,S=Bi.current,le(Bi,H?S&1|2:S&1),ur&&sd(g,M.treeForkCount),h):(ai(g),null);case 22:case 23:return vo(g),kP(),M=g.memoizedState!==null,h!==null?h.memoizedState!==null!==M&&(g.flags|=8192):M&&(g.flags|=8192),M?(S&536870912)!==0&&(g.flags&128)===0&&(ai(g),g.subtreeFlags&6&&(g.flags|=8192)):ai(g),S=g.updateQueue,S!==null&&qw(g,S.retryQueue),S=null,h!==null&&h.memoizedState!==null&&h.memoizedState.cachePool!==null&&(S=h.memoizedState.cachePool.pool),M=null,g.memoizedState!==null&&g.memoizedState.cachePool!==null&&(M=g.memoizedState.cachePool.pool),M!==S&&(g.flags|=2048),h!==null&&ie(jh),null;case 24:return S=null,h!==null&&(S=h.memoizedState.cache),g.memoizedState.cache!==S&&(g.flags|=2048),ld(Xi),ai(g),null;case 25:return null;case 30:return null}throw Error(r(156,g.tag))}function Boe(h,g){switch(cP(g),g.tag){case 1:return h=g.flags,h&65536?(g.flags=h&-65537|128,g):null;case 3:return ld(Xi),E(),h=g.flags,(h&65536)!==0&&(h&128)===0?(g.flags=h&-65537|128,g):null;case 26:case 27:case 5:return W(g),null;case 31:if(g.memoizedState!==null){if(vo(g),g.alternate===null)throw Error(r(340));Ah()}return h=g.flags,h&65536?(g.flags=h&-65537|128,g):null;case 13:if(vo(g),h=g.memoizedState,h!==null&&h.dehydrated!==null){if(g.alternate===null)throw Error(r(340));Ah()}return h=g.flags,h&65536?(g.flags=h&-65537|128,g):null;case 19:return ie(Bi),null;case 4:return E(),null;case 10:return ld(g.type),null;case 22:case 23:return vo(g),kP(),h!==null&&ie(jh),h=g.flags,h&65536?(g.flags=h&-65537|128,g):null;case 24:return ld(Xi),null;case 25:return null;default:return null}}function Ez(h,g){switch(cP(g),g.tag){case 3:ld(Xi),E();break;case 26:case 27:case 5:W(g);break;case 4:E();break;case 31:g.memoizedState!==null&&vo(g);break;case 13:vo(g);break;case 19:ie(Bi);break;case 10:ld(g.type);break;case 22:case 23:vo(g),kP(),h!==null&&ie(jh);break;case 24:ld(Xi)}}function Qx(h,g){try{var S=g.updateQueue,M=S!==null?S.lastEffect:null;if(M!==null){var H=M.next;S=H;do{if((S.tag&h)===h){M=void 0;var Y=S.create,we=S.inst;M=Y(),we.destroy=M}S=S.next}while(S!==H)}}catch(Oe){Ar(g,g.return,Oe)}}function Iu(h,g,S){try{var M=g.updateQueue,H=M!==null?M.lastEffect:null;if(H!==null){var Y=H.next;M=Y;do{if((M.tag&h)===h){var we=M.inst,Oe=we.destroy;if(Oe!==void 0){we.destroy=void 0,H=g;var Qe=S,xt=Oe;try{xt()}catch(Ct){Ar(H,Qe,Ct)}}}M=M.next}while(M!==Y)}}catch(Ct){Ar(g,g.return,Ct)}}function jz(h){var g=h.updateQueue;if(g!==null){var S=h.stateNode;try{S5(g,S)}catch(M){Ar(h,h.return,M)}}}function Dz(h,g,S){S.props=Oh(h.type,h.memoizedProps),S.state=h.memoizedState;try{S.componentWillUnmount()}catch(M){Ar(h,g,M)}}function Zx(h,g){try{var S=h.ref;if(S!==null){switch(h.tag){case 26:case 27:case 5:var M=h.stateNode;break;case 30:M=h.stateNode;break;default:M=h.stateNode}typeof S=="function"?h.refCleanup=S(M):S.current=M}}catch(H){Ar(h,g,H)}}function fc(h,g){var S=h.ref,M=h.refCleanup;if(S!==null)if(typeof M=="function")try{M()}catch(H){Ar(h,g,H)}finally{h.refCleanup=null,h=h.alternate,h!=null&&(h.refCleanup=null)}else if(typeof S=="function")try{S(null)}catch(H){Ar(h,g,H)}else S.current=null}function Rz(h){var g=h.type,S=h.memoizedProps,M=h.stateNode;try{e:switch(g){case"button":case"input":case"select":case"textarea":S.autoFocus&&M.focus();break e;case"img":S.src?M.src=S.src:S.srcSet&&(M.srcset=S.srcSet)}}catch(H){Ar(h,h.return,H)}}function nA(h,g,S){try{var M=h.stateNode;cle(M,h.type,S,g),M[on]=g}catch(H){Ar(h,h.return,H)}}function Fz(h){return h.tag===5||h.tag===3||h.tag===26||h.tag===27&&Vu(h.type)||h.tag===4}function rA(h){e:for(;;){for(;h.sibling===null;){if(h.return===null||Fz(h.return))return null;h=h.return}for(h.sibling.return=h.return,h=h.sibling;h.tag!==5&&h.tag!==6&&h.tag!==18;){if(h.tag===27&&Vu(h.type)||h.flags&2||h.child===null||h.tag===4)continue e;h.child.return=h,h=h.child}if(!(h.flags&2))return h.stateNode}}function iA(h,g,S){var M=h.tag;if(M===5||M===6)h=h.stateNode,g?(S.nodeType===9?S.body:S.nodeName==="HTML"?S.ownerDocument.body:S).insertBefore(h,g):(g=S.nodeType===9?S.body:S.nodeName==="HTML"?S.ownerDocument.body:S,g.appendChild(h),S=S._reactRootContainer,S!=null||g.onclick!==null||(g.onclick=Ki));else if(M!==4&&(M===27&&Vu(h.type)&&(S=h.stateNode,g=null),h=h.child,h!==null))for(iA(h,g,S),h=h.sibling;h!==null;)iA(h,g,S),h=h.sibling}function Vw(h,g,S){var M=h.tag;if(M===5||M===6)h=h.stateNode,g?S.insertBefore(h,g):S.appendChild(h);else if(M!==4&&(M===27&&Vu(h.type)&&(S=h.stateNode),h=h.child,h!==null))for(Vw(h,g,S),h=h.sibling;h!==null;)Vw(h,g,S),h=h.sibling}function Lz(h){var g=h.stateNode,S=h.memoizedProps;try{for(var M=h.type,H=g.attributes;H.length;)g.removeAttributeNode(H[0]);$a(g,M,S),g[nn]=h,g[on]=S}catch(Y){Ar(h,h.return,Y)}}var hd=!1,Ji=!1,aA=!1,Oz=typeof WeakSet=="function"?WeakSet:Set,Ca=null;function Hoe(h,g){if(h=h.containerInfo,CA=mS,h=YI(h),ZT(h)){if("selectionStart"in h)var S={start:h.selectionStart,end:h.selectionEnd};else e:{S=(S=h.ownerDocument)&&S.defaultView||window;var M=S.getSelection&&S.getSelection();if(M&&M.rangeCount!==0){S=M.anchorNode;var H=M.anchorOffset,Y=M.focusNode;M=M.focusOffset;try{S.nodeType,Y.nodeType}catch{S=null;break e}var we=0,Oe=-1,Qe=-1,xt=0,Ct=0,Et=h,vt=null;t:for(;;){for(var _t;Et!==S||H!==0&&Et.nodeType!==3||(Oe=we+H),Et!==Y||M!==0&&Et.nodeType!==3||(Qe=we+M),Et.nodeType===3&&(we+=Et.nodeValue.length),(_t=Et.firstChild)!==null;)vt=Et,Et=_t;for(;;){if(Et===h)break t;if(vt===S&&++xt===H&&(Oe=we),vt===Y&&++Ct===M&&(Qe=we),(_t=Et.nextSibling)!==null)break;Et=vt,vt=Et.parentNode}Et=_t}S=Oe===-1||Qe===-1?null:{start:Oe,end:Qe}}else S=null}S=S||{start:0,end:0}}else S=null;for(TA={focusedElem:h,selectionRange:S},mS=!1,Ca=g;Ca!==null;)if(g=Ca,h=g.child,(g.subtreeFlags&1028)!==0&&h!==null)h.return=g,Ca=h;else for(;Ca!==null;){switch(g=Ca,Y=g.alternate,h=g.flags,g.tag){case 0:if((h&4)!==0&&(h=g.updateQueue,h=h!==null?h.events:null,h!==null))for(S=0;S<h.length;S++)H=h[S],H.ref.impl=H.nextImpl;break;case 11:case 15:break;case 1:if((h&1024)!==0&&Y!==null){h=void 0,S=g,H=Y.memoizedProps,Y=Y.memoizedState,M=S.stateNode;try{var Jt=Oh(S.type,H);h=M.getSnapshotBeforeUpdate(Jt,Y),M.__reactInternalSnapshotBeforeUpdate=h}catch(Sn){Ar(S,S.return,Sn)}}break;case 3:if((h&1024)!==0){if(h=g.stateNode.containerInfo,S=h.nodeType,S===9)MA(h);else if(S===1)switch(h.nodeName){case"HEAD":case"HTML":case"BODY":MA(h);break;default:h.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((h&1024)!==0)throw Error(r(163))}if(h=g.sibling,h!==null){h.return=g.return,Ca=h;break}Ca=g.return}}function Iz(h,g,S){var M=S.flags;switch(S.tag){case 0:case 11:case 15:fd(h,S),M&4&&Qx(5,S);break;case 1:if(fd(h,S),M&4)if(h=S.stateNode,g===null)try{h.componentDidMount()}catch(we){Ar(S,S.return,we)}else{var H=Oh(S.type,g.memoizedProps);g=g.memoizedState;try{h.componentDidUpdate(H,g,h.__reactInternalSnapshotBeforeUpdate)}catch(we){Ar(S,S.return,we)}}M&64&&jz(S),M&512&&Zx(S,S.return);break;case 3:if(fd(h,S),M&64&&(h=S.updateQueue,h!==null)){if(g=null,S.child!==null)switch(S.child.tag){case 27:case 5:g=S.child.stateNode;break;case 1:g=S.child.stateNode}try{S5(h,g)}catch(we){Ar(S,S.return,we)}}break;case 27:g===null&&M&4&&Lz(S);case 26:case 5:fd(h,S),g===null&&M&4&&Rz(S),M&512&&Zx(S,S.return);break;case 12:fd(h,S);break;case 31:fd(h,S),M&4&&Bz(h,S);break;case 13:fd(h,S),M&4&&Hz(h,S),M&64&&(h=S.memoizedState,h!==null&&(h=h.dehydrated,h!==null&&(S=Qoe.bind(null,S),ble(h,S))));break;case 22:if(M=S.memoizedState!==null||hd,!M){g=g!==null&&g.memoizedState!==null||Ji,H=hd;var Y=Ji;hd=M,(Ji=g)&&!Y?gd(h,S,(S.subtreeFlags&8772)!==0):fd(h,S),hd=H,Ji=Y}break;case 30:break;default:fd(h,S)}}function zz(h){var g=h.alternate;g!==null&&(h.alternate=null,zz(g)),h.child=null,h.deletions=null,h.sibling=null,h.tag===5&&(g=h.stateNode,g!==null&&Ke(g)),h.stateNode=null,h.return=null,h.dependencies=null,h.memoizedProps=null,h.memoizedState=null,h.pendingProps=null,h.stateNode=null,h.updateQueue=null}var di=null,Gs=!1;function pd(h,g,S){for(S=S.child;S!==null;)Uz(h,g,S),S=S.sibling}function Uz(h,g,S){if(Ne&&typeof Ne.onCommitFiberUnmount=="function")try{Ne.onCommitFiberUnmount(Ue,S)}catch{}switch(S.tag){case 26:Ji||fc(S,g),pd(h,g,S),S.memoizedState?S.memoizedState.count--:S.stateNode&&(S=S.stateNode,S.parentNode.removeChild(S));break;case 27:Ji||fc(S,g);var M=di,H=Gs;Vu(S.type)&&(di=S.stateNode,Gs=!1),pd(h,g,S),oy(S.stateNode),di=M,Gs=H;break;case 5:Ji||fc(S,g);case 6:if(M=di,H=Gs,di=null,pd(h,g,S),di=M,Gs=H,di!==null)if(Gs)try{(di.nodeType===9?di.body:di.nodeName==="HTML"?di.ownerDocument.body:di).removeChild(S.stateNode)}catch(Y){Ar(S,g,Y)}else try{di.removeChild(S.stateNode)}catch(Y){Ar(S,g,Y)}break;case 18:di!==null&&(Gs?(h=di,jU(h.nodeType===9?h.body:h.nodeName==="HTML"?h.ownerDocument.body:h,S.stateNode),ng(h)):jU(di,S.stateNode));break;case 4:M=di,H=Gs,di=S.stateNode.containerInfo,Gs=!0,pd(h,g,S),di=M,Gs=H;break;case 0:case 11:case 14:case 15:Iu(2,S,g),Ji||Iu(4,S,g),pd(h,g,S);break;case 1:Ji||(fc(S,g),M=S.stateNode,typeof M.componentWillUnmount=="function"&&Dz(S,g,M)),pd(h,g,S);break;case 21:pd(h,g,S);break;case 22:Ji=(M=Ji)||S.memoizedState!==null,pd(h,g,S),Ji=M;break;default:pd(h,g,S)}}function Bz(h,g){if(g.memoizedState===null&&(h=g.alternate,h!==null&&(h=h.memoizedState,h!==null))){h=h.dehydrated;try{ng(h)}catch(S){Ar(g,g.return,S)}}}function Hz(h,g){if(g.memoizedState===null&&(h=g.alternate,h!==null&&(h=h.memoizedState,h!==null&&(h=h.dehydrated,h!==null))))try{ng(h)}catch(S){Ar(g,g.return,S)}}function $oe(h){switch(h.tag){case 31:case 13:case 19:var g=h.stateNode;return g===null&&(g=h.stateNode=new Oz),g;case 22:return h=h.stateNode,g=h._retryCache,g===null&&(g=h._retryCache=new Oz),g;default:throw Error(r(435,h.tag))}}function Gw(h,g){var S=$oe(h);g.forEach(function(M){if(!S.has(M)){S.add(M);var H=Zoe.bind(null,h,M);M.then(H,H)}})}function Ws(h,g){var S=g.deletions;if(S!==null)for(var M=0;M<S.length;M++){var H=S[M],Y=h,we=g,Oe=we;e:for(;Oe!==null;){switch(Oe.tag){case 27:if(Vu(Oe.type)){di=Oe.stateNode,Gs=!1;break e}break;case 5:di=Oe.stateNode,Gs=!1;break e;case 3:case 4:di=Oe.stateNode.containerInfo,Gs=!0;break e}Oe=Oe.return}if(di===null)throw Error(r(160));Uz(Y,we,H),di=null,Gs=!1,Y=H.alternate,Y!==null&&(Y.return=null),H.return=null}if(g.subtreeFlags&13886)for(g=g.child;g!==null;)$z(g,h),g=g.sibling}var Ll=null;function $z(h,g){var S=h.alternate,M=h.flags;switch(h.tag){case 0:case 11:case 14:case 15:Ws(g,h),Ks(h),M&4&&(Iu(3,h,h.return),Qx(3,h),Iu(5,h,h.return));break;case 1:Ws(g,h),Ks(h),M&512&&(Ji||S===null||fc(S,S.return)),M&64&&hd&&(h=h.updateQueue,h!==null&&(M=h.callbacks,M!==null&&(S=h.shared.hiddenCallbacks,h.shared.hiddenCallbacks=S===null?M:S.concat(M))));break;case 26:var H=Ll;if(Ws(g,h),Ks(h),M&512&&(Ji||S===null||fc(S,S.return)),M&4){var Y=S!==null?S.memoizedState:null;if(M=h.memoizedState,S===null)if(M===null)if(h.stateNode===null){e:{M=h.type,S=h.memoizedProps,H=H.ownerDocument||H;t:switch(M){case"title":Y=H.getElementsByTagName("title")[0],(!Y||Y[at]||Y[nn]||Y.namespaceURI==="http://www.w3.org/2000/svg"||Y.hasAttribute("itemprop"))&&(Y=H.createElement(M),H.head.insertBefore(Y,H.querySelector("head > title"))),$a(Y,M,S),Y[nn]=h,Ze(Y),M=Y;break e;case"link":var we=$U("link","href",H).get(M+(S.href||""));if(we){for(var Oe=0;Oe<we.length;Oe++)if(Y=we[Oe],Y.getAttribute("href")===(S.href==null||S.href===""?null:S.href)&&Y.getAttribute("rel")===(S.rel==null?null:S.rel)&&Y.getAttribute("title")===(S.title==null?null:S.title)&&Y.getAttribute("crossorigin")===(S.crossOrigin==null?null:S.crossOrigin)){we.splice(Oe,1);break t}}Y=H.createElement(M),$a(Y,M,S),H.head.appendChild(Y);break;case"meta":if(we=$U("meta","content",H).get(M+(S.content||""))){for(Oe=0;Oe<we.length;Oe++)if(Y=we[Oe],Y.getAttribute("content")===(S.content==null?null:""+S.content)&&Y.getAttribute("name")===(S.name==null?null:S.name)&&Y.getAttribute("property")===(S.property==null?null:S.property)&&Y.getAttribute("http-equiv")===(S.httpEquiv==null?null:S.httpEquiv)&&Y.getAttribute("charset")===(S.charSet==null?null:S.charSet)){we.splice(Oe,1);break t}}Y=H.createElement(M),$a(Y,M,S),H.head.appendChild(Y);break;default:throw Error(r(468,M))}Y[nn]=h,Ze(Y),M=Y}h.stateNode=M}else qU(H,h.type,h.stateNode);else h.stateNode=HU(H,M,h.memoizedProps);else Y!==M?(Y===null?S.stateNode!==null&&(S=S.stateNode,S.parentNode.removeChild(S)):Y.count--,M===null?qU(H,h.type,h.stateNode):HU(H,M,h.memoizedProps)):M===null&&h.stateNode!==null&&nA(h,h.memoizedProps,S.memoizedProps)}break;case 27:Ws(g,h),Ks(h),M&512&&(Ji||S===null||fc(S,S.return)),S!==null&&M&4&&nA(h,h.memoizedProps,S.memoizedProps);break;case 5:if(Ws(g,h),Ks(h),M&512&&(Ji||S===null||fc(S,S.return)),h.flags&32){H=h.stateNode;try{Fr(H,"")}catch(Jt){Ar(h,h.return,Jt)}}M&4&&h.stateNode!=null&&(H=h.memoizedProps,nA(h,H,S!==null?S.memoizedProps:H)),M&1024&&(aA=!0);break;case 6:if(Ws(g,h),Ks(h),M&4){if(h.stateNode===null)throw Error(r(162));M=h.memoizedProps,S=h.stateNode;try{S.nodeValue=M}catch(Jt){Ar(h,h.return,Jt)}}break;case 3:if(lS=null,H=Ll,Ll=sS(g.containerInfo),Ws(g,h),Ll=H,Ks(h),M&4&&S!==null&&S.memoizedState.isDehydrated)try{ng(g.containerInfo)}catch(Jt){Ar(h,h.return,Jt)}aA&&(aA=!1,qz(h));break;case 4:M=Ll,Ll=sS(h.stateNode.containerInfo),Ws(g,h),Ks(h),Ll=M;break;case 12:Ws(g,h),Ks(h);break;case 31:Ws(g,h),Ks(h),M&4&&(M=h.updateQueue,M!==null&&(h.updateQueue=null,Gw(h,M)));break;case 13:Ws(g,h),Ks(h),h.child.flags&8192&&h.memoizedState!==null!=(S!==null&&S.memoizedState!==null)&&(Kw=F()),M&4&&(M=h.updateQueue,M!==null&&(h.updateQueue=null,Gw(h,M)));break;case 22:H=h.memoizedState!==null;var Qe=S!==null&&S.memoizedState!==null,xt=hd,Ct=Ji;if(hd=xt||H,Ji=Ct||Qe,Ws(g,h),Ji=Ct,hd=xt,Ks(h),M&8192)e:for(g=h.stateNode,g._visibility=H?g._visibility&-2:g._visibility|1,H&&(S===null||Qe||hd||Ji||Ih(h)),S=null,g=h;;){if(g.tag===5||g.tag===26){if(S===null){Qe=S=g;try{if(Y=Qe.stateNode,H)we=Y.style,typeof we.setProperty=="function"?we.setProperty("display","none","important"):we.display="none";else{Oe=Qe.stateNode;var Et=Qe.memoizedProps.style,vt=Et!=null&&Et.hasOwnProperty("display")?Et.display:null;Oe.style.display=vt==null||typeof vt=="boolean"?"":(""+vt).trim()}}catch(Jt){Ar(Qe,Qe.return,Jt)}}}else if(g.tag===6){if(S===null){Qe=g;try{Qe.stateNode.nodeValue=H?"":Qe.memoizedProps}catch(Jt){Ar(Qe,Qe.return,Jt)}}}else if(g.tag===18){if(S===null){Qe=g;try{var _t=Qe.stateNode;H?DU(_t,!0):DU(Qe.stateNode,!1)}catch(Jt){Ar(Qe,Qe.return,Jt)}}}else if((g.tag!==22&&g.tag!==23||g.memoizedState===null||g===h)&&g.child!==null){g.child.return=g,g=g.child;continue}if(g===h)break e;for(;g.sibling===null;){if(g.return===null||g.return===h)break e;S===g&&(S=null),g=g.return}S===g&&(S=null),g.sibling.return=g.return,g=g.sibling}M&4&&(M=h.updateQueue,M!==null&&(S=M.retryQueue,S!==null&&(M.retryQueue=null,Gw(h,S))));break;case 19:Ws(g,h),Ks(h),M&4&&(M=h.updateQueue,M!==null&&(h.updateQueue=null,Gw(h,M)));break;case 30:break;case 21:break;default:Ws(g,h),Ks(h)}}function Ks(h){var g=h.flags;if(g&2){try{for(var S,M=h.return;M!==null;){if(Fz(M)){S=M;break}M=M.return}if(S==null)throw Error(r(160));switch(S.tag){case 27:var H=S.stateNode,Y=rA(h);Vw(h,Y,H);break;case 5:var we=S.stateNode;S.flags&32&&(Fr(we,""),S.flags&=-33);var Oe=rA(h);Vw(h,Oe,we);break;case 3:case 4:var Qe=S.stateNode.containerInfo,xt=rA(h);iA(h,xt,Qe);break;default:throw Error(r(161))}}catch(Ct){Ar(h,h.return,Ct)}h.flags&=-3}g&4096&&(h.flags&=-4097)}function qz(h){if(h.subtreeFlags&1024)for(h=h.child;h!==null;){var g=h;qz(g),g.tag===5&&g.flags&1024&&g.stateNode.reset(),h=h.sibling}}function fd(h,g){if(g.subtreeFlags&8772)for(g=g.child;g!==null;)Iz(h,g.alternate,g),g=g.sibling}function Ih(h){for(h=h.child;h!==null;){var g=h;switch(g.tag){case 0:case 11:case 14:case 15:Iu(4,g,g.return),Ih(g);break;case 1:fc(g,g.return);var S=g.stateNode;typeof S.componentWillUnmount=="function"&&Dz(g,g.return,S),Ih(g);break;case 27:oy(g.stateNode);case 26:case 5:fc(g,g.return),Ih(g);break;case 22:g.memoizedState===null&&Ih(g);break;case 30:Ih(g);break;default:Ih(g)}h=h.sibling}}function gd(h,g,S){for(S=S&&(g.subtreeFlags&8772)!==0,g=g.child;g!==null;){var M=g.alternate,H=h,Y=g,we=Y.flags;switch(Y.tag){case 0:case 11:case 15:gd(H,Y,S),Qx(4,Y);break;case 1:if(gd(H,Y,S),M=Y,H=M.stateNode,typeof H.componentDidMount=="function")try{H.componentDidMount()}catch(xt){Ar(M,M.return,xt)}if(M=Y,H=M.updateQueue,H!==null){var Oe=M.stateNode;try{var Qe=H.shared.hiddenCallbacks;if(Qe!==null)for(H.shared.hiddenCallbacks=null,H=0;H<Qe.length;H++)w5(Qe[H],Oe)}catch(xt){Ar(M,M.return,xt)}}S&&we&64&&jz(Y),Zx(Y,Y.return);break;case 27:Lz(Y);case 26:case 5:gd(H,Y,S),S&&M===null&&we&4&&Rz(Y),Zx(Y,Y.return);break;case 12:gd(H,Y,S);break;case 31:gd(H,Y,S),S&&we&4&&Bz(H,Y);break;case 13:gd(H,Y,S),S&&we&4&&Hz(H,Y);break;case 22:Y.memoizedState===null&&gd(H,Y,S),Zx(Y,Y.return);break;case 30:break;default:gd(H,Y,S)}g=g.sibling}}function sA(h,g){var S=null;h!==null&&h.memoizedState!==null&&h.memoizedState.cachePool!==null&&(S=h.memoizedState.cachePool.pool),h=null,g.memoizedState!==null&&g.memoizedState.cachePool!==null&&(h=g.memoizedState.cachePool.pool),h!==S&&(h!=null&&h.refCount++,S!=null&&Ix(S))}function oA(h,g){h=null,g.alternate!==null&&(h=g.alternate.memoizedState.cache),g=g.memoizedState.cache,g!==h&&(g.refCount++,h!=null&&Ix(h))}function Ol(h,g,S,M){if(g.subtreeFlags&10256)for(g=g.child;g!==null;)Vz(h,g,S,M),g=g.sibling}function Vz(h,g,S,M){var H=g.flags;switch(g.tag){case 0:case 11:case 15:Ol(h,g,S,M),H&2048&&Qx(9,g);break;case 1:Ol(h,g,S,M);break;case 3:Ol(h,g,S,M),H&2048&&(h=null,g.alternate!==null&&(h=g.alternate.memoizedState.cache),g=g.memoizedState.cache,g!==h&&(g.refCount++,h!=null&&Ix(h)));break;case 12:if(H&2048){Ol(h,g,S,M),h=g.stateNode;try{var Y=g.memoizedProps,we=Y.id,Oe=Y.onPostCommit;typeof Oe=="function"&&Oe(we,g.alternate===null?"mount":"update",h.passiveEffectDuration,-0)}catch(Qe){Ar(g,g.return,Qe)}}else Ol(h,g,S,M);break;case 31:Ol(h,g,S,M);break;case 13:Ol(h,g,S,M);break;case 23:break;case 22:Y=g.stateNode,we=g.alternate,g.memoizedState!==null?Y._visibility&2?Ol(h,g,S,M):Jx(h,g):Y._visibility&2?Ol(h,g,S,M):(Y._visibility|=2,Vf(h,g,S,M,(g.subtreeFlags&10256)!==0||!1)),H&2048&&sA(we,g);break;case 24:Ol(h,g,S,M),H&2048&&oA(g.alternate,g);break;default:Ol(h,g,S,M)}}function Vf(h,g,S,M,H){for(H=H&&((g.subtreeFlags&10256)!==0||!1),g=g.child;g!==null;){var Y=h,we=g,Oe=S,Qe=M,xt=we.flags;switch(we.tag){case 0:case 11:case 15:Vf(Y,we,Oe,Qe,H),Qx(8,we);break;case 23:break;case 22:var Ct=we.stateNode;we.memoizedState!==null?Ct._visibility&2?Vf(Y,we,Oe,Qe,H):Jx(Y,we):(Ct._visibility|=2,Vf(Y,we,Oe,Qe,H)),H&&xt&2048&&sA(we.alternate,we);break;case 24:Vf(Y,we,Oe,Qe,H),H&&xt&2048&&oA(we.alternate,we);break;default:Vf(Y,we,Oe,Qe,H)}g=g.sibling}}function Jx(h,g){if(g.subtreeFlags&10256)for(g=g.child;g!==null;){var S=h,M=g,H=M.flags;switch(M.tag){case 22:Jx(S,M),H&2048&&sA(M.alternate,M);break;case 24:Jx(S,M),H&2048&&oA(M.alternate,M);break;default:Jx(S,M)}g=g.sibling}}var ey=8192;function Gf(h,g,S){if(h.subtreeFlags&ey)for(h=h.child;h!==null;)Gz(h,g,S),h=h.sibling}function Gz(h,g,S){switch(h.tag){case 26:Gf(h,g,S),h.flags&ey&&h.memoizedState!==null&&Ale(S,Ll,h.memoizedState,h.memoizedProps);break;case 5:Gf(h,g,S);break;case 3:case 4:var M=Ll;Ll=sS(h.stateNode.containerInfo),Gf(h,g,S),Ll=M;break;case 22:h.memoizedState===null&&(M=h.alternate,M!==null&&M.memoizedState!==null?(M=ey,ey=16777216,Gf(h,g,S),ey=M):Gf(h,g,S));break;default:Gf(h,g,S)}}function Wz(h){var g=h.alternate;if(g!==null&&(h=g.child,h!==null)){g.child=null;do g=h.sibling,h.sibling=null,h=g;while(h!==null)}}function ty(h){var g=h.deletions;if((h.flags&16)!==0){if(g!==null)for(var S=0;S<g.length;S++){var M=g[S];Ca=M,Yz(M,h)}Wz(h)}if(h.subtreeFlags&10256)for(h=h.child;h!==null;)Kz(h),h=h.sibling}function Kz(h){switch(h.tag){case 0:case 11:case 15:ty(h),h.flags&2048&&Iu(9,h,h.return);break;case 3:ty(h);break;case 12:ty(h);break;case 22:var g=h.stateNode;h.memoizedState!==null&&g._visibility&2&&(h.return===null||h.return.tag!==13)?(g._visibility&=-3,Ww(h)):ty(h);break;default:ty(h)}}function Ww(h){var g=h.deletions;if((h.flags&16)!==0){if(g!==null)for(var S=0;S<g.length;S++){var M=g[S];Ca=M,Yz(M,h)}Wz(h)}for(h=h.child;h!==null;){switch(g=h,g.tag){case 0:case 11:case 15:Iu(8,g,g.return),Ww(g);break;case 22:S=g.stateNode,S._visibility&2&&(S._visibility&=-3,Ww(g));break;default:Ww(g)}h=h.sibling}}function Yz(h,g){for(;Ca!==null;){var S=Ca;switch(S.tag){case 0:case 11:case 15:Iu(8,S,g);break;case 23:case 22:if(S.memoizedState!==null&&S.memoizedState.cachePool!==null){var M=S.memoizedState.cachePool.pool;M!=null&&M.refCount++}break;case 24:Ix(S.memoizedState.cache)}if(M=S.child,M!==null)M.return=S,Ca=M;else e:for(S=h;Ca!==null;){M=Ca;var H=M.sibling,Y=M.return;if(zz(M),M===S){Ca=null;break e}if(H!==null){H.return=Y,Ca=H;break e}Ca=Y}}}var qoe={getCacheForType:function(h){var g=Ba(Xi),S=g.data.get(h);return S===void 0&&(S=h(),g.data.set(h,S)),S},cacheSignal:function(){return Ba(Xi).controller.signal}},Voe=typeof WeakMap=="function"?WeakMap:Map,Sr=0,Wr=null,ir=null,cr=0,Pr=0,wo=null,zu=!1,Wf=!1,lA=!1,bd=0,Pi=0,Uu=0,zh=0,cA=0,So=0,Kf=0,ny=null,Ys=null,dA=!1,Kw=0,Xz=0,Yw=1/0,Xw=null,Bu=null,da=0,Hu=null,Yf=null,xd=0,uA=0,mA=null,Qz=null,ry=0,hA=null;function _o(){return(Sr&2)!==0&&cr!==0?cr&-cr:re.T!==null?yA():xn()}function Zz(){if(So===0)if((cr&536870912)===0||ur){var h=Pe;Pe<<=1,(Pe&3932160)===0&&(Pe=262144),So=h}else So=536870912;return h=yo.current,h!==null&&(h.flags|=32),So}function Xs(h,g,S){(h===Wr&&(Pr===2||Pr===9)||h.cancelPendingCommit!==null)&&(Xf(h,0),$u(h,cr,So,!1)),ot(h,S),((Sr&2)===0||h!==Wr)&&(h===Wr&&((Sr&2)===0&&(zh|=S),Pi===4&&$u(h,cr,So,!1)),gc(h))}function Jz(h,g,S){if((Sr&6)!==0)throw Error(r(327));var M=!S&&(g&127)===0&&(g&h.expiredLanes)===0||$e(h,g),H=M?Koe(h,g):fA(h,g,!0),Y=M;do{if(H===0){Wf&&!M&&$u(h,g,0,!1);break}else{if(S=h.current.alternate,Y&&!Goe(S)){H=fA(h,g,!1),Y=!1;continue}if(H===2){if(Y=g,h.errorRecoveryDisabledLanes&Y)var we=0;else we=h.pendingLanes&-536870913,we=we!==0?we:we&536870912?536870912:0;if(we!==0){g=we;e:{var Oe=h;H=ny;var Qe=Oe.current.memoizedState.isDehydrated;if(Qe&&(Xf(Oe,we).flags|=256),we=fA(Oe,we,!1),we!==2){if(lA&&!Qe){Oe.errorRecoveryDisabledLanes|=Y,zh|=Y,H=4;break e}Y=Ys,Ys=H,Y!==null&&(Ys===null?Ys=Y:Ys.push.apply(Ys,Y))}H=we}if(Y=!1,H!==2)continue}}if(H===1){Xf(h,0),$u(h,g,0,!0);break}e:{switch(M=h,Y=H,Y){case 0:case 1:throw Error(r(345));case 4:if((g&4194048)!==g)break;case 6:$u(M,g,So,!zu);break e;case 2:Ys=null;break;case 3:case 5:break;default:throw Error(r(329))}if((g&62914560)===g&&(H=Kw+300-F(),10<H)){if($u(M,g,So,!zu),ye(M,0,!0)!==0)break e;xd=g,M.timeoutHandle=MU(eU.bind(null,M,S,Ys,Xw,dA,g,So,zh,Kf,zu,Y,"Throttled",-0,0),H);break e}eU(M,S,Ys,Xw,dA,g,So,zh,Kf,zu,Y,null,-0,0)}}break}while(!0);gc(h)}function eU(h,g,S,M,H,Y,we,Oe,Qe,xt,Ct,Et,vt,_t){if(h.timeoutHandle=-1,Et=g.subtreeFlags,Et&8192||(Et&16785408)===16785408){Et={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Ki},Gz(g,Y,Et);var Jt=(Y&62914560)===Y?Kw-F():(Y&4194048)===Y?Xz-F():0;if(Jt=Mle(Et,Jt),Jt!==null){xd=Y,h.cancelPendingCommit=Jt(lU.bind(null,h,g,Y,S,M,H,we,Oe,Qe,Ct,Et,null,vt,_t)),$u(h,Y,we,!xt);return}}lU(h,g,Y,S,M,H,we,Oe,Qe)}function Goe(h){for(var g=h;;){var S=g.tag;if((S===0||S===11||S===15)&&g.flags&16384&&(S=g.updateQueue,S!==null&&(S=S.stores,S!==null)))for(var M=0;M<S.length;M++){var H=S[M],Y=H.getSnapshot;H=H.value;try{if(!bo(Y(),H))return!1}catch{return!1}}if(S=g.child,g.subtreeFlags&16384&&S!==null)S.return=g,g=S;else{if(g===h)break;for(;g.sibling===null;){if(g.return===null||g.return===h)return!0;g=g.return}g.sibling.return=g.return,g=g.sibling}}return!0}function $u(h,g,S,M){g&=~cA,g&=~zh,h.suspendedLanes|=g,h.pingedLanes&=~g,M&&(h.warmLanes|=g),M=h.expirationTimes;for(var H=g;0<H;){var Y=31-ke(H),we=1<<Y;M[Y]=-1,H&=~we}S!==0&&qe(h,S,g)}function Qw(){return(Sr&6)===0?(iy(0),!1):!0}function pA(){if(ir!==null){if(Pr===0)var h=ir.return;else h=ir,od=Mh=null,MP(h),Uf=null,Ux=0,h=ir;for(;h!==null;)Ez(h.alternate,h),h=h.return;ir=null}}function Xf(h,g){var S=h.timeoutHandle;S!==-1&&(h.timeoutHandle=-1,mle(S)),S=h.cancelPendingCommit,S!==null&&(h.cancelPendingCommit=null,S()),xd=0,pA(),Wr=h,ir=S=ad(h.current,null),cr=g,Pr=0,wo=null,zu=!1,Wf=$e(h,g),lA=!1,Kf=So=cA=zh=Uu=Pi=0,Ys=ny=null,dA=!1,(g&8)!==0&&(g|=g&32);var M=h.entangledLanes;if(M!==0)for(h=h.entanglements,M&=g;0<M;){var H=31-ke(M),Y=1<<H;g|=h[H],M&=~Y}return bd=g,xw(),S}function tU(h,g){Un=null,re.H=Kx,g===zf||g===Cw?(g=b5(),Pr=3):g===xP?(g=b5(),Pr=4):Pr=g===GP?8:g!==null&&typeof g=="object"&&typeof g.then=="function"?6:1,wo=g,ir===null&&(Pi=1,Uw(h,Ho(g,h.current)))}function nU(){var h=yo.current;return h===null?!0:(cr&4194048)===cr?Go===null:(cr&62914560)===cr||(cr&536870912)!==0?h===Go:!1}function rU(){var h=re.H;return re.H=Kx,h===null?Kx:h}function iU(){var h=re.A;return re.A=qoe,h}function Zw(){Pi=4,zu||(cr&4194048)!==cr&&yo.current!==null||(Wf=!0),(Uu&134217727)===0&&(zh&134217727)===0||Wr===null||$u(Wr,cr,So,!1)}function fA(h,g,S){var M=Sr;Sr|=2;var H=rU(),Y=iU();(Wr!==h||cr!==g)&&(Xw=null,Xf(h,g)),g=!1;var we=Pi;e:do try{if(Pr!==0&&ir!==null){var Oe=ir,Qe=wo;switch(Pr){case 8:pA(),we=6;break e;case 3:case 2:case 9:case 6:yo.current===null&&(g=!0);var xt=Pr;if(Pr=0,wo=null,Qf(h,Oe,Qe,xt),S&&Wf){we=0;break e}break;default:xt=Pr,Pr=0,wo=null,Qf(h,Oe,Qe,xt)}}Woe(),we=Pi;break}catch(Ct){tU(h,Ct)}while(!0);return g&&h.shellSuspendCounter++,od=Mh=null,Sr=M,re.H=H,re.A=Y,ir===null&&(Wr=null,cr=0,xw()),we}function Woe(){for(;ir!==null;)aU(ir)}function Koe(h,g){var S=Sr;Sr|=2;var M=rU(),H=iU();Wr!==h||cr!==g?(Xw=null,Yw=F()+500,Xf(h,g)):Wf=$e(h,g);e:do try{if(Pr!==0&&ir!==null){g=ir;var Y=wo;t:switch(Pr){case 1:Pr=0,wo=null,Qf(h,g,Y,1);break;case 2:case 9:if(f5(Y)){Pr=0,wo=null,sU(g);break}g=function(){Pr!==2&&Pr!==9||Wr!==h||(Pr=7),gc(h)},Y.then(g,g);break e;case 3:Pr=7;break e;case 4:Pr=5;break e;case 7:f5(Y)?(Pr=0,wo=null,sU(g)):(Pr=0,wo=null,Qf(h,g,Y,7));break;case 5:var we=null;switch(ir.tag){case 26:we=ir.memoizedState;case 5:case 27:var Oe=ir;if(we?VU(we):Oe.stateNode.complete){Pr=0,wo=null;var Qe=Oe.sibling;if(Qe!==null)ir=Qe;else{var xt=Oe.return;xt!==null?(ir=xt,Jw(xt)):ir=null}break t}}Pr=0,wo=null,Qf(h,g,Y,5);break;case 6:Pr=0,wo=null,Qf(h,g,Y,6);break;case 8:pA(),Pi=6;break e;default:throw Error(r(462))}}Yoe();break}catch(Ct){tU(h,Ct)}while(!0);return od=Mh=null,re.H=M,re.A=H,Sr=S,ir!==null?0:(Wr=null,cr=0,xw(),Pi)}function Yoe(){for(;ir!==null&&!oe();)aU(ir)}function aU(h){var g=Az(h.alternate,h,bd);h.memoizedProps=h.pendingProps,g===null?Jw(h):ir=g}function sU(h){var g=h,S=g.alternate;switch(g.tag){case 15:case 0:g=_z(S,g,g.pendingProps,g.type,void 0,cr);break;case 11:g=_z(S,g,g.pendingProps,g.type.render,g.ref,cr);break;case 5:MP(g);default:Ez(S,g),g=ir=i5(g,bd),g=Az(S,g,bd)}h.memoizedProps=h.pendingProps,g===null?Jw(h):ir=g}function Qf(h,g,S,M){od=Mh=null,MP(g),Uf=null,Ux=0;var H=g.return;try{if(Ooe(h,H,g,S,cr)){Pi=1,Uw(h,Ho(S,h.current)),ir=null;return}}catch(Y){if(H!==null)throw ir=H,Y;Pi=1,Uw(h,Ho(S,h.current)),ir=null;return}g.flags&32768?(ur||M===1?h=!0:Wf||(cr&536870912)!==0?h=!1:(zu=h=!0,(M===2||M===9||M===3||M===6)&&(M=yo.current,M!==null&&M.tag===13&&(M.flags|=16384))),oU(g,h)):Jw(g)}function Jw(h){var g=h;do{if((g.flags&32768)!==0){oU(g,zu);return}h=g.return;var S=Uoe(g.alternate,g,bd);if(S!==null){ir=S;return}if(g=g.sibling,g!==null){ir=g;return}ir=g=h}while(g!==null);Pi===0&&(Pi=5)}function oU(h,g){do{var S=Boe(h.alternate,h);if(S!==null){S.flags&=32767,ir=S;return}if(S=h.return,S!==null&&(S.flags|=32768,S.subtreeFlags=0,S.deletions=null),!g&&(h=h.sibling,h!==null)){ir=h;return}ir=h=S}while(h!==null);Pi=6,ir=null}function lU(h,g,S,M,H,Y,we,Oe,Qe){h.cancelPendingCommit=null;do eS();while(da!==0);if((Sr&6)!==0)throw Error(r(327));if(g!==null){if(g===h.current)throw Error(r(177));if(Y=g.lanes|g.childLanes,Y|=rP,ft(h,S,Y,we,Oe,Qe),h===Wr&&(ir=Wr=null,cr=0),Yf=g,Hu=h,xd=S,uA=Y,mA=H,Qz=M,(g.subtreeFlags&10256)!==0||(g.flags&10256)!==0?(h.callbackNode=null,h.callbackPriority=0,Joe(de,function(){return hU(),null})):(h.callbackNode=null,h.callbackPriority=0),M=(g.flags&13878)!==0,(g.subtreeFlags&13878)!==0||M){M=re.T,re.T=null,H=J.p,J.p=2,we=Sr,Sr|=4;try{Hoe(h,g,S)}finally{Sr=we,J.p=H,re.T=M}}da=1,cU(),dU(),uU()}}function cU(){if(da===1){da=0;var h=Hu,g=Yf,S=(g.flags&13878)!==0;if((g.subtreeFlags&13878)!==0||S){S=re.T,re.T=null;var M=J.p;J.p=2;var H=Sr;Sr|=4;try{$z(g,h);var Y=TA,we=YI(h.containerInfo),Oe=Y.focusedElem,Qe=Y.selectionRange;if(we!==Oe&&Oe&&Oe.ownerDocument&&KI(Oe.ownerDocument.documentElement,Oe)){if(Qe!==null&&ZT(Oe)){var xt=Qe.start,Ct=Qe.end;if(Ct===void 0&&(Ct=xt),"selectionStart"in Oe)Oe.selectionStart=xt,Oe.selectionEnd=Math.min(Ct,Oe.value.length);else{var Et=Oe.ownerDocument||document,vt=Et&&Et.defaultView||window;if(vt.getSelection){var _t=vt.getSelection(),Jt=Oe.textContent.length,Sn=Math.min(Qe.start,Jt),Ir=Qe.end===void 0?Sn:Math.min(Qe.end,Jt);!_t.extend&&Sn>Ir&&(we=Ir,Ir=Sn,Sn=we);var dt=WI(Oe,Sn),nt=WI(Oe,Ir);if(dt&&nt&&(_t.rangeCount!==1||_t.anchorNode!==dt.node||_t.anchorOffset!==dt.offset||_t.focusNode!==nt.node||_t.focusOffset!==nt.offset)){var gt=Et.createRange();gt.setStart(dt.node,dt.offset),_t.removeAllRanges(),Sn>Ir?(_t.addRange(gt),_t.extend(nt.node,nt.offset)):(gt.setEnd(nt.node,nt.offset),_t.addRange(gt))}}}}for(Et=[],_t=Oe;_t=_t.parentNode;)_t.nodeType===1&&Et.push({element:_t,left:_t.scrollLeft,top:_t.scrollTop});for(typeof Oe.focus=="function"&&Oe.focus(),Oe=0;Oe<Et.length;Oe++){var At=Et[Oe];At.element.scrollLeft=At.left,At.element.scrollTop=At.top}}mS=!!CA,TA=CA=null}finally{Sr=H,J.p=M,re.T=S}}h.current=g,da=2}}function dU(){if(da===2){da=0;var h=Hu,g=Yf,S=(g.flags&8772)!==0;if((g.subtreeFlags&8772)!==0||S){S=re.T,re.T=null;var M=J.p;J.p=2;var H=Sr;Sr|=4;try{Iz(h,g.alternate,g)}finally{Sr=H,J.p=M,re.T=S}}da=3}}function uU(){if(da===4||da===3){da=0,O();var h=Hu,g=Yf,S=xd,M=Qz;(g.subtreeFlags&10256)!==0||(g.flags&10256)!==0?da=5:(da=0,Yf=Hu=null,mU(h,h.pendingLanes));var H=h.pendingLanes;if(H===0&&(Bu=null),Yt(S),g=g.stateNode,Ne&&typeof Ne.onCommitFiberRoot=="function")try{Ne.onCommitFiberRoot(Ue,g,void 0,(g.current.flags&128)===128)}catch{}if(M!==null){g=re.T,H=J.p,J.p=2,re.T=null;try{for(var Y=h.onRecoverableError,we=0;we<M.length;we++){var Oe=M[we];Y(Oe.value,{componentStack:Oe.stack})}}finally{re.T=g,J.p=H}}(xd&3)!==0&&eS(),gc(h),H=h.pendingLanes,(S&261930)!==0&&(H&42)!==0?h===hA?ry++:(ry=0,hA=h):ry=0,iy(0)}}function mU(h,g){(h.pooledCacheLanes&=g)===0&&(g=h.pooledCache,g!=null&&(h.pooledCache=null,Ix(g)))}function eS(){return cU(),dU(),uU(),hU()}function hU(){if(da!==5)return!1;var h=Hu,g=uA;uA=0;var S=Yt(xd),M=re.T,H=J.p;try{J.p=32>S?32:S,re.T=null,S=mA,mA=null;var Y=Hu,we=xd;if(da=0,Yf=Hu=null,xd=0,(Sr&6)!==0)throw Error(r(331));var Oe=Sr;if(Sr|=4,Kz(Y.current),Vz(Y,Y.current,we,S),Sr=Oe,iy(0,!1),Ne&&typeof Ne.onPostCommitFiberRoot=="function")try{Ne.onPostCommitFiberRoot(Ue,Y)}catch{}return!0}finally{J.p=H,re.T=M,mU(h,g)}}function pU(h,g,S){g=Ho(S,g),g=VP(h.stateNode,g,2),h=Fu(h,g,2),h!==null&&(ot(h,2),gc(h))}function Ar(h,g,S){if(h.tag===3)pU(h,h,S);else for(;g!==null;){if(g.tag===3){pU(g,h,S);break}else if(g.tag===1){var M=g.stateNode;if(typeof g.type.getDerivedStateFromError=="function"||typeof M.componentDidCatch=="function"&&(Bu===null||!Bu.has(M))){h=Ho(S,h),S=fz(2),M=Fu(g,S,2),M!==null&&(gz(S,M,g,h),ot(M,2),gc(M));break}}g=g.return}}function gA(h,g,S){var M=h.pingCache;if(M===null){M=h.pingCache=new Voe;var H=new Set;M.set(g,H)}else H=M.get(g),H===void 0&&(H=new Set,M.set(g,H));H.has(S)||(lA=!0,H.add(S),h=Xoe.bind(null,h,g,S),g.then(h,h))}function Xoe(h,g,S){var M=h.pingCache;M!==null&&M.delete(g),h.pingedLanes|=h.suspendedLanes&S,h.warmLanes&=~S,Wr===h&&(cr&S)===S&&(Pi===4||Pi===3&&(cr&62914560)===cr&&300>F()-Kw?(Sr&2)===0&&Xf(h,0):cA|=S,Kf===cr&&(Kf=0)),gc(h)}function fU(h,g){g===0&&(g=lt()),h=Th(h,g),h!==null&&(ot(h,g),gc(h))}function Qoe(h){var g=h.memoizedState,S=0;g!==null&&(S=g.retryLane),fU(h,S)}function Zoe(h,g){var S=0;switch(h.tag){case 31:case 13:var M=h.stateNode,H=h.memoizedState;H!==null&&(S=H.retryLane);break;case 19:M=h.stateNode;break;case 22:M=h.stateNode._retryCache;break;default:throw Error(r(314))}M!==null&&M.delete(g),fU(h,S)}function Joe(h,g){return ce(h,g)}var tS=null,Zf=null,bA=!1,nS=!1,xA=!1,qu=0;function gc(h){h!==Zf&&h.next===null&&(Zf===null?tS=Zf=h:Zf=Zf.next=h),nS=!0,bA||(bA=!0,tle())}function iy(h,g){if(!xA&&nS){xA=!0;do for(var S=!1,M=tS;M!==null;){if(h!==0){var H=M.pendingLanes;if(H===0)var Y=0;else{var we=M.suspendedLanes,Oe=M.pingedLanes;Y=(1<<31-ke(42|h)+1)-1,Y&=H&~(we&~Oe),Y=Y&201326741?Y&201326741|1:Y?Y|2:0}Y!==0&&(S=!0,yU(M,Y))}else Y=cr,Y=ye(M,M===Wr?Y:0,M.cancelPendingCommit!==null||M.timeoutHandle!==-1),(Y&3)===0||$e(M,Y)||(S=!0,yU(M,Y));M=M.next}while(S);xA=!1}}function ele(){gU()}function gU(){nS=bA=!1;var h=0;qu!==0&&ule()&&(h=qu);for(var g=F(),S=null,M=tS;M!==null;){var H=M.next,Y=bU(M,g);Y===0?(M.next=null,S===null?tS=H:S.next=H,H===null&&(Zf=S)):(S=M,(h!==0||(Y&3)!==0)&&(nS=!0)),M=H}da!==0&&da!==5||iy(h),qu!==0&&(qu=0)}function bU(h,g){for(var S=h.suspendedLanes,M=h.pingedLanes,H=h.expirationTimes,Y=h.pendingLanes&-62914561;0<Y;){var we=31-ke(Y),Oe=1<<we,Qe=H[we];Qe===-1?((Oe&S)===0||(Oe&M)!==0)&&(H[we]=Ye(Oe,g)):Qe<=g&&(h.expiredLanes|=Oe),Y&=~Oe}if(g=Wr,S=cr,S=ye(h,h===g?S:0,h.cancelPendingCommit!==null||h.timeoutHandle!==-1),M=h.callbackNode,S===0||h===g&&(Pr===2||Pr===9)||h.cancelPendingCommit!==null)return M!==null&&M!==null&&fe(M),h.callbackNode=null,h.callbackPriority=0;if((S&3)===0||$e(h,S)){if(g=S&-S,g===h.callbackPriority)return g;switch(M!==null&&fe(M),Yt(S)){case 2:case 8:S=he;break;case 32:S=de;break;case 268435456:S=_e;break;default:S=de}return M=xU.bind(null,h),S=ce(S,M),h.callbackPriority=g,h.callbackNode=S,g}return M!==null&&M!==null&&fe(M),h.callbackPriority=2,h.callbackNode=null,2}function xU(h,g){if(da!==0&&da!==5)return h.callbackNode=null,h.callbackPriority=0,null;var S=h.callbackNode;if(eS()&&h.callbackNode!==S)return null;var M=cr;return M=ye(h,h===Wr?M:0,h.cancelPendingCommit!==null||h.timeoutHandle!==-1),M===0?null:(Jz(h,M,g),bU(h,F()),h.callbackNode!=null&&h.callbackNode===S?xU.bind(null,h):null)}function yU(h,g){if(eS())return null;Jz(h,g,!0)}function tle(){hle(function(){(Sr&6)!==0?ce(ve,ele):gU()})}function yA(){if(qu===0){var h=Of;h===0&&(h=He,He<<=1,(He&261888)===0&&(He=256)),qu=h}return qu}function vU(h){return h==null||typeof h=="symbol"||typeof h=="boolean"?null:typeof h=="function"?h:uc(""+h)}function wU(h,g){var S=g.ownerDocument.createElement("input");return S.name=g.name,S.value=g.value,h.id&&S.setAttribute("form",h.id),g.parentNode.insertBefore(S,g),h=new FormData(h),S.parentNode.removeChild(S),h}function nle(h,g,S,M,H){if(g==="submit"&&S&&S.stateNode===H){var Y=vU((H[on]||null).action),we=M.submitter;we&&(g=(g=we[on]||null)?vU(g.formAction):we.getAttribute("formAction"),g!==null&&(Y=g,we=null));var Oe=new sn("action","action",null,M,H);h.push({event:Oe,listeners:[{instance:null,listener:function(){if(M.defaultPrevented){if(qu!==0){var Qe=we?wU(H,we):new FormData(H);zP(S,{pending:!0,data:Qe,method:H.method,action:Y},null,Qe)}}else typeof Y=="function"&&(Oe.preventDefault(),Qe=we?wU(H,we):new FormData(H),zP(S,{pending:!0,data:Qe,method:H.method,action:Y},Y,Qe))},currentTarget:H}]})}}for(var vA=0;vA<nP.length;vA++){var wA=nP[vA],rle=wA.toLowerCase(),ile=wA[0].toUpperCase()+wA.slice(1);Fl(rle,"on"+ile)}Fl(ZI,"onAnimationEnd"),Fl(JI,"onAnimationIteration"),Fl(e5,"onAnimationStart"),Fl("dblclick","onDoubleClick"),Fl("focusin","onFocus"),Fl("focusout","onBlur"),Fl(voe,"onTransitionRun"),Fl(woe,"onTransitionStart"),Fl(Soe,"onTransitionCancel"),Fl(t5,"onTransitionEnd"),tt("onMouseEnter",["mouseout","mouseover"]),tt("onMouseLeave",["mouseout","mouseover"]),tt("onPointerEnter",["pointerout","pointerover"]),tt("onPointerLeave",["pointerout","pointerover"]),st("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),st("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),st("onBeforeInput",["compositionend","keypress","textInput","paste"]),st("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),st("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),st("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ay="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(" "),ale=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(ay));function SU(h,g){g=(g&4)!==0;for(var S=0;S<h.length;S++){var M=h[S],H=M.event;M=M.listeners;e:{var Y=void 0;if(g)for(var we=M.length-1;0<=we;we--){var Oe=M[we],Qe=Oe.instance,xt=Oe.currentTarget;if(Oe=Oe.listener,Qe!==Y&&H.isPropagationStopped())break e;Y=Oe,H.currentTarget=xt;try{Y(H)}catch(Ct){bw(Ct)}H.currentTarget=null,Y=Qe}else for(we=0;we<M.length;we++){if(Oe=M[we],Qe=Oe.instance,xt=Oe.currentTarget,Oe=Oe.listener,Qe!==Y&&H.isPropagationStopped())break e;Y=Oe,H.currentTarget=xt;try{Y(H)}catch(Ct){bw(Ct)}H.currentTarget=null,Y=Qe}}}}function ar(h,g){var S=g[pn];S===void 0&&(S=g[pn]=new Set);var M=h+"__bubble";S.has(M)||(_U(g,h,2,!1),S.add(M))}function SA(h,g,S){var M=0;g&&(M|=4),_U(S,h,M,g)}var rS="_reactListening"+Math.random().toString(36).slice(2);function _A(h){if(!h[rS]){h[rS]=!0,Le.forEach(function(S){S!=="selectionchange"&&(ale.has(S)||SA(S,!1,h),SA(S,!0,h))});var g=h.nodeType===9?h:h.ownerDocument;g===null||g[rS]||(g[rS]=!0,SA("selectionchange",!1,g))}}function _U(h,g,S,M){switch(ZU(g)){case 2:var H=Dle;break;case 8:H=Rle;break;default:H=IA}S=H.bind(null,g,S,h),H=void 0,!rd||g!=="touchstart"&&g!=="touchmove"&&g!=="wheel"||(H=!0),M?H!==void 0?h.addEventListener(g,S,{capture:!0,passive:H}):h.addEventListener(g,S,!0):H!==void 0?h.addEventListener(g,S,{passive:H}):h.addEventListener(g,S,!1)}function kA(h,g,S,M,H){var Y=M;if((g&1)===0&&(g&2)===0&&M!==null)e:for(;;){if(M===null)return;var we=M.tag;if(we===3||we===4){var Oe=M.stateNode.containerInfo;if(Oe===H)break;if(we===4)for(we=M.return;we!==null;){var Qe=we.tag;if((Qe===3||Qe===4)&&we.stateNode.containerInfo===H)return;we=we.return}for(;Oe!==null;){if(we=It(Oe),we===null)return;if(Qe=we.tag,Qe===5||Qe===6||Qe===26||Qe===27){M=Y=we;continue e}Oe=Oe.parentNode}}M=M.return}mc(function(){var xt=Y,Ct=_s(S),Et=[];e:{var vt=n5.get(h);if(vt!==void 0){var _t=sn,Jt=h;switch(h){case"keypress":if(Pn(S)===0)break e;case"keydown":case"keyup":_t=Zse;break;case"focusin":Jt="focus",_t=Yi;break;case"focusout":Jt="blur",_t=Yi;break;case"beforeblur":case"afterblur":_t=Yi;break;case"click":if(S.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":_t=Cn;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":_t=ri;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":_t=toe;break;case ZI:case JI:case e5:_t=ks;break;case t5:_t=roe;break;case"scroll":case"scrollend":_t=qs;break;case"wheel":_t=aoe;break;case"copy":case"cut":case"paste":_t=vi;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":_t=DI;break;case"toggle":case"beforetoggle":_t=ooe}var Sn=(g&4)!==0,Ir=!Sn&&(h==="scroll"||h==="scrollend"),dt=Sn?vt!==null?vt+"Capture":null:vt;Sn=[];for(var nt=xt,gt;nt!==null;){var At=nt;if(gt=At.stateNode,At=At.tag,At!==5&&At!==26&&At!==27||gt===null||dt===null||(At=Dl(nt,dt),At!=null&&Sn.push(sy(nt,At,gt))),Ir)break;nt=nt.return}0<Sn.length&&(vt=new _t(vt,Jt,null,S,Ct),Et.push({event:vt,listeners:Sn}))}}if((g&7)===0){e:{if(vt=h==="mouseover"||h==="pointerover",_t=h==="mouseout"||h==="pointerout",vt&&S!==Ss&&(Jt=S.relatedTarget||S.fromElement)&&(It(Jt)||Jt[cn]))break e;if((_t||vt)&&(vt=Ct.window===Ct?Ct:(vt=Ct.ownerDocument)?vt.defaultView||vt.parentWindow:window,_t?(Jt=S.relatedTarget||S.toElement,_t=xt,Jt=Jt?It(Jt):null,Jt!==null&&(Ir=s(Jt),Sn=Jt.tag,Jt!==Ir||Sn!==5&&Sn!==27&&Sn!==6)&&(Jt=null)):(_t=null,Jt=xt),_t!==Jt)){if(Sn=Cn,At="onMouseLeave",dt="onMouseEnter",nt="mouse",(h==="pointerout"||h==="pointerover")&&(Sn=DI,At="onPointerLeave",dt="onPointerEnter",nt="pointer"),Ir=_t==null?vt:We(_t),gt=Jt==null?vt:We(Jt),vt=new Sn(At,nt+"leave",_t,S,Ct),vt.target=Ir,vt.relatedTarget=gt,At=null,It(Ct)===xt&&(Sn=new Sn(dt,nt+"enter",Jt,S,Ct),Sn.target=gt,Sn.relatedTarget=Ir,At=Sn),Ir=At,_t&&Jt)t:{for(Sn=sle,dt=_t,nt=Jt,gt=0,At=dt;At;At=Sn(At))gt++;At=0;for(var hn=nt;hn;hn=Sn(hn))At++;for(;0<gt-At;)dt=Sn(dt),gt--;for(;0<At-gt;)nt=Sn(nt),At--;for(;gt--;){if(dt===nt||nt!==null&&dt===nt.alternate){Sn=dt;break t}dt=Sn(dt),nt=Sn(nt)}Sn=null}else Sn=null;_t!==null&&kU(Et,vt,_t,Sn,!1),Jt!==null&&Ir!==null&&kU(Et,Ir,Jt,Sn,!0)}}e:{if(vt=xt?We(xt):window,_t=vt.nodeName&&vt.nodeName.toLowerCase(),_t==="select"||_t==="input"&&vt.type==="file")var gr=BI;else if(zI(vt))if(HI)gr=boe;else{gr=foe;var an=poe}else _t=vt.nodeName,!_t||_t.toLowerCase()!=="input"||vt.type!=="checkbox"&&vt.type!=="radio"?xt&&za(xt.elementType)&&(gr=BI):gr=goe;if(gr&&(gr=gr(h,xt))){UI(Et,gr,S,Ct);break e}an&&an(h,vt,xt),h==="focusout"&&xt&&vt.type==="number"&&xt.memoizedProps.value!=null&&gi(vt,"number",vt.value)}switch(an=xt?We(xt):window,h){case"focusin":(zI(an)||an.contentEditable==="true")&&(Af=an,JT=xt,Fx=null);break;case"focusout":Fx=JT=Af=null;break;case"mousedown":eP=!0;break;case"contextmenu":case"mouseup":case"dragend":eP=!1,XI(Et,S,Ct);break;case"selectionchange":if(yoe)break;case"keydown":case"keyup":XI(Et,S,Ct)}var Hn;if(YT)e:{switch(h){case"compositionstart":var dr="onCompositionStart";break e;case"compositionend":dr="onCompositionEnd";break e;case"compositionupdate":dr="onCompositionUpdate";break e}dr=void 0}else Pf?OI(h,S)&&(dr="onCompositionEnd"):h==="keydown"&&S.keyCode===229&&(dr="onCompositionStart");dr&&(RI&&S.locale!=="ko"&&(Pf||dr!=="onCompositionStart"?dr==="onCompositionEnd"&&Pf&&(Hn=kt()):(bt=Ct,Ot="value"in bt?bt.value:bt.textContent,Pf=!0)),an=iS(xt,dr),0<an.length&&(dr=new Pu(dr,h,null,S,Ct),Et.push({event:dr,listeners:an}),Hn?dr.data=Hn:(Hn=II(S),Hn!==null&&(dr.data=Hn)))),(Hn=coe?doe(h,S):uoe(h,S))&&(dr=iS(xt,"onBeforeInput"),0<dr.length&&(an=new Pu("onBeforeInput","beforeinput",null,S,Ct),Et.push({event:an,listeners:dr}),an.data=Hn)),nle(Et,h,xt,S,Ct)}SU(Et,g)})}function sy(h,g,S){return{instance:h,listener:g,currentTarget:S}}function iS(h,g){for(var S=g+"Capture",M=[];h!==null;){var H=h,Y=H.stateNode;if(H=H.tag,H!==5&&H!==26&&H!==27||Y===null||(H=Dl(h,S),H!=null&&M.unshift(sy(h,H,Y)),H=Dl(h,g),H!=null&&M.push(sy(h,H,Y))),h.tag===3)return M;h=h.return}return[]}function sle(h){if(h===null)return null;do h=h.return;while(h&&h.tag!==5&&h.tag!==27);return h||null}function kU(h,g,S,M,H){for(var Y=g._reactName,we=[];S!==null&&S!==M;){var Oe=S,Qe=Oe.alternate,xt=Oe.stateNode;if(Oe=Oe.tag,Qe!==null&&Qe===M)break;Oe!==5&&Oe!==26&&Oe!==27||xt===null||(Qe=xt,H?(xt=Dl(S,Y),xt!=null&&we.unshift(sy(S,xt,Qe))):H||(xt=Dl(S,Y),xt!=null&&we.push(sy(S,xt,Qe)))),S=S.return}we.length!==0&&h.push({event:g,listeners:we})}var ole=/\r\n?/g,lle=/\u0000|\uFFFD/g;function NU(h){return(typeof h=="string"?h:""+h).replace(ole,`
- `).replace(lle,"")}function CU(h,g){return g=NU(g),NU(h)===g}function Or(h,g,S,M,H,Y){switch(S){case"children":typeof M=="string"?g==="body"||g==="textarea"&&M===""||Fr(h,M):(typeof M=="number"||typeof M=="bigint")&&g!=="body"&&Fr(h,""+M);break;case"className":rn(h,"class",M);break;case"tabIndex":rn(h,"tabindex",M);break;case"dir":case"role":case"viewBox":case"width":case"height":rn(h,S,M);break;case"style":kf(h,M,Y);break;case"data":if(g!=="object"){rn(h,"data",M);break}case"src":case"href":if(M===""&&(g!=="a"||S!=="href")){h.removeAttribute(S);break}if(M==null||typeof M=="function"||typeof M=="symbol"||typeof M=="boolean"){h.removeAttribute(S);break}M=uc(""+M),h.setAttribute(S,M);break;case"action":case"formAction":if(typeof M=="function"){h.setAttribute(S,"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 Y=="function"&&(S==="formAction"?(g!=="input"&&Or(h,g,"name",H.name,H,null),Or(h,g,"formEncType",H.formEncType,H,null),Or(h,g,"formMethod",H.formMethod,H,null),Or(h,g,"formTarget",H.formTarget,H,null)):(Or(h,g,"encType",H.encType,H,null),Or(h,g,"method",H.method,H,null),Or(h,g,"target",H.target,H,null)));if(M==null||typeof M=="symbol"||typeof M=="boolean"){h.removeAttribute(S);break}M=uc(""+M),h.setAttribute(S,M);break;case"onClick":M!=null&&(h.onclick=Ki);break;case"onScroll":M!=null&&ar("scroll",h);break;case"onScrollEnd":M!=null&&ar("scrollend",h);break;case"dangerouslySetInnerHTML":if(M!=null){if(typeof M!="object"||!("__html"in M))throw Error(r(61));if(S=M.__html,S!=null){if(H.children!=null)throw Error(r(60));h.innerHTML=S}}break;case"multiple":h.multiple=M&&typeof M!="function"&&typeof M!="symbol";break;case"muted":h.muted=M&&typeof M!="function"&&typeof M!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(M==null||typeof M=="function"||typeof M=="boolean"||typeof M=="symbol"){h.removeAttribute("xlink:href");break}S=uc(""+M),h.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",S);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":M!=null&&typeof M!="function"&&typeof M!="symbol"?h.setAttribute(S,""+M):h.removeAttribute(S);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":M&&typeof M!="function"&&typeof M!="symbol"?h.setAttribute(S,""):h.removeAttribute(S);break;case"capture":case"download":M===!0?h.setAttribute(S,""):M!==!1&&M!=null&&typeof M!="function"&&typeof M!="symbol"?h.setAttribute(S,M):h.removeAttribute(S);break;case"cols":case"rows":case"size":case"span":M!=null&&typeof M!="function"&&typeof M!="symbol"&&!isNaN(M)&&1<=M?h.setAttribute(S,M):h.removeAttribute(S);break;case"rowSpan":case"start":M==null||typeof M=="function"||typeof M=="symbol"||isNaN(M)?h.removeAttribute(S):h.setAttribute(S,M);break;case"popover":ar("beforetoggle",h),ar("toggle",h),mn(h,"popover",M);break;case"xlinkActuate":vn(h,"http://www.w3.org/1999/xlink","xlink:actuate",M);break;case"xlinkArcrole":vn(h,"http://www.w3.org/1999/xlink","xlink:arcrole",M);break;case"xlinkRole":vn(h,"http://www.w3.org/1999/xlink","xlink:role",M);break;case"xlinkShow":vn(h,"http://www.w3.org/1999/xlink","xlink:show",M);break;case"xlinkTitle":vn(h,"http://www.w3.org/1999/xlink","xlink:title",M);break;case"xlinkType":vn(h,"http://www.w3.org/1999/xlink","xlink:type",M);break;case"xmlBase":vn(h,"http://www.w3.org/XML/1998/namespace","xml:base",M);break;case"xmlLang":vn(h,"http://www.w3.org/XML/1998/namespace","xml:lang",M);break;case"xmlSpace":vn(h,"http://www.w3.org/XML/1998/namespace","xml:space",M);break;case"is":mn(h,"is",M);break;case"innerText":case"textContent":break;default:(!(2<S.length)||S[0]!=="o"&&S[0]!=="O"||S[1]!=="n"&&S[1]!=="N")&&(S=Nf.get(S)||S,mn(h,S,M))}}function NA(h,g,S,M,H,Y){switch(S){case"style":kf(h,M,Y);break;case"dangerouslySetInnerHTML":if(M!=null){if(typeof M!="object"||!("__html"in M))throw Error(r(61));if(S=M.__html,S!=null){if(H.children!=null)throw Error(r(60));h.innerHTML=S}}break;case"children":typeof M=="string"?Fr(h,M):(typeof M=="number"||typeof M=="bigint")&&Fr(h,""+M);break;case"onScroll":M!=null&&ar("scroll",h);break;case"onScrollEnd":M!=null&&ar("scrollend",h);break;case"onClick":M!=null&&(h.onclick=Ki);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!mt.hasOwnProperty(S))e:{if(S[0]==="o"&&S[1]==="n"&&(H=S.endsWith("Capture"),g=S.slice(2,H?S.length-7:void 0),Y=h[on]||null,Y=Y!=null?Y[S]:null,typeof Y=="function"&&h.removeEventListener(g,Y,H),typeof M=="function")){typeof Y!="function"&&Y!==null&&(S in h?h[S]=null:h.hasAttribute(S)&&h.removeAttribute(S)),h.addEventListener(g,M,H);break e}S in h?h[S]=M:M===!0?h.setAttribute(S,""):mn(h,S,M)}}}function $a(h,g,S){switch(g){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":ar("error",h),ar("load",h);var M=!1,H=!1,Y;for(Y in S)if(S.hasOwnProperty(Y)){var we=S[Y];if(we!=null)switch(Y){case"src":M=!0;break;case"srcSet":H=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,g));default:Or(h,g,Y,we,S,null)}}H&&Or(h,g,"srcSet",S.srcSet,S,null),M&&Or(h,g,"src",S.src,S,null);return;case"input":ar("invalid",h);var Oe=Y=we=H=null,Qe=null,xt=null;for(M in S)if(S.hasOwnProperty(M)){var Ct=S[M];if(Ct!=null)switch(M){case"name":H=Ct;break;case"type":we=Ct;break;case"checked":Qe=Ct;break;case"defaultChecked":xt=Ct;break;case"value":Y=Ct;break;case"defaultValue":Oe=Ct;break;case"children":case"dangerouslySetInnerHTML":if(Ct!=null)throw Error(r(137,g));break;default:Or(h,g,M,Ct,S,null)}}zn(h,Y,Oe,Qe,xt,we,H,!1);return;case"select":ar("invalid",h),M=we=Y=null;for(H in S)if(S.hasOwnProperty(H)&&(Oe=S[H],Oe!=null))switch(H){case"value":Y=Oe;break;case"defaultValue":we=Oe;break;case"multiple":M=Oe;default:Or(h,g,H,Oe,S,null)}g=Y,S=we,h.multiple=!!M,g!=null?tr(h,!!M,g,!1):S!=null&&tr(h,!!M,S,!0);return;case"textarea":ar("invalid",h),Y=H=M=null;for(we in S)if(S.hasOwnProperty(we)&&(Oe=S[we],Oe!=null))switch(we){case"value":M=Oe;break;case"defaultValue":H=Oe;break;case"children":Y=Oe;break;case"dangerouslySetInnerHTML":if(Oe!=null)throw Error(r(91));break;default:Or(h,g,we,Oe,S,null)}ni(h,M,H,Y);return;case"option":for(Qe in S)S.hasOwnProperty(Qe)&&(M=S[Qe],M!=null)&&(Qe==="selected"?h.selected=M&&typeof M!="function"&&typeof M!="symbol":Or(h,g,Qe,M,S,null));return;case"dialog":ar("beforetoggle",h),ar("toggle",h),ar("cancel",h),ar("close",h);break;case"iframe":case"object":ar("load",h);break;case"video":case"audio":for(M=0;M<ay.length;M++)ar(ay[M],h);break;case"image":ar("error",h),ar("load",h);break;case"details":ar("toggle",h);break;case"embed":case"source":case"link":ar("error",h),ar("load",h);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(xt in S)if(S.hasOwnProperty(xt)&&(M=S[xt],M!=null))switch(xt){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,g));default:Or(h,g,xt,M,S,null)}return;default:if(za(g)){for(Ct in S)S.hasOwnProperty(Ct)&&(M=S[Ct],M!==void 0&&NA(h,g,Ct,M,S,void 0));return}}for(Oe in S)S.hasOwnProperty(Oe)&&(M=S[Oe],M!=null&&Or(h,g,Oe,M,S,null))}function cle(h,g,S,M){switch(g){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var H=null,Y=null,we=null,Oe=null,Qe=null,xt=null,Ct=null;for(_t in S){var Et=S[_t];if(S.hasOwnProperty(_t)&&Et!=null)switch(_t){case"checked":break;case"value":break;case"defaultValue":Qe=Et;default:M.hasOwnProperty(_t)||Or(h,g,_t,null,M,Et)}}for(var vt in M){var _t=M[vt];if(Et=S[vt],M.hasOwnProperty(vt)&&(_t!=null||Et!=null))switch(vt){case"type":Y=_t;break;case"name":H=_t;break;case"checked":xt=_t;break;case"defaultChecked":Ct=_t;break;case"value":we=_t;break;case"defaultValue":Oe=_t;break;case"children":case"dangerouslySetInnerHTML":if(_t!=null)throw Error(r(137,g));break;default:_t!==Et&&Or(h,g,vt,_t,M,Et)}}ci(h,we,Oe,Qe,xt,Ct,Y,H);return;case"select":_t=we=Oe=vt=null;for(Y in S)if(Qe=S[Y],S.hasOwnProperty(Y)&&Qe!=null)switch(Y){case"value":break;case"multiple":_t=Qe;default:M.hasOwnProperty(Y)||Or(h,g,Y,null,M,Qe)}for(H in M)if(Y=M[H],Qe=S[H],M.hasOwnProperty(H)&&(Y!=null||Qe!=null))switch(H){case"value":vt=Y;break;case"defaultValue":Oe=Y;break;case"multiple":we=Y;default:Y!==Qe&&Or(h,g,H,Y,M,Qe)}g=Oe,S=we,M=_t,vt!=null?tr(h,!!S,vt,!1):!!M!=!!S&&(g!=null?tr(h,!!S,g,!0):tr(h,!!S,S?[]:"",!1));return;case"textarea":_t=vt=null;for(Oe in S)if(H=S[Oe],S.hasOwnProperty(Oe)&&H!=null&&!M.hasOwnProperty(Oe))switch(Oe){case"value":break;case"children":break;default:Or(h,g,Oe,null,M,H)}for(we in M)if(H=M[we],Y=S[we],M.hasOwnProperty(we)&&(H!=null||Y!=null))switch(we){case"value":vt=H;break;case"defaultValue":_t=H;break;case"children":break;case"dangerouslySetInnerHTML":if(H!=null)throw Error(r(91));break;default:H!==Y&&Or(h,g,we,H,M,Y)}bi(h,vt,_t);return;case"option":for(var Jt in S)vt=S[Jt],S.hasOwnProperty(Jt)&&vt!=null&&!M.hasOwnProperty(Jt)&&(Jt==="selected"?h.selected=!1:Or(h,g,Jt,null,M,vt));for(Qe in M)vt=M[Qe],_t=S[Qe],M.hasOwnProperty(Qe)&&vt!==_t&&(vt!=null||_t!=null)&&(Qe==="selected"?h.selected=vt&&typeof vt!="function"&&typeof vt!="symbol":Or(h,g,Qe,vt,M,_t));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 Sn in S)vt=S[Sn],S.hasOwnProperty(Sn)&&vt!=null&&!M.hasOwnProperty(Sn)&&Or(h,g,Sn,null,M,vt);for(xt in M)if(vt=M[xt],_t=S[xt],M.hasOwnProperty(xt)&&vt!==_t&&(vt!=null||_t!=null))switch(xt){case"children":case"dangerouslySetInnerHTML":if(vt!=null)throw Error(r(137,g));break;default:Or(h,g,xt,vt,M,_t)}return;default:if(za(g)){for(var Ir in S)vt=S[Ir],S.hasOwnProperty(Ir)&&vt!==void 0&&!M.hasOwnProperty(Ir)&&NA(h,g,Ir,void 0,M,vt);for(Ct in M)vt=M[Ct],_t=S[Ct],!M.hasOwnProperty(Ct)||vt===_t||vt===void 0&&_t===void 0||NA(h,g,Ct,vt,M,_t);return}}for(var dt in S)vt=S[dt],S.hasOwnProperty(dt)&&vt!=null&&!M.hasOwnProperty(dt)&&Or(h,g,dt,null,M,vt);for(Et in M)vt=M[Et],_t=S[Et],!M.hasOwnProperty(Et)||vt===_t||vt==null&&_t==null||Or(h,g,Et,vt,M,_t)}function TU(h){switch(h){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function dle(){if(typeof performance.getEntriesByType=="function"){for(var h=0,g=0,S=performance.getEntriesByType("resource"),M=0;M<S.length;M++){var H=S[M],Y=H.transferSize,we=H.initiatorType,Oe=H.duration;if(Y&&Oe&&TU(we)){for(we=0,Oe=H.responseEnd,M+=1;M<S.length;M++){var Qe=S[M],xt=Qe.startTime;if(xt>Oe)break;var Ct=Qe.transferSize,Et=Qe.initiatorType;Ct&&TU(Et)&&(Qe=Qe.responseEnd,we+=Ct*(Qe<Oe?1:(Oe-xt)/(Qe-xt)))}if(--M,g+=8*(Y+we)/(H.duration/1e3),h++,10<h)break}}if(0<h)return g/h/1e6}return navigator.connection&&(h=navigator.connection.downlink,typeof h=="number")?h:5}var CA=null,TA=null;function aS(h){return h.nodeType===9?h:h.ownerDocument}function PU(h){switch(h){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function AU(h,g){if(h===0)switch(g){case"svg":return 1;case"math":return 2;default:return 0}return h===1&&g==="foreignObject"?0:h}function PA(h,g){return h==="textarea"||h==="noscript"||typeof g.children=="string"||typeof g.children=="number"||typeof g.children=="bigint"||typeof g.dangerouslySetInnerHTML=="object"&&g.dangerouslySetInnerHTML!==null&&g.dangerouslySetInnerHTML.__html!=null}var AA=null;function ule(){var h=window.event;return h&&h.type==="popstate"?h===AA?!1:(AA=h,!0):(AA=null,!1)}var MU=typeof setTimeout=="function"?setTimeout:void 0,mle=typeof clearTimeout=="function"?clearTimeout:void 0,EU=typeof Promise=="function"?Promise:void 0,hle=typeof queueMicrotask=="function"?queueMicrotask:typeof EU<"u"?function(h){return EU.resolve(null).then(h).catch(ple)}:MU;function ple(h){setTimeout(function(){throw h})}function Vu(h){return h==="head"}function jU(h,g){var S=g,M=0;do{var H=S.nextSibling;if(h.removeChild(S),H&&H.nodeType===8)if(S=H.data,S==="/$"||S==="/&"){if(M===0){h.removeChild(H),ng(g);return}M--}else if(S==="$"||S==="$?"||S==="$~"||S==="$!"||S==="&")M++;else if(S==="html")oy(h.ownerDocument.documentElement);else if(S==="head"){S=h.ownerDocument.head,oy(S);for(var Y=S.firstChild;Y;){var we=Y.nextSibling,Oe=Y.nodeName;Y[at]||Oe==="SCRIPT"||Oe==="STYLE"||Oe==="LINK"&&Y.rel.toLowerCase()==="stylesheet"||S.removeChild(Y),Y=we}}else S==="body"&&oy(h.ownerDocument.body);S=H}while(S);ng(g)}function DU(h,g){var S=h;h=0;do{var M=S.nextSibling;if(S.nodeType===1?g?(S._stashedDisplay=S.style.display,S.style.display="none"):(S.style.display=S._stashedDisplay||"",S.getAttribute("style")===""&&S.removeAttribute("style")):S.nodeType===3&&(g?(S._stashedText=S.nodeValue,S.nodeValue=""):S.nodeValue=S._stashedText||""),M&&M.nodeType===8)if(S=M.data,S==="/$"){if(h===0)break;h--}else S!=="$"&&S!=="$?"&&S!=="$~"&&S!=="$!"||h++;S=M}while(S)}function MA(h){var g=h.firstChild;for(g&&g.nodeType===10&&(g=g.nextSibling);g;){var S=g;switch(g=g.nextSibling,S.nodeName){case"HTML":case"HEAD":case"BODY":MA(S),Ke(S);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(S.rel.toLowerCase()==="stylesheet")continue}h.removeChild(S)}}function fle(h,g,S,M){for(;h.nodeType===1;){var H=S;if(h.nodeName.toLowerCase()!==g.toLowerCase()){if(!M&&(h.nodeName!=="INPUT"||h.type!=="hidden"))break}else if(M){if(!h[at])switch(g){case"meta":if(!h.hasAttribute("itemprop"))break;return h;case"link":if(Y=h.getAttribute("rel"),Y==="stylesheet"&&h.hasAttribute("data-precedence"))break;if(Y!==H.rel||h.getAttribute("href")!==(H.href==null||H.href===""?null:H.href)||h.getAttribute("crossorigin")!==(H.crossOrigin==null?null:H.crossOrigin)||h.getAttribute("title")!==(H.title==null?null:H.title))break;return h;case"style":if(h.hasAttribute("data-precedence"))break;return h;case"script":if(Y=h.getAttribute("src"),(Y!==(H.src==null?null:H.src)||h.getAttribute("type")!==(H.type==null?null:H.type)||h.getAttribute("crossorigin")!==(H.crossOrigin==null?null:H.crossOrigin))&&Y&&h.hasAttribute("async")&&!h.hasAttribute("itemprop"))break;return h;default:return h}}else if(g==="input"&&h.type==="hidden"){var Y=H.name==null?null:""+H.name;if(H.type==="hidden"&&h.getAttribute("name")===Y)return h}else return h;if(h=Wo(h.nextSibling),h===null)break}return null}function gle(h,g,S){if(g==="")return null;for(;h.nodeType!==3;)if((h.nodeType!==1||h.nodeName!=="INPUT"||h.type!=="hidden")&&!S||(h=Wo(h.nextSibling),h===null))return null;return h}function RU(h,g){for(;h.nodeType!==8;)if((h.nodeType!==1||h.nodeName!=="INPUT"||h.type!=="hidden")&&!g||(h=Wo(h.nextSibling),h===null))return null;return h}function EA(h){return h.data==="$?"||h.data==="$~"}function jA(h){return h.data==="$!"||h.data==="$?"&&h.ownerDocument.readyState!=="loading"}function ble(h,g){var S=h.ownerDocument;if(h.data==="$~")h._reactRetry=g;else if(h.data!=="$?"||S.readyState!=="loading")g();else{var M=function(){g(),S.removeEventListener("DOMContentLoaded",M)};S.addEventListener("DOMContentLoaded",M),h._reactRetry=M}}function Wo(h){for(;h!=null;h=h.nextSibling){var g=h.nodeType;if(g===1||g===3)break;if(g===8){if(g=h.data,g==="$"||g==="$!"||g==="$?"||g==="$~"||g==="&"||g==="F!"||g==="F")break;if(g==="/$"||g==="/&")return null}}return h}var DA=null;function FU(h){h=h.nextSibling;for(var g=0;h;){if(h.nodeType===8){var S=h.data;if(S==="/$"||S==="/&"){if(g===0)return Wo(h.nextSibling);g--}else S!=="$"&&S!=="$!"&&S!=="$?"&&S!=="$~"&&S!=="&"||g++}h=h.nextSibling}return null}function LU(h){h=h.previousSibling;for(var g=0;h;){if(h.nodeType===8){var S=h.data;if(S==="$"||S==="$!"||S==="$?"||S==="$~"||S==="&"){if(g===0)return h;g--}else S!=="/$"&&S!=="/&"||g++}h=h.previousSibling}return null}function OU(h,g,S){switch(g=aS(S),h){case"html":if(h=g.documentElement,!h)throw Error(r(452));return h;case"head":if(h=g.head,!h)throw Error(r(453));return h;case"body":if(h=g.body,!h)throw Error(r(454));return h;default:throw Error(r(451))}}function oy(h){for(var g=h.attributes;g.length;)h.removeAttributeNode(g[0]);Ke(h)}var Ko=new Map,IU=new Set;function sS(h){return typeof h.getRootNode=="function"?h.getRootNode():h.nodeType===9?h:h.ownerDocument}var yd=J.d;J.d={f:xle,r:yle,D:vle,C:wle,L:Sle,m:_le,X:Nle,S:kle,M:Cle};function xle(){var h=yd.f(),g=Qw();return h||g}function yle(h){var g=Te(h);g!==null&&g.tag===5&&g.type==="form"?tz(g):yd.r(h)}var Jf=typeof document>"u"?null:document;function zU(h,g,S){var M=Jf;if(M&&typeof g=="string"&&g){var H=lr(g);H='link[rel="'+h+'"][href="'+H+'"]',typeof S=="string"&&(H+='[crossorigin="'+S+'"]'),IU.has(H)||(IU.add(H),h={rel:h,crossOrigin:S,href:g},M.querySelector(H)===null&&(g=M.createElement("link"),$a(g,"link",h),Ze(g),M.head.appendChild(g)))}}function vle(h){yd.D(h),zU("dns-prefetch",h,null)}function wle(h,g){yd.C(h,g),zU("preconnect",h,g)}function Sle(h,g,S){yd.L(h,g,S);var M=Jf;if(M&&h&&g){var H='link[rel="preload"][as="'+lr(g)+'"]';g==="image"&&S&&S.imageSrcSet?(H+='[imagesrcset="'+lr(S.imageSrcSet)+'"]',typeof S.imageSizes=="string"&&(H+='[imagesizes="'+lr(S.imageSizes)+'"]')):H+='[href="'+lr(h)+'"]';var Y=H;switch(g){case"style":Y=eg(h);break;case"script":Y=tg(h)}Ko.has(Y)||(h=m({rel:"preload",href:g==="image"&&S&&S.imageSrcSet?void 0:h,as:g},S),Ko.set(Y,h),M.querySelector(H)!==null||g==="style"&&M.querySelector(ly(Y))||g==="script"&&M.querySelector(cy(Y))||(g=M.createElement("link"),$a(g,"link",h),Ze(g),M.head.appendChild(g)))}}function _le(h,g){yd.m(h,g);var S=Jf;if(S&&h){var M=g&&typeof g.as=="string"?g.as:"script",H='link[rel="modulepreload"][as="'+lr(M)+'"][href="'+lr(h)+'"]',Y=H;switch(M){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":Y=tg(h)}if(!Ko.has(Y)&&(h=m({rel:"modulepreload",href:h},g),Ko.set(Y,h),S.querySelector(H)===null)){switch(M){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(S.querySelector(cy(Y)))return}M=S.createElement("link"),$a(M,"link",h),Ze(M),S.head.appendChild(M)}}}function kle(h,g,S){yd.S(h,g,S);var M=Jf;if(M&&h){var H=et(M).hoistableStyles,Y=eg(h);g=g||"default";var we=H.get(Y);if(!we){var Oe={loading:0,preload:null};if(we=M.querySelector(ly(Y)))Oe.loading=5;else{h=m({rel:"stylesheet",href:h,"data-precedence":g},S),(S=Ko.get(Y))&&RA(h,S);var Qe=we=M.createElement("link");Ze(Qe),$a(Qe,"link",h),Qe._p=new Promise(function(xt,Ct){Qe.onload=xt,Qe.onerror=Ct}),Qe.addEventListener("load",function(){Oe.loading|=1}),Qe.addEventListener("error",function(){Oe.loading|=2}),Oe.loading|=4,oS(we,g,M)}we={type:"stylesheet",instance:we,count:1,state:Oe},H.set(Y,we)}}}function Nle(h,g){yd.X(h,g);var S=Jf;if(S&&h){var M=et(S).hoistableScripts,H=tg(h),Y=M.get(H);Y||(Y=S.querySelector(cy(H)),Y||(h=m({src:h,async:!0},g),(g=Ko.get(H))&&FA(h,g),Y=S.createElement("script"),Ze(Y),$a(Y,"link",h),S.head.appendChild(Y)),Y={type:"script",instance:Y,count:1,state:null},M.set(H,Y))}}function Cle(h,g){yd.M(h,g);var S=Jf;if(S&&h){var M=et(S).hoistableScripts,H=tg(h),Y=M.get(H);Y||(Y=S.querySelector(cy(H)),Y||(h=m({src:h,async:!0,type:"module"},g),(g=Ko.get(H))&&FA(h,g),Y=S.createElement("script"),Ze(Y),$a(Y,"link",h),S.head.appendChild(Y)),Y={type:"script",instance:Y,count:1,state:null},M.set(H,Y))}}function UU(h,g,S,M){var H=(H=q.current)?sS(H):null;if(!H)throw Error(r(446));switch(h){case"meta":case"title":return null;case"style":return typeof S.precedence=="string"&&typeof S.href=="string"?(g=eg(S.href),S=et(H).hoistableStyles,M=S.get(g),M||(M={type:"style",instance:null,count:0,state:null},S.set(g,M)),M):{type:"void",instance:null,count:0,state:null};case"link":if(S.rel==="stylesheet"&&typeof S.href=="string"&&typeof S.precedence=="string"){h=eg(S.href);var Y=et(H).hoistableStyles,we=Y.get(h);if(we||(H=H.ownerDocument||H,we={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},Y.set(h,we),(Y=H.querySelector(ly(h)))&&!Y._p&&(we.instance=Y,we.state.loading=5),Ko.has(h)||(S={rel:"preload",as:"style",href:S.href,crossOrigin:S.crossOrigin,integrity:S.integrity,media:S.media,hrefLang:S.hrefLang,referrerPolicy:S.referrerPolicy},Ko.set(h,S),Y||Tle(H,h,S,we.state))),g&&M===null)throw Error(r(528,""));return we}if(g&&M!==null)throw Error(r(529,""));return null;case"script":return g=S.async,S=S.src,typeof S=="string"&&g&&typeof g!="function"&&typeof g!="symbol"?(g=tg(S),S=et(H).hoistableScripts,M=S.get(g),M||(M={type:"script",instance:null,count:0,state:null},S.set(g,M)),M):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,h))}}function eg(h){return'href="'+lr(h)+'"'}function ly(h){return'link[rel="stylesheet"]['+h+"]"}function BU(h){return m({},h,{"data-precedence":h.precedence,precedence:null})}function Tle(h,g,S,M){h.querySelector('link[rel="preload"][as="style"]['+g+"]")?M.loading=1:(g=h.createElement("link"),M.preload=g,g.addEventListener("load",function(){return M.loading|=1}),g.addEventListener("error",function(){return M.loading|=2}),$a(g,"link",S),Ze(g),h.head.appendChild(g))}function tg(h){return'[src="'+lr(h)+'"]'}function cy(h){return"script[async]"+h}function HU(h,g,S){if(g.count++,g.instance===null)switch(g.type){case"style":var M=h.querySelector('style[data-href~="'+lr(S.href)+'"]');if(M)return g.instance=M,Ze(M),M;var H=m({},S,{"data-href":S.href,"data-precedence":S.precedence,href:null,precedence:null});return M=(h.ownerDocument||h).createElement("style"),Ze(M),$a(M,"style",H),oS(M,S.precedence,h),g.instance=M;case"stylesheet":H=eg(S.href);var Y=h.querySelector(ly(H));if(Y)return g.state.loading|=4,g.instance=Y,Ze(Y),Y;M=BU(S),(H=Ko.get(H))&&RA(M,H),Y=(h.ownerDocument||h).createElement("link"),Ze(Y);var we=Y;return we._p=new Promise(function(Oe,Qe){we.onload=Oe,we.onerror=Qe}),$a(Y,"link",M),g.state.loading|=4,oS(Y,S.precedence,h),g.instance=Y;case"script":return Y=tg(S.src),(H=h.querySelector(cy(Y)))?(g.instance=H,Ze(H),H):(M=S,(H=Ko.get(Y))&&(M=m({},S),FA(M,H)),h=h.ownerDocument||h,H=h.createElement("script"),Ze(H),$a(H,"link",M),h.head.appendChild(H),g.instance=H);case"void":return null;default:throw Error(r(443,g.type))}else g.type==="stylesheet"&&(g.state.loading&4)===0&&(M=g.instance,g.state.loading|=4,oS(M,S.precedence,h));return g.instance}function oS(h,g,S){for(var M=S.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),H=M.length?M[M.length-1]:null,Y=H,we=0;we<M.length;we++){var Oe=M[we];if(Oe.dataset.precedence===g)Y=Oe;else if(Y!==H)break}Y?Y.parentNode.insertBefore(h,Y.nextSibling):(g=S.nodeType===9?S.head:S,g.insertBefore(h,g.firstChild))}function RA(h,g){h.crossOrigin==null&&(h.crossOrigin=g.crossOrigin),h.referrerPolicy==null&&(h.referrerPolicy=g.referrerPolicy),h.title==null&&(h.title=g.title)}function FA(h,g){h.crossOrigin==null&&(h.crossOrigin=g.crossOrigin),h.referrerPolicy==null&&(h.referrerPolicy=g.referrerPolicy),h.integrity==null&&(h.integrity=g.integrity)}var lS=null;function $U(h,g,S){if(lS===null){var M=new Map,H=lS=new Map;H.set(S,M)}else H=lS,M=H.get(S),M||(M=new Map,H.set(S,M));if(M.has(h))return M;for(M.set(h,null),S=S.getElementsByTagName(h),H=0;H<S.length;H++){var Y=S[H];if(!(Y[at]||Y[nn]||h==="link"&&Y.getAttribute("rel")==="stylesheet")&&Y.namespaceURI!=="http://www.w3.org/2000/svg"){var we=Y.getAttribute(g)||"";we=h+we;var Oe=M.get(we);Oe?Oe.push(Y):M.set(we,[Y])}}return M}function qU(h,g,S){h=h.ownerDocument||h,h.head.insertBefore(S,g==="title"?h.querySelector("head > title"):null)}function Ple(h,g,S){if(S===1||g.itemProp!=null)return!1;switch(h){case"meta":case"title":return!0;case"style":if(typeof g.precedence!="string"||typeof g.href!="string"||g.href==="")break;return!0;case"link":if(typeof g.rel!="string"||typeof g.href!="string"||g.href===""||g.onLoad||g.onError)break;return g.rel==="stylesheet"?(h=g.disabled,typeof g.precedence=="string"&&h==null):!0;case"script":if(g.async&&typeof g.async!="function"&&typeof g.async!="symbol"&&!g.onLoad&&!g.onError&&g.src&&typeof g.src=="string")return!0}return!1}function VU(h){return!(h.type==="stylesheet"&&(h.state.loading&3)===0)}function Ale(h,g,S,M){if(S.type==="stylesheet"&&(typeof M.media!="string"||matchMedia(M.media).matches!==!1)&&(S.state.loading&4)===0){if(S.instance===null){var H=eg(M.href),Y=g.querySelector(ly(H));if(Y){g=Y._p,g!==null&&typeof g=="object"&&typeof g.then=="function"&&(h.count++,h=cS.bind(h),g.then(h,h)),S.state.loading|=4,S.instance=Y,Ze(Y);return}Y=g.ownerDocument||g,M=BU(M),(H=Ko.get(H))&&RA(M,H),Y=Y.createElement("link"),Ze(Y);var we=Y;we._p=new Promise(function(Oe,Qe){we.onload=Oe,we.onerror=Qe}),$a(Y,"link",M),S.instance=Y}h.stylesheets===null&&(h.stylesheets=new Map),h.stylesheets.set(S,g),(g=S.state.preload)&&(S.state.loading&3)===0&&(h.count++,S=cS.bind(h),g.addEventListener("load",S),g.addEventListener("error",S))}}var LA=0;function Mle(h,g){return h.stylesheets&&h.count===0&&uS(h,h.stylesheets),0<h.count||0<h.imgCount?function(S){var M=setTimeout(function(){if(h.stylesheets&&uS(h,h.stylesheets),h.unsuspend){var Y=h.unsuspend;h.unsuspend=null,Y()}},6e4+g);0<h.imgBytes&&LA===0&&(LA=62500*dle());var H=setTimeout(function(){if(h.waitingForImages=!1,h.count===0&&(h.stylesheets&&uS(h,h.stylesheets),h.unsuspend)){var Y=h.unsuspend;h.unsuspend=null,Y()}},(h.imgBytes>LA?50:800)+g);return h.unsuspend=S,function(){h.unsuspend=null,clearTimeout(M),clearTimeout(H)}}:null}function cS(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)uS(this,this.stylesheets);else if(this.unsuspend){var h=this.unsuspend;this.unsuspend=null,h()}}}var dS=null;function uS(h,g){h.stylesheets=null,h.unsuspend!==null&&(h.count++,dS=new Map,g.forEach(Ele,h),dS=null,cS.call(h))}function Ele(h,g){if(!(g.state.loading&4)){var S=dS.get(h);if(S)var M=S.get(null);else{S=new Map,dS.set(h,S);for(var H=h.querySelectorAll("link[data-precedence],style[data-precedence]"),Y=0;Y<H.length;Y++){var we=H[Y];(we.nodeName==="LINK"||we.getAttribute("media")!=="not all")&&(S.set(we.dataset.precedence,we),M=we)}M&&S.set(null,M)}H=g.instance,we=H.getAttribute("data-precedence"),Y=S.get(we)||M,Y===M&&S.set(null,H),S.set(we,H),this.count++,M=cS.bind(this),H.addEventListener("load",M),H.addEventListener("error",M),Y?Y.parentNode.insertBefore(H,Y.nextSibling):(h=h.nodeType===9?h.head:h,h.insertBefore(H,h.firstChild)),g.state.loading|=4}}var dy={$$typeof:k,Provider:null,Consumer:null,_currentValue:ue,_currentValue2:ue,_threadCount:0};function jle(h,g,S,M,H,Y,we,Oe,Qe){this.tag=1,this.containerInfo=h,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=St(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=St(0),this.hiddenUpdates=St(null),this.identifierPrefix=M,this.onUncaughtError=H,this.onCaughtError=Y,this.onRecoverableError=we,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=Qe,this.incompleteTransitions=new Map}function GU(h,g,S,M,H,Y,we,Oe,Qe,xt,Ct,Et){return h=new jle(h,g,S,we,Qe,xt,Ct,Et,Oe),g=1,Y===!0&&(g|=24),Y=xo(3,null,null,g),h.current=Y,Y.stateNode=h,g=fP(),g.refCount++,h.pooledCache=g,g.refCount++,Y.memoizedState={element:M,isDehydrated:S,cache:g},yP(Y),h}function WU(h){return h?(h=jf,h):jf}function KU(h,g,S,M,H,Y){H=WU(H),M.context===null?M.context=H:M.pendingContext=H,M=Ru(g),M.payload={element:S},Y=Y===void 0?null:Y,Y!==null&&(M.callback=Y),S=Fu(h,M,g),S!==null&&(Xs(S,h,g),Hx(S,h,g))}function YU(h,g){if(h=h.memoizedState,h!==null&&h.dehydrated!==null){var S=h.retryLane;h.retryLane=S!==0&&S<g?S:g}}function OA(h,g){YU(h,g),(h=h.alternate)&&YU(h,g)}function XU(h){if(h.tag===13||h.tag===31){var g=Th(h,67108864);g!==null&&Xs(g,h,67108864),OA(h,67108864)}}function QU(h){if(h.tag===13||h.tag===31){var g=_o();g=Bt(g);var S=Th(h,g);S!==null&&Xs(S,h,g),OA(h,g)}}var mS=!0;function Dle(h,g,S,M){var H=re.T;re.T=null;var Y=J.p;try{J.p=2,IA(h,g,S,M)}finally{J.p=Y,re.T=H}}function Rle(h,g,S,M){var H=re.T;re.T=null;var Y=J.p;try{J.p=8,IA(h,g,S,M)}finally{J.p=Y,re.T=H}}function IA(h,g,S,M){if(mS){var H=zA(M);if(H===null)kA(h,g,M,hS,S),JU(h,M);else if(Lle(H,h,g,S,M))M.stopPropagation();else if(JU(h,M),g&4&&-1<Fle.indexOf(h)){for(;H!==null;){var Y=Te(H);if(Y!==null)switch(Y.tag){case 3:if(Y=Y.stateNode,Y.current.memoizedState.isDehydrated){var we=je(Y.pendingLanes);if(we!==0){var Oe=Y;for(Oe.pendingLanes|=2,Oe.entangledLanes|=2;we;){var Qe=1<<31-ke(we);Oe.entanglements[1]|=Qe,we&=~Qe}gc(Y),(Sr&6)===0&&(Yw=F()+500,iy(0))}}break;case 31:case 13:Oe=Th(Y,2),Oe!==null&&Xs(Oe,Y,2),Qw(),OA(Y,2)}if(Y=zA(M),Y===null&&kA(h,g,M,hS,S),Y===H)break;H=Y}H!==null&&M.stopPropagation()}else kA(h,g,M,null,S)}}function zA(h){return h=_s(h),UA(h)}var hS=null;function UA(h){if(hS=null,h=It(h),h!==null){var g=s(h);if(g===null)h=null;else{var S=g.tag;if(S===13){if(h=o(g),h!==null)return h;h=null}else if(S===31){if(h=l(g),h!==null)return h;h=null}else if(S===3){if(g.stateNode.current.memoizedState.isDehydrated)return g.tag===3?g.stateNode.containerInfo:null;h=null}else g!==h&&(h=null)}}return hS=h,null}function ZU(h){switch(h){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(Q()){case ve:return 2;case he:return 8;case de:case Ae:return 32;case _e:return 268435456;default:return 32}default:return 32}}var BA=!1,Gu=null,Wu=null,Ku=null,uy=new Map,my=new Map,Yu=[],Fle="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 JU(h,g){switch(h){case"focusin":case"focusout":Gu=null;break;case"dragenter":case"dragleave":Wu=null;break;case"mouseover":case"mouseout":Ku=null;break;case"pointerover":case"pointerout":uy.delete(g.pointerId);break;case"gotpointercapture":case"lostpointercapture":my.delete(g.pointerId)}}function hy(h,g,S,M,H,Y){return h===null||h.nativeEvent!==Y?(h={blockedOn:g,domEventName:S,eventSystemFlags:M,nativeEvent:Y,targetContainers:[H]},g!==null&&(g=Te(g),g!==null&&XU(g)),h):(h.eventSystemFlags|=M,g=h.targetContainers,H!==null&&g.indexOf(H)===-1&&g.push(H),h)}function Lle(h,g,S,M,H){switch(g){case"focusin":return Gu=hy(Gu,h,g,S,M,H),!0;case"dragenter":return Wu=hy(Wu,h,g,S,M,H),!0;case"mouseover":return Ku=hy(Ku,h,g,S,M,H),!0;case"pointerover":var Y=H.pointerId;return uy.set(Y,hy(uy.get(Y)||null,h,g,S,M,H)),!0;case"gotpointercapture":return Y=H.pointerId,my.set(Y,hy(my.get(Y)||null,h,g,S,M,H)),!0}return!1}function eB(h){var g=It(h.target);if(g!==null){var S=s(g);if(S!==null){if(g=S.tag,g===13){if(g=o(S),g!==null){h.blockedOn=g,Xt(h.priority,function(){QU(S)});return}}else if(g===31){if(g=l(S),g!==null){h.blockedOn=g,Xt(h.priority,function(){QU(S)});return}}else if(g===3&&S.stateNode.current.memoizedState.isDehydrated){h.blockedOn=S.tag===3?S.stateNode.containerInfo:null;return}}}h.blockedOn=null}function pS(h){if(h.blockedOn!==null)return!1;for(var g=h.targetContainers;0<g.length;){var S=zA(h.nativeEvent);if(S===null){S=h.nativeEvent;var M=new S.constructor(S.type,S);Ss=M,S.target.dispatchEvent(M),Ss=null}else return g=Te(S),g!==null&&XU(g),h.blockedOn=S,!1;g.shift()}return!0}function tB(h,g,S){pS(h)&&S.delete(g)}function Ole(){BA=!1,Gu!==null&&pS(Gu)&&(Gu=null),Wu!==null&&pS(Wu)&&(Wu=null),Ku!==null&&pS(Ku)&&(Ku=null),uy.forEach(tB),my.forEach(tB)}function fS(h,g){h.blockedOn===g&&(h.blockedOn=null,BA||(BA=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Ole)))}var gS=null;function nB(h){gS!==h&&(gS=h,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){gS===h&&(gS=null);for(var g=0;g<h.length;g+=3){var S=h[g],M=h[g+1],H=h[g+2];if(typeof M!="function"){if(UA(M||S)===null)continue;break}var Y=Te(S);Y!==null&&(h.splice(g,3),g-=3,zP(Y,{pending:!0,data:H,method:S.method,action:M},M,H))}}))}function ng(h){function g(Qe){return fS(Qe,h)}Gu!==null&&fS(Gu,h),Wu!==null&&fS(Wu,h),Ku!==null&&fS(Ku,h),uy.forEach(g),my.forEach(g);for(var S=0;S<Yu.length;S++){var M=Yu[S];M.blockedOn===h&&(M.blockedOn=null)}for(;0<Yu.length&&(S=Yu[0],S.blockedOn===null);)eB(S),S.blockedOn===null&&Yu.shift();if(S=(h.ownerDocument||h).$$reactFormReplay,S!=null)for(M=0;M<S.length;M+=3){var H=S[M],Y=S[M+1],we=H[on]||null;if(typeof Y=="function")we||nB(S);else if(we){var Oe=null;if(Y&&Y.hasAttribute("formAction")){if(H=Y,we=Y[on]||null)Oe=we.formAction;else if(UA(H)!==null)continue}else Oe=we.action;typeof Oe=="function"?S[M+1]=Oe:(S.splice(M,3),M-=3),nB(S)}}}function rB(){function h(Y){Y.canIntercept&&Y.info==="react-transition"&&Y.intercept({handler:function(){return new Promise(function(we){return H=we})},focusReset:"manual",scroll:"manual"})}function g(){H!==null&&(H(),H=null),M||setTimeout(S,20)}function S(){if(!M&&!navigation.transition){var Y=navigation.currentEntry;Y&&Y.url!=null&&navigation.navigate(Y.url,{state:Y.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var M=!1,H=null;return navigation.addEventListener("navigate",h),navigation.addEventListener("navigatesuccess",g),navigation.addEventListener("navigateerror",g),setTimeout(S,100),function(){M=!0,navigation.removeEventListener("navigate",h),navigation.removeEventListener("navigatesuccess",g),navigation.removeEventListener("navigateerror",g),H!==null&&(H(),H=null)}}}function HA(h){this._internalRoot=h}bS.prototype.render=HA.prototype.render=function(h){var g=this._internalRoot;if(g===null)throw Error(r(409));var S=g.current,M=_o();KU(S,M,h,g,null,null)},bS.prototype.unmount=HA.prototype.unmount=function(){var h=this._internalRoot;if(h!==null){this._internalRoot=null;var g=h.containerInfo;KU(h.current,2,null,h,null,null),Qw(),g[cn]=null}};function bS(h){this._internalRoot=h}bS.prototype.unstable_scheduleHydration=function(h){if(h){var g=xn();h={blockedOn:null,target:h,priority:g};for(var S=0;S<Yu.length&&g!==0&&g<Yu[S].priority;S++);Yu.splice(S,0,h),S===0&&eB(h)}};var iB=e.version;if(iB!=="19.2.4")throw Error(r(527,iB,"19.2.4"));J.findDOMNode=function(h){var g=h._reactInternals;if(g===void 0)throw typeof h.render=="function"?Error(r(188)):(h=Object.keys(h).join(","),Error(r(268,h)));return h=d(g),h=h!==null?u(h):null,h=h===null?null:h.stateNode,h};var Ile={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:re,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var xS=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!xS.isDisabled&&xS.supportsFiber)try{Ue=xS.inject(Ile),Ne=xS}catch{}}return fy.createRoot=function(h,g){if(!a(h))throw Error(r(299));var S=!1,M="",H=uz,Y=mz,we=hz;return g!=null&&(g.unstable_strictMode===!0&&(S=!0),g.identifierPrefix!==void 0&&(M=g.identifierPrefix),g.onUncaughtError!==void 0&&(H=g.onUncaughtError),g.onCaughtError!==void 0&&(Y=g.onCaughtError),g.onRecoverableError!==void 0&&(we=g.onRecoverableError)),g=GU(h,1,!1,null,null,S,M,null,H,Y,we,rB),h[cn]=g.current,_A(h),new HA(g)},fy.hydrateRoot=function(h,g,S){if(!a(h))throw Error(r(299));var M=!1,H="",Y=uz,we=mz,Oe=hz,Qe=null;return S!=null&&(S.unstable_strictMode===!0&&(M=!0),S.identifierPrefix!==void 0&&(H=S.identifierPrefix),S.onUncaughtError!==void 0&&(Y=S.onUncaughtError),S.onCaughtError!==void 0&&(we=S.onCaughtError),S.onRecoverableError!==void 0&&(Oe=S.onRecoverableError),S.formState!==void 0&&(Qe=S.formState)),g=GU(h,1,!0,g,S??null,M,H,Qe,Y,we,Oe,rB),g.context=WU(null),S=g.current,M=_o(),M=Bt(M),H=Ru(M),H.callback=null,Fu(S,H,M),S=M,g.current.lanes=S,ot(g,S),gc(g),h[cn]=g.current,_A(h),new bS(g)},fy.version="19.2.4",fy}var pB;function Yle(){if(pB)return VA.exports;pB=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),VA.exports=Kle(),VA.exports}var Xle=Yle();const An=t=>typeof t=="string",gy=()=>{let t,e;const n=new Promise((r,a)=>{t=r,e=a});return n.resolve=t,n.reject=e,n},fB=t=>t==null?"":""+t,Qle=(t,e,n)=>{t.forEach(r=>{e[r]&&(n[r]=e[r])})},Zle=/###/g,gB=t=>t&&t.indexOf("###")>-1?t.replace(Zle,"."):t,bB=t=>!t||An(t),av=(t,e,n)=>{const r=An(e)?e.split("."):e;let a=0;for(;a<r.length-1;){if(bB(t))return{};const s=gB(r[a]);!t[s]&&n&&(t[s]=new n),Object.prototype.hasOwnProperty.call(t,s)?t=t[s]:t={},++a}return bB(t)?{}:{obj:t,k:gB(r[a])}},xB=(t,e,n)=>{const{obj:r,k:a}=av(t,e,Object);if(r!==void 0||e.length===1){r[a]=n;return}let s=e[e.length-1],o=e.slice(0,e.length-1),l=av(t,o,Object);for(;l.obj===void 0&&o.length;)s=`${o[o.length-1]}.${s}`,o=o.slice(0,o.length-1),l=av(t,o,Object),l?.obj&&typeof l.obj[`${l.k}.${s}`]<"u"&&(l.obj=void 0);l.obj[`${l.k}.${s}`]=n},Jle=(t,e,n,r)=>{const{obj:a,k:s}=av(t,e,Object);a[s]=a[s]||[],a[s].push(n)},F1=(t,e)=>{const{obj:n,k:r}=av(t,e);if(n&&Object.prototype.hasOwnProperty.call(n,r))return n[r]},ece=(t,e,n)=>{const r=F1(t,n);return r!==void 0?r:F1(e,n)},KK=(t,e,n)=>{for(const r in e)r!=="__proto__"&&r!=="constructor"&&(r in t?An(t[r])||t[r]instanceof String||An(e[r])||e[r]instanceof String?n&&(t[r]=e[r]):KK(t[r],e[r],n):t[r]=e[r]);return t},rg=t=>t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var tce={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};const nce=t=>An(t)?t.replace(/[&<>"'\/]/g,e=>tce[e]):t;class rce{constructor(e){this.capacity=e,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(e){const n=this.regExpMap.get(e);if(n!==void 0)return n;const r=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,r),this.regExpQueue.push(e),r}}const ice=[" ",",","?","!",";"],ace=new rce(20),sce=(t,e,n)=>{e=e||"",n=n||"";const r=ice.filter(o=>e.indexOf(o)<0&&n.indexOf(o)<0);if(r.length===0)return!0;const a=ace.getRegExp(`(${r.map(o=>o==="?"?"\\?":o).join("|")})`);let s=!a.test(t);if(!s){const o=t.indexOf(n);o>0&&!a.test(t.substring(0,o))&&(s=!0)}return s},lD=(t,e,n=".")=>{if(!t)return;if(t[e])return Object.prototype.hasOwnProperty.call(t,e)?t[e]:void 0;const r=e.split(n);let a=t;for(let s=0;s<r.length;){if(!a||typeof a!="object")return;let o,l="";for(let c=s;c<r.length;++c)if(c!==s&&(l+=n),l+=r[c],o=a[l],o!==void 0){if(["string","number","boolean"].indexOf(typeof o)>-1&&c<r.length-1)continue;s+=c-s+1;break}a=o}return a},Ev=t=>t?.replace("_","-"),oce={type:"logger",log(t){this.output("log",t)},warn(t){this.output("warn",t)},error(t){this.output("error",t)},output(t,e){console?.[t]?.apply?.(console,e)}};class L1{constructor(e,n={}){this.init(e,n)}init(e,n={}){this.prefix=n.prefix||"i18next:",this.logger=e||oce,this.options=n,this.debug=n.debug}log(...e){return this.forward(e,"log","",!0)}warn(...e){return this.forward(e,"warn","",!0)}error(...e){return this.forward(e,"error","")}deprecate(...e){return this.forward(e,"warn","WARNING DEPRECATED: ",!0)}forward(e,n,r,a){return a&&!this.debug?null:(An(e[0])&&(e[0]=`${r}${this.prefix} ${e[0]}`),this.logger[n](e))}create(e){return new L1(this.logger,{prefix:`${this.prefix}:${e}:`,...this.options})}clone(e){return e=e||this.options,e.prefix=e.prefix||this.prefix,new L1(this.logger,e)}}var jc=new L1;let aC=class{constructor(){this.observers={}}on(e,n){return e.split(" ").forEach(r=>{this.observers[r]||(this.observers[r]=new Map);const a=this.observers[r].get(n)||0;this.observers[r].set(n,a+1)}),this}off(e,n){if(this.observers[e]){if(!n){delete this.observers[e];return}this.observers[e].delete(n)}}emit(e,...n){this.observers[e]&&Array.from(this.observers[e].entries()).forEach(([a,s])=>{for(let o=0;o<s;o++)a(...n)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(([a,s])=>{for(let o=0;o<s;o++)a.apply(a,[e,...n])})}};class yB extends aC{constructor(e,n={ns:["translation"],defaultNS:"translation"}){super(),this.data=e||{},this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}removeNamespaces(e){const n=this.options.ns.indexOf(e);n>-1&&this.options.ns.splice(n,1)}getResource(e,n,r,a={}){const s=a.keySeparator!==void 0?a.keySeparator:this.options.keySeparator,o=a.ignoreJSONStructure!==void 0?a.ignoreJSONStructure:this.options.ignoreJSONStructure;let l;e.indexOf(".")>-1?l=e.split("."):(l=[e,n],r&&(Array.isArray(r)?l.push(...r):An(r)&&s?l.push(...r.split(s)):l.push(r)));const c=F1(this.data,l);return!c&&!n&&!r&&e.indexOf(".")>-1&&(e=l[0],n=l[1],r=l.slice(2).join(".")),c||!o||!An(r)?c:lD(this.data?.[e]?.[n],r,s)}addResource(e,n,r,a,s={silent:!1}){const o=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator;let l=[e,n];r&&(l=l.concat(o?r.split(o):r)),e.indexOf(".")>-1&&(l=e.split("."),a=n,n=l[1]),this.addNamespaces(n),xB(this.data,l,a),s.silent||this.emit("added",e,n,r,a)}addResources(e,n,r,a={silent:!1}){for(const s in r)(An(r[s])||Array.isArray(r[s]))&&this.addResource(e,n,s,r[s],{silent:!0});a.silent||this.emit("added",e,n,r)}addResourceBundle(e,n,r,a,s,o={silent:!1,skipCopy:!1}){let l=[e,n];e.indexOf(".")>-1&&(l=e.split("."),a=r,r=n,n=l[1]),this.addNamespaces(n);let c=F1(this.data,l)||{};o.skipCopy||(r=JSON.parse(JSON.stringify(r))),a?KK(c,r,s):c={...c,...r},xB(this.data,l,c),o.silent||this.emit("added",e,n,r)}removeResourceBundle(e,n){this.hasResourceBundle(e,n)&&delete this.data[e][n],this.removeNamespaces(n),this.emit("removed",e,n)}hasResourceBundle(e,n){return this.getResource(e,n)!==void 0}getResourceBundle(e,n){return n||(n=this.options.defaultNS),this.getResource(e,n)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){const n=this.getDataByLanguage(e);return!!(n&&Object.keys(n)||[]).find(a=>n[a]&&Object.keys(n[a]).length>0)}toJSON(){return this.data}}var YK={processors:{},addPostProcessor(t){this.processors[t.name]=t},handle(t,e,n,r,a){return t.forEach(s=>{e=this.processors[s]?.process(e,n,r,a)??e}),e}};const XK=Symbol("i18next/PATH_KEY");function lce(){const t=[],e=Object.create(null);let n;return e.get=(r,a)=>(n?.revoke?.(),a===XK?t:(t.push(a),n=Proxy.revocable(r,e),n.proxy)),Proxy.revocable(Object.create(null),e).proxy}function cD(t,e){const{[XK]:n}=t(lce());return n.join(e?.keySeparator??".")}const vB={},YA=t=>!An(t)&&typeof t!="boolean"&&typeof t!="number";class O1 extends aC{constructor(e,n={}){super(),Qle(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,this),this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=jc.create("translator")}changeLanguage(e){e&&(this.language=e)}exists(e,n={interpolation:{}}){const r={...n};if(e==null)return!1;const a=this.resolve(e,r);if(a?.res===void 0)return!1;const s=YA(a.res);return!(r.returnObjects===!1&&s)}extractFromKey(e,n){let r=n.nsSeparator!==void 0?n.nsSeparator:this.options.nsSeparator;r===void 0&&(r=":");const a=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator;let s=n.ns||this.options.defaultNS||[];const o=r&&e.indexOf(r)>-1,l=!this.options.userDefinedKeySeparator&&!n.keySeparator&&!this.options.userDefinedNsSeparator&&!n.nsSeparator&&!sce(e,r,a);if(o&&!l){const c=e.match(this.interpolator.nestingRegexp);if(c&&c.length>0)return{key:e,namespaces:An(s)?[s]:s};const d=e.split(r);(r!==a||r===a&&this.options.ns.indexOf(d[0])>-1)&&(s=d.shift()),e=d.join(a)}return{key:e,namespaces:An(s)?[s]:s}}translate(e,n,r){let a=typeof n=="object"?{...n}:n;if(typeof a!="object"&&this.options.overloadTranslationOptionHandler&&(a=this.options.overloadTranslationOptionHandler(arguments)),typeof a=="object"&&(a={...a}),a||(a={}),e==null)return"";typeof e=="function"&&(e=cD(e,{...this.options,...a})),Array.isArray(e)||(e=[String(e)]);const s=a.returnDetails!==void 0?a.returnDetails:this.options.returnDetails,o=a.keySeparator!==void 0?a.keySeparator:this.options.keySeparator,{key:l,namespaces:c}=this.extractFromKey(e[e.length-1],a),d=c[c.length-1];let u=a.nsSeparator!==void 0?a.nsSeparator:this.options.nsSeparator;u===void 0&&(u=":");const m=a.lng||this.language,p=a.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(m?.toLowerCase()==="cimode")return p?s?{res:`${d}${u}${l}`,usedKey:l,exactUsedKey:l,usedLng:m,usedNS:d,usedParams:this.getUsedParamsDetails(a)}:`${d}${u}${l}`:s?{res:l,usedKey:l,exactUsedKey:l,usedLng:m,usedNS:d,usedParams:this.getUsedParamsDetails(a)}:l;const f=this.resolve(e,a);let y=f?.res;const x=f?.usedKey||l,b=f?.exactUsedKey||l,v=["[object Number]","[object Function]","[object RegExp]"],_=a.joinArrays!==void 0?a.joinArrays:this.options.joinArrays,k=!this.i18nFormat||this.i18nFormat.handleAsObject,P=a.count!==void 0&&!An(a.count),C=O1.hasDefaultValue(a),T=P?this.pluralResolver.getSuffix(m,a.count,a):"",N=a.ordinal&&P?this.pluralResolver.getSuffix(m,a.count,{ordinal:!1}):"",R=P&&!a.ordinal&&a.count===0,A=R&&a[`defaultValue${this.options.pluralSeparator}zero`]||a[`defaultValue${T}`]||a[`defaultValue${N}`]||a.defaultValue;let D=y;k&&!y&&C&&(D=A);const $=YA(D),U=Object.prototype.toString.apply(D);if(k&&D&&$&&v.indexOf(U)<0&&!(An(_)&&Array.isArray(D))){if(!a.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const G=this.options.returnedObjectHandler?this.options.returnedObjectHandler(x,D,{...a,ns:c}):`key '${l} (${this.language})' returned an object instead of string.`;return s?(f.res=G,f.usedParams=this.getUsedParamsDetails(a),f):G}if(o){const G=Array.isArray(D),L=G?[]:{},te=G?b:x;for(const re in D)if(Object.prototype.hasOwnProperty.call(D,re)){const J=`${te}${o}${re}`;C&&!y?L[re]=this.translate(J,{...a,defaultValue:YA(A)?A[re]:void 0,joinArrays:!1,ns:c}):L[re]=this.translate(J,{...a,joinArrays:!1,ns:c}),L[re]===J&&(L[re]=D[re])}y=L}}else if(k&&An(_)&&Array.isArray(y))y=y.join(_),y&&(y=this.extendTranslation(y,e,a,r));else{let G=!1,L=!1;!this.isValidLookup(y)&&C&&(G=!0,y=A),this.isValidLookup(y)||(L=!0,y=l);const re=(a.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&L?void 0:y,J=C&&A!==y&&this.options.updateMissing;if(L||G||J){if(this.logger.log(J?"updateKey":"missingKey",m,d,l,J?A:y),o){const X=this.resolve(l,{...a,keySeparator:!1});X&&X.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let ue=[];const me=this.languageUtils.getFallbackCodes(this.options.fallbackLng,a.lng||this.language);if(this.options.saveMissingTo==="fallback"&&me&&me[0])for(let X=0;X<me.length;X++)ue.push(me[X]);else this.options.saveMissingTo==="all"?ue=this.languageUtils.toResolveHierarchy(a.lng||this.language):ue.push(a.lng||this.language);const ge=(X,ie,le)=>{const pe=C&&le!==y?le:re;this.options.missingKeyHandler?this.options.missingKeyHandler(X,d,ie,pe,J,a):this.backendConnector?.saveMissing&&this.backendConnector.saveMissing(X,d,ie,pe,J,a),this.emit("missingKey",X,d,ie,y)};this.options.saveMissing&&(this.options.saveMissingPlurals&&P?ue.forEach(X=>{const ie=this.pluralResolver.getSuffixes(X,a);R&&a[`defaultValue${this.options.pluralSeparator}zero`]&&ie.indexOf(`${this.options.pluralSeparator}zero`)<0&&ie.push(`${this.options.pluralSeparator}zero`),ie.forEach(le=>{ge([X],l+le,a[`defaultValue${le}`]||A)})}):ge(ue,l,A))}y=this.extendTranslation(y,e,a,f,r),L&&y===l&&this.options.appendNamespaceToMissingKey&&(y=`${d}${u}${l}`),(L||G)&&this.options.parseMissingKeyHandler&&(y=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${d}${u}${l}`:l,G?y:void 0,a))}return s?(f.res=y,f.usedParams=this.getUsedParamsDetails(a),f):y}extendTranslation(e,n,r,a,s){if(this.i18nFormat?.parse)e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...r},r.lng||this.language||a.usedLng,a.usedNS,a.usedKey,{resolved:a});else if(!r.skipInterpolation){r.interpolation&&this.interpolator.init({...r,interpolation:{...this.options.interpolation,...r.interpolation}});const c=An(e)&&(r?.interpolation?.skipOnVariables!==void 0?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let d;if(c){const m=e.match(this.interpolator.nestingRegexp);d=m&&m.length}let u=r.replace&&!An(r.replace)?r.replace:r;if(this.options.interpolation.defaultVariables&&(u={...this.options.interpolation.defaultVariables,...u}),e=this.interpolator.interpolate(e,u,r.lng||this.language||a.usedLng,r),c){const m=e.match(this.interpolator.nestingRegexp),p=m&&m.length;d<p&&(r.nest=!1)}!r.lng&&a&&a.res&&(r.lng=this.language||a.usedLng),r.nest!==!1&&(e=this.interpolator.nest(e,(...m)=>s?.[0]===m[0]&&!r.context?(this.logger.warn(`It seems you are nesting recursively key: ${m[0]} in key: ${n[0]}`),null):this.translate(...m,n),r)),r.interpolation&&this.interpolator.reset()}const o=r.postProcess||this.options.postProcess,l=An(o)?[o]:o;return e!=null&&l?.length&&r.applyPostProcessor!==!1&&(e=YK.handle(l,e,n,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...a,usedParams:this.getUsedParamsDetails(r)},...r}:r,this)),e}resolve(e,n={}){let r,a,s,o,l;return An(e)&&(e=[e]),e.forEach(c=>{if(this.isValidLookup(r))return;const d=this.extractFromKey(c,n),u=d.key;a=u;let m=d.namespaces;this.options.fallbackNS&&(m=m.concat(this.options.fallbackNS));const p=n.count!==void 0&&!An(n.count),f=p&&!n.ordinal&&n.count===0,y=n.context!==void 0&&(An(n.context)||typeof n.context=="number")&&n.context!=="",x=n.lngs?n.lngs:this.languageUtils.toResolveHierarchy(n.lng||this.language,n.fallbackLng);m.forEach(b=>{this.isValidLookup(r)||(l=b,!vB[`${x[0]}-${b}`]&&this.utils?.hasLoadedNamespace&&!this.utils?.hasLoadedNamespace(l)&&(vB[`${x[0]}-${b}`]=!0,this.logger.warn(`key "${a}" for languages "${x.join(", ")}" won't get resolved as namespace "${l}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),x.forEach(v=>{if(this.isValidLookup(r))return;o=v;const _=[u];if(this.i18nFormat?.addLookupKeys)this.i18nFormat.addLookupKeys(_,u,v,b,n);else{let P;p&&(P=this.pluralResolver.getSuffix(v,n.count,n));const C=`${this.options.pluralSeparator}zero`,T=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(p&&(n.ordinal&&P.indexOf(T)===0&&_.push(u+P.replace(T,this.options.pluralSeparator)),_.push(u+P),f&&_.push(u+C)),y){const N=`${u}${this.options.contextSeparator||"_"}${n.context}`;_.push(N),p&&(n.ordinal&&P.indexOf(T)===0&&_.push(N+P.replace(T,this.options.pluralSeparator)),_.push(N+P),f&&_.push(N+C))}}let k;for(;k=_.pop();)this.isValidLookup(r)||(s=k,r=this.getResource(v,b,k,n))}))})}),{res:r,usedKey:a,exactUsedKey:s,usedLng:o,usedNS:l}}isValidLookup(e){return e!==void 0&&!(!this.options.returnNull&&e===null)&&!(!this.options.returnEmptyString&&e==="")}getResource(e,n,r,a={}){return this.i18nFormat?.getResource?this.i18nFormat.getResource(e,n,r,a):this.resourceStore.getResource(e,n,r,a)}getUsedParamsDetails(e={}){const n=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],r=e.replace&&!An(e.replace);let a=r?e.replace:e;if(r&&typeof e.count<"u"&&(a.count=e.count),this.options.interpolation.defaultVariables&&(a={...this.options.interpolation.defaultVariables,...a}),!r){a={...a};for(const s of n)delete a[s]}return a}static hasDefaultValue(e){const n="defaultValue";for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)&&n===r.substring(0,n.length)&&e[r]!==void 0)return!0;return!1}}class wB{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=jc.create("languageUtils")}getScriptPartFromCode(e){if(e=Ev(e),!e||e.indexOf("-")<0)return null;const n=e.split("-");return n.length===2||(n.pop(),n[n.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(n.join("-"))}getLanguagePartFromCode(e){if(e=Ev(e),!e||e.indexOf("-")<0)return e;const n=e.split("-");return this.formatLanguageCode(n[0])}formatLanguageCode(e){if(An(e)&&e.indexOf("-")>-1){let n;try{n=Intl.getCanonicalLocales(e)[0]}catch{}return n&&this.options.lowerCaseLng&&(n=n.toLowerCase()),n||(this.options.lowerCaseLng?e.toLowerCase():e)}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(e){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}getBestMatchFromCodes(e){if(!e)return null;let n;return e.forEach(r=>{if(n)return;const a=this.formatLanguageCode(r);(!this.options.supportedLngs||this.isSupportedCode(a))&&(n=a)}),!n&&this.options.supportedLngs&&e.forEach(r=>{if(n)return;const a=this.getScriptPartFromCode(r);if(this.isSupportedCode(a))return n=a;const s=this.getLanguagePartFromCode(r);if(this.isSupportedCode(s))return n=s;n=this.options.supportedLngs.find(o=>{if(o===s)return o;if(!(o.indexOf("-")<0&&s.indexOf("-")<0)&&(o.indexOf("-")>0&&s.indexOf("-")<0&&o.substring(0,o.indexOf("-"))===s||o.indexOf(s)===0&&s.length>1))return o})}),n||(n=this.getFallbackCodes(this.options.fallbackLng)[0]),n}getFallbackCodes(e,n){if(!e)return[];if(typeof e=="function"&&(e=e(n)),An(e)&&(e=[e]),Array.isArray(e))return e;if(!n)return e.default||[];let r=e[n];return r||(r=e[this.getScriptPartFromCode(n)]),r||(r=e[this.formatLanguageCode(n)]),r||(r=e[this.getLanguagePartFromCode(n)]),r||(r=e.default),r||[]}toResolveHierarchy(e,n){const r=this.getFallbackCodes((n===!1?[]:n)||this.options.fallbackLng||[],e),a=[],s=o=>{o&&(this.isSupportedCode(o)?a.push(o):this.logger.warn(`rejecting language code not found in supportedLngs: ${o}`))};return An(e)&&(e.indexOf("-")>-1||e.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&s(this.formatLanguageCode(e)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&s(this.getScriptPartFromCode(e)),this.options.load!=="currentOnly"&&s(this.getLanguagePartFromCode(e))):An(e)&&s(this.formatLanguageCode(e)),r.forEach(o=>{a.indexOf(o)<0&&s(this.formatLanguageCode(o))}),a}}const SB={zero:0,one:1,two:2,few:3,many:4,other:5},_B={select:t=>t===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class cce{constructor(e,n={}){this.languageUtils=e,this.options=n,this.logger=jc.create("pluralResolver"),this.pluralRulesCache={}}addRule(e,n){this.rules[e]=n}clearCache(){this.pluralRulesCache={}}getRule(e,n={}){const r=Ev(e==="dev"?"en":e),a=n.ordinal?"ordinal":"cardinal",s=JSON.stringify({cleanedCode:r,type:a});if(s in this.pluralRulesCache)return this.pluralRulesCache[s];let o;try{o=new Intl.PluralRules(r,{type:a})}catch{if(!Intl)return this.logger.error("No Intl support, please use an Intl polyfill!"),_B;if(!e.match(/-|_/))return _B;const c=this.languageUtils.getLanguagePartFromCode(e);o=this.getRule(c,n)}return this.pluralRulesCache[s]=o,o}needsPlural(e,n={}){let r=this.getRule(e,n);return r||(r=this.getRule("dev",n)),r?.resolvedOptions().pluralCategories.length>1}getPluralFormsOfKey(e,n,r={}){return this.getSuffixes(e,r).map(a=>`${n}${a}`)}getSuffixes(e,n={}){let r=this.getRule(e,n);return r||(r=this.getRule("dev",n)),r?r.resolvedOptions().pluralCategories.sort((a,s)=>SB[a]-SB[s]).map(a=>`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${a}`):[]}getSuffix(e,n,r={}){const a=this.getRule(e,r);return a?`${this.options.prepend}${r.ordinal?`ordinal${this.options.prepend}`:""}${a.select(n)}`:(this.logger.warn(`no plural rule found for: ${e}`),this.getSuffix("dev",n,r))}}const kB=(t,e,n,r=".",a=!0)=>{let s=ece(t,e,n);return!s&&a&&An(n)&&(s=lD(t,n,r),s===void 0&&(s=lD(e,n,r))),s},XA=t=>t.replace(/\$/g,"$$$$");class dce{constructor(e={}){this.logger=jc.create("interpolator"),this.options=e,this.format=e?.interpolation?.format||(n=>n),this.init(e)}init(e={}){e.interpolation||(e.interpolation={escapeValue:!0});const{escape:n,escapeValue:r,useRawValueToEscape:a,prefix:s,prefixEscaped:o,suffix:l,suffixEscaped:c,formatSeparator:d,unescapeSuffix:u,unescapePrefix:m,nestingPrefix:p,nestingPrefixEscaped:f,nestingSuffix:y,nestingSuffixEscaped:x,nestingOptionsSeparator:b,maxReplaces:v,alwaysFormat:_}=e.interpolation;this.escape=n!==void 0?n:nce,this.escapeValue=r!==void 0?r:!0,this.useRawValueToEscape=a!==void 0?a:!1,this.prefix=s?rg(s):o||"{{",this.suffix=l?rg(l):c||"}}",this.formatSeparator=d||",",this.unescapePrefix=u?"":m||"-",this.unescapeSuffix=this.unescapePrefix?"":u||"",this.nestingPrefix=p?rg(p):f||rg("$t("),this.nestingSuffix=y?rg(y):x||rg(")"),this.nestingOptionsSeparator=b||",",this.maxReplaces=v||1e3,this.alwaysFormat=_!==void 0?_:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const e=(n,r)=>n?.source===r?(n.lastIndex=0,n):new RegExp(r,"g");this.regexp=e(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=e(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=e(this.nestingRegexp,`${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`)}interpolate(e,n,r,a){let s,o,l;const c=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},d=f=>{if(f.indexOf(this.formatSeparator)<0){const v=kB(n,c,f,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(v,void 0,r,{...a,...n,interpolationkey:f}):v}const y=f.split(this.formatSeparator),x=y.shift().trim(),b=y.join(this.formatSeparator).trim();return this.format(kB(n,c,x,this.options.keySeparator,this.options.ignoreJSONStructure),b,r,{...a,...n,interpolationkey:x})};this.resetRegExp();const u=a?.missingInterpolationHandler||this.options.missingInterpolationHandler,m=a?.interpolation?.skipOnVariables!==void 0?a.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:f=>XA(f)},{regex:this.regexp,safeValue:f=>this.escapeValue?XA(this.escape(f)):XA(f)}].forEach(f=>{for(l=0;s=f.regex.exec(e);){const y=s[1].trim();if(o=d(y),o===void 0)if(typeof u=="function"){const b=u(e,s,a);o=An(b)?b:""}else if(a&&Object.prototype.hasOwnProperty.call(a,y))o="";else if(m){o=s[0];continue}else this.logger.warn(`missed to pass in variable ${y} for interpolating ${e}`),o="";else!An(o)&&!this.useRawValueToEscape&&(o=fB(o));const x=f.safeValue(o);if(e=e.replace(s[0],x),m?(f.regex.lastIndex+=o.length,f.regex.lastIndex-=s[0].length):f.regex.lastIndex=0,l++,l>=this.maxReplaces)break}}),e}nest(e,n,r={}){let a,s,o;const l=(c,d)=>{const u=this.nestingOptionsSeparator;if(c.indexOf(u)<0)return c;const m=c.split(new RegExp(`${u}[ ]*{`));let p=`{${m[1]}`;c=m[0],p=this.interpolate(p,o);const f=p.match(/'/g),y=p.match(/"/g);((f?.length??0)%2===0&&!y||y.length%2!==0)&&(p=p.replace(/'/g,'"'));try{o=JSON.parse(p),d&&(o={...d,...o})}catch(x){return this.logger.warn(`failed parsing options string in nesting for key ${c}`,x),`${c}${u}${p}`}return o.defaultValue&&o.defaultValue.indexOf(this.prefix)>-1&&delete o.defaultValue,c};for(;a=this.nestingRegexp.exec(e);){let c=[];o={...r},o=o.replace&&!An(o.replace)?o.replace:o,o.applyPostProcessor=!1,delete o.defaultValue;const d=/{.*}/.test(a[1])?a[1].lastIndexOf("}")+1:a[1].indexOf(this.formatSeparator);if(d!==-1&&(c=a[1].slice(d).split(this.formatSeparator).map(u=>u.trim()).filter(Boolean),a[1]=a[1].slice(0,d)),s=n(l.call(this,a[1].trim(),o),o),s&&a[0]===e&&!An(s))return s;An(s)||(s=fB(s)),s||(this.logger.warn(`missed to resolve ${a[1]} for nesting ${e}`),s=""),c.length&&(s=c.reduce((u,m)=>this.format(u,m,r.lng,{...r,interpolationkey:a[1].trim()}),s.trim())),e=e.replace(a[0],s),this.regexp.lastIndex=0}return e}}const uce=t=>{let e=t.toLowerCase().trim();const n={};if(t.indexOf("(")>-1){const r=t.split("(");e=r[0].toLowerCase().trim();const a=r[1].substring(0,r[1].length-1);e==="currency"&&a.indexOf(":")<0?n.currency||(n.currency=a.trim()):e==="relativetime"&&a.indexOf(":")<0?n.range||(n.range=a.trim()):a.split(";").forEach(o=>{if(o){const[l,...c]=o.split(":"),d=c.join(":").trim().replace(/^'+|'+$/g,""),u=l.trim();n[u]||(n[u]=d),d==="false"&&(n[u]=!1),d==="true"&&(n[u]=!0),isNaN(d)||(n[u]=parseInt(d,10))}})}return{formatName:e,formatOptions:n}},NB=t=>{const e={};return(n,r,a)=>{let s=a;a&&a.interpolationkey&&a.formatParams&&a.formatParams[a.interpolationkey]&&a[a.interpolationkey]&&(s={...s,[a.interpolationkey]:void 0});const o=r+JSON.stringify(s);let l=e[o];return l||(l=t(Ev(r),a),e[o]=l),l(n)}},mce=t=>(e,n,r)=>t(Ev(n),r)(e);class hce{constructor(e={}){this.logger=jc.create("formatter"),this.options=e,this.init(e)}init(e,n={interpolation:{}}){this.formatSeparator=n.interpolation.formatSeparator||",";const r=n.cacheInBuiltFormats?NB:mce;this.formats={number:r((a,s)=>{const o=new Intl.NumberFormat(a,{...s});return l=>o.format(l)}),currency:r((a,s)=>{const o=new Intl.NumberFormat(a,{...s,style:"currency"});return l=>o.format(l)}),datetime:r((a,s)=>{const o=new Intl.DateTimeFormat(a,{...s});return l=>o.format(l)}),relativetime:r((a,s)=>{const o=new Intl.RelativeTimeFormat(a,{...s});return l=>o.format(l,s.range||"day")}),list:r((a,s)=>{const o=new Intl.ListFormat(a,{...s});return l=>o.format(l)})}}add(e,n){this.formats[e.toLowerCase().trim()]=n}addCached(e,n){this.formats[e.toLowerCase().trim()]=NB(n)}format(e,n,r,a={}){const s=n.split(this.formatSeparator);if(s.length>1&&s[0].indexOf("(")>1&&s[0].indexOf(")")<0&&s.find(l=>l.indexOf(")")>-1)){const l=s.findIndex(c=>c.indexOf(")")>-1);s[0]=[s[0],...s.splice(1,l)].join(this.formatSeparator)}return s.reduce((l,c)=>{const{formatName:d,formatOptions:u}=uce(c);if(this.formats[d]){let m=l;try{const p=a?.formatParams?.[a.interpolationkey]||{},f=p.locale||p.lng||a.locale||a.lng||r;m=this.formats[d](l,f,{...u,...a,...p})}catch(p){this.logger.warn(p)}return m}else this.logger.warn(`there was no format function for ${d}`);return l},e)}}const pce=(t,e)=>{t.pending[e]!==void 0&&(delete t.pending[e],t.pendingCount--)};class fce extends aC{constructor(e,n,r,a={}){super(),this.backend=e,this.store=n,this.services=r,this.languageUtils=r.languageUtils,this.options=a,this.logger=jc.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=a.maxParallelReads||10,this.readingCalls=0,this.maxRetries=a.maxRetries>=0?a.maxRetries:5,this.retryTimeout=a.retryTimeout>=1?a.retryTimeout:350,this.state={},this.queue=[],this.backend?.init?.(r,a.backend,a)}queueLoad(e,n,r,a){const s={},o={},l={},c={};return e.forEach(d=>{let u=!0;n.forEach(m=>{const p=`${d}|${m}`;!r.reload&&this.store.hasResourceBundle(d,m)?this.state[p]=2:this.state[p]<0||(this.state[p]===1?o[p]===void 0&&(o[p]=!0):(this.state[p]=1,u=!1,o[p]===void 0&&(o[p]=!0),s[p]===void 0&&(s[p]=!0),c[m]===void 0&&(c[m]=!0)))}),u||(l[d]=!0)}),(Object.keys(s).length||Object.keys(o).length)&&this.queue.push({pending:o,pendingCount:Object.keys(o).length,loaded:{},errors:[],callback:a}),{toLoad:Object.keys(s),pending:Object.keys(o),toLoadLanguages:Object.keys(l),toLoadNamespaces:Object.keys(c)}}loaded(e,n,r){const a=e.split("|"),s=a[0],o=a[1];n&&this.emit("failedLoading",s,o,n),!n&&r&&this.store.addResourceBundle(s,o,r,void 0,void 0,{skipCopy:!0}),this.state[e]=n?-1:2,n&&r&&(this.state[e]=0);const l={};this.queue.forEach(c=>{Jle(c.loaded,[s],o),pce(c,e),n&&c.errors.push(n),c.pendingCount===0&&!c.done&&(Object.keys(c.loaded).forEach(d=>{l[d]||(l[d]={});const u=c.loaded[d];u.length&&u.forEach(m=>{l[d][m]===void 0&&(l[d][m]=!0)})}),c.done=!0,c.errors.length?c.callback(c.errors):c.callback())}),this.emit("loaded",l),this.queue=this.queue.filter(c=>!c.done)}read(e,n,r,a=0,s=this.retryTimeout,o){if(!e.length)return o(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:e,ns:n,fcName:r,tried:a,wait:s,callback:o});return}this.readingCalls++;const l=(d,u)=>{if(this.readingCalls--,this.waitingReads.length>0){const m=this.waitingReads.shift();this.read(m.lng,m.ns,m.fcName,m.tried,m.wait,m.callback)}if(d&&u&&a<this.maxRetries){setTimeout(()=>{this.read.call(this,e,n,r,a+1,s*2,o)},s);return}o(d,u)},c=this.backend[r].bind(this.backend);if(c.length===2){try{const d=c(e,n);d&&typeof d.then=="function"?d.then(u=>l(null,u)).catch(l):l(null,d)}catch(d){l(d)}return}return c(e,n,l)}prepareLoading(e,n,r={},a){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),a&&a();An(e)&&(e=this.languageUtils.toResolveHierarchy(e)),An(n)&&(n=[n]);const s=this.queueLoad(e,n,r,a);if(!s.toLoad.length)return s.pending.length||a(),null;s.toLoad.forEach(o=>{this.loadOne(o)})}load(e,n,r){this.prepareLoading(e,n,{},r)}reload(e,n,r){this.prepareLoading(e,n,{reload:!0},r)}loadOne(e,n=""){const r=e.split("|"),a=r[0],s=r[1];this.read(a,s,"read",void 0,void 0,(o,l)=>{o&&this.logger.warn(`${n}loading namespace ${s} for language ${a} failed`,o),!o&&l&&this.logger.log(`${n}loaded namespace ${s} for language ${a}`,l),this.loaded(e,o,l)})}saveMissing(e,n,r,a,s,o={},l=()=>{}){if(this.services?.utils?.hasLoadedNamespace&&!this.services?.utils?.hasLoadedNamespace(n)){this.logger.warn(`did not save key "${r}" as the namespace "${n}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(r==null||r==="")){if(this.backend?.create){const c={...o,isUpdate:s},d=this.backend.create.bind(this.backend);if(d.length<6)try{let u;d.length===5?u=d(e,n,r,a,c):u=d(e,n,r,a),u&&typeof u.then=="function"?u.then(m=>l(null,m)).catch(l):l(null,u)}catch(u){l(u)}else d(e,n,r,a,l,c)}!e||!e[0]||this.store.addResource(e[0],n,r,a)}}}const CB=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:t=>{let e={};if(typeof t[1]=="object"&&(e=t[1]),An(t[1])&&(e.defaultValue=t[1]),An(t[2])&&(e.tDescription=t[2]),typeof t[2]=="object"||typeof t[3]=="object"){const n=t[3]||t[2];Object.keys(n).forEach(r=>{e[r]=n[r]})}return e},interpolation:{escapeValue:!0,format:t=>t,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),TB=t=>(An(t.ns)&&(t.ns=[t.ns]),An(t.fallbackLng)&&(t.fallbackLng=[t.fallbackLng]),An(t.fallbackNS)&&(t.fallbackNS=[t.fallbackNS]),t.supportedLngs?.indexOf?.("cimode")<0&&(t.supportedLngs=t.supportedLngs.concat(["cimode"])),typeof t.initImmediate=="boolean"&&(t.initAsync=t.initImmediate),t),vS=()=>{},gce=t=>{Object.getOwnPropertyNames(Object.getPrototypeOf(t)).forEach(n=>{typeof t[n]=="function"&&(t[n]=t[n].bind(t))})};class sv extends aC{constructor(e={},n){if(super(),this.options=TB(e),this.services={},this.logger=jc,this.modules={external:[]},gce(this),n&&!this.isInitialized&&!e.isClone){if(!this.options.initAsync)return this.init(e,n),this;setTimeout(()=>{this.init(e,n)},0)}}init(e={},n){this.isInitializing=!0,typeof e=="function"&&(n=e,e={}),e.defaultNS==null&&e.ns&&(An(e.ns)?e.defaultNS=e.ns:e.ns.indexOf("translation")<0&&(e.defaultNS=e.ns[0]));const r=CB();this.options={...r,...this.options,...TB(e)},this.options.interpolation={...r.interpolation,...this.options.interpolation},e.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=e.keySeparator),e.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=e.nsSeparator);const a=d=>d?typeof d=="function"?new d:d:null;if(!this.options.isClone){this.modules.logger?jc.init(a(this.modules.logger),this.options):jc.init(null,this.options);let d;this.modules.formatter?d=this.modules.formatter:d=hce;const u=new wB(this.options);this.store=new yB(this.options.resources,this.options);const m=this.services;m.logger=jc,m.resourceStore=this.store,m.languageUtils=u,m.pluralResolver=new cce(u,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),this.options.interpolation.format&&this.options.interpolation.format!==r.interpolation.format&&this.logger.deprecate("init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting"),d&&(!this.options.interpolation.format||this.options.interpolation.format===r.interpolation.format)&&(m.formatter=a(d),m.formatter.init&&m.formatter.init(m,this.options),this.options.interpolation.format=m.formatter.format.bind(m.formatter)),m.interpolator=new dce(this.options),m.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},m.backendConnector=new fce(a(this.modules.backend),m.resourceStore,m,this.options),m.backendConnector.on("*",(f,...y)=>{this.emit(f,...y)}),this.modules.languageDetector&&(m.languageDetector=a(this.modules.languageDetector),m.languageDetector.init&&m.languageDetector.init(m,this.options.detection,this.options)),this.modules.i18nFormat&&(m.i18nFormat=a(this.modules.i18nFormat),m.i18nFormat.init&&m.i18nFormat.init(this)),this.translator=new O1(this.services,this.options),this.translator.on("*",(f,...y)=>{this.emit(f,...y)}),this.modules.external.forEach(f=>{f.init&&f.init(this)})}if(this.format=this.options.interpolation.format,n||(n=vS),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const d=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);d.length>0&&d[0]!=="dev"&&(this.options.lng=d[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(d=>{this[d]=(...u)=>this.store[d](...u)}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(d=>{this[d]=(...u)=>(this.store[d](...u),this)});const l=gy(),c=()=>{const d=(u,m)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),l.resolve(m),n(u,m)};if(this.languages&&!this.isInitialized)return d(null,this.t.bind(this));this.changeLanguage(this.options.lng,d)};return this.options.resources||!this.options.initAsync?c():setTimeout(c,0),l}loadResources(e,n=vS){let r=n;const a=An(e)?e:this.language;if(typeof e=="function"&&(r=e),!this.options.resources||this.options.partialBundledLanguages){if(a?.toLowerCase()==="cimode"&&(!this.options.preload||this.options.preload.length===0))return r();const s=[],o=l=>{if(!l||l==="cimode")return;this.services.languageUtils.toResolveHierarchy(l).forEach(d=>{d!=="cimode"&&s.indexOf(d)<0&&s.push(d)})};a?o(a):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(c=>o(c)),this.options.preload?.forEach?.(l=>o(l)),this.services.backendConnector.load(s,this.options.ns,l=>{!l&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),r(l)})}else r(null)}reloadResources(e,n,r){const a=gy();return typeof e=="function"&&(r=e,e=void 0),typeof n=="function"&&(r=n,n=void 0),e||(e=this.languages),n||(n=this.options.ns),r||(r=vS),this.services.backendConnector.reload(e,n,s=>{a.resolve(),r(s)}),a}use(e){if(!e)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return e.type==="backend"&&(this.modules.backend=e),(e.type==="logger"||e.log&&e.warn&&e.error)&&(this.modules.logger=e),e.type==="languageDetector"&&(this.modules.languageDetector=e),e.type==="i18nFormat"&&(this.modules.i18nFormat=e),e.type==="postProcessor"&&YK.addPostProcessor(e),e.type==="formatter"&&(this.modules.formatter=e),e.type==="3rdParty"&&this.modules.external.push(e),this}setResolvedLanguage(e){if(!(!e||!this.languages)&&!(["cimode","dev"].indexOf(e)>-1)){for(let n=0;n<this.languages.length;n++){const r=this.languages[n];if(!(["cimode","dev"].indexOf(r)>-1)&&this.store.hasLanguageSomeTranslations(r)){this.resolvedLanguage=r;break}}!this.resolvedLanguage&&this.languages.indexOf(e)<0&&this.store.hasLanguageSomeTranslations(e)&&(this.resolvedLanguage=e,this.languages.unshift(e))}}changeLanguage(e,n){this.isLanguageChangingTo=e;const r=gy();this.emit("languageChanging",e);const a=l=>{this.language=l,this.languages=this.services.languageUtils.toResolveHierarchy(l),this.resolvedLanguage=void 0,this.setResolvedLanguage(l)},s=(l,c)=>{c?this.isLanguageChangingTo===e&&(a(c),this.translator.changeLanguage(c),this.isLanguageChangingTo=void 0,this.emit("languageChanged",c),this.logger.log("languageChanged",c)):this.isLanguageChangingTo=void 0,r.resolve((...d)=>this.t(...d)),n&&n(l,(...d)=>this.t(...d))},o=l=>{!e&&!l&&this.services.languageDetector&&(l=[]);const c=An(l)?l:l&&l[0],d=this.store.hasLanguageSomeTranslations(c)?c:this.services.languageUtils.getBestMatchFromCodes(An(l)?[l]:l);d&&(this.language||a(d),this.translator.language||this.translator.changeLanguage(d),this.services.languageDetector?.cacheUserLanguage?.(d)),this.loadResources(d,u=>{s(u,d)})};return!e&&this.services.languageDetector&&!this.services.languageDetector.async?o(this.services.languageDetector.detect()):!e&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(o):this.services.languageDetector.detect(o):o(e),r}getFixedT(e,n,r){const a=(s,o,...l)=>{let c;typeof o!="object"?c=this.options.overloadTranslationOptionHandler([s,o].concat(l)):c={...o},c.lng=c.lng||a.lng,c.lngs=c.lngs||a.lngs,c.ns=c.ns||a.ns,c.keyPrefix!==""&&(c.keyPrefix=c.keyPrefix||r||a.keyPrefix);const d=this.options.keySeparator||".";let u;return c.keyPrefix&&Array.isArray(s)?u=s.map(m=>(typeof m=="function"&&(m=cD(m,{...this.options,...o})),`${c.keyPrefix}${d}${m}`)):(typeof s=="function"&&(s=cD(s,{...this.options,...o})),u=c.keyPrefix?`${c.keyPrefix}${d}${s}`:s),this.t(u,c)};return An(e)?a.lng=e:a.lngs=e,a.ns=n,a.keyPrefix=r,a}t(...e){return this.translator?.translate(...e)}exists(...e){return this.translator?.exists(...e)}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e,n={}){if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const r=n.lng||this.resolvedLanguage||this.languages[0],a=this.options?this.options.fallbackLng:!1,s=this.languages[this.languages.length-1];if(r.toLowerCase()==="cimode")return!0;const o=(l,c)=>{const d=this.services.backendConnector.state[`${l}|${c}`];return d===-1||d===0||d===2};if(n.precheck){const l=n.precheck(this,o);if(l!==void 0)return l}return!!(this.hasResourceBundle(r,e)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||o(r,e)&&(!a||o(s,e)))}loadNamespaces(e,n){const r=gy();return this.options.ns?(An(e)&&(e=[e]),e.forEach(a=>{this.options.ns.indexOf(a)<0&&this.options.ns.push(a)}),this.loadResources(a=>{r.resolve(),n&&n(a)}),r):(n&&n(),Promise.resolve())}loadLanguages(e,n){const r=gy();An(e)&&(e=[e]);const a=this.options.preload||[],s=e.filter(o=>a.indexOf(o)<0&&this.services.languageUtils.isSupportedCode(o));return s.length?(this.options.preload=a.concat(s),this.loadResources(o=>{r.resolve(),n&&n(o)}),r):(n&&n(),Promise.resolve())}dir(e){if(e||(e=this.resolvedLanguage||(this.languages?.length>0?this.languages[0]:this.language)),!e)return"rtl";try{const a=new Intl.Locale(e);if(a&&a.getTextInfo){const s=a.getTextInfo();if(s&&s.direction)return s.direction}}catch{}const n=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],r=this.services?.languageUtils||new wB(CB());return e.toLowerCase().indexOf("-latn")>1?"ltr":n.indexOf(r.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(e={},n){const r=new sv(e,n);return r.createInstance=sv.createInstance,r}cloneInstance(e={},n=vS){const r=e.forkResourceStore;r&&delete e.forkResourceStore;const a={...this.options,...e,isClone:!0},s=new sv(a);if((e.debug!==void 0||e.prefix!==void 0)&&(s.logger=s.logger.clone(e)),["store","services","language"].forEach(l=>{s[l]=this[l]}),s.services={...this.services},s.services.utils={hasLoadedNamespace:s.hasLoadedNamespace.bind(s)},r){const l=Object.keys(this.store.data).reduce((c,d)=>(c[d]={...this.store.data[d]},c[d]=Object.keys(c[d]).reduce((u,m)=>(u[m]={...c[d][m]},u),c[d]),c),{});s.store=new yB(l,a),s.services.resourceStore=s.store}return s.translator=new O1(s.services,a),s.translator.on("*",(l,...c)=>{s.emit(l,...c)}),s.init(a,n),s.translator.options=a,s.translator.backendConnector.services.utils={hasLoadedNamespace:s.hasLoadedNamespace.bind(s)},s}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const Hs=sv.createInstance();Hs.createInstance;Hs.dir;Hs.init;Hs.loadResources;Hs.reloadResources;Hs.use;Hs.changeLanguage;Hs.getFixedT;Hs.t;Hs.exists;Hs.setDefaultNamespace;Hs.hasLoadedNamespace;Hs.loadNamespaces;Hs.loadLanguages;const bce=(t,e,n,r)=>{const a=[n,{code:e,...r||{}}];if(t?.services?.logger?.forward)return t.services.logger.forward(a,"warn","react-i18next::",!0);zp(a[0])&&(a[0]=`react-i18next:: ${a[0]}`),t?.services?.logger?.warn?t.services.logger.warn(...a):console?.warn&&console.warn(...a)},PB={},QK=(t,e,n,r)=>{zp(n)&&PB[n]||(zp(n)&&(PB[n]=new Date),bce(t,e,n,r))},ZK=(t,e)=>()=>{if(t.isInitialized)e();else{const n=()=>{setTimeout(()=>{t.off("initialized",n)},0),e()};t.on("initialized",n)}},dD=(t,e,n)=>{t.loadNamespaces(e,ZK(t,n))},AB=(t,e,n,r)=>{if(zp(n)&&(n=[n]),t.options.preload&&t.options.preload.indexOf(e)>-1)return dD(t,n,r);n.forEach(a=>{t.options.ns.indexOf(a)<0&&t.options.ns.push(a)}),t.loadLanguages(e,ZK(t,r))},xce=(t,e,n={})=>!e.languages||!e.languages.length?(QK(e,"NO_LANGUAGES","i18n.languages were undefined or empty",{languages:e.languages}),!0):e.hasLoadedNamespace(t,{lng:n.lng,precheck:(r,a)=>{if(n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&r.services.backendConnector.backend&&r.isLanguageChangingTo&&!a(r.isLanguageChangingTo,t))return!1}}),zp=t=>typeof t=="string",yce=t=>typeof t=="object"&&t!==null,vce=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,wce={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},Sce=t=>wce[t],_ce=t=>t.replace(vce,Sce);let uD={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:_ce,transDefaultProps:void 0};const kce=(t={})=>{uD={...uD,...t}},Nce=()=>uD;let JK;const Cce=t=>{JK=t},Tce=()=>JK,Pce={type:"3rdParty",init(t){kce(t.options.react),Cce(t)}},Ace=w.createContext();class Mce{constructor(){this.usedNamespaces={}}addUsedNamespaces(e){e.forEach(n=>{this.usedNamespaces[n]||(this.usedNamespaces[n]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}var QA={exports:{}},ZA={};var MB;function Ece(){if(MB)return ZA;MB=1;var t=pf();function e(m,p){return m===p&&(m!==0||1/m===1/p)||m!==m&&p!==p}var n=typeof Object.is=="function"?Object.is:e,r=t.useState,a=t.useEffect,s=t.useLayoutEffect,o=t.useDebugValue;function l(m,p){var f=p(),y=r({inst:{value:f,getSnapshot:p}}),x=y[0].inst,b=y[1];return s(function(){x.value=f,x.getSnapshot=p,c(x)&&b({inst:x})},[m,f,p]),a(function(){return c(x)&&b({inst:x}),m(function(){c(x)&&b({inst:x})})},[m]),o(f),f}function c(m){var p=m.getSnapshot;m=m.value;try{var f=p();return!n(m,f)}catch{return!0}}function d(m,p){return p()}var u=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?d:l;return ZA.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:u,ZA}var EB;function eY(){return EB||(EB=1,QA.exports=Ece()),QA.exports}var AF=eY();const jce=(t,e)=>zp(e)?e:yce(e)&&zp(e.defaultValue)?e.defaultValue:Array.isArray(t)?t[t.length-1]:t,Dce={t:jce,ready:!1},Rce=()=>()=>{},Mt=(t,e={})=>{const{i18n:n}=e,{i18n:r,defaultNS:a}=w.useContext(Ace)||{},s=n||r||Tce();s&&!s.reportNamespaces&&(s.reportNamespaces=new Mce),s||QK(s,"NO_I18NEXT_INSTANCE","useTranslation: You will need to pass in an i18next instance by using initReactI18next");const o=w.useMemo(()=>({...Nce(),...s?.options?.react,...e}),[s,e]),{useSuspense:l,keyPrefix:c}=o,d=a||s?.options?.defaultNS,u=zp(d)?[d]:d||["translation"],m=w.useMemo(()=>u,u);s?.reportNamespaces?.addUsedNamespaces?.(m);const p=w.useRef(0),f=w.useCallback(A=>{if(!s)return Rce;const{bindI18n:D,bindI18nStore:$}=o,U=()=>{p.current+=1,A()};return D&&s.on(D,U),$&&s.store.on($,U),()=>{D&&D.split(" ").forEach(G=>s.off(G,U)),$&&$.split(" ").forEach(G=>s.store.off(G,U))}},[s,o]),y=w.useRef(),x=w.useCallback(()=>{if(!s)return Dce;const A=!!(s.isInitialized||s.initializedStoreOnce)&&m.every(te=>xce(te,s,o)),D=e.lng||s.language,$=p.current,U=y.current;if(U&&U.ready===A&&U.lng===D&&U.keyPrefix===c&&U.revision===$)return U;const L={t:s.getFixedT(D,o.nsMode==="fallback"?m:m[0],c),ready:A,lng:D,keyPrefix:c,revision:$};return y.current=L,L},[s,m,c,o,e.lng]),[b,v]=w.useState(0),{t:_,ready:k}=AF.useSyncExternalStore(f,x,x);w.useEffect(()=>{if(s&&!k&&!l){const A=()=>v(D=>D+1);e.lng?AB(s,e.lng,m,A):dD(s,m,A)}},[s,e.lng,m,k,l,b]);const P=s||{},C=w.useRef(null),T=w.useRef(),N=A=>{const D=Object.getOwnPropertyDescriptors(A);D.__original&&delete D.__original;const $=Object.create(Object.getPrototypeOf(A),D);if(!Object.prototype.hasOwnProperty.call($,"__original"))try{Object.defineProperty($,"__original",{value:A,writable:!1,enumerable:!1,configurable:!1})}catch{}return $},R=w.useMemo(()=>{const A=P,D=A?.language;let $=A;A&&(C.current&&C.current.__original===A?T.current!==D?($=N(A),C.current=$,T.current=D):$=C.current:($=N(A),C.current=$,T.current=D));const U=[_,$,k];return U.t=_,U.i18n=$,U.ready=k,U},[_,P,k,P.resolvedLanguage,P.language,P.languages]);if(s&&l&&!k)throw new Promise(A=>{const D=()=>A();e.lng?AB(s,e.lng,m,D):dD(s,m,D)});return R},{slice:Fce,forEach:Lce}=[];function Oce(t){return Lce.call(Fce.call(arguments,1),e=>{if(e)for(const n in e)t[n]===void 0&&(t[n]=e[n])}),t}function Ice(t){return typeof t!="string"?!1:[/<\s*script.*?>/i,/<\s*\/\s*script\s*>/i,/<\s*img.*?on\w+\s*=/i,/<\s*\w+\s*on\w+\s*=.*?>/i,/javascript\s*:/i,/vbscript\s*:/i,/expression\s*\(/i,/eval\s*\(/i,/alert\s*\(/i,/document\.cookie/i,/document\.write\s*\(/i,/window\.location/i,/innerHTML/i].some(n=>n.test(t))}const jB=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,zce=function(t,e){const r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{path:"/"},a=encodeURIComponent(e);let s=`${t}=${a}`;if(r.maxAge>0){const o=r.maxAge-0;if(Number.isNaN(o))throw new Error("maxAge should be a Number");s+=`; Max-Age=${Math.floor(o)}`}if(r.domain){if(!jB.test(r.domain))throw new TypeError("option domain is invalid");s+=`; Domain=${r.domain}`}if(r.path){if(!jB.test(r.path))throw new TypeError("option path is invalid");s+=`; Path=${r.path}`}if(r.expires){if(typeof r.expires.toUTCString!="function")throw new TypeError("option expires is invalid");s+=`; Expires=${r.expires.toUTCString()}`}if(r.httpOnly&&(s+="; HttpOnly"),r.secure&&(s+="; Secure"),r.sameSite)switch(typeof r.sameSite=="string"?r.sameSite.toLowerCase():r.sameSite){case!0:s+="; SameSite=Strict";break;case"lax":s+="; SameSite=Lax";break;case"strict":s+="; SameSite=Strict";break;case"none":s+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}return r.partitioned&&(s+="; Partitioned"),s},DB={create(t,e,n,r){let a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};n&&(a.expires=new Date,a.expires.setTime(a.expires.getTime()+n*60*1e3)),r&&(a.domain=r),document.cookie=zce(t,e,a)},read(t){const e=`${t}=`,n=document.cookie.split(";");for(let r=0;r<n.length;r++){let a=n[r];for(;a.charAt(0)===" ";)a=a.substring(1,a.length);if(a.indexOf(e)===0)return a.substring(e.length,a.length)}return null},remove(t,e){this.create(t,"",-1,e)}};var Uce={name:"cookie",lookup(t){let{lookupCookie:e}=t;if(e&&typeof document<"u")return DB.read(e)||void 0},cacheUserLanguage(t,e){let{lookupCookie:n,cookieMinutes:r,cookieDomain:a,cookieOptions:s}=e;n&&typeof document<"u"&&DB.create(n,t,r,a,s)}},Bce={name:"querystring",lookup(t){let{lookupQuerystring:e}=t,n;if(typeof window<"u"){let{search:r}=window.location;!window.location.search&&window.location.hash?.indexOf("?")>-1&&(r=window.location.hash.substring(window.location.hash.indexOf("?")));const s=r.substring(1).split("&");for(let o=0;o<s.length;o++){const l=s[o].indexOf("=");l>0&&s[o].substring(0,l)===e&&(n=s[o].substring(l+1))}}return n}},Hce={name:"hash",lookup(t){let{lookupHash:e,lookupFromHashIndex:n}=t,r;if(typeof window<"u"){const{hash:a}=window.location;if(a&&a.length>2){const s=a.substring(1);if(e){const o=s.split("&");for(let l=0;l<o.length;l++){const c=o[l].indexOf("=");c>0&&o[l].substring(0,c)===e&&(r=o[l].substring(c+1))}}if(r)return r;if(!r&&n>-1){const o=a.match(/\/([a-zA-Z-]*)/g);return Array.isArray(o)?o[typeof n=="number"?n:0]?.replace("/",""):void 0}}}return r}};let ig=null;const RB=()=>{if(ig!==null)return ig;try{if(ig=typeof window<"u"&&window.localStorage!==null,!ig)return!1;const t="i18next.translate.boo";window.localStorage.setItem(t,"foo"),window.localStorage.removeItem(t)}catch{ig=!1}return ig};var $ce={name:"localStorage",lookup(t){let{lookupLocalStorage:e}=t;if(e&&RB())return window.localStorage.getItem(e)||void 0},cacheUserLanguage(t,e){let{lookupLocalStorage:n}=e;n&&RB()&&window.localStorage.setItem(n,t)}};let ag=null;const FB=()=>{if(ag!==null)return ag;try{if(ag=typeof window<"u"&&window.sessionStorage!==null,!ag)return!1;const t="i18next.translate.boo";window.sessionStorage.setItem(t,"foo"),window.sessionStorage.removeItem(t)}catch{ag=!1}return ag};var qce={name:"sessionStorage",lookup(t){let{lookupSessionStorage:e}=t;if(e&&FB())return window.sessionStorage.getItem(e)||void 0},cacheUserLanguage(t,e){let{lookupSessionStorage:n}=e;n&&FB()&&window.sessionStorage.setItem(n,t)}},Vce={name:"navigator",lookup(t){const e=[];if(typeof navigator<"u"){const{languages:n,userLanguage:r,language:a}=navigator;if(n)for(let s=0;s<n.length;s++)e.push(n[s]);r&&e.push(r),a&&e.push(a)}return e.length>0?e:void 0}},Gce={name:"htmlTag",lookup(t){let{htmlTag:e}=t,n;const r=e||(typeof document<"u"?document.documentElement:null);return r&&typeof r.getAttribute=="function"&&(n=r.getAttribute("lang")),n}},Wce={name:"path",lookup(t){let{lookupFromPathIndex:e}=t;if(typeof window>"u")return;const n=window.location.pathname.match(/\/([a-zA-Z-]*)/g);return Array.isArray(n)?n[typeof e=="number"?e:0]?.replace("/",""):void 0}},Kce={name:"subdomain",lookup(t){let{lookupFromSubdomainIndex:e}=t;const n=typeof e=="number"?e+1:1,r=typeof window<"u"&&window.location?.hostname?.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i);if(r)return r[n]}};let tY=!1;try{document.cookie,tY=!0}catch{}const nY=["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"];tY||nY.splice(1,1);const Yce=()=>({order:nY,lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:t=>t});class rY{constructor(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.type="languageDetector",this.detectors={},this.init(e,n)}init(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{languageUtils:{}},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=e,this.options=Oce(n,this.options||{},Yce()),typeof this.options.convertDetectedLanguage=="string"&&this.options.convertDetectedLanguage.indexOf("15897")>-1&&(this.options.convertDetectedLanguage=a=>a.replace("-","_")),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=r,this.addDetector(Uce),this.addDetector(Bce),this.addDetector($ce),this.addDetector(qce),this.addDetector(Vce),this.addDetector(Gce),this.addDetector(Wce),this.addDetector(Kce),this.addDetector(Hce)}addDetector(e){return this.detectors[e.name]=e,this}detect(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.options.order,n=[];return e.forEach(r=>{if(this.detectors[r]){let a=this.detectors[r].lookup(this.options);a&&typeof a=="string"&&(a=[a]),a&&(n=n.concat(a))}}),n=n.filter(r=>r!=null&&!Ice(r)).map(r=>this.options.convertDetectedLanguage(r)),this.services&&this.services.languageUtils&&this.services.languageUtils.getBestMatchFromCodes?n:n.length>0?n[0]:null}cacheUserLanguage(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.options.caches;n&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(e)>-1||n.forEach(r=>{this.detectors[r]&&this.detectors[r].cacheUserLanguage(e,this.options)}))}}rY.type="languageDetector";const Xce={nav:{printers:"Printers",archives:"Archives",queue:"Queue",stats:"Statistics",profiles:"Profiles",maintenance:"Maintenance",projects:"Projects",inventory:"Filament",files:"File Manager",settings:"Settings",system:"System",collapseSidebar:"Collapse sidebar",expandSidebar:"Expand sidebar",update:"Update",updateAvailable:"Update available: v{{version}}",updateAvailableBanner:"Version {{version}} is available!",viewUpdate:"View update",viewOnGithub:"View on GitHub",keyboardShortcuts:"Keyboard shortcuts (?)",switchToLight:"Switch to light mode",switchToDark:"Switch to dark mode",smartSwitches:"Smart Switches",logout:"Logout"},common:{save:"Save",saving:"Saving...",cancel:"Cancel",delete:"Delete",edit:"Edit",add:"Add",close:"Close",confirm:"Confirm",loading:"Loading...",error:"Error",success:"Success",warning:"Warning",enabled:"Enabled",disabled:"Disabled",yes:"Yes",no:"No",on:"On",off:"Off",all:"All",none:"None",search:"Search",filter:"Filter",sort:"Sort",refresh:"Refresh",download:"Download",upload:"Upload",uploading:"Uploading...",uploadFailed:"Upload failed",actions:"Actions",status:"Status",name:"Name",description:"Description",date:"Date",time:"Time",hours:"hours",minutes:"minutes",seconds:"seconds",days:"days",enable:"Enable",disable:"Disable",permissions:"Permissions",noPrinters:"No printers configured",noData:"No data available",linkNotFound:"Link not found",required:"Required",optional:"Optional",dismiss:"Dismiss",apply:"Apply",reset:"Reset",export:"Export",import:"Import",clear:"Clear",selectAll:"Select All",deselectAll:"Deselect All",noChange:"— No change —",unchanged:"Unchanged",unassigned:"Unassigned",unknown:"Unknown",unknownError:"Unknown error",today:"Today",tomorrow:"Tomorrow",asap:"ASAP",overdue:"Overdue",now:"Now",collapse:"Collapse",expand:"Expand",viewArchive:"View archive",viewInFileManager:"View in File Manager",addedBy:"Added by {{username}}",prints:"prints",more:"+{{count}} more",ascending:"Ascending",descending:"Descending",printer:"Printer",remove:"Remove",type:"Type",print:"Print",rename:"Rename",move:"Move",create:"Create",duplicate:"Duplicate",left:"Left",right:"Right"},printers:{title:"Printers",addPrinter:"Add Printer",editPrinter:"Edit Printer",deletePrinter:"Delete Printer",printerName:"Printer Name",serialNumber:"Serial Number",ipAddress:"IP Address / Hostname",accessCode:"Access Code",model:"Model",nozzleCount:"Nozzle Count",autoArchive:"Auto Archive",status:{available:"Available",idle:"Idle",printing:"Printing",paused:"Paused",offline:"Offline",error:"Error",finished:"Finished",unknown:"Unknown"},temperatures:{nozzle:"Nozzle",bed:"Bed",chamber:"Chamber"},progress:"{{percent}}% complete",timeRemaining:"{{time}} remaining",deleteConfirm:'Are you sure you want to delete "{{name}}"?',maintenanceOk:"Maintenance OK",maintenanceWarning:"{{count}} warning",maintenanceWarning_plural:"{{count}} warnings",maintenanceDue:"{{count}} due",maintenanceDue_plural:"{{count}} due",sort:{name:"Name",status:"Status",model:"Model",location:"Location",ascending:"Sort ascending",descending:"Sort descending"},cardSize:{small:"Small cards",medium:"Medium cards",large:"Large cards",extraLarge:"Extra large cards"},hideOffline:"Hide offline",nextAvailable:"Next available",powerOn:"Power On",offlinePrintersWithPlugs:"Offline printers with smart plugs",noPrintersConfigured:"No printers configured yet",readyToPrint:"Ready to print",external:"External",extL:"Ext-L",extR:"Ext-R",deleteArchives:"Delete print archives",noLabel:"No label",printPreview:"Print preview",width:"Width",height:"Height",noObjectsFound:"No objects found",objectsLoadedOnPrintStart:"Objects are loaded when a print starts",willBeSkipped:"Will be skipped",name:"Name",serialCannotBeChanged:"Serial number cannot be changed",locationHelp:"Used to group printers and filter queue jobs",wifiSignal:{veryWeak:"Very weak",weak:"Weak",fair:"Fair",good:"Good",excellent:"Excellent"},maintenanceUpToDate:"All maintenance up to date - Click to view",chamberLightOn:"Turn on chamber light",chamberLightOff:"Turn off chamber light",files:"Files",browseFiles:"Browse printer files",autoOffAfterPrint:"Auto power-off after print",autoOffExecuted:"Auto-off was executed - turn printer on to reset",hmsErrors:"HMS Errors",viewHmsErrors:"View {{count}} HMS error(s)",resume:"Resume",pause:"Pause",stop:"Stop",camera:"Camera",skipObject:"Skip Object",reconnect:"Reconnect",mqttDebug:"MQTT Debug",printerInformation:"Printer Information",copyToClipboard:"Copy",copied:"Copied!",state:"State",wifiSignalLabel:"WiFi Signal",developerMode:"Developer Mode",enabled:"Enabled",disabled:"Disabled",addedOn:"Added",sdCard:"SD Card",inserted:"Inserted",notInserted:"Not inserted",totalPrintHours:"Print Hours",activeNozzle:"Active: {{nozzle}} nozzle",nozzleRack:"Nozzle Rack",nozzleDocked:"Docked",nozzleMounted:"Mounted",nozzleActive:"Active",nozzleIdle:"Idle",nozzleDiameter:"Diameter",nozzleType:"Type",nozzleStatus:"Status",nozzleFilament:"Filament",nozzleWear:"Wear",nozzleMaxTemp:"Max Temp",nozzleSerial:"Serial",nozzleHardenedSteel:"Hardened Steel",nozzleStainlessSteel:"Stainless Steel",nozzleTungstenCarbide:"Tungsten Carbide",nozzleFlow:"Flow",nozzleHighFlow:"High Flow",nozzleStandardFlow:"Standard",firmwareUpdate:"Firmware Update",firmwareInstructions:"On the printer's touchscreen, go to",firmwareNav:"Navigate to",settings:"Settings",firmware:"Firmware",discoverPrinters:"Discover Printers",searching:"Searching...",manualEntry:"Manual Entry",addFromCloud:"Add from Cloud",toast:{printerDeleted:"Printer deleted",printerAdded:"Printer added",printerUpdated:"Printer updated",failedToDelete:"Failed to delete printer",failedToAdd:"Failed to add printer",failedToUpdate:"Failed to update printer",commandSent:"Command sent",failedToSendCommand:"Failed to send command",turnedOn:"{{name}} turned on",failedToPowerOn:"Failed to power on {{name}}",scriptTriggered:"Script triggered",printStopped:"Print stopped",printPaused:"Print paused",printResumed:"Print resumed",referenceDeleted:"Reference deleted",detectionAreaSaved:"Detection area saved",failedToRunScript:"Failed to run script",failedToStopPrint:"Failed to stop print",failedToPausePrint:"Failed to pause print",failedToResumePrint:"Failed to resume print",failedToControlChamberLight:"Failed to control chamber light",failedToUpdateSetting:"Failed to update setting",failedToSkipObjects:"Failed to skip objects",failedToRereadRfid:"Failed to re-read RFID",failedToCheckPlate:"Failed to check plate",failedToUpdateLabel:"Failed to update label",failedToDeleteReference:"Failed to delete reference",failedToSaveDetectionArea:"Failed to save detection area",plateCheckEnabled:"Plate check enabled",plateCheckDisabled:"Plate check disabled",calibrationSaved:"Calibration saved!",calibrationFailed:"Calibration failed",rfidRereadInitiated:"RFID re-read initiated"},connection:{connected:"Connected",offline:"Offline"},queue:{inQueue:"{{count}} print in queue",inQueue_plural:"{{count}} prints in queue"},controls:"Controls",rfid:{reread:"Re-read RFID"},permission:{noAdd:"You do not have permission to add printers",noEdit:"You do not have permission to edit printers",noDelete:"You do not have permission to delete printers",noControl:"You do not have permission to control printers",noFiles:"You do not have permission to access printer files",noAmsRfid:"You do not have permission to re-read AMS RFID",noSmartPlugControl:"You do not have permission to control smart plugs",noCamera:"You do not have permission to view cameras"},modal:{addTitle:"Add Printer",editTitle:"Edit Printer",myPrinter:"My Printer",selectModel:"Select model...",locationGroup:"Location / Group (optional)",locationPlaceholder:"e.g., Workshop, Office, Basement",autoArchiveLabel:"Auto-archive completed prints",fromPrinterSettings:"From printer settings",modelOptional:"Model (optional)",saveChanges:"Save Changes"},skipObjects:{tooltip:"Skip objects",onlyWhilePrinting:"Skip objects (only while printing)",requiresMultiple:"Skip objects (requires 2+ objects)",title:"Skip Objects",matchIdsInfo:"Match IDs with your printer display",printerShowsIds:"The printer screen shows object IDs on the build plate",skipSelected:"Skip Selected",skipping:"Skipping...",noObjectsSelected:"No objects selected",selectObjectsToSkip:"Select objects you want to skip from the current print",skipped:"skipped",objectsSkipped:"Objects skipped",activeCount:"{{count}} active",waitForLayer:"Wait for layer 2+ to skip objects (currently layer {{layer}})",skip:"Skip",confirmTitle:"Skip Object?",confirmMessage:'Are you sure you want to skip "{{name}}"? This cannot be undone.'},confirm:{deleteTitle:"Delete Printer",deleteMessage:'Are you sure you want to delete "{{name}}"? This will remove all connection settings.',deleteArchivesNote:"All print history for this printer will be permanently deleted.",keepArchivesNote:"Print history will be kept but no longer associated with this printer.",stopTitle:"Stop Print",stopMessage:'Are you sure you want to stop the current print on "{{name}}"? This will cancel the print job.',stopButton:"Stop Print",pauseTitle:"Pause Print",pauseMessage:'Are you sure you want to pause the current print on "{{name}}"?',pauseButton:"Pause Print",resumeTitle:"Resume Print",resumeMessage:'Are you sure you want to resume the print on "{{name}}"?',resumeButton:"Resume Print",powerOnTitle:"Power On Printer",powerOnMessage:'Are you sure you want to turn ON the power for "{{name}}"?',powerOnButton:"Power On",powerOffTitle:"Power Off Printer",powerOffMessage:'Are you sure you want to turn OFF the power for "{{name}}"?',powerOffWarning:'WARNING: "{{name}}" is currently printing! Are you sure you want to turn OFF the power? This will interrupt the print and may damage the printer.',powerOffButton:"Power Off"},discovery:{title:"Discover Printers",searching:"Searching...",scanning:"Scanning...",scanProgress:"Scanning... {{scanned}}/{{total}}",foundPrinters:"Found {{count}} printer(s)",noPrintersFound:"No printers found",noPrintersFoundSubnet:"No printers found in the specified subnet.",noPrintersFoundNetwork:"No printers found on the network.",allConfigured:"All discovered printers are already configured.",alreadyAdded:"Already added",select:"Select",manualEntry:"Manual Entry",addFromCloud:"Add from Cloud",subnetToScan:"Subnet to scan",dockerNote:"Docker detected. Enter your printer's subnet in CIDR notation. Requires network_mode: host in docker-compose.yml.",scanSubnet:"Scan Subnet for Printers",discoverNetwork:"Discover Printers on Network",scanningSubnet:"Scanning subnet for Bambu printers...",scanningNetwork:"Scanning network...",serialRequired:"Serial required",unknown:"Unknown",failedToStart:"Failed to start discovery"},filaments:"Filaments",openCameraOverlay:"Open camera overlay",openCameraWindow:"Open camera in new window",firmwareUpdateAvailable:"Firmware update available: {{current}} → {{latest}}",firmwareUpToDate:"Firmware {{version}} — Up to date",firmwareUpdateButton:"Update",plateDetection:{noPermission:"You do not have permission to update printers",enabledClick:"Plate check enabled - Click to disable",disabledClick:"Plate check disabled - Click to enable",manageCalibration:"Manage plate detection calibration",calibrationRequired:"Calibration Required",calibrationInstructions:"Please ensure the build plate is <strong>completely empty</strong>, then click Calibrate.",calibrationDescription:"Calibration captures a reference image of the empty plate. Future checks will compare against this reference to detect objects.",calibrationTip:"<strong>Tip:</strong> You can store up to 5 calibrations for different plates. The system automatically uses the best match when checking.",plateEmpty:"Plate appears empty",objectsDetected:"Objects detected on plate",confidence:"Confidence",difference:"Difference",analysisPreview:"Analysis preview:",analysisLegend:"Green box = detection area, Red overlay = differences from calibration",savedReferences:"Saved References ({{count}}/{{max}})",deleteReference:"Delete reference",labelPlaceholder:"Label...",clickToEdit:"{{label}} - Click to edit",clickToAddLabel:"Click to add label"},fans:{partCooling:"Part Cooling Fan",auxiliary:"Auxiliary Fan",chamber:"Chamber Fan"},clickToViewHmsErrors:"Click to view HMS errors",estimatedCompletion:"Estimated completion time",slotOptions:"Slot options",amsPopup:{friendlyName:"AMS Name",friendlyNamePlaceholder:"e.g. AMS Friendly Name",serialNumber:"Serial Number",firmwareVersion:"Firmware",save:"Save",clear:"Clear",noEditPermission:"You do not have permission to rename AMS units"},firmwareModal:{title:"Firmware Update",titleUpToDate:"Firmware Info",currentVersion:"Current:",latestVersion:"Latest:",releaseNotes:"Release Notes",checkingPrereqs:"Checking prerequisites...",sdCardReady:"SD card ready. Click below to upload firmware.",uploadedSuccess:"Firmware uploaded to SD card!",applyInstructions:"To apply the update on your printer:",step1:"On the printer's touchscreen, go to <strong>Settings</strong>",step2:"Navigate to <strong>Firmware</strong>",step3:"Select <strong>Update from SD card</strong>",step4:"The update will take 10-20 minutes",done:"Done",starting:"Starting...",uploadFirmware:"Upload Firmware",uploadFailed:"Failed to start upload: {{error}}",uploadedToast:"Firmware uploaded! Trigger update from printer screen."},accessCodePlaceholder:"Leave empty to keep current",roi:{title:"Detection Area (ROI)",xStart:"X Start",yStart:"Y Start",width:"Width",height:"Height",instruction:"Adjust the detection area to focus on the build plate. The green box in the preview shows the current area."},developerModeWarning:"Developer LAN mode is not enabled on: {{names}}. Some features may not work.",howToEnable:"How to enable",incompatibleFile:"This file was sliced for {{slicedFor}}, but this printer is a {{printerModel}}",dropNotPrintable:"Only .gcode and .gcode.3mf files can be printed",dropToPrint:"Drop to print",cannotPrint:"Printer busy"},archives:{title:"Print Archives",searchPlaceholder:"Search archives...",filterByPrinter:"Filter by printer",filterByStatus:"Filter by status",sortBy:"Sort by",sortNewest:"Newest first",sortOldest:"Oldest first",sortName:"Name",sortDuration:"Duration",sortLargest:"Largest first",sortSmallest:"Smallest first",sortSize:"Size",noArchives:"No archives found",noArchivesSearch:"No archives match your search",noArchivesYet:"No archives yet",loadingArchives:"Loading archives...",releaseToUpload:"Release to upload",showAll:"Show all",showFavoritesOnly:"Show favorites only",gridView:"Grid view",listView:"List view",calendarView:"Calendar view",logView:"Print Log",manageTags:"Manage Tags",showFailedPrints:"Show failed prints",hideFailedPrints:"Hide failed prints",printTime:"Print Time",filamentUsed:"Filament Used",cost:"Cost",reprint:"Reprint",preview:"Preview",deleteArchive:"Delete Archive",deleteConfirm:"Are you sure you want to delete this archive?",favorite:"Favorite",unfavorite:"Remove from favorites",viewDetails:"View Details",status:{completed:"Completed",failed:"Failed",stopped:"Stopped"},toast:{source3mfAttached:"Source 3MF attached: {{filename}}",failedUploadSource3mf:"Failed to upload source 3MF",source3mfRemoved:"Source 3MF removed",failedRemoveSource3mf:"Failed to remove source 3MF",f3dAttached:"F3D attached: {{filename}}",failedUploadF3d:"Failed to upload F3D",f3dRemoved:"F3D removed",failedRemoveF3d:"Failed to remove F3D",timelapseAttached:"Timelapse attached: {{filename}}",timelapseAlreadyAttached:"Timelapse already attached",noMatchingTimelapse:"No matching timelapse found",failedScanTimelapse:"Failed to scan for timelapse",failedAttachTimelapse:"Failed to attach timelapse",timelapseRemoved:"Timelapse removed",failedRemoveTimelapse:"Failed to remove timelapse",timelapseUploaded:"Timelapse uploaded: {{filename}}",failedUploadTimelapse:"Failed to upload timelapse",archiveDeleted:"Archive deleted",failedDeleteArchive:"Failed to delete archive",addedToFavorites:"Added to favorites",removedFromFavorites:"Removed from favorites",projectUpdated:"Project updated",failedUpdateProject:"Failed to update project",linkCopied:"Link copied to clipboard",failedCopyLink:"Failed to copy link",photoDeleted:"Photo deleted",failedDeletePhoto:"Failed to delete photo",failedDeleteArchives:"Failed to delete archives",failedUpdateFavorites:"Failed to update favorites",exportDownloaded:"Export downloaded",exportFailed:"Export failed"},menu:{print:"Print",schedule:"Schedule",openInBambuStudio:"Open in Slicer",slice:"Slice",externalLink:"External Link",viewOnMakerWorld:"View on MakerWorld",preview3d:"3D Preview",viewTimelapse:"View Timelapse",scanForTimelapse:"Scan for Timelapse",uploadTimelapse:"Upload Timelapse",removeTimelapse:"Remove Timelapse",downloadSource3mf:"Download Source 3MF",uploadSource3mf:"Upload Source 3MF",replaceSource3mf:"Replace Source 3MF",removeSource3mf:"Remove Source 3MF",uploadF3d:"Upload F3D",replaceF3d:"Replace F3D",downloadF3d:"Download F3D",removeF3d:"Remove F3D",download:"Download",copyDownloadLink:"Copy Download Link",qrCode:"QR Code",viewPhotos:"View Photos",viewPhotosCount:"View Photos ({{count}})",projectPage:"Project Page",addToFavorites:"Add to Favorites",removeFromFavorites:"Remove from Favorites",edit:"Edit",goToProject:"Go to Project: {{name}}",addToProject:"Add to Project",removeFromProject:"Remove from Project",loading:"Loading...",noProjectsAvailable:"No projects available",select:"Select",deselect:"Deselect",delete:"Delete"},permission:{noReprint:"You do not have permission to reprint this archive",noAddToQueue:"You do not have permission to add to queue",noUpdateArchives:"You do not have permission to update archives",noUploadFiles:"You do not have permission to upload files",noDownload:"You do not have permission to download archives",noCopyLink:"You do not have permission to copy download links",noDelete:"You do not have permission to delete this archive",noCreate:"You do not have permission to create archives"},card:{previousPlate:"Previous plate",nextPlate:"Next plate",plateNumber:"Plate {{index}}",moreOptions:"Right-click for more options",addToFavorites:"Add to favorites",removeFromFavorites:"Remove from favorites",cancelled:"cancelled",failed:"failed",duplicate:"duplicate",duplicateTitle:"This model has been printed before",openSource3mf:"Open source 3MF in Bambu Studio (right-click for more options)",downloadF3d:"Download Fusion 360 design file",viewTimelapse:"View timelapse",viewPhoto:"View 1 photo",viewPhotos:"View {{count}} photos",openFolder:"Open folder: {{name}}",slicedFile:"Sliced file - ready to print",sourceFile:"Source file only - no AMS mapping available",gcode:"GCODE",source:"SOURCE",project:"Project: {{name}}",estimated:"Estimated: {{time}}",actual:"Actual: {{time}}",accuracy:"Accuracy: {{percent}}%",filament:"{{weight}}g",layer:"{{count}} layer",layers:"{{count}} layers",object:"{{count}} object",objects:"{{count}} objects",slicedFor:"Sliced for {{model}}",uploadedBy:"Uploaded By",noPermissionReprint:"You do not have permission to reprint",noFileForReprint:"No 3MF file available — the file could not be downloaded from the printer when the print was recorded",noPermissionEdit:"You do not have permission to edit archives",noPermissionDelete:"You do not have permission to delete archives",reprint:"Reprint",schedulePrint:"Schedule Print",schedule:"Schedule",openInBambuStudio:"Open in Slicer",openInBambuStudioToSlice:"Open in Slicer to slice",slice:"Slice",externalLink:"External Link",makerWorld:"MakerWorld: {{designer}}",viewProject:"View project",noExternalLink:"No external link",preview3d:"3D Preview",download:"Download",edit:"Edit",delete:"Delete"},modal:{deleteArchive:"Delete Archive",deleteConfirm:'Are you sure you want to delete "{{name}}"? This action cannot be undone.',deleteButton:"Delete",removeSource3mf:"Remove Source 3MF",removeSource3mfConfirm:'Are you sure you want to remove the source 3MF file from "{{name}}"? This will delete the original slicer project file.',removeButton:"Remove",removeF3d:"Remove F3D",removeF3dConfirm:'Are you sure you want to remove the Fusion 360 design file from "{{name}}"?',removeTimelapse:"Remove Timelapse",removeTimelapseConfirm:'Are you sure you want to remove the timelapse video from "{{name}}"?',timelapse:"{{name}} - Timelapse",selectTimelapse:"Select Timelapse",selectTimelapseDesc:"No auto-match found. Select the timelapse for this print:",deleteArchives:"Delete Archives",deleteArchivesConfirm:"Are you sure you want to delete {{count}} archive(s)? This action cannot be undone.",deleteCount:"Delete {{count}}"},page:{title:"Archives",printsCount:"{{filtered}} of {{total}} prints",dropFilesHere:"Drop .3mf files here",releaseToUpload:"Release to upload",only3mfSupported:"Only .3mf files are supported",close:"Close",selected:"{{count}} selected",selectAll:"Select All",tags:"Tags",project:"Project",favorite:"Favorite",delete:"Delete",toggledFavorites:"Toggled favorites for {{count}} archive(s)",failedUpdateFavorites:"Failed to update favorites",archivesDeleted:"{{count}} archive(s) deleted",failedDeleteArchives:"Failed to delete archives",photoDeleted:"Photo deleted",failedDeletePhoto:"Failed to delete photo"},list:{name:"Name",printer:"Printer",date:"Date",size:"Size",actions:"Actions",hasTimelapse:"Has timelapse"},log:{date:"Date",printName:"Print Name",printer:"Printer",user:"User",status:"Status",duration:"Duration",filament:"Filament",allPrinters:"All Printers",allUsers:"All Users",allStatuses:"All Statuses",cancelled:"Cancelled",skipped:"Skipped",dateFrom:"From",dateTo:"To",noEntries:"No print log entries found",showing:"Showing {{count}} of {{total}} entries",rowsPerPage:"Rows",page:"Page",prev:"Prev",next:"Next",clearLog:"Clear Log",clearLogTitle:"Clear Print Log",clearLogConfirm:"All print log entries will be permanently deleted. Archives and queue items are not affected. This action cannot be undone. Are you sure?",clearLogButton:"Clear All",cleared:"{{count}} log entries cleared",clearFailed:"Failed to clear print log"}},queue:{title:"Print Queue",subtitle:"Schedule and manage your print jobs",addToQueue:"Add to Queue",print:"Print",reprint:"Re-print",schedulePrint:"Schedule Print",editQueueItem:"Edit Queue Item",printToPrinters:"Print to {{count}} Printers",queueToPrinters:"Queue to {{count}} Printers",queueAllPlates:"Queue All {{count}} Plates",printQueued:"Print queued",itemsQueued:"{{count}} items queued",sending:"Sending...",sendingProgress:"Sending {{current}}/{{total}}...",adding:"Adding...",addingProgress:"Adding {{current}}/{{total}}...",savingProgress:"Saving {{current}}/{{total}}...",clearQueue:"Clear Queue",clearHistory:"Clear History",emptyQueue:"Queue is empty",position:"Position",scheduledTime:"Scheduled Time",moveUp:"Move Up",moveDown:"Move Down",startNow:"Start Now",printingInProgress:"Printing in progress...",viewArchive:"View archive",viewInFileManager:"View in File Manager",itemCount:"{{count}} item",itemCount_plural:"{{count}} items",dragToReorder:"Drag to reorder (ASAP only)",reorderHint:"Position only affects ASAP items. Scheduled items run at their set time.",addedBy:"Added by {{name}}",nextInQueue:"Next in queue",clearPlate:"Clear Plate & Start Next",clearPlateSuccess:"Plate cleared — ready for next print",plateReady:"Plate cleared — ready for next print",plateNumber:"Plate {{index}}",sections:{currentlyPrinting:"Currently Printing",queued:"Queued",history:"History"},status:{pending:"Pending",waiting:"Waiting",printing:"Printing",paused:"Paused",completed:"Completed",failed:"Failed",skipped:"Skipped",cancelled:"Cancelled"},summary:{printing:"Printing",queued:"Queued",totalTime:"Total Queue Time",totalWeight:"Total Queue Weight",history:"History"},filter:{allPrinters:"All Printers",unassigned:"Unassigned",allStatus:"All Status",allLocations:"All Locations",any:"Any"},sort:{byPosition:"Sort by Position",byName:"Sort by Name",byPrinter:"Sort by Printer",bySchedule:"Sort by Schedule",byDate:"Sort by Date",ascendingOldest:"Ascending (oldest first)",descendingNewest:"Descending (newest first)"},badges:{staged:"Staged",requiresPrevious:"Requires previous success",autoPowerOff:"Auto power off"},empty:{title:"No prints scheduled",description:'Schedule a print from the Archives page using the "Schedule" option in the context menu, or drag and drop files to get started.'},time:{asap:"ASAP",overdue:"Overdue",now:"Now",lessThanMinute:"In less than a minute",inMinutes:"In {{count}} min",inHours:"In {{count}} hours"},actions:{stopPrint:"Stop Print",startPrint:"Start Print",requeue:"Re-queue"},bulkEdit:{title:"Edit {{count}} Item",title_plural:"Edit {{count}} Items",description:"Only changed settings will be applied to selected items.",printer:"Printer",noChange:"— No change —",queueOptions:"Queue Options",staged:"Staged (manual start)",autoPowerOff:"Auto power off after print",requirePrevious:"Require previous success",printOptions:"Print Options",bedLevelling:"Bed levelling",flowCalibration:"Flow calibration",vibrationCalibration:"Vibration calibration",layerInspection:"First layer inspection",timelapse:"Timelapse",useAms:"Use AMS",applyChanges:"Apply Changes",selectAll:"Select All",deselectAll:"Deselect All",selected:"{{count}} selected",editSelected:"Edit Selected",cancelSelected:"Cancel Selected"},confirm:{cancelTitle:"Cancel Scheduled Print",cancelMessage:'Are you sure you want to cancel "{{name}}"?',stopTitle:"Stop Print",stopMessage:'Are you sure you want to stop the current print "{{name}}"? This will cancel the print job on the printer.',removeTitle:"Remove from History",removeMessage:'Are you sure you want to remove "{{name}}" from the queue history?',clearHistoryTitle:"Clear History",clearHistoryMessage:"Are you sure you want to remove all {{count}} item(s) from the history?",cancelButton:"Cancel Print",stopButton:"Stop Print",thisPrint:"this print",thisItem:"this item"},toast:{cancelled:"Queue item cancelled",cancelFailed:"Failed to cancel item",removed:"Queue item removed",removeFailed:"Failed to remove item",stopped:"Print stopped",stopFailed:"Failed to stop print",released:"Print released to queue",startFailed:"Failed to start print",reorderFailed:"Failed to reorder queue",historyCleared:"Cleared {{count}} history item(s)",clearHistoryFailed:"Failed to clear history",updateFailed:"Failed to update items",bulkCancelled:"Cancelled {{count}} item(s)",bulkCancelFailed:"Failed to cancel items"},permissions:{noStopPrint:"You do not have permission to stop prints",noStartPrint:"You do not have permission to start prints",noEdit:"You do not have permission to edit this queue item",noCancel:"You do not have permission to cancel this queue item",noRequeue:"You do not have permission to re-queue items",noRemove:"You do not have permission to remove this queue item",noClearHistory:"You do not have permission to clear all history",noEditItems:"You do not have permission to edit queue items",noCancelItems:"You do not have permission to cancel queue items"}},backgroundDispatch:{unknownFile:"Unknown file",unknownPrinter:"Unknown printer",startingPrints:"Starting prints",progressSummary:"{{complete}}/{{total}} complete • Dispatched: {{dispatched}} • Processing: {{processing}}",expandDetails:"Expand dispatch details",collapseDetails:"Collapse dispatch details",dismissToast:"Dismiss dispatch toast",cancelDispatchJob:"Cancel dispatch job",cancel:"Cancel",cancelling:"Cancelling…",status:{dispatched:"Dispatched",processing:"Processing",completed:"Completed",failed:"Failed",cancelled:"Cancelled"},toast:{cancellingUpload:"Cancelling upload...",cancelled:"Dispatch cancelled",cancelFailed:"Failed to cancel dispatch",completeWithFailures:"Background dispatch complete: {{completed}} succeeded, {{failed}} failed",completeSuccess:"Background dispatch complete: {{completed}} succeeded",printStartedRemaining:"{{completed}} print(s) started, {{remaining}} more sending..."}},stats:{title:"Dashboard",subtitle:"Drag widgets to rearrange. Click the eye icon to hide.",overview:"Overview",totalPrints:"Total Prints",successRate:"Success Rate",totalPrintTime:"Total Print Time",printTime:"Print Time",totalFilament:"Total Filament Used",filamentUsed:"Filament Used",filamentCost:"Filament Cost",totalCost:"Total Cost",energyUsed:"Energy Used",energyCost:"Energy Cost",averagePrintTime:"Average Print Time",printsPerDay:"Prints per Day",byPrinter:"By Printer",printsByPrinter:"Prints by Printer",byMaterial:"By Material",byMonth:"By Month",last7Days:"Last 7 Days",last30Days:"Last 30 Days",last90Days:"Last 90 Days",allTime:"All Time",quickStats:"Quick Stats",printActivity:"Print Activity",filamentTypes:"Filament Types",filamentTrends:"Filament Trends",failureAnalysis:"Failure Analysis",timeAccuracy:"Time Accuracy",successful:"Successful:",failed:"Failed:",perfectEstimate:"100% = perfect estimate",noTimeAccuracyData:"No time accuracy data yet",noFilamentData:"No filament data available",noPrinterData:"No printer data available",noPrintData:"No print data available",noPrintDataLast30Days:"No print data in the last 30 days",failureReasons:"Failure Reasons",topFailureReasons:"Top Failure Reasons",failedPrintsCount:"{{failed}} / {{total}} prints failed",lastWeekRate:"Last week: {{rate}}%",resetLayout:"Reset Layout",recalculateCosts:"Recalculate Costs",recalculateCostsHint:"Recalculate all archive costs using current filament prices",exportStats:"Export Stats",exportAsCsv:"Export as CSV",exportAsExcel:"Export as Excel",hiddenCount:"{{count}} Hidden",exportDownloaded:"Export downloaded",exportFailed:"Export failed",layoutReset:"Layout reset",recalculatedCosts:"Recalculated costs for {{count}} archives",recalculateFailed:"Failed to recalculate costs",loadingStats:"Loading statistics...",noPermissionResetLayout:"You do not have permission to reset layout",noPermissionRecalculate:"You do not have permission to recalculate costs",noPrintDataInRange:"No print data in selected range",periodFilament:"Period Filament",periodCost:"Period Cost",avgPerPrint:"Avg per Print",usageOverTime:"Usage Over Time",filamentByWeight:"Weight",printDuration:"Print Duration",printerUtilization:"Printer Utilization",filamentSuccess:"Success by Material",printHabits:"Print Habits",printTimeOfDay:"Print Time of Day",colorDistribution:"Color Distribution",noColorData:"No color data available",records:"Records",longestPrint:"Longest Print",heaviestPrint:"Heaviest Print",mostExpensivePrint:"Most Expensive",busiestDay:"Busiest Day",successStreak:"Success Streak",streakPrint:"consecutive print",streakPrints:"{{count}} consecutive prints",printerStats:"Printer Stats",hours:"hours",avgPrints:"Avg. prints",noArchiveData:"No print data available",filamentByTime:"Time",avgWeight:"Avg. weight",avgTime:"Avg. time",filamentByPrints:"Prints",timeframe:{today:"Today","this-week":"This Week","this-month":"This Month","last-7":"Last 7 Days","last-30":"Last 30 Days","last-90":"Last 90 Days","this-year":"This Year","all-time":"All Time",custom:"Custom Range",from:"From",to:"To"}},maintenance:{title:"Maintenance",overview:"Overview",allOk:"All maintenance up to date",dueCount:"{{count}} item due",dueCount_plural:"{{count}} items due",warningCount:"{{count}} warning",warningCount_plural:"{{count}} warnings",totalPrintTime:"Total Print Time",nextMaintenance:"Next Maintenance",nothingDue:"Nothing due",tasks:"Tasks",lastPerformed:"Last performed",interval:"Interval",hoursRemaining:"{{hours}}h remaining",hoursOverdue:"{{hours}}h overdue",markDone:"Mark as Done",performMaintenance:"Perform Maintenance",history:"History",noHistory:"No maintenance history",editPrintHours:"Edit Print Hours",currentHours:"Current Hours",statusTab:"Status",settingsTab:"Settings",overdueCount:"{{count}} overdue",dueSoonCount:"{{count}} due soon",dueSoon:"Due soon",allGood:"All good",overdueBy:"Overdue by {{duration}}",dueIn:"Due in {{duration}}",timeLeft:"{{duration}} left",day:"1 day",days:"{{count}} days",week:"1 week",weeks:"{{count}} weeks",month:"1 month",months:"{{count}} months",year:"1 year",maintenanceTypes:"Maintenance Types",maintenanceTypesDescription:"System types and your custom maintenance tasks",addCustomType:"Add Custom Type",restoreDefaults:"Restore Default Tasks",intervalType:"Interval Type",intervalValue:"Interval ({{type}})",icon:"Icon",documentationLink:"Documentation Link (optional)",assignToPrinters:"Assign to Printers",selectAtLeastOnePrinter:"Select at least one printer",addType:"Add Type",custom:"Custom",printHours:"Print Hours",calendarDays:"Calendar Days",exampleName:"e.g., Replace HEPA Filter",viewDocumentation:"View documentation",timeBasedInterval:"Time-based interval",intervalOverrides:"Interval Overrides",intervalOverridesDescription:"Customize intervals for specific printers",assignedToPrinters:"Assigned to printers:",noPrintersAssigned:"No printers assigned",addPrinterShort:"Add:",printersAssignedClick:"{{count}} printer(s) assigned - click to manage",removeFromPrinter:"Remove from this printer",types:{lubricateCarbonRods:"Lubricate Carbon Rods",lubricateRails:"Lubricate Linear Rails",cleanNozzle:"Clean Nozzle/Hotend",checkBelts:"Check Belt Tension",cleanBuildPlate:"Clean Build Plate",checkExtruder:"Check Extruder Gears",checkCooling:"Check Cooling Fans",generalInspection:"General Inspection",cleanCarbonRods:"Clean Carbon Rods",lubricateSteelRods:"Lubricate Steel Rods",cleanSteelRods:"Clean Steel Rods",cleanLinearRails:"Clean Linear Rails",checkPtfeTube:"Check PTFE Tube",replaceHepaFilter:"Replace HEPA Filter",replaceCarbonFilter:"Replace Carbon Filter",lubricateLeftNozzleRail:"Lubricate Left Nozzle Rail"},maintenanceComplete:"Maintenance marked as complete",typeUpdated:"Maintenance type updated",typeDeleted:"Maintenance type deleted",defaultsRestored:"Restored {{count}} default task(s)",printHoursUpdated:"Print hours updated",printerAssigned:"Printer assigned",printerRemoved:"Printer removed",deleteTypeConfirm:'Delete "{{name}}"?',deleteSystemTypeTitle:"Delete default maintenance task?",deleteSystemTypeMessage:'Are you sure you want to delete the default maintenance task "{{name}}"?',noPermissionUpdate:"You do not have permission to update maintenance items",noPermissionPerform:"You do not have permission to perform maintenance",noPermissionEditTypes:"You do not have permission to edit maintenance types",noPermissionDeleteTypes:"You do not have permission to delete maintenance types",noPermissionEditHours:"You do not have permission to edit print hours",noPermissionRemovePrinter:"You do not have permission to remove printer assignments",noPermissionAssignPrinter:"You do not have permission to assign printers",noPermissionEditIntervals:"You do not have permission to edit intervals",configureSettings:"Configure maintenance types and intervals"},settings:{title:"Settings",general:"General",tabs:{general:"General",smartPlugs:"Smart Plugs",notifications:"Notifications",filament:"Filament",network:"Network",apiKeys:"API Keys",virtualPrinter:"Virtual Printer",users:"Authentication",backup:"Backup",emailAuth:"Email Authentication"},email:{smtpSettings:"SMTP Configuration",smtpHost:"SMTP Server",smtpPort:"SMTP Port",security:"Security",authentication:"Authentication",username:"Username",password:"Password",fromEmail:"From Email",fromName:"From Name",testConnection:"Test SMTP Connection",testRecipient:"Test Recipient Email",sendTest:"Send Test Email",sending:"Sending...",save:"Save Settings",saving:"Saving...",advancedAuth:"Advanced Authentication",advancedAuthEnabled:"Advanced Authentication is enabled",advancedAuthEnabledDesc:"Email-based user management features are active. New users will receive auto-generated passwords via email, and users can reset their passwords through the forgot password feature.",advancedAuthDisabled:"Advanced Authentication is disabled",advancedAuthDisabledDesc:"Enable advanced authentication to activate email-based features for user management.",enable:"Enable",disable:"Disable",feature1:"Passwords are auto-generated and emailed to new users",feature2:"Users can login with username or email",feature3:"Forgot password feature is available",feature4:"Admins can reset user passwords via email",errors:{requiredFields:"Please fill in all required fields",usernameRequired:"Username is required when authentication is enabled",enterTestEmail:"Please enter a test email address",smtpServerAndEmail:"Please fill in SMTP Server and From Email before testing",usernamePasswordRequired:"Username and Password are required when authentication is enabled",configureSmtpFirst:"Please configure and test SMTP settings first"},success:{settingsSaved:"SMTP settings saved successfully"},securityOptions:{starttls:"STARTTLS (Port 587)",ssl:"SSL/TLS (Port 465)",none:"None (Port 25)"},authOptions:{enabled:"Enabled",disabled:"Disabled"}},appearance:"Appearance",notifications:"Notifications",smartPlugs:"Smart Plugs",spoolman:"Spoolman",updates:"Updates",language:"Language",languageDescription:"Select your preferred language",theme:"Theme",themeLight:"Light",themeDark:"Dark",themeSystem:"System",defaultView:"Default View",defaultViewDescription:"Page to show when opening the app",checkForUpdates:"Check for Updates",autoUpdate:"Auto Update",currentVersion:"Current Version",latestVersion:"Latest Version",upToDate:"You are up to date",updateAvailable:"Update available",notificationLanguage:"Notification Language",notificationLanguageDescription:"Language for push notifications",bedCooledThreshold:"Bed Cooled Threshold",bedCooledThresholdDescription:"Temperature below which the bed is considered cooled after a print",notificationProviders:"Notification Providers",addProvider:"Add Provider",editProvider:"Edit Provider",providerType:"Provider Type",testNotification:"Test Notification",testSuccess:"Test notification sent successfully",testFailed:"Failed to send test notification",quietHours:"Quiet Hours",quietHoursDescription:"Do not disturb during these hours",quietHoursStart:"Start",quietHoursEnd:"End",events:{title:"Notification Events",printStart:"Print Started",printComplete:"Print Completed",printFailed:"Print Failed",printStopped:"Print Stopped",printProgress:"Progress Milestones",printProgressDescription:"Notify at 25%, 50%, 75%",printerOffline:"Printer Offline",printerError:"Printer Error",filamentLow:"Low Filament",maintenanceDue:"Maintenance Due",maintenanceDueDescription:"Notify when maintenance is needed"},smartPlug:{title:"Smart Plugs",add:"Add Smart Plug",edit:"Edit Smart Plug",name:"Name",ipAddress:"IP Address",linkedPrinter:"Linked Printer",autoOn:"Auto Power On",autoOnDescription:"Turn on when print starts",autoOff:"Auto Power Off",autoOffDescription:"Turn off after print completes",offDelay:"Off Delay",offDelayMinutes:"Minutes after print",offDelayTemp:"When nozzle below temperature",currentState:"Current State",turnOn:"Turn On",turnOff:"Turn Off"},filamentTracking:"Filament Tracking",filamentTrackingDesc:"Choose how to track your filament spools. You can use the built-in inventory or connect an external Spoolman server.",trackingModeBuiltIn:"Built-in Inventory",trackingModeBuiltInDesc:"RFID auto-matching and usage tracking included",trackingModeSpoolmanDesc:"External filament management server",builtInFeatureRfid:"Automatically detects Bambu Lab RFID spools in AMS",builtInFeatureUsage:"Tracks filament consumption per print",builtInFeatureCatalog:"Manage spools, colors, and K-factor profiles",builtInFeatureThirdParty:"Third-party spools can be assigned to inventory spools",amsSyncButton:"Sync Weights from AMS",amsSyncTitle:"Sync Spool Weights from AMS",amsSyncMessage:"This will overwrite all inventory spool weights with the current AMS remain% values from connected printers. Use this to recover from corrupted weight data. Printers must be online.",amsSyncing:"Syncing...",amsSyncSuccess:"{{synced}} spool(s) synced, {{skipped}} skipped",amsSyncError:"Failed to sync weights from AMS",spoolmanUrl:"Spoolman URL",spoolmanUrlHint:"URL of your Spoolman server (e.g., http://localhost:7912)",spoolmanConnected:"Connected",spoolmanDisconnected:"Disconnected",status:"Status",connect:"Connect",disconnect:"Disconnect",howSyncWorks:"How Sync Works",syncInfoRfidOnly:"Only official Bambu Lab spools with RFID are synced",syncInfoAutoCreate:"New spools are auto-created in Spoolman on first sync",syncInfoThirdPartySkipped:"Non-Bambu Lab spools (third-party, refilled) are skipped",linkingExistingSpools:"Linking Existing Spools",linkingExistingSpoolsDesc:'To link existing Spoolman spools to your AMS, hover over an AMS slot and click "Link to Spoolman".',syncMode:"Sync Mode",syncModeAuto:"Automatic",syncModeManual:"Manual Only",syncModeAutoDesc:"AMS data syncs automatically when changes are detected",syncModeManualDesc:"Only sync when manually triggered",syncAmsData:"Sync AMS Data",syncAmsDataDesc:"Manually sync printer AMS data to Spoolman",allPrinters:"All Printers",noDefaultPrinter:"No default (ask each time)",sidebarOrder:"Sidebar order",saveThumbnails:"Save thumbnails",captureFinishPhoto:"Capture finish photo",noPrintersConfigured:"No printers configured",archiveMode:{always:"Always create archive entry",never:"Never create archive entry",ask:"Ask each time"},checkForUpdatesLabel:"Check for updates",checkPrinterFirmware:"Check printer firmware",includeBetaUpdates:"Include beta versions",includeBetaUpdatesDesc:"Notify about beta and prerelease versions when checking for updates",enableRetry:"Enable retry",homeAssistantDescription:"Control smart plugs via Home Assistant",environmentManagedLabel:"(Environment Managed)",autoEnabledViaEnv:"Automatically enabled via environment variables",urlFromEnvReadOnly:"Value set by HA_URL environment variable (read-only)",tokenFromEnvReadOnly:"Value set by HA_TOKEN environment variable (read-only)",mqttConnectedTo:"Connected to",prometheusDescription:"Expose printer data in Prometheus format",noSmartPlugsTitle:"No smart plugs configured",noSmartPlugsDescription:"Add a Tasmota-based smart plug to track energy usage and automate power control.",noProvidersTitle:"No providers configured",noProvidersDescription:"Add a provider to receive alerts.",noTemplatesAvailable:"No templates available. Restart the backend to seed default templates.",apiPermissionView:"View printer status and queue",apiPermissionEdit:"Add and remove items from print queue",apiKeysEmptyTitle:"No API keys",apiKeysEmptyDescription:"Create an API key to integrate with external services.",noUsersFound:"No users found",noGroupsFound:"No groups found",noGroupsAvailable:"No groups available",passwordsDoNotMatch:"Passwords do not match",systemGroupWarning:"System group names cannot be changed",authDisabledTitle:"Authentication is Disabled",authDisabledFeature1:"Require login to access the system",authDisabledFeature2:"Create multiple users with group-based permissions",authDisabledFeature3:"Control access with 50+ granular permissions",userHasCreated:"This user has created:",userItemsQuestion:"What would you like to do with these items?",deleteUserConfirm:"Are you sure you want to delete this user?",actionCannotBeUndone:"This action cannot be undone.",addFirstSmartPlug:"Add Your First Smart Plug",providers:"Providers",log:"Log",testAll:"Test All",testResults:"Test Results",testPassedCount:"{{count}} passed",testFailedCount:"{{count}} failed",messageTemplates:"Message Templates",messageTemplatesDescription:"Customize notification messages for each event.",apiKeys:"API Keys",apiKeysDescription:"Create API keys for external integrations and webhooks.",createKey:"Create Key",apiKeyCreated:"API Key Created Successfully",apiKeyCopyWarning:"Copy this key now - it won't be shown again!",useInApiBrowser:"Use in API Browser",createNewApiKey:"Create New API Key",keyName:"Key Name",keyNamePlaceholder:"e.g., Home Assistant, OctoPrint",readStatus:"Read Status",readStatusDescription:"View printer status and queue",manageQueue:"Manage Queue",manageQueueDescription:"Add and remove items from print queue",controlPrinter:"Control Printer",controlPrinterDescription:"Pause, resume, and stop prints",unnamedKey:"Unnamed Key",lastUsed:"Last used",read:"Read",control:"Control",createFirstKey:"Create Your First Key",webhookEndpoints:"Webhook Endpoints",webhookApiKeyHint:"Use your API key in the X-API-Key header.",webhook:{getAllStatus:"Get all printer status",getSpecificStatus:"Get specific printer status",addToQueue:"Add to print queue",pausePrint:"Pause print",resumePrint:"Resume print",stopPrint:"Stop print"},apiBrowser:"API Browser",apiBrowserDescription:"Explore and test all available API endpoints.",apiKeyForTesting:"API Key for Testing",apiKeyPlaceholder:"Paste your API key here to test authenticated endpoints...",apiKeyHint:"This key will be sent as X-API-Key header with requests.",deleteApiKeyTitle:"Delete API Key",deleteApiKeyMessage:"Are you sure you want to delete this API key? Any integrations using this key will stop working.",deleteKey:"Delete Key",amsDisplayThresholds:"AMS Display Thresholds",amsThresholdsDescription:"Configure color thresholds for AMS humidity and temperature indicators.",humidity:"Humidity",goodGreen:"Good (green)",fairOrange:"Fair (orange)",aboveFairBad:"Above fair threshold shows as red (bad)",temperature:"Temperature",goodBlue:"Good (blue)",aboveFairHot:"Above fair threshold shows as red (hot)",historyRetention:"History Retention",keepSensorHistory:"Keep sensor history for",historyRetentionDescription:"Older humidity and temperature data will be automatically deleted",printModal:"Print Modal",expandCustomMapping:"Expand custom mapping by default",expandCustomMappingDescription:"When printing to multiple printers, show per-printer AMS mapping expanded",authentication:"Authentication",authEnabledDescription:"Your instance is secured with user authentication",authDisabledDescription:"Enable to require login and manage user access",authDisabledMessage:"Enable authentication to create user accounts, manage permissions, and secure your Bambuddy instance.",enableAuthentication:"Enable Authentication",currentUser:"Current User",changePassword:"Change Password",admin:"Admin",users:"Users",addUser:"Add User",groups:"Groups",addGroup:"Add Group",system:"System",noDescription:"No description",userCount:"{{count}} users",permissionCount:"{{count}} permissions",createUser:"Create User",username:"Username",enterUsername:"Enter username",password:"Password",enterPassword:"Enter password (min 6 characters)",confirmPassword:"Confirm Password",confirmPasswordPlaceholder:"Confirm password",viewReleaseOnGitHub:"View release on GitHub",turnAllPlugsOn:"Turn all plugs on",turnAllPlugsOff:"Turn all plugs off",clearNotificationLogs:"Clear Notification Logs",clearLogsMessage:"This will permanently delete all notification logs older than 30 days. This action cannot be undone.",clearLogs:"Clear Logs",resetUiPreferences:"Reset UI Preferences",resetUiPreferencesMessage:"This will reset all UI preferences to defaults: sidebar order, theme, dashboard layout, view modes, and sorting preferences. Your printers, archives, and server settings will NOT be affected. The page will reload after clearing.",resetPreferences:"Reset Preferences",deleteGroupTitle:"Delete Group",deleteGroupMessage:"Are you sure you want to delete this group? Users in this group will lose these permissions.",deleteGroup:"Delete Group",disableAuthenticationTitle:"Disable Authentication",disableAuthenticationMessage:"Are you sure you want to disable authentication? This will make your Bambuddy instance accessible without login. All users will remain in the database but authentication will be disabled.",disableAuthentication:"Disable Authentication",configureBambuddy:"Configure Bambuddy",systemDefault:"System Default",archiveSettings:"Archive Settings",newWindow:"New Window",embeddedOverlay:"Embedded Overlay",preferredSlicer:"Preferred Slicer",preferredSlicerDescription:"Choose which slicer application to open files with",externalCameras:"External Cameras",costTracking:"Cost Tracking",printsOnly:"Prints Only",totalConsumption:"Total Consumption",dataManagement:"Data Management",storageUsage:"Storage Usage",storageUsageDescription:"Breakdown of data usage by category",storageUsageTotal:"Total",storageUsageErrors:"Errors",storageUsageOtherBreakdown:"Other (includes static assets, scripts, and configuration files)",storageUsageSystem:"System",storageUsageData:"Data",storageUsageUnavailable:"Storage usage information unavailable",clearNotificationLogsDescription:"Delete notification logs older than 30 days",resetUiPreferencesDescription:"Reset sidebar order, theme, view modes, and layout preferences. Printers, archives, and settings are not affected.",enableHomeAssistant:"Enable Home Assistant",enableMqtt:"Enable MQTT",useTls:"Use TLS",enableMetricsEndpoint:"Enable Metrics Endpoint",availableMetrics:"Available Metrics",editUser:"Edit User",deleteUserTitle:"Delete User",groupName:"Group Name",leaveEmptyForAnonymous:"Leave empty for anonymous",leaveEmptyForNoAuth:"Leave empty for no authentication",enterNewPassword:"Enter new password",confirmNewPassword:"Confirm new password",enterGroupName:"Enter group name",enterDescriptionOptional:"Enter description (optional)",enterCurrentPassword:"Enter current password",enterNewPasswordMin6:"Enter new password (min 6 characters)",toast:{keyCopied:"Key copied to clipboard",copyFailed:"Failed to copy key",keyAddedToBrowser:"Key added to API Browser",clearLogsFailed:"Failed to clear logs",uiPreferencesReset:"UI preferences reset. Refreshing...",authDisabled:"Authentication disabled successfully",authDisableFailed:"Failed to disable authentication",apiKeyCreated:"API key created",apiKeyDeleted:"API key deleted",userCreated:"User created successfully",userUpdated:"User updated successfully",userDeleted:"User deleted successfully",groupCreated:"Group created successfully",groupUpdated:"Group updated successfully",groupDeleted:"Group deleted successfully",fillRequiredFields:"Please fill in all required fields",passwordsDoNotMatch:"Passwords do not match",passwordTooShort:"Password must be at least 6 characters",enterGroupName:"Please enter a group name",settingsSaved:"Settings saved",cameraSettingsSaved:"Camera settings saved",enterCameraUrl:"Please enter a camera URL",passwordChanged:"Password changed successfully",connectionFailed:"Connection failed",testFailed:"Test failed",cameraConnected:"Camera connected{{resolution}}"},testConnection:"Test Connection",catalog:{spoolCatalog:"Spool Catalog",spoolCatalogDescription:"Empty spool weights by brand/type. Used for automatic weight lookup when adding spools.",searchCatalog:"Search catalog...",addNewEntry:"Add New Entry",namePlaceholder:"Name (e.g., Bambu Lab - Plastic)",weight:"Weight",type:"Type",default:"Default",custom:"Custom",noMatch:"No entries match your search",empty:"No entries in catalog",deleteEntry:"Delete Entry",deleteConfirm:'Are you sure you want to delete "{{name}}"?',resetCatalog:"Reset Catalog",resetConfirm:"Reset catalog to defaults? This will remove all custom entries.",loadFailed:"Failed to load spool catalog",nameWeightRequired:"Name and weight are required",entryAdded:"Entry added",addFailed:"Failed to add entry",entryUpdated:"Entry updated",updateFailed:"Failed to update entry",entryDeleted:"Entry deleted",deleteFailed:"Failed to delete entry",resetSuccess:"Catalog reset to defaults",resetFailed:"Failed to reset catalog",exported:"Exported {{count}} entries",imported:"Imported {{added}} entries ({{skipped}} skipped)",importFailed:"Failed to import: invalid JSON format",exportTooltip:"Export catalog to JSON",importTooltip:"Import catalog from JSON",resetTooltip:"Reset to defaults",selectedCount:"{{count}} selected",deleteSelected:"Delete Selected",bulkDeleteConfirm:"Are you sure you want to delete {{count}} entries?",bulkDeleted:"Deleted {{count}} entries",bulkDeleteFailed:"Failed to delete entries"},colorCatalog:{title:"Color Catalog",description:"Filament colors by manufacturer/material. Used for automatic color lookup when adding spools.",searchColors:"Search colors...",allManufacturers:"All manufacturers",addNewColor:"Add New Color",manufacturer:"Manufacturer",colorName:"Color Name",hex:"Hex",materialOptional:"Material (optional)",showing:"Showing {{filtered}} of {{total}} colors",noMatch:"No colors match your search",empty:"No colors in catalog",deleteColor:"Delete Color",deleteConfirm:'Are you sure you want to delete "{{name}}"?',resetCatalog:"Reset Color Catalog",resetConfirm:"Reset catalog to defaults? This will remove all custom colors.",sync:"Sync",starting:"Starting...",syncTooltip:"Sync from FilamentColors.xyz (2000+ colors, may take a minute)",loadFailed:"Failed to load color catalog",fieldsRequired:"Manufacturer, color name, and hex color are required",colorAdded:"Color added",addFailed:"Failed to add color",colorUpdated:"Color updated",updateFailed:"Failed to update color",colorDeleted:"Color deleted",deleteFailed:"Failed to delete color",resetSuccess:"Color catalog reset to defaults",resetFailed:"Failed to reset catalog",syncUpToDate:"Already up to date ({{count}} colors checked)",syncComplete:"Added {{added}} new colors ({{skipped}} already existed)",syncError:"Sync error",syncFailed:"Failed to sync from FilamentColors.xyz",exported:"Exported {{count}} colors",imported:"Imported {{added}} colors ({{skipped}} skipped)",importFailed:"Failed to import: invalid JSON format",selectedCount:"{{count}} selected",deleteSelected:"Delete Selected",bulkDeleteConfirm:"Are you sure you want to delete {{count}} colors?",bulkDeleted:"Deleted {{count}} colors",bulkDeleteFailed:"Failed to delete colors"},dateFormat:"Date Format",dateFormatUs:"US (MM/DD/YYYY)",dateFormatEu:"EU (DD/MM/YYYY)",dateFormatIso:"ISO (YYYY-MM-DD)",timeFormat:"Time Format",timeFormat12:"12-hour (3:30 PM)",timeFormat24:"24-hour (15:30)",defaultPrinter:"Default Printer",defaultPrinterDescription:"Pre-select this printer for uploads, reprints, and other operations.",slicerBambuStudio:"Bambu Studio",slicerOrcaSlicer:"OrcaSlicer",sidebarOrderDescription:"Drag items in the sidebar to reorder. Reset to default order here.",reset:"Reset",darkMode:"Dark Mode",lightMode:"Light Mode",active:"(active)",background:"Background",accent:"Accent",style:"Style",bgNeutral:"Neutral",bgWarm:"Warm",bgCool:"Cool",bgOled:"OLED Black",bgSlate:"Slate Blue",bgForest:"Forest Green",accentGreen:"Green",accentTeal:"Teal",accentBlue:"Blue",accentOrange:"Orange",accentPurple:"Purple",accentRed:"Red",styleClassic:"Classic",styleGlow:"Glow",styleVibrant:"Vibrant",themeToggleHint:"Toggle between dark and light mode using the sun/moon icon in the sidebar.",autoArchivePrints:"Auto-archive prints",autoArchiveDescription:"Automatically save 3MF files when prints complete",saveThumbnailsDescription:"Extract and save preview images from 3MF files",captureFinishPhotoDescription:"Take a photo from printer camera when print completes",ffmpegNotInstalled:"ffmpeg not installed",ffmpegRequired:"Camera capture requires ffmpeg. Install it via <brew>brew install ffmpeg</brew> (macOS) or <apt>apt install ffmpeg</apt> (Linux).",camera:"Camera",cameraViewMode:"Camera View Mode",cameraOverlayDescription:"Camera opens in a resizable overlay on the main screen",cameraWindowDescription:"Camera opens in a separate browser window",externalCamerasDescription:"Configure external cameras to replace the built-in printer camera. Supports MJPEG streams, RTSP, HTTP snapshots, and USB cameras (V4L2). When enabled, the external camera is used for live view and finish photos.",cameraPlaceholderUsb:"Device path (/dev/video0)",cameraPlaceholderUrl:"Camera URL (rtsp://... or http://...)",cameraTypeMjpeg:"MJPEG Stream",cameraTypeRtsp:"RTSP Stream",cameraTypeSnapshot:"HTTP Snapshot",cameraTypeUsb:"USB Camera (V4L2)",test:"Test",connected:"Connected",disconnected:"Disconnected",currency:"Currency",defaultFilamentCost:"Default filament cost (per kg)",electricityCost:"Electricity cost per kWh",energyDisplayMode:"Energy display mode",energyModePrintDescription:"Dashboard shows sum of energy used during prints",energyModeTotalDescription:"Dashboard shows lifetime energy from smart plugs",fileManager:"File Manager",createArchiveEntry:"Create Archive Entry When Printing",createArchiveEntryDescription:"When printing from File Manager, optionally create an archive entry",lowDiskSpaceWarning:"Low Disk Space Warning",lowDiskSpaceDescription:"Show warning when free disk space falls below this threshold",printerFirmware:"Printer Firmware",checkFirmwareDescription:"Check for printer firmware updates from Bambu Lab",bambuddySoftware:"Bambuddy Software",autoCheckDescription:"Automatically check for new versions on startup",checkNow:"Check now",updateAvailableVersion:"Update available: v{{version}}",releaseNotes:"Release Notes",updateViaDocker:"Update via Docker Compose:",installUpdate:"Install Update",latestVersionRunning:"You're running the latest version",failedToCheckUpdates:"Failed to check for updates: {{error}}",backupRestore:"Backup & Restore",backupRestoreDescription:"Export/import settings and configure GitHub backup",goToBackup:"Go to Backup",externalUrl:"External URL",externalUrlDescription:"The external URL where Bambuddy is accessible. Used for notification images and external integrations.",bambuddyUrl:"Bambuddy URL",externalUrlHint:"Include protocol and port (e.g., http://192.168.1.100:8000)",ftpRetry:"FTP Retry",ftpRetryDescription:"Retry FTP operations when printer WiFi is unreliable. Applies to 3MF downloads, print uploads, timelapse downloads, and firmware updates.",autoRetryDescription:"Automatically retry failed FTP operations",retryAttempts:"Retry attempts",retryDelay:"Retry delay",connectionTimeout:"Connection timeout",time_one:"{{count}} time",time_other:"{{count}} times",second_one:"{{count}} second",second_other:"{{count}} seconds",nSeconds:"{{count}} seconds",increaseForWeakWifi:"Increase for printers with weak WiFi",homeAssistant:"Home Assistant",homeAssistantFullDescription:"Connect to Home Assistant to control smart plugs via HA's REST API. Supports switch, light, input_boolean, and script entities.",homeAssistantUrl:"Home Assistant URL",longLivedAccessToken:"Long-Lived Access Token",haTokenHint:"Create a token in HA: Profile → Long-Lived Access Tokens → Create Token",connectionSuccessful:"Connection Successful",connectionFailed:"Connection Failed",haConnectionSuccess:"Successfully connected to Home Assistant.",haConnectionFailed:"Failed to connect to Home Assistant.",mqttPublishing:"MQTT Publishing",mqttDescription:"Publish BamBuddy events to an external MQTT broker for integration with Node-RED, Home Assistant, and other automation systems.",mqttEnableDescription:"Publish events to external MQTT broker",brokerHostname:"Broker hostname",port:"Port",usernameOptional:"Username (optional)",passwordOptional:"Password (optional)",topicPrefix:"Topic prefix",topicPrefixHint:"Topics will be: {{prefix}}/printers/<serial>/status, etc.",prometheusMetrics:"Prometheus Metrics",prometheusEndpointDescription:"Expose printer metrics at <code>/api/v1/metrics</code> for Prometheus/Grafana monitoring.",bearerTokenOptional:"Bearer Token (optional)",bearerTokenHint:"If set, requests must include <code>Authorization: Bearer <token></code>",metricsConnectionStatus:"Connection status",metricsPrinterState:"Printer state (idle/printing/etc)",metricsPrintProgress:"Print progress 0-100%",metricsBedTemp:"Bed temperature",metricsNozzleTemp:"Nozzle temperature",metricsPrintsTotal:"Total prints by result",metricsMore:"...and more (layers, fans, queue, filament usage)",smartPlugsDescription:"Connect smart plugs (Tasmota or Home Assistant) to automate power control and track energy usage for your printers.",allOn:"All On",allOff:"All Off",addSmartPlug:"Add Smart Plug",energySummary:"Energy Summary",currentPower:"Current Power",plugsOnline:"{{reachable}}/{{total}} plugs online",today:"Today",yesterday:"Yesterday",total:"Total",enablePlugsForSummary:"Enable plugs to see energy summary",addNotificationProvider:"Add",systemBadge:"(System)",creating:"Creating...",changing:"Changing...",deleteUserAndItems:"Delete user AND their items",deleteUserKeepItems:"Delete user, keep items (become ownerless)",ok:"OK"},notification:{printStarted:{title:"Print Started",body:"{{printer}}: {{filename}} has started printing"},printCompleted:{title:"Print Completed",body:"{{printer}}: {{filename}} completed successfully"},printFailed:{title:"Print Failed",body:"{{printer}}: {{filename}} has failed"},printStopped:{title:"Print Stopped",body:"{{printer}}: {{filename}} was stopped"},printProgress:{title:"Print Progress",body:"{{printer}}: {{filename}} is {{percent}}% complete"},printerOffline:{title:"Printer Offline",body:"{{printer}} is offline"},printerError:{title:"Printer Error",body:"{{printer}}: {{error}}"},filamentLow:{title:"Low Filament",body:"{{printer}}: Filament is running low"},maintenanceDue:{title:"Maintenance Due",body:"{{printer}}: {{items}} need attention"}},errors:{generic:"Something went wrong",networkError:"Network error. Please check your connection.",notFound:"Not found",unauthorized:"Unauthorized",serverError:"Server error",validationError:"Please check your input",printerConnectionFailed:"Failed to connect to printer",saveFailed:"Failed to save changes",deleteFailed:"Failed to delete",loadFailed:"Failed to load data"},hmsErrors:{title:"Errors - {{name}}",noErrors:"No errors",viewOnWiki:"View on Bambu Lab Wiki",clearInstructions:"Clear errors on the printer to dismiss them here.",clearErrors:"Clear Errors",clearSuccess:"HMS errors cleared",clearFailed:"Failed to clear HMS errors"},mqttDebug:{title:"MQTT Debug Log",searchPlaceholder:"Search topic or payload...",noMessages:"No messages logged yet",startLoggingHint:'Click "Start Logging" to begin capturing MQTT messages',noMessagesMatch:"No messages match your filter",adjustFilterHint:"Try adjusting your search or filter criteria",incoming:"Incoming",outgoing:"Outgoing",loggingStopped:"Logging stopped",loggingActive:"Logging active - messages will auto-refresh",startLogging:"Start Logging",stopLogging:"Stop Logging",clearLog:"Clear Log",topic:"Topic",timestamp:"Timestamp",direction:"Direction",all:"All"},printerFiles:{title:"File Manager",storageUsed:"Used:",storageFree:"Free:",filterPlaceholder:"Filter files...",deleteButton:"Delete",deleteFiles:"Delete {{count}} Files",deleteFileConfirm:'Delete "{{name}}"? This cannot be undone.',deleteFilesConfirm:"Delete {{count}} selected files? This cannot be undone.",noFiles:"No files on printer",loadingFiles:"Loading files...",failedToLoad:"Failed to load files",toast:{filesDeleted:"Deleted {{count}} file(s)",deleteFailed:"Delete failed: {{error}}"}},confirm:{delete:"Are you sure you want to delete this?",unsavedChanges:"You have unsaved changes. Are you sure you want to leave?",clearQueue:"Are you sure you want to clear the queue?"},login:{title:"Bambuddy Login",subtitle:"Sign in to your account",username:"Username",usernamePlaceholder:"Enter your username",usernameOrEmail:"Username or Email",usernameOrEmailPlaceholder:"Username or @ Email",password:"Password",passwordPlaceholder:"Enter your password",signIn:"Sign in",signingIn:"Logging in...",forgotPassword:"Forgot your password?",loginSuccess:"Logged in successfully",loginFailed:"Login failed",enterCredentials:"Please enter username and password",forgotPasswordTitle:"Forgot Password",forgotPasswordMessage:"If you've forgotten your password, please contact your system administrator to reset it.",forgotPasswordEmailMessage:"Enter your email address and we'll send you a new password.",emailAddress:"Email Address",emailPlaceholder:"your.email@example.com",cancel:"Cancel",sending:"Sending...",sendResetEmail:"Send Reset Email",howToReset:"How to reset your password:",resetStep1:"Contact your Bambuddy administrator",resetStep2:"Ask them to reset your password in User Management",resetStep3:"They can set a new temporary password for you",resetStep4:"Log in with the new password and change it in Settings",gotIt:"Got it"},setup:{title:"Bambuddy Setup",subtitle:"Configure authentication for your Bambuddy instance",enableAuth:"Enable Authentication",adminAccount:"Admin Account",adminAccountDesc:"If admin users already exist, authentication will be enabled using the existing admin accounts. Leave the fields below empty to use existing admins, or enter new credentials to create a new admin user.",adminUsername:"Admin Username",adminPassword:"Admin Password",optionalIfAdminExists:"(optional if admin users exist)",adminUsernamePlaceholder:"Enter admin username (optional)",adminPasswordPlaceholder:"Enter admin password (optional)",confirmPassword:"Confirm Password",confirmPasswordPlaceholder:"Confirm admin password",settingUp:"Setting up...",completeSetup:"Complete Setup",toast:{authEnabledAdminCreated:"Authentication enabled and admin user created",authEnabledExistingAdmins:"Authentication enabled using existing admin users",setupCompleted:"Setup completed",enterBothCredentials:"Please enter both admin username and password, or leave both empty to use existing admin users",passwordsDoNotMatch:"Passwords do not match",passwordTooShort:"Password must be at least 6 characters"}},changePassword:{title:"Change Password",currentPassword:"Current Password",currentPasswordPlaceholder:"Enter current password",newPassword:"New Password",newPasswordPlaceholder:"Enter new password (min 6 characters)",confirmPassword:"Confirm New Password",confirmPasswordPlaceholder:"Confirm new password",passwordsDoNotMatch:"Passwords do not match",passwordTooShort:"Password must be at least 6 characters",changing:"Changing...",success:"Password changed successfully",failed:"Failed to change password"},plateAlert:{title:"Print Paused!",message:"Objects detected on build plate. The print has been automatically paused. Please clear the plate and resume the print.",understand:"I Understand"},camera:{title:"Camera View",invalidPrinterId:"Invalid printer ID",live:"Live",snapshot:"Snapshot",restartStream:"Restart stream",refreshSnapshot:"Refresh snapshot",fullscreen:"Fullscreen",exitFullscreen:"Exit fullscreen",connectingToCamera:"Connecting to camera...",capturingSnapshot:"Capturing snapshot...",connectionLost:"Connection lost",connectionFailed:"Camera connection failed",reconnecting:"Reconnecting in {{countdown}}s... (attempt {{attempt}}/{{max}})",reconnectNow:"Reconnect now",cameraUnavailable:"Camera unavailable",cameraUnavailableDesc:"Make sure the printer is powered on and connected.",noCamera:"No camera available",retry:"Retry",cameraStream:"Camera stream",zoomOut:"Zoom out",zoomIn:"Zoom in",resetZoom:"Reset zoom",recording:"Recording",startRecording:"Start Recording",stopRecording:"Stop Recording",chamberLight:"Toggle chamber light"},groups:{title:"Group Management",subtitle:"Manage permission groups for access control",backToSettings:"Back to Settings",createGroup:"Create Group",noPermission:"You do not have permission to access this page.",system:"System",noDescription:"No description",usersCount:"{{count}} users",permissionsCount:"{{count}} permissions",edit:"Edit",delete:"Delete",toast:{created:"Group created successfully",updated:"Group updated successfully",deleted:"Group deleted successfully",enterGroupName:"Please enter a group name"},modal:{editGroup:"Edit Group",createGroup:"Create Group",cancel:"Cancel",saving:"Saving...",creating:"Creating...",saveChanges:"Save Changes"},form:{groupName:"Group Name",groupNamePlaceholder:"Enter group name",systemGroupWarning:"System group names cannot be changed",description:"Description",descriptionPlaceholder:"Enter description (optional)",permissions:"Permissions ({{count}} selected)"},deleteModal:{title:"Delete Group",message:"Are you sure you want to delete this group? Users in this group will lose these permissions.",confirm:"Delete Group"},editor:{title:"Edit Group",createTitle:"Create Group",search:"Search permissions...",selectAll:"Select All",clearAll:"Clear All",permissionsSelected:"{{count}} selected",noResults:"No permissions match your search"}},users:{title:"User Management",subtitle:"Manage users and their access to your Bambuddy instance",backToSettings:"Back to Settings",createUser:"Create User",noPermission:"You do not have permission to access this page.",admin:"Admin",noGroups:"No groups",active:"Active",inactive:"Inactive",edit:"Edit",delete:"Delete",system:"System",noGroupsAvailable:"No groups available",table:{username:"Username",groups:"Groups",status:"Status",actions:"Actions"},toast:{created:"User created successfully",updated:"User updated successfully",deleted:"User deleted successfully",fillRequired:"Please fill in all required fields",passwordsDoNotMatch:"Passwords do not match",passwordTooShort:"Password must be at least 6 characters"},modal:{createUser:"Create User",editUser:"Edit User",cancel:"Cancel",creating:"Creating...",saving:"Saving...",saveChanges:"Save Changes",advancedAuthSubtitle:"with Advanced Authentication"},form:{username:"Username",usernamePlaceholder:"Enter username",email:"Email",emailPlaceholder:"user@example.com",password:"Password",passwordPlaceholder:"Enter password",confirmPassword:"Confirm Password",confirmPasswordPlaceholder:"Confirm password",newPasswordPlaceholder:"Enter new password",confirmNewPasswordPlaceholder:"Confirm new password",leaveBlankToKeep:"leave blank to keep current",groups:"Groups",optional:"optional",autoGeneratedPassword:"A secure password will be automatically generated and emailed to the user.",passwordManagedByAdvancedAuth:'Password is managed by Advanced Authentication. Use "Reset Password" to send a new password to the user via email.',resetPassword:"Reset Password",resettingPassword:"Resetting Password..."},deleteModal:{title:"Delete User",message:"Are you sure you want to delete this user? This action cannot be undone.",confirm:"Delete User"}},streamOverlay:{title:"Stream Overlay",invalidPrinterId:"Invalid printer ID",cameraStream:"Camera stream",progress:"Progress",eta:"ETA",printerIdle:"Printer is idle",printerOffline:"Printer offline",status:{printing:"Printing",paused:"Paused",finished:"Finished",failed:"Failed",idle:"Idle",unknown:"Unknown"}},profiles:{title:"Profiles",subtitle:"Manage your slicer presets and pressure advance calibrations",tabs:{cloud:"Cloud Profiles",local:"Local Profiles",kprofiles:"K-Profiles"},localProfiles:{title:"Local Profiles",subtitle:"Import and manage slicer presets from OrcaSlicer",import:"Import Profiles",importDesc:"Drop .bbscfg, .bbsflmt, .orca_filament, .zip, or .json files here",importing:"Importing...",search:"Search local presets...",noPresets:"No local presets yet",badge:"Local",edit:"Edit",delete:"Delete",cancel:"Cancel",deleteConfirmTitle:"Delete Preset",deleteConfirm:"Are you sure you want to delete this preset? This cannot be undone.",source:"Source",inheritsFrom:"Inherits",filamentType:"Type",vendor:"Vendor",compatiblePrinters:"Printers",nozzleTemp:"Nozzle Temp",cost:"Cost",density:"Density",pressureAdvance:"Pressure Advance",filament:"Filament",process:"Process",printer:"Printer",toast:{importSuccess:"{{count}} preset(s) imported",importSkipped:"{{count}} preset(s) skipped (duplicates)",importError:"{{count}} error(s) during import",deleted:"Preset deleted",updated:"Preset updated"}},connectedAs:"Connected as",logout:"Logout",noLogoutPermission:"You do not have permission to logout",failedToLoad:"Failed to load profiles",retry:"Retry",time:{justNow:"Just now",minsAgo:"{{count}}m ago",hoursAgo:"{{count}}h ago",daysAgo:"{{count}}d ago"},toast:{loggedOut:"Logged out"},login:{title:"Connect to Bambu Cloud",subtitle:"Sync your slicer presets across devices",email:"Email",password:"Password",region:"Region",regionGlobal:"Global",regionChina:"China",verificationCode:"Verification Code",totpCode:"Authenticator Code",checkEmail:"Check your email ({{email}}) for a 6-digit code",enterTotpHint:"Enter the 6-digit code from your authenticator app",accessToken:"Access Token",accessTokenHint:"Paste your Bambu Lab access token (from Bambu Studio)",back:"Back",loginButton:"Login",verifyButton:"Verify",setTokenButton:"Set Token",useToken:"Use access token instead",useEmail:"Login with email instead",toast:{loggedIn:"Logged in successfully",codeSent:"Verification code sent to your email",enterTotp:"Enter code from your authenticator app",tokenSet:"Token set successfully"}},presets:{myPreset:"My preset (editable)",duplicate:"Duplicate",editable:"Editable",failedToLoadDetails:"Failed to load preset details",deleteConfirm:"Delete this preset?",deleteWarning:'This will permanently delete "{{name}}" from Bambu Cloud. This cannot be undone.',noDuplicatePermission:"You do not have permission to duplicate presets",noEditPermission:"You do not have permission to edit presets",noDeletePermission:"You do not have permission to delete presets",types:{filament:"Filament preset",printer:"Printer preset",process:"Process preset"},toast:{deleted:"Preset deleted",created:"Preset created",updated:"Preset updated",duplicated:"Preset duplicated",fieldAdded:'Field "{{key}}" added',exported:"Preset exported"},baseLabel:"Base: {{name}}",currentLabel:"Current: {{name}}",newPreset:"New Preset",editPreset:"Edit Preset",duplicatePreset:"Duplicate Preset",createNewPreset:"Create New Preset",customizeSettings:"Customize settings for your new preset",compareWithBase:"Compare with base preset",compare:"Compare",basePreset:"Base Preset",selectBasePreset:"Select base preset...",presetName:"Preset Name",myCustomPreset:"My custom preset",inheritsFrom:"Inherits from",dropJsonToImport:"Drop JSON to import",tabs:{common:"Common",allFields:"All Fields"},availableFields:"Available Fields",searchFieldsPlaceholder:"Search fields...",noMatchingFields:"No matching fields",allFieldsAdded:"All fields added",addCustomField:"Add custom field",yourOverrides:"Your Overrides",noOverridesYet:"No overrides yet",clickFieldsToAdd:"Click fields on the left to add them",saveAsTemplate:"Save as template",jsonTip:"Tip: Drag & drop a .json file anywhere on this modal to import settings"},cloudView:{searchPlaceholder:"Search presets...",templates:"Templates",refresh:"Refresh",newPreset:"New Preset",clearFilters:"Clear filters",compareMode:"Compare Mode",selectAnotherPreset:"Select another {{type}} preset",clickTwoPresets:"Click two presets of the same type to compare",selectFirst:"1. Select first",selectSecond:"2. Select second",compareNow:"Compare Now",lastSynced:"Last synced:",showingCount:"Showing {{showing}} of {{total}} presets",noPresetsFound:"No presets found",columns:{filament:"Filament",process:"Process",printer:"Printer"},noFilamentPresets:"No filament presets",noProcessPresets:"No process presets",noPrinterPresets:"No printer presets",filters:{type:"Type",owner:"Owner",printer:"Printer",nozzle:"Nozzle",filament:"Filament",layer:"Layer",all:"All",myPresets:"My Presets",builtIn:"Built-in",process:"Process"},noTemplatesPermission:"You do not have permission to manage templates",noRefreshPermission:"You do not have permission to refresh profiles",noCreatePermission:"You do not have permission to create presets"},templates:{title:"Quick Templates",noTemplates:"No templates yet",createFirst:"Create templates from the preset editor",typeFilter:"Type:",deleteTitle:"Delete Template",deleteWarning:"This action cannot be undone",deleteConfirm:'Are you sure you want to delete "{{name}}"?',namePlaceholder:"Template name",descriptionPlaceholder:"Description",settingsJson:"Settings (JSON)",fieldsCount:"{{count}} fields",shownInModals:"Shown in modals",hiddenInModals:"Hidden in modals",apply:"Apply",toast:{deleted:"Template deleted",updated:"Template updated",created:"Template created",applied:"Template applied"}}},support:{debugLoggingActive:"Debug logging is active",manageLogs:"Manage",collectItem7:"Printer connectivity and firmware versions",collectItem8:"Integration status (Spoolman, MQTT, HA)",collectItem9:"Network interfaces (subnets only)",collectItem10:"Python package versions",collectItem11:"Database health checks",collectItem12:"Docker environment details"},fileManager:{title:"File Manager",subtitle:"Organize and manage your print files",uploadFiles:"Upload Files",newFolder:"New Folder",folderName:"Folder Name",folderNamePlaceholder:"e.g., Functional Parts",renameFile:"Rename File",renameFolder:"Rename Folder",moveFiles:"Move {{count}} File(s)",rootNoFolder:"Root (No Folder)",current:"current",linkFolder:"Link Folder",linkFolderDescription:'Link "{{name}}" to a project or archive for quick access.',project:"Project",archive:"Archive",noProjectsFound:"No projects found",noArchivesFound:"No archives found",unlink:"Unlink",link:"Link",dragDropFiles:"Drag & drop files here",dropFilesHere:"Drop files here",orClickToBrowse:"or click to browse",allFileTypesSupported:"All file types supported. ZIP files will be extracted.",zipFilesDetected:"ZIP files detected",zipExtractOptions:"ZIP files will be extracted. Choose how to handle folder structure:",preserveZipStructure:"Preserve folder structure from ZIP",createFolderFromZip:"Create folder from ZIP filename",stlThumbnailGeneration:"STL thumbnail generation",zipMayContainStl:"ZIP files may contain STL files. Thumbnails can be generated during extraction.",thumbnailsCanBeGenerated:"Thumbnails can be generated for STL files. Large models may take longer to process.",generateThumbnailsForStl:"Generate thumbnails for STL files",threemfDetected:"3MF files detected",threemfExtractionInfo:"Printer model, material, color, and print settings will be automatically extracted from 3MF files.",willBeExtracted:"Will be extracted",filesExtracted:"{{count}} files extracted",uploadComplete:"Upload complete: {{succeeded}} succeeded",uploadFailed:"Upload failed",zipFilesFailed:"{{count}} files failed",uploading:"Uploading...",changeLink:"Change Link...",linkTo:"Link to...",linkToProjectOrArchive:"Link to project or archive",addToQueue:"Add to Queue",schedulePrint:"Schedule",generateThumbnail:"Generate Thumbnail",generateThumbnails:"Generate Thumbnails",generateThumbnailsForMissing:"Generate thumbnails for STL files missing them",gridView:"Grid view",listView:"List view",lowDiskSpaceWarning:"Low disk space warning",lowDiskSpaceDetails:"Only {{free}} free of {{total}} total. Threshold is set to {{threshold}} GB in settings.",files:"Files",folders:"Folders",size:"Size",free:"Free",allFiles:"All Files",wrap:"Wrap",enableTextWrapping:"Enable text wrapping",disableTextWrapping:"Disable text wrapping",dragToResizeTooltip:"Drag to resize, double-click to reset",searchFiles:"Search files...",allTypes:"All types",prints:"Prints",ascending:"Ascending",descending:"Descending",resultsCount:"{{showing}} of {{total}} files",selectAll:"Select All",deselectAll:"Deselect All",selected:"{{count}} selected",adding:"Adding...",loadingFiles:"Loading files...",folderIsEmpty:"Folder is empty",noFilesYet:"No files yet",folderEmptyDescription:"Upload files or move files into this folder to get started.",noFilesDescription:"Upload files to start organizing your print-related files.",noMatchingFiles:"No matching files",noMatchingFilesDescription:"No files match your current search or filter criteria.",clearFilters:"Clear filters",printedCount:"Printed {{count}}x",uploadedBy:"Uploaded By",deleteFolder:"Delete Folder",deleteFile:"Delete File",deleteFilesCount:"Delete {{count}} Files",deleteFolderConfirm:"Are you sure you want to delete this folder? All files inside will also be deleted.",deleteFileConfirm:"Are you sure you want to delete this file?",deleteFilesConfirm:"Are you sure you want to delete {{count}} selected files? This action cannot be undone.",deleting:"Deleting...",noPermissionRenameFolder:"You do not have permission to rename folders",noPermissionLinkFolder:"You do not have permission to link folders",noPermissionDeleteFolder:"You do not have permission to delete folders",noPermissionPrint:"You do not have permission to print",noPermissionAddToQueue:"You do not have permission to add to queue",noPermissionDownload:"You do not have permission to download files",noPermissionRenameFile:"You do not have permission to rename this file",noPermissionGenerateThumbnail:"You do not have permission to generate thumbnails",noPermissionDeleteFile:"You do not have permission to delete this file",noPermissionCreateFolder:"You do not have permission to create folders",noPermissionUpload:"You do not have permission to upload files",noPermissionMoveFiles:"You do not have permission to move files",noPermissionDeleteFiles:"You do not have permission to delete files",toast:{folderCreated:"Folder created",folderDeleted:"Folder deleted",fileDeleted:"File deleted",filesDeleted:"Deleted {{count}} files",filesMoved:"Files moved",folderLinked:"Folder linked",folderUnlinked:"Folder unlinked",addedToQueue:"Added {{count}} file(s) to queue",addedToQueuePartial:"Added {{added}} file(s), {{failed}} failed",failedToAddToQueue:"Failed to add files: {{error}}",fileRenamed:"File renamed",folderRenamed:"Folder renamed",thumbnailsGenerated:"Generated {{count}} thumbnail(s)",thumbnailsGeneratedPartial:"Generated {{succeeded}} thumbnail(s), {{failed}} failed",noStlMissingThumbnails:"No STL files missing thumbnails",failedToGenerateThumbnails:"Failed to generate thumbnails: {{error}}",thumbnailGenerated:"Thumbnail generated",failedToGenerateThumbnail:"Failed to generate thumbnail: {{error}}"}},projects:{title:"Projects",subtitle:"Organize and track your 3D printing projects",newProject:"New Project",editProject:"Edit Project",deleteProject:"Delete Project",projectName:"Project Name",description:"Description",noProjects:"No projects yet",noProjectsFiltered:"No {{status}} projects",noProjectsFilteredHelp:"You don't have any {{status}} projects. Projects will appear here when their status changes.",createFirst:"Create your first project to start organizing related prints, tracking progress, and managing your builds.",createFirstButton:"Create Your First Project",create:"Create",files:"Files",prints:"Prints",plates:"plates",parts:"parts",lastModified:"Last Modified",deleteConfirm:"Are you sure you want to delete this project? Archives and queue items will be unlinked but not deleted.",addFiles:"Add Files",removeFile:"Remove File",viewDetails:"View Details",namePlaceholder:"e.g., Voron 2.4 Build",descriptionPlaceholder:"Optional description...",color:"Color",targetPlates:"Target Plates",targetPlatesPlaceholder:"e.g., 25",targetPlatesHelp:"Number of print jobs",targetParts:"Target Parts",targetPartsPlaceholder:"e.g., 150",targetPartsHelp:"Total objects needed",tagsLabel:"Tags (comma-separated)",tagsPlaceholder:"e.g., voron, functional, gift",dueDate:"Due Date",priority:"Priority",priorityLow:"Low",priorityNormal:"Normal",priorityHigh:"High",priorityUrgent:"Urgent",statusActive:"Active",statusCompleted:"Completed",statusArchived:"Archived",done:"Done",completed:"completed",failed:"failed",inQueue:"in queue",noPrintsYet:"No prints yet",printJobs:"Print jobs (plates)",partsPrinted:"Parts printed",failedParts:"Failed parts",import:"Import",export:"Export",importProject:"Import project",exportAll:"Export all projects",loading:"Loading projects...",noEditPermission:"You do not have permission to edit projects",noDeletePermission:"You do not have permission to delete projects",noCreatePermission:"You do not have permission to create projects",noImportPermission:"You do not have permission to import projects",noExportPermission:"You do not have permission to export projects",toast:{created:"Project created",updated:"Project updated",deleted:"Project deleted",imported:"Project imported",multipleImported:"{{count}} projects imported",importFailed:"Import failed",exported:"Projects exported (metadata only)"}},projectDetail:{notFound:"Project not found",backToProjects:"Back to Projects",export:"Export",exportProject:"Export project",noExportPermission:"You do not have permission to export projects",noEditPermission:"You do not have permission to edit projects",partOf:"Part of:",priorityLabel:"Priority:",noPrints:"No prints in this project yet",status:{active:"Active",completed:"Completed",archived:"Archived"},priority:{low:"Low",normal:"Normal",high:"High",urgent:"Urgent"},dueDate:{overdue:"Overdue",today:"Due today",daysLeft:"{{count}} days left"},progress:{platesProgress:"Plates Progress",partsProgress:"Parts Progress",printJobs:"print jobs",parts:"parts",percentComplete:"{{percent}}% complete",remaining:"{{count}} remaining"},stats:{printJobs:"Print Jobs",total:"total",failed:"{{count}} failed",partsPrinted:"{{count}} parts printed",printTime:"Print Time",filamentUsed:"Filament Used"},cost:{title:"Cost Tracking",filamentCost:"Filament Cost",energy:"Energy",budget:"Budget",remaining:"Remaining"},subProjects:{title:"Sub-projects ({{count}})"},notes:{title:"Notes",noEditPermission:"You do not have permission to edit notes",placeholder:"Add notes about this project...",empty:"No notes yet. Click Edit to add notes."},files:{title:"Files",linkFolders:"Link folders from the File Manager",forQuickAccess:"to this project for quick access.",fileCount:"{{count}} file(s)",empty:"No folders linked. Go to File Manager and link a folder to this project."},bom:{title:"Bill of Materials",acquired:"{{completed}}/{{total}} acquired",showAll:"Show all",hideDone:"Hide done",addPart:"Add Part",noAddPermission:"You do not have permission to add parts",partNamePlaceholder:"Part name (e.g., M3x8 screws)",partName:"Part name",qty:"Qty",price:"Price ({{currency}})",sourcingUrlPlaceholder:"Sourcing URL (optional)",remarksPlaceholder:"Remarks (optional)",deletePart:"Delete Part",deleteConfirm:'Are you sure you want to delete "{{name}}"?',noUpdatePermission:"You do not have permission to update parts",noEditPermission:"You do not have permission to edit parts",noDeletePermission:"You do not have permission to delete parts",totalCost:"Total cost:",empty:"No parts in the bill of materials. Add hardware, electronics, or other components to track what needs to be sourced."},timeline:{title:"Activity Timeline",empty:"No activity yet."},template:{saveAsTemplate:"Save as Template",noCreatePermission:"You do not have permission to create templates"},queue:{title:"Queue",viewAll:"View all",printing:"{{count}} printing",queued:"{{count}} queued"},prints:{title:"Prints ({{count}})"},toast:{projectUpdated:"Project updated",partAdded:"Part added",partRemoved:"Part removed",exportFailed:"Export failed",projectExported:"Project exported",templateCreated:"Template created"}},system:{title:"System Information",version:"Version",uptime:"Uptime",cpuUsage:"CPU Usage",memoryUsage:"Memory Usage",diskUsage:"Disk Usage",networkInfo:"Network Info",logs:"Logs",debugMode:"Debug Mode",enableDebug:"Enable Debug Logging",disableDebug:"Disable Debug Logging",downloadLogs:"Download Logs",clearLogs:"Clear Logs",dockerInfo:"Docker Info",containerName:"Container Name",imageName:"Image Name",platform:"Platform",architecture:"Architecture"},library:{title:"Filament Library",addFilament:"Add Filament",editFilament:"Edit Filament",deleteFilament:"Delete Filament",vendor:"Vendor",material:"Material",color:"Color",kFactor:"K Factor",temperature:"Temperature",noFilaments:"No filaments in library",deleteConfirm:"Are you sure you want to delete this filament?",importFromPrinter:"Import from Printer",exportToFile:"Export to File"},spoolman:{title:"Spoolman Integration",enabled:"Spoolman Enabled",url:"Spoolman URL",connected:"Connected",disconnected:"Not Connected",testConnection:"Test Connection",sync:"Sync",syncing:"Syncing...",lastSync:"Last Sync",linkToSpoolman:"Link to Spoolman",openInSpoolman:"Open in Spoolman",unlinkSpool:"Unlink Spool",unlinkConfirmTitle:"Unlink Spool?",unlinkConfirmMessage:"This will disconnect the spool from Spoolman. The spool data in Spoolman will remain unchanged.",selectSpool:"Select Spool",noUnlinkedSpools:"No unlinked spools available",linkSuccess:"Spool linked to Spoolman successfully",linkFailed:"Failed to link spool",unlinkSuccess:"Spool unlinked from Spoolman successfully",unlinkFailed:"Failed to unlink spool",spoolId:"Spool ID",fillSourceLabel:"(Spoolman)",weight:"Weight",remaining:"Remaining",disableWeightSync:"Disable AMS Estimated Weight Sync",disableWeightSyncDesc:"Don't update remaining capacity from AMS estimates. Use this if you prefer Spoolman's usage tracking over AMS percentage-based estimates. New spools will still use the AMS estimate as their initial weight.",reportPartialUsage:"Report Partial Usage for Failed Prints",reportPartialUsageDesc:"When a print fails or is cancelled, report the estimated filament used up to that point based on layer progress."},inventory:{title:"Spool Inventory",addSpool:"Add Spool",editSpool:"Edit Spool",material:"Material",selectMaterial:"Select material...",subtype:"Subtype",brand:"Brand",searchBrand:"Search brand...",useCustomBrand:'Use "{{brand}}"',useCustomMaterial:"Use custom material: {{material}}",colorName:"Color Name",colorNamePlaceholder:"Jade White, Fire Red...",color:"Color",hexColor:"Hex Color",pickColor:"Pick custom color",labelWeight:"Label Weight",coreWeight:"Empty Spool Weight",searchSpoolWeight:"Search spool weight...",weightUsed:"Used",currentWeight:"Remaining Weight",measuredWeight:"Measured Weight",costPerKg:"Cost per kg",measuredWeightError:"Measured weight must be between {{min}}g and {{max}}g.",slicerFilament:"Slicer Filament",slicerFilamentName:"Slicer Preset Name",slicerPreset:"Slicer Preset",searchPresets:"Search filament presets...",selectedPreset:"Selected",noPresetsFound:"No presets found",tempOverrides:"Temperature Overrides",note:"Note",notePlaceholder:"Any additional notes about this spool...",archive:"Archive",restore:"Restore",noSpools:"No spools yet. Add your first spool to get started.",noManualSpools:"No manually added spools available. Add a spool to your inventory first.",kProfiles:"K-Profiles",addKProfile:"Add K-Profile",assignSpool:"Assign Spool",unassignSpool:"Unassign",assignSuccess:"Spool assigned and AMS slot configured",assignFailed:"Failed to assign spool",selectSpool:"Select a spool to assign to this slot",assigned:"Assigned",assigning:"Assigning...",searchSpools:"Search spools...",allMaterials:"All Materials",filterByBrand:"Filter by brand...",showArchived:"Show archived",quickAdd:"Quick Add (Stock)",quantity:"Quantity",stock:"Stock",configured:"Configured",spoolsCreated:"{{count}} spools created",spoolCreated:"Spool created",spoolUpdated:"Spool updated",spoolDeleted:"Spool deleted",spoolArchived:"Spool archived",spoolRestored:"Spool restored",deleteConfirm:"Are you sure you want to delete this spool? This cannot be undone.",archiveConfirm:"Are you sure you want to archive this spool?",advancedSettings:"Advanced Settings",filamentInfoTab:"Filament Info",paProfileTab:"PA Profile",filamentInfo:"Filament",additional:"Additional",loadingPresets:"Loading cloud presets...",cloudConnected:"Cloud connected",cloudNotConnected:"Cloud not connected (using defaults)",recentColors:"Recent",searchColors:"Search colors...",searchResults:"Search results",allColors:"All colors",commonColors:"Common colors",showLess:"Show less",showAll:"Show all",noColorsFound:"No colors match your search",noResults:"No matches found",selectMaterialFirst:"Please select a material first in the Filament Info tab.",noPrintersConfigured:"No printers configured. Add printers to use PA profiles.",matchingFilter:"Matching",anyBrand:"Any brand",anyVariant:"Any variant",autoSelect:"Auto-select",matches:"matches",match:"match",noMatches:"No matches",connected:"Connected",offline:"Offline",printerOffline:"Printer is offline. Connect to view calibration profiles.",noKProfilesMatch:"No K-profiles match the selected filament.",leftNozzle:"Left Nozzle",rightNozzle:"Right Nozzle",profilesSelected:"calibration profile(s) selected",totalInventory:"Total Inventory",totalConsumed:"Total Consumed",byMaterial:"By Material",inPrinter:"In Printer",lowStock:"Low Stock",sinceTracking:"Since tracking started",loadedInAms:"Loaded in AMS/Ext",remaining:"Remaining",weightCheck:"Weight Check",lastWeighed:"Last weighed",neverWeighed:"Never weighed",search:"Search spools...",showing:"Showing",to:"to",of:"of",show:"Show",spools:"spools",spool:"spool",page:"Page",noSpoolsMatch:"No results found",noSpoolsMatchDesc:"Try adjusting your search or filters to find what you're looking for.",active:"Active",archived:"Archived",all:"All",used:"Used",new:"New",clearFilters:"Clear filters",table:"Table",cards:"Cards",net:"Net",groupSimilar:"Group",groupedSpools:"{{count}} identical spools",groupedRows:"rows",columns:"Columns",configureColumns:"Configure Columns",configureColumnsDesc:"Drag to reorder columns or use arrows. Toggle visibility with the eye icon.",visible:"visible",reset:"Reset",cancel:"Cancel",applyChanges:"Apply Changes",moveUp:"Move up",moveDown:"Move down",hideColumn:"Hide column",showColumn:"Show column",linkToSpool:"Link to Spool",tagLinked:"Tag linked to spool",tagLinkFailed:"Failed to link tag",tagAlreadyLinked:"Tag already linked to another spool",unknownTag:"Unknown RFID tag detected",usageHistory:"Usage History",noUsageHistory:"No usage recorded yet",printName:"Print Name",weightConsumed:"Weight Consumed",clearHistory:"Clear",historyCleared:"Usage history cleared",fillSourceLabel:"(Inv)",lowStockThresholdError:"Threshold must be between 0.1 and 99.9"},timelapse:{title:"Timelapse",create:"Create Timelapse",download:"Download",delete:"Delete",preview:"Preview",frameRate:"Frame Rate",quality:"Quality",processing:"Processing...",noTimelapses:"No timelapses available"},ams:{title:"AMS",slot:"Slot",empty:"Empty",emptySlot:"Empty slot",unknown:"Unknown",humidity:"Humidity",temperature:"Temperature",filamentType:"Filament Type",filamentColor:"Color",remaining:"Remaining",history:"AMS History",noHistory:"No history available",configureSlot:"Configure Slot",externalSpool:"External Spool",profile:"Profile",kFactor:"K Factor",fill:"Fill",configure:"Configure",used:"used",remainingUnit:"remaining"},printModal:{title:"Start Print",selectPrinter:"Select Printer",selectPlate:"Select Plate",filamentMapping:"Filament Mapping",totalCost:"Total cost:",slotRemainingShort:" - {{grams}}g left",printSettings:"Print Settings",bedLeveling:"Bed Leveling",flowCalibration:"Flow Calibration",vibrationCalibration:"Vibration Calibration",layerInspection:"First Layer Inspection",timelapse:"Timelapse",startPrint:"Start Print",addToQueue:"Add to Queue",cancel:"Cancel",noPrintersAvailable:"No printers available",printerBusy:"Printer is busy",printerOffline:"Printer is offline",sameTypeDifferentColor:"Same type, different color",filamentTypeNotLoaded:"Filament type not loaded",openCalendar:"Open calendar",leftNozzle:"L",rightNozzle:"R",leftNozzleTooltip:"Left nozzle",rightNozzleTooltip:"Right nozzle",filamentOverride:"Filament Override",filamentOverrideHint:"Optionally override filaments for model-based assignment. The scheduler will match against your selected filaments instead of the original 3MF values.",originalFilament:"Original",overrideWith:"Override with",resetToOriginal:"Reset to original",forceColorMatch:"Force color match"},backup:{title:"Backup & Restore",createBackup:"Create Backup",restoreBackup:"Restore Backup",restoreDescription:"Replace all data from a backup file",downloadBackup:"Download Backup",uploadBackup:"Upload Backup",lastBackup:"Last Backup",autoBackup:"Auto Backup",backupNow:"Backup Now",restoreWarning:"Warning: Restoring a backup will overwrite all current data.",includeArchives:"Include Archives",includeSettings:"Include Settings",includeProfiles:"Include Profiles",backupSuccess:"Backup created successfully",restoreSuccess:"Backup restored successfully",backupFailed:"Backup failed",restoreFailed:"Restore failed",restoreNote:"Virtual Printer will be stopped during restore",githubBackup:"GitHub Backup",enabled:"Enabled",cloudLoginRequired:"Bambu Cloud login required. Sign in under Profiles → Cloud Profiles to enable GitHub backup.",cloudLoginRequiredShort:"Cloud login required",githubDescription:"Automatically sync your profiles to a private GitHub repository for backup and version history.",repositoryUrl:"Repository URL",personalAccessToken:"Personal Access Token",tokenSaved:"(saved)",enterNewToken:"Enter new token to update",tokenHint:"Fine-grained token with Contents read/write permission",branch:"Branch",manualOnly:"Manual only",hourly:"Hourly",daily:"Daily",weekly:"Weekly",includeInBackup:"Include in backup",kProfiles:"K-Profiles",kProfilesDescription:"Pressure advance calibration from connected printers",noPrintersConnected:"No printers connected",printersConnected:"{{connected}}/{{total}} connected",cloudProfiles:"Cloud Profiles",cloudProfilesDescription:"Filament, printer, and process presets from Bambu Cloud",appSettings:"App Settings",appSettingsDescription:"Bambuddy configuration (complete database)",lastBackupAt:"Last backup:",noBackupsYet:"No backups yet",next:"Next:",startingBackup:"Starting backup...",test:"Test",enableBackup:"Enable Backup",testConnection:"Test Connection",enterRepoUrl:"Enter repository URL",enterRepoAndToken:"Enter repository URL and access token",repoRequired:"Repository URL is required",tokenRequired:"Access token is required",githubBackupEnabled:"GitHub backup enabled",tokenUpdated:"Token updated",settingsSaved:"Settings saved",failedToSave:"Failed to save: {{message}}",backupCompleteFiles:"Backup complete - {{count}} files updated",backupSkippedNoChanges:"Backup skipped - no changes",backupFailed2:"Backup failed: {{message}}",clearedLogs:"Cleared {{count}} logs",failedToClearLogs:"Failed to clear logs: {{message}}",history:"History",clear:"Clear",date:"Date",status:"Status",commit:"Commit",localBackup:"Local Backup",localBackupDescription:"Create a complete backup of your Bambuddy data including the database, archives, uploads, and all files.",downloadBackupLabel:"Download Backup",completeBackupZip:"Complete backup: database + all files (ZIP)",download:"Download",preparingBackup:"Preparing backup...",creatingArchive:"Creating backup archive... This may take a while for large archives.",downloadingFile:"Downloading backup file...",backupDownloaded:"Backup downloaded successfully",failedToCreateBackup:"Failed to create backup: {{message}}",restore:"Restore",restoreReplacesAll:"Restore replaces all data.",restoreReplacesAllDetail:"Your current database and files will be completely replaced. A restart is required after restore.",restoreConfirmTitle:"Restore Backup",restoreConfirmMessage:'Are you sure you want to restore from "{{filename}}"? This will completely replace your current database and all files. The application will need to be restarted after restore.',restoreConfirmButton:"Restore Backup",uploadingFile:"Uploading backup file...",backupRestoredRestart:"Backup restored. Please restart Bambuddy.",failedToRestore:"Failed to restore backup. Please check the file format.",reloadNow:"Reload Now",creatingBackup:"Creating Backup",restoringBackup:"Restoring Backup",preparing:"Preparing...",processing:"Processing...",doNotClosePage:"Please do not close this page or navigate away. This operation may take several minutes for large backups.",restoring:"Restoring...",restoreComplete:"Restore Complete",restoreFailed2:"Restore Failed",importSettings:"Import settings from a backup file",pleaseWaitRestoring:"Please wait while your data is being restored",selectBackupFile:"Click to select backup file (.json or .zip)",duplicateHandling:"How duplicate handling works:",matchPrinters:"Printers",matchPrintersBy:"matched by serial number",matchSmartPlugs:"Smart Plugs",matchSmartPlugsBy:"matched by IP address",matchNotificationProviders:"Notification Providers",matchNotificationProvidersBy:"matched by name",matchFilaments:"Filaments",matchFilamentsBy:"matched by name + type + brand",matchArchives:"Archives",matchArchivesBy:"matched by content hash (always skipped)",matchPendingUploads:"Pending Uploads",matchPendingUploadsBy:"matched by filename",matchSettingsTemplates:"Settings & Templates",matchSettingsTemplatesBy:"always overwritten",replaceExisting:"Replace existing data",keepExisting:"Keep existing data",overwriteDescription:"Overwrite items that already exist with backup data",keepDescription:"Only restore items that don't already exist",overwriteCaution:"Caution:",overwriteWarning:"Overwriting will replace your current configurations with data from the backup. Printer access codes are never overwritten for security.",cancel:"Cancel",processingBackup:"Processing backup file...",itemsRestored:"Items Restored",itemsSkipped:"Items Skipped",restored:"Restored",skippedAlreadyExist:"Skipped (already exist)",filesCategory:"Files (3MF, thumbnails, etc.)",andMore:"...and {{count}} more",newApiKeysGenerated:"New API Keys Generated",keysShownOnce:"These keys are only shown once. Copy them now!",copy:"Copy",noDataFound:"No data was found to restore in the backup file.",close:"Close",categories:{settings:"Settings",notification_providers:"Notification Providers",notification_templates:"Notification Templates",smart_plugs:"Smart Plugs",printers:"Printers",filaments:"Filaments",maintenance_types:"Maintenance Types",archives:"Archives",projects:"Projects",pending_uploads:"Pending Uploads",external_links:"External Links",api_keys:"API Keys"}},tags:{title:"Tags",addTag:"Add Tag",editTag:"Edit Tag",deleteTag:"Delete Tag",tagName:"Tag Name",tagColor:"Tag Color",noTags:"No tags",deleteConfirm:"Are you sure you want to delete this tag?",manageTags:"Manage Tags"},uploadModal:{title:"Upload 3MF Files",dragDrop:"Drag & drop .3mf files here",or:"or",browseFiles:"Browse Files",extractionInfo:"The printer model will be automatically extracted from the 3MF file metadata.",uploaded:"uploaded",failed:"failed",uploading:"Uploading...",upload:"Upload",uploadFailed:"Upload failed"},editArchive:{title:"Edit Archive",name:"Name",namePlaceholder:"Print name",printer:"Printer",noPrinter:"No printer",project:"Project",noProject:"No project",itemsPrinted:"Items Printed",itemsPrintedHelp:"Number of items produced in this print job",notes:"Notes",notesPlaceholder:"Add notes about this print...",externalLink:"External Link",externalLinkPlaceholder:"https://printables.com/model/...",externalLinkHelp:"Link to Printables, Thingiverse, or other source",tags:"Tags",tagsPlaceholder:"Add tags...",addMoreTags:"Add more tags...",matchingTags:'Matching "{{query}}"',existingTags:"Existing tags",clickToAdd:"(click to add)",status:"Status",failureReason:"Failure Reason",selectReason:"Select reason...",photos:"Photos of Printed Result",photosHelp:"Click + to add photos of your printed result",printResult:"Print result",saving:"Saving...",failureReasons:{adhesionFailure:"Adhesion failure",spaghettiDetached:"Spaghetti / Detached",layerShift:"Layer shift",cloggedNozzle:"Clogged nozzle",filamentRunout:"Filament runout",warping:"Warping",stringing:"Stringing",underExtrusion:"Under-extrusion",powerFailure:"Power failure",userCancelled:"User cancelled",other:"Other"},statuses:{completed:"Completed",failed:"Failed",aborted:"Cancelled",printing:"Printing"}},kProfiles:{title:"K-Profiles",noPrintersConfigured:"No Printers Configured",addPrinterInSettings:"Add a printer in Settings to manage K-profiles",noActivePrinters:"No Active Printers",enablePrinterConnection:"Enable a printer connection to view its K-profiles",loadingProfiles:"Loading K-Profiles...",printerOffline:"Printer Offline",printerOfflineDesc:"The selected printer is not connected. Power it on to view K-profiles.",noMatchingProfiles:"No Matching Profiles",noMatchingProfilesDesc:"No profiles match your search criteria",noKProfiles:"No K-Profiles",noKProfilesDesc:"No pressure advance profiles found for {{diameter}}mm nozzle",createFirstProfile:"Create First Profile",printer:"Printer",nozzle:"Nozzle",refresh:"Refresh",addProfile:"Add Profile",export:"Export",import:"Import",select:"Select",selectAll:"Select All",delete:"Delete",searchPlaceholder:"Search by name or filament...",allExtruders:"All Extruders",leftOnly:"Left Only",rightOnly:"Right Only",allFlow:"All Flow",hfOnly:"HF Only",sOnly:"S Only",sortName:"Sort: Name",sortKValue:"Sort: K-Value",sortFilament:"Sort: Filament",leftExtruder:"Left Extruder",rightExtruder:"Right Extruder",modal:{addTitle:"Add K-Profile",editTitle:"Edit K-Profile",profileName:"Profile Name",profileNamePlaceholder:"My PLA Profile",kValue:"K-Value",kValuePlaceholder:"0.020",kValueHelp:"Typical range: 0.01 - 0.06 for PLA, 0.02 - 0.10 for PETG",filament:"Filament",selectFilament:"Select filament...",noFilamentsHelp:"No filaments found. Create a K-profile in Bambu Studio first.",flowType:"Flow Type",highFlow:"High Flow",standard:"Standard",nozzleSize:"Nozzle Size",extruder:"Extruder",extruders:"Extruders",left:"Left",right:"Right",notes:"Notes (stored locally)",notesPlaceholder:"Add notes about this profile...",notesHelp:"Notes are saved in Bambuddy, not on the printer",syncing:"Syncing with printer...",savingExtruder:"Saving to extruder {{current}}/{{total}}...",pleaseWait:"Please wait"},deleteConfirm:{title:"Delete Profile",cannotUndo:"This cannot be undone",message:'Are you sure you want to delete "{{name}}" from the printer?'},bulkDelete:{title:"Delete Profiles",cannotUndo:"This cannot be undone",message:"Are you sure you want to delete {{count}} selected profiles from the printer?"},toast:{profileSaved:"K-profile saved",profilesSaved:"K-profile saved to {{count}} extruders",selectAtLeastOneExtruder:"Please select at least one extruder",profileDeleted:"K-profile deleted",profilesDeleted:"Deleted {{count}} profiles",exportedProfiles:"Exported {{count}} profiles",importedProfiles:"Imported {{count}} of {{total}} profiles",noProfilesToExport:"No profiles to export",invalidFileFormat:"Invalid file format",failedToParseImport:"Failed to parse import file",failedToSaveBatch:"Failed to save K-profiles",noteSaved:"Note saved",failedToSaveNote:"Failed to save note"},permission:{noRead:"You do not have permission to refresh profiles",noCreate:"You do not have permission to add profiles",noUpdate:"You do not have permission to update K-profiles",noDelete:"You do not have permission to delete K-profiles",noExport:"You do not have permission to export profiles",noImport:"You do not have permission to import profiles"}},virtualPrinter:{title:"Virtual Printer",running:"Running",stopped:"Stopped",description:{default:"Enable a virtual printer that appears in Bambu Studio and OrcaSlicer. Files sent to this printer will be archived directly without printing.",proxy:"Enable a proxy that relays slicer traffic to a real printer, allowing remote printing over any network."},enable:{title:"Enable Virtual Printer",visibleInSlicer:'Visible as "Bambuddy" in slicer discovery',proxyingTo:"Proxying to {{name}}",notActive:"Not active"},model:{title:"Printer Model",description:"Select which printer model to emulate.",restartWarning:"Changing the model will restart the virtual printer"},accessCode:{title:"Access Code",isSet:"Access code is set",notSet:"No access code set - required to enable",placeholder:"Enter 8-char code",placeholderChange:"Enter new code to change",hint:"Must be exactly 8 characters. Used by slicers to authenticate.",charCount:"({{count}}/8)"},targetPrinter:{title:"Target Printer",configured:"Proxy target configured",notConfigured:"No target printer selected - required for proxy mode",placeholder:"Select a printer...",hint:"Select the printer to proxy slicer traffic to. The printer must be in LAN mode.",noPrinters:"No printers configured. Add a printer first to use proxy mode."},remoteInterface:{title:"Network Interface Override",configured:"Interface override active",optional:"Optional - use if auto-detected IP is wrong (e.g. multiple NICs, Docker, VPN)",placeholder:"Auto-detect (default)...",hint:"Override the IP address advertised via SSDP and used in the TLS certificate. Useful when Bambuddy has multiple network interfaces."},mode:{title:"Mode",archive:"Archive",archiveDesc:"Archive files immediately",review:"Review",reviewDesc:"Review before archiving",queue:"Queue",queueDesc:"Archive and add to queue",proxy:"Proxy",proxyDesc:"Relay to real printer"},autoDispatch:{title:"Auto-dispatch",description:"Automatically start prints when added to queue. When off, prints wait for manual dispatch."},setupRequired:{title:"Setup Required",description:"The virtual printer feature requires additional system configuration before it will work. This includes port forwarding, firewall rules, and platform-specific settings.",readGuide:"Read the setup guide before enabling"},howItWorks:{title:"How it works",step1:"On the same LAN, virtual printers appear in your slicer (Bambu Studio / OrcaSlicer) automatically via discovery. From other networks, add them manually by IP address and access code.",step2:'In Archive, Review, and Queue modes, use the "Send" button in your slicer to upload 3MF files to Bambuddy. The slicer will show "Print success" — the file is stored, not printed.',step3:"In Proxy mode, the virtual printer relays all traffic to a real printer — prints start immediately as if connected directly."},status:{title:"Status Details",printerName:"Printer Name",model:"Model",serialNumber:"Serial Number",mode:"Mode",pendingFiles:"Pending Files",targetPrinter:"Target Printer",ftpPort:"FTP Port",mqttPort:"MQTT Port",ftpConnections:"FTP Connections",mqttConnections:"MQTT Connections"},toast:{updated:"Virtual printer settings updated",failedToUpdate:"Failed to update settings",accessCodeRequired:"Please set an access code first",targetPrinterRequired:"Please select a target printer first",bindIpRequired:"Please set a bind IP first",accessCodeEmpty:"Access code cannot be empty",accessCodeLength:"Access code must be exactly 8 characters",created:"Virtual printer created",failedToCreate:"Failed to create virtual printer",deleted:"Virtual printer deleted",failedToDelete:"Failed to delete virtual printer"},list:{title:"Virtual Printers",add:"Add",addFirst:"Add Virtual Printer",empty:"No virtual printers configured. Add one to get started."},bindIp:{title:"Bind Interface",placeholder:"Select interface...",hint:"Network interface for this virtual printer to bind to. Must be unique per printer."},proxy:{accessCodeHint:"In proxy mode, use your target printer's access code in the slicer. The connection is forwarded transparently to the real printer."},addDialog:{title:"Add Virtual Printer",name:"Name",hint:"You can configure access code, target printer, and other settings after creating.",create:"Create"},deleteConfirm:{title:"Delete Virtual Printer",message:'Are you sure you want to delete "{{name}}"? This will stop all services for this printer.'}},modelViewer:{openInSlicer:"Open in Slicer",tabs:{model:"3D Model",gcode:"G-code Preview"},notAvailable:"not available",notSliced:"not sliced",plates:"Plates",allPlates:"All Plates",plateNumber:"Plate {{number}}",plateCount:"{{count}} plate",plateCount_other:"{{count}} plates",objectCount:"{{count}} object",objectCount_other:"{{count}} objects",filamentCount:"{{count}} filament",filamentCount_other:"{{count}} filaments",eta:"ETA {{minutes}} min",noPreview:"No preview available for this file",pagination:{pageOf:"Page {{current}} of {{total}}",prev:"Prev",next:"Next"},errors:{failedToLoad:"Failed to load file",noMeshes:"No meshes found in 3MF file",unsupportedFormat:"Unsupported file format"}},maintenanceDescriptions:{lubricateCarbonRods:"Apply lubricant to carbon rods for smooth motion",lubricateRails:"Apply lubricant to linear rails for smooth motion",cleanNozzle:"Clean hotend and nozzle to prevent clogs",checkBelts:"Verify belt tension for accurate prints",cleanBuildPlate:"Clean build plate for better adhesion",checkExtruder:"Inspect extruder gears for wear",checkCooling:"Ensure cooling fans are working properly",generalInspection:"General printer inspection",cleanCarbonRods:"Clean carbon rods to reduce friction",lubricateSteelRods:"Apply lubricant to steel rods for smooth motion",cleanSteelRods:"Clean steel rods to reduce friction",cleanLinearRails:"Wipe linear rails to remove dust and debris",checkPtfeTube:"Inspect PTFE tube for wear or damage",replaceHepaFilter:"Replace HEPA filter for air quality",replaceCarbonFilter:"Replace activated carbon filter",lubricateLeftNozzleRail:"Lubricate left nozzle rail (H2 series)"},smartPlugs:{offline:"Offline",admin:"Admin",openPlugAdminPage:"Open plug admin page",deleteSmartPlug:"Delete Smart Plug",turnOnSmartPlug:"Turn On Smart Plug",turnOffSmartPlug:"Turn Off Smart Plug",turnOn:"Turn On",turnOff:"Turn Off",addSmartPlug:{scanningNetwork:"Scanning network...",chooseEntity:"Choose an entity...",connectionFailed:"Connection failed",searchEntities:"Search entities...",searchPowerSensors:"Search power sensors...",searchEnergySensors:"Search energy sensors...",placeholders:{plugName:"Living Room Plug",mqttStateOnValue:"ON, true, 1",mqttSameAsPower:"Same as power topic, or different"}},linkedTo:"Linked to:",monitorOnly:"Monitor Only",alerts:"Alerts",scheduleOn:"On {{time}}",scheduleOff:"Off {{time}}",on:"On",off:"Off",power:"Power",kwhToday:"kWh Today",settings:"Settings",automationSettings:"Automation Settings",showInSwitchbar:"Show in Switchbar",quickAccessSidebar:"Quick access from sidebar",enabled:"Enabled",enableAutomation:"Enable automation for this plug",autoOn:"Auto On",autoOnDescription:"Turn on when print starts",autoOff:"Auto Off",autoOffDescription:"Turn off when print completes (one-shot)",turnOffDelayMode:"Turn Off Delay Mode",time:"Time",temp:"Temp",delayMinutes:"Delay (minutes)",tempThreshold:"Temperature threshold (°C)",tempThresholdDescription:"Turns off when nozzle cools below this temperature",edit:"Edit",deleteConfirm:'Are you sure you want to delete "{{name}}"? This cannot be undone.',turnOnConfirm:'Are you sure you want to turn on "{{name}}"?',turnOffConfirm:'Are you sure you want to turn off "{{name}}"? This will cut power to the connected device.',failedToTurn:'Failed to turn {{action}} "{{name}}"',unknown:"Unknown",addTitle:"Add Smart Plug",editTitle:"Edit Smart Plug",stopScanning:"Stop Scanning",discoverTasmota:"Discover Tasmota Devices",foundDevices:"Found {{count}} device(s) - click to select:",noDevicesFound:"No Tasmota devices found on your network",haNotConfigured:"Home Assistant is not configured. Set it up in",haSettingsPath:"Settings → Network → Home Assistant",selectEntity:"Select Entity *",ipAddress:"IP Address *",nameLabel:"Name *",username:"Username",password:"Password",authHint:"Leave empty if your Tasmota device doesn't require authentication",linkToPrinter:"Link to Printer",noPrinter:"No printer (manual control only)",linkingDescription:"Linking enables automatic on/off when prints start/complete",powerAlerts:"Power Alerts",alertAbove:"Alert if above (W)",alertBelow:"Alert if below (W)",alertDescription:"Get notified when power consumption crosses these thresholds. Leave empty to disable that direction.",dailySchedule:"Daily Schedule",turnOnAt:"Turn On at",turnOffAt:"Turn Off at",scheduleDescription:"Automatically turn the plug on/off at these times daily. Leave empty to skip that action.",showOnPrinterCard:"Show on Printer Card",displayOnPrinterCard:"Display button on printer card",connectedResult:"Connected!",deviceLabel:"Device: {{name}} - ",stateLabel:"State: {{state}}",test:"Test",delete:"Delete",save:"Save",add:"Add",cancel:"Cancel",failedToStartScan:"Failed to start scan",nameRequired:"Name is required",entityRequired:"Entity is required for Home Assistant plugs",mqttTopicRequired:"At least one MQTT topic must be configured for power, energy, or state monitoring",loadingEntities:"Loading entities...",loading:"Loading...",failedToLoadEntities:"Failed to load entities: {{error}}",noEntitiesMatching:'No entities found matching "{{search}}"',noEntitiesAvailable:"No entities available",searchingEntities:"Searching all entities ({{count}} found)",showingEntities:"Showing switch, light, input_boolean ({{count}} available)",energyMonitoringOptional:"Energy Monitoring (Optional)",energyMonitoringHint:"Search and select sensors that provide power/energy data.",powerSensorW:"Power Sensor (W)",energyTodayKwh:"Energy Today (kWh)",totalEnergyKwh:"Total Energy (kWh)",noMatchingSensors:"No matching sensors",none:"None",mqttNotConfigured:"MQTT broker not configured. Set broker address in",mqttSettingsPath:"Settings → Network → MQTT Publishing",mqttNotConfiguredSuffix:"(you don't need to enable publishing, just fill in the broker details).",mqttMonitorOnlyDescription:"MQTT plugs receive power/energy data via MQTT subscription. On/off control is not available - use your MQTT broker or home automation system.",powerMonitoring:"Power Monitoring",energyMonitoring:"Energy Monitoring",stateMonitoring:"State Monitoring",optional:"optional",topic:"Topic",jsonPath:"JSON Path",multiplier:"Multiplier",onValue:"ON Value",mqttPowerHint:`JSON path extracts value from JSON payload (e.g., "power_l1"). Leave empty if topic publishes raw numeric values.
- Use multiplier 0.001 for mW→W, 1000 for kW→W.`,mqttEnergyHint:`JSON path extracts value from JSON payload. Leave empty for raw values.
- Use multiplier 0.001 for Wh→kWh, 1000 for MWh→kWh.`,mqttStateHint:`JSON path extracts value from JSON payload. Leave empty for raw values.
- ON value: the exact string that means "ON". Leave empty for auto-detect (ON, true, 1).`,noSwitchesInSwitchbar:"No switches in switchbar",enableSwitchbarHint:'Enable "Show in Switchbar" in Settings > Smart Plugs'},notifications:{providerTypes:{callmebot:"CallMeBot/WhatsApp",ntfy:"ntfy",pushover:"Pushover",telegram:"Telegram",email:"Email",discord:"Discord",webhook:"Webhook",homeassistant:"Home Assistant"},providerDescriptions:{email:"SMTP email notifications",telegram:"Notifications via Telegram bot",discord:"Send to Discord channel via webhook",ntfy:"Free, self-hostable push notifications",pushover:"Simple, reliable push notifications",callmebot:"Free WhatsApp notifications via CallMeBot",webhook:"Generic HTTP POST to any URL",homeassistant:"Persistent notifications in Home Assistant dashboard"},lastSuccess:"Last: {{date}}",error:"Error",printer:"Printer:",allPrinters:"All printers",sendTestNotification:"Send Test Notification",eventSettings:"Event Settings",enabled:"Enabled",sendFromProvider:"Send notifications from this provider",printEvents:"Print Events",printerStatus:"Printer Status",amsAlarms:"AMS Alarms",amsHtAlarms:"AMS-HT Alarms",printQueue:"Print Queue",start:"Start",plateCheck:"Plate Check",complete:"Complete",failed:"Failed",stopped:"Stopped",progress:"Progress",offline:"Offline",lowFilament:"Low Filament",maintenance:"Maintenance",amsHumidity:"AMS Humidity",amsTemp:"AMS Temp",amsHtHumidity:"AMS-HT Humidity",amsHtTemp:"AMS-HT Temp",bedCooled:"Bed Cooled",quiet:"Quiet",digest:"Digest {{time}}",printStarted:"Print Started",plateNotEmpty:"Plate Not Empty",plateNotEmptyDescription:"Objects detected before print",printCompleted:"Print Completed",bedCooledLabel:"Bed Cooled",bedCooledDescription:"Bed cooled below threshold after print",printFailed:"Print Failed",printStopped:"Print Stopped",progressMilestones:"Progress Milestones",progressMilestonesDescription:"Notify at 25%, 50%, 75%",printerOffline:"Printer Offline",printerError:"Printer Error",lowFilamentLabel:"Low Filament",maintenanceDue:"Maintenance Due",maintenanceDueDescription:"Notify when maintenance is needed",amsHumidityHigh:"AMS Humidity High",amsHumidityHighDescription:"Regular AMS humidity exceeds threshold",amsTemperatureHigh:"AMS Temperature High",amsTemperatureHighDescription:"Regular AMS temperature exceeds threshold",amsHtHumidityHigh:"AMS-HT Humidity High",amsHtHumidityHighDescription:"AMS-HT humidity exceeds threshold",amsHtTemperatureHigh:"AMS-HT Temperature High",amsHtTemperatureHighDescription:"AMS-HT temperature exceeds threshold",jobAdded:"Job Added",jobAddedDescription:"Job added to queue",jobAssigned:"Job Assigned",jobAssignedDescription:"Model-based job assigned to printer",jobStarted:"Job Started",jobStartedDescription:"Queue job started printing",jobWaiting:"Job Waiting",jobWaitingDescription:"Job waiting for filament",jobSkipped:"Job Skipped",jobSkippedDescription:"Job skipped (previous failed)",jobFailed:"Job Failed",jobFailedDescription:"Job failed to start",queueComplete:"Queue Complete",queueCompleteDescription:"All queue jobs finished",quietHours:"Quiet Hours",noNotificationsDuring:"No notifications during these hours",editProviderToChangeQuietHours:"Edit provider to change quiet hours",dailyDigest:"Daily Digest",batchNotifications:"Batch notifications into a single daily summary",sendAt:"Send at {{time}}",editProviderToChangeDigestTime:"Edit provider to change digest time",edit:"Edit",deleteProvider:"Delete Notification Provider",deleteConfirm:'Are you sure you want to delete "{{name}}"? This cannot be undone.',delete:"Delete",addTitle:"Add Notification Provider",editTitle:"Edit Notification Provider",nameLabel:"Name *",namePlaceholder:"My Notifications",providerTypeLabel:"Provider Type *",configuration:"Configuration",testConfiguration:"Test Configuration",printerFilter:"Printer Filter",onlyFromPrinter:"Only send notifications for events from this printer",quietHoursDnd:"Quiet Hours (Do Not Disturb)",quietStart:"Start",quietEnd:"End",dailyDigestLabel:"Daily Digest",sendDigestAt:"Send digest at",digestCollected:"Events will be collected and sent as a single summary at this time",notificationEvents:"Notification Events",progressPercent:"(25%, 50%, 75%)",bedCooledAfterPrint:"(after print completes)",cancel:"Cancel",save:"Save",add:"Add",nameRequired:"Name is required",fieldRequired:"{{field}} is required",phoneNumber:"Phone Number",apiKey:"API Key",serverUrl:"Server URL",topic:"Topic",authToken:"Auth Token",userKey:"User Key",appToken:"App Token",priority:"Priority",botToken:"Bot Token",chatId:"Chat ID",smtpServer:"SMTP Server",smtpPort:"SMTP Port",security:"Security",authentication:"Authentication",username:"Username",password:"Password",fromEmail:"From Email",toEmail:"To Email",webhookUrl:"Webhook URL",payloadFormat:"Payload Format",authorization:"Authorization",titleFieldName:"Title Field Name",messageFieldName:"Message Field Name",editTemplate:"Edit Template: {{name}}",titleLabel:"Title",bodyLabel:"Body",titlePlaceholder:"Notification title...",bodyPlaceholder:"Notification body...",availableVariables:"Available Variables",clickToInsert:"Click to insert at cursor position in body",livePreview:"Live Preview",hide:"Hide",show:"Show",loadingPreview:"Loading preview...",enterTemplateContent:"Enter template content to see preview",titlePreview:"Title:",bodyPreview:"Body:",resetToDefault:"Reset to Default",titleRequired:"Title is required",bodyRequired:"Body is required",notificationLog:"Notification Log",showFailedOnly:"Failed only",last24Hours:"Last 24 hours",last7Days:"Last 7 days",last30Days:"Last 30 days",last90Days:"Last 90 days",justNow:"Just now",noFailedNotifications:"No failed notifications",noNotificationsLogged:"No notifications logged",unknownProvider:"Unknown Provider",logTitle:"Title",logMessage:"Message",logError:"Error",logProvider:"Provider: {{type}}",logTime:"Time: {{time}}",refresh:"Refresh",clearOld:"Clear Old",statsSummary:"Last {{days}} days:",statsNotifications:"notifications",statsSent:"{{count}} sent",statsFailed:"{{count}} failed",eventTypes:{print_start:"Print Started",print_complete:"Print Complete",print_failed:"Print Failed",print_stopped:"Print Stopped",print_progress:"Progress",printer_offline:"Printer Offline",printer_error:"Printer Error",filament_low:"Low Filament",maintenance_due:"Maintenance Due",test:"Test"}},richTextEditor:{bold:"Bold",italic:"Italic",underline:"Underline",bulletList:"Bullet List",numberedList:"Numbered List",alignLeft:"Align Left",alignCenter:"Align Center",alignRight:"Align Right",addLink:"Add Link",removeLink:"Remove Link"},externalLinks:{noLinksConfigured:"No external links configured",deleteLink:"Delete Link",removeCustomIcon:"Remove custom icon",openInNewTab:"Open in new tab",placeholders:{linkName:"My Link"}},keyboardShortcuts:{title:"Keyboard Shortcuts",navigation:"Navigation",archivesSection:"Archives",kProfilesSection:"K-Profiles",generalSection:"General",shortcuts:{goToPrinters:"Go to Printers",goToArchives:"Go to Archives",goToQueue:"Go to Queue",goToStats:"Go to Statistics",goToProfiles:"Go to Cloud Profiles",goToSettings:"Go to Settings",focusSearch:"Focus search",openUploadModal:"Open upload modal",clearSelection:"Clear selection / blur input",contextMenu:"Context menu on cards",refreshProfiles:"Refresh profiles",newProfile:"New profile",exitSelectionMode:"Exit selection mode",showHelp:"Show this help"},footer:"Press Esc or click outside to close"},notificationLog:{title:"Notification Log",events:{printStarted:"Print Started",printComplete:"Print Complete",printFailed:"Print Failed",printStopped:"Print Stopped",progress:"Progress",printerOffline:"Printer Offline",printerError:"Printer Error",lowFilament:"Low Filament",maintenanceDue:"Maintenance Due",test:"Test"},timeAgo:{justNow:"Just now",minutesAgo:"{{minutes}}m ago",hoursAgo:"{{hours}}h ago"}},restoreBackup:{title:"Restore Backup",restoring:"Restoring...",restoreComplete:"Restore Complete",restoreFailed:"Restore Failed",importSettings:"Import settings from a backup file",pleaseWait:"Please wait while your data is being restored",clickToSelect:"Click to select backup file (.json or .zip)",howDuplicateHandling:"How duplicate handling works:",categories:{printers:"Printers",smartPlugs:"Smart Plugs",notificationProviders:"Notification Providers",filaments:"Filaments",archives:"Archives",pendingUploads:"Pending Uploads",settingsTemplates:"Settings & Templates"},matchingInfo:{printers:"matched by serial number",smartPlugs:"matched by IP address",notificationProviders:"matched by name",filaments:"matched by name + type + brand",archives:"matched by content hash",pendingUploads:"matched by filename",settingsTemplates:"always overwritten"},replaceExisting:"Replace existing data",keepExisting:"Keep existing data",replaceDescription:"Overwrite items that already exist with backup data",keepDescription:"Only restore items that don't already exist",caution:"Caution:",cautionText:"Overwriting will replace your current configurations with backup data. Printer access codes are never overwritten for security.",itemsRestored:"Items Restored",itemsSkipped:"Items Skipped",restored:"Restored",skipped:"Skipped (already exist)",filesLabel:"Files (3MF, thumbnails, etc.)",newApiKeysGenerated:"New API Keys Generated",newApiKeysWarning:"These keys are only shown once. Copy them now!",processingBackup:"Processing backup file...",noDataFound:"No data was found to restore in the backup file.",failedToRestore:"Failed to restore backup. Please check the file format."},backupExport:{title:"Export Backup",selectData:"Select data to include",selectAll:"Select All",selectNone:"Select None",categoryDescriptions:{settings:"Language, theme, update preferences",notifications:"ntfy, Pushover, Discord, etc.",templates:"Custom message templates",smartPlugs:"Tasmota plug configurations",externalLinks:"Sidebar links to external services",printers:"Printer info (access codes excluded)",plateDetection:"Empty plate reference images",filaments:"Filament types and costs",maintenance:"Custom maintenance schedules",archives:"All print data + files (3MF, thumbnails, photos)",projects:"Projects, BOM items, and attachments",pendingUploads:"Virtual printer uploads awaiting review",apiKeys:"Webhook API keys (new keys generated on import)"},requiresPrinters:"Requires Printers to be selected",zipFileWarning:"ZIP file will be created.",zipFileDescription:"Includes all 3MF files, thumbnails, timelapses, and photos. This may take a while and result in a large file.",includeAccessCodes:"Include Access Codes",includeAccessCodesDescription:"For transferring to another machine",includeAccessCodesWarning:"Access codes will be included in plain text. Keep this backup file secure!",categoriesSelected:"{{selectedCount}} categories selected"},pendingUploads:{placeholders:{notes:"Add notes about this print..."},discardUpload:"Discard Upload",archiveAllUploads:"Archive All Uploads",discardAllUploads:"Discard All Uploads",archive:"Archive",timeAgo:{justNow:"Just now",minutesAgo:"{{minutes}}m ago",hoursAgo:"{{hours}}h ago",daysAgo:"{{days}}d ago"}},apiBrowser:{placeholders:{requestBody:"JSON request body...",searchEndpoints:"Search endpoints..."}},configureAmsSlot:{title:"Configure AMS Slot",slotConfigured:"Slot Configured!",configuringSlot:"Configuring slot:",slotLabel:"{{ams}} Slot {{slot}}",searchPresets:"Search presets...",colorPlaceholder:"Color name or hex (e.g., brown, FF8800)",clearCustomColor:"Clear custom color",noCloudPresets:"No cloud presets. Login to Bambu Cloud to sync.",noPresetsAvailable:"No presets available. Login to Bambu Cloud or import local profiles.",noMatchingPresets:"No matching presets found.",custom:"Custom",builtin:"Built-in",settingsSentToPrinter:"Settings sent to printer",filamentProfile:"Filament Profile",kProfileLabel:"K Profile (Pressure Advance)",filteringFor:"Filtering for: {{material}}",noKProfile:"No K profile (use default 0.020)",noMatchingKProfiles:"No matching K profiles found. Default K=0.020 will be used.",selectFilamentFirst:"Select a filament profile first",kFromCalibration:"K={{value}} from printer calibration",customColorLabel:"Custom Color (optional)",presetColors:"{{name}} colors:",showLessColors:"Show less colors",showMoreColors:"Show more colors",clear:"Clear",hexLabel:"Hex: #{{hex}}",resetting:"Resetting...",resetSlot:"Reset Slot",cancel:"Cancel",configuring:"Configuring...",configureSlot:"Configure Slot"},githubBackup:{title:"GitHub Backup",history:"History",downloadBackup:"Download Backup",restoreBackup:"Restore Backup",noBackupsYet:"No backups yet"},emailSettings:{placeholders:{fromName:"BamBuddy"}},tagManagement:{searchTags:"Search tags...",renameTag:"Rename tag",deleteTag:"Delete tag"},notificationTemplates:{placeholders:{title:"Notification title...",body:"Notification body..."}},batchTag:{placeholders:{newTag:"Enter new tag..."}},photoGallery:{deletePhoto:"Delete Photo"},filamentHoverCard:{copySpoolUuid:"Copy spool UUID"},kProfilesView:{hasNote:"Has note",copyProfile:"Copy profile"},layout:{openMenu:"Open menu",noPermissionSystemInfo:"You do not have permission to view system information"},dashboard:{dragToReorder:"Drag to reorder",hideWidget:"Hide widget"},notificationProviderCard:{deleteNotificationProvider:"Delete Notification Provider"},fileManagerModal:{closeFileManager:"Close file manager",sortFiles:"Sort files",goToParentFolder:"Go to parent folder",threeView:"3D View"},embeddedCameraViewer:{refreshStream:"Refresh stream",close:"Close",zoomOut:"Zoom out",resetZoom:"Reset zoom",zoomIn:"Zoom in",dragToResize:"Drag to resize"},timelapseViewer:{skipBack5s:"Skip back 5s",skipForward5s:"Skip forward 5s"},notificationProviders:{descriptions:{email:"SMTP email notifications",telegram:"Notifications via Telegram bot",discord:"Send to Discord channel via webhook",ntfy:"Free, self-hostable push notifications",pushover:"Simple, reliable push notifications",callmebot:"Free WhatsApp notifications via CallMeBot",webhook:"Generic HTTP POST to any URL"}},logViewer:{searchPlaceholder:"Search message or logger name...",noLogEntries:"No log entries found"},switchbarPopover:{noSwitchesInSwitchbar:"No switches in switchbar"},projectPageModal:{placeholders:{title:"Title",designer:"Designer",license:"License",description:"Enter description...",profileTitle:"Profile Title",profileDescription:"Profile description..."}},spoolmanSettings:{},time:{unknown:"-",waiting:"Waiting",justNow:"Just now",now:"Now",minsAgo:"{{count}}m ago",inMins:"in {{count}}m",hoursAgo:"{{count}}h ago",inHours:"in {{count}}h",daysAgo:"{{count}}d ago",inDays:"in {{count}}d"},spoolbuddy:{nav:{dashboard:"Dashboard",ams:"AMS",inventory:"Inventory",writeTag:"Write",settings:"Settings"},status:{nfcReady:"NFC Ready",nfcOff:"NFC Off",offline:"Offline",online:"Online",noPrinters:"No printers",deviceOffline:"Device Offline",waitingConnection:"Waiting for device connection...",systemReady:"System Ready",status:"Status"},dashboard:{readyToScan:"Ready to scan",idleMessage:"Place a spool on the scale to identify it",nfcHint:"NFC tag will be read automatically",device:"Device",syncWeight:"Sync Weight",weightSynced:"Synced!",unknownTag:"Unknown Tag",newTag:"New Tag Detected",onScale:"on scale",linkSpool:"Link to Spool",linkTagTitle:"Link Tag to Spool",linkTag:"Link Tag",selectSpool:"Select a spool to link this tag to:",noUntagged:"No spools without tags found",tagDetected:"Tag detected",noTag:"No tag",tagId:"Tag",grossWeight:"Gross weight",spoolSize:"Spool size",close:"Close",currentSpool:"Current Spool"},modal:{spoolDetected:"Spool Detected",assignToAms:"Assign to AMS",syncWeight:"Sync Weight",weightSynced:"Synced!",syncing:"Syncing...",newTagDetected:"New Tag Detected",addToInventory:"Add to Inventory",assignToAmsTitle:"Assign to AMS",selectSlot:"Select a slot",assign:"Assign",assigning:"Assigning...",assignSuccess:"Assigned!",assignError:"Failed to assign spool. Please try again.",noPrinterSelected:"Select a printer...",noAmsDetected:"No AMS detected on this printer",slot:"Slot"},weight:{noReading:"No reading",stable:"Stable",measuring:"Measuring...",tare:"Tare",calibrate:"Calibrate"},spool:{remaining:"Remaining",material:"Material",brand:"Brand",color:"Color",coreWeight:"Core",labelWeight:"Label",scaleWeight:"Scale",netWeight:"Net",lastUsed:"Last used"},ams:{noData:"No AMS detected",connectAms:"Connect an AMS to see filament slots",noPrinter:"No printer selected",selectPrinter:"Select a printer from the top bar",printerDisconnected:"Printer disconnected",humidity:"Humidity",level:"Level",active:"Active",slot:"Slot",empty:"Empty"},inventory:{search:"Search spools...",empty:"No spools in inventory",noResults:"No matching spools",spools:"spools",addSpool:"Add Spool"},settings:{tabDevice:"Device",tabDisplay:"Display",tabScale:"Scale",tabUpdates:"Updates",nfcReader:"NFC Reader",type:"Type",connection:"Connection",notConnected:"N/A",deviceInfo:"Device Info",hostname:"Host",uptime:"Uptime",brightness:"Brightness",saved:"Saved",noBacklight:"No DSI backlight detected. Brightness control requires a DSI display.",screenBlank:"Screen Blank Timeout",screenBlankDesc:"Screen turns off after inactivity. Touch to wake.",displayNote:"Brightness is applied as a software filter.",scaleCalibration:"Scale Calibration",currentWeight:"Current weight",tareOffset:"Tare",calFactor:"Factor",knownWeight:"Known weight",calStep1:"Remove all items from the scale and press Set Zero.",calStep2:"Place known weight on scale.",setZero:"Set Zero",calibrateNow:"Calibrate",calibrated:"Calibrated",tareSet:"Tare command sent. Waiting for device...",tareFailed:"Failed to send tare command",zeroSet:"Zero point set. Place known weight on scale.",calibrationDone:"Calibration complete!",calibrationFailed:"Calibration failed",lastCalibrated:"Last calibrated",stable:"Stable",settling:"Settling...",firmware:"Firmware",scale:"Scale",noDevice:"No SpoolBuddy device found",daemonVersion:"Daemon Version",currentVersion:"Current",versionPending:"Waiting for daemon...",checking:"Checking...",checkUpdates:"Check for Updates",updateAvailable:"Update available",updateInstructions:"Update via SSH: run the SpoolBuddy install script to upgrade.",upToDate:"Up to date",includeBeta:"Include beta versions"},writeTag:{tabExisting:"Existing Spool",tabNew:"New Spool",tabReplace:"Replace Tag",searchPlaceholder:"Search by material, color, brand...",noUntaggedSpools:"No spools without tags",noTaggedSpools:"No spools with tags",selectSpool:"Select a spool, then place a blank NTAG on the reader",placeTag:"Place an NTAG on the reader",tagReady:"Tag detected — ready to write",writeTag:"Write Tag",replaceTag:"Replace Tag",writing:"Writing tag...",waiting:"Waiting for SpoolBuddy...",writeSuccess:"Tag written successfully!",writeFailed:"Write failed",queueFailed:"Failed to queue write command",tryAgain:"Try Again",cancel:"Cancel",replaceWarning:"Old tag will be unlinked. New tag will replace it.",deviceOffline:"SpoolBuddy is offline",material:"Material",colorName:"Color Name",color:"Color",brand:"Brand",weight:"Weight (g)",createSpool:"Create Spool",creating:"Creating...",spoolCreated:"Spool created! Ready to write.",createFailed:"Failed to create spool"}},bugReport:{title:"Report a Bug",description:"Description",descriptionPlaceholder:"What went wrong? Please describe the issue...",email:"Email (optional)",emailPlaceholder:"your@email.com",emailPrivacy:"If provided, your email will be included in a collapsed section of the GitHub issue so the maintainer can follow up.",screenshot:"Screenshot",uploadOrPaste:"Upload, paste, or drag an image",dataCollectedSummary:"What data is included in the report?",dataIncluded:"Included:",dataIncludedList:"App version, OS, architecture, Python version, database stats (counts only), printer models, nozzle counts, firmware versions, connectivity status, integration status (Spoolman, MQTT, HA), non-sensitive settings, network interface count, Docker details, dependency versions.",dataNeverIncluded:"Never included:",dataNeverIncludedList:"Printer names, serial numbers, access codes, passwords, IP addresses, email addresses, API keys, tokens, webhook URLs, hostnames, or usernames.",submit:"Submit",collectingLogs:"Collecting diagnostic logs...",collectingLogsHint:"Debug logging enabled, querying printers for fresh data.",submitting:"Submitting bug report...",submitSuccess:"Bug report submitted successfully!",submitFailed:"Failed to submit bug report",thankYou:"Thank you!",submitted:"Your bug report has been submitted.",viewIssue:"View Issue",unexpectedError:"An unexpected error occurred",countdownSeconds:"{{seconds}}s"}},Qce={nav:{printers:"Drucker",archives:"Archiv",queue:"Warteschlange",stats:"Statistiken",profiles:"Profile",maintenance:"Wartung",projects:"Projekte",inventory:"Filament",files:"Dateimanager",settings:"Einstellungen",system:"System",collapseSidebar:"Seitenleiste einklappen",expandSidebar:"Seitenleiste ausklappen",update:"Update",updateAvailable:"Update verfügbar: v{{version}}",updateAvailableBanner:"Version {{version}} ist verfügbar!",viewUpdate:"Update anzeigen",viewOnGithub:"Auf GitHub ansehen",keyboardShortcuts:"Tastaturkürzel (?)",switchToLight:"Zum hellen Modus wechseln",switchToDark:"Zum dunklen Modus wechseln",smartSwitches:"Smart Switches",logout:"Abmelden"},common:{save:"Speichern",saving:"Speichern...",cancel:"Abbrechen",delete:"Löschen",edit:"Bearbeiten",add:"Hinzufügen",close:"Schließen",confirm:"Bestätigen",loading:"Lädt...",error:"Fehler",success:"Erfolg",warning:"Warnung",enabled:"Aktiviert",disabled:"Deaktiviert",yes:"Ja",no:"Nein",on:"An",off:"Aus",all:"Alle",none:"Keine",search:"Suchen",filter:"Filtern",sort:"Sortieren",refresh:"Aktualisieren",download:"Herunterladen",upload:"Hochladen",uploading:"Hochladen...",uploadFailed:"Hochladen fehlgeschlagen",actions:"Aktionen",status:"Status",name:"Name",description:"Beschreibung",date:"Datum",time:"Zeit",hours:"Stunden",minutes:"Minuten",seconds:"Sekunden",days:"Tage",enable:"Aktivieren",disable:"Deaktivieren",permissions:"Berechtigungen",noPrinters:"Keine Drucker konfiguriert",noData:"Keine Daten verfügbar",linkNotFound:"Link nicht gefunden",required:"Erforderlich",optional:"Optional",dismiss:"Schließen",apply:"Anwenden",reset:"Zurücksetzen",export:"Exportieren",import:"Importieren",clear:"Leeren",selectAll:"Alle auswählen",deselectAll:"Auswahl aufheben",noChange:"— Keine Änderung —",unchanged:"Unverändert",unassigned:"Nicht zugewiesen",unknown:"Unbekannt",unknownError:"Unbekannter Fehler",today:"Heute",tomorrow:"Morgen",asap:"Sofort",overdue:"Überfällig",now:"Jetzt",collapse:"Einklappen",expand:"Ausklappen",viewArchive:"Archiv anzeigen",viewInFileManager:"Im Dateimanager anzeigen",addedBy:"Hinzugefügt von {{username}}",prints:"Drucke",more:"+{{count}} weitere",ascending:"Aufsteigend",descending:"Absteigend",printer:"Drucker",remove:"Entfernen",type:"Typ",print:"Drucken",rename:"Umbenennen",move:"Verschieben",create:"Erstellen",duplicate:"Duplizieren",left:"Links",right:"Rechts"},printers:{title:"Drucker",addPrinter:"Drucker hinzufügen",editPrinter:"Drucker bearbeiten",deletePrinter:"Drucker löschen",printerName:"Druckername",serialNumber:"Seriennummer",ipAddress:"IP-Adresse / Hostname",accessCode:"Zugangscode",model:"Modell",nozzleCount:"Düsenanzahl",autoArchive:"Automatische Archivierung",status:{available:"Verfügbar",idle:"Bereit",printing:"Druckt",paused:"Pausiert",offline:"Offline",error:"Fehler",finished:"Fertig",unknown:"Unbekannt"},temperatures:{nozzle:"Düse",bed:"Druckbett",chamber:"Kammer"},progress:"{{percent}}% abgeschlossen",timeRemaining:"Noch {{time}}",deleteConfirm:'Möchten Sie "{{name}}" wirklich löschen?',maintenanceOk:"Wartung OK",maintenanceWarning:"{{count}} Warnung",maintenanceWarning_plural:"{{count}} Warnungen",maintenanceDue:"{{count}} fällig",maintenanceDue_plural:"{{count}} fällig",sort:{name:"Name",status:"Status",model:"Modell",location:"Standort",ascending:"Aufsteigend sortieren",descending:"Absteigend sortieren"},cardSize:{small:"Kleine Karten",medium:"Mittlere Karten",large:"Große Karten",extraLarge:"Extra große Karten"},hideOffline:"Offline ausblenden",nextAvailable:"Nächster verfügbar",powerOn:"Einschalten",offlinePrintersWithPlugs:"Offline-Drucker mit Smart-Plugs",noPrintersConfigured:"Noch keine Drucker konfiguriert",readyToPrint:"Druckbereit",external:"Extern",extL:"Ext-L",extR:"Ext-R",deleteArchives:"Druckarchive löschen",noLabel:"Keine Bezeichnung",printPreview:"Druckvorschau",width:"Breite",height:"Höhe",noObjectsFound:"Keine Objekte gefunden",objectsLoadedOnPrintStart:"Objekte werden beim Druckstart geladen",willBeSkipped:"Wird übersprungen",name:"Name",serialCannotBeChanged:"Seriennummer kann nicht geändert werden",locationHelp:"Dient zur Gruppierung von Druckern und zum Filtern von Warteschlangenaufträgen",wifiSignal:{veryWeak:"Sehr schwach",weak:"Schwach",fair:"Ausreichend",good:"Gut",excellent:"Ausgezeichnet"},maintenanceUpToDate:"Alle Wartungen aktuell - Klicken zum Anzeigen",chamberLightOn:"Kammerbeleuchtung einschalten",chamberLightOff:"Kammerbeleuchtung ausschalten",files:"Dateien",browseFiles:"Druckerdateien durchsuchen",autoOffAfterPrint:"Automatisches Ausschalten nach Druck",autoOffExecuted:"Auto-off wurde ausgeführt - Drucker einschalten zum Zurücksetzen",hmsErrors:"HMS-Fehler",viewHmsErrors:"{{count}} HMS-Fehler anzeigen",resume:"Fortsetzen",pause:"Pausieren",stop:"Stoppen",camera:"Kamera",skipObject:"Objekt überspringen",reconnect:"Neu verbinden",mqttDebug:"MQTT-Debug",printerInformation:"Druckerinformationen",copyToClipboard:"Kopieren",copied:"Kopiert!",state:"Zustand",wifiSignalLabel:"WLAN-Signal",developerMode:"Entwicklermodus",enabled:"Aktiviert",disabled:"Deaktiviert",addedOn:"Hinzugefügt",sdCard:"SD-Karte",inserted:"Eingelegt",notInserted:"Nicht eingelegt",totalPrintHours:"Druckstunden",activeNozzle:"Aktiv: {{nozzle}} Düse",nozzleRack:"Düsenhalter",nozzleDocked:"Angedockt",nozzleMounted:"Montiert",nozzleActive:"Aktiv",nozzleIdle:"Inaktiv",nozzleDiameter:"Durchmesser",nozzleType:"Typ",nozzleStatus:"Status",nozzleFilament:"Filament",nozzleWear:"Verschleiß",nozzleMaxTemp:"Max Temp",nozzleSerial:"Seriennr.",nozzleHardenedSteel:"Gehärteter Stahl",nozzleStainlessSteel:"Edelstahl",nozzleTungstenCarbide:"Wolframkarbid",nozzleFlow:"Durchfluss",nozzleHighFlow:"High Flow",nozzleStandardFlow:"Standard",firmwareUpdate:"Firmware-Update",firmwareInstructions:"Gehen Sie auf dem Touchscreen des Druckers zu",firmwareNav:"Navigieren Sie zu",settings:"Einstellungen",firmware:"Firmware",discoverPrinters:"Drucker entdecken",searching:"Suche...",manualEntry:"Manuelle Eingabe",addFromCloud:"Aus Cloud hinzufügen",toast:{printerDeleted:"Drucker gelöscht",printerAdded:"Drucker hinzugefügt",printerUpdated:"Drucker aktualisiert",failedToDelete:"Drucker konnte nicht gelöscht werden",failedToAdd:"Drucker konnte nicht hinzugefügt werden",failedToUpdate:"Drucker konnte nicht aktualisiert werden",commandSent:"Befehl gesendet",failedToSendCommand:"Befehl konnte nicht gesendet werden",turnedOn:"{{name}} eingeschaltet",failedToPowerOn:"{{name}} konnte nicht eingeschaltet werden",scriptTriggered:"Skript ausgelöst",printStopped:"Druck gestoppt",printPaused:"Druck pausiert",printResumed:"Druck fortgesetzt",referenceDeleted:"Referenz gelöscht",detectionAreaSaved:"Erkennungsbereich gespeichert",failedToRunScript:"Skript konnte nicht ausgeführt werden",failedToStopPrint:"Druck konnte nicht gestoppt werden",failedToPausePrint:"Druck konnte nicht pausiert werden",failedToResumePrint:"Druck konnte nicht fortgesetzt werden",failedToControlChamberLight:"Kammerbeleuchtung konnte nicht gesteuert werden",failedToUpdateSetting:"Einstellung konnte nicht aktualisiert werden",failedToSkipObjects:"Objekte konnten nicht übersprungen werden",failedToRereadRfid:"RFID konnte nicht erneut gelesen werden",failedToCheckPlate:"Platte konnte nicht überprüft werden",failedToUpdateLabel:"Bezeichnung konnte nicht aktualisiert werden",failedToDeleteReference:"Referenz konnte nicht gelöscht werden",failedToSaveDetectionArea:"Erkennungsbereich konnte nicht gespeichert werden",plateCheckEnabled:"Plattenprüfung aktiviert",plateCheckDisabled:"Plattenprüfung deaktiviert",calibrationSaved:"Kalibrierung gespeichert!",calibrationFailed:"Kalibrierung fehlgeschlagen",rfidRereadInitiated:"RFID-Neueinlesen gestartet"},connection:{connected:"Verbunden",offline:"Offline"},queue:{inQueue:"{{count}} Druck in Warteschlange",inQueue_plural:"{{count}} Drucke in Warteschlange"},controls:"Steuerung",rfid:{reread:"RFID neu lesen"},permission:{noAdd:"Sie haben keine Berechtigung, Drucker hinzuzufügen",noEdit:"Sie haben keine Berechtigung, Drucker zu bearbeiten",noDelete:"Sie haben keine Berechtigung, Drucker zu löschen",noControl:"Sie haben keine Berechtigung, Drucker zu steuern",noFiles:"Sie haben keine Berechtigung, auf Druckerdateien zuzugreifen",noAmsRfid:"Sie haben keine Berechtigung, AMS-RFID erneut zu lesen",noSmartPlugControl:"Sie haben keine Berechtigung, Smart Plugs zu steuern",noCamera:"Sie haben keine Berechtigung, Kameras anzuzeigen"},modal:{addTitle:"Drucker hinzufügen",editTitle:"Drucker bearbeiten",myPrinter:"Mein Drucker",selectModel:"Modell auswählen...",locationGroup:"Standort / Gruppe (optional)",locationPlaceholder:"z.B. Werkstatt, Büro, Keller",autoArchiveLabel:"Abgeschlossene Drucke automatisch archivieren",fromPrinterSettings:"Aus Druckereinstellungen",modelOptional:"Modell (optional)",saveChanges:"Änderungen speichern"},skipObjects:{tooltip:"Objekte überspringen",onlyWhilePrinting:"Objekte überspringen (nur während des Drucks)",requiresMultiple:"Objekte überspringen (erfordert 2+ Objekte)",title:"Objekte überspringen",matchIdsInfo:"IDs mit Drucker-Display abgleichen",printerShowsIds:"Der Druckerbildschirm zeigt Objekt-IDs auf der Bauplatte",skipSelected:"Ausgewählte überspringen",skipping:"Überspringe...",noObjectsSelected:"Keine Objekte ausgewählt",selectObjectsToSkip:"Wählen Sie Objekte aus, die Sie vom aktuellen Druck überspringen möchten",skipped:"übersprungen",objectsSkipped:"Objekte übersprungen",activeCount:"{{count}} aktiv",waitForLayer:"Warten Sie auf Schicht 2+ zum Überspringen von Objekten (aktuell Schicht {{layer}})",skip:"Überspringen",confirmTitle:"Objekt überspringen?",confirmMessage:'Möchten Sie "{{name}}" wirklich überspringen? Dies kann nicht rückgängig gemacht werden.'},confirm:{deleteTitle:"Drucker löschen",deleteMessage:'Möchten Sie "{{name}}" wirklich löschen? Alle Verbindungseinstellungen werden entfernt.',deleteArchivesNote:"Der gesamte Druckverlauf für diesen Drucker wird dauerhaft gelöscht.",keepArchivesNote:"Der Druckverlauf wird beibehalten, aber nicht mehr mit diesem Drucker verknüpft.",stopTitle:"Druck stoppen",stopMessage:'Möchten Sie den aktuellen Druck auf "{{name}}" wirklich stoppen? Der Druckauftrag wird abgebrochen.',stopButton:"Druck stoppen",pauseTitle:"Druck pausieren",pauseMessage:'Möchten Sie den aktuellen Druck auf "{{name}}" wirklich pausieren?',pauseButton:"Druck pausieren",resumeTitle:"Druck fortsetzen",resumeMessage:'Möchten Sie den Druck auf "{{name}}" fortsetzen?',resumeButton:"Druck fortsetzen",powerOnTitle:"Drucker einschalten",powerOnMessage:'Möchten Sie die Stromversorgung für "{{name}}" wirklich EINSCHALTEN?',powerOnButton:"Einschalten",powerOffTitle:"Drucker ausschalten",powerOffMessage:'Möchten Sie die Stromversorgung für "{{name}}" wirklich AUSSCHALTEN?',powerOffWarning:'WARNUNG: "{{name}}" druckt gerade! Möchten Sie die Stromversorgung wirklich AUSSCHALTEN? Dies unterbricht den Druck und kann den Drucker beschädigen.',powerOffButton:"Ausschalten"},discovery:{title:"Drucker entdecken",searching:"Suche...",scanning:"Scanne...",scanProgress:"Scanne... {{scanned}}/{{total}}",foundPrinters:"{{count}} Drucker gefunden",noPrintersFound:"Keine Drucker gefunden",noPrintersFoundSubnet:"Keine Drucker im angegebenen Subnetz gefunden.",noPrintersFoundNetwork:"Keine Drucker im Netzwerk gefunden.",allConfigured:"Alle erkannten Drucker sind bereits konfiguriert.",alreadyAdded:"Bereits hinzugefügt",select:"Auswählen",manualEntry:"Manuelle Eingabe",addFromCloud:"Aus Cloud hinzufügen",subnetToScan:"Zu scannendes Subnetz",dockerNote:"Docker erkannt. Geben Sie das Subnetz Ihres Druckers in CIDR-Notation ein. Erfordert network_mode: host in docker-compose.yml.",scanSubnet:"Subnetz nach Druckern scannen",discoverNetwork:"Drucker im Netzwerk suchen",scanningSubnet:"Subnetz wird nach Bambu-Druckern gescannt...",scanningNetwork:"Netzwerk wird gescannt...",serialRequired:"Seriennummer erforderlich",unknown:"Unbekannt",failedToStart:"Erkennung konnte nicht gestartet werden"},filaments:"Filamente",openCameraOverlay:"Kamera-Overlay öffnen",openCameraWindow:"Kamera in neuem Fenster öffnen",firmwareUpdateAvailable:"Firmware-Update verfügbar: {{current}} → {{latest}}",firmwareUpToDate:"Firmware {{version}} — Aktuell",firmwareUpdateButton:"Update",plateDetection:{noPermission:"Sie haben keine Berechtigung, Drucker zu aktualisieren",enabledClick:"Plattenprüfung aktiviert - Klicken zum Deaktivieren",disabledClick:"Plattenprüfung deaktiviert - Klicken zum Aktivieren",manageCalibration:"Platten-Erkennungskalibrierung verwalten",calibrationRequired:"Kalibrierung erforderlich",calibrationInstructions:"Bitte stellen Sie sicher, dass die Druckplatte <strong>vollständig leer</strong> ist, und klicken Sie dann auf Kalibrieren.",calibrationDescription:"Die Kalibrierung erfasst ein Referenzbild der leeren Platte. Zukünftige Prüfungen vergleichen mit dieser Referenz, um Objekte zu erkennen.",calibrationTip:"<strong>Tipp:</strong> Sie können bis zu 5 Kalibrierungen für verschiedene Platten speichern. Das System verwendet automatisch die beste Übereinstimmung bei der Prüfung.",plateEmpty:"Platte erscheint leer",objectsDetected:"Objekte auf Platte erkannt",confidence:"Konfidenz",difference:"Differenz",analysisPreview:"Analysevorschau:",analysisLegend:"Grüner Rahmen = Erkennungsbereich, Rote Überlagerung = Unterschiede zur Kalibrierung",savedReferences:"Gespeicherte Referenzen ({{count}}/{{max}})",deleteReference:"Referenz löschen",labelPlaceholder:"Bezeichnung...",clickToEdit:"{{label}} - Zum Bearbeiten klicken",clickToAddLabel:"Zum Hinzufügen einer Bezeichnung klicken"},fans:{partCooling:"Bauteilkühlung",auxiliary:"Hilfsventilator",chamber:"Kammerventilator"},clickToViewHmsErrors:"Klicken, um HMS-Fehler anzuzeigen",estimatedCompletion:"Geschätzte Fertigstellungszeit",slotOptions:"Slot-Optionen",amsPopup:{friendlyName:"AMS-Name",friendlyNamePlaceholder:"z. B. AMS-Anzeigename",serialNumber:"Seriennummer",firmwareVersion:"Firmware",save:"Speichern",clear:"Löschen",noEditPermission:"Sie haben keine Berechtigung, AMS-Einheiten umzubenennen"},firmwareModal:{title:"Firmware-Update",titleUpToDate:"Firmware-Info",currentVersion:"Aktuell:",latestVersion:"Neueste:",releaseNotes:"Versionshinweise",checkingPrereqs:"Prüfe Voraussetzungen...",sdCardReady:"SD-Karte bereit. Klicken Sie unten, um die Firmware hochzuladen.",uploadedSuccess:"Firmware auf SD-Karte hochgeladen!",applyInstructions:"So wenden Sie das Update auf Ihrem Drucker an:",step1:"Gehen Sie auf dem Touchscreen des Druckers zu <strong>Einstellungen</strong>",step2:"Navigieren Sie zu <strong>Firmware</strong>",step3:"Wählen Sie <strong>Update von SD-Karte</strong>",step4:"Das Update dauert 10-20 Minuten",done:"Fertig",starting:"Starte...",uploadFirmware:"Firmware hochladen",uploadFailed:"Upload fehlgeschlagen: {{error}}",uploadedToast:"Firmware hochgeladen! Starten Sie das Update vom Druckerbildschirm."},accessCodePlaceholder:"Leer lassen, um den aktuellen zu behalten",roi:{title:"Erkennungsbereich (ROI)",xStart:"X-Start",yStart:"Y-Start",width:"Breite",height:"Höhe",instruction:"Passen Sie den Erkennungsbereich an, um sich auf die Druckplatte zu konzentrieren. Der grüne Rahmen in der Vorschau zeigt den aktuellen Bereich."},developerModeWarning:"Der Entwickler-LAN-Modus ist nicht aktiviert auf: {{names}}. Einige Funktionen funktionieren möglicherweise nicht.",howToEnable:"Aktivieren",incompatibleFile:"Diese Datei wurde für {{slicedFor}} geslicet, aber dieser Drucker ist ein {{printerModel}}",dropNotPrintable:"Nur .gcode- und .gcode.3mf-Dateien können gedruckt werden",dropToPrint:"Zum Drucken ablegen",cannotPrint:"Drucker beschäftigt"},archives:{title:"Druckarchiv",searchPlaceholder:"Archiv durchsuchen...",filterByPrinter:"Nach Drucker filtern",filterByStatus:"Nach Status filtern",sortBy:"Sortieren nach",sortNewest:"Neueste zuerst",sortOldest:"Älteste zuerst",sortName:"Name",sortDuration:"Dauer",sortLargest:"Größte zuerst",sortSmallest:"Kleinste zuerst",sortSize:"Größe",noArchives:"Keine Archive gefunden",noArchivesSearch:"Keine Archive entsprechen Ihrer Suche",noArchivesYet:"Noch keine Archive",loadingArchives:"Lade Archive...",releaseToUpload:"Loslassen zum Hochladen",showAll:"Alle anzeigen",showFavoritesOnly:"Nur Favoriten anzeigen",gridView:"Rasteransicht",listView:"Listenansicht",calendarView:"Kalenderansicht",logView:"Druckprotokoll",manageTags:"Tags verwalten",showFailedPrints:"Fehlgeschlagene Drucke anzeigen",hideFailedPrints:"Fehlgeschlagene Drucke ausblenden",printTime:"Druckzeit",filamentUsed:"Verbrauchtes Filament",cost:"Kosten",reprint:"Drucken",preview:"Vorschau",deleteArchive:"Archiv löschen",deleteConfirm:"Möchten Sie dieses Archiv wirklich löschen?",favorite:"Favorit",unfavorite:"Aus Favoriten entfernen",viewDetails:"Details anzeigen",status:{completed:"Abgeschlossen",failed:"Fehlgeschlagen",stopped:"Gestoppt"},toast:{source3mfAttached:"Quell-3MF angehängt: {{filename}}",failedUploadSource3mf:"Fehler beim Hochladen der Quell-3MF",source3mfRemoved:"Quell-3MF entfernt",failedRemoveSource3mf:"Fehler beim Entfernen der Quell-3MF",f3dAttached:"F3D angehängt: {{filename}}",failedUploadF3d:"Fehler beim Hochladen der F3D",f3dRemoved:"F3D entfernt",failedRemoveF3d:"Fehler beim Entfernen der F3D",timelapseAttached:"Zeitraffer angehängt: {{filename}}",timelapseAlreadyAttached:"Zeitraffer bereits angehängt",noMatchingTimelapse:"Kein passender Zeitraffer gefunden",failedScanTimelapse:"Fehler beim Suchen nach Zeitraffer",failedAttachTimelapse:"Fehler beim Anhängen des Zeitraffers",timelapseRemoved:"Zeitraffer entfernt",failedRemoveTimelapse:"Fehler beim Entfernen des Zeitraffers",timelapseUploaded:"Zeitraffer hochgeladen: {{filename}}",failedUploadTimelapse:"Fehler beim Hochladen des Zeitraffers",archiveDeleted:"Archiv gelöscht",failedDeleteArchive:"Fehler beim Löschen des Archivs",addedToFavorites:"Zu Favoriten hinzugefügt",removedFromFavorites:"Aus Favoriten entfernt",projectUpdated:"Projekt aktualisiert",failedUpdateProject:"Fehler beim Aktualisieren des Projekts",linkCopied:"Link in die Zwischenablage kopiert",failedCopyLink:"Fehler beim Kopieren des Links",photoDeleted:"Foto gelöscht",failedDeletePhoto:"Fehler beim Löschen des Fotos",failedDeleteArchives:"Fehler beim Löschen der Archive",failedUpdateFavorites:"Fehler beim Aktualisieren der Favoriten",exportDownloaded:"Export heruntergeladen",exportFailed:"Export fehlgeschlagen"},menu:{print:"Drucken",schedule:"Planen",openInBambuStudio:"Im Slicer öffnen",slice:"Slicen",externalLink:"Externer Link",viewOnMakerWorld:"Auf MakerWorld ansehen",preview3d:"3D-Vorschau",viewTimelapse:"Zeitraffer ansehen",scanForTimelapse:"Nach Zeitraffer suchen",uploadTimelapse:"Zeitraffer hochladen",removeTimelapse:"Zeitraffer entfernen",downloadSource3mf:"Quell-3MF herunterladen",uploadSource3mf:"Quell-3MF hochladen",replaceSource3mf:"Quell-3MF ersetzen",removeSource3mf:"Quell-3MF entfernen",uploadF3d:"F3D hochladen",replaceF3d:"F3D ersetzen",downloadF3d:"F3D herunterladen",removeF3d:"F3D entfernen",download:"Herunterladen",copyDownloadLink:"Download-Link kopieren",qrCode:"QR-Code",viewPhotos:"Fotos ansehen",viewPhotosCount:"Fotos ansehen ({{count}})",projectPage:"Projektseite",addToFavorites:"Zu Favoriten hinzufügen",removeFromFavorites:"Aus Favoriten entfernen",edit:"Bearbeiten",goToProject:"Zum Projekt: {{name}}",addToProject:"Zu Projekt hinzufügen",removeFromProject:"Aus Projekt entfernen",loading:"Laden...",noProjectsAvailable:"Keine Projekte verfügbar",select:"Auswählen",deselect:"Abwählen",delete:"Löschen"},permission:{noReprint:"Sie haben keine Berechtigung, dieses Archiv erneut zu drucken",noAddToQueue:"Sie haben keine Berechtigung, zur Warteschlange hinzuzufügen",noUpdateArchives:"Sie haben keine Berechtigung, Archive zu aktualisieren",noUploadFiles:"Sie haben keine Berechtigung, Dateien hochzuladen",noDownload:"Sie haben keine Berechtigung, Archive herunterzuladen",noCopyLink:"Sie haben keine Berechtigung, Download-Links zu kopieren",noDelete:"Sie haben keine Berechtigung, dieses Archiv zu löschen",noCreate:"Sie haben keine Berechtigung, Archive zu erstellen"},card:{previousPlate:"Vorherige Platte",nextPlate:"Nächste Platte",plateNumber:"Platte {{index}}",moreOptions:"Rechtsklick für mehr Optionen",addToFavorites:"Zu Favoriten hinzufügen",removeFromFavorites:"Aus Favoriten entfernen",cancelled:"abgebrochen",failed:"fehlgeschlagen",duplicate:"Duplikat",duplicateTitle:"Dieses Modell wurde bereits zuvor gedruckt",openSource3mf:"Quell-3MF in Bambu Studio öffnen (Rechtsklick für mehr Optionen)",downloadF3d:"Fusion 360 Designdatei herunterladen",viewTimelapse:"Zeitraffer ansehen",viewPhoto:"1 Foto ansehen",viewPhotos:"{{count}} Fotos ansehen",openFolder:"Ordner öffnen: {{name}}",slicedFile:"Geslicte Datei - druckbereit",sourceFile:"Nur Quelldatei - keine AMS-Zuordnung verfügbar",gcode:"GCODE",source:"QUELLE",project:"Projekt: {{name}}",estimated:"Geschätzt: {{time}}",actual:"Tatsächlich: {{time}}",accuracy:"Genauigkeit: {{percent}}%",filament:"{{weight}}g",layer:"{{count}} Schicht",layers:"{{count}} Schichten",object:"{{count}} Objekt",objects:"{{count}} Objekte",slicedFor:"Geslict für {{model}}",uploadedBy:"Hochgeladen von",noPermissionReprint:"Sie haben keine Berechtigung, erneut zu drucken",noFileForReprint:"Keine 3MF-Datei verfügbar — die Datei konnte beim Aufzeichnen des Drucks nicht vom Drucker heruntergeladen werden",noPermissionEdit:"Sie haben keine Berechtigung, Archive zu bearbeiten",noPermissionDelete:"Sie haben keine Berechtigung, Archive zu löschen",reprint:"Drucken",schedulePrint:"Druck planen",schedule:"Planen",openInBambuStudio:"Im Slicer öffnen",openInBambuStudioToSlice:"Im Slicer öffnen zum Slicen",slice:"Slicen",externalLink:"Externer Link",makerWorld:"MakerWorld: {{designer}}",viewProject:"Projekt ansehen",noExternalLink:"Kein externer Link",preview3d:"3D-Vorschau",download:"Herunterladen",edit:"Bearbeiten",delete:"Löschen"},modal:{deleteArchive:"Archiv löschen",deleteConfirm:'Möchten Sie "{{name}}" wirklich löschen? Diese Aktion kann nicht rückgängig gemacht werden.',deleteButton:"Löschen",removeSource3mf:"Quell-3MF entfernen",removeSource3mfConfirm:'Möchten Sie die Quell-3MF-Datei wirklich von "{{name}}" entfernen? Die ursprüngliche Slicer-Projektdatei wird gelöscht.',removeButton:"Entfernen",removeF3d:"F3D entfernen",removeF3dConfirm:'Möchten Sie die Fusion 360 Designdatei wirklich von "{{name}}" entfernen?',removeTimelapse:"Zeitraffer entfernen",removeTimelapseConfirm:'Möchten Sie das Zeitraffervideo wirklich von "{{name}}" entfernen?',timelapse:"{{name}} - Zeitraffer",selectTimelapse:"Zeitraffer auswählen",selectTimelapseDesc:"Keine automatische Übereinstimmung gefunden. Wählen Sie den Zeitraffer für diesen Druck:",deleteArchives:"Archive löschen",deleteArchivesConfirm:"Möchten Sie wirklich {{count}} Archiv(e) löschen? Diese Aktion kann nicht rückgängig gemacht werden.",deleteCount:"{{count}} löschen"},page:{title:"Archive",printsCount:"{{filtered}} von {{total}} Drucken",dropFilesHere:".3mf-Dateien hier ablegen",releaseToUpload:"Loslassen zum Hochladen",only3mfSupported:"Nur .3mf-Dateien werden unterstützt",close:"Schließen",selected:"{{count}} ausgewählt",selectAll:"Alle auswählen",tags:"Tags",project:"Projekt",favorite:"Favorit",delete:"Löschen",toggledFavorites:"Favoriten für {{count}} Archiv(e) umgeschaltet",failedUpdateFavorites:"Fehler beim Aktualisieren der Favoriten",archivesDeleted:"{{count}} Archiv(e) gelöscht",failedDeleteArchives:"Fehler beim Löschen der Archive",photoDeleted:"Foto gelöscht",failedDeletePhoto:"Fehler beim Löschen des Fotos"},list:{name:"Name",printer:"Drucker",date:"Datum",size:"Größe",actions:"Aktionen",hasTimelapse:"Hat Zeitraffer"},log:{date:"Datum",printName:"Druckname",printer:"Drucker",user:"Benutzer",status:"Status",duration:"Dauer",filament:"Filament",allPrinters:"Alle Drucker",allUsers:"Alle Benutzer",allStatuses:"Alle Status",cancelled:"Abgebrochen",skipped:"Übersprungen",dateFrom:"Von",dateTo:"Bis",noEntries:"Keine Druckprotokolleinträge gefunden",showing:"{{count}} von {{total}} Einträgen",rowsPerPage:"Zeilen",page:"Seite",prev:"Zurück",next:"Weiter",clearLog:"Protokoll löschen",clearLogTitle:"Druckprotokoll löschen",clearLogConfirm:"Alle Druckprotokolleinträge werden dauerhaft gelöscht. Archive und Warteschlangeneinträge sind nicht betroffen. Diese Aktion kann nicht rückgängig gemacht werden. Sind Sie sicher?",clearLogButton:"Alle löschen",cleared:"{{count}} Protokolleinträge gelöscht",clearFailed:"Druckprotokoll konnte nicht gelöscht werden"}},queue:{title:"Druckwarteschlange",subtitle:"Planen und verwalten Sie Ihre Druckaufträge",addToQueue:"Zur Warteschlange hinzufügen",print:"Drucken",reprint:"Erneut drucken",schedulePrint:"Druck planen",editQueueItem:"Warteschlangeneintrag bearbeiten",printToPrinters:"Auf {{count}} Druckern drucken",queueToPrinters:"Zu {{count}} Druckern hinzufügen",queueAllPlates:"Alle {{count}} Platten in die Warteschlange",printQueued:"Druck in Warteschlange",itemsQueued:"{{count}} Einträge in Warteschlange",sending:"Wird gesendet...",sendingProgress:"Sende {{current}}/{{total}}...",adding:"Wird hinzugefügt...",addingProgress:"Füge hinzu {{current}}/{{total}}...",savingProgress:"Speichere {{current}}/{{total}}...",clearQueue:"Warteschlange leeren",clearHistory:"Verlauf löschen",emptyQueue:"Warteschlange ist leer",position:"Position",scheduledTime:"Geplante Zeit",moveUp:"Nach oben",moveDown:"Nach unten",startNow:"Jetzt starten",printingInProgress:"Druck läuft...",viewArchive:"Archiv anzeigen",viewInFileManager:"Im Dateimanager anzeigen",itemCount:"{{count}} Element",itemCount_plural:"{{count}} Elemente",dragToReorder:"Ziehen zum Neuordnen (nur Sofort)",reorderHint:"Position betrifft nur Sofort-Elemente. Geplante Elemente werden zur festgelegten Zeit ausgeführt.",addedBy:"Hinzugefügt von {{name}}",nextInQueue:"Nächster in der Warteschlange",clearPlate:"Druckplatte freigeben & Nächsten starten",clearPlateSuccess:"Druckplatte freigegeben — bereit für nächsten Druck",plateReady:"Druckplatte freigegeben — bereit für nächsten Druck",plateNumber:"Platte {{index}}",sections:{currentlyPrinting:"Aktuell druckend",queued:"In Warteschlange",history:"Verlauf"},status:{pending:"Ausstehend",waiting:"Wartend",printing:"Druckt",paused:"Pausiert",completed:"Abgeschlossen",failed:"Fehlgeschlagen",skipped:"Übersprungen",cancelled:"Abgebrochen"},summary:{printing:"Druckt",queued:"In Warteschlange",totalTime:"Gesamte Wartezeit",totalWeight:"Gesamtgewicht der Warteschlange",history:"Verlauf"},filter:{allPrinters:"Alle Drucker",unassigned:"Nicht zugewiesen",allStatus:"Alle Status",allLocations:"Alle Standorte",any:"Beliebig"},sort:{byPosition:"Nach Position sortieren",byName:"Nach Name sortieren",byPrinter:"Nach Drucker sortieren",bySchedule:"Nach Zeitplan sortieren",byDate:"Nach Datum sortieren",ascendingOldest:"Aufsteigend (älteste zuerst)",descendingNewest:"Absteigend (neueste zuerst)"},badges:{staged:"Bereitgestellt",requiresPrevious:"Erfordert vorherigen Erfolg",autoPowerOff:"Automatisch ausschalten"},empty:{title:"Keine Drucke geplant",description:'Planen Sie einen Druck von der Archivseite über die Option "Planen" im Kontextmenü oder ziehen Sie Dateien hierher.'},time:{asap:"Sofort",overdue:"Überfällig",now:"Jetzt",lessThanMinute:"In weniger als einer Minute",inMinutes:"In {{count}} Min",inHours:"In {{count}} Stunden"},actions:{stopPrint:"Druck stoppen",startPrint:"Druck starten",requeue:"Erneut einreihen"},bulkEdit:{title:"{{count}} Element bearbeiten",title_plural:"{{count}} Elemente bearbeiten",description:"Nur geänderte Einstellungen werden auf ausgewählte Elemente angewendet.",printer:"Drucker",noChange:"— Keine Änderung —",queueOptions:"Warteschlangenoptionen",staged:"Bereitgestellt (manueller Start)",autoPowerOff:"Nach Druck automatisch ausschalten",requirePrevious:"Vorherigen Erfolg erfordern",printOptions:"Druckoptionen",bedLevelling:"Bett-Nivellierung",flowCalibration:"Fluss-Kalibrierung",vibrationCalibration:"Vibrations-Kalibrierung",layerInspection:"Erste-Schicht-Prüfung",timelapse:"Zeitraffer",useAms:"AMS verwenden",applyChanges:"Änderungen übernehmen",selectAll:"Alle auswählen",deselectAll:"Auswahl aufheben",selected:"{{count}} ausgewählt",editSelected:"Ausgewählte bearbeiten",cancelSelected:"Ausgewählte abbrechen"},confirm:{cancelTitle:"Geplanten Druck abbrechen",cancelMessage:'Möchten Sie "{{name}}" wirklich abbrechen?',stopTitle:"Druck stoppen",stopMessage:'Möchten Sie den aktuellen Druck "{{name}}" wirklich stoppen? Der Druckauftrag wird am Drucker abgebrochen.',removeTitle:"Aus Verlauf entfernen",removeMessage:'Möchten Sie "{{name}}" wirklich aus dem Warteschlangenverlauf entfernen?',clearHistoryTitle:"Verlauf löschen",clearHistoryMessage:"Möchten Sie alle {{count}} Element(e) aus dem Verlauf entfernen?",cancelButton:"Druck abbrechen",stopButton:"Druck stoppen",thisPrint:"diesen Druck",thisItem:"dieses Element"},toast:{cancelled:"Warteschlangenelement abgebrochen",cancelFailed:"Element konnte nicht abgebrochen werden",removed:"Warteschlangenelement entfernt",removeFailed:"Element konnte nicht entfernt werden",stopped:"Druck gestoppt",stopFailed:"Druck konnte nicht gestoppt werden",released:"Druck in Warteschlange freigegeben",startFailed:"Druck konnte nicht gestartet werden",reorderFailed:"Warteschlange konnte nicht neu geordnet werden",historyCleared:"{{count}} Verlaufselement(e) gelöscht",clearHistoryFailed:"Verlauf konnte nicht gelöscht werden",updateFailed:"Elemente konnten nicht aktualisiert werden",bulkCancelled:"{{count}} Element(e) abgebrochen",bulkCancelFailed:"Elemente konnten nicht abgebrochen werden"},permissions:{noStopPrint:"Sie haben keine Berechtigung, Drucke zu stoppen",noStartPrint:"Sie haben keine Berechtigung, Drucke zu starten",noEdit:"Sie haben keine Berechtigung, dieses Warteschlangenelement zu bearbeiten",noCancel:"Sie haben keine Berechtigung, dieses Warteschlangenelement abzubrechen",noRequeue:"Sie haben keine Berechtigung, Elemente erneut einzureihen",noRemove:"Sie haben keine Berechtigung, dieses Warteschlangenelement zu entfernen",noClearHistory:"Sie haben keine Berechtigung, den gesamten Verlauf zu löschen",noEditItems:"Sie haben keine Berechtigung, Warteschlangenelemente zu bearbeiten",noCancelItems:"Sie haben keine Berechtigung, Warteschlangenelemente abzubrechen"}},backgroundDispatch:{unknownFile:"Unbekannte Datei",unknownPrinter:"Unbekannter Drucker",startingPrints:"Starte Drucke",progressSummary:"{{complete}}/{{total}} abgeschlossen • Geplant: {{dispatched}} • In Bearbeitung: {{processing}}",expandDetails:"Dispatch-Details ausklappen",collapseDetails:"Dispatch-Details einklappen",dismissToast:"Dispatch-Hinweis schließen",cancelDispatchJob:"Dispatch-Job abbrechen",cancel:"Abbrechen",cancelling:"Wird abgebrochen…",status:{dispatched:"Geplant",processing:"In Bearbeitung",completed:"Abgeschlossen",failed:"Fehlgeschlagen",cancelled:"Abgebrochen"},toast:{cancellingUpload:"Upload wird abgebrochen...",cancelled:"Dispatch abgebrochen",cancelFailed:"Dispatch konnte nicht abgebrochen werden",completeWithFailures:"Background Dispatch abgeschlossen: {{completed}} erfolgreich, {{failed}} fehlgeschlagen",completeSuccess:"Background Dispatch abgeschlossen: {{completed}} erfolgreich",printStartedRemaining:"{{completed}} Druck(e) gestartet, {{remaining}} weitere werden gesendet..."}},stats:{title:"Dashboard",subtitle:"Widgets zum Neuanordnen ziehen. Auf das Augensymbol klicken zum Ausblenden.",overview:"Übersicht",totalPrints:"Gesamtdrucke",successRate:"Erfolgsrate",totalPrintTime:"Gesamtdruckzeit",printTime:"Druckzeit",totalFilament:"Gesamtverbrauch Filament",filamentUsed:"Filamentverbrauch",filamentCost:"Filamentkosten",totalCost:"Gesamtkosten",energyUsed:"Energieverbrauch",energyCost:"Energiekosten",averagePrintTime:"Durchschnittliche Druckzeit",printsPerDay:"Drucke pro Tag",byPrinter:"Nach Drucker",printsByPrinter:"Drucke nach Drucker",byMaterial:"Nach Material",byMonth:"Nach Monat",last7Days:"Letzte 7 Tage",last30Days:"Letzte 30 Tage",last90Days:"Letzte 90 Tage",allTime:"Gesamt",quickStats:"Schnellstatistiken",printActivity:"Druckaktivität",filamentTypes:"Filamenttypen",filamentTrends:"Filamenttrends",failureAnalysis:"Fehleranalyse",timeAccuracy:"Zeitgenauigkeit",successful:"Erfolgreich:",failed:"Fehlgeschlagen:",perfectEstimate:"100% = perfekte Schätzung",noTimeAccuracyData:"Noch keine Zeitgenauigkeitsdaten",noFilamentData:"Keine Filamentdaten verfügbar",noPrinterData:"Keine Druckerdaten verfügbar",noPrintData:"Keine Druckdaten verfügbar",noPrintDataLast30Days:"Keine Druckdaten in den letzten 30 Tagen",failureReasons:"Fehlerursachen",topFailureReasons:"Häufigste Fehlerursachen",failedPrintsCount:"{{failed}} / {{total}} Drucke fehlgeschlagen",lastWeekRate:"Letzte Woche: {{rate}}%",resetLayout:"Layout zurücksetzen",recalculateCosts:"Kosten neu berechnen",recalculateCostsHint:"Alle Archivkosten mit aktuellen Filamentpreisen neu berechnen",exportStats:"Statistiken exportieren",exportAsCsv:"Als CSV exportieren",exportAsExcel:"Als Excel exportieren",hiddenCount:"{{count}} ausgeblendet",exportDownloaded:"Export heruntergeladen",exportFailed:"Export fehlgeschlagen",layoutReset:"Layout zurückgesetzt",recalculatedCosts:"Kosten für {{count}} Archive neu berechnet",recalculateFailed:"Kosten konnten nicht neu berechnet werden",loadingStats:"Statistiken werden geladen...",noPermissionResetLayout:"Sie haben keine Berechtigung, das Layout zurückzusetzen",noPermissionRecalculate:"Sie haben keine Berechtigung, Kosten neu zu berechnen",noPrintDataInRange:"Keine Druckdaten im ausgewählten Zeitraum",periodFilament:"Filamentverbrauch",periodCost:"Kosten",avgPerPrint:"Durchschnitt pro Druck",usageOverTime:"Verbrauch im Zeitverlauf",filamentByWeight:"Gewicht",printDuration:"Druckdauer",printerUtilization:"Druckerauslastung",filamentSuccess:"Erfolg nach Material",printHabits:"Druckgewohnheiten",printTimeOfDay:"Druck-Tageszeit",colorDistribution:"Farbverteilung",noColorData:"Keine Farbdaten verfügbar",records:"Rekorde",longestPrint:"Längster Druck",heaviestPrint:"Schwerster Druck",mostExpensivePrint:"Teuerster Druck",busiestDay:"Aktivster Tag",successStreak:"Erfolgsserie",streakPrint:"aufeinanderfolgender Druck",streakPrints:"{{count}} aufeinanderfolgende Drucke",printerStats:"Druckerstatistiken",hours:"Stunden",avgPrints:"Ø Drucke",noArchiveData:"Keine Druckdaten verfügbar",filamentByTime:"Zeitverlauf",avgWeight:"Ø Gewicht",avgTime:"Ø Zeit",filamentByPrints:"Drucke",timeframe:{today:"Heute","this-week":"Diese Woche","this-month":"Dieser Monat","last-7":"Letzte 7 Tage","last-30":"Letzte 30 Tage","last-90":"Letzte 90 Tage","this-year":"Dieses Jahr","all-time":"Gesamt",custom:"Benutzerdefiniert",from:"Von",to:"Bis"}},maintenance:{title:"Wartung",overview:"Übersicht",allOk:"Alle Wartungen aktuell",dueCount:"{{count}} Aufgabe fällig",dueCount_plural:"{{count}} Aufgaben fällig",warningCount:"{{count}} Warnung",warningCount_plural:"{{count}} Warnungen",totalPrintTime:"Gesamtdruckzeit",nextMaintenance:"Nächste Wartung",nothingDue:"Nichts fällig",tasks:"Aufgaben",lastPerformed:"Zuletzt durchgeführt",interval:"Intervall",hoursRemaining:"{{hours}}h verbleibend",hoursOverdue:"{{hours}}h überfällig",markDone:"Als erledigt markieren",performMaintenance:"Wartung durchführen",history:"Verlauf",noHistory:"Kein Wartungsverlauf",editPrintHours:"Druckstunden bearbeiten",currentHours:"Aktuelle Stunden",statusTab:"Status",settingsTab:"Einstellungen",overdueCount:"{{count}} überfällig",dueSoonCount:"{{count}} bald fällig",dueSoon:"Bald fällig",allGood:"Alles in Ordnung",overdueBy:"Überfällig um {{duration}}",dueIn:"Fällig in {{duration}}",timeLeft:"{{duration}} verbleibend",day:"1 Tag",days:"{{count}} Tage",week:"1 Woche",weeks:"{{count}} Wochen",month:"1 Monat",months:"{{count}} Monate",year:"1 Jahr",maintenanceTypes:"Wartungstypen",maintenanceTypesDescription:"Systemtypen und Ihre benutzerdefinierten Wartungsaufgaben",addCustomType:"Benutzerdefinierten Typ hinzufügen",restoreDefaults:"Standardaufgaben wiederherstellen",intervalType:"Intervalltyp",intervalValue:"Intervall ({{type}})",icon:"Symbol",documentationLink:"Dokumentationslink (optional)",assignToPrinters:"Druckern zuweisen",selectAtLeastOnePrinter:"Wählen Sie mindestens einen Drucker",addType:"Typ hinzufügen",custom:"Benutzerdefiniert",printHours:"Druckstunden",calendarDays:"Kalendertage",exampleName:"z.B. HEPA-Filter ersetzen",viewDocumentation:"Dokumentation anzeigen",timeBasedInterval:"Zeitbasiertes Intervall",intervalOverrides:"Intervall-Überschreibungen",intervalOverridesDescription:"Intervalle für bestimmte Drucker anpassen",assignedToPrinters:"Druckern zugewiesen:",noPrintersAssigned:"Keine Drucker zugewiesen",addPrinterShort:"Hinzufügen:",printersAssignedClick:"{{count}} Drucker zugewiesen - klicken zum Verwalten",removeFromPrinter:"Von diesem Drucker entfernen",types:{lubricateCarbonRods:"Karbonstäbe schmieren",lubricateRails:"Linearschienen schmieren",cleanNozzle:"Düse/Hotend reinigen",checkBelts:"Riemenspannung prüfen",cleanBuildPlate:"Druckbett reinigen",checkExtruder:"Extruderzahnräder prüfen",checkCooling:"Kühlungslüfter prüfen",generalInspection:"Allgemeine Inspektion",cleanCarbonRods:"Kohlenstoffstangen reinigen",lubricateSteelRods:"Stahlstangen schmieren",cleanSteelRods:"Stahlstangen reinigen",cleanLinearRails:"Linearschienen reinigen",checkPtfeTube:"PTFE-Schlauch prüfen",replaceHepaFilter:"HEPA-Filter ersetzen",replaceCarbonFilter:"Aktivkohlefilter ersetzen",lubricateLeftNozzleRail:"Linke Düsenschiene schmieren"},maintenanceComplete:"Wartung als abgeschlossen markiert",typeUpdated:"Wartungstyp aktualisiert",typeDeleted:"Wartungstyp gelöscht",defaultsRestored:"{{count}} Standardaufgabe(n) wiederhergestellt",printHoursUpdated:"Druckstunden aktualisiert",printerAssigned:"Drucker zugewiesen",printerRemoved:"Drucker entfernt",deleteTypeConfirm:'"{{name}}" löschen?',deleteSystemTypeTitle:"Standard-Wartungsaufgabe löschen?",deleteSystemTypeMessage:'Möchten Sie die Standard-Wartungsaufgabe "{{name}}" wirklich löschen?',noPermissionUpdate:"Sie haben keine Berechtigung, Wartungselemente zu aktualisieren",noPermissionPerform:"Sie haben keine Berechtigung, Wartungen durchzuführen",noPermissionEditTypes:"Sie haben keine Berechtigung, Wartungstypen zu bearbeiten",noPermissionDeleteTypes:"Sie haben keine Berechtigung, Wartungstypen zu löschen",noPermissionEditHours:"Sie haben keine Berechtigung, Druckstunden zu bearbeiten",noPermissionRemovePrinter:"Sie haben keine Berechtigung, Druckerzuweisungen zu entfernen",noPermissionAssignPrinter:"Sie haben keine Berechtigung, Drucker zuzuweisen",noPermissionEditIntervals:"Sie haben keine Berechtigung, Intervalle zu bearbeiten",configureSettings:"Wartungstypen und Intervalle konfigurieren"},settings:{title:"Einstellungen",general:"Allgemein",tabs:{general:"Allgemein",smartPlugs:"Smart Plugs",notifications:"Benachrichtigungen",filament:"Filament",network:"Netzwerk",apiKeys:"API-Schlüssel",virtualPrinter:"Virtueller Drucker",users:"Authentifizierung",backup:"Sicherung",emailAuth:"E-Mail-Authentifizierung"},email:{smtpSettings:"SMTP-Konfiguration",smtpHost:"SMTP-Server",smtpPort:"SMTP-Port",security:"Sicherheit",authentication:"Authentifizierung",username:"Benutzername",password:"Passwort",fromEmail:"Absender-E-Mail",fromName:"Absendername",testConnection:"SMTP-Verbindung testen",testRecipient:"Test-Empfänger-E-Mail",sendTest:"Test-E-Mail senden",sending:"Wird gesendet...",save:"Einstellungen speichern",saving:"Wird gespeichert...",advancedAuth:"Erweiterte Authentifizierung",advancedAuthEnabled:"Erweiterte Authentifizierung ist aktiviert",advancedAuthEnabledDesc:"E-Mail-basierte Benutzerverwaltungsfunktionen sind aktiv. Neue Benutzer erhalten automatisch generierte Passwörter per E-Mail und können ihr Passwort über die Passwort vergessen Funktion zurücksetzen.",advancedAuthDisabled:"Erweiterte Authentifizierung ist deaktiviert",advancedAuthDisabledDesc:"Aktivieren Sie die erweiterte Authentifizierung, um E-Mail-basierte Funktionen für die Benutzerverwaltung zu aktivieren.",enable:"Aktivieren",disable:"Deaktivieren",feature1:"Passwörter werden automatisch generiert und an neue Benutzer gesendet",feature2:"Benutzer können sich mit Benutzername oder E-Mail anmelden",feature3:"Passwort vergessen Funktion ist verfügbar",feature4:"Administratoren können Benutzerpasswörter per E-Mail zurücksetzen",errors:{requiredFields:"Bitte füllen Sie alle Pflichtfelder aus",usernameRequired:"Benutzername ist erforderlich, wenn Authentifizierung aktiviert ist",enterTestEmail:"Bitte geben Sie eine Test-E-Mail-Adresse ein",smtpServerAndEmail:"Bitte füllen Sie SMTP-Server und Absender-E-Mail aus, bevor Sie testen",usernamePasswordRequired:"Benutzername und Passwort sind erforderlich, wenn Authentifizierung aktiviert ist",configureSmtpFirst:"Bitte konfigurieren und testen Sie zuerst die SMTP-Einstellungen"},success:{settingsSaved:"SMTP-Einstellungen erfolgreich gespeichert"},securityOptions:{starttls:"STARTTLS (Port 587)",ssl:"SSL/TLS (Port 465)",none:"Keine (Port 25)"},authOptions:{enabled:"Aktiviert",disabled:"Deaktiviert"}},appearance:"Erscheinungsbild",notifications:"Benachrichtigungen",smartPlugs:"Smart Plugs",spoolman:"Spoolman",updates:"Updates",language:"Sprache",languageDescription:"Wählen Sie Ihre bevorzugte Sprache",theme:"Design",themeLight:"Hell",themeDark:"Dunkel",themeSystem:"System",defaultView:"Standardansicht",defaultViewDescription:"Seite, die beim Öffnen der App angezeigt wird",checkForUpdates:"Nach Updates suchen",autoUpdate:"Automatische Updates",currentVersion:"Aktuelle Version",latestVersion:"Neueste Version",upToDate:"Sie sind auf dem neuesten Stand",updateAvailable:"Update verfügbar",notificationLanguage:"Benachrichtigungssprache",notificationLanguageDescription:"Sprache für Push-Benachrichtigungen",bedCooledThreshold:"Bett-Abkühlung Schwellenwert",bedCooledThresholdDescription:"Temperatur, unter der das Bett nach einem Druck als abgekühlt gilt",notificationProviders:"Benachrichtigungsanbieter",addProvider:"Anbieter hinzufügen",editProvider:"Anbieter bearbeiten",providerType:"Anbietertyp",testNotification:"Testbenachrichtigung",testSuccess:"Testbenachrichtigung erfolgreich gesendet",testFailed:"Testbenachrichtigung konnte nicht gesendet werden",quietHours:"Ruhezeiten",quietHoursDescription:"Keine Störungen während dieser Zeiten",quietHoursStart:"Beginn",quietHoursEnd:"Ende",events:{title:"Benachrichtigungsereignisse",printStart:"Druck gestartet",printComplete:"Druck abgeschlossen",printFailed:"Druck fehlgeschlagen",printStopped:"Druck gestoppt",printProgress:"Fortschrittsmeldungen",printProgressDescription:"Bei 25%, 50%, 75% benachrichtigen",printerOffline:"Drucker offline",printerError:"Druckerfehler",filamentLow:"Filament niedrig",maintenanceDue:"Wartung fällig",maintenanceDueDescription:"Benachrichtigen, wenn Wartung erforderlich"},smartPlug:{title:"Smart Plugs",add:"Smart Plug hinzufügen",edit:"Smart Plug bearbeiten",name:"Name",ipAddress:"IP-Adresse",linkedPrinter:"Verknüpfter Drucker",autoOn:"Automatisch einschalten",autoOnDescription:"Einschalten beim Druckstart",autoOff:"Automatisch ausschalten",autoOffDescription:"Ausschalten nach Druckende",offDelay:"Ausschaltverzögerung",offDelayMinutes:"Minuten nach Druck",offDelayTemp:"Wenn Düse unter Temperatur",currentState:"Aktueller Status",turnOn:"Einschalten",turnOff:"Ausschalten"},filamentTracking:"Filament-Verfolgung",filamentTrackingDesc:"Wählen Sie, wie Sie Ihre Filamentspulen verfolgen möchten. Sie können das integrierte Inventar oder einen externen Spoolman-Server verwenden.",trackingModeBuiltIn:"Integriertes Inventar",trackingModeBuiltInDesc:"RFID-Erkennung und Verbrauchserfassung inklusive",trackingModeSpoolmanDesc:"Externer Filament-Management-Server",builtInFeatureRfid:"Erkennt automatisch Bambu Lab RFID-Spulen im AMS",builtInFeatureUsage:"Erfasst den Filamentverbrauch pro Druck",builtInFeatureCatalog:"Spulen, Farben und K-Faktor-Profile verwalten",builtInFeatureThirdParty:"Drittanbieter-Spulen können Inventarspulen zugewiesen werden",amsSyncButton:"Gewichte vom AMS synchronisieren",amsSyncTitle:"Spulengewichte vom AMS synchronisieren",amsSyncMessage:"Alle Inventar-Spulengewichte werden mit den aktuellen AMS-Restwerten der verbundenen Drucker überschrieben. Verwenden Sie dies zur Wiederherstellung beschädigter Gewichtsdaten. Drucker müssen online sein.",amsSyncing:"Synchronisiere...",amsSyncSuccess:"{{synced}} Spule(n) synchronisiert, {{skipped}} übersprungen",amsSyncError:"Synchronisierung der Gewichte vom AMS fehlgeschlagen",spoolmanUrl:"Spoolman URL",spoolmanUrlHint:"URL Ihres Spoolman-Servers (z.B. http://localhost:7912)",spoolmanConnected:"Verbunden",spoolmanDisconnected:"Nicht verbunden",status:"Status",connect:"Verbinden",disconnect:"Trennen",howSyncWorks:"So funktioniert die Synchronisierung",syncInfoRfidOnly:"Nur offizielle Bambu Lab Spulen mit RFID werden synchronisiert",syncInfoAutoCreate:"Neue Spulen werden bei der ersten Synchronisierung automatisch in Spoolman erstellt",syncInfoThirdPartySkipped:"Nicht-Bambu-Lab-Spulen (Drittanbieter, nachgefüllt) werden übersprungen",linkingExistingSpools:"Vorhandene Spulen verknüpfen",linkingExistingSpoolsDesc:'Um vorhandene Spoolman-Spulen mit Ihrem AMS zu verknüpfen, fahren Sie über einen AMS-Slot und klicken Sie auf "Mit Spoolman verknüpfen".',syncMode:"Synchronisierungsmodus",syncModeAuto:"Automatisch",syncModeManual:"Nur manuell",syncModeAutoDesc:"AMS-Daten werden automatisch synchronisiert, wenn Änderungen erkannt werden",syncModeManualDesc:"Nur bei manueller Auslösung synchronisieren",syncAmsData:"AMS-Daten synchronisieren",syncAmsDataDesc:"AMS-Daten des Druckers manuell mit Spoolman synchronisieren",allPrinters:"Alle Drucker",noDefaultPrinter:"Kein Standard (jedes Mal fragen)",sidebarOrder:"Seitenleisten-Reihenfolge",saveThumbnails:"Vorschaubilder speichern",captureFinishPhoto:"Abschlussfoto aufnehmen",noPrintersConfigured:"Keine Drucker konfiguriert",archiveMode:{always:"Immer Archiveintrag erstellen",never:"Nie Archiveintrag erstellen",ask:"Jedes Mal fragen"},checkForUpdatesLabel:"Nach Updates suchen",checkPrinterFirmware:"Drucker-Firmware prüfen",includeBetaUpdates:"Beta-Versionen einschließen",includeBetaUpdatesDesc:"Über Beta- und Vorabversionen bei der Updateprüfung benachrichtigen",enableRetry:"Wiederholung aktivieren",homeAssistantDescription:"Smart Plugs über Home Assistant steuern",environmentManagedLabel:"(Umgebungsvariable)",autoEnabledViaEnv:"Automatisch über Umgebungsvariablen aktiviert",urlFromEnvReadOnly:"Wert wird über HA_URL Umgebungsvariable gesetzt (schreibgeschützt)",tokenFromEnvReadOnly:"Wert wird über HA_TOKEN Umgebungsvariable gesetzt (schreibgeschützt)",mqttConnectedTo:"Verbunden mit",prometheusDescription:"Druckerdaten im Prometheus-Format bereitstellen",noSmartPlugsTitle:"Keine Smart Plugs konfiguriert",noSmartPlugsDescription:"Fügen Sie einen Tasmota-basierten Smart Plug hinzu, um den Energieverbrauch zu verfolgen und die Stromsteuerung zu automatisieren.",noProvidersTitle:"Keine Anbieter konfiguriert",noProvidersDescription:"Fügen Sie einen Anbieter hinzu, um Benachrichtigungen zu erhalten.",noTemplatesAvailable:"Keine Vorlagen verfügbar. Starten Sie das Backend neu, um Standardvorlagen zu laden.",apiPermissionView:"Druckerstatus und Warteschlange anzeigen",apiPermissionEdit:"Elemente zur Druckwarteschlange hinzufügen und entfernen",apiKeysEmptyTitle:"Keine API-Schlüssel",apiKeysEmptyDescription:"Erstellen Sie einen API-Schlüssel zur Integration mit externen Diensten.",noUsersFound:"Keine Benutzer gefunden",noGroupsFound:"Keine Gruppen gefunden",noGroupsAvailable:"Keine Gruppen verfügbar",passwordsDoNotMatch:"Passwörter stimmen nicht überein",systemGroupWarning:"System-Gruppennamen können nicht geändert werden",authDisabledTitle:"Authentifizierung ist deaktiviert",authDisabledFeature1:"Anmeldung zum Zugriff auf das System erforderlich",authDisabledFeature2:"Mehrere Benutzer mit gruppenbasierten Berechtigungen erstellen",authDisabledFeature3:"Zugriff mit über 50 granularen Berechtigungen steuern",userHasCreated:"Dieser Benutzer hat erstellt:",userItemsQuestion:"Was möchten Sie mit diesen Elementen tun?",deleteUserConfirm:"Möchten Sie diesen Benutzer wirklich löschen?",actionCannotBeUndone:"Diese Aktion kann nicht rückgängig gemacht werden.",addFirstSmartPlug:"Ersten Smart Plug hinzufügen",providers:"Anbieter",log:"Protokoll",testAll:"Alle testen",testResults:"Testergebnisse",testPassedCount:"{{count}} bestanden",testFailedCount:"{{count}} fehlgeschlagen",messageTemplates:"Nachrichtenvorlagen",messageTemplatesDescription:"Passen Sie Benachrichtigungen für jedes Ereignis an.",apiKeys:"API-Schlüssel",apiKeysDescription:"Erstellen Sie API-Schlüssel für externe Integrationen und Webhooks.",createKey:"Schlüssel erstellen",apiKeyCreated:"API-Schlüssel erfolgreich erstellt",apiKeyCopyWarning:"Kopieren Sie diesen Schlüssel jetzt - er wird nicht mehr angezeigt!",useInApiBrowser:"Im API-Browser verwenden",createNewApiKey:"Neuen API-Schlüssel erstellen",keyName:"Schlüsselname",keyNamePlaceholder:"z.B. Home Assistant, OctoPrint",readStatus:"Status lesen",readStatusDescription:"Druckerstatus und Warteschlange anzeigen",manageQueue:"Warteschlange verwalten",manageQueueDescription:"Elemente zur Druckwarteschlange hinzufügen und entfernen",controlPrinter:"Drucker steuern",controlPrinterDescription:"Drucke pausieren, fortsetzen und stoppen",unnamedKey:"Unbenannter Schlüssel",lastUsed:"Zuletzt verwendet",read:"Lesen",control:"Steuern",createFirstKey:"Ersten Schlüssel erstellen",webhookEndpoints:"Webhook-Endpunkte",webhookApiKeyHint:"Verwenden Sie Ihren API-Schlüssel im X-API-Key-Header.",webhook:{getAllStatus:"Alle Druckerstatus abrufen",getSpecificStatus:"Spezifischen Druckerstatus abrufen",addToQueue:"Zur Druckwarteschlange hinzufügen",pausePrint:"Druck pausieren",resumePrint:"Druck fortsetzen",stopPrint:"Druck stoppen"},apiBrowser:"API-Browser",apiBrowserDescription:"Erkunden und testen Sie alle verfügbaren API-Endpunkte.",apiKeyForTesting:"API-Schlüssel zum Testen",apiKeyPlaceholder:"Fügen Sie hier Ihren API-Schlüssel ein, um authentifizierte Endpunkte zu testen...",apiKeyHint:"Dieser Schlüssel wird als X-API-Key-Header mit Anfragen gesendet.",deleteApiKeyTitle:"API-Schlüssel löschen",deleteApiKeyMessage:"Möchten Sie diesen API-Schlüssel wirklich löschen? Alle Integrationen, die diesen Schlüssel verwenden, funktionieren nicht mehr.",deleteKey:"Schlüssel löschen",amsDisplayThresholds:"AMS-Anzeigeschwellenwerte",amsThresholdsDescription:"Konfigurieren Sie Farbschwellenwerte für AMS-Feuchtigkeits- und Temperaturanzeigen.",humidity:"Luftfeuchtigkeit",goodGreen:"Gut (grün)",fairOrange:"Mittel (orange)",aboveFairBad:"Über dem mittleren Schwellenwert wird rot angezeigt (schlecht)",temperature:"Temperatur",goodBlue:"Gut (blau)",aboveFairHot:"Über dem mittleren Schwellenwert wird rot angezeigt (heiß)",historyRetention:"Verlaufsaufbewahrung",keepSensorHistory:"Sensorverlauf behalten für",historyRetentionDescription:"Ältere Feuchtigkeits- und Temperaturdaten werden automatisch gelöscht",printModal:"Druckdialog",expandCustomMapping:"Benutzerdefinierte Zuordnung standardmäßig erweitern",expandCustomMappingDescription:"Bei Druck auf mehrere Drucker die AMS-Zuordnung pro Drucker erweitert anzeigen",authentication:"Authentifizierung",authEnabledDescription:"Ihre Instanz ist mit Benutzerauthentifizierung gesichert",authDisabledDescription:"Aktivieren Sie die Anmeldepflicht und verwalten Sie den Benutzerzugriff",authDisabledMessage:"Aktivieren Sie die Authentifizierung, um Benutzerkonten zu erstellen, Berechtigungen zu verwalten und Ihre Bambuddy-Instanz zu sichern.",enableAuthentication:"Authentifizierung aktivieren",currentUser:"Aktueller Benutzer",changePassword:"Passwort ändern",admin:"Admin",users:"Benutzer",addUser:"Benutzer hinzufügen",groups:"Gruppen",addGroup:"Gruppe hinzufügen",system:"System",noDescription:"Keine Beschreibung",userCount:"{{count}} Benutzer",permissionCount:"{{count}} Berechtigungen",createUser:"Benutzer erstellen",username:"Benutzername",enterUsername:"Benutzername eingeben",password:"Passwort",enterPassword:"Passwort eingeben (min. 6 Zeichen)",confirmPassword:"Passwort bestätigen",confirmPasswordPlaceholder:"Passwort bestätigen",viewReleaseOnGitHub:"Release auf GitHub anzeigen",turnAllPlugsOn:"Alle Stecker einschalten",turnAllPlugsOff:"Alle Stecker ausschalten",clearNotificationLogs:"Benachrichtigungsprotokolle löschen",clearLogsMessage:"Dadurch werden alle Benachrichtigungsprotokolle, die älter als 30 Tage sind, dauerhaft gelöscht. Diese Aktion kann nicht rückgängig gemacht werden.",clearLogs:"Protokolle löschen",resetUiPreferences:"UI-Einstellungen zurücksetzen",resetUiPreferencesMessage:"Dadurch werden alle UI-Einstellungen auf Standardwerte zurückgesetzt: Seitenleisten-Reihenfolge, Theme, Dashboard-Layout, Ansichtsmodi und Sortiereinstellungen. Ihre Drucker, Archive und Servereinstellungen werden NICHT beeinträchtigt. Die Seite wird nach dem Löschen neu geladen.",resetPreferences:"Einstellungen zurücksetzen",deleteGroupTitle:"Gruppe löschen",deleteGroupMessage:"Möchten Sie diese Gruppe wirklich löschen? Benutzer in dieser Gruppe verlieren diese Berechtigungen.",deleteGroup:"Gruppe löschen",disableAuthenticationTitle:"Authentifizierung deaktivieren",disableAuthenticationMessage:"Möchten Sie die Authentifizierung wirklich deaktivieren? Dadurch wird Ihre Bambuddy-Instanz ohne Anmeldung zugänglich. Alle Benutzer bleiben in der Datenbank, aber die Authentifizierung wird deaktiviert.",disableAuthentication:"Authentifizierung deaktivieren",configureBambuddy:"Bambuddy konfigurieren",systemDefault:"Systemstandard",archiveSettings:"Archiv-Einstellungen",newWindow:"Neues Fenster",embeddedOverlay:"Eingebettetes Overlay",preferredSlicer:"Bevorzugter Slicer",preferredSlicerDescription:"Wähle die Slicer-Anwendung zum Öffnen von Dateien",externalCameras:"Externe Kameras",costTracking:"Kostenverfolgung",printsOnly:"Nur Drucke",totalConsumption:"Gesamtverbrauch",dataManagement:"Datenverwaltung",storageUsage:"Speichernutzung",storageUsageDescription:"Aufschlüsselung der Datennutzung nach Kategorie",storageUsageTotal:"Gesamt",storageUsageErrors:"Fehler",storageUsageOtherBreakdown:"Sonstiges (enthält statische Assets, Skripte und Konfigurationsdateien)",storageUsageSystem:"System",storageUsageData:"Daten",storageUsageUnavailable:"Speichernutzungsinformationen nicht verfügbar",clearNotificationLogsDescription:"Benachrichtigungsprotokolle älter als 30 Tage löschen",resetUiPreferencesDescription:"Seitenleisten-Reihenfolge, Theme, Ansichtsmodi und Layout-Einstellungen zurücksetzen. Drucker, Archive und Einstellungen werden nicht beeinflusst.",enableHomeAssistant:"Home Assistant aktivieren",enableMqtt:"MQTT aktivieren",useTls:"TLS verwenden",enableMetricsEndpoint:"Metrik-Endpunkt aktivieren",availableMetrics:"Verfügbare Metriken",editUser:"Benutzer bearbeiten",deleteUserTitle:"Benutzer löschen",groupName:"Gruppenname",leaveEmptyForAnonymous:"Leer lassen für anonym",leaveEmptyForNoAuth:"Leer lassen für keine Authentifizierung",enterNewPassword:"Neues Passwort eingeben",confirmNewPassword:"Neues Passwort bestätigen",enterGroupName:"Gruppenname eingeben",enterDescriptionOptional:"Beschreibung eingeben (optional)",enterCurrentPassword:"Aktuelles Passwort eingeben",enterNewPasswordMin6:"Neues Passwort eingeben (min. 6 Zeichen)",toast:{keyCopied:"Schlüssel in Zwischenablage kopiert",copyFailed:"Schlüssel konnte nicht kopiert werden",keyAddedToBrowser:"Schlüssel zum API-Browser hinzugefügt",clearLogsFailed:"Protokolle konnten nicht gelöscht werden",uiPreferencesReset:"UI-Einstellungen zurückgesetzt. Wird neu geladen...",authDisabled:"Authentifizierung erfolgreich deaktiviert",authDisableFailed:"Authentifizierung konnte nicht deaktiviert werden",apiKeyCreated:"API-Schlüssel erstellt",apiKeyDeleted:"API-Schlüssel gelöscht",userCreated:"Benutzer erfolgreich erstellt",userUpdated:"Benutzer erfolgreich aktualisiert",userDeleted:"Benutzer erfolgreich gelöscht",groupCreated:"Gruppe erfolgreich erstellt",groupUpdated:"Gruppe erfolgreich aktualisiert",groupDeleted:"Gruppe erfolgreich gelöscht",fillRequiredFields:"Bitte füllen Sie alle erforderlichen Felder aus",passwordsDoNotMatch:"Passwörter stimmen nicht überein",passwordTooShort:"Passwort muss mindestens 6 Zeichen lang sein",enterGroupName:"Bitte geben Sie einen Gruppennamen ein",settingsSaved:"Einstellungen gespeichert",cameraSettingsSaved:"Kamera-Einstellungen gespeichert",enterCameraUrl:"Bitte geben Sie eine Kamera-URL ein",passwordChanged:"Passwort erfolgreich geändert",connectionFailed:"Verbindung fehlgeschlagen",testFailed:"Test fehlgeschlagen",cameraConnected:"Kamera verbunden{{resolution}}"},testConnection:"Verbindung testen",catalog:{spoolCatalog:"Spulenkatalog",spoolCatalogDescription:"Leerspulengewichte nach Marke/Typ. Wird für die automatische Gewichtssuche beim Hinzufügen von Spulen verwendet.",searchCatalog:"Katalog durchsuchen...",addNewEntry:"Neuen Eintrag hinzufügen",namePlaceholder:"Name (z.B. Bambu Lab - Plastik)",weight:"Gewicht",type:"Typ",default:"Standard",custom:"Benutzerdefiniert",noMatch:"Keine Einträge entsprechen Ihrer Suche",empty:"Keine Einträge im Katalog",deleteEntry:"Eintrag löschen",deleteConfirm:'Möchten Sie "{{name}}" wirklich löschen?',resetCatalog:"Katalog zurücksetzen",resetConfirm:"Katalog auf Standardwerte zurücksetzen? Alle benutzerdefinierten Einträge werden entfernt.",loadFailed:"Spulenkatalog konnte nicht geladen werden",nameWeightRequired:"Name und Gewicht sind erforderlich",entryAdded:"Eintrag hinzugefügt",addFailed:"Eintrag konnte nicht hinzugefügt werden",entryUpdated:"Eintrag aktualisiert",updateFailed:"Eintrag konnte nicht aktualisiert werden",entryDeleted:"Eintrag gelöscht",deleteFailed:"Eintrag konnte nicht gelöscht werden",resetSuccess:"Katalog auf Standardwerte zurückgesetzt",resetFailed:"Katalog konnte nicht zurückgesetzt werden",exported:"{{count}} Einträge exportiert",imported:"{{added}} Einträge importiert ({{skipped}} übersprungen)",importFailed:"Import fehlgeschlagen: ungültiges JSON-Format",exportTooltip:"Katalog als JSON exportieren",importTooltip:"Katalog aus JSON importieren",resetTooltip:"Auf Standardwerte zurücksetzen",selectedCount:"{{count}} ausgewählt",deleteSelected:"Ausgewählte löschen",bulkDeleteConfirm:"Möchten Sie {{count}} Einträge wirklich löschen?",bulkDeleted:"{{count}} Einträge gelöscht",bulkDeleteFailed:"Fehler beim Löschen der Einträge"},colorCatalog:{title:"Farbkatalog",description:"Filamentfarben nach Hersteller/Material. Wird für die automatische Farbsuche beim Hinzufügen von Spulen verwendet.",searchColors:"Farben durchsuchen...",allManufacturers:"Alle Hersteller",addNewColor:"Neue Farbe hinzufügen",manufacturer:"Hersteller",colorName:"Farbname",hex:"Hex",materialOptional:"Material (optional)",showing:"{{filtered}} von {{total}} Farben angezeigt",noMatch:"Keine Farben entsprechen Ihrer Suche",empty:"Keine Farben im Katalog",deleteColor:"Farbe löschen",deleteConfirm:'Möchten Sie "{{name}}" wirklich löschen?',resetCatalog:"Farbkatalog zurücksetzen",resetConfirm:"Katalog auf Standardwerte zurücksetzen? Alle benutzerdefinierten Farben werden entfernt.",sync:"Sync",starting:"Starten...",syncTooltip:"Von FilamentColors.xyz synchronisieren (2000+ Farben)",loadFailed:"Farbkatalog konnte nicht geladen werden",fieldsRequired:"Hersteller, Farbname und Hex-Farbe sind erforderlich",colorAdded:"Farbe hinzugefügt",addFailed:"Farbe konnte nicht hinzugefügt werden",colorUpdated:"Farbe aktualisiert",updateFailed:"Farbe konnte nicht aktualisiert werden",colorDeleted:"Farbe gelöscht",deleteFailed:"Farbe konnte nicht gelöscht werden",resetSuccess:"Farbkatalog auf Standardwerte zurückgesetzt",resetFailed:"Katalog konnte nicht zurückgesetzt werden",syncUpToDate:"Bereits aktuell ({{count}} Farben geprüft)",syncComplete:"{{added}} neue Farben hinzugefügt ({{skipped}} bereits vorhanden)",syncError:"Sync-Fehler",syncFailed:"Synchronisierung von FilamentColors.xyz fehlgeschlagen",exported:"{{count}} Farben exportiert",imported:"{{added}} Farben importiert ({{skipped}} übersprungen)",importFailed:"Import fehlgeschlagen: ungültiges JSON-Format",selectedCount:"{{count}} ausgewählt",deleteSelected:"Ausgewählte löschen",bulkDeleteConfirm:"Möchten Sie {{count}} Farben wirklich löschen?",bulkDeleted:"{{count}} Farben gelöscht",bulkDeleteFailed:"Fehler beim Löschen der Farben"},dateFormat:"Datumsformat",dateFormatUs:"US (MM/TT/JJJJ)",dateFormatEu:"EU (TT/MM/JJJJ)",dateFormatIso:"ISO (JJJJ-MM-TT)",timeFormat:"Zeitformat",timeFormat12:"12-Stunden (3:30 PM)",timeFormat24:"24-Stunden (15:30)",defaultPrinter:"Standarddrucker",defaultPrinterDescription:"Diesen Drucker für Uploads, Nachdrucke und andere Vorgänge vorauswählen.",slicerBambuStudio:"Bambu Studio",slicerOrcaSlicer:"OrcaSlicer",sidebarOrderDescription:"Elemente in der Seitenleiste per Drag & Drop neu anordnen. Hier auf Standardreihenfolge zurücksetzen.",reset:"Zurücksetzen",darkMode:"Dunkelmodus",lightMode:"Hellmodus",active:"(aktiv)",background:"Hintergrund",accent:"Akzent",style:"Stil",bgNeutral:"Neutral",bgWarm:"Warm",bgCool:"Kühl",bgOled:"OLED Schwarz",bgSlate:"Schieferblau",bgForest:"Waldgrün",accentGreen:"Grün",accentTeal:"Türkis",accentBlue:"Blau",accentOrange:"Orange",accentPurple:"Lila",accentRed:"Rot",styleClassic:"Klassisch",styleGlow:"Leuchtend",styleVibrant:"Lebendig",themeToggleHint:"Zwischen Hell- und Dunkelmodus mit dem Sonnen-/Mondsymbol in der Seitenleiste wechseln.",autoArchivePrints:"Drucke automatisch archivieren",autoArchiveDescription:"3MF-Dateien automatisch speichern, wenn Drucke abgeschlossen sind",saveThumbnailsDescription:"Vorschaubilder aus 3MF-Dateien extrahieren und speichern",captureFinishPhotoDescription:"Foto von der Druckerkamera aufnehmen, wenn der Druck abgeschlossen ist",ffmpegNotInstalled:"ffmpeg nicht installiert",ffmpegRequired:"Kameraaufnahme benötigt ffmpeg. Installieren über <brew>brew install ffmpeg</brew> (macOS) oder <apt>apt install ffmpeg</apt> (Linux).",camera:"Kamera",cameraViewMode:"Kamera-Ansichtsmodus",cameraOverlayDescription:"Kamera öffnet sich als größenveränderbares Overlay auf dem Hauptbildschirm",cameraWindowDescription:"Kamera öffnet sich in einem separaten Browserfenster",externalCamerasDescription:"Externe Kameras konfigurieren, um die eingebaute Druckerkamera zu ersetzen. Unterstützt MJPEG-Streams, RTSP, HTTP-Snapshots und USB-Kameras (V4L2). Wenn aktiviert, wird die externe Kamera für Live-Ansicht und Abschlussfotos verwendet.",cameraPlaceholderUsb:"Gerätepfad (/dev/video0)",cameraPlaceholderUrl:"Kamera-URL (rtsp://... oder http://...)",cameraTypeMjpeg:"MJPEG-Stream",cameraTypeRtsp:"RTSP-Stream",cameraTypeSnapshot:"HTTP-Snapshot",cameraTypeUsb:"USB-Kamera (V4L2)",test:"Testen",connected:"Verbunden",disconnected:"Getrennt",currency:"Währung",defaultFilamentCost:"Standard-Filamentkosten (pro kg)",electricityCost:"Stromkosten pro kWh",energyDisplayMode:"Energieanzeige-Modus",energyModePrintDescription:"Dashboard zeigt Summe der während Drucken verbrauchten Energie",energyModeTotalDescription:"Dashboard zeigt Gesamtenergie der Smart Plugs",fileManager:"Dateimanager",createArchiveEntry:"Archiveintrag beim Drucken erstellen",createArchiveEntryDescription:"Beim Drucken aus dem Dateimanager optional einen Archiveintrag erstellen",lowDiskSpaceWarning:"Warnung bei wenig Speicherplatz",lowDiskSpaceDescription:"Warnung anzeigen, wenn freier Speicherplatz unter diesen Schwellenwert fällt",printerFirmware:"Drucker-Firmware",checkFirmwareDescription:"Nach Firmware-Updates von Bambu Lab suchen",bambuddySoftware:"Bambuddy Software",autoCheckDescription:"Automatisch beim Start nach neuen Versionen suchen",checkNow:"Jetzt prüfen",updateAvailableVersion:"Update verfügbar: v{{version}}",releaseNotes:"Versionshinweise",updateViaDocker:"Update über Docker Compose:",installUpdate:"Update installieren",latestVersionRunning:"Sie verwenden die neueste Version",failedToCheckUpdates:"Update-Prüfung fehlgeschlagen: {{error}}",backupRestore:"Sicherung & Wiederherstellung",backupRestoreDescription:"Einstellungen exportieren/importieren und GitHub-Backup konfigurieren",goToBackup:"Zur Sicherung",externalUrl:"Externe URL",externalUrlDescription:"Die externe URL, unter der Bambuddy erreichbar ist. Wird für Benachrichtigungsbilder und externe Integrationen verwendet.",bambuddyUrl:"Bambuddy-URL",externalUrlHint:"Protokoll und Port angeben (z.B. http://192.168.1.100:8000)",ftpRetry:"FTP-Wiederholung",ftpRetryDescription:"FTP-Operationen bei unzuverlässigem Drucker-WLAN wiederholen. Gilt für 3MF-Downloads, Druck-Uploads, Zeitraffer-Downloads und Firmware-Updates.",autoRetryDescription:"Fehlgeschlagene FTP-Operationen automatisch wiederholen",retryAttempts:"Wiederholungsversuche",retryDelay:"Wiederholungsverzögerung",connectionTimeout:"Verbindungs-Timeout",time_one:"{{count}} Mal",time_other:"{{count}} Mal",second_one:"{{count}} Sekunde",second_other:"{{count}} Sekunden",nSeconds:"{{count}} Sekunden",increaseForWeakWifi:"Erhöhen für Drucker mit schwachem WLAN",homeAssistant:"Home Assistant",homeAssistantFullDescription:"Mit Home Assistant verbinden, um Smart Plugs über die HA REST-API zu steuern. Unterstützt Switch-, Light-, Input_Boolean- und Script-Entitäten.",homeAssistantUrl:"Home Assistant URL",longLivedAccessToken:"Langlebiges Zugriffstoken",haTokenHint:"Token in HA erstellen: Profil → Langlebige Zugriffstoken → Token erstellen",connectionSuccessful:"Verbindung erfolgreich",connectionFailed:"Verbindung fehlgeschlagen",haConnectionSuccess:"Erfolgreich mit Home Assistant verbunden.",haConnectionFailed:"Verbindung zu Home Assistant fehlgeschlagen.",mqttPublishing:"MQTT-Veröffentlichung",mqttDescription:"BamBuddy-Ereignisse an einen externen MQTT-Broker zur Integration mit Node-RED, Home Assistant und anderen Automatisierungssystemen veröffentlichen.",mqttEnableDescription:"Ereignisse an externen MQTT-Broker veröffentlichen",brokerHostname:"Broker-Hostname",port:"Port",usernameOptional:"Benutzername (optional)",passwordOptional:"Passwort (optional)",topicPrefix:"Topic-Präfix",topicPrefixHint:"Topics werden sein: {{prefix}}/printers/<serial>/status, etc.",prometheusMetrics:"Prometheus-Metriken",prometheusEndpointDescription:"Druckermetriken unter <code>/api/v1/metrics</code> für Prometheus/Grafana-Überwachung bereitstellen.",bearerTokenOptional:"Bearer-Token (optional)",bearerTokenHint:"Wenn gesetzt, müssen Anfragen <code>Authorization: Bearer <token></code> enthalten",metricsConnectionStatus:"Verbindungsstatus",metricsPrinterState:"Druckerstatus (idle/printing/etc)",metricsPrintProgress:"Druckfortschritt 0-100%",metricsBedTemp:"Betttemperatur",metricsNozzleTemp:"Düsentemperatur",metricsPrintsTotal:"Gesamtdrucke nach Ergebnis",metricsMore:"...und mehr (Schichten, Lüfter, Warteschlange, Filamentverbrauch)",smartPlugsDescription:"Smart Plugs (Tasmota oder Home Assistant) verbinden, um Stromsteuerung zu automatisieren und Energieverbrauch für Ihre Drucker zu verfolgen.",allOn:"Alle Ein",allOff:"Alle Aus",addSmartPlug:"Smart Plug hinzufügen",energySummary:"Energieübersicht",currentPower:"Aktuelle Leistung",plugsOnline:"{{reachable}}/{{total}} Plugs online",today:"Heute",yesterday:"Gestern",total:"Gesamt",enablePlugsForSummary:"Plugs aktivieren, um Energieübersicht zu sehen",addNotificationProvider:"Hinzufügen",systemBadge:"(System)",creating:"Erstellen...",changing:"Ändern...",deleteUserAndItems:"Benutzer UND dessen Elemente löschen",deleteUserKeepItems:"Benutzer löschen, Elemente behalten (werden herrenlos)",ok:"OK"},notification:{printStarted:{title:"Druck gestartet",body:"{{printer}}: {{filename}} wird gedruckt"},printCompleted:{title:"Druck abgeschlossen",body:"{{printer}}: {{filename}} erfolgreich abgeschlossen"},printFailed:{title:"Druck fehlgeschlagen",body:"{{printer}}: {{filename}} ist fehlgeschlagen"},printStopped:{title:"Druck gestoppt",body:"{{printer}}: {{filename}} wurde gestoppt"},printProgress:{title:"Druckfortschritt",body:"{{printer}}: {{filename}} ist zu {{percent}}% abgeschlossen"},printerOffline:{title:"Drucker offline",body:"{{printer}} ist offline"},printerError:{title:"Druckerfehler",body:"{{printer}}: {{error}}"},filamentLow:{title:"Filament niedrig",body:"{{printer}}: Filament geht zur Neige"},maintenanceDue:{title:"Wartung fällig",body:"{{printer}}: {{items}} benötigen Aufmerksamkeit"}},errors:{generic:"Etwas ist schiefgelaufen",networkError:"Netzwerkfehler. Bitte überprüfen Sie Ihre Verbindung.",notFound:"Nicht gefunden",unauthorized:"Nicht autorisiert",serverError:"Serverfehler",validationError:"Bitte überprüfen Sie Ihre Eingabe",printerConnectionFailed:"Verbindung zum Drucker fehlgeschlagen",saveFailed:"Speichern fehlgeschlagen",deleteFailed:"Löschen fehlgeschlagen",loadFailed:"Laden der Daten fehlgeschlagen"},hmsErrors:{title:"Fehler - {{name}}",noErrors:"Keine Fehler",viewOnWiki:"Im Bambu Lab Wiki ansehen",clearInstructions:"Löschen Sie die Fehler am Drucker, um sie hier zu entfernen.",clearErrors:"Fehler löschen",clearSuccess:"HMS-Fehler gelöscht",clearFailed:"HMS-Fehler konnten nicht gelöscht werden"},mqttDebug:{title:"MQTT-Debug-Protokoll",searchPlaceholder:"Topic oder Payload suchen...",noMessages:"Noch keine Nachrichten protokolliert",startLoggingHint:'Klicken Sie auf "Protokollierung starten", um MQTT-Nachrichten aufzuzeichnen',noMessagesMatch:"Keine Nachrichten entsprechen Ihrem Filter",adjustFilterHint:"Versuchen Sie, Ihre Such- oder Filterkriterien anzupassen",incoming:"Eingehend",outgoing:"Ausgehend",loggingStopped:"Protokollierung gestoppt",loggingActive:"Protokollierung aktiv - Nachrichten werden automatisch aktualisiert",startLogging:"Protokollierung starten",stopLogging:"Protokollierung stoppen",clearLog:"Protokoll löschen",topic:"Topic",timestamp:"Zeitstempel",direction:"Richtung",all:"Alle"},printerFiles:{title:"Dateimanager",storageUsed:"Belegt:",storageFree:"Frei:",filterPlaceholder:"Dateien filtern...",deleteButton:"Löschen",deleteFiles:"{{count}} Dateien löschen",deleteFileConfirm:'"{{name}}" löschen? Dies kann nicht rückgängig gemacht werden.',deleteFilesConfirm:"{{count}} ausgewählte Dateien löschen? Dies kann nicht rückgängig gemacht werden.",noFiles:"Keine Dateien auf dem Drucker",loadingFiles:"Dateien werden geladen...",failedToLoad:"Dateien konnten nicht geladen werden",toast:{filesDeleted:"{{count}} Datei(en) gelöscht",deleteFailed:"Löschen fehlgeschlagen: {{error}}"}},confirm:{delete:"Möchten Sie dies wirklich löschen?",unsavedChanges:"Sie haben ungespeicherte Änderungen. Möchten Sie wirklich verlassen?",clearQueue:"Möchten Sie die Warteschlange wirklich leeren?"},login:{title:"Bambuddy Anmeldung",subtitle:"Melden Sie sich bei Ihrem Konto an",username:"Benutzername",usernamePlaceholder:"Benutzername eingeben",usernameOrEmail:"Benutzername oder E-Mail",usernameOrEmailPlaceholder:"Benutzername oder @ E-Mail",password:"Passwort",passwordPlaceholder:"Passwort eingeben",signIn:"Anmelden",signingIn:"Anmeldung läuft...",forgotPassword:"Passwort vergessen?",loginSuccess:"Erfolgreich angemeldet",loginFailed:"Anmeldung fehlgeschlagen",enterCredentials:"Bitte Benutzername und Passwort eingeben",forgotPasswordTitle:"Passwort vergessen",forgotPasswordMessage:"Wenn Sie Ihr Passwort vergessen haben, wenden Sie sich bitte an Ihren Systemadministrator.",forgotPasswordEmailMessage:"Geben Sie Ihre E-Mail-Adresse ein und wir senden Ihnen ein neues Passwort.",emailAddress:"E-Mail-Adresse",emailPlaceholder:"ihre.email@beispiel.de",cancel:"Abbrechen",sending:"Wird gesendet...",sendResetEmail:"Zurücksetzungs-E-Mail senden",howToReset:"So setzen Sie Ihr Passwort zurück:",resetStep1:"Kontaktieren Sie Ihren Bambuddy-Administrator",resetStep2:"Bitten Sie ihn, Ihr Passwort in der Benutzerverwaltung zurückzusetzen",resetStep3:"Er kann ein neues temporäres Passwort für Sie festlegen",resetStep4:"Melden Sie sich mit dem neuen Passwort an und ändern Sie es in den Einstellungen",gotIt:"Verstanden"},setup:{title:"Bambuddy Einrichtung",subtitle:"Konfigurieren Sie die Authentifizierung für Ihre Bambuddy-Instanz",enableAuth:"Authentifizierung aktivieren",adminAccount:"Admin-Konto",adminAccountDesc:"Wenn bereits Admin-Benutzer existieren, wird die Authentifizierung mit den vorhandenen Admin-Konten aktiviert. Lassen Sie die Felder unten leer, um vorhandene Admins zu verwenden, oder geben Sie neue Anmeldedaten ein, um einen neuen Admin-Benutzer zu erstellen.",adminUsername:"Admin-Benutzername",adminPassword:"Admin-Passwort",optionalIfAdminExists:"(optional, wenn Admin-Benutzer existieren)",adminUsernamePlaceholder:"Admin-Benutzernamen eingeben (optional)",adminPasswordPlaceholder:"Admin-Passwort eingeben (optional)",confirmPassword:"Passwort bestätigen",confirmPasswordPlaceholder:"Admin-Passwort bestätigen",settingUp:"Einrichtung läuft...",completeSetup:"Einrichtung abschließen",toast:{authEnabledAdminCreated:"Authentifizierung aktiviert und Admin-Benutzer erstellt",authEnabledExistingAdmins:"Authentifizierung mit vorhandenen Admin-Benutzern aktiviert",setupCompleted:"Einrichtung abgeschlossen",enterBothCredentials:"Bitte geben Sie sowohl Admin-Benutzernamen als auch Passwort ein, oder lassen Sie beide leer, um vorhandene Admin-Benutzer zu verwenden",passwordsDoNotMatch:"Passwörter stimmen nicht überein",passwordTooShort:"Passwort muss mindestens 6 Zeichen lang sein"}},changePassword:{title:"Passwort ändern",currentPassword:"Aktuelles Passwort",currentPasswordPlaceholder:"Aktuelles Passwort eingeben",newPassword:"Neues Passwort",newPasswordPlaceholder:"Neues Passwort eingeben (min. 6 Zeichen)",confirmPassword:"Neues Passwort bestätigen",confirmPasswordPlaceholder:"Neues Passwort bestätigen",passwordsDoNotMatch:"Passwörter stimmen nicht überein",passwordTooShort:"Passwort muss mindestens 6 Zeichen lang sein",changing:"Wird geändert...",success:"Passwort erfolgreich geändert",failed:"Passwortänderung fehlgeschlagen"},plateAlert:{title:"Druck pausiert!",message:"Objekte auf dem Druckbett erkannt. Der Druck wurde automatisch pausiert. Bitte räumen Sie das Druckbett und setzen Sie den Druck fort.",understand:"Verstanden"},camera:{title:"Kameraansicht",invalidPrinterId:"Ungültige Drucker-ID",live:"Live",snapshot:"Schnappschuss",restartStream:"Stream neu starten",refreshSnapshot:"Schnappschuss aktualisieren",fullscreen:"Vollbild",exitFullscreen:"Vollbild beenden",connectingToCamera:"Verbinde mit Kamera...",capturingSnapshot:"Schnappschuss wird aufgenommen...",connectionLost:"Verbindung verloren",connectionFailed:"Kameraverbindung fehlgeschlagen",reconnecting:"Neuverbindung in {{countdown}}s... (Versuch {{attempt}}/{{max}})",reconnectNow:"Jetzt verbinden",cameraUnavailable:"Kamera nicht verfügbar",cameraUnavailableDesc:"Stellen Sie sicher, dass der Drucker eingeschaltet und verbunden ist.",noCamera:"Keine Kamera verfügbar",retry:"Erneut versuchen",cameraStream:"Kamera-Stream",zoomOut:"Verkleinern",zoomIn:"Vergrößern",resetZoom:"Zoom zurücksetzen",recording:"Aufnahme",startRecording:"Aufnahme starten",stopRecording:"Aufnahme stoppen",chamberLight:"Kammerbeleuchtung umschalten"},groups:{title:"Gruppenverwaltung",subtitle:"Berechtigungsgruppen für Zugriffskontrolle verwalten",backToSettings:"Zurück zu Einstellungen",createGroup:"Gruppe erstellen",noPermission:"Sie haben keine Berechtigung, auf diese Seite zuzugreifen.",system:"System",noDescription:"Keine Beschreibung",usersCount:"{{count}} Benutzer",permissionsCount:"{{count}} Berechtigungen",edit:"Bearbeiten",delete:"Löschen",toast:{created:"Gruppe erfolgreich erstellt",updated:"Gruppe erfolgreich aktualisiert",deleted:"Gruppe erfolgreich gelöscht",enterGroupName:"Bitte geben Sie einen Gruppennamen ein"},modal:{editGroup:"Gruppe bearbeiten",createGroup:"Gruppe erstellen",cancel:"Abbrechen",saving:"Speichern...",creating:"Erstellen...",saveChanges:"Änderungen speichern"},form:{groupName:"Gruppenname",groupNamePlaceholder:"Gruppennamen eingeben",systemGroupWarning:"Systemgruppennamen können nicht geändert werden",description:"Beschreibung",descriptionPlaceholder:"Beschreibung eingeben (optional)",permissions:"Berechtigungen ({{count}} ausgewählt)"},deleteModal:{title:"Gruppe löschen",message:"Sind Sie sicher, dass Sie diese Gruppe löschen möchten? Benutzer in dieser Gruppe verlieren diese Berechtigungen.",confirm:"Gruppe löschen"},editor:{title:"Gruppe bearbeiten",createTitle:"Gruppe erstellen",search:"Berechtigungen suchen...",selectAll:"Alle auswählen",clearAll:"Alle abwählen",permissionsSelected:"{{count}} ausgewählt",noResults:"Keine Berechtigungen entsprechen Ihrer Suche"}},users:{title:"Benutzerverwaltung",subtitle:"Benutzer und deren Zugriff auf Ihre Bambuddy-Instanz verwalten",backToSettings:"Zurück zu Einstellungen",createUser:"Benutzer erstellen",noPermission:"Sie haben keine Berechtigung, auf diese Seite zuzugreifen.",admin:"Admin",noGroups:"Keine Gruppen",active:"Aktiv",inactive:"Inaktiv",edit:"Bearbeiten",delete:"Löschen",system:"System",noGroupsAvailable:"Keine Gruppen verfügbar",table:{username:"Benutzername",groups:"Gruppen",status:"Status",actions:"Aktionen"},toast:{created:"Benutzer erfolgreich erstellt",updated:"Benutzer erfolgreich aktualisiert",deleted:"Benutzer erfolgreich gelöscht",fillRequired:"Bitte füllen Sie alle Pflichtfelder aus",passwordsDoNotMatch:"Passwörter stimmen nicht überein",passwordTooShort:"Passwort muss mindestens 6 Zeichen lang sein"},modal:{createUser:"Benutzer erstellen",editUser:"Benutzer bearbeiten",cancel:"Abbrechen",creating:"Erstellen...",saving:"Speichern...",saveChanges:"Änderungen speichern",advancedAuthSubtitle:"mit erweiterter Authentifizierung"},form:{username:"Benutzername",usernamePlaceholder:"Benutzernamen eingeben",email:"E-Mail",emailPlaceholder:"benutzer@beispiel.de",password:"Passwort",passwordPlaceholder:"Passwort eingeben",confirmPassword:"Passwort bestätigen",confirmPasswordPlaceholder:"Passwort bestätigen",newPasswordPlaceholder:"Neues Passwort eingeben",confirmNewPasswordPlaceholder:"Neues Passwort bestätigen",leaveBlankToKeep:"leer lassen, um das aktuelle zu behalten",groups:"Gruppen",optional:"optional",autoGeneratedPassword:"Ein sicheres Passwort wird automatisch generiert und per E-Mail an den Benutzer gesendet.",passwordManagedByAdvancedAuth:'Das Passwort wird durch erweiterte Authentifizierung verwaltet. Verwenden Sie "Passwort zurücksetzen", um ein neues Passwort per E-Mail an den Benutzer zu senden.',resetPassword:"Passwort zurücksetzen",resettingPassword:"Passwort wird zurückgesetzt..."},deleteModal:{title:"Benutzer löschen",message:"Sind Sie sicher, dass Sie diesen Benutzer löschen möchten? Diese Aktion kann nicht rückgängig gemacht werden.",confirm:"Benutzer löschen"}},streamOverlay:{title:"Stream-Overlay",invalidPrinterId:"Ungültige Drucker-ID",cameraStream:"Kamera-Stream",progress:"Fortschritt",eta:"ETA",printerIdle:"Drucker ist inaktiv",printerOffline:"Drucker offline",status:{printing:"Druckt",paused:"Pausiert",finished:"Fertig",failed:"Fehlgeschlagen",idle:"Inaktiv",unknown:"Unbekannt"}},profiles:{title:"Profile",subtitle:"Verwalten Sie Ihre Slicer-Voreinstellungen und Druckvorschub-Kalibrierungen",tabs:{cloud:"Cloud-Profile",local:"Lokale Profile",kprofiles:"K-Profile"},localProfiles:{title:"Lokale Profile",subtitle:"Slicer-Voreinstellungen aus OrcaSlicer importieren und verwalten",import:"Profile importieren",importDesc:".bbscfg-, .bbsflmt-, .orca_filament-, .zip- oder .json-Dateien hier ablegen",importing:"Importiere...",search:"Lokale Voreinstellungen durchsuchen...",noPresets:"Noch keine lokalen Voreinstellungen",badge:"Lokal",edit:"Bearbeiten",delete:"Löschen",cancel:"Abbrechen",deleteConfirmTitle:"Voreinstellung löschen",deleteConfirm:"Möchten Sie diese Voreinstellung wirklich löschen? Dies kann nicht rückgängig gemacht werden.",source:"Quelle",inheritsFrom:"Erbt von",filamentType:"Typ",vendor:"Hersteller",compatiblePrinters:"Drucker",nozzleTemp:"Düsentemperatur",cost:"Kosten",density:"Dichte",pressureAdvance:"Druckvorschub",filament:"Filament",process:"Prozess",printer:"Drucker",toast:{importSuccess:"{{count}} Voreinstellung(en) importiert",importSkipped:"{{count}} Voreinstellung(en) übersprungen (Duplikate)",importError:"{{count}} Fehler beim Import",deleted:"Voreinstellung gelöscht",updated:"Voreinstellung aktualisiert"}},connectedAs:"Verbunden als",logout:"Abmelden",noLogoutPermission:"Sie haben keine Berechtigung zum Abmelden",failedToLoad:"Profile konnten nicht geladen werden",retry:"Erneut versuchen",time:{justNow:"Gerade eben",minsAgo:"vor {{count}}m",hoursAgo:"vor {{count}}h",daysAgo:"vor {{count}}d"},toast:{loggedOut:"Abgemeldet"},login:{title:"Mit Bambu Cloud verbinden",subtitle:"Synchronisieren Sie Ihre Slicer-Voreinstellungen geräteübergreifend",email:"E-Mail",password:"Passwort",region:"Region",regionGlobal:"Global",regionChina:"China",verificationCode:"Bestätigungscode",totpCode:"Authenticator-Code",checkEmail:"Prüfen Sie Ihre E-Mail ({{email}}) für einen 6-stelligen Code",enterTotpHint:"Geben Sie den 6-stelligen Code aus Ihrer Authenticator-App ein",accessToken:"Zugriffstoken",accessTokenHint:"Fügen Sie Ihr Bambu Lab Zugriffstoken ein (aus Bambu Studio)",back:"Zurück",loginButton:"Anmelden",verifyButton:"Bestätigen",setTokenButton:"Token setzen",useToken:"Stattdessen Zugriffstoken verwenden",useEmail:"Stattdessen mit E-Mail anmelden",toast:{loggedIn:"Erfolgreich angemeldet",codeSent:"Bestätigungscode an Ihre E-Mail gesendet",enterTotp:"Geben Sie den Code aus Ihrer Authenticator-App ein",tokenSet:"Token erfolgreich gesetzt"}},presets:{myPreset:"Mein Profil (bearbeitbar)",duplicate:"Duplizieren",editable:"Bearbeitbar",failedToLoadDetails:"Profil-Details konnten nicht geladen werden",deleteConfirm:"Dieses Profil löschen?",deleteWarning:'"{{name}}" wird dauerhaft aus Bambu Cloud gelöscht. Dies kann nicht rückgängig gemacht werden.',noDuplicatePermission:"Sie haben keine Berechtigung zum Duplizieren von Profilen",noEditPermission:"Sie haben keine Berechtigung zum Bearbeiten von Profilen",noDeletePermission:"Sie haben keine Berechtigung zum Löschen von Profilen",types:{filament:"Filament-Profil",printer:"Drucker-Profil",process:"Prozess-Profil"},toast:{deleted:"Profil gelöscht",created:"Profil erstellt",updated:"Profil aktualisiert",duplicated:"Profil dupliziert",fieldAdded:'Feld "{{key}}" hinzugefügt',exported:"Profil exportiert"},baseLabel:"Basis: {{name}}",currentLabel:"Aktuell: {{name}}",newPreset:"Neues Profil",editPreset:"Profil bearbeiten",duplicatePreset:"Profil duplizieren",createNewPreset:"Neues Profil erstellen",customizeSettings:"Passen Sie die Einstellungen für Ihr neues Profil an",compareWithBase:"Mit Basis-Profil vergleichen",compare:"Vergleichen",basePreset:"Basis-Profil",selectBasePreset:"Basis-Profil auswählen...",presetName:"Profilname",myCustomPreset:"Mein eigenes Profil",inheritsFrom:"Erbt von",dropJsonToImport:"JSON zum Importieren ablegen",tabs:{common:"Allgemein",allFields:"Alle Felder"},availableFields:"Verfügbare Felder",searchFieldsPlaceholder:"Felder suchen...",noMatchingFields:"Keine passenden Felder",allFieldsAdded:"Alle Felder hinzugefügt",addCustomField:"Eigenes Feld hinzufügen",yourOverrides:"Ihre Überschreibungen",noOverridesYet:"Noch keine Überschreibungen",clickFieldsToAdd:"Klicken Sie links auf Felder, um sie hinzuzufügen",saveAsTemplate:"Als Vorlage speichern",jsonTip:"Tipp: Ziehen Sie eine .json-Datei auf dieses Fenster, um Einstellungen zu importieren"},cloudView:{searchPlaceholder:"Profile suchen...",templates:"Vorlagen",refresh:"Aktualisieren",newPreset:"Neues Profil",clearFilters:"Filter zurücksetzen",compareMode:"Vergleichsmodus",selectAnotherPreset:"Wählen Sie ein weiteres {{type}}-Profil",clickTwoPresets:"Klicken Sie auf zwei Profile des gleichen Typs zum Vergleichen",selectFirst:"1. Erstes auswählen",selectSecond:"2. Zweites auswählen",compareNow:"Jetzt vergleichen",lastSynced:"Zuletzt synchronisiert:",showingCount:"{{showing}} von {{total}} Profilen",noPresetsFound:"Keine Profile gefunden",columns:{filament:"Filament",process:"Prozess",printer:"Drucker"},noFilamentPresets:"Keine Filament-Profile",noProcessPresets:"Keine Prozess-Profile",noPrinterPresets:"Keine Drucker-Profile",filters:{type:"Typ",owner:"Besitzer",printer:"Drucker",nozzle:"Düse",filament:"Filament",layer:"Schicht",all:"Alle",myPresets:"Meine Profile",builtIn:"Voreingestellt",process:"Prozess"},noTemplatesPermission:"Sie haben keine Berechtigung, Vorlagen zu verwalten",noRefreshPermission:"Sie haben keine Berechtigung, Profile zu aktualisieren",noCreatePermission:"Sie haben keine Berechtigung, Profile zu erstellen"},templates:{title:"Schnellvorlagen",noTemplates:"Noch keine Vorlagen",createFirst:"Erstellen Sie Vorlagen aus dem Preset-Editor",typeFilter:"Typ:",deleteTitle:"Vorlage löschen",deleteWarning:"Diese Aktion kann nicht rückgängig gemacht werden",deleteConfirm:'Möchten Sie "{{name}}" wirklich löschen?',namePlaceholder:"Vorlagenname",descriptionPlaceholder:"Beschreibung",settingsJson:"Einstellungen (JSON)",fieldsCount:"{{count}} Felder",shownInModals:"In Dialogen angezeigt",hiddenInModals:"In Dialogen ausgeblendet",apply:"Anwenden",toast:{deleted:"Vorlage gelöscht",updated:"Vorlage aktualisiert",created:"Vorlage erstellt",applied:"Vorlage angewendet"}}},support:{debugLoggingActive:"Debug-Protokollierung ist aktiv",manageLogs:"Verwalten",collectItem7:"Drucker-Verbindungsstatus und Firmware-Versionen",collectItem8:"Integrationsstatus (Spoolman, MQTT, HA)",collectItem9:"Netzwerkschnittstellen (nur Subnetze)",collectItem10:"Python-Paketversionen",collectItem11:"Datenbankzustandsprüfungen",collectItem12:"Docker-Umgebungsdetails"},fileManager:{title:"Dateimanager",subtitle:"Organisieren und verwalten Sie Ihre Druckdateien",uploadFiles:"Dateien hochladen",newFolder:"Neuer Ordner",folderName:"Ordnername",folderNamePlaceholder:"z.B. Funktionsteile",renameFile:"Datei umbenennen",renameFolder:"Ordner umbenennen",moveFiles:"{{count}} Datei(en) verschieben",rootNoFolder:"Stammverzeichnis (Kein Ordner)",current:"aktuell",linkFolder:"Ordner verknüpfen",linkFolderDescription:'"{{name}}" mit einem Projekt oder Archiv verknüpfen für schnellen Zugriff.',project:"Projekt",archive:"Archiv",noProjectsFound:"Keine Projekte gefunden",noArchivesFound:"Keine Archive gefunden",unlink:"Verknüpfung aufheben",link:"Verknüpfen",dragDropFiles:"Dateien hierher ziehen",dropFilesHere:"Dateien hier ablegen",orClickToBrowse:"oder klicken zum Durchsuchen",allFileTypesSupported:"Alle Dateitypen werden unterstützt. ZIP-Dateien werden extrahiert.",zipFilesDetected:"ZIP-Dateien erkannt",zipExtractOptions:"ZIP-Dateien werden extrahiert. Wählen Sie, wie die Ordnerstruktur behandelt werden soll:",preserveZipStructure:"Ordnerstruktur aus ZIP beibehalten",createFolderFromZip:"Ordner aus ZIP-Dateiname erstellen",stlThumbnailGeneration:"STL-Vorschaubildgenerierung",zipMayContainStl:"ZIP-Dateien können STL-Dateien enthalten. Vorschaubilder können während der Extraktion generiert werden.",thumbnailsCanBeGenerated:"Vorschaubilder können für STL-Dateien generiert werden. Große Modelle benötigen möglicherweise mehr Zeit.",generateThumbnailsForStl:"Vorschaubilder für STL-Dateien generieren",threemfDetected:"3MF-Dateien erkannt",threemfExtractionInfo:"Druckermodell, Material, Farbe und Druckeinstellungen werden automatisch aus 3MF-Dateien extrahiert.",willBeExtracted:"Wird extrahiert",filesExtracted:"{{count}} Dateien extrahiert",uploadComplete:"Upload abgeschlossen: {{succeeded}} erfolgreich",uploadFailed:"Hochladen fehlgeschlagen",zipFilesFailed:"{{count}} Dateien fehlgeschlagen",uploading:"Hochladen...",changeLink:"Verknüpfung ändern...",linkTo:"Verknüpfen mit...",linkToProjectOrArchive:"Mit Projekt oder Archiv verknüpfen",addToQueue:"Zur Warteschlange",schedulePrint:"Planen",generateThumbnail:"Vorschaubild generieren",generateThumbnails:"Vorschaubilder generieren",generateThumbnailsForMissing:"Vorschaubilder für STL-Dateien ohne Vorschau generieren",gridView:"Rasteransicht",listView:"Listenansicht",lowDiskSpaceWarning:"Warnung: Wenig Speicherplatz",lowDiskSpaceDetails:"Nur {{free}} frei von {{total}} gesamt. Schwellenwert ist auf {{threshold}} GB eingestellt.",files:"Dateien",folders:"Ordner",size:"Größe",free:"Frei",allFiles:"Alle Dateien",wrap:"Umbrechen",enableTextWrapping:"Textumbruch aktivieren",disableTextWrapping:"Textumbruch deaktivieren",dragToResizeTooltip:"Ziehen zum Ändern der Größe, Doppelklick zum Zurücksetzen",searchFiles:"Dateien suchen...",allTypes:"Alle Typen",prints:"Drucke",ascending:"Aufsteigend",descending:"Absteigend",resultsCount:"{{showing}} von {{total}} Dateien",selectAll:"Alle auswählen",deselectAll:"Auswahl aufheben",selected:"{{count}} ausgewählt",adding:"Hinzufügen...",loadingFiles:"Dateien werden geladen...",folderIsEmpty:"Ordner ist leer",noFilesYet:"Noch keine Dateien",folderEmptyDescription:"Laden Sie Dateien hoch oder verschieben Sie Dateien in diesen Ordner.",noFilesDescription:"Laden Sie Dateien hoch, um Ihre Druckdateien zu organisieren.",noMatchingFiles:"Keine passenden Dateien",noMatchingFilesDescription:"Keine Dateien entsprechen Ihren aktuellen Such- oder Filterkriterien.",clearFilters:"Filter zurücksetzen",printedCount:"{{count}}x gedruckt",uploadedBy:"Hochgeladen von",deleteFolder:"Ordner löschen",deleteFile:"Datei löschen",deleteFilesCount:"{{count}} Dateien löschen",deleteFolderConfirm:"Möchten Sie diesen Ordner wirklich löschen? Alle Dateien darin werden ebenfalls gelöscht.",deleteFileConfirm:"Möchten Sie diese Datei wirklich löschen?",deleteFilesConfirm:"Möchten Sie {{count}} ausgewählte Dateien wirklich löschen? Diese Aktion kann nicht rückgängig gemacht werden.",deleting:"Wird gelöscht...",noPermissionRenameFolder:"Sie haben keine Berechtigung, Ordner umzubenennen",noPermissionLinkFolder:"Sie haben keine Berechtigung, Ordner zu verknüpfen",noPermissionDeleteFolder:"Sie haben keine Berechtigung, Ordner zu löschen",noPermissionPrint:"Sie haben keine Berechtigung zum Drucken",noPermissionAddToQueue:"Sie haben keine Berechtigung, zur Warteschlange hinzuzufügen",noPermissionDownload:"Sie haben keine Berechtigung, Dateien herunterzuladen",noPermissionRenameFile:"Sie haben keine Berechtigung, diese Datei umzubenennen",noPermissionGenerateThumbnail:"Sie haben keine Berechtigung, Vorschaubilder zu generieren",noPermissionDeleteFile:"Sie haben keine Berechtigung, diese Datei zu löschen",noPermissionCreateFolder:"Sie haben keine Berechtigung, Ordner zu erstellen",noPermissionUpload:"Sie haben keine Berechtigung, Dateien hochzuladen",noPermissionMoveFiles:"Sie haben keine Berechtigung, Dateien zu verschieben",noPermissionDeleteFiles:"Sie haben keine Berechtigung, Dateien zu löschen",toast:{folderCreated:"Ordner erstellt",folderDeleted:"Ordner gelöscht",fileDeleted:"Datei gelöscht",filesDeleted:"{{count}} Dateien gelöscht",filesMoved:"Dateien verschoben",folderLinked:"Ordner verknüpft",folderUnlinked:"Ordnerverknüpfung aufgehoben",addedToQueue:"{{count}} Datei(en) zur Warteschlange hinzugefügt",addedToQueuePartial:"{{added}} Datei(en) hinzugefügt, {{failed}} fehlgeschlagen",failedToAddToQueue:"Fehler beim Hinzufügen: {{error}}",fileRenamed:"Datei umbenannt",folderRenamed:"Ordner umbenannt",thumbnailsGenerated:"{{count}} Vorschaubild(er) generiert",thumbnailsGeneratedPartial:"{{succeeded}} Vorschaubild(er) generiert, {{failed}} fehlgeschlagen",noStlMissingThumbnails:"Keine STL-Dateien ohne Vorschaubild",failedToGenerateThumbnails:"Fehler beim Generieren der Vorschaubilder: {{error}}",thumbnailGenerated:"Vorschaubild generiert",failedToGenerateThumbnail:"Fehler beim Generieren des Vorschaubildes: {{error}}"}},projects:{title:"Projekte",subtitle:"Organisieren und verfolgen Sie Ihre 3D-Druckprojekte",newProject:"Neues Projekt",editProject:"Projekt bearbeiten",deleteProject:"Projekt löschen",projectName:"Projektname",description:"Beschreibung",noProjects:"Noch keine Projekte",noProjectsFiltered:"Keine {{status}} Projekte",noProjectsFilteredHelp:"Sie haben keine {{status}} Projekte. Projekte werden hier angezeigt, wenn sich ihr Status ändert.",createFirst:"Erstellen Sie Ihr erstes Projekt, um verwandte Drucke zu organisieren, den Fortschritt zu verfolgen und Ihre Builds zu verwalten.",createFirstButton:"Erstes Projekt erstellen",create:"Erstellen",files:"Dateien",prints:"Drucke",plates:"Platten",parts:"Teile",lastModified:"Zuletzt geändert",deleteConfirm:"Möchten Sie dieses Projekt wirklich löschen? Archive und Warteschlangenelemente werden getrennt, aber nicht gelöscht.",addFiles:"Dateien hinzufügen",removeFile:"Datei entfernen",viewDetails:"Details anzeigen",namePlaceholder:"z.B. Voron 2.4 Build",descriptionPlaceholder:"Optionale Beschreibung...",color:"Farbe",targetPlates:"Ziel-Platten",targetPlatesPlaceholder:"z.B. 25",targetPlatesHelp:"Anzahl der Druckaufträge",targetParts:"Ziel-Teile",targetPartsPlaceholder:"z.B. 150",targetPartsHelp:"Benötigte Objekte insgesamt",tagsLabel:"Tags (kommagetrennt)",tagsPlaceholder:"z.B. voron, funktional, geschenk",dueDate:"Fälligkeitsdatum",priority:"Priorität",priorityLow:"Niedrig",priorityNormal:"Normal",priorityHigh:"Hoch",priorityUrgent:"Dringend",statusActive:"Aktiv",statusCompleted:"Abgeschlossen",statusArchived:"Archiviert",done:"Fertig",completed:"abgeschlossen",failed:"fehlgeschlagen",inQueue:"in Warteschlange",noPrintsYet:"Noch keine Drucke",printJobs:"Druckaufträge (Platten)",partsPrinted:"Gedruckte Teile",failedParts:"Fehlgeschlagene Teile",import:"Importieren",export:"Exportieren",importProject:"Projekt importieren",exportAll:"Alle Projekte exportieren",loading:"Projekte werden geladen...",noEditPermission:"Sie haben keine Berechtigung, Projekte zu bearbeiten",noDeletePermission:"Sie haben keine Berechtigung, Projekte zu löschen",noCreatePermission:"Sie haben keine Berechtigung, Projekte zu erstellen",noImportPermission:"Sie haben keine Berechtigung, Projekte zu importieren",noExportPermission:"Sie haben keine Berechtigung, Projekte zu exportieren",toast:{created:"Projekt erstellt",updated:"Projekt aktualisiert",deleted:"Projekt gelöscht",imported:"Projekt importiert",multipleImported:"{{count}} Projekte importiert",importFailed:"Import fehlgeschlagen",exported:"Projekte exportiert (nur Metadaten)"}},projectDetail:{notFound:"Projekt nicht gefunden",backToProjects:"Zurück zu Projekten",export:"Exportieren",exportProject:"Projekt exportieren",noExportPermission:"Sie haben keine Berechtigung, Projekte zu exportieren",noEditPermission:"Sie haben keine Berechtigung, Projekte zu bearbeiten",partOf:"Teil von:",priorityLabel:"Priorität:",noPrints:"Noch keine Drucke in diesem Projekt",status:{active:"Aktiv",completed:"Abgeschlossen",archived:"Archiviert"},priority:{low:"Niedrig",normal:"Normal",high:"Hoch",urgent:"Dringend"},dueDate:{overdue:"Überfällig",today:"Heute fällig",daysLeft:"{{count}} Tage übrig"},progress:{platesProgress:"Platten-Fortschritt",partsProgress:"Teile-Fortschritt",printJobs:"Druckaufträge",parts:"Teile",percentComplete:"{{percent}}% abgeschlossen",remaining:"{{count}} verbleibend"},stats:{printJobs:"Druckaufträge",total:"gesamt",failed:"{{count}} fehlgeschlagen",partsPrinted:"{{count}} Teile gedruckt",printTime:"Druckzeit",filamentUsed:"Filament verbraucht"},cost:{title:"Kostenverfolgung",filamentCost:"Filamentkosten",energy:"Energie",budget:"Budget",remaining:"Verbleibend"},subProjects:{title:"Unterprojekte ({{count}})"},notes:{title:"Notizen",noEditPermission:"Sie haben keine Berechtigung, Notizen zu bearbeiten",placeholder:"Notizen zu diesem Projekt hinzufügen...",empty:"Noch keine Notizen. Klicken Sie auf Bearbeiten, um Notizen hinzuzufügen."},files:{title:"Dateien",linkFolders:"Ordner aus dem Dateimanager verknüpfen",forQuickAccess:"für schnellen Zugriff auf dieses Projekt.",fileCount:"{{count}} Datei(en)",empty:"Keine Ordner verknüpft. Gehen Sie zum Dateimanager und verknüpfen Sie einen Ordner mit diesem Projekt."},bom:{title:"Stückliste",acquired:"{{completed}}/{{total}} beschafft",showAll:"Alle anzeigen",hideDone:"Erledigte ausblenden",addPart:"Teil hinzufügen",noAddPermission:"Sie haben keine Berechtigung, Teile hinzuzufügen",partNamePlaceholder:"Teilename (z.B. M3x8 Schrauben)",partName:"Teilename",qty:"Menge",price:"Preis ({{currency}})",sourcingUrlPlaceholder:"Bezugsquelle-URL (optional)",remarksPlaceholder:"Bemerkungen (optional)",deletePart:"Teil löschen",deleteConfirm:'Möchten Sie "{{name}}" wirklich löschen?',noUpdatePermission:"Sie haben keine Berechtigung, Teile zu aktualisieren",noEditPermission:"Sie haben keine Berechtigung, Teile zu bearbeiten",noDeletePermission:"Sie haben keine Berechtigung, Teile zu löschen",totalCost:"Gesamtkosten:",empty:"Keine Teile in der Stückliste. Fügen Sie Hardware, Elektronik oder andere Komponenten hinzu, um zu verfolgen, was beschafft werden muss."},timeline:{title:"Aktivitätsverlauf",empty:"Noch keine Aktivität."},template:{saveAsTemplate:"Als Vorlage speichern",noCreatePermission:"Sie haben keine Berechtigung, Vorlagen zu erstellen"},queue:{title:"Warteschlange",viewAll:"Alle anzeigen",printing:"{{count}} druckend",queued:"{{count}} in Warteschlange"},prints:{title:"Drucke ({{count}})"},toast:{projectUpdated:"Projekt aktualisiert",partAdded:"Teil hinzugefügt",partRemoved:"Teil entfernt",exportFailed:"Export fehlgeschlagen",projectExported:"Projekt exportiert",templateCreated:"Vorlage erstellt"}},system:{title:"Systeminformationen",version:"Version",uptime:"Laufzeit",cpuUsage:"CPU-Auslastung",memoryUsage:"Speicherauslastung",diskUsage:"Festplattenauslastung",networkInfo:"Netzwerkinformationen",logs:"Protokolle",debugMode:"Debug-Modus",enableDebug:"Debug-Protokollierung aktivieren",disableDebug:"Debug-Protokollierung deaktivieren",downloadLogs:"Protokolle herunterladen",clearLogs:"Protokolle löschen",dockerInfo:"Docker-Info",containerName:"Container-Name",imageName:"Image-Name",platform:"Plattform",architecture:"Architektur"},library:{title:"Filament-Bibliothek",addFilament:"Filament hinzufügen",editFilament:"Filament bearbeiten",deleteFilament:"Filament löschen",vendor:"Hersteller",material:"Material",color:"Farbe",kFactor:"K-Faktor",temperature:"Temperatur",noFilaments:"Keine Filamente in der Bibliothek",deleteConfirm:"Möchten Sie dieses Filament wirklich löschen?",importFromPrinter:"Vom Drucker importieren",exportToFile:"In Datei exportieren"},spoolman:{title:"Spoolman-Integration",enabled:"Spoolman aktiviert",url:"Spoolman URL",connected:"Verbunden",disconnected:"Nicht verbunden",testConnection:"Verbindung testen",sync:"Synchronisieren",syncing:"Synchronisiert...",lastSync:"Letzte Synchronisierung",linkToSpoolman:"Mit Spoolman verknüpfen",openInSpoolman:"In Spoolman öffnen",unlinkSpool:"Spule trennen",unlinkConfirmTitle:"Spule entkoppeln?",unlinkConfirmMessage:"Dadurch wird die Spule von Spoolman getrennt. Die Spulendaten in Spoolman bleiben unverändert.",selectSpool:"Spule auswählen",noUnlinkedSpools:"Keine nicht verknüpften Spulen verfügbar",linkSuccess:"Spule erfolgreich mit Spoolman verknüpft",linkFailed:"Verknüpfung mit Spoolman fehlgeschlagen",unlinkSuccess:"Spule erfolgreich von Spoolman getrennt",unlinkFailed:"Trennen der Spule von Spoolman fehlgeschlagen",spoolId:"Spulen-ID",fillSourceLabel:"(Spoolman)",weight:"Gewicht",remaining:"Verbleibend",disableWeightSync:"AMS-Gewichtsschätzung deaktivieren",disableWeightSyncDesc:"Verbleibende Kapazität nicht aus AMS-Schätzungen aktualisieren. Verwenden Sie dies, wenn Sie die Verbrauchserfassung von Spoolman gegenüber den prozentualen AMS-Schätzungen bevorzugen. Neue Spulen verwenden weiterhin die AMS-Schätzung als Anfangsgewicht.",reportPartialUsage:"Teilverbrauch bei fehlgeschlagenen Drucken melden",reportPartialUsageDesc:"Wenn ein Druck fehlschlägt oder abgebrochen wird, den geschätzten Filamentverbrauch bis zu diesem Zeitpunkt basierend auf dem Schichtfortschritt melden."},inventory:{title:"Spulen-Inventar",addSpool:"Spule hinzufügen",editSpool:"Spule bearbeiten",material:"Material",selectMaterial:"Material auswählen...",subtype:"Untertyp",brand:"Marke",searchBrand:"Marke suchen...",useCustomBrand:'"{{brand}}" verwenden',useCustomMaterial:"Benutzerdefiniertes Material verwenden: {{material}}",colorName:"Farbname",colorNamePlaceholder:"Jade White, Fire Red...",color:"Farbe",hexColor:"Hex-Farbe",pickColor:"Benutzerdefinierte Farbe wählen",labelWeight:"Nenngewicht",coreWeight:"Leergewicht der Spule",searchSpoolWeight:"Spulengewicht suchen...",weightUsed:"Verbraucht",currentWeight:"Restgewicht",measuredWeight:"Gemessenes Gewicht",costPerKg:"Kosten pro kg",measuredWeightError:"Das gemessene Gewicht muss zwischen {{min}}g und {{max}}g liegen.",slicerFilament:"Slicer-Filament",slicerFilamentName:"Slicer-Preset-Name",slicerPreset:"Slicer-Preset",searchPresets:"Filament-Presets suchen...",selectedPreset:"Ausgewählt",noPresetsFound:"Keine Presets gefunden",tempOverrides:"Temperatur-Überschreibungen",note:"Notiz",notePlaceholder:"Zusätzliche Notizen zu dieser Spule...",archive:"Archivieren",restore:"Wiederherstellen",noSpools:"Noch keine Spulen. Fügen Sie Ihre erste Spule hinzu.",noManualSpools:"Keine manuell hinzugefügten Spulen verfügbar. Fügen Sie zuerst eine Spule zum Inventar hinzu.",kProfiles:"K-Profile",addKProfile:"K-Profil hinzufügen",assignSpool:"Spule zuweisen",unassignSpool:"Zuweisung aufheben",assignSuccess:"Spule zugewiesen und AMS-Slot konfiguriert",assignFailed:"Spulenzuweisung fehlgeschlagen",selectSpool:"Wählen Sie eine Spule für diesen Slot",assigned:"Zugewiesen",assigning:"Wird zugewiesen...",searchSpools:"Spulen suchen...",allMaterials:"Alle Materialien",filterByBrand:"Nach Marke filtern...",showArchived:"Archivierte anzeigen",quickAdd:"Schnellerfassung (Lager)",quantity:"Menge",stock:"Lager",configured:"Konfiguriert",spoolsCreated:"{{count}} Spulen erstellt",spoolCreated:"Spule erstellt",spoolUpdated:"Spule aktualisiert",spoolDeleted:"Spule gelöscht",spoolArchived:"Spule archiviert",spoolRestored:"Spule wiederhergestellt",deleteConfirm:"Möchten Sie diese Spule wirklich löschen? Dies kann nicht rückgängig gemacht werden.",archiveConfirm:"Möchten Sie diese Spule wirklich archivieren?",advancedSettings:"Erweiterte Einstellungen",filamentInfoTab:"Filament-Info",paProfileTab:"PA-Profil",filamentInfo:"Filament",additional:"Zusätzlich",loadingPresets:"Cloud-Presets werden geladen...",cloudConnected:"Cloud verbunden",cloudNotConnected:"Cloud nicht verbunden (Standardwerte)",recentColors:"Zuletzt",searchColors:"Farben suchen...",searchResults:"Suchergebnisse",allColors:"Alle Farben",commonColors:"Häufige Farben",showLess:"Weniger",showAll:"Alle",noColorsFound:"Keine Farben gefunden",noResults:"Keine Ergebnisse",selectMaterialFirst:"Bitte zuerst ein Material im Filament-Info Tab auswählen.",noPrintersConfigured:"Keine Drucker konfiguriert. Fügen Sie Drucker hinzu.",matchingFilter:"Filter",anyBrand:"Jede Marke",anyVariant:"Jede Variante",autoSelect:"Auto-Auswahl",matches:"Treffer",match:"Treffer",noMatches:"Keine Treffer",connected:"Verbunden",offline:"Offline",printerOffline:"Drucker ist offline. Verbinden Sie ihn, um Kalibrierungsprofile anzuzeigen.",noKProfilesMatch:"Keine K-Profile stimmen mit dem gewählten Filament überein.",leftNozzle:"Linke Düse",rightNozzle:"Rechte Düse",profilesSelected:"Kalibrierungsprofil(e) ausgewählt",totalInventory:"Gesamtbestand",totalConsumed:"Gesamtverbrauch",byMaterial:"Nach Material",inPrinter:"Im Drucker",lowStock:"Niedriger Bestand",sinceTracking:"Seit Beginn der Erfassung",loadedInAms:"Im AMS/Ext geladen",remaining:"Verbleibend",weightCheck:"Gewichtskontrolle",lastWeighed:"Zuletzt gewogen",neverWeighed:"Nie gewogen",search:"Spulen suchen...",showing:"Zeige",to:"bis",of:"von",show:"Zeige",spools:"Spulen",spool:"Spule",page:"Seite",noSpoolsMatch:"Keine Ergebnisse",noSpoolsMatchDesc:"Versuchen Sie, Ihre Suche oder Filter anzupassen.",active:"Aktiv",archived:"Archiviert",all:"Alle",used:"Verwendet",new:"Neu",clearFilters:"Filter löschen",table:"Tabelle",cards:"Karten",net:"Netto",groupSimilar:"Gruppieren",groupedSpools:"{{count}} identische Spulen",groupedRows:"Zeilen",columns:"Spalten",configureColumns:"Spalten konfigurieren",configureColumnsDesc:"Ziehen zum Neuordnen oder Pfeile verwenden. Sichtbarkeit mit dem Augensymbol umschalten.",visible:"sichtbar",reset:"Zurücksetzen",cancel:"Abbrechen",applyChanges:"Änderungen anwenden",moveUp:"Nach oben",moveDown:"Nach unten",hideColumn:"Spalte ausblenden",showColumn:"Spalte einblenden",linkToSpool:"Mit Spule verknüpfen",tagLinked:"Tag mit Spule verknüpft",tagLinkFailed:"Tag-Verknüpfung fehlgeschlagen",tagAlreadyLinked:"Tag bereits mit anderer Spule verknüpft",unknownTag:"Unbekannter RFID-Tag erkannt",usageHistory:"Verbrauchshistorie",noUsageHistory:"Noch kein Verbrauch erfasst",printName:"Druckname",weightConsumed:"Verbrauchtes Gewicht",clearHistory:"Löschen",historyCleared:"Verbrauchshistorie gelöscht",fillSourceLabel:"(Inv)",lowStockThresholdError:"Der Schwellenwert muss zwischen 0.1 und 99.9 liegen"},timelapse:{title:"Zeitraffer",create:"Zeitraffer erstellen",download:"Herunterladen",delete:"Löschen",preview:"Vorschau",frameRate:"Bildrate",quality:"Qualität",processing:"Wird verarbeitet...",noTimelapses:"Keine Zeitraffer verfügbar"},ams:{title:"AMS",slot:"Slot",empty:"Leer",emptySlot:"Leerer Slot",unknown:"Unbekannt",humidity:"Luftfeuchtigkeit",temperature:"Temperatur",filamentType:"Filamenttyp",filamentColor:"Farbe",remaining:"Verbleibend",history:"AMS-Verlauf",noHistory:"Kein Verlauf verfügbar",configureSlot:"Slot konfigurieren",externalSpool:"Externe Spule",profile:"Profil",kFactor:"K-Faktor",fill:"Füllstand",configure:"Konfigurieren",used:"verwendet",remainingUnit:"verbleibend"},printModal:{title:"Druck starten",selectPrinter:"Drucker auswählen",selectPlate:"Platte auswählen",filamentMapping:"Filamentzuordnung",totalCost:"Gesamtkosten:",slotRemainingShort:" - {{grams}}g übrig",printSettings:"Druckeinstellungen",bedLeveling:"Bett-Nivellierung",flowCalibration:"Fluss-Kalibrierung",vibrationCalibration:"Vibrations-Kalibrierung",layerInspection:"Erste-Schicht-Prüfung",timelapse:"Zeitraffer",startPrint:"Druck starten",addToQueue:"Zur Warteschlange hinzufügen",cancel:"Abbrechen",noPrintersAvailable:"Keine Drucker verfügbar",printerBusy:"Drucker ist beschäftigt",printerOffline:"Drucker ist offline",sameTypeDifferentColor:"Gleicher Typ, andere Farbe",filamentTypeNotLoaded:"Filamenttyp nicht geladen",openCalendar:"Kalender öffnen",leftNozzle:"L",rightNozzle:"R",leftNozzleTooltip:"Linke Düse",rightNozzleTooltip:"Rechte Düse",filamentOverride:"Filament-Überschreibung",filamentOverrideHint:"Filamente für modellbasierte Zuweisung optional überschreiben. Der Planer wird gegen die ausgewählten Filamente statt der ursprünglichen 3MF-Werte abgleichen.",originalFilament:"Original",overrideWith:"Ersetzen mit",resetToOriginal:"Auf Original zurücksetzen",forceColorMatch:"Farbe erzwingen"},backup:{title:"Sichern & Wiederherstellen",createBackup:"Sicherung erstellen",restoreBackup:"Sicherung wiederherstellen",restoreDescription:"Alle Daten aus einer Sicherungsdatei ersetzen",downloadBackup:"Sicherung herunterladen",uploadBackup:"Sicherung hochladen",lastBackup:"Letzte Sicherung",autoBackup:"Automatische Sicherung",backupNow:"Jetzt sichern",restoreWarning:"Warnung: Das Wiederherstellen einer Sicherung überschreibt alle aktuellen Daten.",includeArchives:"Archive einschließen",includeSettings:"Einstellungen einschließen",includeProfiles:"Profile einschließen",backupSuccess:"Sicherung erfolgreich erstellt",restoreSuccess:"Sicherung erfolgreich wiederhergestellt",backupFailed:"Sicherung fehlgeschlagen",restoreFailed:"Wiederherstellung fehlgeschlagen",restoreNote:"Virtueller Drucker wird während der Wiederherstellung gestoppt",githubBackup:"GitHub Backup",enabled:"Aktiviert",cloudLoginRequired:"Bambu Cloud Login erforderlich. Melden Sie sich unter Profile → Cloud-Profile an, um GitHub-Backup zu aktivieren.",cloudLoginRequiredShort:"Cloud-Login erforderlich",githubDescription:"Synchronisieren Sie Ihre Profile automatisch mit einem privaten GitHub-Repository für Backup und Versionsverlauf.",repositoryUrl:"Repository-URL",personalAccessToken:"Persönlicher Zugriffstoken",tokenSaved:"(gespeichert)",enterNewToken:"Neuen Token eingeben zum Aktualisieren",tokenHint:"Feingranularer Token mit Lese-/Schreibberechtigung für Inhalte",branch:"Branch",manualOnly:"Nur manuell",hourly:"Stündlich",daily:"Täglich",weekly:"Wöchentlich",includeInBackup:"In Sicherung einschließen",kProfiles:"K-Profile",kProfilesDescription:"Druckvorschub-Kalibrierung von verbundenen Druckern",noPrintersConnected:"Keine Drucker verbunden",printersConnected:"{{connected}}/{{total}} verbunden",cloudProfiles:"Cloud-Profile",cloudProfilesDescription:"Filament-, Drucker- und Prozessprofile aus der Bambu Cloud",appSettings:"App-Einstellungen",appSettingsDescription:"Bambuddy-Konfiguration (komplette Datenbank)",lastBackupAt:"Letzte Sicherung:",noBackupsYet:"Noch keine Sicherungen",next:"Nächste:",startingBackup:"Sicherung wird gestartet...",test:"Test",enableBackup:"Sicherung aktivieren",testConnection:"Verbindung testen",enterRepoUrl:"Repository-URL eingeben",enterRepoAndToken:"Repository-URL und Zugriffstoken eingeben",repoRequired:"Repository-URL ist erforderlich",tokenRequired:"Zugriffstoken ist erforderlich",githubBackupEnabled:"GitHub-Backup aktiviert",tokenUpdated:"Token aktualisiert",settingsSaved:"Einstellungen gespeichert",failedToSave:"Speichern fehlgeschlagen: {{message}}",backupCompleteFiles:"Sicherung abgeschlossen - {{count}} Dateien aktualisiert",backupSkippedNoChanges:"Sicherung übersprungen - keine Änderungen",backupFailed2:"Sicherung fehlgeschlagen: {{message}}",clearedLogs:"{{count}} Protokolle gelöscht",failedToClearLogs:"Protokolle löschen fehlgeschlagen: {{message}}",history:"Verlauf",clear:"Löschen",date:"Datum",status:"Status",commit:"Commit",localBackup:"Lokale Sicherung",localBackupDescription:"Erstellen Sie eine vollständige Sicherung Ihrer Bambuddy-Daten einschließlich Datenbank, Archive, Uploads und aller Dateien.",downloadBackupLabel:"Sicherung herunterladen",completeBackupZip:"Vollständige Sicherung: Datenbank + alle Dateien (ZIP)",download:"Herunterladen",preparingBackup:"Sicherung wird vorbereitet...",creatingArchive:"Sicherungsarchiv wird erstellt... Dies kann bei großen Archiven eine Weile dauern.",downloadingFile:"Sicherungsdatei wird heruntergeladen...",backupDownloaded:"Sicherung erfolgreich heruntergeladen",failedToCreateBackup:"Sicherung erstellen fehlgeschlagen: {{message}}",restore:"Wiederherstellen",restoreReplacesAll:"Wiederherstellung ersetzt alle Daten.",restoreReplacesAllDetail:"Ihre aktuelle Datenbank und Dateien werden vollständig ersetzt. Nach der Wiederherstellung ist ein Neustart erforderlich.",restoreConfirmTitle:"Sicherung wiederherstellen",restoreConfirmMessage:'Sind Sie sicher, dass Sie von "{{filename}}" wiederherstellen möchten? Dies ersetzt Ihre aktuelle Datenbank und alle Dateien vollständig. Die Anwendung muss nach der Wiederherstellung neu gestartet werden.',restoreConfirmButton:"Sicherung wiederherstellen",uploadingFile:"Sicherungsdatei wird hochgeladen...",backupRestoredRestart:"Sicherung wiederhergestellt. Bitte starten Sie Bambuddy neu.",failedToRestore:"Sicherung wiederherstellen fehlgeschlagen. Bitte überprüfen Sie das Dateiformat.",reloadNow:"Jetzt neu laden",creatingBackup:"Sicherung erstellen",restoringBackup:"Sicherung wiederherstellen",preparing:"Vorbereiten...",processing:"Verarbeiten...",doNotClosePage:"Bitte schließen Sie diese Seite nicht und navigieren Sie nicht weg. Dieser Vorgang kann bei großen Sicherungen mehrere Minuten dauern.",restoring:"Wiederherstellen...",restoreComplete:"Wiederherstellung abgeschlossen",restoreFailed2:"Wiederherstellung fehlgeschlagen",importSettings:"Einstellungen aus einer Sicherungsdatei importieren",pleaseWaitRestoring:"Bitte warten Sie, während Ihre Daten wiederhergestellt werden",selectBackupFile:"Klicken Sie, um eine Sicherungsdatei auszuwählen (.json oder .zip)",duplicateHandling:"So funktioniert die Duplikatbehandlung:",matchPrinters:"Drucker",matchPrintersBy:"abgeglichen nach Seriennummer",matchSmartPlugs:"Smart Plugs",matchSmartPlugsBy:"abgeglichen nach IP-Adresse",matchNotificationProviders:"Benachrichtigungsanbieter",matchNotificationProvidersBy:"abgeglichen nach Name",matchFilaments:"Filamente",matchFilamentsBy:"abgeglichen nach Name + Typ + Marke",matchArchives:"Archive",matchArchivesBy:"abgeglichen nach Inhaltshash (immer übersprungen)",matchPendingUploads:"Ausstehende Uploads",matchPendingUploadsBy:"abgeglichen nach Dateiname",matchSettingsTemplates:"Einstellungen & Vorlagen",matchSettingsTemplatesBy:"immer überschrieben",replaceExisting:"Vorhandene Daten ersetzen",keepExisting:"Vorhandene Daten behalten",overwriteDescription:"Bereits vorhandene Elemente mit Sicherungsdaten überschreiben",keepDescription:"Nur Elemente wiederherstellen, die noch nicht vorhanden sind",overwriteCaution:"Achtung:",overwriteWarning:"Das Überschreiben ersetzt Ihre aktuellen Konfigurationen durch Daten aus der Sicherung. Drucker-Zugangscodes werden aus Sicherheitsgründen nie überschrieben.",cancel:"Abbrechen",processingBackup:"Sicherungsdatei wird verarbeitet...",itemsRestored:"Wiederhergestellt",itemsSkipped:"Übersprungen",restored:"Wiederhergestellt",skippedAlreadyExist:"Übersprungen (bereits vorhanden)",filesCategory:"Dateien (3MF, Thumbnails, etc.)",andMore:"...und {{count}} weitere",newApiKeysGenerated:"Neue API-Schlüssel generiert",keysShownOnce:"Diese Schlüssel werden nur einmal angezeigt. Kopieren Sie sie jetzt!",copy:"Kopieren",noDataFound:"In der Sicherungsdatei wurden keine Daten zur Wiederherstellung gefunden.",close:"Schließen",categories:{settings:"Einstellungen",notification_providers:"Benachrichtigungsanbieter",notification_templates:"Benachrichtigungsvorlagen",smart_plugs:"Smart Plugs",printers:"Drucker",filaments:"Filamente",maintenance_types:"Wartungstypen",archives:"Archive",projects:"Projekte",pending_uploads:"Ausstehende Uploads",external_links:"Externe Links",api_keys:"API-Schlüssel"}},tags:{title:"Tags",addTag:"Tag hinzufügen",editTag:"Tag bearbeiten",deleteTag:"Tag löschen",tagName:"Tag-Name",tagColor:"Tag-Farbe",noTags:"Keine Tags",deleteConfirm:"Möchten Sie diesen Tag wirklich löschen?",manageTags:"Tags verwalten"},uploadModal:{title:"3MF-Dateien hochladen",dragDrop:"3MF-Dateien hierher ziehen",or:"oder",browseFiles:"Dateien durchsuchen",extractionInfo:"Das Druckermodell wird automatisch aus den 3MF-Datei-Metadaten extrahiert.",uploaded:"hochgeladen",failed:"fehlgeschlagen",uploading:"Wird hochgeladen...",upload:"Hochladen",uploadFailed:"Hochladen fehlgeschlagen"},editArchive:{title:"Archiv bearbeiten",name:"Name",namePlaceholder:"Druckname",printer:"Drucker",noPrinter:"Kein Drucker",project:"Projekt",noProject:"Kein Projekt",itemsPrinted:"Gedruckte Teile",itemsPrintedHelp:"Anzahl der in diesem Druckauftrag produzierten Teile",notes:"Notizen",notesPlaceholder:"Notizen zu diesem Druck hinzufügen...",externalLink:"Externer Link",externalLinkPlaceholder:"https://printables.com/model/...",externalLinkHelp:"Link zu Printables, Thingiverse oder anderer Quelle",tags:"Tags",tagsPlaceholder:"Tags hinzufügen...",addMoreTags:"Weitere Tags hinzufügen...",matchingTags:'Übereinstimmend mit "{{query}}"',existingTags:"Vorhandene Tags",clickToAdd:"(zum Hinzufügen klicken)",status:"Status",failureReason:"Fehlergrund",selectReason:"Grund auswählen...",photos:"Fotos des Druckergebnisses",photosHelp:"Klicken Sie auf + um Fotos Ihres Druckergebnisses hinzuzufügen",printResult:"Druckergebnis",saving:"Wird gespeichert...",failureReasons:{adhesionFailure:"Haftungsfehler",spaghettiDetached:"Spaghetti / Abgelöst",layerShift:"Schichtversatz",cloggedNozzle:"Verstopfte Düse",filamentRunout:"Filament aufgebraucht",warping:"Verformung",stringing:"Fadenziehen",underExtrusion:"Unterextrusion",powerFailure:"Stromausfall",userCancelled:"Vom Benutzer abgebrochen",other:"Sonstiges"},statuses:{completed:"Abgeschlossen",failed:"Fehlgeschlagen",aborted:"Abgebrochen",printing:"Druckt"}},kProfiles:{title:"K-Profile",noPrintersConfigured:"Keine Drucker konfiguriert",addPrinterInSettings:"Fügen Sie einen Drucker in den Einstellungen hinzu, um K-Profile zu verwalten",noActivePrinters:"Keine aktiven Drucker",enablePrinterConnection:"Aktivieren Sie eine Druckerverbindung, um K-Profile anzuzeigen",loadingProfiles:"Lade K-Profile...",printerOffline:"Drucker offline",printerOfflineDesc:"Der ausgewählte Drucker ist nicht verbunden. Schalten Sie ihn ein, um K-Profile anzuzeigen.",noMatchingProfiles:"Keine passenden Profile",noMatchingProfilesDesc:"Keine Profile entsprechen Ihren Suchkriterien",noKProfiles:"Keine K-Profile",noKProfilesDesc:"Keine Druckvorschub-Profile für {{diameter}}mm Düse gefunden",createFirstProfile:"Erstes Profil erstellen",printer:"Drucker",nozzle:"Düse",refresh:"Aktualisieren",addProfile:"Profil hinzufügen",export:"Exportieren",import:"Importieren",select:"Auswählen",selectAll:"Alle auswählen",delete:"Löschen",searchPlaceholder:"Nach Name oder Filament suchen...",allExtruders:"Alle Extruder",leftOnly:"Nur links",rightOnly:"Nur rechts",allFlow:"Alle Flusstypen",hfOnly:"Nur HF",sOnly:"Nur S",sortName:"Sortieren: Name",sortKValue:"Sortieren: K-Wert",sortFilament:"Sortieren: Filament",leftExtruder:"Linker Extruder",rightExtruder:"Rechter Extruder",modal:{addTitle:"K-Profil hinzufügen",editTitle:"K-Profil bearbeiten",profileName:"Profilname",profileNamePlaceholder:"Mein PLA-Profil",kValue:"K-Wert",kValuePlaceholder:"0,020",kValueHelp:"Typischer Bereich: 0,01 - 0,06 für PLA, 0,02 - 0,10 für PETG",filament:"Filament",selectFilament:"Filament auswählen...",noFilamentsHelp:"Keine Filamente gefunden. Erstellen Sie zuerst ein K-Profil in Bambu Studio.",flowType:"Flusstyp",highFlow:"High Flow",standard:"Standard",nozzleSize:"Düsengröße",extruder:"Extruder",extruders:"Extruder",left:"Links",right:"Rechts",notes:"Notizen (lokal gespeichert)",notesPlaceholder:"Notizen zu diesem Profil hinzufügen...",notesHelp:"Notizen werden in Bambuddy gespeichert, nicht auf dem Drucker",syncing:"Synchronisiert mit Drucker...",savingExtruder:"Speichern auf Extruder {{current}}/{{total}}...",pleaseWait:"Bitte warten"},deleteConfirm:{title:"Profil löschen",cannotUndo:"Dies kann nicht rückgängig gemacht werden",message:'Möchten Sie "{{name}}" wirklich vom Drucker löschen?'},bulkDelete:{title:"Profile löschen",cannotUndo:"Dies kann nicht rückgängig gemacht werden",message:"Möchten Sie wirklich {{count}} ausgewählte Profile vom Drucker löschen?"},toast:{profileSaved:"K-Profil gespeichert",profilesSaved:"K-Profil auf {{count}} Extrudern gespeichert",selectAtLeastOneExtruder:"Bitte wählen Sie mindestens einen Extruder aus",profileDeleted:"K-Profil gelöscht",profilesDeleted:"{{count}} Profile gelöscht",exportedProfiles:"{{count}} Profile exportiert",importedProfiles:"{{count}} von {{total}} Profilen importiert",noProfilesToExport:"Keine Profile zum Exportieren",invalidFileFormat:"Ungültiges Dateiformat",failedToParseImport:"Import-Datei konnte nicht gelesen werden",failedToSaveBatch:"K-Profile konnten nicht gespeichert werden",noteSaved:"Notiz gespeichert",failedToSaveNote:"Notiz konnte nicht gespeichert werden"},permission:{noRead:"Sie haben keine Berechtigung, Profile zu aktualisieren",noCreate:"Sie haben keine Berechtigung, Profile hinzuzufügen",noUpdate:"Sie haben keine Berechtigung, K-Profile zu aktualisieren",noDelete:"Sie haben keine Berechtigung, K-Profile zu löschen",noExport:"Sie haben keine Berechtigung, Profile zu exportieren",noImport:"Sie haben keine Berechtigung, Profile zu importieren"}},virtualPrinter:{title:"Virtueller Drucker",running:"Läuft",stopped:"Gestoppt",description:{default:"Aktiviere einen virtuellen Drucker, der in Bambu Studio und OrcaSlicer erscheint. Dateien, die an diesen Drucker gesendet werden, werden direkt archiviert ohne zu drucken.",proxy:"Aktiviere einen Proxy, der Slicer-Datenverkehr an einen echten Drucker weiterleitet, um Ferndruck über jedes Netzwerk zu ermöglichen."},enable:{title:"Virtuellen Drucker aktivieren",visibleInSlicer:'Sichtbar als "Bambuddy" in der Slicer-Erkennung',proxyingTo:"Proxy zu {{name}}",notActive:"Nicht aktiv"},model:{title:"Druckermodell",description:"Wähle welches Druckermodell emuliert werden soll.",restartWarning:"Das Ändern des Modells startet den virtuellen Drucker neu"},accessCode:{title:"Zugangscode",isSet:"Zugangscode ist gesetzt",notSet:"Kein Zugangscode gesetzt - erforderlich zum Aktivieren",placeholder:"8-Zeichen-Code eingeben",placeholderChange:"Neuen Code eingeben zum Ändern",hint:"Muss genau 8 Zeichen lang sein. Wird von Slicern zur Authentifizierung verwendet.",charCount:"({{count}}/8)"},targetPrinter:{title:"Zieldrucker",configured:"Proxy-Ziel konfiguriert",notConfigured:"Kein Zieldrucker ausgewählt - erforderlich für Proxy-Modus",placeholder:"Drucker auswählen...",hint:"Wähle den Drucker aus, an den der Slicer-Datenverkehr weitergeleitet werden soll. Der Drucker muss im LAN-Modus sein.",noPrinters:"Keine Drucker konfiguriert. Füge zuerst einen Drucker hinzu, um den Proxy-Modus zu verwenden."},remoteInterface:{title:"Netzwerkschnittstelle überschreiben",configured:"Schnittstellenüberschreibung aktiv",optional:"Optional - verwenden wenn die automatisch erkannte IP falsch ist (z.B. mehrere NICs, Docker, VPN)",placeholder:"Automatisch erkennen (Standard)...",hint:"Überschreibt die per SSDP beworbene und im TLS-Zertifikat verwendete IP-Adresse. Nützlich wenn Bambuddy mehrere Netzwerkschnittstellen hat."},mode:{title:"Modus",archive:"Archivieren",archiveDesc:"Dateien sofort archivieren",review:"Überprüfen",reviewDesc:"Vor dem Archivieren überprüfen",queue:"Warteschlange",queueDesc:"Archivieren und zur Warteschlange hinzufügen",proxy:"Proxy",proxyDesc:"An echten Drucker weiterleiten"},autoDispatch:{title:"Automatisch starten",description:"Drucke automatisch starten, wenn sie zur Warteschlange hinzugefügt werden. Wenn deaktiviert, warten Drucke auf manuellen Start."},setupRequired:{title:"Einrichtung erforderlich",description:"Die virtuelle Druckerfunktion erfordert zusätzliche Systemkonfiguration, bevor sie funktioniert. Dies beinhaltet Portweiterleitung, Firewall-Regeln und plattformspezifische Einstellungen.",readGuide:"Lese die Einrichtungsanleitung vor dem Aktivieren"},howItWorks:{title:"So funktioniert es",step1:"Im selben LAN erscheinen virtuelle Drucker automatisch in deinem Slicer (Bambu Studio / OrcaSlicer). Aus anderen Netzwerken füge sie manuell per IP-Adresse und Zugangscode hinzu.",step2:'Im Archiv-, Überprüfungs- und Warteschlangen-Modus verwende die "Senden"-Funktion im Slicer, um 3MF-Dateien an Bambuddy zu senden. Der Slicer zeigt "Druck erfolgreich" — die Datei wird gespeichert, nicht gedruckt.',step3:"Im Proxy-Modus leitet der virtuelle Drucker den gesamten Datenverkehr an einen echten Drucker weiter — Drucke starten sofort wie bei einer direkten Verbindung."},status:{title:"Status-Details",printerName:"Druckername",model:"Modell",serialNumber:"Seriennummer",mode:"Modus",pendingFiles:"Ausstehende Dateien",targetPrinter:"Zieldrucker",ftpPort:"FTP-Port",mqttPort:"MQTT-Port",ftpConnections:"FTP-Verbindungen",mqttConnections:"MQTT-Verbindungen"},toast:{updated:"Virtuelle Druckereinstellungen aktualisiert",failedToUpdate:"Einstellungen konnten nicht aktualisiert werden",accessCodeRequired:"Bitte zuerst einen Zugangscode setzen",targetPrinterRequired:"Bitte zuerst einen Zieldrucker auswählen",bindIpRequired:"Bitte zuerst eine Bind-IP setzen",accessCodeEmpty:"Zugangscode darf nicht leer sein",accessCodeLength:"Zugangscode muss genau 8 Zeichen lang sein",created:"Virtueller Drucker erstellt",failedToCreate:"Virtueller Drucker konnte nicht erstellt werden",deleted:"Virtueller Drucker gelöscht",failedToDelete:"Virtueller Drucker konnte nicht gelöscht werden"},list:{title:"Virtuelle Drucker",add:"Hinzufügen",addFirst:"Virtuellen Drucker hinzufügen",empty:"Keine virtuellen Drucker konfiguriert. Fügen Sie einen hinzu, um zu beginnen."},bindIp:{title:"Bind-Interface",placeholder:"Interface auswählen...",hint:"Netzwerkinterface, an das dieser virtuelle Drucker gebunden wird. Muss pro Drucker eindeutig sein."},proxy:{accessCodeHint:"Im Proxy-Modus den Zugangscode des Zieldruckers im Slicer verwenden. Die Verbindung wird transparent zum echten Drucker weitergeleitet."},addDialog:{title:"Virtuellen Drucker hinzufügen",name:"Name",hint:"Sie können Zugangscode, Zieldrucker und andere Einstellungen nach dem Erstellen konfigurieren.",create:"Erstellen"},deleteConfirm:{title:"Virtuellen Drucker löschen",message:'Möchten Sie "{{name}}" wirklich löschen? Dies stoppt alle Dienste für diesen Drucker.'}},modelViewer:{openInSlicer:"Im Slicer öffnen",tabs:{model:"3D-Modell",gcode:"G-Code Vorschau"},notAvailable:"nicht verfügbar",notSliced:"nicht geslicet",plates:"Platten",allPlates:"Alle Platten",plateNumber:"Platte {{number}}",plateCount:"{{count}} Platte",plateCount_other:"{{count}} Platten",objectCount:"{{count}} Objekt",objectCount_other:"{{count}} Objekte",filamentCount:"{{count}} Filament",filamentCount_other:"{{count}} Filamente",eta:"ETA {{minutes}} Min",noPreview:"Keine Vorschau für diese Datei verfügbar",pagination:{pageOf:"Seite {{current}} von {{total}}",prev:"Zurück",next:"Weiter"},errors:{failedToLoad:"Datei konnte nicht geladen werden",noMeshes:"Keine Meshes in 3MF-Datei gefunden",unsupportedFormat:"Nicht unterstütztes Dateiformat"}},maintenanceDescriptions:{lubricateCarbonRods:"Schmiermittel auf Karbonstäbe für sanfte Bewegung auftragen",lubricateRails:"Schmiermittel auf Linearschienen für sanfte Bewegung auftragen",cleanNozzle:"Hotend und Düse reinigen, um Verstopfungen zu verhindern",checkBelts:"Riemenspannung für präzise Drucke überprüfen",cleanBuildPlate:"Druckplatte für bessere Haftung reinigen",checkExtruder:"Extruderzahnräder auf Verschleiß prüfen",checkCooling:"Sicherstellen, dass Lüfter ordnungsgemäß funktionieren",generalInspection:"Allgemeine Druckerinspektion",cleanCarbonRods:"Karbonstäbe reinigen, um Reibung zu reduzieren",lubricateSteelRods:"Schmiermittel auf Stahlstangen für sanfte Bewegung auftragen",cleanSteelRods:"Stahlstangen reinigen, um Reibung zu reduzieren",cleanLinearRails:"Linearschienen abwischen, um Staub und Schmutz zu entfernen",checkPtfeTube:"PTFE-Schlauch auf Verschleiß oder Beschädigung prüfen",replaceHepaFilter:"HEPA-Filter für Luftqualität ersetzen",replaceCarbonFilter:"Aktivkohlefilter ersetzen",lubricateLeftNozzleRail:"Linke Düsenschiene schmieren (H2-Serie)"},smartPlugs:{offline:"Offline",admin:"Admin",openPlugAdminPage:"Plug-Admin-Seite öffnen",deleteSmartPlug:"Smart Plug löschen",turnOnSmartPlug:"Smart Plug einschalten",turnOffSmartPlug:"Smart Plug ausschalten",turnOn:"Einschalten",turnOff:"Ausschalten",addSmartPlug:{scanningNetwork:"Netzwerk wird durchsucht...",chooseEntity:"Entität auswählen...",connectionFailed:"Verbindung fehlgeschlagen",searchEntities:"Entitäten suchen...",searchPowerSensors:"Leistungssensoren suchen...",searchEnergySensors:"Energiesensoren suchen...",placeholders:{plugName:"Wohnzimmer Steckdose",mqttStateOnValue:"ON, true, 1",mqttSameAsPower:"Gleich wie Leistungs-Topic oder anders"}},linkedTo:"Verbunden mit:",monitorOnly:"Nur Überwachung",alerts:"Alarme",scheduleOn:"Ein {{time}}",scheduleOff:"Aus {{time}}",on:"Ein",off:"Aus",power:"Leistung",kwhToday:"kWh Heute",settings:"Einstellungen",automationSettings:"Automatisierungseinstellungen",showInSwitchbar:"In Schaltleiste anzeigen",quickAccessSidebar:"Schnellzugriff über Seitenleiste",enabled:"Aktiviert",enableAutomation:"Automatisierung für diesen Stecker aktivieren",autoOn:"Auto Ein",autoOnDescription:"Einschalten wenn Druck startet",autoOff:"Auto Aus",autoOffDescription:"Ausschalten wenn Druck abgeschlossen (einmalig)",turnOffDelayMode:"Ausschaltverzögerungsmodus",time:"Zeit",temp:"Temp",delayMinutes:"Verzögerung (Minuten)",tempThreshold:"Temperaturschwelle (°C)",tempThresholdDescription:"Schaltet aus wenn die Düse unter diese Temperatur abkühlt",edit:"Bearbeiten",deleteConfirm:'Möchten Sie "{{name}}" wirklich löschen? Dies kann nicht rückgängig gemacht werden.',turnOnConfirm:'Möchten Sie "{{name}}" wirklich einschalten?',turnOffConfirm:'Möchten Sie "{{name}}" wirklich ausschalten? Dies unterbricht die Stromversorgung des angeschlossenen Geräts.',failedToTurn:'{{name}}" konnte nicht {{action}} werden',unknown:"Unbekannt",addTitle:"Smart Plug hinzufügen",editTitle:"Smart Plug bearbeiten",stopScanning:"Suche beenden",discoverTasmota:"Tasmota Geräte suchen",foundDevices:"{{count}} Gerät(e) gefunden - zum Auswählen klicken:",noDevicesFound:"Keine Tasmota Geräte in Ihrem Netzwerk gefunden",haNotConfigured:"Home Assistant ist nicht konfiguriert. Einrichtung unter",haSettingsPath:"Einstellungen → Netzwerk → Home Assistant",selectEntity:"Entität auswählen *",ipAddress:"IP-Adresse *",nameLabel:"Name *",username:"Benutzername",password:"Passwort",authHint:"Leer lassen, wenn Ihr Tasmota-Gerät keine Authentifizierung benötigt",linkToPrinter:"Mit Drucker verbinden",noPrinter:"Kein Drucker (nur manuelle Steuerung)",linkingDescription:"Verknüpfung ermöglicht automatisches Ein-/Ausschalten bei Druckstart/-ende",powerAlerts:"Leistungsalarme",alertAbove:"Alarm wenn über (W)",alertBelow:"Alarm wenn unter (W)",alertDescription:"Benachrichtigung wenn der Stromverbrauch diese Schwellenwerte überschreitet. Leer lassen um diese Richtung zu deaktivieren.",dailySchedule:"Tagesplan",turnOnAt:"Einschalten um",turnOffAt:"Ausschalten um",scheduleDescription:"Den Stecker automatisch täglich zu diesen Zeiten ein-/ausschalten. Leer lassen um diese Aktion zu überspringen.",showOnPrinterCard:"Auf Druckerkarte anzeigen",displayOnPrinterCard:"Schaltfläche auf Druckerkarte anzeigen",connectedResult:"Verbunden!",deviceLabel:"Gerät: {{name}} - ",stateLabel:"Status: {{state}}",test:"Test",delete:"Löschen",save:"Speichern",add:"Hinzufügen",cancel:"Abbrechen",failedToStartScan:"Suche konnte nicht gestartet werden",nameRequired:"Name ist erforderlich",entityRequired:"Entität ist für Home Assistant Stecker erforderlich",mqttTopicRequired:"Mindestens ein MQTT-Topic muss für Leistung, Energie oder Statusüberwachung konfiguriert sein",loadingEntities:"Entitäten werden geladen...",loading:"Laden...",failedToLoadEntities:"Entitäten konnten nicht geladen werden: {{error}}",noEntitiesMatching:'Keine Entitäten gefunden die "{{search}}" entsprechen',noEntitiesAvailable:"Keine Entitäten verfügbar",searchingEntities:"Alle Entitäten durchsuchen ({{count}} gefunden)",showingEntities:"Zeige switch, light, input_boolean ({{count}} verfügbar)",energyMonitoringOptional:"Energieüberwachung (Optional)",energyMonitoringHint:"Sensoren suchen und auswählen, die Leistungs-/Energiedaten liefern.",powerSensorW:"Leistungssensor (W)",energyTodayKwh:"Energie Heute (kWh)",totalEnergyKwh:"Gesamtenergie (kWh)",noMatchingSensors:"Keine passenden Sensoren",none:"Keine",mqttNotConfigured:"MQTT-Broker nicht konfiguriert. Broker-Adresse einstellen unter",mqttSettingsPath:"Einstellungen → Netzwerk → MQTT-Veröffentlichung",mqttNotConfiguredSuffix:"(Sie müssen die Veröffentlichung nicht aktivieren, nur die Broker-Details ausfüllen).",mqttMonitorOnlyDescription:"MQTT-Stecker empfangen Leistungs-/Energiedaten über MQTT-Abonnement. Ein-/Ausschalten ist nicht verfügbar - verwenden Sie Ihren MQTT-Broker oder Ihr Home-Automation-System.",powerMonitoring:"Leistungsüberwachung",energyMonitoring:"Energieüberwachung",stateMonitoring:"Statusüberwachung",optional:"optional",topic:"Topic",jsonPath:"JSON-Pfad",multiplier:"Multiplikator",onValue:"EIN-Wert",mqttPowerHint:`JSON-Pfad extrahiert Wert aus JSON-Payload (z.B. "power_l1"). Leer lassen wenn Topic rohe numerische Werte sendet.
- Multiplikator 0.001 für mW→W, 1000 für kW→W verwenden.`,mqttEnergyHint:`JSON-Pfad extrahiert Wert aus JSON-Payload. Leer lassen für rohe Werte.
- Multiplikator 0.001 für Wh→kWh, 1000 für MWh→kWh verwenden.`,mqttStateHint:`JSON-Pfad extrahiert Wert aus JSON-Payload. Leer lassen für rohe Werte.
- EIN-Wert: der genaue String der "EIN" bedeutet. Leer lassen für Auto-Erkennung (ON, true, 1).`,noSwitchesInSwitchbar:"Keine Schalter in der Schaltleiste",enableSwitchbarHint:'"In Schaltleiste anzeigen" unter Einstellungen > Smart Plugs aktivieren'},notifications:{providerTypes:{callmebot:"CallMeBot/WhatsApp",ntfy:"ntfy",pushover:"Pushover",telegram:"Telegram",email:"E-Mail",discord:"Discord",webhook:"Webhook",homeassistant:"Home Assistant"},providerDescriptions:{email:"SMTP-E-Mail-Benachrichtigungen",telegram:"Benachrichtigungen über Telegram-Bot",discord:"An Discord-Kanal per Webhook senden",ntfy:"Kostenlose, selbst-hostbare Push-Benachrichtigungen",pushover:"Einfache, zuverlässige Push-Benachrichtigungen",callmebot:"Kostenlose WhatsApp-Benachrichtigungen über CallMeBot",webhook:"Generischer HTTP-POST an beliebige URL",homeassistant:"Dauerhafte Benachrichtigungen im Home Assistant Dashboard"},lastSuccess:"Zuletzt: {{date}}",error:"Fehler",printer:"Drucker:",allPrinters:"Alle Drucker",sendTestNotification:"Testbenachrichtigung senden",eventSettings:"Ereigniseinstellungen",enabled:"Aktiviert",sendFromProvider:"Benachrichtigungen von diesem Anbieter senden",printEvents:"Druckereignisse",printerStatus:"Druckerstatus",amsAlarms:"AMS-Alarme",amsHtAlarms:"AMS-HT-Alarme",printQueue:"Druckwarteschlange",start:"Start",plateCheck:"Plattenkontrolle",complete:"Abgeschlossen",failed:"Fehlgeschlagen",stopped:"Gestoppt",progress:"Fortschritt",offline:"Offline",lowFilament:"Filament niedrig",maintenance:"Wartung",amsHumidity:"AMS-Feuchtigkeit",amsTemp:"AMS-Temperatur",amsHtHumidity:"AMS-HT-Feuchtigkeit",amsHtTemp:"AMS-HT-Temperatur",bedCooled:"Bett abgekühlt",quiet:"Ruhe",digest:"Zusammenfassung {{time}}",printStarted:"Druck gestartet",plateNotEmpty:"Platte nicht leer",plateNotEmptyDescription:"Objekte vor dem Druck erkannt",printCompleted:"Druck abgeschlossen",bedCooledLabel:"Bett abgekühlt",bedCooledDescription:"Bett nach dem Druck unter Schwellenwert abgekühlt",printFailed:"Druck fehlgeschlagen",printStopped:"Druck gestoppt",progressMilestones:"Fortschrittsmeilensteine",progressMilestonesDescription:"Benachrichtigung bei 25%, 50%, 75%",printerOffline:"Drucker offline",printerError:"Druckerfehler",lowFilamentLabel:"Filament niedrig",maintenanceDue:"Wartung fällig",maintenanceDueDescription:"Benachrichtigen, wenn Wartung erforderlich ist",amsHumidityHigh:"AMS-Feuchtigkeit hoch",amsHumidityHighDescription:"Normale AMS-Feuchtigkeit überschreitet Schwellenwert",amsTemperatureHigh:"AMS-Temperatur hoch",amsTemperatureHighDescription:"Normale AMS-Temperatur überschreitet Schwellenwert",amsHtHumidityHigh:"AMS-HT-Feuchtigkeit hoch",amsHtHumidityHighDescription:"AMS-HT-Feuchtigkeit überschreitet Schwellenwert",amsHtTemperatureHigh:"AMS-HT-Temperatur hoch",amsHtTemperatureHighDescription:"AMS-HT-Temperatur überschreitet Schwellenwert",jobAdded:"Auftrag hinzugefügt",jobAddedDescription:"Auftrag zur Warteschlange hinzugefügt",jobAssigned:"Auftrag zugewiesen",jobAssignedDescription:"Modellbasierter Auftrag einem Drucker zugewiesen",jobStarted:"Auftrag gestartet",jobStartedDescription:"Warteschlangenauftrag hat Druck begonnen",jobWaiting:"Auftrag wartet",jobWaitingDescription:"Auftrag wartet auf Filament",jobSkipped:"Auftrag übersprungen",jobSkippedDescription:"Auftrag übersprungen (vorheriger fehlgeschlagen)",jobFailed:"Auftrag fehlgeschlagen",jobFailedDescription:"Auftrag konnte nicht gestartet werden",queueComplete:"Warteschlange abgeschlossen",queueCompleteDescription:"Alle Warteschlangenaufträge beendet",quietHours:"Ruhezeiten",noNotificationsDuring:"Keine Benachrichtigungen während dieser Zeiten",editProviderToChangeQuietHours:"Anbieter bearbeiten, um Ruhezeiten zu ändern",dailyDigest:"Tägliche Zusammenfassung",batchNotifications:"Benachrichtigungen zu einer täglichen Zusammenfassung bündeln",sendAt:"Senden um {{time}}",editProviderToChangeDigestTime:"Anbieter bearbeiten, um Zusammenfassungszeit zu ändern",edit:"Bearbeiten",deleteProvider:"Benachrichtigungsanbieter löschen",deleteConfirm:'Sind Sie sicher, dass Sie "{{name}}" löschen möchten? Dies kann nicht rückgängig gemacht werden.',delete:"Löschen",addTitle:"Benachrichtigungsanbieter hinzufügen",editTitle:"Benachrichtigungsanbieter bearbeiten",nameLabel:"Name *",namePlaceholder:"Meine Benachrichtigungen",providerTypeLabel:"Anbietertyp *",configuration:"Konfiguration",testConfiguration:"Konfiguration testen",printerFilter:"Druckerfilter",onlyFromPrinter:"Nur Benachrichtigungen für Ereignisse von diesem Drucker senden",quietHoursDnd:"Ruhezeiten (Nicht stören)",quietStart:"Start",quietEnd:"Ende",dailyDigestLabel:"Tägliche Zusammenfassung",sendDigestAt:"Zusammenfassung senden um",digestCollected:"Ereignisse werden gesammelt und als einzelne Zusammenfassung zu dieser Zeit gesendet",notificationEvents:"Benachrichtigungsereignisse",progressPercent:"(25%, 50%, 75%)",bedCooledAfterPrint:"(nach Druckabschluss)",cancel:"Abbrechen",save:"Speichern",add:"Hinzufügen",nameRequired:"Name ist erforderlich",fieldRequired:"{{field}} ist erforderlich",phoneNumber:"Telefonnummer",apiKey:"API-Schlüssel",serverUrl:"Server-URL",topic:"Thema",authToken:"Auth-Token",userKey:"Benutzerschlüssel",appToken:"App-Token",priority:"Priorität",botToken:"Bot-Token",chatId:"Chat-ID",smtpServer:"SMTP-Server",smtpPort:"SMTP-Port",security:"Sicherheit",authentication:"Authentifizierung",username:"Benutzername",password:"Passwort",fromEmail:"Absender-E-Mail",toEmail:"Empfänger-E-Mail",webhookUrl:"Webhook-URL",payloadFormat:"Payload-Format",authorization:"Autorisierung",titleFieldName:"Titel-Feldname",messageFieldName:"Nachrichten-Feldname",editTemplate:"Vorlage bearbeiten: {{name}}",titleLabel:"Titel",bodyLabel:"Inhalt",titlePlaceholder:"Benachrichtigungstitel...",bodyPlaceholder:"Benachrichtigungsinhalt...",availableVariables:"Verfügbare Variablen",clickToInsert:"Klicken, um an Cursorposition im Inhalt einzufügen",livePreview:"Live-Vorschau",hide:"Ausblenden",show:"Anzeigen",loadingPreview:"Vorschau wird geladen...",enterTemplateContent:"Vorlageninhalt eingeben, um Vorschau zu sehen",titlePreview:"Titel:",bodyPreview:"Inhalt:",resetToDefault:"Auf Standard zurücksetzen",titleRequired:"Titel ist erforderlich",bodyRequired:"Inhalt ist erforderlich",notificationLog:"Benachrichtigungsprotokoll",showFailedOnly:"Nur fehlgeschlagene",last24Hours:"Letzte 24 Stunden",last7Days:"Letzte 7 Tage",last30Days:"Letzte 30 Tage",last90Days:"Letzte 90 Tage",justNow:"Gerade eben",noFailedNotifications:"Keine fehlgeschlagenen Benachrichtigungen",noNotificationsLogged:"Keine Benachrichtigungen protokolliert",unknownProvider:"Unbekannter Anbieter",logTitle:"Titel",logMessage:"Nachricht",logError:"Fehler",logProvider:"Anbieter: {{type}}",logTime:"Zeit: {{time}}",refresh:"Aktualisieren",clearOld:"Alte löschen",statsSummary:"Letzte {{days}} Tage:",statsNotifications:"Benachrichtigungen",statsSent:"{{count}} gesendet",statsFailed:"{{count}} fehlgeschlagen",eventTypes:{print_start:"Druck gestartet",print_complete:"Druck abgeschlossen",print_failed:"Druck fehlgeschlagen",print_stopped:"Druck gestoppt",print_progress:"Fortschritt",printer_offline:"Drucker offline",printer_error:"Druckerfehler",filament_low:"Filament niedrig",maintenance_due:"Wartung fällig",test:"Test"}},richTextEditor:{bold:"Fett",italic:"Kursiv",underline:"Unterstrichen",bulletList:"Aufzählungsliste",numberedList:"Nummerierte Liste",alignLeft:"Linksbündig",alignCenter:"Zentriert",alignRight:"Rechtsbündig",addLink:"Link hinzufügen",removeLink:"Link entfernen"},externalLinks:{noLinksConfigured:"Keine externen Links konfiguriert",deleteLink:"Link löschen",removeCustomIcon:"Benutzerdefiniertes Symbol entfernen",openInNewTab:"In neuem Tab öffnen",placeholders:{linkName:"Mein Link"}},keyboardShortcuts:{title:"Tastaturkürzel",navigation:"Navigation",archivesSection:"Archive",kProfilesSection:"K-Profile",generalSection:"Allgemein",shortcuts:{goToPrinters:"Zu Drucker gehen",goToArchives:"Zu Archiv gehen",goToQueue:"Zur Warteschlange gehen",goToStats:"Zu Statistiken gehen",goToProfiles:"Zu Cloud-Profilen gehen",goToSettings:"Zu Einstellungen gehen",focusSearch:"Suche fokussieren",openUploadModal:"Upload-Modal öffnen",clearSelection:"Auswahl löschen / Eingabe aufheben",contextMenu:"Kontextmenü auf Karten",refreshProfiles:"Profile aktualisieren",newProfile:"Neues Profil",exitSelectionMode:"Auswahlmodus beenden",showHelp:"Diese Hilfe anzeigen"},footer:"Drücken Sie Esc oder klicken Sie außerhalb, um zu schließen"},notificationLog:{title:"Benachrichtigungsprotokoll",events:{printStarted:"Druck gestartet",printComplete:"Druck abgeschlossen",printFailed:"Druck fehlgeschlagen",printStopped:"Druck gestoppt",progress:"Fortschritt",printerOffline:"Drucker offline",printerError:"Druckerfehler",lowFilament:"Wenig Filament",maintenanceDue:"Wartung fällig",test:"Test"},timeAgo:{justNow:"Gerade eben",minutesAgo:"vor {{minutes}}m",hoursAgo:"vor {{hours}}h"}},restoreBackup:{title:"Backup wiederherstellen",restoring:"Wird wiederhergestellt...",restoreComplete:"Wiederherstellung abgeschlossen",restoreFailed:"Wiederherstellung fehlgeschlagen",importSettings:"Einstellungen aus Backup-Datei importieren",pleaseWait:"Bitte warten Sie, während Ihre Daten wiederhergestellt werden",clickToSelect:"Klicken Sie, um Backup-Datei auszuwählen (.json oder .zip)",howDuplicateHandling:"So funktioniert die Duplikatbehandlung:",categories:{printers:"Drucker",smartPlugs:"Smart Plugs",notificationProviders:"Benachrichtigungsanbieter",filaments:"Filamente",archives:"Archive",pendingUploads:"Ausstehende Uploads",settingsTemplates:"Einstellungen & Vorlagen"},matchingInfo:{printers:"abgeglichen nach Seriennummer",smartPlugs:"abgeglichen nach IP-Adresse",notificationProviders:"abgeglichen nach Name",filaments:"abgeglichen nach Name + Typ + Marke",archives:"abgeglichen nach Inhalts-Hash",pendingUploads:"abgeglichen nach Dateiname",settingsTemplates:"immer überschrieben"},replaceExisting:"Vorhandene Daten ersetzen",keepExisting:"Vorhandene Daten behalten",replaceDescription:"Bereits vorhandene Elemente mit Backup-Daten überschreiben",keepDescription:"Nur Elemente wiederherstellen, die noch nicht existieren",caution:"Vorsicht:",cautionText:"Das Überschreiben ersetzt Ihre aktuellen Konfigurationen durch Backup-Daten. Drucker-Zugangscodes werden aus Sicherheitsgründen niemals überschrieben.",itemsRestored:"Wiederhergestellte Elemente",itemsSkipped:"Übersprungene Elemente",restored:"Wiederhergestellt",skipped:"Übersprungen (existieren bereits)",filesLabel:"Dateien (3MF, Thumbnails, etc.)",newApiKeysGenerated:"Neue API-Schlüssel generiert",newApiKeysWarning:"Diese Schlüssel werden nur einmal angezeigt. Kopieren Sie sie jetzt!",processingBackup:"Backup-Datei wird verarbeitet...",noDataFound:"In der Backup-Datei wurden keine wiederherzustellenden Daten gefunden.",failedToRestore:"Backup konnte nicht wiederhergestellt werden. Bitte überprüfen Sie das Dateiformat."},backupExport:{title:"Backup exportieren",selectData:"Zu exportierende Daten auswählen",selectAll:"Alle auswählen",selectNone:"Keine auswählen",categoryDescriptions:{settings:"Sprache, Theme, Update-Einstellungen",notifications:"ntfy, Pushover, Discord, usw.",templates:"Benutzerdefinierte Nachrichtenvorlagen",smartPlugs:"Tasmota-Plug-Konfigurationen",externalLinks:"Seitenleiste Links zu externen Diensten",printers:"Druckerinformationen (Zugangscodes ausgeschlossen)",plateDetection:"Leere Platten-Referenzbilder",filaments:"Filamenttypen und -kosten",maintenance:"Benutzerdefinierte Wartungspläne",archives:"Alle Druckdaten + Dateien (3MF, Thumbnails, Fotos)",projects:"Projekte, BOM-Elemente und Anhänge",pendingUploads:"Virtueller Drucker-Uploads zur Überprüfung",apiKeys:"Webhook-API-Schlüssel (neue Schlüssel bei Import generiert)"},requiresPrinters:"Drucker müssen ausgewählt sein",zipFileWarning:"ZIP-Datei wird erstellt.",zipFileDescription:"Enthält alle 3MF-Dateien, Thumbnails, Zeitraffer und Fotos. Dies kann eine Weile dauern und zu einer großen Datei führen.",includeAccessCodes:"Zugangscodes einschließen",includeAccessCodesDescription:"Für die Übertragung auf eine andere Maschine",includeAccessCodesWarning:"Zugangscodes werden im Klartext eingeschlossen. Bewahren Sie diese Backup-Datei sicher auf!",categoriesSelected:"{{selectedCount}} Kategorien ausgewählt"},pendingUploads:{placeholders:{notes:"Notizen zu diesem Druck hinzufügen..."},discardUpload:"Upload verwerfen",archiveAllUploads:"Alle Uploads archivieren",discardAllUploads:"Alle Uploads verwerfen",archive:"Archivieren",timeAgo:{justNow:"Gerade eben",minutesAgo:"vor {{minutes}}m",hoursAgo:"vor {{hours}}h",daysAgo:"vor {{days}}d"}},apiBrowser:{placeholders:{requestBody:"JSON-Anforderungstext...",searchEndpoints:"Endpunkte suchen..."}},configureAmsSlot:{title:"AMS-Slot konfigurieren",slotConfigured:"Slot konfiguriert!",configuringSlot:"Slot wird konfiguriert:",slotLabel:"{{ams}} Slot {{slot}}",searchPresets:"Voreinstellungen suchen...",colorPlaceholder:"Farbname oder Hex (z.B. braun, FF8800)",clearCustomColor:"Benutzerdefinierte Farbe löschen",noCloudPresets:"Keine Cloud-Voreinstellungen. Melden Sie sich bei Bambu Cloud an, um zu synchronisieren.",noPresetsAvailable:"Keine Voreinstellungen verfügbar. Melden Sie sich bei Bambu Cloud an oder importieren Sie lokale Profile.",noMatchingPresets:"Keine passenden Voreinstellungen gefunden.",custom:"Benutzerdefiniert",builtin:"Integriert",settingsSentToPrinter:"Einstellungen an Drucker gesendet",filamentProfile:"Filamentprofil",kProfileLabel:"K-Profil (Pressure Advance)",filteringFor:"Filtern nach: {{material}}",noKProfile:"Kein K-Profil (Standard 0.020 verwenden)",noMatchingKProfiles:"Keine passenden K-Profile gefunden. Standard K=0.020 wird verwendet.",selectFilamentFirst:"Zuerst ein Filamentprofil auswählen",kFromCalibration:"K={{value}} aus Druckerkalibrierung",customColorLabel:"Benutzerdefinierte Farbe (optional)",presetColors:"{{name}} Farben:",showLessColors:"Weniger Farben anzeigen",showMoreColors:"Mehr Farben anzeigen",clear:"Löschen",hexLabel:"Hex: #{{hex}}",resetting:"Wird zurückgesetzt...",resetSlot:"Slot zurücksetzen",cancel:"Abbrechen",configuring:"Wird konfiguriert...",configureSlot:"Slot konfigurieren"},githubBackup:{title:"GitHub-Backup",history:"Verlauf",downloadBackup:"Backup herunterladen",restoreBackup:"Backup wiederherstellen",noBackupsYet:"Noch keine Backups"},emailSettings:{placeholders:{fromName:"BamBuddy"}},tagManagement:{searchTags:"Tags suchen...",renameTag:"Tag umbenennen",deleteTag:"Tag löschen"},notificationTemplates:{placeholders:{title:"Benachrichtigungstitel...",body:"Benachrichtigungstext..."}},batchTag:{placeholders:{newTag:"Neuen Tag eingeben..."}},photoGallery:{deletePhoto:"Foto löschen"},filamentHoverCard:{copySpoolUuid:"Spulen-UUID kopieren"},kProfilesView:{hasNote:"Hat Notiz",copyProfile:"Profil kopieren"},layout:{openMenu:"Menü öffnen",noPermissionSystemInfo:"Sie haben keine Berechtigung zum Anzeigen von Systeminformationen"},dashboard:{dragToReorder:"Ziehen zum Neuordnen",hideWidget:"Widget ausblenden"},notificationProviderCard:{deleteNotificationProvider:"Benachrichtigungsanbieter löschen"},fileManagerModal:{closeFileManager:"Dateimanager schließen",sortFiles:"Dateien sortieren",goToParentFolder:"Zum übergeordneten Ordner gehen",threeView:"3D-Ansicht"},embeddedCameraViewer:{refreshStream:"Stream aktualisieren",close:"Schließen",zoomOut:"Verkleinern",resetZoom:"Zoom zurücksetzen",zoomIn:"Vergrößern",dragToResize:"Ziehen zum Größe ändern"},timelapseViewer:{skipBack5s:"5s zurückspringen",skipForward5s:"5s vorspringen"},notificationProviders:{descriptions:{email:"SMTP-E-Mail-Benachrichtigungen",telegram:"Benachrichtigungen über Telegram-Bot",discord:"An Discord-Kanal über Webhook senden",ntfy:"Kostenlose, selbst hostbare Push-Benachrichtigungen",pushover:"Einfache, zuverlässige Push-Benachrichtigungen",callmebot:"Kostenlose WhatsApp-Benachrichtigungen über CallMeBot",webhook:"Generischer HTTP POST zu beliebiger URL"}},logViewer:{searchPlaceholder:"Nachricht oder Logger-Name suchen...",noLogEntries:"Keine Logeinträge gefunden"},switchbarPopover:{noSwitchesInSwitchbar:"Keine Schalter in Schalterleiste"},projectPageModal:{placeholders:{title:"Titel",designer:"Designer",license:"Lizenz",description:"Beschreibung eingeben...",profileTitle:"Profil-Titel",profileDescription:"Profilbeschreibung..."}},spoolmanSettings:{},time:{unknown:"-",waiting:"Wartend",justNow:"Gerade eben",now:"Jetzt",minsAgo:"vor {{count}}m",inMins:"in {{count}}m",hoursAgo:"vor {{count}}h",inHours:"in {{count}}h",daysAgo:"vor {{count}}d",inDays:"in {{count}}d"},spoolbuddy:{nav:{dashboard:"Dashboard",ams:"AMS",inventory:"Inventar",writeTag:"Schreiben",settings:"Einstellungen"},status:{nfcReady:"NFC bereit",nfcOff:"NFC aus",offline:"Offline",online:"Online",noPrinters:"Keine Drucker",deviceOffline:"Gerät offline",waitingConnection:"Warte auf Geräteverbindung...",systemReady:"System bereit",status:"Status"},dashboard:{readyToScan:"Bereit zum Scannen",idleMessage:"Spule auf die Waage legen zum Identifizieren",nfcHint:"NFC-Tag wird automatisch gelesen",device:"Gerät",syncWeight:"Gewicht sync.",weightSynced:"Synchronisiert!",unknownTag:"Unbekannter Tag",newTag:"Neuer Tag erkannt",onScale:"auf der Waage",linkSpool:"Mit Spule verknüpfen",linkTagTitle:"Tag mit Spule verknüpfen",linkTag:"Tag verknüpfen",selectSpool:"Spule zum Verknüpfen auswählen:",noUntagged:"Keine Spulen ohne Tags gefunden",tagDetected:"Tag erkannt",noTag:"Kein Tag",tagId:"Tag",grossWeight:"Bruttogewicht",spoolSize:"Spulengröße",close:"Schließen",currentSpool:"Aktuelle Spule"},modal:{spoolDetected:"Spule erkannt",assignToAms:"AMS zuweisen",syncWeight:"Gewicht sync.",weightSynced:"Synchronisiert!",syncing:"Synchronisiere...",newTagDetected:"Neuer Tag erkannt",addToInventory:"Zum Inventar hinzufügen",assignToAmsTitle:"AMS zuweisen",selectSlot:"Slot auswählen",assign:"Zuweisen",assigning:"Zuweisen...",assignSuccess:"Zugewiesen!",assignError:"Fehler beim Zuweisen. Bitte erneut versuchen.",noPrinterSelected:"Drucker auswählen...",noAmsDetected:"Kein AMS an diesem Drucker erkannt",slot:"Slot"},weight:{noReading:"Kein Messwert",stable:"Stabil",measuring:"Messen...",tare:"Tarieren",calibrate:"Kalibrieren"},spool:{remaining:"Verbleibend",material:"Material",brand:"Marke",color:"Farbe",coreWeight:"Kern",labelWeight:"Etikett",scaleWeight:"Waage",netWeight:"Netto",lastUsed:"Zuletzt verwendet"},ams:{noData:"Kein AMS erkannt",connectAms:"AMS anschließen um Filament-Slots zu sehen",noPrinter:"Kein Drucker ausgewählt",selectPrinter:"Drucker in der oberen Leiste auswählen",printerDisconnected:"Drucker getrennt",humidity:"Feuchtigkeit",level:"Stufe",active:"Aktiv",slot:"Slot",empty:"Leer"},inventory:{search:"Spulen suchen...",empty:"Keine Spulen im Inventar",noResults:"Keine passenden Spulen",spools:"Spulen",addSpool:"Spule hinzufügen"},settings:{tabDevice:"Gerät",tabDisplay:"Anzeige",tabScale:"Waage",tabUpdates:"Updates",nfcReader:"NFC-Leser",type:"Typ",connection:"Verbindung",notConnected:"N/A",deviceInfo:"Geräteinfo",hostname:"Host",uptime:"Betriebszeit",brightness:"Helligkeit",saved:"Gespeichert",noBacklight:"Keine DSI-Hintergrundbeleuchtung erkannt. Helligkeitssteuerung erfordert ein DSI-Display.",screenBlank:"Bildschirm-Abschaltzeit",screenBlankDesc:"Bildschirm schaltet sich nach Inaktivität ab. Zum Aufwecken berühren.",displayNote:"Helligkeit wird als Software-Filter angewendet.",scaleCalibration:"Waagen-Kalibrierung",currentWeight:"Aktuelles Gewicht",tareOffset:"Tara",calFactor:"Faktor",knownWeight:"Bekanntes Gewicht",calStep1:"Alle Gegenstände von der Waage entfernen und Nullpunkt setzen.",calStep2:"Bekanntes Gewicht auf die Waage legen.",setZero:"Nullpunkt setzen",calibrateNow:"Kalibrieren",calibrated:"Kalibriert",tareSet:"Tara-Befehl gesendet. Warte auf Gerät...",tareFailed:"Tara-Befehl fehlgeschlagen",zeroSet:"Nullpunkt gesetzt. Bekanntes Gewicht auf die Waage legen.",calibrationDone:"Kalibrierung abgeschlossen!",calibrationFailed:"Kalibrierung fehlgeschlagen",lastCalibrated:"Zuletzt kalibriert",stable:"Stabil",settling:"Stabilisierung...",firmware:"Firmware",scale:"Waage",noDevice:"Kein SpoolBuddy-Gerät gefunden",daemonVersion:"Daemon-Version",currentVersion:"Aktuell",versionPending:"Warte auf Daemon...",checking:"Prüfe...",checkUpdates:"Nach Updates suchen",updateAvailable:"Update verfügbar",updateInstructions:"Update per SSH: SpoolBuddy-Installationsskript ausführen.",upToDate:"Aktuell",includeBeta:"Beta-Versionen einschließen"},writeTag:{tabExisting:"Vorhandene Spule",tabNew:"Neue Spule",tabReplace:"Tag ersetzen",searchPlaceholder:"Suche nach Material, Farbe, Marke...",noUntaggedSpools:"Keine Spulen ohne Tags",noTaggedSpools:"Keine Spulen mit Tags",selectSpool:"Spule auswählen, dann einen NTAG auf den Leser legen",placeTag:"NTAG auf den Leser legen",tagReady:"Tag erkannt — bereit zum Schreiben",writeTag:"Tag beschreiben",replaceTag:"Tag ersetzen",writing:"Tag wird beschrieben...",waiting:"Warte auf SpoolBuddy...",writeSuccess:"Tag erfolgreich beschrieben!",writeFailed:"Schreiben fehlgeschlagen",queueFailed:"Schreibbefehl konnte nicht eingereiht werden",tryAgain:"Erneut versuchen",cancel:"Abbrechen",replaceWarning:"Alter Tag wird getrennt. Neuer Tag ersetzt ihn.",deviceOffline:"SpoolBuddy ist offline",material:"Material",colorName:"Farbname",color:"Farbe",brand:"Marke",weight:"Gewicht (g)",createSpool:"Spule erstellen",creating:"Wird erstellt...",spoolCreated:"Spule erstellt! Bereit zum Schreiben.",createFailed:"Spule konnte nicht erstellt werden"}},bugReport:{title:"Fehler melden",description:"Beschreibung",descriptionPlaceholder:"Was ist schiefgelaufen? Bitte beschreiben Sie das Problem...",email:"E-Mail (optional)",emailPlaceholder:"ihre@email.de",emailPrivacy:"Falls angegeben, wird Ihre E-Mail in einem eingeklappten Abschnitt des GitHub-Issues aufgeführt, damit der Betreuer sich melden kann.",screenshot:"Screenshot",uploadOrPaste:"Bild hochladen, einfügen oder ziehen",dataCollectedSummary:"Welche Daten werden im Bericht gesendet?",dataIncluded:"Enthalten:",dataIncludedList:"App-Version, Betriebssystem, Architektur, Python-Version, Datenbankstatistiken (nur Anzahl), Druckermodelle, Düsenanzahl, Firmware-Versionen, Verbindungsstatus, Integrationsstatus (Spoolman, MQTT, HA), nicht-sensible Einstellungen, Netzwerkschnittstellenanzahl, Docker-Details, Abhängigkeitsversionen.",dataNeverIncluded:"Nie enthalten:",dataNeverIncludedList:"Druckernamen, Seriennummern, Zugangscodes, Passwörter, IP-Adressen, E-Mail-Adressen, API-Schlüssel, Tokens, Webhook-URLs, Hostnamen oder Benutzernamen.",submit:"Absenden",collectingLogs:"Diagnoseprotokolle werden gesammelt...",collectingLogsHint:"Debug-Protokollierung aktiviert, Drucker werden nach aktuellen Daten abgefragt.",submitting:"Fehlerbericht wird gesendet...",submitSuccess:"Fehlerbericht erfolgreich gesendet!",submitFailed:"Fehlerbericht konnte nicht gesendet werden",thankYou:"Vielen Dank!",submitted:"Ihr Fehlerbericht wurde eingereicht.",viewIssue:"Issue ansehen",unexpectedError:"Ein unerwarteter Fehler ist aufgetreten",countdownSeconds:"{{seconds}}s"}},Zce={nav:{printers:"Imprimantes",archives:"Archives",queue:"File d'attente",stats:"Statistiques",profiles:"Profils",maintenance:"Maintenance",projects:"Projets",inventory:"Filament",files:"Gestionnaire de fichiers",settings:"Paramètres",system:"Système",collapseSidebar:"Réduire la barre latérale",expandSidebar:"Développer la barre latérale",update:"Mise à jour",updateAvailable:"Mise à jour disponible : v{{version}}",updateAvailableBanner:"La version {{version}} est disponible !",viewUpdate:"Voir la mise à jour",viewOnGithub:"Voir sur GitHub",keyboardShortcuts:"Raccourcis clavier (?)",switchToLight:"Passer au mode clair",switchToDark:"Passer au mode sombre",smartSwitches:"Interrupteurs intelligents",logout:"Déconnexion"},common:{save:"Enregistrer",saving:"Enregistrement...",cancel:"Annuler",delete:"Supprimer",edit:"Modifier",add:"Ajouter",close:"Fermer",confirm:"Confirmer",loading:"Chargement...",error:"Erreur",success:"Succès",warning:"Avertissement",enabled:"Activé",disabled:"Désactivé",yes:"Oui",no:"Non",on:"On",off:"Off",all:"Tous",none:"Aucun",search:"Rechercher",filter:"Filtrer",sort:"Trier",refresh:"Actualiser",download:"Télécharger",upload:"Téléverser",uploading:"Téléversement...",uploadFailed:"Échec du téléversement",actions:"Actions",status:"Statut",name:"Nom",description:"Description",date:"Date",time:"Heure",hours:"heures",minutes:"minutes",seconds:"secondes",days:"jours",enable:"Activer",disable:"Désactiver",permissions:"Autorisations",noPrinters:"Aucune imprimante configurée",noData:"Aucune donnée disponible",linkNotFound:"Lien non trouvé",required:"Requis",optional:"Optionnel",dismiss:"Ignorer",apply:"Appliquer",reset:"Réinitialiser",export:"Exporter",import:"Importer",clear:"Effacer",selectAll:"Tout sélectionner",deselectAll:"Tout désélectionner",noChange:"— Aucun changement —",unchanged:"Inchangé",unassigned:"Non assigné",unknown:"Inconnu",unknownError:"Erreur inconnue",today:"Aujourd'hui",tomorrow:"Demain",asap:"Dès que possible",overdue:"En retard",now:"Maintenant",collapse:"Réduire",expand:"Développer",viewArchive:"Voir l'archive",viewInFileManager:"Voir dans le gestionnaire de fichiers",addedBy:"Ajouté par {{username}}",prints:"impressions",more:"+{{count}} de plus",ascending:"Croissant",descending:"Décroissant",printer:"Imprimante",remove:"Retirer",type:"Type",print:"Imprimer",rename:"Renommer",move:"Déplacer",create:"Créer",duplicate:"Dupliquer",left:"Gauche",right:"Droite"},printers:{title:"Imprimantes",addPrinter:"Ajouter une imprimante",editPrinter:"Modifier l'imprimante",deletePrinter:"Supprimer l'imprimante",printerName:"Nom de l'imprimante",serialNumber:"Numéro de série",ipAddress:"Adresse IP / Nom d'hôte",accessCode:"Code d'accès",model:"Modèle",nozzleCount:"Nombre de buses",autoArchive:"Auto-archivage",status:{available:"Disponible",idle:"Inactif",printing:"Impression en cours",paused:"En pause",offline:"Hors ligne",error:"Erreur",finished:"Terminé",unknown:"Inconnu"},temperatures:{nozzle:"Buse",bed:"Plateau",chamber:"Chambre"},progress:"{{percent}}% terminé",timeRemaining:"{{time}} restant",deleteConfirm:'Êtes-vous sûr de vouloir supprimer "{{name}}" ?',maintenanceOk:"Maintenance OK",maintenanceWarning:"{{count}} avertissement",maintenanceWarning_plural:"{{count}} avertissements",maintenanceDue:"{{count}} échéance",maintenanceDue_plural:"{{count}} échéances",sort:{name:"Nom",status:"Statut",model:"Modèle",location:"Emplacement",ascending:"Tri croissant",descending:"Tri décroissant"},cardSize:{small:"Petites cartes",medium:"Cartes moyennes",large:"Grandes cartes",extraLarge:"Très grandes cartes"},hideOffline:"Masquer hors ligne",nextAvailable:"Prochaine disponible",powerOn:"Allumer",offlinePrintersWithPlugs:"Imprimantes hors ligne avec prises connectées",noPrintersConfigured:"Aucune imprimante configurée pour le moment",readyToPrint:"Prête à imprimer",external:"Externe",extL:"Ext-L",extR:"Ext-R",deleteArchives:"Supprimer les archives d'impression",noLabel:"Pas d'étiquette",printPreview:"Aperçu avant impression",width:"Largeur",height:"Hauteur",noObjectsFound:"Aucun objet trouvé",objectsLoadedOnPrintStart:"Les objets sont chargés au début de l'impression",willBeSkipped:"Sera sauté",name:"Nom",serialCannotBeChanged:"Le numéro de série ne peut pas être modifié",locationHelp:"Utilisé pour grouper les imprimantes et filtrer la file d'attente",wifiSignal:{veryWeak:"Très faible",weak:"Faible",fair:"Moyen",good:"Bon",excellent:"Excellent"},maintenanceUpToDate:"Maintenance à jour - Cliquez pour voir",chamberLightOn:"Allumer la lumière de la chambre",chamberLightOff:"Éteindre la lumière de la chambre",files:"Fichiers",browseFiles:"Parcourir les fichiers de l'imprimante",autoOffAfterPrint:"Extinction auto après impression",autoOffExecuted:"Extinction auto exécutée - rallumez pour réinitialiser",hmsErrors:"Erreurs HMS",viewHmsErrors:"Voir {{count}} erreur(s) HMS",resume:"Reprendre",pause:"Pause",stop:"Arrêter",camera:"Caméra",skipObject:"Sauter l'objet",reconnect:"Reconnecter",mqttDebug:"Débogage MQTT",printerInformation:"Informations imprimante",copyToClipboard:"Copier",copied:"Copié !",state:"État",wifiSignalLabel:"Signal WiFi",developerMode:"Mode développeur",enabled:"Activé",disabled:"Désactivé",addedOn:"Ajoutée le",sdCard:"Carte SD",inserted:"Insérée",notInserted:"Non insérée",totalPrintHours:"Heures d'impression",activeNozzle:"Active : buse {{nozzle}}",nozzleRack:"Rack à buses",nozzleDocked:"Rangée",nozzleMounted:"Montée",nozzleActive:"Active",nozzleIdle:"Inactive",nozzleDiameter:"Diamètre",nozzleType:"Type",nozzleStatus:"Statut",nozzleFilament:"Filament",nozzleWear:"Usure",nozzleMaxTemp:"Temp Max",nozzleSerial:"Série",nozzleHardenedSteel:"Acier Trempé",nozzleStainlessSteel:"Acier Inoxydable",nozzleTungstenCarbide:"Carbure de Tungstène",nozzleFlow:"Débit",nozzleHighFlow:"Haut débit",nozzleStandardFlow:"Standard",firmwareUpdate:"Mise à jour Firmware",firmwareInstructions:"Sur l'écran de l'imprimante, allez dans",firmwareNav:"Naviguez vers",settings:"Paramètres",firmware:"Firmware",discoverPrinters:"Découvrir les imprimantes",searching:"Recherche...",manualEntry:"Saisie manuelle",addFromCloud:"Ajouter depuis le Cloud",toast:{printerDeleted:"Imprimante supprimée",printerAdded:"Imprimante ajoutée",printerUpdated:"Imprimante mise à jour",failedToDelete:"Échec de la suppression",failedToAdd:"Échec de l'ajout",failedToUpdate:"Échec de la mise à jour",commandSent:"Commande envoyée",failedToSendCommand:"Échec de l'envoi de la commande",turnedOn:"{{name}} allumée",failedToPowerOn:"Échec de l'allumage de {{name}}",scriptTriggered:"Script déclenché",printStopped:"Impression arrêtée",printPaused:"Impression en pause",printResumed:"Impression reprise",referenceDeleted:"Référence supprimée",detectionAreaSaved:"Zone de détection enregistrée",failedToRunScript:"Échec du script",failedToStopPrint:"Échec de l'arrêt",failedToPausePrint:"Échec de la mise en pause",failedToResumePrint:"Échec de la reprise",failedToControlChamberLight:"Échec du contrôle de la lumière",failedToUpdateSetting:"Échec de mise à jour du paramètre",failedToSkipObjects:"Échec du saut d'objets",failedToRereadRfid:"Échec lecture RFID",failedToCheckPlate:"Échec vérification plateau",failedToUpdateLabel:"Échec mise à jour étiquette",failedToDeleteReference:"Échec suppression référence",failedToSaveDetectionArea:"Échec enregistrement zone",plateCheckEnabled:"Vérification plateau activée",plateCheckDisabled:"Vérification plateau désactivée",calibrationSaved:"Calibration enregistrée !",calibrationFailed:"Échec de la calibration",rfidRereadInitiated:"Lecture RFID initiée"},connection:{connected:"Connecté",offline:"Hors ligne"},queue:{inQueue:"{{count}} impression en file",inQueue_plural:"{{count}} impressions en file"},controls:"Contrôles",rfid:{reread:"Relire RFID"},permission:{noAdd:"Pas d'autorisation pour ajouter",noEdit:"Pas d'autorisation pour modifier",noDelete:"Pas d'autorisation pour supprimer",noControl:"Pas d'autorisation pour contrôler",noFiles:"Pas d'autorisation pour les fichiers",noAmsRfid:"Pas d'autorisation pour le RFID",noSmartPlugControl:"Pas d'autorisation pour les prises",noCamera:"Pas d'autorisation pour les caméras"},modal:{addTitle:"Ajouter une imprimante",editTitle:"Modifier l'imprimante",myPrinter:"Mon imprimante",selectModel:"Choisir un modèle...",locationGroup:"Emplacement / Groupe (optionnel)",locationPlaceholder:"ex: Atelier, Bureau",autoArchiveLabel:"Auto-archiver les impressions terminées",fromPrinterSettings:"Depuis les paramètres imprimante",modelOptional:"Modèle (optionnel)",saveChanges:"Enregistrer les modifications"},skipObjects:{tooltip:"Sauter des objets",onlyWhilePrinting:"Sauter (uniquement pendant l'impression)",requiresMultiple:"Sauter (nécessite 2+ objets)",title:"Sauter des objets",matchIdsInfo:"Faites correspondre les IDs avec l'écran de l'imprimante",printerShowsIds:"L'écran affiche les IDs des objets sur le plateau",skipSelected:"Sauter la sélection",skipping:"Saut en cours...",noObjectsSelected:"Aucun objet sélectionné",selectObjectsToSkip:"Sélectionnez les objets à ignorer",skipped:"sauté",objectsSkipped:"Objets sautés",activeCount:"{{count}} actifs",waitForLayer:"Attendez la couche 2 pour sauter des objets (actuelle : {{layer}})",skip:"Sauter",confirmTitle:"Sauter l'objet ?",confirmMessage:'Voulez-vous vraiment sauter "{{name}}" ? Cette action est irréversible.'},confirm:{deleteTitle:"Supprimer l'imprimante",deleteMessage:'Supprimer "{{name}}" ? Cela retirera tous les paramètres de connexion.',deleteArchivesNote:"Tout l'historique sera définitivement supprimé.",keepArchivesNote:"L'historique sera conservé mais plus associé à cette imprimante.",stopTitle:"Arrêter l'impression",stopMessage:`Arrêter l'impression sur "{{name}}" ?`,stopButton:"Arrêter",pauseTitle:"Mettre en pause",pauseMessage:`Mettre en pause l'impression sur "{{name}}" ?`,pauseButton:"Pause",resumeTitle:"Reprendre l'impression",resumeMessage:`Reprendre l'impression sur "{{name}}" ?`,resumeButton:"Reprendre",powerOnTitle:"Allumer l'imprimante",powerOnMessage:'Allumer "{{name}}" ?',powerOnButton:"Allumer",powerOffTitle:"Éteindre l'imprimante",powerOffMessage:'Éteindre "{{name}}" ?',powerOffWarning:`ATTENTION : "{{name}}" imprime ! L'éteindre maintenant peut endommager l'imprimante.`,powerOffButton:"Éteindre"},discovery:{title:"Découvrir les imprimantes",searching:"Recherche...",scanning:"Scan en cours...",scanProgress:"Scan... {{scanned}}/{{total}}",foundPrinters:"{{count}} imprimante(s) trouvée(s)",noPrintersFound:"Aucune imprimante trouvée",noPrintersFoundSubnet:"Aucune imprimante dans ce sous-réseau.",noPrintersFoundNetwork:"Aucune imprimante sur le réseau.",allConfigured:"Toutes les imprimantes trouvées sont déjà configurées.",alreadyAdded:"Déjà ajoutée",select:"Sélectionner",manualEntry:"Saisie manuelle",addFromCloud:"Ajouter depuis le Cloud",subnetToScan:"Sous-réseau à scanner",dockerNote:"Docker détecté. Entrez le sous-réseau en notation CIDR. Nécessite network_mode: host.",scanSubnet:"Scanner le sous-réseau",discoverNetwork:"Découvrir sur le réseau",scanningSubnet:"Scan du sous-réseau pour imprimantes Bambu...",scanningNetwork:"Scan du réseau...",serialRequired:"Série requis",unknown:"Inconnu",failedToStart:"Échec du démarrage de la découverte"},filaments:"Filaments",openCameraOverlay:"Ouvrir la caméra en superposition",openCameraWindow:"Ouvrir la caméra dans une fenêtre",firmwareUpdateAvailable:"Mise à jour firmware : {{current}} → {{latest}}",firmwareUpToDate:"Firmware {{version}} — À jour",firmwareUpdateButton:"Mettre à jour",plateDetection:{noPermission:"Pas d'autorisation de modification",enabledClick:"Vérification activée - Cliquez pour désactiver",disabledClick:"Vérification désactivée - Cliquez pour activer",manageCalibration:"Gérer la calibration de détection",calibrationRequired:"Calibration requise",calibrationInstructions:"Videz le plateau, puis cliquez sur Calibrer.",calibrationDescription:"Capture une image de référence du plateau vide.",calibrationTip:"Conseil : Stockez jusqu'à 5 références. Le système utilise la meilleure correspondance.",plateEmpty:"Le plateau semble vide",objectsDetected:"Objets détectés sur le plateau",confidence:"Confiance",difference:"Différence",analysisPreview:"Aperçu de l'analyse :",analysisLegend:"Cadre vert = zone, Rouge = différences",savedReferences:"Références ({{count}}/{{max}})",deleteReference:"Supprimer la référence",labelPlaceholder:"Étiquette...",clickToEdit:"{{label}} - Modifier",clickToAddLabel:"Ajouter une étiquette"},fans:{partCooling:"Ventilateur pièce",auxiliary:"Ventilateur auxiliaire",chamber:"Ventilateur chambre"},clickToViewHmsErrors:"Cliquez pour voir les erreurs HMS",estimatedCompletion:"Fin estimée",slotOptions:"Options du slot",amsPopup:{friendlyName:"Nom AMS",friendlyNamePlaceholder:"ex. Nom convivial AMS",serialNumber:"Numéro de série",firmwareVersion:"Firmware",save:"Enregistrer",clear:"Effacer",noEditPermission:"Vous n'avez pas la permission de renommer les unités AMS"},firmwareModal:{title:"Mise à jour Firmware",titleUpToDate:"Infos Firmware",currentVersion:"Actuelle :",latestVersion:"Dernière :",releaseNotes:"Notes de version",checkingPrereqs:"Vérification des prérequis...",sdCardReady:"Carte SD prête. Cliquez pour téléverser.",uploadedSuccess:"Firmware téléversé !",applyInstructions:"Pour appliquer sur l'imprimante :",step1:"Sur l'écran, allez dans Paramètres",step2:"Allez dans Firmware",step3:'Sélectionnez "Mettre à jour depuis carte SD"',step4:"Prévoyez 10-20 minutes",done:"Terminé",starting:"Démarrage...",uploadFirmware:"Téléverser le Firmware",uploadFailed:"Échec du téléversement : {{error}}",uploadedToast:"Firmware téléversé ! Lancez la mise à jour sur l'écran."},accessCodePlaceholder:"Laissez vide pour garder l'actuel",roi:{title:"Zone de détection (ROI)",xStart:"Début X",yStart:"Début Y",width:"Largeur",height:"Hauteur",instruction:"Ajustez le cadre vert pour cibler le plateau."},developerModeWarning:"Le mode développeur LAN n'est pas activé sur : {{names}}. Certaines fonctionnalités peuvent ne pas fonctionner.",howToEnable:"Comment activer",incompatibleFile:"Ce fichier a été tranché pour {{slicedFor}}, mais cette imprimante est une {{printerModel}}",dropNotPrintable:"Seuls les fichiers .gcode et .gcode.3mf peuvent être imprimés",dropToPrint:"Déposer pour imprimer",cannotPrint:"Imprimante occupée"},archives:{title:"Archives d'impression",searchPlaceholder:"Chercher dans les archives...",filterByPrinter:"Par imprimante",filterByStatus:"Par statut",sortBy:"Trier par",sortNewest:"Plus récent",sortOldest:"Plus ancien",sortName:"Nom",sortDuration:"Durée",sortLargest:"Plus volumineux",sortSmallest:"Plus léger",sortSize:"Taille",noArchives:"Aucune archive trouvée",noArchivesSearch:"Aucune archive ne correspond",noArchivesYet:"Pas encore d'archive",loadingArchives:"Chargement...",releaseToUpload:"Relâcher pour téléverser",showAll:"Tout afficher",showFavoritesOnly:"Favoris uniquement",gridView:"Grille",listView:"Liste",calendarView:"Calendrier",logView:"Journal d'impression",manageTags:"Gérer les tags",showFailedPrints:"Afficher les échecs",hideFailedPrints:"Masquer les échecs",printTime:"Temps d'impression",filamentUsed:"Filament utilisé",cost:"Coût",reprint:"Réimprimer",preview:"Aperçu",deleteArchive:"Supprimer l'archive",deleteConfirm:"Supprimer cette archive ?",favorite:"Favori",unfavorite:"Retirer des favoris",viewDetails:"Détails",status:{completed:"Réussi",failed:"Échoué",stopped:"Arrêté"},toast:{source3mfAttached:"Source 3MF attachée : {{filename}}",failedUploadSource3mf:"Échec téléversement 3MF",source3mfRemoved:"Source 3MF retirée",failedRemoveSource3mf:"Échec retrait 3MF",f3dAttached:"F3D attaché : {{filename}}",failedUploadF3d:"Échec téléversement F3D",f3dRemoved:"F3D retiré",failedRemoveF3d:"Échec retrait F3D",timelapseAttached:"Timelapse attaché : {{filename}}",timelapseAlreadyAttached:"Timelapse déjà présent",noMatchingTimelapse:"Pas de timelapse correspondant",failedScanTimelapse:"Échec scan timelapse",failedAttachTimelapse:"Échec attache timelapse",timelapseRemoved:"Timelapse supprimé",failedRemoveTimelapse:"Échec de la suppression du timelapse",timelapseUploaded:"Timelapse importé : {{filename}}",failedUploadTimelapse:"Échec de l'importation du timelapse",archiveDeleted:"Archive supprimée",failedDeleteArchive:"Échec suppression",addedToFavorites:"Ajouté aux favoris",removedFromFavorites:"Retiré des favoris",projectUpdated:"Projet mis à jour",failedUpdateProject:"Échec mise à jour projet",linkCopied:"Lien copié",failedCopyLink:"Échec copie lien",photoDeleted:"Photo supprimée",failedDeletePhoto:"Échec suppression photo",failedDeleteArchives:"Échec suppression archives",failedUpdateFavorites:"Échec mise à jour favoris",exportDownloaded:"Export téléchargé",exportFailed:"Échec export"},menu:{print:"Imprimer",schedule:"Planifier",openInBambuStudio:"Ouvrir dans le Slicer",slice:"Découper",externalLink:"Lien externe",viewOnMakerWorld:"Voir sur MakerWorld",preview3d:"Aperçu 3D",viewTimelapse:"Voir le Timelapse",scanForTimelapse:"Scanner pour Timelapse",uploadTimelapse:"Importer un timelapse",removeTimelapse:"Supprimer le timelapse",downloadSource3mf:"Télécharger Source 3MF",uploadSource3mf:"Téléverser Source 3MF",replaceSource3mf:"Remplacer Source 3MF",removeSource3mf:"Retirer Source 3MF",uploadF3d:"Téléverser F3D",replaceF3d:"Remplacer F3D",downloadF3d:"Télécharger F3D",removeF3d:"Retirer F3D",download:"Télécharger",copyDownloadLink:"Copier lien de téléchargement",qrCode:"Code QR",viewPhotos:"Voir les photos",viewPhotosCount:"Voir les photos ({{count}})",projectPage:"Page du Projet",addToFavorites:"Ajouter aux favoris",removeFromFavorites:"Retirer des favoris",edit:"Modifier",goToProject:"Aller au Projet : {{name}}",addToProject:"Ajouter au Projet",removeFromProject:"Retirer du Projet",loading:"Chargement...",noProjectsAvailable:"Aucun projet disponible",select:"Sélectionner",deselect:"Désélectionner",delete:"Supprimer"},permission:{noReprint:"Pas d'autorisation de réimpression",noAddToQueue:"Pas d'autorisation pour la file",noUpdateArchives:"Pas d'autorisation de mise à jour",noUploadFiles:"Pas d'autorisation de téléversement",noDownload:"Pas d'autorisation de téléchargement",noCopyLink:"Pas d'autorisation de copie lien",noDelete:"Pas d'autorisation de suppression",noCreate:"Pas d'autorisation de création"},card:{previousPlate:"Plateau précédent",nextPlate:"Plateau suivant",plateNumber:"Plateau {{index}}",moreOptions:"Clic droit pour plus d'options",addToFavorites:"Ajouter aux favoris",removeFromFavorites:"Retirer des favoris",cancelled:"annulé",failed:"échoué",duplicate:"doublon",duplicateTitle:"Ce modèle a déjà été imprimé",openSource3mf:"Ouvrir 3MF dans Bambu Studio (clic droit pour plus)",downloadF3d:"Télécharger fichier Fusion 360",viewTimelapse:"Voir timelapse",viewPhoto:"Voir 1 photo",viewPhotos:"Voir {{count}} photos",openFolder:"Ouvrir le dossier : {{name}}",slicedFile:"Fichier découpé - prêt",sourceFile:"Fichier source uniquement - pas de mapping AMS",gcode:"GCODE",source:"SOURCE",project:"Projet : {{name}}",estimated:"Estimé : {{time}}",actual:"Réel : {{time}}",accuracy:"Précision : {{percent}}%",filament:"{{weight}}g",layer:"{{count}} couche",layers:"{{count}} couches",object:"{{count}} objet",objects:"{{count}} objets",slicedFor:"Découpé pour {{model}}",uploadedBy:"Téléversé par",noPermissionReprint:"Pas d'autorisation de réimpression",noFileForReprint:"Aucun fichier 3MF disponible — le fichier n'a pas pu être téléchargé depuis l'imprimante lors de l'enregistrement",noPermissionEdit:"Pas d'autorisation de modification",noPermissionDelete:"Pas d'autorisation de suppression",reprint:"Réimprimer",schedulePrint:"Planifier",schedule:"Planifier",openInBambuStudio:"Ouvrir dans le Slicer",openInBambuStudioToSlice:"Ouvrir dans le Slicer pour découper",slice:"Découper",externalLink:"Lien externe",makerWorld:"MakerWorld : {{designer}}",viewProject:"Voir projet",noExternalLink:"Aucun lien externe",preview3d:"Aperçu 3D",download:"Télécharger",edit:"Modifier",delete:"Supprimer"},modal:{deleteArchive:"Supprimer l'archive",deleteConfirm:'Supprimer "{{name}}" ? Cette action est irréversible.',deleteButton:"Supprimer",removeSource3mf:"Retirer Source 3MF",removeSource3mfConfirm:'Retirer le fichier 3MF de "{{name}}" ?',removeButton:"Retirer",removeF3d:"Retirer F3D",removeF3dConfirm:'Retirer le fichier Fusion 360 de "{{name}}" ?',removeTimelapse:"Supprimer le timelapse",removeTimelapseConfirm:'Êtes-vous sûr de vouloir supprimer la vidéo timelapse de "{{name}}" ?',timelapse:"{{name}} - Timelapse",selectTimelapse:"Choisir un Timelapse",selectTimelapseDesc:"Sélectionnez manuellement le timelapse :",deleteArchives:"Supprimer les archives",deleteArchivesConfirm:"Supprimer {{count}} archive(s) ?",deleteCount:"Supprimer {{count}}"},page:{title:"Archives",printsCount:"{{filtered}} sur {{total}} impressions",dropFilesHere:"Déposez les fichiers .3mf ici",releaseToUpload:"Relâcher pour téléverser",only3mfSupported:"Seuls les fichiers .3mf sont supportés",close:"Fermer",selected:"{{count}} sélectionnés",selectAll:"Tout sélectionner",tags:"Tags",project:"Projet",favorite:"Favori",delete:"Supprimer",toggledFavorites:"Favoris mis à jour pour {{count}} archive(s)",failedUpdateFavorites:"Échec mise à jour favoris",archivesDeleted:"{{count}} archive(s) supprimée(s)",failedDeleteArchives:"Échec suppression",photoDeleted:"Photo supprimée",failedDeletePhoto:"Échec suppression photo"},list:{name:"Nom",printer:"Imprimante",date:"Date",size:"Taille",actions:"Actions",hasTimelapse:"A un timelapse"},log:{date:"Date",printName:"Nom de l'impression",printer:"Imprimante",user:"Utilisateur",status:"Statut",duration:"Durée",filament:"Filament",allPrinters:"Toutes les imprimantes",allUsers:"Tous les utilisateurs",allStatuses:"Tous les statuts",cancelled:"Annulé",skipped:"Ignoré",dateFrom:"Du",dateTo:"Au",noEntries:"Aucune entrée de journal trouvée",showing:"{{count}} sur {{total}} entrées",rowsPerPage:"Lignes",page:"Page",prev:"Préc.",next:"Suiv.",clearLog:"Effacer le journal",clearLogTitle:"Effacer le journal d'impression",clearLogConfirm:"Toutes les entrées du journal d'impression seront supprimées définitivement. Les archives et les éléments de file d'attente ne sont pas affectés. Cette action est irréversible. Êtes-vous sûr ?",clearLogButton:"Tout effacer",cleared:"{{count}} entrées de journal effacées",clearFailed:"Échec de l'effacement du journal d'impression"}},queue:{title:"File d'attente",subtitle:"Gérez vos travaux d'impression",addToQueue:"Ajouter à la file",print:"Imprimer",reprint:"Réimprimer",schedulePrint:"Planifier",editQueueItem:"Modifier l'élément",printToPrinters:"Imprimer sur {{count}} imprimantes",queueToPrinters:"Ajouter à la file pour {{count}} imprimantes",queueAllPlates:"Ajouter les {{count}} plaques à la file",printQueued:"Impression ajoutée à la file",itemsQueued:"{{count}} éléments ajoutés à la file",sending:"Envoi...",sendingProgress:"Envoi {{current}}/{{total}}...",adding:"Ajout...",addingProgress:"Ajout {{current}}/{{total}}...",savingProgress:"Enregistrement {{current}}/{{total}}...",clearQueue:"Vider la file",clearHistory:"Effacer l'historique",emptyQueue:"La file est vide",position:"Position",scheduledTime:"Heure prévue",moveUp:"Monter",moveDown:"Descendre",startNow:"Démarrer maintenant",printingInProgress:"Impression en cours...",viewArchive:"Voir l'archive",viewInFileManager:"Voir dans le gestionnaire",itemCount:"{{count}} élément",itemCount_plural:"{{count}} éléments",dragToReorder:"Glisser pour réordonner (ASAP uniquement)",reorderHint:"La position n'affecte que les éléments ASAP.",addedBy:"Ajouté par {{name}}",nextInQueue:"Prochain en file",clearPlate:"Vider plateau & lancer suivant",clearPlateSuccess:"Plateau vidé — prêt pour l'impression suivante",plateReady:"Plateau vidé — prêt pour l'impression suivante",plateNumber:"Plateau {{index}}",sections:{currentlyPrinting:"En cours",queued:"En attente",history:"Historique"},status:{pending:"En attente",waiting:"En attente",printing:"Impression",paused:"En pause",completed:"Terminé",failed:"Échoué",skipped:"Sauté",cancelled:"Annulé"},summary:{printing:"Impressions",queued:"En attente",totalTime:"Temps total estimé",totalWeight:"Poids total estimé",history:"Historique"},filter:{allPrinters:"Toutes les imprimantes",unassigned:"Non assigné",allStatus:"Tous les statuts",allLocations:"Tous les emplacements",any:"Tout"},sort:{byPosition:"Par position",byName:"Par nom",byPrinter:"Par imprimante",bySchedule:"Par planification",byDate:"Par date",ascendingOldest:"Croissant (plus vieux)",descendingNewest:"Décroissant (plus récent)"},badges:{staged:"Préparé",requiresPrevious:"Nécessite succès précédent",autoPowerOff:"Extinction auto"},empty:{title:"Aucune impression prévue",description:"Planifiez depuis les Archives ou glissez des fichiers ici."},time:{asap:"Dès que possible",overdue:"En retard",now:"Maintenant",lessThanMinute:"Dans moins d'une minute",inMinutes:"Dans {{count}} min",inHours:"Dans {{count}} heures"},actions:{stopPrint:"Arrêter",startPrint:"Démarrer",requeue:"Remettre en file"},bulkEdit:{title:"Modifier {{count}} élément",title_plural:"Modifier {{count}} éléments",description:"Seuls les changements seront appliqués.",printer:"Imprimante",noChange:"— Aucun changement —",queueOptions:"Options de file",staged:"Préparé (manuel)",autoPowerOff:"Extinction auto après",requirePrevious:"Requiert succès précédent",printOptions:"Options d'impression",bedLevelling:"Nivellement plateau",flowCalibration:"Calibration débit",vibrationCalibration:"Vibration (Input Shaper)",layerInspection:"Inspection 1ère couche",timelapse:"Timelapse",useAms:"Utiliser AMS",applyChanges:"Appliquer",selectAll:"Tout sélectionner",deselectAll:"Tout désélectionner",selected:"{{count}} sélectionnés",editSelected:"Modifier la sélection",cancelSelected:"Annuler la sélection"},confirm:{cancelTitle:"Annuler l'impression prévue",cancelMessage:'Annuler "{{name}}" ?',stopTitle:"Arrêter l'impression",stopMessage:`Arrêter "{{name}}" sur l'imprimante ?`,removeTitle:"Retirer de l'historique",removeMessage:`Retirer "{{name}}" de l'historique ?`,clearHistoryTitle:"Effacer l'historique",clearHistoryMessage:"Retirer les {{count}} éléments ?",cancelButton:"Annuler l'impression",stopButton:"Arrêter l'impression",thisPrint:"cette impression",thisItem:"cet élément"},toast:{cancelled:"Élément annulé",cancelFailed:"Échec annulation",removed:"Élément retiré",removeFailed:"Échec retrait",stopped:"Impression arrêtée",stopFailed:"Échec arrêt",released:"Libéré dans la file",startFailed:"Échec démarrage",reorderFailed:"Échec réorganisation",historyCleared:"{{count}} éléments effacés",clearHistoryFailed:"Échec effacement",updateFailed:"Échec mise à jour",bulkCancelled:"{{count}} éléments annulés",bulkCancelFailed:"Échec annulation"},permissions:{noStopPrint:"Pas d'autorisation d'arrêt",noStartPrint:"Pas d'autorisation de démarrage",noEdit:"Pas d'autorisation de modification",noCancel:"Pas d'autorisation d'annulation",noRequeue:"Pas d'autorisation de remise en file",noRemove:"Pas d'autorisation de retrait",noClearHistory:"Pas d'autorisation historique",noEditItems:"Pas d'autorisation modification groupée",noCancelItems:"Pas d'autorisation annulation groupée"}},backgroundDispatch:{unknownFile:"Unknown file",unknownPrinter:"Unknown printer",startingPrints:"Starting prints",progressSummary:"{{complete}}/{{total}} complete • Dispatched: {{dispatched}} • Processing: {{processing}}",expandDetails:"Expand dispatch details",collapseDetails:"Collapse dispatch details",dismissToast:"Dismiss dispatch toast",cancelDispatchJob:"Cancel dispatch job",cancel:"Cancel",cancelling:"Cancelling…",status:{dispatched:"Dispatched",processing:"Processing",completed:"Completed",failed:"Failed",cancelled:"Cancelled"},toast:{cancellingUpload:"Cancelling upload...",cancelled:"Dispatch cancelled",cancelFailed:"Failed to cancel dispatch",completeWithFailures:"Background dispatch complete: {{completed}} succeeded, {{failed}} failed",completeSuccess:"Background dispatch complete: {{completed}} succeeded",printStartedRemaining:"{{completed}} impression(s) lancée(s), {{remaining}} en cours d'envoi..."}},stats:{title:"Tableau de bord",subtitle:"Glissez les widgets pour réorganiser. Cliquez sur l'œil pour masquer.",overview:"Vue d'ensemble",totalPrints:"Total impressions",successRate:"Taux de succès",totalPrintTime:"Temps total d'impression",printTime:"Temps d'impression",totalFilament:"Total filament utilisé",filamentUsed:"Filament utilisé",filamentCost:"Coût filament",totalCost:"Coût total",energyUsed:"Énergie consommée",energyCost:"Coût énergie",averagePrintTime:"Temps moyen par impression",printsPerDay:"Impressions par jour",byPrinter:"Par imprimante",printsByPrinter:"Impressions par imprimante",byMaterial:"Par matériau",byMonth:"Par mois",last7Days:"7 derniers jours",last30Days:"30 derniers jours",last90Days:"90 derniers jours",allTime:"Tout le temps",quickStats:"Stats rapides",printActivity:"Activité d'impression",filamentTypes:"Types de filament",filamentTrends:"Tendances filament",failureAnalysis:"Analyse des échecs",timeAccuracy:"Précision du temps",successful:"Succès :",failed:"Échecs :",perfectEstimate:"100% = estimation parfaite",noTimeAccuracyData:"Pas encore de données de précision",noFilamentData:"Aucune donnée de filament",noPrinterData:"Aucune donnée d'imprimante",noPrintData:"Aucune donnée d'impression",noPrintDataLast30Days:"Aucune impression ces 30 derniers jours",failureReasons:"Raisons des échecs",topFailureReasons:"Top raisons d'échec",failedPrintsCount:"{{failed}} / {{total}} impressions ont échoué",lastWeekRate:"Semaine dernière : {{rate}}%",resetLayout:"Réinitialiser la mise en page",recalculateCosts:"Recalculer les coûts",recalculateCostsHint:"Recalcule les coûts avec les prix actuels des filaments",exportStats:"Exporter les stats",exportAsCsv:"Exporter en CSV",exportAsExcel:"Exporter en Excel",hiddenCount:"{{count}} Masqués",exportDownloaded:"Export téléchargé",exportFailed:"Échec export",layoutReset:"Mise en page réinitialisée",recalculatedCosts:"Coûts recalculés pour {{count}} archives",recalculateFailed:"Échec du calcul",loadingStats:"Chargement des statistiques...",noPermissionResetLayout:"Pas d'autorisation de réinitialisation",noPermissionRecalculate:"Pas d'autorisation de recalcul",noPrintDataInRange:"Aucune donnée dans la période sélectionnée",periodFilament:"Filament utilisé",periodCost:"Coût",avgPerPrint:"Moy. par impression",usageOverTime:"Utilisation dans le temps",filamentByWeight:"Poids",printDuration:"Durée d'impression",printerUtilization:"Utilisation imprimante",filamentSuccess:"Succès par matériau",printHabits:"Habitudes d'impression",printTimeOfDay:"Heure d'impression",colorDistribution:"Distribution des couleurs",noColorData:"Aucune donnée de couleur disponible",records:"Records",longestPrint:"Plus longue impression",heaviestPrint:"Plus lourde impression",mostExpensivePrint:"Plus chère",busiestDay:"Jour le plus actif",successStreak:"Série de succès",streakPrint:"impression consécutive",streakPrints:"{{count}} impressions consécutives",printerStats:"Stats imprimante",hours:"heures",avgPrints:"Moy. impressions",noArchiveData:"Aucune donnée d'impression disponible",filamentByTime:"Temps",avgWeight:"Moy. poids",avgTime:"Moy. temps",filamentByPrints:"Impressions",timeframe:{today:"Aujourd'hui","this-week":"Cette semaine","this-month":"Ce mois","last-7":"7 derniers jours","last-30":"30 derniers jours","last-90":"90 derniers jours","this-year":"Cette année","all-time":"Tout",custom:"Personnalisé",from:"Du",to:"Au"}},maintenance:{title:"Maintenance",overview:"Vue d'ensemble",allOk:"Toute la maintenance est à jour",dueCount:"{{count}} tâche à faire",dueCount_plural:"{{count}} tâches à faire",warningCount:"{{count}} avertissement",warningCount_plural:"{{count}} avertissements",totalPrintTime:"Temps d'impression total",nextMaintenance:"Prochaine maintenance",nothingDue:"Rien de prévu",tasks:"Tâches",lastPerformed:"Dernière réalisation",interval:"Intervalle",hoursRemaining:"{{hours}}h restantes",hoursOverdue:"{{hours}}h de retard",markDone:"Marquer comme fait",performMaintenance:"Effectuer la maintenance",history:"Historique",noHistory:"Aucun historique",editPrintHours:"Modifier les heures d'impression",currentHours:"Heures actuelles",statusTab:"Statut",settingsTab:"Paramètres",overdueCount:"{{count}} en retard",dueSoonCount:"{{count}} bientôt",dueSoon:"Bientôt",allGood:"Tout va bien",overdueBy:"Retard de {{duration}}",dueIn:"Dans {{duration}}",timeLeft:"{{duration}} restant",day:"1 jour",days:"{{count}} jours",week:"1 semaine",weeks:"{{count}} semaines",month:"1 mois",months:"{{count}} mois",year:"1 an",maintenanceTypes:"Types de maintenance",maintenanceTypesDescription:"Types système et tâches personnalisées",addCustomType:"Ajouter un type",restoreDefaults:"Restaurer les tâches par défaut",intervalType:"Type d'intervalle",intervalValue:"Intervalle ({{type}})",icon:"Icône",documentationLink:"Lien documentation (optionnel)",assignToPrinters:"Assigner aux imprimantes",selectAtLeastOnePrinter:"Sélectionnez au moins une imprimante",addType:"Ajouter le type",custom:"Personnalisé",printHours:"Heures d'impression",calendarDays:"Jours calendaires",exampleName:"ex: Remplacement filtre HEPA",viewDocumentation:"Voir documentation",timeBasedInterval:"Intervalle temporel",intervalOverrides:"Exceptions d'intervalle",intervalOverridesDescription:"Intervalles spécifiques par imprimante",assignedToPrinters:"Assigné aux imprimantes :",noPrintersAssigned:"Aucune imprimante assignée",addPrinterShort:"Ajouter :",printersAssignedClick:"{{count}} imprimante(s) assignée(s) - gérer",removeFromPrinter:"Retirer de cette imprimante",types:{lubricateCarbonRods:"Lubrifier les tiges carbone",lubricateRails:"Lubrifier les rails linéaires",cleanNozzle:"Nettoyer la buse / hotend",checkBelts:"Vérifier la tension des courroies",cleanBuildPlate:"Nettoyer le plateau",checkExtruder:"Vérifier les engrenages de l'extrudeur",checkCooling:"Vérifier les ventilateurs",generalInspection:"Inspection générale",cleanCarbonRods:"Nettoyer les tiges carbone",lubricateSteelRods:"Lubrifier les tiges en acier",cleanSteelRods:"Nettoyer les tiges en acier",cleanLinearRails:"Nettoyer les rails linéaires",checkPtfeTube:"Vérifier le tube PTFE",replaceHepaFilter:"Remplacer le filtre HEPA",replaceCarbonFilter:"Remplacer le filtre charbon",lubricateLeftNozzleRail:"Lubrifier le rail de buse gauche"},maintenanceComplete:"Maintenance marquée comme faite",typeUpdated:"Type mis à jour",typeDeleted:"Type supprimé",defaultsRestored:"{{count}} tâche(s) par défaut restaurée(s)",printHoursUpdated:"Heures mises à jour",printerAssigned:"Imprimante assignée",printerRemoved:"Imprimante retirée",deleteTypeConfirm:'Supprimer "{{name}}" ?',deleteSystemTypeTitle:"Supprimer la tâche de maintenance par défaut ?",deleteSystemTypeMessage:'Êtes-vous sûr de vouloir supprimer la tâche de maintenance par défaut "{{name}}" ?',noPermissionUpdate:"Pas d'autorisation de mise à jour",noPermissionPerform:"Pas d'autorisation d'action",noPermissionEditTypes:"Pas d'autorisation de modification types",noPermissionDeleteTypes:"Pas d'autorisation de suppression types",noPermissionEditHours:"Pas d'autorisation de modification heures",noPermissionRemovePrinter:"Pas d'autorisation retrait imprimante",noPermissionAssignPrinter:"Pas d'autorisation assignation",noPermissionEditIntervals:"Pas d'autorisation modification intervalles",configureSettings:"Configurer types et intervalles"},settings:{title:"Paramètres",general:"Général",tabs:{general:"Général",smartPlugs:"Prises connectées",notifications:"Notifications",filament:"Filament",network:"Réseau",apiKeys:"Clés API",virtualPrinter:"Imprimante virtuelle",users:"Authentification",backup:"Sauvegarde",emailAuth:"Authentification Email"},email:{smtpSettings:"Configuration SMTP",smtpHost:"Serveur SMTP",smtpPort:"Port SMTP",security:"Sécurité",authentication:"Authentification",username:"Utilisateur",password:"Mot de passe",fromEmail:"Email expéditeur",fromName:"Nom expéditeur",testConnection:"Tester la connexion SMTP",testRecipient:"Email test destinataire",sendTest:"Envoyer email test",sending:"Envoi...",save:"Enregistrer les paramètres",saving:"Enregistrement...",advancedAuth:"Authentification avancée",advancedAuthEnabled:"L'authentification avancée est activée",advancedAuthEnabledDesc:"La gestion des utilisateurs par email est active. Les nouveaux utilisateurs recevront un mot de passe auto-généré.",advancedAuthDisabled:"Authentification avancée désactivée",advancedAuthDisabledDesc:"Activez pour les fonctionnalités liées à l'email (mot de passe oublié, etc).",enable:"Activer",disable:"Désactiver",feature1:"Génération auto et envoi de mots de passe par email",feature2:"Connexion par utilisateur ou email",feature3:"Réinitialisation mot de passe oublié disponible",feature4:"Réinitialisation admin par email",errors:{requiredFields:"Remplissez tous les champs requis",usernameRequired:"L'utilisateur est requis pour l'authentification",enterTestEmail:"Entrez une adresse email de test",smtpServerAndEmail:"Serveur et expéditeur requis pour le test",usernamePasswordRequired:"Utilisateur et mot de passe requis pour l'auth",configureSmtpFirst:"Configurez et testez le SMTP d'abord"},success:{settingsSaved:"Paramètres SMTP enregistrés"},securityOptions:{starttls:"STARTTLS (Port 587)",ssl:"SSL/TLS (Port 465)",none:"Aucun (Port 25)"},authOptions:{enabled:"Activée",disabled:"Désactivée"}},appearance:"Apparence",notifications:"Notifications",smartPlugs:"Prises connectées",spoolman:"Spoolman",updates:"Mises à jour",language:"Langue",languageDescription:"Choisissez votre langue",theme:"Thème",themeLight:"Clair",themeDark:"Sombre",themeSystem:"Système",defaultView:"Vue par défaut",defaultViewDescription:"Page affichée au démarrage",checkForUpdates:"Vérifier les mises à jour",autoUpdate:"Mise à jour auto",currentVersion:"Version actuelle",latestVersion:"Dernière version",upToDate:"Bambuddy est à jour",updateAvailable:"Mise à jour disponible",notificationLanguage:"Langue des notifications",notificationLanguageDescription:"Langue pour les notifications push",bedCooledThreshold:"Seuil de refroidissement du plateau",bedCooledThresholdDescription:"Température en dessous de laquelle le plateau est considéré comme refroidi",notificationProviders:"Fournisseurs de notifications",addProvider:"Ajouter un fournisseur",editProvider:"Modifier le fournisseur",providerType:"Type de fournisseur",testNotification:"Tester la notification",testSuccess:"Notification de test envoyée",testFailed:"Échec de l'envoi du test",quietHours:"Heures de silence",quietHoursDescription:"Ne pas déranger pendant ces heures",quietHoursStart:"Début",quietHoursEnd:"Fin",events:{title:"Événements de notification",printStart:"Impression démarrée",printComplete:"Impression terminée",printFailed:"Impression échouée",printStopped:"Impression arrêtée",printProgress:"Jalons de progression",printProgressDescription:"Notifier à 25%, 50%, 75%",printerOffline:"Imprimante hors ligne",printerError:"Erreur imprimante",filamentLow:"Filament bas",maintenanceDue:"Maintenance due",maintenanceDueDescription:"Notifier quand une tâche est due"},smartPlug:{title:"Prises connectées",add:"Ajouter une prise",edit:"Modifier la prise",name:"Nom",ipAddress:"Adresse IP",linkedPrinter:"Imprimante liée",autoOn:"Allumage auto",autoOnDescription:"Allumer au début de l'impression",autoOff:"Extinction auto",autoOffDescription:"Éteindre après l'impression",offDelay:"Délai d'extinction",offDelayMinutes:"Minutes après fin",offDelayTemp:"Quand la buse est sous",currentState:"État actuel",turnOn:"Allumer",turnOff:"Éteindre"},filamentTracking:"Suivi de Filament",filamentTrackingDesc:"Choisissez comment suivre vos bobines. Utilisez l'inventaire intégré ou connectez un serveur Spoolman.",trackingModeBuiltIn:"Inventaire Intégré",trackingModeBuiltInDesc:"Correspondance RFID et suivi de consommation inclus",trackingModeSpoolmanDesc:"Serveur de gestion externe",builtInFeatureRfid:"Détecte auto les bobines RFID Bambu Lab dans l'AMS",builtInFeatureUsage:"Suit la consommation par impression",builtInFeatureCatalog:"Gère bobines, couleurs et profils facteur K",builtInFeatureThirdParty:"Les bobines tierces peuvent être assignées aux bobines d'inventaire",amsSyncButton:"Synchroniser les poids depuis l'AMS",amsSyncTitle:"Synchroniser les poids des bobines depuis l'AMS",amsSyncMessage:"Tous les poids des bobines de l'inventaire seront écrasés par les valeurs actuelles de l'AMS des imprimantes connectées. Utilisez ceci pour récupérer des données de poids corrompues. Les imprimantes doivent être en ligne.",amsSyncing:"Synchronisation...",amsSyncSuccess:"{{synced}} bobine(s) synchronisée(s), {{skipped}} ignorée(s)",amsSyncError:"Échec de la synchronisation des poids depuis l'AMS",spoolmanUrl:"URL Spoolman",spoolmanUrlHint:"URL de votre serveur Spoolman (ex: http://localhost:7912)",spoolmanConnected:"Connecté",spoolmanDisconnected:"Déconnecté",status:"Statut",connect:"Connecter",disconnect:"Déconnecter",howSyncWorks:"Fonctionnement de la Sync",syncInfoRfidOnly:"Seules les bobines officielles RFID sont synchronisées",syncInfoAutoCreate:"Les bobines sont créées dans Spoolman à la 1ère sync",syncInfoThirdPartySkipped:"Les bobines tierces ou rechargées sont ignorées",linkingExistingSpools:"Lier des bobines existantes",linkingExistingSpoolsDesc:'Pour lier une bobine Spoolman, survolez un slot AMS et cliquez sur "Lier à Spoolman".',syncMode:"Mode de Sync",syncModeAuto:"Automatique",syncModeManual:"Manuel uniquement",syncModeAutoDesc:"Sync auto lors de changements AMS",syncModeManualDesc:"Sync uniquement sur déclenchement manuel",syncAmsData:"Synchroniser AMS",syncAmsDataDesc:"Synchroniser manuellement les données vers Spoolman",allPrinters:"Toutes les imprimantes",noDefaultPrinter:"Aucune par défaut (demander à chaque fois)",sidebarOrder:"Ordre de la barre latérale",saveThumbnails:"Enregistrer les vignettes",captureFinishPhoto:"Prendre une photo à la fin",noPrintersConfigured:"Aucune imprimante configurée",archiveMode:{always:"Toujours créer une archive",never:"Ne jamais créer d'archive",ask:"Demander à chaque fois"},checkForUpdatesLabel:"Vérifier les mises à jour",checkPrinterFirmware:"Vérifier le firmware imprimante",includeBetaUpdates:"Inclure les versions bêta",includeBetaUpdatesDesc:"Notifier des versions bêta et préliminaires lors de la vérification des mises à jour",enableRetry:"Activer la rétentative",homeAssistantDescription:"Contrôler les prises via Home Assistant",environmentManagedLabel:"(Géré par l'environnement)",autoEnabledViaEnv:"Activé via variables d'environnement",urlFromEnvReadOnly:"Valeur HA_URL (lecture seule)",tokenFromEnvReadOnly:"Valeur HA_TOKEN (lecture seule)",mqttConnectedTo:"Connecté à",prometheusDescription:"Exposer les données au format Prometheus",noSmartPlugsTitle:"Aucune prise configurée",noSmartPlugsDescription:"Ajoutez une prise Tasmota pour suivre l'énergie et automatiser.",noProvidersTitle:"Aucun fournisseur configuré",noProvidersDescription:"Ajoutez un fournisseur pour recevoir des alertes.",noTemplatesAvailable:"Aucun modèle dispo. Redémarrez pour les générer.",apiPermissionView:"Voir statut et file",apiPermissionEdit:"Gérer la file d'attente",apiKeysEmptyTitle:"Aucune clé API",apiKeysEmptyDescription:"Créez une clé pour vos intégrations.",noUsersFound:"Aucun utilisateur trouvé",noGroupsFound:"Aucun groupe trouvé",noGroupsAvailable:"Aucun groupe disponible",passwordsDoNotMatch:"Les mots de passe ne correspondent pas",systemGroupWarning:"Les noms des groupes système sont fixes",authDisabledTitle:"Authentification désactivée",authDisabledFeature1:"Requis pour accéder au système",authDisabledFeature2:"Gestion multi-utilisateurs et groupes",authDisabledFeature3:"Plus de 50 permissions granulaires",userHasCreated:"Cet utilisateur a créé :",userItemsQuestion:"Que faire de ces éléments ?",deleteUserConfirm:"Supprimer cet utilisateur ?",actionCannotBeUndone:"Cette action est irréversible.",addFirstSmartPlug:"Ajoutez votre première prise",providers:"Fournisseurs",log:"Journal",testAll:"Tout tester",testResults:"Résultats du test",testPassedCount:"{{count}} succès",testFailedCount:"{{count}} échecs",messageTemplates:"Modèles de message",messageTemplatesDescription:"Personnalisez les messages par événement.",apiKeys:"Clés API",apiKeysDescription:"Créez des clés pour webhooks et API.",createKey:"Créer une clé",apiKeyCreated:"Clé API créée avec succès",apiKeyCopyWarning:"Copiez cette clé maintenant - elle ne sera plus affichée !",useInApiBrowser:"Utiliser dans l'explorateur API",createNewApiKey:"Nouvelle clé API",keyName:"Nom de la clé",keyNamePlaceholder:"ex: Home Assistant, OctoPrint",readStatus:"Lire le statut",readStatusDescription:"Voir les imprimantes et la file",manageQueue:"Gérer la file",manageQueueDescription:"Ajouter/retirer des éléments",controlPrinter:"Contrôler l'imprimante",controlPrinterDescription:"Pause, reprise, arrêt",unnamedKey:"Clé sans nom",lastUsed:"Dernière utilisation",read:"Lecture",control:"Contrôle",createFirstKey:"Créez votre première clé",webhookEndpoints:"Points de terminaison Webhook",webhookApiKeyHint:"Utilisez la clé dans l'en-tête X-API-Key.",webhook:{getAllStatus:"Tous les statuts",getSpecificStatus:"Statut spécifique",addToQueue:"Ajouter à la file",pausePrint:"Pause",resumePrint:"Reprise",stopPrint:"Arrêt"},apiBrowser:"Explorateur API",apiBrowserDescription:"Testez les endpoints API.",apiKeyForTesting:"Clé API pour test",apiKeyPlaceholder:"Collez votre clé pour tester...",apiKeyHint:"Sera envoyée via l'en-tête X-API-Key.",deleteApiKeyTitle:"Supprimer la clé API",deleteApiKeyMessage:"Les intégrations utilisant cette clé cesseront de fonctionner.",deleteKey:"Supprimer la clé",amsDisplayThresholds:"Seuils d'affichage AMS",amsThresholdsDescription:"Seuils de couleur pour humidité et température.",humidity:"Humidité",goodGreen:"Bon (vert)",fairOrange:"Moyen (orange)",aboveFairBad:"Au-dessus = rouge (mauvais)",temperature:"Température",goodBlue:"Bon (bleu)",aboveFairHot:"Au-dessus = rouge (chaud)",historyRetention:"Rétention d'historique",keepSensorHistory:"Garder l'historique pendant",historyRetentionDescription:"Les anciennes données seront supprimées.",printModal:"Fenêtre d'impression",expandCustomMapping:"Étendre le mapping personnalisé par défaut",expandCustomMappingDescription:"Affiche le mapping AMS par imprimante étendu.",authentication:"Authentification",authEnabledDescription:"L'instance est sécurisée",authDisabledDescription:"Activez pour restreindre l'accès",authDisabledMessage:"Activez l'authentification pour gérer comptes et permissions.",enableAuthentication:"Activer l'authentification",currentUser:"Utilisateur actuel",changePassword:"Changer le mot de passe",admin:"Admin",users:"Utilisateurs",addUser:"Ajouter un utilisateur",groups:"Groupes",addGroup:"Ajouter un groupe",system:"Système",noDescription:"Pas de description",userCount:"{{count}} utilisateurs",permissionCount:"{{count}} permissions",createUser:"Créer un utilisateur",username:"Nom d'utilisateur",enterUsername:"Entrez l'utilisateur",password:"Mot de passe",enterPassword:"Mot de passe (min 6 char)",confirmPassword:"Confirmer le mot de passe",confirmPasswordPlaceholder:"Confirmez le mot de passe",viewReleaseOnGitHub:"Voir la version sur GitHub",turnAllPlugsOn:"Tout allumer",turnAllPlugsOff:"Tout éteindre",clearNotificationLogs:"Effacer les journaux",clearLogsMessage:"Efface définitivement les logs de plus de 30 jours.",clearLogs:"Effacer les logs",resetUiPreferences:"Réinitialiser l'UI",resetUiPreferencesMessage:"Réinitialise l'ordre, thème, widgets, etc. N'affecte pas vos données.",resetPreferences:"Réinitialiser",deleteGroupTitle:"Supprimer le groupe",deleteGroupMessage:"Les utilisateurs de ce groupe perdront ces permissions.",deleteGroup:"Supprimer le groupe",disableAuthenticationTitle:"Désactiver l'authentification",disableAuthenticationMessage:"Instance accessible sans connexion. Les comptes sont conservés.",disableAuthentication:"Désactiver",configureBambuddy:"Configurer Bambuddy",systemDefault:"Défaut système",archiveSettings:"Réglages Archives",newWindow:"Nouvelle fenêtre",embeddedOverlay:"Superposition intégrée",preferredSlicer:"Slicer préféré",preferredSlicerDescription:"Application pour ouvrir les fichiers",externalCameras:"Caméras externes",costTracking:"Suivi des coûts",printsOnly:"Impressions uniquement",totalConsumption:"Consommation totale",dataManagement:"Gestion des données",storageUsage:"Utilisation du stockage",storageUsageDescription:"Répartition de l'utilisation des données par catégorie",storageUsageTotal:"Total",storageUsageErrors:"Erreurs",storageUsageOtherBreakdown:"Autre (inclut ressources statiques, scripts et fichiers de configuration)",storageUsageSystem:"Système",storageUsageData:"Données",storageUsageUnavailable:"Informations d'utilisation du stockage non disponibles",clearNotificationLogsDescription:"Supprimer logs de plus de 30 jours",resetUiPreferencesDescription:"Réinitialise thèmes et affichage sans toucher aux données.",enableHomeAssistant:"Activer Home Assistant",enableMqtt:"Activer MQTT",useTls:"Utiliser TLS",enableMetricsEndpoint:"Activer l'endpoint Metrics",availableMetrics:"Metrics disponibles",editUser:"Modifier l'utilisateur",deleteUserTitle:"Supprimer l'utilisateur",groupName:"Nom du groupe",leaveEmptyForAnonymous:"Vide pour anonyme",leaveEmptyForNoAuth:"Vide si pas d'auth",enterNewPassword:"Nouveau mot de passe",confirmNewPassword:"Confirmer nouveau mdp",enterGroupName:"Entrez le nom du groupe",enterDescriptionOptional:"Description (optionnel)",enterCurrentPassword:"Mdp actuel",enterNewPasswordMin6:"Nouveau mdp (min 6 char)",toast:{keyCopied:"Clé copiée",copyFailed:"Échec copie",keyAddedToBrowser:"Clé ajoutée à l'explorateur",clearLogsFailed:"Échec effacement logs",uiPreferencesReset:"Préférences UI réinitialisées. Rafraîchissement...",authDisabled:"Authentification désactivée",authDisableFailed:"Échec désactivation",apiKeyCreated:"Clé API créée",apiKeyDeleted:"Clé API supprimée",userCreated:"Utilisateur créé",userUpdated:"Utilisateur mis à jour",userDeleted:"Utilisateur supprimé",groupCreated:"Groupe créé",groupUpdated:"Groupe mis à jour",groupDeleted:"Groupe supprimé",fillRequiredFields:"Remplissez les champs requis",passwordsDoNotMatch:"Les mots de passe ne correspondent pas",passwordTooShort:"Minimum 6 caractères",enterGroupName:"Entrez un nom de groupe",settingsSaved:"Paramètres enregistrés",cameraSettingsSaved:"Réglages caméra enregistrés",enterCameraUrl:"Entrez une URL caméra",passwordChanged:"Mot de passe modifié",connectionFailed:"Échec connexion",testFailed:"Échec test",cameraConnected:"Caméra connectée {{resolution}}"},testConnection:"Tester la connexion",catalog:{spoolCatalog:"Catalogue de Bobines",spoolCatalogDescription:"Poids des bobines vides par marque/type. Utilisé pour le calcul auto du poids restant.",searchCatalog:"Chercher dans le catalogue...",addNewEntry:"Nouvelle Entrée",namePlaceholder:"Nom (ex: Bambu Lab - Plastique)",weight:"Poids",type:"Type",default:"Défaut",custom:"Perso",noMatch:"Aucune entrée correspondante",empty:"Catalogue vide",deleteEntry:"Supprimer l'entrée",deleteConfirm:'Supprimer "{{name}}" ?',resetCatalog:"Réinitialiser le catalogue",resetConfirm:"Réinitialiser aux valeurs par défaut ? Vos entrées personnalisées seront supprimées.",loadFailed:"Échec chargement catalogue",nameWeightRequired:"Nom et poids requis",entryAdded:"Entrée ajoutée",addFailed:"Échec ajout",entryUpdated:"Entrée mise à jour",updateFailed:"Échec mise à jour",entryDeleted:"Entrée supprimée",deleteFailed:"Échec suppression",resetSuccess:"Catalogue réinitialisé",resetFailed:"Échec réinitialisation",exported:"{{count}} entrées exportées",imported:"{{added}} entrées importées ({{skipped}} ignorées)",importFailed:"Échec import : format JSON invalide",exportTooltip:"Exporter en JSON",importTooltip:"Importer depuis JSON",resetTooltip:"Réinitialiser par défaut",selectedCount:"{{count}} sélectionnés",deleteSelected:"Supprimer la sélection",bulkDeleteConfirm:"Supprimer {{count}} entrées ?",bulkDeleted:"{{count}} entrées supprimées",bulkDeleteFailed:"Échec de la suppression"},colorCatalog:{title:"Catalogue de Couleurs",description:"Couleurs de filament par fabricant. Utilisé pour la recherche auto lors de l'ajout de bobines.",searchColors:"Chercher couleurs...",allManufacturers:"Tous les fabricants",addNewColor:"Nouvelle Couleur",manufacturer:"Fabricant",colorName:"Nom couleur",hex:"Hex",materialOptional:"Matériau (optionnel)",showing:"Affichage {{filtered}} sur {{total}} couleurs",noMatch:"Aucune couleur correspondante",empty:"Catalogue vide",deleteColor:"Supprimer couleur",deleteConfirm:'Supprimer "{{name}}" ?',resetCatalog:"Réinitialiser catalogue couleurs",resetConfirm:"Réinitialiser aux valeurs par défaut ?",sync:"Sync",starting:"Démarrage...",syncTooltip:"Sync depuis FilamentColors.xyz (2000+ couleurs, peut être long)",loadFailed:"Échec chargement catalogue couleurs",fieldsRequired:"Fabricant, nom et code Hex requis",colorAdded:"Couleur ajoutée",addFailed:"Échec ajout",colorUpdated:"Couleur mise à jour",updateFailed:"Échec mise à jour",colorDeleted:"Couleur supprimée",deleteFailed:"Échec suppression",resetSuccess:"Catalogue réinitialisé",resetFailed:"Échec réinitialisation",syncUpToDate:"Déjà à jour ({{count}} couleurs vérifiées)",syncComplete:"{{added}} couleurs ajoutées ({{skipped}} déjà présentes)",syncError:"Erreur de sync",syncFailed:"Échec sync FilamentColors.xyz",exported:"{{count}} couleurs exportées",imported:"{{added}} couleurs importées ({{skipped}} ignorées)",importFailed:"Échec import : format JSON invalide",selectedCount:"{{count}} sélectionnés",deleteSelected:"Supprimer la sélection",bulkDeleteConfirm:"Supprimer {{count}} couleurs ?",bulkDeleted:"{{count}} couleurs supprimées",bulkDeleteFailed:"Échec de la suppression des couleurs"},dateFormat:"Format de date",dateFormatUs:"US (MM/JJ/AAAA)",dateFormatEu:"EU (JJ/MM/AAAA)",dateFormatIso:"ISO (AAAA-MM-JJ)",timeFormat:"Format horaire",timeFormat12:"12 heures (3:30 PM)",timeFormat24:"24 heures (15:30)",defaultPrinter:"Imprimante par défaut",defaultPrinterDescription:"Présélectionner cette imprimante pour les téléversements, réimpressions et autres opérations.",slicerBambuStudio:"Bambu Studio",slicerOrcaSlicer:"OrcaSlicer",sidebarOrderDescription:"Glissez les éléments dans la barre latérale pour réorganiser. Réinitialiser l'ordre par défaut ici.",reset:"Réinitialiser",darkMode:"Mode sombre",lightMode:"Mode clair",active:"(actif)",background:"Arrière-plan",accent:"Accent",style:"Style",bgNeutral:"Neutre",bgWarm:"Chaud",bgCool:"Froid",bgOled:"OLED Noir",bgSlate:"Bleu ardoise",bgForest:"Vert forêt",accentGreen:"Vert",accentTeal:"Sarcelle",accentBlue:"Bleu",accentOrange:"Orange",accentPurple:"Violet",accentRed:"Rouge",styleClassic:"Classique",styleGlow:"Lumineux",styleVibrant:"Vibrant",themeToggleHint:"Basculer entre le mode sombre et clair avec l'icône soleil/lune dans la barre latérale.",autoArchivePrints:"Archiver automatiquement les impressions",autoArchiveDescription:"Sauvegarder automatiquement les fichiers 3MF à la fin des impressions",saveThumbnailsDescription:"Extraire et sauvegarder les images d'aperçu des fichiers 3MF",captureFinishPhotoDescription:"Prendre une photo avec la caméra de l'imprimante à la fin de l'impression",ffmpegNotInstalled:"ffmpeg non installé",ffmpegRequired:"La capture caméra nécessite ffmpeg. Installez-le via <brew>brew install ffmpeg</brew> (macOS) ou <apt>apt install ffmpeg</apt> (Linux).",camera:"Caméra",cameraViewMode:"Mode d'affichage caméra",cameraOverlayDescription:"La caméra s'ouvre dans un overlay redimensionnable sur l'écran principal",cameraWindowDescription:"La caméra s'ouvre dans une fenêtre de navigateur séparée",externalCamerasDescription:"Configurer des caméras externes pour remplacer la caméra intégrée. Supporte les flux MJPEG, RTSP, snapshots HTTP et caméras USB (V4L2). Lorsqu'activée, la caméra externe est utilisée pour la vue en direct et les photos de fin.",cameraPlaceholderUsb:"Chemin du périphérique (/dev/video0)",cameraPlaceholderUrl:"URL caméra (rtsp://... ou http://...)",cameraTypeMjpeg:"Flux MJPEG",cameraTypeRtsp:"Flux RTSP",cameraTypeSnapshot:"Snapshot HTTP",cameraTypeUsb:"Caméra USB (V4L2)",test:"Tester",connected:"Connecté",disconnected:"Déconnecté",currency:"Devise",defaultFilamentCost:"Coût filament par défaut (par kg)",electricityCost:"Coût électricité par kWh",energyDisplayMode:"Mode d'affichage énergie",energyModePrintDescription:"Le tableau de bord affiche la somme de l'énergie utilisée pendant les impressions",energyModeTotalDescription:"Le tableau de bord affiche l'énergie totale des prises connectées",fileManager:"Gestionnaire de fichiers",createArchiveEntry:"Créer une entrée d'archive lors de l'impression",createArchiveEntryDescription:"Lors de l'impression depuis le gestionnaire de fichiers, créer optionnellement une entrée d'archive",lowDiskSpaceWarning:"Avertissement espace disque faible",lowDiskSpaceDescription:"Afficher un avertissement lorsque l'espace disque libre descend sous ce seuil",printerFirmware:"Firmware imprimante",checkFirmwareDescription:"Vérifier les mises à jour firmware de Bambu Lab",bambuddySoftware:"Logiciel Bambuddy",autoCheckDescription:"Vérifier automatiquement les nouvelles versions au démarrage",checkNow:"Vérifier maintenant",updateAvailableVersion:"Mise à jour disponible : v{{version}}",releaseNotes:"Notes de version",updateViaDocker:"Mettre à jour via Docker Compose :",installUpdate:"Installer la mise à jour",latestVersionRunning:"Vous utilisez la dernière version",failedToCheckUpdates:"Échec de la vérification des mises à jour : {{error}}",backupRestore:"Sauvegarde & Restauration",backupRestoreDescription:"Exporter/importer les paramètres et configurer la sauvegarde GitHub",goToBackup:"Aller à la sauvegarde",externalUrl:"URL externe",externalUrlDescription:"L'URL externe où Bambuddy est accessible. Utilisée pour les images de notification et les intégrations externes.",bambuddyUrl:"URL Bambuddy",externalUrlHint:"Inclure le protocole et le port (ex : http://192.168.1.100:8000)",ftpRetry:"Réessai FTP",ftpRetryDescription:"Réessayer les opérations FTP lorsque le WiFi de l'imprimante est instable. S'applique aux téléchargements 3MF, uploads d'impression, téléchargements timelapse et mises à jour firmware.",autoRetryDescription:"Réessayer automatiquement les opérations FTP échouées",retryAttempts:"Tentatives de réessai",retryDelay:"Délai de réessai",connectionTimeout:"Délai de connexion",time_one:"{{count}} fois",time_other:"{{count}} fois",second_one:"{{count}} seconde",second_other:"{{count}} secondes",nSeconds:"{{count}} secondes",increaseForWeakWifi:"Augmenter pour les imprimantes avec un WiFi faible",homeAssistant:"Home Assistant",homeAssistantFullDescription:"Se connecter à Home Assistant pour contrôler les prises connectées via l'API REST HA. Supporte les entités switch, light, input_boolean et script.",homeAssistantUrl:"URL Home Assistant",longLivedAccessToken:"Token d'accès longue durée",haTokenHint:"Créer un token dans HA : Profil → Tokens d'accès longue durée → Créer un token",connectionSuccessful:"Connexion réussie",connectionFailed:"Connexion échouée",haConnectionSuccess:"Connexion à Home Assistant réussie.",haConnectionFailed:"Échec de la connexion à Home Assistant.",mqttPublishing:"Publication MQTT",mqttDescription:"Publier les événements BamBuddy vers un broker MQTT externe pour l'intégration avec Node-RED, Home Assistant et d'autres systèmes d'automatisation.",mqttEnableDescription:"Publier les événements vers un broker MQTT externe",brokerHostname:"Nom d'hôte du broker",port:"Port",usernameOptional:"Nom d'utilisateur (optionnel)",passwordOptional:"Mot de passe (optionnel)",topicPrefix:"Préfixe de topic",topicPrefixHint:"Les topics seront : {{prefix}}/printers/<serial>/status, etc.",prometheusMetrics:"Métriques Prometheus",prometheusEndpointDescription:"Exposer les métriques imprimante sur <code>/api/v1/metrics</code> pour la surveillance Prometheus/Grafana.",bearerTokenOptional:"Token Bearer (optionnel)",bearerTokenHint:"Si défini, les requêtes doivent inclure <code>Authorization: Bearer <token></code>",metricsConnectionStatus:"État de connexion",metricsPrinterState:"État imprimante (idle/printing/etc)",metricsPrintProgress:"Progression impression 0-100%",metricsBedTemp:"Température du plateau",metricsNozzleTemp:"Température de la buse",metricsPrintsTotal:"Total impressions par résultat",metricsMore:"...et plus (couches, ventilateurs, file d'attente, utilisation filament)",smartPlugsDescription:"Connecter des prises connectées (Tasmota ou Home Assistant) pour automatiser le contrôle de l'alimentation et suivre la consommation d'énergie de vos imprimantes.",allOn:"Tout allumer",allOff:"Tout éteindre",addSmartPlug:"Ajouter une prise",energySummary:"Résumé énergétique",currentPower:"Puissance actuelle",plugsOnline:"{{reachable}}/{{total}} prises en ligne",today:"Aujourd'hui",yesterday:"Hier",total:"Total",enablePlugsForSummary:"Activer les prises pour voir le résumé énergétique",addNotificationProvider:"Ajouter",systemBadge:"(Système)",creating:"Création...",changing:"Modification...",deleteUserAndItems:"Supprimer l'utilisateur ET ses éléments",deleteUserKeepItems:"Supprimer l'utilisateur, garder les éléments (deviennent sans propriétaire)",ok:"OK"},notification:{printStarted:{title:"Impression démarrée",body:"{{printer}} : {{filename}} commence l'impression"},printCompleted:{title:"Impression terminée",body:"{{printer}} : {{filename}} a réussi"},printFailed:{title:"Impression échouée",body:"{{printer}} : {{filename}} a échoué"},printStopped:{title:"Impression arrêtée",body:"{{printer}} : {{filename}} a été arrêtée"},printProgress:{title:"Progression d'impression",body:"{{printer}} : {{filename}} est à {{percent}}%"},printerOffline:{title:"Imprimante hors ligne",body:"{{printer}} est déconnectée"},printerError:{title:"Erreur imprimante",body:"{{printer}} : {{error}}"},filamentLow:{title:"Filament bas",body:"{{printer}} : Le filament est presque vide"},maintenanceDue:{title:"Maintenance due",body:"{{printer}} : {{items}} demandent votre attention"}},errors:{generic:"Une erreur est survenue",networkError:"Erreur réseau. Vérifiez votre connexion.",notFound:"Non trouvé",unauthorized:"Non autorisé",serverError:"Erreur serveur",validationError:"Vérifiez vos saisies",printerConnectionFailed:"Échec connexion imprimante",saveFailed:"Échec enregistrement",deleteFailed:"Échec suppression",loadFailed:"Échec chargement"},hmsErrors:{title:"Erreurs - {{name}}",noErrors:"Aucune erreur",viewOnWiki:"Voir sur le Wiki Bambu Lab",clearInstructions:"Effacez les erreurs sur l'imprimante pour les retirer ici.",clearErrors:"Effacer les erreurs",clearSuccess:"Erreurs HMS effacées",clearFailed:"Échec de l'effacement des erreurs HMS"},mqttDebug:{title:"Journal de débogage MQTT",searchPlaceholder:"Chercher topic ou message...",noMessages:"Aucun message enregistré",startLoggingHint:'Cliquez sur "Démarrer" pour capturer les messages MQTT',noMessagesMatch:"Aucun message ne correspond",adjustFilterHint:"Ajustez votre recherche",incoming:"Entrant",outgoing:"Sortant",loggingStopped:"Enregistrement arrêté",loggingActive:"Enregistrement actif - rafraîchissement auto",startLogging:"Démarrer",stopLogging:"Arrêter",clearLog:"Effacer le journal",topic:"Topic",timestamp:"Horodatage",direction:"Direction",all:"Tous"},printerFiles:{title:"Gestionnaire de fichiers",storageUsed:"Utilisé :",storageFree:"Libre :",filterPlaceholder:"Filtrer les fichiers...",deleteButton:"Supprimer",deleteFiles:"Supprimer {{count}} fichiers",deleteFileConfirm:'Supprimer "{{name}}" ?',deleteFilesConfirm:"Supprimer les {{count}} fichiers sélectionnés ?",noFiles:"Aucun fichier sur l'imprimante",loadingFiles:"Chargement...",failedToLoad:"Échec chargement fichiers",toast:{filesDeleted:"{{count}} fichier(s) supprimé(s)",deleteFailed:"Échec suppression : {{error}}"}},confirm:{delete:"Voulez-vous vraiment supprimer cet élément ?",unsavedChanges:"Changements non sauvegardés. Voulez-vous quitter ?",clearQueue:"Voulez-vous vraiment vider la file d'attente ?"},login:{title:"Connexion Bambuddy",subtitle:"Connectez-vous à votre compte",username:"Utilisateur",usernamePlaceholder:"Entrez votre utilisateur",usernameOrEmail:"Utilisateur ou Email",usernameOrEmailPlaceholder:"Utilisateur ou @ Email",password:"Mot de passe",passwordPlaceholder:"Entrez votre mot de passe",signIn:"Se connecter",signingIn:"Connexion...",forgotPassword:"Mot de passe oublié ?",loginSuccess:"Connecté avec succès",loginFailed:"Échec de connexion",enterCredentials:"Entrez vos identifiants",forgotPasswordTitle:"Mot de passe oublié",forgotPasswordMessage:"Contactez votre administrateur pour réinitialiser votre accès.",forgotPasswordEmailMessage:"Entrez votre email pour recevoir un nouveau mot de passe.",emailAddress:"Adresse Email",emailPlaceholder:"votre.email@exemple.com",cancel:"Annuler",sending:"Envoi...",sendResetEmail:"Envoyer l'email",howToReset:"Comment réinitialiser :",resetStep1:"Contactez votre admin Bambuddy",resetStep2:"Demandez une réinitialisation dans la Gestion Utilisateurs",resetStep3:"Il vous donnera un mot de passe temporaire",resetStep4:"Connectez-vous et changez-le dans les Paramètres",gotIt:"Compris"},setup:{title:"Configuration Bambuddy",subtitle:"Configurez l'authentification",enableAuth:"Activer l'authentification",adminAccount:"Compte Admin",adminAccountDesc:"Si des admins existent, ils seront utilisés. Sinon, créez-en un ci-dessous.",adminUsername:"Utilisateur Admin",adminPassword:"Mot de passe Admin",optionalIfAdminExists:"(optionnel si admin existe)",adminUsernamePlaceholder:"Nom admin (optionnel)",adminPasswordPlaceholder:"Mdp admin (optionnel)",confirmPassword:"Confirmer mdp",confirmPasswordPlaceholder:"Confirmez mdp admin",settingUp:"Configuration...",completeSetup:"Terminer la configuration",toast:{authEnabledAdminCreated:"Authentification activée et admin créé",authEnabledExistingAdmins:"Authentification activée avec admins existants",setupCompleted:"Configuration terminée",enterBothCredentials:"Entrez les deux ou laissez vide pour utiliser les admins existants",passwordsDoNotMatch:"Les mots de passe ne correspondent pas",passwordTooShort:"Minimum 6 caractères"}},changePassword:{title:"Changer le mot de passe",currentPassword:"Mot de passe actuel",currentPasswordPlaceholder:"Entrez mdp actuel",newPassword:"Nouveau mot de passe",newPasswordPlaceholder:"Nouveau mdp (min 6 char)",confirmPassword:"Confirmer nouveau mdp",confirmPasswordPlaceholder:"Confirmez nouveau mdp",passwordsDoNotMatch:"Les mots de passe ne correspondent pas",passwordTooShort:"Minimum 6 caractères",changing:"Changement...",success:"Mot de passe modifié",failed:"Échec modification"},plateAlert:{title:"Impression en Pause !",message:"Objets détectés sur le plateau. L'impression a été suspendue automatiquement. Videz le plateau avant de reprendre.",understand:"J'ai compris"},camera:{title:"Vue Caméra",invalidPrinterId:"ID imprimante invalide",live:"Direct",snapshot:"Instantané",restartStream:"Redémarrer le flux",refreshSnapshot:"Rafraîchir l'image",fullscreen:"Plein écran",exitFullscreen:"Quitter plein écran",connectingToCamera:"Connexion caméra...",capturingSnapshot:"Capture...",connectionLost:"Connexion perdue",connectionFailed:"Échec connexion caméra",reconnecting:"Reconnexion dans {{countdown}}s... (essai {{attempt}}/{{max}})",reconnectNow:"Reconnexion immédiate",cameraUnavailable:"Caméra indisponible",cameraUnavailableDesc:"Vérifiez que l'imprimante est allumée.",noCamera:"Aucune caméra disponible",retry:"Réessayer",cameraStream:"Flux caméra",zoomOut:"Zoom arrière",zoomIn:"Zoom avant",resetZoom:"Réinitialiser zoom",recording:"Enregistrement",startRecording:"Démarrer l'enregistrement",stopRecording:"Arrêter l'enregistrement",chamberLight:"Basculer lumière chambre"},groups:{title:"Gestion des Groupes",subtitle:"Gérez les permissions pour le contrôle d'accès",backToSettings:"Retour aux paramètres",createGroup:"Créer un groupe",noPermission:"Accès refusé.",system:"Système",noDescription:"Pas de description",usersCount:"{{count}} utilisateurs",permissionsCount:"{{count}} permissions",edit:"Modifier",delete:"Supprimer",toast:{created:"Groupe créé",updated:"Groupe mis à jour",deleted:"Groupe supprimé",enterGroupName:"Entrez un nom de groupe"},modal:{editGroup:"Modifier le groupe",createGroup:"Créer un groupe",cancel:"Annuler",saving:"Enregistrement...",creating:"Création...",saveChanges:"Enregistrer"},form:{groupName:"Nom du groupe",groupNamePlaceholder:"Nom du groupe",systemGroupWarning:"Les groupes système sont fixes",description:"Description",descriptionPlaceholder:"Description (optionnel)",permissions:"Permissions ({{count}} sélectionnées)"},deleteModal:{title:"Supprimer le groupe",message:"Les utilisateurs de ce groupe perdront ces permissions.",confirm:"Supprimer"},editor:{title:"Modifier le groupe",createTitle:"Créer un groupe",search:"Rechercher des permissions...",selectAll:"Tout sélectionner",clearAll:"Tout désélectionner",permissionsSelected:"{{count}} sélectionnée(s)",noResults:"Aucune permission ne correspond à votre recherche"}},users:{title:"Gestion des Utilisateurs",subtitle:"Gérez les accès à Bambuddy",backToSettings:"Retour aux paramètres",createUser:"Créer un utilisateur",noPermission:"Accès refusé.",admin:"Admin",noGroups:"Aucun groupe",active:"Actif",inactive:"Inactif",edit:"Modifier",delete:"Supprimer",system:"Système",noGroupsAvailable:"Aucun groupe disponible",table:{username:"Utilisateur",groups:"Groupes",status:"Statut",actions:"Actions"},toast:{created:"Utilisateur créé",updated:"Utilisateur mis à jour",deleted:"Utilisateur supprimé",fillRequired:"Remplissez les champs requis",passwordsDoNotMatch:"Les mots de passe ne correspondent pas",passwordTooShort:"Minimum 6 caractères"},modal:{createUser:"Créer utilisateur",editUser:"Modifier utilisateur",cancel:"Annuler",creating:"Création...",saving:"Enregistrement...",saveChanges:"Enregistrer",advancedAuthSubtitle:"avec Authentification Avancée"},form:{username:"Utilisateur",usernamePlaceholder:"Nom utilisateur",email:"Email",emailPlaceholder:"utilisateur@exemple.com",password:"Mot de passe",passwordPlaceholder:"Mot de passe",confirmPassword:"Confirmer mdp",confirmPasswordPlaceholder:"Confirmez mdp",newPasswordPlaceholder:"Nouveau mdp",confirmNewPasswordPlaceholder:"Confirmez nouveau mdp",leaveBlankToKeep:"Laissez vide pour conserver l'actuel",groups:"Groupes",optional:"optionnel",autoGeneratedPassword:"Un mot de passe sera généré et envoyé par email.",passwordManagedByAdvancedAuth:'Géré par Auth Avancée. Utilisez "Réinitialiser" pour envoyer un nouveau mdp par email.',resetPassword:"Réinitialiser le mot de passe",resettingPassword:"Réinitialisation..."},deleteModal:{title:"Supprimer utilisateur",message:"Cette action est irréversible.",confirm:"Supprimer"}},streamOverlay:{title:"Superposition Flux",invalidPrinterId:"ID invalide",cameraStream:"Flux caméra",progress:"Progression",eta:"Fin estimée",printerIdle:"Imprimante inactive",printerOffline:"Imprimante hors ligne",status:{printing:"Impression",paused:"En pause",finished:"Terminée",failed:"Échouée",idle:"Inactive",unknown:"Inconnue"}},profiles:{title:"Profils",subtitle:"Gérez vos presets slicer et calibrations Pressure Advance",tabs:{cloud:"Profils Cloud",local:"Profils Locaux",kprofiles:"K-Profiles"},localProfiles:{title:"Profils Locaux",subtitle:"Gérez vos presets OrcaSlicer",import:"Importer Profils",importDesc:"Déposez les fichiers .bbscfg, .bbsflmt, .orca_filament, .zip ou .json",importing:"Importation...",search:"Chercher un preset...",noPresets:"Aucun preset local",badge:"Local",edit:"Modifier",delete:"Supprimer",cancel:"Annuler",deleteConfirmTitle:"Supprimer Preset",deleteConfirm:"Supprimer définitivement ce preset ?",source:"Source",inheritsFrom:"Hérite de",filamentType:"Type",vendor:"Vendeur",compatiblePrinters:"Imprimantes",nozzleTemp:"Temp Buse",cost:"Coût",density:"Densité",pressureAdvance:"Pressure Advance",filament:"Filament",process:"Processus",printer:"Imprimante",toast:{importSuccess:"{{count}} profil(s) importé(s)",importSkipped:"{{count}} profil(s) ignoré(s) (doublons)",importError:"{{count}} erreur(s) d'import",deleted:"Preset supprimé",updated:"Preset mis à jour"}},connectedAs:"Connecté en tant que",logout:"Déconnexion",noLogoutPermission:"Pas d'autorisation de déconnexion",failedToLoad:"Échec chargement profils",retry:"Réessayer",time:{justNow:"À l'instant",minsAgo:"Il y a {{count}}m",hoursAgo:"Il y a {{count}}h",daysAgo:"Il y a {{count}}j"},toast:{loggedOut:"Déconnecté"},login:{title:"Connexion Bambu Cloud",subtitle:"Synchronisez vos presets slicer",email:"Email",password:"Mot de passe",region:"Région",regionGlobal:"Global",regionChina:"Chine",verificationCode:"Code de vérification",totpCode:"Code Authenticator",checkEmail:"Code envoyé à {{email}}",enterTotpHint:"Entrez le code 2FA",accessToken:"Jeton d'accès (Access Token)",accessTokenHint:"Collez le jeton (depuis Bambu Studio)",back:"Retour",loginButton:"Connexion",verifyButton:"Vérifier",setTokenButton:"Définir Jeton",useToken:"Utiliser jeton d'accès",useEmail:"Connexion par email",toast:{loggedIn:"Connecté avec succès",codeSent:"Code envoyé par email",enterTotp:"Entrez le code Authenticator",tokenSet:"Jeton défini"}},presets:{myPreset:"Mon preset (modifiable)",duplicate:"Dupliquer",editable:"Modifiable",failedToLoadDetails:"Échec détails preset",deleteConfirm:"Supprimer ce preset ?",deleteWarning:'Ceci supprimera "{{name}}" de Bambu Cloud définitivement.',noDuplicatePermission:"Pas d'autorisation duplication",noEditPermission:"Pas d'autorisation modification",noDeletePermission:"Pas d'autorisation suppression",types:{filament:"Preset filament",printer:"Preset imprimante",process:"Preset processus"},toast:{deleted:"Preset supprimé",created:"Preset créé",updated:"Preset mis à jour",duplicated:"Preset dupliqué",fieldAdded:'Champ "{{key}}" ajouté',exported:"Preset exporté"},baseLabel:"Base : {{name}}",currentLabel:"Actuel : {{name}}",newPreset:"Nouveau Preset",editPreset:"Modifier Preset",duplicatePreset:"Dupliquer Preset",createNewPreset:"Créer un nouveau Preset",customizeSettings:"Personnalisez vos réglages",compareWithBase:"Comparer avec la base",compare:"Comparer",basePreset:"Preset de base",selectBasePreset:"Choisir preset de base...",presetName:"Nom du preset",myCustomPreset:"Mon preset personnalisé",inheritsFrom:"Hérite de",dropJsonToImport:"Glissez JSON pour importer",tabs:{common:"Commun",allFields:"Tous les champs"},availableFields:"Champs disponibles",searchFieldsPlaceholder:"Chercher un champ...",noMatchingFields:"Aucun champ trouvé",allFieldsAdded:"Tous les champs sont ajoutés",addCustomField:"Ajouter un champ personnalisé",yourOverrides:"Vos modifications",noOverridesYet:"Aucune modification",clickFieldsToAdd:"Cliquez à gauche pour ajouter",saveAsTemplate:"Enregistrer comme modèle",jsonTip:"Conseil : Glissez un .json pour importer les réglages"},cloudView:{searchPlaceholder:"Chercher presets...",templates:"Modèles",refresh:"Rafraîchir",newPreset:"Nouveau Preset",clearFilters:"Effacer filtres",compareMode:"Mode Comparaison",selectAnotherPreset:"Choisir un autre preset {{type}}",clickTwoPresets:"Choisissez deux presets de même type",selectFirst:"1. Sélectionner premier",selectSecond:"2. Sélectionner second",compareNow:"Comparer maintenant",lastSynced:"Synchronisé :",showingCount:"{{showing}} sur {{total}} presets",noPresetsFound:"Aucun preset trouvé",columns:{filament:"Filament",process:"Processus",printer:"Imprimante"},noFilamentPresets:"Pas de preset filament",noProcessPresets:"Pas de preset processus",noPrinterPresets:"Pas de preset imprimante",filters:{type:"Type",owner:"Propriétaire",printer:"Imprimante",nozzle:"Buse",filament:"Filament",layer:"Couche",all:"Tous",myPresets:"Mes Presets",builtIn:"Inclus",process:"Processus"},noTemplatesPermission:"Pas d'autorisation modèles",noRefreshPermission:"Pas d'autorisation rafraîchissement",noCreatePermission:"Pas d'autorisation création"},templates:{title:"Modèles rapides",noTemplates:"Aucun modèle",createFirst:"Créez-en depuis l'éditeur de preset",typeFilter:"Type :",deleteTitle:"Supprimer modèle",deleteWarning:"Action irréversible",deleteConfirm:'Supprimer "{{name}}" ?',namePlaceholder:"Nom du modèle",descriptionPlaceholder:"Description",settingsJson:"Paramètres (JSON)",fieldsCount:"{{count}} champs",shownInModals:"Visible dans fenêtres",hiddenInModals:"Masqué dans fenêtres",apply:"Appliquer",toast:{deleted:"Modèle supprimé",updated:"Modèle mis à jour",created:"Modèle créé",applied:"Modèle appliqué"}}},support:{debugLoggingActive:"Débogage actif",manageLogs:"Gérer",collectItem7:"Connectivité et versions firmware",collectItem8:"Statut intégrations (Spoolman, MQTT, HA)",collectItem9:"Interfaces réseau (sous-réseaux)",collectItem10:"Versions packages Python",collectItem11:"Santé base de données",collectItem12:"Détails environnement Docker"},fileManager:{title:"Gestionnaire de fichiers",subtitle:"Organisez vos fichiers d'impression",uploadFiles:"Téléverser fichiers",newFolder:"Nouveau dossier",folderName:"Nom du dossier",folderNamePlaceholder:"ex: Pièces Utiles",renameFile:"Renommer fichier",renameFolder:"Renommer dossier",moveFiles:"Déplacer {{count}} fichier(s)",rootNoFolder:"Racine (aucun dossier)",current:"actuel",linkFolder:"Lier le dossier",linkFolderDescription:'Lier "{{name}}" à un projet ou archive.',project:"Projet",archive:"Archive",noProjectsFound:"Aucun projet trouvé",noArchivesFound:"Aucune archive trouvée",unlink:"Délier",link:"Lier",dragDropFiles:"Glissez les fichiers ici",dropFilesHere:"Déposez ici",orClickToBrowse:"ou cliquez pour parcourir",allFileTypesSupported:"Tous types supportés. ZIP extraits.",zipFilesDetected:"ZIP détectés",zipExtractOptions:"Choix de structure pour ZIP :",preserveZipStructure:"Garder structure ZIP",createFolderFromZip:"Dossier par nom du ZIP",stlThumbnailGeneration:"Vignettes STL",zipMayContainStl:"Extraction vignettes possible pour STL.",thumbnailsCanBeGenerated:"Génération vignettes (peut être long).",generateThumbnailsForStl:"Générer vignettes STL",threemfDetected:"Fichiers 3MF détectés",threemfExtractionInfo:"Réglages extraits auto du 3MF.",willBeExtracted:"Sera extrait",filesExtracted:"{{count}} fichiers extraits",uploadComplete:"Terminé : {{succeeded}} succès",uploadFailed:"Échec du téléversement",zipFilesFailed:"{{count}} fichiers échoués",uploading:"Téléversement...",changeLink:"Modifier lien...",linkTo:"Lier à...",linkToProjectOrArchive:"Lier à projet ou archive",addToQueue:"Ajouter à la file",schedulePrint:"Planifier",generateThumbnail:"Générer vignette",generateThumbnails:"Générer vignettes",generateThumbnailsForMissing:"Vignettes STL manquantes",gridView:"Grille",listView:"Liste",lowDiskSpaceWarning:"Espace disque faible",lowDiskSpaceDetails:"{{free}} libre sur {{total}}. Seuil : {{threshold}} Go.",files:"Fichiers",folders:"Dossiers",size:"Taille",free:"Libre",allFiles:"Tous les fichiers",wrap:"Retour ligne",enableTextWrapping:"Activer retour ligne",disableTextWrapping:"Désactiver retour ligne",dragToResizeTooltip:"Glisser pour redimensionner, double-clic reset",searchFiles:"Chercher fichiers...",allTypes:"Tous types",prints:"Impressions",ascending:"Croissant",descending:"Décroissant",resultsCount:"{{showing}} sur {{total}} fichiers",selectAll:"Tout sélectionner",deselectAll:"Tout désélectionner",selected:"{{count}} sélectionnés",adding:"Ajout...",loadingFiles:"Chargement...",folderIsEmpty:"Dossier vide",noFilesYet:"Aucun fichier",folderEmptyDescription:"Téléversez ou déplacez des fichiers ici.",noFilesDescription:"Téléversez des fichiers pour organiser.",noMatchingFiles:"Aucun fichier correspondant",noMatchingFilesDescription:"Ajustez votre recherche.",clearFilters:"Effacer filtres",printedCount:"Imprimé {{count}}x",uploadedBy:"Téléversé par",deleteFolder:"Supprimer dossier",deleteFile:"Supprimer fichier",deleteFilesCount:"Supprimer {{count}} fichiers",deleteFolderConfirm:"Supprimer le dossier et son contenu ?",deleteFileConfirm:"Supprimer ce fichier ?",deleteFilesConfirm:"Supprimer {{count}} fichiers définitivement ?",deleting:"Suppression...",noPermissionRenameFolder:"Pas d'autorisation renommage",noPermissionLinkFolder:"Pas d'autorisation lien",noPermissionDeleteFolder:"Pas d'autorisation suppression dossier",noPermissionPrint:"Pas d'autorisation impression",noPermissionAddToQueue:"Pas d'autorisation file",noPermissionDownload:"Pas d'autorisation téléchargement",noPermissionRenameFile:"Pas d'autorisation renommage fichier",noPermissionGenerateThumbnail:"Pas d'autorisation vignettes",noPermissionDeleteFile:"Pas d'autorisation suppression fichier",noPermissionCreateFolder:"Pas d'autorisation nouveau dossier",noPermissionUpload:"Pas d'autorisation téléversement",noPermissionMoveFiles:"Pas d'autorisation déplacement",noPermissionDeleteFiles:"Pas d'autorisation suppression groupée",toast:{folderCreated:"Dossier créé",folderDeleted:"Dossier supprimé",fileDeleted:"Fichier supprimé",filesDeleted:"{{count}} fichiers supprimés",filesMoved:"Fichiers déplacés",folderLinked:"Dossier lié",folderUnlinked:"Dossier délié",addedToQueue:"{{count}} fichier(s) ajouté(s)",addedToQueuePartial:"{{added}} ajoutés, {{failed}} échecs",failedToAddToQueue:"Échec ajout file : {{error}}",fileRenamed:"Fichier renommé",folderRenamed:"Dossier renommé",thumbnailsGenerated:"{{count}} vignette(s) générée(s)",thumbnailsGeneratedPartial:"{{succeeded}} succès, {{failed}} échecs",noStlMissingThumbnails:"Aucun STL sans vignette",failedToGenerateThumbnails:"Échec vignettes : {{error}}",thumbnailGenerated:"Vignette générée",failedToGenerateThumbnail:"Échec vignette : {{error}}"}},projects:{title:"Projets",subtitle:"Suivez vos projets d'impression 3D",newProject:"Nouveau Projet",editProject:"Modifier Projet",deleteProject:"Supprimer Projet",projectName:"Nom du Projet",description:"Description",noProjects:"Aucun projet",noProjectsFiltered:"Aucun projet {{status}}",noProjectsFilteredHelp:"Les projets apparaîtront ici quand leur statut changera.",createFirst:"Créez votre premier projet pour organiser vos builds.",createFirstButton:"Créer votre premier projet",create:"Créer",files:"Fichiers",prints:"Impressions",plates:"plateaux",parts:"pièces",lastModified:"Modifié le",deleteConfirm:"Supprimer ce projet ? Les archives seront déliées mais conservées.",addFiles:"Ajouter fichiers",removeFile:"Retirer fichier",viewDetails:"Détails",namePlaceholder:"ex: Build Voron 2.4",descriptionPlaceholder:"Description optionnelle...",color:"Couleur",targetPlates:"Plateaux cibles",targetPlatesPlaceholder:"ex: 25",targetPlatesHelp:"Nombre total de jobs",targetParts:"Pièces cibles",targetPartsPlaceholder:"ex: 150",targetPartsHelp:"Nombre total d'objets",tagsLabel:"Tags (séparés par virgules)",tagsPlaceholder:"ex: voron, cadeau",dueDate:"Échéance",priority:"Priorité",priorityLow:"Basse",priorityNormal:"Normale",priorityHigh:"Haute",priorityUrgent:"Urgente",statusActive:"Actif",statusCompleted:"Terminé",statusArchived:"Archivé",done:"Fait",completed:"terminé",failed:"échoué",inQueue:"en file",noPrintsYet:"Aucune impression",printJobs:"Jobs (plateaux)",partsPrinted:"Pièces imprimées",failedParts:"Pièces échouées",import:"Importer",export:"Exporter",importProject:"Importer projet",exportAll:"Exporter tous les projets",loading:"Chargement des projets...",noEditPermission:"Pas d'autorisation de modification",noDeletePermission:"Pas d'autorisation de suppression",noCreatePermission:"Pas d'autorisation de création",noImportPermission:"Pas d'autorisation d'import",noExportPermission:"Pas d'autorisation d'export",toast:{created:"Projet créé",updated:"Projet mis à jour",deleted:"Projet supprimé",imported:"Projet importé",multipleImported:"{{count}} projets importés",importFailed:"Échec d'import",exported:"Projets exportés (métadonnées)"}},projectDetail:{notFound:"Projet non trouvé",backToProjects:"Retour aux Projets",export:"Exporter",exportProject:"Exporter projet",noExportPermission:"Pas d'autorisation export",noEditPermission:"Pas d'autorisation modification",partOf:"Fait partie de :",priorityLabel:"Priorité :",noPrints:"Aucune impression dans ce projet",status:{active:"Actif",completed:"Terminé",archived:"Archivé"},priority:{low:"Basse",normal:"Normale",high:"Haute",urgent:"Urgente"},dueDate:{overdue:"En retard",today:"Aujourd'hui",daysLeft:"{{count}} jours restants"},progress:{platesProgress:"Progression Plateaux",partsProgress:"Progression Pièces",printJobs:"jobs d'impression",parts:"pièces",percentComplete:"{{percent}}% terminé",remaining:"{{count}} restant(s)"},stats:{printJobs:"Jobs d'Impression",total:"total",failed:"{{count}} échecs",partsPrinted:"{{count}} pièces imprimées",printTime:"Temps d'Impression",filamentUsed:"Filament utilisé"},cost:{title:"Suivi des coûts",filamentCost:"Coût Filament",energy:"Énergie",budget:"Budget",remaining:"Restant"},subProjects:{title:"Sous-projets ({{count}})"},notes:{title:"Notes",noEditPermission:"Pas d'autorisation modification",placeholder:"Ajouter des notes...",empty:"Aucune note. Cliquez sur modifier."},files:{title:"Fichiers",linkFolders:"Liez des dossiers depuis le gestionnaire",forQuickAccess:"pour un accès rapide.",fileCount:"{{count}} fichier(s)",empty:"Aucun dossier lié."},bom:{title:"BOM (Liste matériel)",acquired:"{{completed}}/{{total}} acquis",showAll:"Tout afficher",hideDone:"Masquer acquis",addPart:"Ajouter matériel",noAddPermission:"Pas d'autorisation ajout",partNamePlaceholder:"Nom (ex: Vis M3x8)",partName:"Nom de pièce",qty:"Qté",price:"Prix ({{currency}})",sourcingUrlPlaceholder:"Lien d'achat (optionnel)",remarksPlaceholder:"Remarques (optionnel)",deletePart:"Supprimer pièce",deleteConfirm:'Supprimer "{{name}}" ?',noUpdatePermission:"Pas d'autorisation mise à jour",noEditPermission:"Pas d'autorisation modification",noDeletePermission:"Pas d'autorisation suppression",totalCost:"Coût total :",empty:"BOM vide. Ajoutez du matériel ou de l'électronique."},timeline:{title:"Historique d'activité",empty:"Aucune activité."},template:{saveAsTemplate:"Enregistrer comme modèle",noCreatePermission:"Pas d'autorisation modèle"},queue:{title:"File d'attente",viewAll:"Tout voir",printing:"{{count}} en cours",queued:"{{count}} en file"},prints:{title:"Impressions ({{count}})"},toast:{projectUpdated:"Projet mis à jour",partAdded:"Pièce ajoutée",partRemoved:"Pièce retirée",exportFailed:"Échec export",projectExported:"Projet exporté",templateCreated:"Modèle créé"}},system:{title:"Informations Système",version:"Version",uptime:"Temps de fonctionnement",cpuUsage:"Utilisation CPU",memoryUsage:"Utilisation RAM",diskUsage:"Utilisation Disque",networkInfo:"Infos Réseau",logs:"Journaux",debugMode:"Mode Débogage",enableDebug:"Activer débogage",disableDebug:"Désactiver débogage",downloadLogs:"Télécharger logs",clearLogs:"Effacer logs",dockerInfo:"Infos Docker",containerName:"Nom conteneur",imageName:"Nom image",platform:"Plateforme",architecture:"Architecture"},library:{title:"Bibliothèque Filament",addFilament:"Ajouter Filament",editFilament:"Modifier Filament",deleteFilament:"Supprimer Filament",vendor:"Vendeur",material:"Matériau",color:"Couleur",kFactor:"Facteur K",temperature:"Température",noFilaments:"Bibliothèque vide",deleteConfirm:"Supprimer ce filament ?",importFromPrinter:"Importer de l'imprimante",exportToFile:"Exporter vers fichier"},spoolman:{title:"Intégration Spoolman",enabled:"Spoolman Activé",url:"URL Spoolman",connected:"Connecté",disconnected:"Non Connecté",testConnection:"Tester connexion",sync:"Synchroniser",syncing:"Sync...",lastSync:"Dernière Sync",linkToSpoolman:"Lier à Spoolman",openInSpoolman:"Ouvrir Spoolman",unlinkSpool:"Délier bobine",unlinkConfirmTitle:"Dissocier la bobine?",unlinkConfirmMessage:"Cette opération déconnectera la bobine de Spoolman. Les données de la bobine dans Spoolman resteront inchangées.",selectSpool:"Choisir bobine",noUnlinkedSpools:"Pas de bobine libre",linkSuccess:"Lien réussi",linkFailed:"Échec lien",unlinkSuccess:"Bobine dissociée avec succès",unlinkFailed:"Échec de la dissociation de la bobine",spoolId:"ID Bobine",fillSourceLabel:"(Spoolman)",weight:"Poids",remaining:"Restant",disableWeightSync:"Désactiver Sync poids estimé AMS",disableWeightSyncDesc:"Ne pas utiliser les estimations AMS. Utile si vous préférez le suivi Spoolman.",reportPartialUsage:"Rapporter consommation partielle pour échecs",reportPartialUsageDesc:"Si l'impression échoue, rapporte le filament consommé selon les couches."},inventory:{title:"Inventaire de Bobines",addSpool:"Ajouter Bobine",editSpool:"Modifier Bobine",material:"Matériau",selectMaterial:"Choisir matériau...",subtype:"Sous-type",brand:"Marque",searchBrand:"Chercher marque...",useCustomBrand:'Utiliser "{{brand}}"',useCustomMaterial:"Utiliser un matériau personnalisé : {{material}}",colorName:"Nom de couleur",colorNamePlaceholder:"Jade White, Fire Red...",color:"Couleur",hexColor:"Code Hex",pickColor:"Choisir couleur perso",labelWeight:"Poids net",coreWeight:"Poids bobine vide",searchSpoolWeight:"Chercher poids bobine...",weightUsed:"Consommé",currentWeight:"Poids restant",measuredWeight:"Poids mesuré",costPerKg:"Coût par kg",measuredWeightError:"Le poids mesuré doit être entre {{min}}g et {{max}}g.",slicerFilament:"Filament Slicer",slicerFilamentName:"Nom du Preset Slicer",slicerPreset:"Preset Slicer",searchPresets:"Chercher presets...",selectedPreset:"Sélectionné",noPresetsFound:"Aucun preset trouvé",tempOverrides:"Exceptions Température",note:"Note",notePlaceholder:"Notes additionnelles sur cette bobine...",archive:"Archiver",restore:"Restaurer",noSpools:"Aucune bobine. Ajoutez votre première bobine pour commencer.",noManualSpools:"Aucune bobine manuelle disponible. Ajoutez-en une d'abord.",kProfiles:"K-Profiles",addKProfile:"Ajouter K-Profile",assignSpool:"Assigner Bobine",unassignSpool:"Désassigner",assignSuccess:"Bobine assignée et slot AMS configuré",assignFailed:"Échec assignation",selectSpool:"Choisir une bobine pour ce slot",assigned:"Assigné",assigning:"Assignation...",searchSpools:"Chercher bobines...",allMaterials:"Tous Matériaux",filterByBrand:"Filtrer par marque...",showArchived:"Afficher archivées",quickAdd:"Ajout rapide (Stock)",quantity:"Quantité",stock:"Stock",configured:"Configuré",spoolsCreated:"{{count}} bobines créées",spoolCreated:"Bobine créée",spoolUpdated:"Bobine mise à jour",spoolDeleted:"Bobine supprimée",spoolArchived:"Bobine archivée",spoolRestored:"Bobine restaurée",deleteConfirm:"Supprimer définitivement cette bobine ?",archiveConfirm:"Voulez-vous vraiment archiver cette bobine ?",advancedSettings:"Paramètres Avancés",filamentInfoTab:"Infos Filament",paProfileTab:"Profil PA",filamentInfo:"Filament",additional:"Additionnel",loadingPresets:"Chargement des presets cloud...",cloudConnected:"Cloud connecté",cloudNotConnected:"Cloud déconnecté (valeurs par défaut)",recentColors:"Récentes",searchColors:"Chercher couleurs...",searchResults:"Résultats",allColors:"Toutes",commonColors:"Communes",showLess:"Moins",showAll:"Toutes",noColorsFound:"Aucune couleur correspondante",noResults:"Aucun résultat",selectMaterialFirst:"Veuillez choisir un matériau dans l'onglet Infos Filament.",noPrintersConfigured:"Ajoutez une imprimante pour utiliser les profils PA.",matchingFilter:"Correspondant",anyBrand:"Toute marque",anyVariant:"Toute variante",autoSelect:"Auto-sélection",matches:"correspondances",match:"correspondance",noMatches:"Aucune correspondance",connected:"Connecté",offline:"Hors ligne",printerOffline:"Imprimante hors ligne. Connectez-vous pour voir les profils.",noKProfilesMatch:"Aucun profil K ne correspond au filament.",leftNozzle:"Buse Gauche",rightNozzle:"Buse Droite",profilesSelected:"profil(s) de calibration sélectionné(s)",totalInventory:"Total Inventaire",totalConsumed:"Total Consommé",byMaterial:"Par Matériau",inPrinter:"Dans Imprimante",lowStock:"Stock Bas",sinceTracking:"Depuis le début du suivi",loadedInAms:"Chargé dans AMS/Ext",remaining:"Restant",weightCheck:"Vérification poids",lastWeighed:"Dernière pesée",neverWeighed:"Jamais pesé",search:"Chercher bobines...",showing:"Affichage",to:"à",of:"sur",show:"Voir",spools:"bobines",spool:"bobine",page:"Page",noSpoolsMatch:"Aucun résultat trouvé",noSpoolsMatchDesc:"Ajustez votre recherche ou vos filtres.",active:"Actif",archived:"Archivé",all:"Tous",used:"Occasion",new:"Neuf",clearFilters:"Effacer filtres",table:"Tableau",cards:"Cartes",net:"Net",groupSimilar:"Grouper",groupedSpools:"{{count}} bobines identiques",groupedRows:"lignes",columns:"Colonnes",configureColumns:"Configurer Colonnes",configureColumnsDesc:"Glissez pour ordonner ou utilisez les flèches. Cliquez sur l'œil pour masquer.",visible:"visible",reset:"Reset",cancel:"Annuler",applyChanges:"Appliquer",moveUp:"Monter",moveDown:"Descendre",hideColumn:"Masquer",showColumn:"Afficher",linkToSpool:"Lier à une Bobine",tagLinked:"Tag lié à la bobine",tagLinkFailed:"Échec lien tag",tagAlreadyLinked:"Tag déjà lié à une autre bobine",unknownTag:"Tag RFID inconnu détecté",usageHistory:"Historique de Consommation",noUsageHistory:"Aucune consommation enregistrée",printName:"Nom Impression",weightConsumed:"Poids consommé",clearHistory:"Effacer",historyCleared:"Historique effacé",fillSourceLabel:"(Inv)",lowStockThresholdError:"Le seuil doit être compris entre 0.1 et 99.9"},timelapse:{title:"Timelapse",create:"Créer Timelapse",download:"Télécharger",delete:"Supprimer",preview:"Aperçu",frameRate:"Images/sec",quality:"Qualité",processing:"Traitement...",noTimelapses:"Aucun timelapse"},ams:{title:"AMS",slot:"Slot",empty:"Vide",emptySlot:"Slot vide",unknown:"Inconnu",humidity:"Humidité",temperature:"Température",filamentType:"Type filament",filamentColor:"Couleur",remaining:"Restant",history:"Historique AMS",noHistory:"Aucun historique",configureSlot:"Configurer Slot",externalSpool:"Bobine externe",profile:"Profil",kFactor:"Facteur K",fill:"Remplir",configure:"Configurer",used:"utilisé",remainingUnit:"restant"},printModal:{title:"Lancer l'impression",selectPrinter:"Choisir l'imprimante",selectPlate:"Choisir le plateau",filamentMapping:"Mapping Filament",totalCost:"Coût total :",slotRemainingShort:" - {{grams}}g rest.",printSettings:"Réglages d'impression",bedLeveling:"Nivellement plateau",flowCalibration:"Calibration débit",vibrationCalibration:"Vibration (Input Shaper)",layerInspection:"Inspection 1ère couche",timelapse:"Timelapse",startPrint:"Démarrer",addToQueue:"Ajouter à la file",cancel:"Annuler",noPrintersAvailable:"Aucune imprimante disponible",printerBusy:"L'imprimante est occupée",printerOffline:"L'imprimante est hors ligne",sameTypeDifferentColor:"Même type, couleur différente",filamentTypeNotLoaded:"Type de filament non chargé",openCalendar:"Ouvrir calendrier",leftNozzle:"G",rightNozzle:"D",leftNozzleTooltip:"Buse gauche",rightNozzleTooltip:"Buse droite",filamentOverride:"Remplacement de filament",filamentOverrideHint:"Remplacez optionnellement les filaments pour l'affectation par modèle. Le planificateur utilisera vos filaments sélectionnés au lieu des valeurs 3MF d'origine.",originalFilament:"Original",overrideWith:"Remplacer par",resetToOriginal:"Revenir à l'original",forceColorMatch:"Forcer la correspondance couleur"},backup:{title:"Sauvegarde & Restauration",createBackup:"Créer Sauvegarde",restoreBackup:"Restaurer Sauvegarde",restoreDescription:"Remplace les données par un fichier de sauvegarde",downloadBackup:"Télécharger Sauvegarde",uploadBackup:"Téléverser Sauvegarde",lastBackup:"Dernière sauvegarde",autoBackup:"Sauvegarde auto",backupNow:"Sauvegarder maintenant",restoreWarning:"Attention : Écrase TOUTES les données actuelles.",includeArchives:"Inclure Archives",includeSettings:"Inclure Paramètres",includeProfiles:"Inclure Profils",backupSuccess:"Sauvegarde réussie",restoreSuccess:"Restauration réussie",backupFailed:"Échec sauvegarde",restoreFailed:"Échec restauration",restoreNote:"L'imprimante virtuelle sera arrêtée pendant la restauration",githubBackup:"Sauvegarde GitHub",enabled:"Activé",cloudLoginRequired:"Connexion Bambu Cloud requise. Connectez-vous sous Profils → Profils Cloud pour activer la sauvegarde GitHub.",cloudLoginRequiredShort:"Connexion Cloud requise",githubDescription:"Synchronisez automatiquement vos profils vers un dépôt GitHub privé pour la sauvegarde et l'historique des versions.",repositoryUrl:"URL du dépôt",personalAccessToken:"Jeton d'accès personnel",tokenSaved:"(enregistré)",enterNewToken:"Entrez un nouveau jeton pour mettre à jour",tokenHint:"Jeton à granularité fine avec permission de lecture/écriture du contenu",branch:"Branche",manualOnly:"Manuel uniquement",hourly:"Toutes les heures",daily:"Quotidien",weekly:"Hebdomadaire",includeInBackup:"Inclure dans la sauvegarde",kProfiles:"K-Profils",kProfilesDescription:"Calibration de l'avance de pression des imprimantes connectées",noPrintersConnected:"Aucune imprimante connectée",printersConnected:"{{connected}}/{{total}} connectées",cloudProfiles:"Profils Cloud",cloudProfilesDescription:"Préréglages de filament, imprimante et processus depuis Bambu Cloud",appSettings:"Paramètres de l'application",appSettingsDescription:"Configuration Bambuddy (base de données complète)",lastBackupAt:"Dernière sauvegarde :",noBackupsYet:"Aucune sauvegarde pour l'instant",next:"Prochaine :",startingBackup:"Démarrage de la sauvegarde...",test:"Tester",enableBackup:"Activer la sauvegarde",testConnection:"Tester la connexion",enterRepoUrl:"Entrez l'URL du dépôt",enterRepoAndToken:"Entrez l'URL du dépôt et le jeton d'accès",repoRequired:"L'URL du dépôt est requise",tokenRequired:"Le jeton d'accès est requis",githubBackupEnabled:"Sauvegarde GitHub activée",tokenUpdated:"Jeton mis à jour",settingsSaved:"Paramètres enregistrés",failedToSave:"Échec de l'enregistrement : {{message}}",backupCompleteFiles:"Sauvegarde terminée - {{count}} fichiers mis à jour",backupSkippedNoChanges:"Sauvegarde ignorée - aucun changement",backupFailed2:"Échec de la sauvegarde : {{message}}",clearedLogs:"{{count}} journaux supprimés",failedToClearLogs:"Échec de la suppression des journaux : {{message}}",history:"Historique",clear:"Effacer",date:"Date",status:"Statut",commit:"Commit",localBackup:"Sauvegarde locale",localBackupDescription:"Créez une sauvegarde complète de vos données Bambuddy incluant la base de données, les archives, les téléchargements et tous les fichiers.",downloadBackupLabel:"Télécharger la sauvegarde",completeBackupZip:"Sauvegarde complète : base de données + tous les fichiers (ZIP)",download:"Télécharger",preparingBackup:"Préparation de la sauvegarde...",creatingArchive:"Création de l'archive de sauvegarde... Cela peut prendre un moment pour les archives volumineuses.",downloadingFile:"Téléchargement du fichier de sauvegarde...",backupDownloaded:"Sauvegarde téléchargée avec succès",failedToCreateBackup:"Échec de la création de la sauvegarde : {{message}}",restore:"Restaurer",restoreReplacesAll:"La restauration remplace toutes les données.",restoreReplacesAllDetail:"Votre base de données et vos fichiers actuels seront complètement remplacés. Un redémarrage est nécessaire après la restauration.",restoreConfirmTitle:"Restaurer la sauvegarde",restoreConfirmMessage:`Êtes-vous sûr de vouloir restaurer depuis "{{filename}}" ? Cela remplacera complètement votre base de données et tous vos fichiers. L'application devra être redémarrée après la restauration.`,restoreConfirmButton:"Restaurer la sauvegarde",uploadingFile:"Téléchargement du fichier de sauvegarde...",backupRestoredRestart:"Sauvegarde restaurée. Veuillez redémarrer Bambuddy.",failedToRestore:"Échec de la restauration. Veuillez vérifier le format du fichier.",reloadNow:"Recharger maintenant",creatingBackup:"Création de la sauvegarde",restoringBackup:"Restauration de la sauvegarde",preparing:"Préparation...",processing:"Traitement...",doNotClosePage:"Veuillez ne pas fermer cette page ni naviguer ailleurs. Cette opération peut prendre plusieurs minutes pour les sauvegardes volumineuses.",restoring:"Restauration...",restoreComplete:"Restauration terminée",restoreFailed2:"Échec de la restauration",importSettings:"Importer les paramètres depuis un fichier de sauvegarde",pleaseWaitRestoring:"Veuillez patienter pendant la restauration de vos données",selectBackupFile:"Cliquez pour sélectionner un fichier de sauvegarde (.json ou .zip)",duplicateHandling:"Comment fonctionne la gestion des doublons :",matchPrinters:"Imprimantes",matchPrintersBy:"correspondance par numéro de série",matchSmartPlugs:"Smart Plugs",matchSmartPlugsBy:"correspondance par adresse IP",matchNotificationProviders:"Fournisseurs de notifications",matchNotificationProvidersBy:"correspondance par nom",matchFilaments:"Filaments",matchFilamentsBy:"correspondance par nom + type + marque",matchArchives:"Archives",matchArchivesBy:"correspondance par hash de contenu (toujours ignoré)",matchPendingUploads:"Téléchargements en attente",matchPendingUploadsBy:"correspondance par nom de fichier",matchSettingsTemplates:"Paramètres et modèles",matchSettingsTemplatesBy:"toujours écrasés",replaceExisting:"Remplacer les données existantes",keepExisting:"Conserver les données existantes",overwriteDescription:"Écraser les éléments qui existent déjà avec les données de sauvegarde",keepDescription:"Restaurer uniquement les éléments qui n'existent pas encore",overwriteCaution:"Attention :",overwriteWarning:"L'écrasement remplacera vos configurations actuelles par les données de la sauvegarde. Les codes d'accès des imprimantes ne sont jamais écrasés pour des raisons de sécurité.",cancel:"Annuler",processingBackup:"Traitement du fichier de sauvegarde...",itemsRestored:"Éléments restaurés",itemsSkipped:"Éléments ignorés",restored:"Restaurés",skippedAlreadyExist:"Ignorés (existent déjà)",filesCategory:"Fichiers (3MF, miniatures, etc.)",andMore:"...et {{count}} de plus",newApiKeysGenerated:"Nouvelles clés API générées",keysShownOnce:"Ces clés ne sont affichées qu'une seule fois. Copiez-les maintenant !",copy:"Copier",noDataFound:"Aucune donnée à restaurer n'a été trouvée dans le fichier de sauvegarde.",close:"Fermer",categories:{settings:"Paramètres",notification_providers:"Fournisseurs de notifications",notification_templates:"Modèles de notifications",smart_plugs:"Smart Plugs",printers:"Imprimantes",filaments:"Filaments",maintenance_types:"Types de maintenance",archives:"Archives",projects:"Projets",pending_uploads:"Téléchargements en attente",external_links:"Liens externes",api_keys:"Clés API"}},tags:{title:"Tags",addTag:"Ajouter Tag",editTag:"Modifier Tag",deleteTag:"Supprimer Tag",tagName:"Nom du Tag",tagColor:"Couleur du Tag",noTags:"Aucun tag",deleteConfirm:"Supprimer ce tag ?",manageTags:"Gérer les Tags"},uploadModal:{title:"Téléverser des fichiers 3MF",dragDrop:"Glissez les fichiers .3mf ici",or:"ou",browseFiles:"Parcourir",extractionInfo:"Le modèle d'imprimante est extrait des métadonnées 3MF.",uploaded:"téléversé",failed:"échoué",uploading:"En cours...",upload:"Téléverser",uploadFailed:"Échec du téléversement"},editArchive:{title:"Modifier l'archive",name:"Nom",namePlaceholder:"Nom de l'impression",printer:"Imprimante",noPrinter:"Aucune imprimante",project:"Projet",noProject:"Aucun projet",itemsPrinted:"Nombre de pièces",itemsPrintedHelp:"Nombre d'objets produits",notes:"Notes",notesPlaceholder:"Notes sur l'impression...",externalLink:"Lien externe",externalLinkPlaceholder:"https://...",externalLinkHelp:"Lien vers Printables, Thingiverse, etc.",tags:"Tags",tagsPlaceholder:"Ajouter des tags...",addMoreTags:"Plus de tags...",matchingTags:'Correspondant à "{{query}}"',existingTags:"Tags existants",clickToAdd:"(cliquer pour ajouter)",status:"Statut",failureReason:"Raison de l'échec",selectReason:"Choisir raison...",photos:"Photos du résultat",photosHelp:"Cliquez sur + pour ajouter des photos",printResult:"Résultat d'impression",saving:"Enregistrement...",failureReasons:{adhesionFailure:"Défaut d'adhésion",spaghettiDetached:"Spaghetti / Détaché",layerShift:"Décalage de couche",cloggedNozzle:"Buse bouchée",filamentRunout:"Filament fini",warping:"Warping (Déformation)",stringing:"Stringing (Cheveux d'ange)",underExtrusion:"Sous-extrusion",powerFailure:"Coupure courant",userCancelled:"Annulé par l'utilisateur",other:"Autre"},statuses:{completed:"Réussie",failed:"Échouée",aborted:"Annulée",printing:"Impression"}},kProfiles:{title:"K-Profiles",noPrintersConfigured:"Aucune imprimante configurée",addPrinterInSettings:"Ajoutez une imprimante pour gérer les K-profiles",noActivePrinters:"Aucune imprimante active",enablePrinterConnection:"Activez la connexion pour voir les K-profiles",loadingProfiles:"Chargement des K-Profiles...",printerOffline:"Imprimante hors ligne",printerOfflineDesc:"L'imprimante doit être allumée.",noMatchingProfiles:"Aucun profil correspondant",noMatchingProfilesDesc:"Ajustez votre recherche",noKProfiles:"Aucun K-Profile",noKProfilesDesc:"Aucun profil trouvé pour une buse de {{diameter}}mm",createFirstProfile:"Créer le premier profil",printer:"Imprimante",nozzle:"Buse",refresh:"Rafraîchir",addProfile:"Ajouter Profil",export:"Exporter",import:"Importer",select:"Choisir",selectAll:"Tout sélectionner",delete:"Supprimer",searchPlaceholder:"Nom ou filament...",allExtruders:"Tous les extrudeurs",leftOnly:"Gauche uniquement",rightOnly:"Droite uniquement",allFlow:"Tout débit",hfOnly:"HF uniquement",sOnly:"S uniquement",sortName:"Tri : Nom",sortKValue:"Tri : Valeur K",sortFilament:"Tri : Filament",leftExtruder:"Extrudeur gauche",rightExtruder:"Extrudeur droit",modal:{addTitle:"Ajouter K-Profile",editTitle:"Modifier K-Profile",profileName:"Nom du profil",profileNamePlaceholder:"ex: Mon profil PLA",kValue:"Valeur K",kValuePlaceholder:"0.020",kValueHelp:"Plage type : 0.01-0.06 (PLA), 0.02-0.10 (PETG)",filament:"Filament",selectFilament:"Choisir filament...",noFilamentsHelp:"Créez d'abord un profil dans Bambu Studio.",flowType:"Type de débit",highFlow:"Haut Débit (HF)",standard:"Standard",nozzleSize:"Taille buse",extruder:"Extrudeur",extruders:"Extrudeurs",left:"Gauche",right:"Droite",notes:"Notes (locales)",notesPlaceholder:"Notes sur ce profil...",notesHelp:"Enregistré dans Bambuddy, pas sur l'imprimante",syncing:"Sync avec l'imprimante...",savingExtruder:"Sauvegarde extrudeur {{current}}/{{total}}...",pleaseWait:"Patientez..."},deleteConfirm:{title:"Supprimer profil",cannotUndo:"Action irréversible",message:`Supprimer "{{name}}" de l'imprimante ?`},bulkDelete:{title:"Supprimer les profils",cannotUndo:"Action irréversible",message:"Supprimer les {{count}} profils de l'imprimante ?"},toast:{profileSaved:"Profil K enregistré",profilesSaved:"Profil K enregistré sur {{count}} extrudeur(s)",selectAtLeastOneExtruder:"Sélectionnez un extrudeur",profileDeleted:"Profil K supprimé",profilesDeleted:"{{count}} profils supprimés",exportedProfiles:"{{count}} profils exportés",importedProfiles:"{{count}} sur {{total}} profils importés",noProfilesToExport:"Rien à exporter",invalidFileFormat:"Format invalide",failedToParseImport:"Échec analyse fichier",failedToSaveBatch:"Échec enregistrement groupé",noteSaved:"Note enregistrée",failedToSaveNote:"Échec note"},permission:{noRead:"Pas d'autorisation lecture",noCreate:"Pas d'autorisation création",noUpdate:"Pas d'autorisation mise à jour",noDelete:"Pas d'autorisation suppression",noExport:"Pas d'autorisation export",noImport:"Pas d'autorisation import"}},virtualPrinter:{title:"Imprimante Virtuelle",running:"En cours",stopped:"Arrêtée",description:{default:"Active une imprimante qui apparaît dans Bambu Studio. Les fichiers envoyés sont archivés sans impression.",proxy:"Active un proxy qui relaie le trafic vers une imprimante réelle, permettant l'impression à distance."},enable:{title:"Activer l'imprimante virtuelle",visibleInSlicer:'Visible comme "Bambuddy" dans le Slicer',proxyingTo:"Proxy vers {{name}}",notActive:"Inactive"},model:{title:"Modèle d'imprimante",description:"Choisissez le modèle à émuler.",restartWarning:"Changer le modèle redémarrera le service"},accessCode:{title:"Code d'accès",isSet:"Code défini",notSet:"Code requis pour activer",placeholder:"Code 8 char",placeholderChange:"Entrez nouveau code",hint:"Exactement 8 caractères. Sert à l'auth du Slicer.",charCount:"({{count}}/8)"},targetPrinter:{title:"Imprimante cible",configured:"Cible configurée",notConfigured:"Imprimante requise pour mode Proxy",placeholder:"Choisir imprimante...",hint:"L'imprimante doit être en mode LAN.",noPrinters:"Ajoutez une imprimante réelle d'abord."},remoteInterface:{title:"Exception Interface Réseau",configured:"Override actif",optional:"Optionnel - si IP auto est fausse (VPN, Docker, multi-NIC).",placeholder:"Auto (défaut)...",hint:"Force l'IP annoncée via SSDP."},mode:{title:"Mode",archive:"Archiver",archiveDesc:"Archive immédiatement",review:"Revue",reviewDesc:"Attendre revue avant archive",queue:"File",queueDesc:"Archiver et ajouter à la file",proxy:"Proxy",proxyDesc:"Relais vers imprimante réelle"},autoDispatch:{title:"Lancement automatique",description:"Lancer automatiquement les impressions ajoutées à la file. Désactivé, les impressions attendent un lancement manuel."},setupRequired:{title:"Configuration requise",description:"Nécessite des réglages système (ports, pare-feu).",readGuide:"Lire le guide de configuration"},howItWorks:{title:"Fonctionnement",step1:"Sur le même LAN, les imprimantes virtuelles apparaissent automatiquement dans votre slicer (Bambu Studio / OrcaSlicer). Depuis d'autres réseaux, ajoutez-les manuellement par adresse IP et code d'accès.",step2:`En mode Archive, Revue et File d'attente, utilisez le bouton "Envoyer" dans votre slicer pour envoyer des fichiers 3MF à Bambuddy. Le slicer affichera "Impression réussie" — le fichier est stocké, pas imprimé.`,step3:"En mode Proxy, l'imprimante virtuelle relaie tout le trafic vers une vraie imprimante — les impressions démarrent immédiatement comme en connexion directe."},status:{title:"Détails du statut",printerName:"Nom",model:"Modèle",serialNumber:"Série",mode:"Mode",pendingFiles:"Fichiers en attente",targetPrinter:"Cible",ftpPort:"Port FTP",mqttPort:"Port MQTT",ftpConnections:"Connexions FTP",mqttConnections:"Connexions MQTT"},toast:{updated:"Réglages virtuels mis à jour",failedToUpdate:"Échec mise à jour",accessCodeRequired:"Code d'accès requis",targetPrinterRequired:"Imprimante cible requise",bindIpRequired:"Veuillez d'abord définir une adresse IP",accessCodeEmpty:"Le code ne peut pas être vide",accessCodeLength:"Le code doit faire 8 caractères",created:"Imprimante virtuelle créée",failedToCreate:"Échec de la création de l'imprimante virtuelle",deleted:"Imprimante virtuelle supprimée",failedToDelete:"Échec de la suppression de l'imprimante virtuelle"},list:{title:"Imprimantes virtuelles",add:"Ajouter",addFirst:"Ajouter une imprimante virtuelle",empty:"Aucune imprimante virtuelle configurée. Ajoutez-en une pour commencer."},bindIp:{title:"Interface réseau",placeholder:"Sélectionner interface...",hint:"Interface réseau sur laquelle cette imprimante virtuelle écoute. Doit être unique par imprimante."},proxy:{accessCodeHint:"En mode proxy, utilisez le code d'accès de l'imprimante cible dans le slicer. La connexion est transmise de manière transparente à l'imprimante réelle."},addDialog:{title:"Ajouter une imprimante virtuelle",name:"Nom",hint:"Vous pourrez configurer le code d'accès, l'imprimante cible et d'autres paramètres après la création.",create:"Créer"},deleteConfirm:{title:"Supprimer l'imprimante virtuelle",message:'Êtes-vous sûr de vouloir supprimer "{{name}}" ? Cela arrêtera tous les services de cette imprimante.'}},modelViewer:{openInSlicer:"Ouvrir dans le Slicer",tabs:{model:"Modèle 3D",gcode:"Aperçu G-code"},notAvailable:"indisponible",notSliced:"pas découpé",plates:"Plateaux",allPlates:"Tous les plateaux",plateNumber:"Plateau {{number}}",plateCount:"{{count}} plateau",plateCount_other:"{{count}} plateaux",objectCount:"{{count}} objet",objectCount_other:"{{count}} objets",filamentCount:"{{count}} filament",filamentCount_other:"{{count}} filaments",eta:"Fin {{minutes}} min",noPreview:"Aucun aperçu pour ce fichier",pagination:{pageOf:"Page {{current}} sur {{total}}",prev:"Préc",next:"Suiv"},errors:{failedToLoad:"Échec chargement fichier",noMeshes:"Aucun maillage trouvé dans le 3MF",unsupportedFormat:"Format non supporté"}},maintenanceDescriptions:{lubricateCarbonRods:"Appliquer du lubrifiant sur les tiges carbone pour un mouvement fluide",lubricateRails:"Appliquer du lubrifiant sur les rails linéaires",cleanNozzle:"Nettoyer buse et hotend anti-bouchage",checkBelts:"Tension des courroies pour la précision",cleanBuildPlate:"Nettoyage plateau pour l'adhésion",checkExtruder:"Usure des engrenages de l'extrudeur",checkCooling:"Bon fonctionnement des ventilateurs",generalInspection:"Inspection générale de la machine",cleanCarbonRods:"Nettoyer les tiges carbone (friction)",lubricateSteelRods:"Appliquer du lubrifiant sur les tiges en acier pour un mouvement fluide",cleanSteelRods:"Nettoyer les tiges en acier (friction)",cleanLinearRails:"Essuyer les rails linéaires (poussière/débris)",checkPtfeTube:"Usure ou dommage du tube PTFE",replaceHepaFilter:"Filtre HEPA pour la qualité de l'air",replaceCarbonFilter:"Filtre charbon actif (odeurs)",lubricateLeftNozzleRail:"Lubrifier le rail de buse gauche (Série H2)"},smartPlugs:{offline:"Hors ligne",admin:"Admin",openPlugAdminPage:"Page admin de la prise",deleteSmartPlug:"Supprimer la prise",turnOnSmartPlug:"Allumer la prise",turnOffSmartPlug:"Éteindre la prise",turnOn:"Allumer",turnOff:"Éteindre",addSmartPlug:{scanningNetwork:"Scan réseau...",chooseEntity:"Choisir une entité...",connectionFailed:"Échec connexion",searchEntities:"Chercher entités...",searchPowerSensors:"Capteurs puissance...",searchEnergySensors:"Capteurs énergie...",placeholders:{plugName:"Prise Salon",mqttStateOnValue:"ON, true, 1",mqttSameAsPower:"Identique au topic puissance, ou différent"}},linkedTo:"Lié à :",monitorOnly:"Surveillance uniquement",alerts:"Alertes",scheduleOn:"On {{time}}",scheduleOff:"Off {{time}}",on:"On",off:"Off",power:"Puissance",kwhToday:"kWh Aujourd'hui",settings:"Paramètres",automationSettings:"Paramètres d'automatisation",showInSwitchbar:"Afficher dans la barre de commutateurs",quickAccessSidebar:"Accès rapide depuis la barre latérale",enabled:"Activé",enableAutomation:"Activer l'automatisation pour cette prise",autoOn:"Auto On",autoOnDescription:"Allumer au démarrage de l'impression",autoOff:"Auto Off",autoOffDescription:"Éteindre à la fin de l'impression (unique)",turnOffDelayMode:"Mode de délai d'extinction",time:"Temps",temp:"Temp",delayMinutes:"Délai (minutes)",tempThreshold:"Seuil de température (°C)",tempThresholdDescription:"S'éteint lorsque la buse refroidit en dessous de cette température",edit:"Modifier",deleteConfirm:'Êtes-vous sûr de vouloir supprimer "{{name}}" ? Cette action est irréversible.',turnOnConfirm:'Êtes-vous sûr de vouloir allumer "{{name}}" ?',turnOffConfirm:`Êtes-vous sûr de vouloir éteindre "{{name}}" ? Cela coupera l'alimentation de l'appareil connecté.`,failedToTurn:'Impossible de {{action}} "{{name}}"',unknown:"Inconnu",addTitle:"Ajouter une prise connectée",editTitle:"Modifier la prise connectée",stopScanning:"Arrêter le scan",discoverTasmota:"Découvrir les appareils Tasmota",foundDevices:"{{count}} appareil(s) trouvé(s) - cliquez pour sélectionner :",noDevicesFound:"Aucun appareil Tasmota trouvé sur votre réseau",haNotConfigured:"Home Assistant n'est pas configuré. Configurez-le dans",haSettingsPath:"Paramètres → Réseau → Home Assistant",selectEntity:"Sélectionner l'entité *",ipAddress:"Adresse IP *",nameLabel:"Nom *",username:"Nom d'utilisateur",password:"Mot de passe",authHint:"Laissez vide si votre appareil Tasmota ne nécessite pas d'authentification",linkToPrinter:"Lier à l'imprimante",noPrinter:"Pas d'imprimante (contrôle manuel uniquement)",linkingDescription:"La liaison permet l'allumage/extinction automatique au début/fin de l'impression",powerAlerts:"Alertes de puissance",alertAbove:"Alerte si au-dessus (W)",alertBelow:"Alerte si en dessous (W)",alertDescription:"Recevoir une notification lorsque la consommation dépasse ces seuils. Laisser vide pour désactiver cette direction.",dailySchedule:"Planification quotidienne",turnOnAt:"Allumer à",turnOffAt:"Éteindre à",scheduleDescription:"Allumer/éteindre automatiquement la prise à ces heures chaque jour. Laisser vide pour ignorer cette action.",showOnPrinterCard:"Afficher sur la carte imprimante",displayOnPrinterCard:"Afficher le bouton sur la carte imprimante",connectedResult:"Connecté !",deviceLabel:"Appareil : {{name}} - ",stateLabel:"État : {{state}}",test:"Tester",delete:"Supprimer",save:"Enregistrer",add:"Ajouter",cancel:"Annuler",failedToStartScan:"Impossible de démarrer le scan",nameRequired:"Le nom est requis",entityRequired:"L'entité est requise pour les prises Home Assistant",mqttTopicRequired:"Au moins un topic MQTT doit être configuré pour la puissance, l'énergie ou la surveillance d'état",loadingEntities:"Chargement des entités...",loading:"Chargement...",failedToLoadEntities:"Échec du chargement des entités : {{error}}",noEntitiesMatching:'Aucune entité trouvée correspondant à "{{search}}"',noEntitiesAvailable:"Aucune entité disponible",searchingEntities:"Recherche de toutes les entités ({{count}} trouvées)",showingEntities:"Affichage switch, light, input_boolean ({{count}} disponibles)",energyMonitoringOptional:"Surveillance énergétique (Optionnel)",energyMonitoringHint:"Recherchez et sélectionnez les capteurs fournissant des données de puissance/énergie.",powerSensorW:"Capteur de puissance (W)",energyTodayKwh:"Énergie aujourd'hui (kWh)",totalEnergyKwh:"Énergie totale (kWh)",noMatchingSensors:"Aucun capteur correspondant",none:"Aucun",mqttNotConfigured:"Broker MQTT non configuré. Définissez l'adresse du broker dans",mqttSettingsPath:"Paramètres → Réseau → Publication MQTT",mqttNotConfiguredSuffix:"(vous n'avez pas besoin d'activer la publication, remplissez simplement les détails du broker).",mqttMonitorOnlyDescription:"Les prises MQTT reçoivent les données de puissance/énergie via un abonnement MQTT. Le contrôle on/off n'est pas disponible - utilisez votre broker MQTT ou système domotique.",powerMonitoring:"Surveillance de puissance",energyMonitoring:"Surveillance énergétique",stateMonitoring:"Surveillance d'état",optional:"optionnel",topic:"Topic",jsonPath:"Chemin JSON",multiplier:"Multiplicateur",onValue:"Valeur ON",mqttPowerHint:`Le chemin JSON extrait la valeur du payload JSON (ex: "power_l1"). Laisser vide si le topic publie des valeurs numériques brutes.
- Utiliser le multiplicateur 0.001 pour mW→W, 1000 pour kW→W.`,mqttEnergyHint:`Le chemin JSON extrait la valeur du payload JSON. Laisser vide pour les valeurs brutes.
- Utiliser le multiplicateur 0.001 pour Wh→kWh, 1000 pour MWh→kWh.`,mqttStateHint:`Le chemin JSON extrait la valeur du payload JSON. Laisser vide pour les valeurs brutes.
- Valeur ON : la chaîne exacte signifiant "ON". Laisser vide pour la détection auto (ON, true, 1).`,noSwitchesInSwitchbar:"Aucun commutateur dans la barre",enableSwitchbarHint:'Activez "Afficher dans la barre de commutateurs" dans Paramètres > Smart Plugs'},notifications:{providerTypes:{callmebot:"CallMeBot/WhatsApp",ntfy:"ntfy",pushover:"Pushover",telegram:"Telegram",email:"E-mail",discord:"Discord",webhook:"Webhook",homeassistant:"Home Assistant"},providerDescriptions:{email:"Notifications par e-mail SMTP",telegram:"Notifications via un bot Telegram",discord:"Envoyer vers un canal Discord via webhook",ntfy:"Notifications push gratuites, auto-hébergeables",pushover:"Notifications push simples et fiables",callmebot:"Notifications WhatsApp gratuites via CallMeBot",webhook:"POST HTTP générique vers n'importe quelle URL",homeassistant:"Notifications persistantes dans le tableau de bord Home Assistant"},lastSuccess:"Dernier : {{date}}",error:"Erreur",printer:"Imprimante :",allPrinters:"Toutes les imprimantes",sendTestNotification:"Envoyer une notification de test",eventSettings:"Paramètres des événements",enabled:"Activé",sendFromProvider:"Envoyer des notifications depuis ce fournisseur",printEvents:"Événements d'impression",printerStatus:"État de l'imprimante",amsAlarms:"Alarmes AMS",amsHtAlarms:"Alarmes AMS-HT",printQueue:"File d'attente d'impression",start:"Début",plateCheck:"Vérification du plateau",complete:"Terminé",failed:"Échoué",stopped:"Arrêté",progress:"Progression",offline:"Hors ligne",lowFilament:"Filament bas",maintenance:"Maintenance",amsHumidity:"Humidité AMS",amsTemp:"Temp. AMS",amsHtHumidity:"Humidité AMS-HT",amsHtTemp:"Temp. AMS-HT",bedCooled:"Plateau refroidi",quiet:"Silencieux",digest:"Résumé {{time}}",printStarted:"Impression démarrée",plateNotEmpty:"Plateau non vide",plateNotEmptyDescription:"Objets détectés avant l'impression",printCompleted:"Impression terminée",bedCooledLabel:"Plateau refroidi",bedCooledDescription:"Plateau refroidi sous le seuil après l'impression",printFailed:"Impression échouée",printStopped:"Impression arrêtée",progressMilestones:"Jalons de progression",progressMilestonesDescription:"Notifier à 25 %, 50 %, 75 %",printerOffline:"Imprimante hors ligne",printerError:"Erreur de l'imprimante",lowFilamentLabel:"Filament bas",maintenanceDue:"Maintenance requise",maintenanceDueDescription:"Notifier lorsqu'une maintenance est nécessaire",amsHumidityHigh:"Humidité AMS élevée",amsHumidityHighDescription:"L'humidité de l'AMS standard dépasse le seuil",amsTemperatureHigh:"Température AMS élevée",amsTemperatureHighDescription:"La température de l'AMS standard dépasse le seuil",amsHtHumidityHigh:"Humidité AMS-HT élevée",amsHtHumidityHighDescription:"L'humidité de l'AMS-HT dépasse le seuil",amsHtTemperatureHigh:"Température AMS-HT élevée",amsHtTemperatureHighDescription:"La température de l'AMS-HT dépasse le seuil",jobAdded:"Tâche ajoutée",jobAddedDescription:"Tâche ajoutée à la file d'attente",jobAssigned:"Tâche assignée",jobAssignedDescription:"Tâche basée sur le modèle assignée à l'imprimante",jobStarted:"Tâche démarrée",jobStartedDescription:"La tâche de la file a commencé l'impression",jobWaiting:"Tâche en attente",jobWaitingDescription:"Tâche en attente de filament",jobSkipped:"Tâche ignorée",jobSkippedDescription:"Tâche ignorée (échec précédent)",jobFailed:"Tâche échouée",jobFailedDescription:"La tâche n'a pas pu démarrer",queueComplete:"File d'attente terminée",queueCompleteDescription:"Toutes les tâches de la file sont terminées",quietHours:"Heures silencieuses",noNotificationsDuring:"Aucune notification pendant ces heures",editProviderToChangeQuietHours:"Modifier le fournisseur pour changer les heures silencieuses",dailyDigest:"Résumé quotidien",batchNotifications:"Regrouper les notifications en un seul résumé quotidien",sendAt:"Envoyer à {{time}}",editProviderToChangeDigestTime:"Modifier le fournisseur pour changer l'heure du résumé",edit:"Modifier",deleteProvider:"Supprimer le fournisseur de notifications",deleteConfirm:"Êtes-vous sûr de vouloir supprimer « {{name}} » ? Cette action est irréversible.",delete:"Supprimer",addTitle:"Ajouter un fournisseur de notifications",editTitle:"Modifier le fournisseur de notifications",nameLabel:"Nom *",namePlaceholder:"Mes notifications",providerTypeLabel:"Type de fournisseur *",configuration:"Configuration",testConfiguration:"Tester la configuration",printerFilter:"Filtre d'imprimante",onlyFromPrinter:"Envoyer uniquement les notifications pour les événements de cette imprimante",quietHoursDnd:"Heures silencieuses (Ne pas déranger)",quietStart:"Début",quietEnd:"Fin",dailyDigestLabel:"Résumé quotidien",sendDigestAt:"Envoyer le résumé à",digestCollected:"Les événements seront collectés et envoyés en un seul résumé à cette heure",notificationEvents:"Événements de notification",progressPercent:"(25 %, 50 %, 75 %)",bedCooledAfterPrint:"(après la fin de l'impression)",cancel:"Annuler",save:"Enregistrer",add:"Ajouter",nameRequired:"Le nom est requis",fieldRequired:"{{field}} est requis",phoneNumber:"Numéro de téléphone",apiKey:"Clé API",serverUrl:"URL du serveur",topic:"Sujet",authToken:"Jeton d'authentification",userKey:"Clé utilisateur",appToken:"Jeton d'application",priority:"Priorité",botToken:"Jeton du bot",chatId:"ID du chat",smtpServer:"Serveur SMTP",smtpPort:"Port SMTP",security:"Sécurité",authentication:"Authentification",username:"Nom d'utilisateur",password:"Mot de passe",fromEmail:"E-mail expéditeur",toEmail:"E-mail destinataire",webhookUrl:"URL du webhook",payloadFormat:"Format du payload",authorization:"Autorisation",titleFieldName:"Nom du champ titre",messageFieldName:"Nom du champ message",editTemplate:"Modifier le modèle : {{name}}",titleLabel:"Titre",bodyLabel:"Corps",titlePlaceholder:"Titre de la notification...",bodyPlaceholder:"Corps de la notification...",availableVariables:"Variables disponibles",clickToInsert:"Cliquer pour insérer à la position du curseur dans le corps",livePreview:"Aperçu en direct",hide:"Masquer",show:"Afficher",loadingPreview:"Chargement de l'aperçu...",enterTemplateContent:"Saisir le contenu du modèle pour voir l'aperçu",titlePreview:"Titre :",bodyPreview:"Corps :",resetToDefault:"Réinitialiser par défaut",titleRequired:"Le titre est requis",bodyRequired:"Le corps est requis",notificationLog:"Journal des notifications",showFailedOnly:"Échecs uniquement",last24Hours:"Dernières 24 heures",last7Days:"7 derniers jours",last30Days:"30 derniers jours",last90Days:"90 derniers jours",justNow:"À l'instant",noFailedNotifications:"Aucune notification échouée",noNotificationsLogged:"Aucune notification enregistrée",unknownProvider:"Fournisseur inconnu",logTitle:"Titre",logMessage:"Message",logError:"Erreur",logProvider:"Fournisseur : {{type}}",logTime:"Heure : {{time}}",refresh:"Actualiser",clearOld:"Purger les anciens",statsSummary:"{{days}} derniers jours :",statsNotifications:"notifications",statsSent:"{{count}} envoyées",statsFailed:"{{count}} échouées",eventTypes:{print_start:"Impression démarrée",print_complete:"Impression terminée",print_failed:"Impression échouée",print_stopped:"Impression arrêtée",print_progress:"Progression",printer_offline:"Imprimante hors ligne",printer_error:"Erreur de l'imprimante",filament_low:"Filament bas",maintenance_due:"Maintenance requise",test:"Test"}},richTextEditor:{bold:"Gras",italic:"Italique",underline:"Souligné",bulletList:"Liste à puces",numberedList:"Liste numérotée",alignLeft:"Aligner à gauche",alignCenter:"Centrer",alignRight:"Aligner à droite",addLink:"Ajouter lien",removeLink:"Retirer lien"},externalLinks:{noLinksConfigured:"Aucun lien externe configuré",deleteLink:"Supprimer lien",removeCustomIcon:"Retirer icône personnalisée",openInNewTab:"Ouvrir dans un nouvel onglet",placeholders:{linkName:"Mon Lien"}},keyboardShortcuts:{title:"Raccourcis Clavier",navigation:"Navigation",archivesSection:"Archives",kProfilesSection:"K-Profiles",generalSection:"Général",shortcuts:{goToPrinters:"Aller aux Imprimantes",goToArchives:"Aller aux Archives",goToQueue:"Aller à la File",goToStats:"Aller aux Stats",goToProfiles:"Aller aux Profils Cloud",goToSettings:"Aller aux Paramètres",focusSearch:"Focus recherche",openUploadModal:"Ouvrir téléversement",clearSelection:"Tout déselectionner",contextMenu:"Menu contextuel (cartes)",refreshProfiles:"Rafraîchir profils",newProfile:"Nouveau profil",exitSelectionMode:"Quitter mode sélection",showHelp:"Afficher cette aide"},footer:"Échap ou clic extérieur pour fermer"},notificationLog:{title:"Journal de Notification",events:{printStarted:"Début impression",printComplete:"Fin impression",printFailed:"Échec impression",printStopped:"Arrêt impression",progress:"Progression",printerOffline:"Hors ligne",printerError:"Erreur",lowFilament:"Filament bas",maintenanceDue:"Maintenance",test:"Test"},timeAgo:{justNow:"À l'instant",minutesAgo:"Il y a {{minutes}}m",hoursAgo:"Il y a {{hours}}h"}},restoreBackup:{title:"Restaurer Sauvegarde",restoring:"Restauration...",restoreComplete:"Restauration terminée",restoreFailed:"Échec restauration",importSettings:"Importer les réglages d'un fichier",pleaseWait:"Patientez pendant la restauration",clickToSelect:"Fichier .json ou .zip",howDuplicateHandling:"Gestion des doublons :",categories:{printers:"Imprimantes",smartPlugs:"Prises",notificationProviders:"Fournisseurs",filaments:"Filaments",archives:"Archives",pendingUploads:"Téléversements en attente",settingsTemplates:"Réglages & Modèles"},matchingInfo:{printers:"par numéro de série",smartPlugs:"par adresse IP",notificationProviders:"par nom",filaments:"par nom+type+marque",archives:"par empreinte numérique (hash)",pendingUploads:"par nom de fichier",settingsTemplates:"toujours écrasés"},replaceExisting:"Remplacer existant",keepExisting:"Garder existant",replaceDescription:"Écrase les doublons avec la sauvegarde",keepDescription:"Ne restaure que les éléments absents",caution:"Attention :",cautionText:"L'écrasement remplacera vos réglages. Les codes d'accès imprimantes sont exclus par sécurité.",itemsRestored:"Éléments restaurés",itemsSkipped:"Éléments ignorés",restored:"Restaurés",skipped:"Ignorés (déjà présents)",filesLabel:"Fichiers (3MF, vignettes, etc.)",newApiKeysGenerated:"Nouvelles clés API générées",newApiKeysWarning:"Copiées maintenant, elles ne seront plus visibles !",processingBackup:"Traitement du fichier...",noDataFound:"Aucune donnée trouvée dans le fichier.",failedToRestore:"Échec restaure. Vérifiez le format."},backupExport:{title:"Exporter Sauvegarde",selectData:"Données à inclure",selectAll:"Tout sélectionner",selectNone:"Ne rien sélectionner",categoryDescriptions:{settings:"Langue, thèmes, préférences",notifications:"ntfy, Pushover, Discord, etc.",templates:"Modèles de messages personnalisés",smartPlugs:"Configuration des prises Tasmota",externalLinks:"Liens externes de la barre latérale",printers:"Infos imprimantes (codes d'accès exclus par défaut)",plateDetection:"Images références des plateaux vides",filaments:"Types et coûts filaments",maintenance:"Plannings de maintenance personnalisés",archives:"Données impressions + fichiers (3MF, vignettes, etc.)",projects:"Projets, BOM, pièces jointes",pendingUploads:"En attente revue virtuelle",apiKeys:"Clés Webhook (nouvelles clés générées à l'import)"},requiresPrinters:"Nécessite sélection des imprimantes",zipFileWarning:"Fichier ZIP créé.",zipFileDescription:"Contient tous les médias. Peut être volumineux.",includeAccessCodes:"Inclure Codes d'accès",includeAccessCodesDescription:"Pour migrer vers une autre machine",includeAccessCodesWarning:"Codes en texte clair. Sécurisez ce fichier !",categoriesSelected:"{{selectedCount}} catégories choisies"},pendingUploads:{placeholders:{notes:"Notes sur l'impression..."},discardUpload:"Rejeter",archiveAllUploads:"Tout archiver",discardAllUploads:"Tout rejeter",archive:"Archiver",timeAgo:{justNow:"À l'instant",minutesAgo:"Il y a {{minutes}}m",hoursAgo:"Il y a {{hours}}h",daysAgo:"Il y a {{days}}j"}},apiBrowser:{placeholders:{requestBody:"Corps JSON...",searchEndpoints:"Chercher endpoints..."}},configureAmsSlot:{title:"Configurer le slot AMS",slotConfigured:"Slot configuré !",configuringSlot:"Configuration du slot :",slotLabel:"{{ams}} Slot {{slot}}",searchPresets:"Chercher presets...",colorPlaceholder:"Nom couleur ou hex (ex: brown, FF8800)",clearCustomColor:"Effacer couleur perso",noCloudPresets:"Profils Cloud absents. Connectez-vous.",noPresetsAvailable:"Aucun preset disponible. Connectez-vous à Bambu Cloud ou importez des profils locaux.",noMatchingPresets:"Aucun profil trouvé.",custom:"Perso",builtin:"Inclus",settingsSentToPrinter:"Réglages envoyés",filamentProfile:"Profil Filament",kProfileLabel:"Profil K (Pressure Advance)",filteringFor:"Filtrage pour : {{material}}",noKProfile:"Pas de profil K (utiliser défaut 0.020)",noMatchingKProfiles:"Aucun profil K trouvé. K=0.020 par défaut sera utilisé.",selectFilamentFirst:"Sélectionnez d'abord un profil filament",kFromCalibration:"K={{value}} de la calibration imprimante",customColorLabel:"Couleur personnalisée (optionnel)",presetColors:"Couleurs {{name}} :",showLessColors:"Moins de couleurs",showMoreColors:"Plus de couleurs",clear:"Effacer",hexLabel:"Hex : #{{hex}}",resetting:"Réinitialisation...",resetSlot:"Réinitialiser le slot",cancel:"Annuler",configuring:"Configuration...",configureSlot:"Configurer le slot"},githubBackup:{title:"Sauvegarde GitHub",history:"Historique",downloadBackup:"Télécharger",restoreBackup:"Restaurer",noBackupsYet:"Aucune sauvegarde"},emailSettings:{placeholders:{fromName:"BamBuddy"}},tagManagement:{searchTags:"Chercher tags...",renameTag:"Renommer tag",deleteTag:"Supprimer tag"},notificationTemplates:{placeholders:{title:"Titre notification...",body:"Message notification..."}},batchTag:{placeholders:{newTag:"Nouveau tag..."}},photoGallery:{deletePhoto:"Supprimer photo"},filamentHoverCard:{copySpoolUuid:"Copier UUID bobine"},kProfilesView:{hasNote:"A une note",copyProfile:"Copier profil"},layout:{openMenu:"Ouvrir menu",noPermissionSystemInfo:"Pas d'autorisation système"},dashboard:{dragToReorder:"Glisser pour réorganiser",hideWidget:"Masquer widget"},notificationProviderCard:{deleteNotificationProvider:"Supprimer fournisseur"},fileManagerModal:{closeFileManager:"Fermer gestionnaire",sortFiles:"Trier fichiers",goToParentFolder:"Dossier parent",threeView:"Vue 3D"},embeddedCameraViewer:{refreshStream:"Actualiser flux",close:"Fermer",zoomOut:"Zoom -",resetZoom:"Reset zoom",zoomIn:"Zoom +",dragToResize:"Glisser pour dimension"},timelapseViewer:{skipBack5s:"-5s",skipForward5s:"+5s"},notificationProviders:{descriptions:{email:"Notifications par email SMTP",telegram:"Via bot Telegram",discord:"Via webhook Discord",ntfy:"Push auto-hébergé (ntfy)",pushover:"Push fiable (Pushover)",callmebot:"WhatsApp gratuit via CallMeBot",webhook:"Requête HTTP POST personnalisée"}},logViewer:{searchPlaceholder:"Message ou nom...",noLogEntries:"Aucune entrée journal"},switchbarPopover:{noSwitchesInSwitchbar:"Aucun interrupteur"},projectPageModal:{placeholders:{title:"Titre",designer:"Designer",license:"Licence",description:"Description...",profileTitle:"Titre du profil",profileDescription:"Description du profil..."}},spoolmanSettings:{},time:{unknown:"-",waiting:"En attente",justNow:"À l'instant",now:"Maintenant",minsAgo:"il y a {{count}}m",inMins:"dans {{count}}m",hoursAgo:"il y a {{count}}h",inHours:"dans {{count}}h",daysAgo:"il y a {{count}}j",inDays:"dans {{count}}j"},spoolbuddy:{nav:{dashboard:"Tableau de bord",ams:"AMS",inventory:"Inventaire",writeTag:"Écrire",settings:"Paramètres"},status:{nfcReady:"NFC prêt",nfcOff:"NFC désactivé",offline:"Hors ligne",online:"En ligne",noPrinters:"Aucune imprimante",deviceOffline:"Appareil hors ligne",waitingConnection:"En attente de connexion...",systemReady:"Système prêt",status:"Statut"},dashboard:{readyToScan:"Prêt à scanner",idleMessage:"Placez une bobine sur la balance pour l'identifier",nfcHint:"Le tag NFC sera lu automatiquement",device:"Appareil",syncWeight:"Sync. poids",weightSynced:"Synchronisé !",unknownTag:"Tag inconnu",newTag:"Nouveau tag détecté",onScale:"sur la balance",linkSpool:"Lier à une bobine",linkTagTitle:"Lier le tag à une bobine",linkTag:"Lier le tag",selectSpool:"Sélectionnez une bobine à lier à ce tag :",noUntagged:"Aucune bobine sans tag trouvée",tagDetected:"Tag détecté",noTag:"Pas de tag",tagId:"Tag",grossWeight:"Poids brut",spoolSize:"Taille bobine",close:"Fermer",currentSpool:"Bobine actuelle"},modal:{spoolDetected:"Bobine détectée",assignToAms:"Assigner à l'AMS",syncWeight:"Synchroniser le poids",weightSynced:"Synchronisé !",syncing:"Synchronisation...",newTagDetected:"Nouveau tag détecté",addToInventory:"Ajouter à l'inventaire",assignToAmsTitle:"Assigner à l'AMS",selectSlot:"Sélectionner un emplacement",assign:"Assigner",assigning:"Attribution...",assignSuccess:"Assigné !",assignError:"Échec de l'attribution de la bobine. Veuillez réessayer.",noPrinterSelected:"Sélectionner une imprimante...",noAmsDetected:"Aucun AMS détecté sur cette imprimante",slot:"Emplacement"},weight:{noReading:"Pas de lecture",stable:"Stable",measuring:"Mesure...",tare:"Tarer",calibrate:"Calibrer"},spool:{remaining:"Restant",material:"Matériau",brand:"Marque",color:"Couleur",coreWeight:"Noyau",labelWeight:"Étiquette",scaleWeight:"Balance",netWeight:"Net",lastUsed:"Dernière utilisation"},ams:{noData:"Aucun AMS détecté",connectAms:"Connectez un AMS pour voir les slots",noPrinter:"Aucune imprimante sélectionnée",selectPrinter:"Sélectionnez une imprimante dans la barre supérieure",printerDisconnected:"Imprimante déconnectée",humidity:"Humidité",level:"Niveau",active:"Actif",slot:"Slot",empty:"Vide"},inventory:{search:"Rechercher des bobines...",empty:"Aucune bobine dans l'inventaire",noResults:"Aucune bobine correspondante",spools:"bobines",addSpool:"Ajouter une bobine"},settings:{tabDevice:"Appareil",tabDisplay:"Affichage",tabScale:"Balance",tabUpdates:"Mises à jour",nfcReader:"Lecteur NFC",type:"Type",connection:"Connexion",notConnected:"N/A",deviceInfo:"Info appareil",hostname:"Hôte",uptime:"Temps de fonctionnement",brightness:"Luminosité",saved:"Enregistré",noBacklight:"Aucun rétroéclairage DSI détecté. Le contrôle de luminosité nécessite un écran DSI.",screenBlank:"Délai d'extinction",screenBlankDesc:"L'écran s'éteint après inactivité. Touchez pour réveiller.",displayNote:"La luminosité est appliquée comme filtre logiciel.",scaleCalibration:"Calibration de la balance",currentWeight:"Poids actuel",tareOffset:"Tare",calFactor:"Facteur",knownWeight:"Poids connu",calStep1:"Retirez tout de la balance et appuyez sur Mettre à zéro.",calStep2:"Placez le poids connu sur la balance.",setZero:"Mettre à zéro",calibrateNow:"Calibrer",calibrated:"Calibré",tareSet:"Commande de tare envoyée. En attente de l'appareil...",tareFailed:"Échec de l'envoi de la commande de tare",zeroSet:"Point zéro défini. Placez le poids connu sur la balance.",calibrationDone:"Calibration terminée !",calibrationFailed:"Échec de la calibration",lastCalibrated:"Dernière calibration",stable:"Stable",settling:"Stabilisation...",firmware:"Firmware",scale:"Balance",noDevice:"Aucun appareil SpoolBuddy trouvé",daemonVersion:"Version du daemon",currentVersion:"Actuelle",versionPending:"En attente du daemon...",checking:"Vérification...",checkUpdates:"Vérifier les mises à jour",updateAvailable:"Mise à jour disponible",updateInstructions:"Mise à jour via SSH : exécutez le script d'installation SpoolBuddy.",upToDate:"À jour",includeBeta:"Inclure les versions bêta"},writeTag:{tabExisting:"Bobine existante",tabNew:"Nouvelle bobine",tabReplace:"Remplacer le tag",searchPlaceholder:"Rechercher par matériau, couleur, marque...",noUntaggedSpools:"Aucune bobine sans tag",noTaggedSpools:"Aucune bobine avec tag",selectSpool:"Sélectionnez une bobine, puis placez un NTAG sur le lecteur",placeTag:"Placez un NTAG sur le lecteur",tagReady:"Tag détecté — prêt à écrire",writeTag:"Écrire le tag",replaceTag:"Remplacer le tag",writing:"Écriture du tag...",waiting:"En attente de SpoolBuddy...",writeSuccess:"Tag écrit avec succès !",writeFailed:"Échec de l'écriture",queueFailed:"Impossible de mettre en file la commande d'écriture",tryAgain:"Réessayer",cancel:"Annuler",replaceWarning:"L'ancien tag sera dissocié. Le nouveau tag le remplacera.",deviceOffline:"SpoolBuddy est hors ligne",material:"Matériau",colorName:"Nom de la couleur",color:"Couleur",brand:"Marque",weight:"Poids (g)",createSpool:"Créer la bobine",creating:"Création...",spoolCreated:"Bobine créée ! Prêt à écrire.",createFailed:"Impossible de créer la bobine"}},bugReport:{title:"Signaler un bug",description:"Description",descriptionPlaceholder:"Qu'est-ce qui n'a pas fonctionné ? Veuillez décrire le problème...",email:"E-mail (optionnel)",emailPlaceholder:"votre@email.fr",emailPrivacy:"Si fourni, votre e-mail sera inclus dans une section repliée de l'issue GitHub pour que le mainteneur puisse vous contacter.",screenshot:"Capture d'écran",uploadOrPaste:"Télécharger, coller ou glisser une image",dataCollectedSummary:"Quelles données sont incluses dans le rapport ?",dataIncluded:"Inclus :",dataIncludedList:"Version de l'app, OS, architecture, version Python, statistiques de base de données (compteurs uniquement), modèles d'imprimantes, nombre de buses, versions firmware, état de connexion, état des intégrations (Spoolman, MQTT, HA), paramètres non sensibles, nombre d'interfaces réseau, détails Docker, versions des dépendances.",dataNeverIncluded:"Jamais inclus :",dataNeverIncludedList:"Noms d'imprimantes, numéros de série, codes d'accès, mots de passe, adresses IP, adresses e-mail, clés API, tokens, URLs de webhook, noms d'hôtes ou noms d'utilisateurs.",submit:"Envoyer",collectingLogs:"Collecte des journaux de diagnostic...",collectingLogsHint:"Journalisation de débogage activée, interrogation des imprimantes pour des données fraîches.",submitting:"Envoi du rapport de bug...",submitSuccess:"Rapport de bug envoyé avec succès !",submitFailed:"Échec de l'envoi du rapport de bug",thankYou:"Merci !",submitted:"Votre rapport de bug a été soumis.",viewIssue:"Voir l'issue",unexpectedError:"Une erreur inattendue est survenue",countdownSeconds:"{{seconds}}s"}},Jce={nav:{printers:"プリンター",archives:"アーカイブ",queue:"キュー",stats:"統計",profiles:"プロファイル",maintenance:"メンテナンス",projects:"プロジェクト",inventory:"フィラメント",files:"ファイル管理",settings:"設定",system:"システム",collapseSidebar:"サイドバーを閉じる",expandSidebar:"サイドバーを開く",update:"アップデート",updateAvailable:"アップデートあり: v{{version}}",updateAvailableBanner:"バージョン {{version}} が利用可能です!",viewUpdate:"アップデートを表示",viewOnGithub:"GitHubで表示",keyboardShortcuts:"キーボードショートカット (?)",switchToLight:"ライトモードに切替",switchToDark:"ダークモードに切替",smartSwitches:"スマートスイッチ",logout:"ログアウト"},common:{save:"保存",saving:"保存中...",cancel:"キャンセル",delete:"削除",edit:"編集",add:"追加",close:"閉じる",confirm:"確認",loading:"読み込み中...",error:"エラー",success:"成功",warning:"警告",enabled:"有効",disabled:"無効",yes:"はい",no:"いいえ",on:"オン",off:"オフ",all:"すべて",none:"なし",search:"検索",filter:"フィルター",sort:"並べ替え",refresh:"更新",download:"ダウンロード",upload:"アップロード",uploading:"アップロード中...",uploadFailed:"アップロード失敗",actions:"操作",status:"ステータス",name:"名前",description:"説明",date:"日付",time:"時間",hours:"時間",minutes:"分",seconds:"秒",days:"日",enable:"有効化",disable:"無効にする",permissions:"権限",noPrinters:"プリンターが登録されていません",noData:"データがありません",linkNotFound:"リンクが見つかりません",required:"必須",optional:"オプション",dismiss:"閉じる",apply:"適用",reset:"リセット",export:"エクスポート",import:"インポート",clear:"クリア",selectAll:"すべて選択",deselectAll:"すべて選択解除",noChange:"— 変更なし —",unchanged:"変更なし",unassigned:"未割当",unknown:"不明",unknownError:"不明なエラー",today:"今日",tomorrow:"明日",asap:"即時",overdue:"期限超過",now:"今すぐ",collapse:"折りたたむ",expand:"展開",viewArchive:"アーカイブを表示",viewInFileManager:"ファイルマネージャーで表示",addedBy:"{{username}}が追加",prints:"プリント",more:"もっと見る",ascending:"昇順",descending:"降順",printer:"プリンター",remove:"削除",type:"種類",print:"印刷",rename:"名前変更",move:"移動",create:"作成",duplicate:"複製",left:"左",right:"右"},printers:{title:"プリンター",addPrinter:"プリンターを追加",editPrinter:"プリンターを編集",deletePrinter:"プリンターを削除",printerName:"プリンター名",serialNumber:"シリアル番号",ipAddress:"IPアドレス / ホスト名",accessCode:"アクセスコード",model:"モデル",nozzleCount:"ノズル数",autoArchive:"自動アーカイブ",status:{available:"利用可能",idle:"待機中",printing:"印刷中",paused:"一時停止",offline:"オフライン",error:"エラー",finished:"完了",unknown:"不明"},temperatures:{nozzle:"ノズル",bed:"ベッド",chamber:"チャンバー"},progress:"{{percent}}% 完了",timeRemaining:"残り {{time}}",deleteConfirm:"「{{name}}」を削除しますか?",maintenanceOk:"メンテナンス正常",maintenanceWarning:"{{count}}件の警告",maintenanceWarning_plural:"{{count}}件の警告",maintenanceDue:"{{count}}件のメンテナンス期限",maintenanceDue_plural:"{{count}}件の期限",sort:{name:"名前",status:"ステータス",model:"モデル",location:"ロケーション",ascending:"昇順で並べ替え",descending:"降順で並べ替え"},cardSize:{small:"小",medium:"中",large:"大",extraLarge:"特大"},hideOffline:"オフラインを非表示",nextAvailable:"次に完了",powerOn:"電源オン",offlinePrintersWithPlugs:"スマートプラグ付きオフラインプリンター",noPrintersConfigured:"プリンターが設定されていません",readyToPrint:"印刷可能",external:"外部",extL:"Ext-L",extR:"Ext-R",deleteArchives:"印刷アーカイブを削除",noLabel:"ラベルなし",printPreview:"印刷プレビュー",width:"幅",height:"高さ",noObjectsFound:"オブジェクトが見つかりません",objectsLoadedOnPrintStart:"オブジェクトは印刷開始時に読み込まれます",willBeSkipped:"スキップされます",name:"名前",serialCannotBeChanged:"シリアル番号は変更できません",locationHelp:"プリンターのグループ化とキュージョブのフィルタリングに使用",wifiSignal:{veryWeak:"非常に弱い",weak:"弱い",fair:"注意",good:"良好",excellent:"非常に良い"},maintenanceUpToDate:"すべてのメンテナンスが最新です",chamberLightOn:"チャンバーライトをオンにしました",chamberLightOff:"チャンバーライトをオフにしました",files:"ファイル",browseFiles:"プリンターのファイルを参照",autoOffAfterPrint:"印刷後に自動電源オフ",autoOffExecuted:"自動オフが実行されました - リセットするにはプリンターの電源を入れてください",hmsErrors:"クリックしてHMSエラーを表示",viewHmsErrors:"{{count}}件のHMSエラーを表示",resume:"再開",pause:"一時停止",stop:"停止",camera:"カメラ",skipObject:"オブジェクトスキップ",reconnect:"再接続",mqttDebug:"MQTTデバッグ",printerInformation:"プリンター情報",copyToClipboard:"コピー",copied:"コピーしました!",state:"状態",wifiSignalLabel:"WiFi信号",developerMode:"開発者モード",enabled:"有効",disabled:"無効",addedOn:"追加日",sdCard:"SDカード",inserted:"挿入済み",notInserted:"未挿入",totalPrintHours:"印刷時間",activeNozzle:"アクティブ: {{side}}ノズル",nozzleRack:"ノズルラック",nozzleDocked:"ドッキング中",nozzleMounted:"マウント中",nozzleActive:"アクティブ",nozzleIdle:"アイドル",nozzleDiameter:"直径",nozzleType:"タイプ",nozzleStatus:"ステータス",nozzleFilament:"フィラメント",nozzleWear:"摩耗",nozzleMaxTemp:"最高温度",nozzleSerial:"シリアル",nozzleHardenedSteel:"焼入れ鋼",nozzleStainlessSteel:"ステンレス鋼",nozzleTungstenCarbide:"タングステンカーバイド",nozzleFlow:"フロー",nozzleHighFlow:"ハイフロー",nozzleStandardFlow:"スタンダード",firmwareUpdate:"ファームウェアアップデート",firmwareInstructions:"プリンターのタッチスクリーンで",firmwareNav:"に移動",settings:"設定",firmware:"ファームウェア",discoverPrinters:"プリンターを検出",searching:"検索中...",manualEntry:"手動入力",addFromCloud:"クラウドから追加",toast:{printerDeleted:"プリンターを削除しました",printerAdded:"プリンターを追加しました",printerUpdated:"プリンターを更新しました",failedToDelete:"プリンターの削除に失敗しました",failedToAdd:"プリンターの追加に失敗しました",failedToUpdate:"プリンターの更新に失敗しました",commandSent:"コマンドを送信しました",failedToSendCommand:"コマンドの送信に失敗しました",turnedOn:"{{name}} の電源をオンにしました",failedToPowerOn:"{{name}} の電源オンに失敗しました",scriptTriggered:"スクリプトを実行しました",printStopped:"印刷を停止しました",printPaused:"印刷を一時停止しました",printResumed:"印刷を再開しました",referenceDeleted:"リファレンスを削除しました",detectionAreaSaved:"検出エリアを保存しました",failedToRunScript:"スクリプトの実行に失敗しました",failedToStopPrint:"印刷の停止に失敗しました",failedToPausePrint:"印刷の一時停止に失敗しました",failedToResumePrint:"印刷の再開に失敗しました",failedToControlChamberLight:"チャンバーライトの制御に失敗しました",failedToUpdateSetting:"設定の更新に失敗しました",failedToSkipObjects:"オブジェクトのスキップに失敗しました",failedToRereadRfid:"RFIDの再読み取りに失敗しました",failedToCheckPlate:"プレートの確認に失敗しました",failedToUpdateLabel:"ラベルの更新に失敗しました",failedToDeleteReference:"リファレンスの削除に失敗しました",failedToSaveDetectionArea:"検出エリアの保存に失敗しました",plateCheckEnabled:"プレートチェックを有効にしました",plateCheckDisabled:"プレートチェックを無効にしました",calibrationSaved:"キャリブレーションを保存しました!",calibrationFailed:"キャリブレーションに失敗しました",rfidRereadInitiated:"RFID再読み取りを開始しました"},connection:{connected:"接続中",offline:"オフライン"},queue:{inQueue:"キュー内",inQueue_plural:"{{count}}件がキュー内"},controls:"コントロール",rfid:{reread:"RFID再読み取り"},permission:{noAdd:"プリンターを追加する権限がありません",noEdit:"プリンターを編集する権限がありません",noDelete:"プリンターを削除する権限がありません",noControl:"プリンターを制御する権限がありません",noFiles:"このディレクトリにファイルがありません",noAmsRfid:"AMS RFIDを再読み取りする権限がありません",noSmartPlugControl:"スマートプラグを制御する権限がありません",noCamera:"カメラを表示する権限がありません"},modal:{addTitle:"プリンターを追加",editTitle:"プリンターを編集",myPrinter:"マイプリンター",selectModel:"モデルを選択...",locationGroup:"ロケーション / グループ",locationPlaceholder:"例: 工房、オフィス、地下室",autoArchiveLabel:"完了した印刷を自動アーカイブ",fromPrinterSettings:"プリンターの設定から取得",modelOptional:"モデル(任意)",saveChanges:"変更を保存"},skipObjects:{tooltip:"オブジェクトスキップ",onlyWhilePrinting:"オブジェクトスキップ(印刷中のみ)",requiresMultiple:"オブジェクトスキップ(2個以上必要)",title:"オブジェクトスキップ",matchIdsInfo:"プリンター画面のIDと照合してください",printerShowsIds:"プリンター画面にビルドプレート上のオブジェクトIDが表示されます",skipSelected:"選択をスキップ",skipping:"スキップ中...",noObjectsSelected:"オブジェクトが選択されていません",selectObjectsToSkip:"現在の印刷からスキップするオブジェクトを選択してください",skipped:"スキップ済み",objectsSkipped:"オブジェクトをスキップしました",activeCount:"{{count}}個アクティブ",waitForLayer:"オブジェクトをスキップするにはレイヤー2以降をお待ちください(現在レイヤー{{layer}})",skip:"スキップ",confirmTitle:"オブジェクトをスキップしますか?",confirmMessage:"「{{name}}」をスキップしますか?この操作は元に戻せません。"},confirm:{deleteTitle:"プリンターを削除",deleteMessage:"「{{name}}」を削除しますか?すべての接続設定が削除されます。",deleteArchivesNote:"このプリンターのすべての印刷履歴が完全に削除されます。",keepArchivesNote:"印刷履歴は保持されますが、このプリンターとの関連は解除されます。",stopTitle:"印刷を停止",stopMessage:"「{{name}}」の現在の印刷を停止しますか?印刷ジョブがキャンセルされます。",stopButton:"印刷を停止",pauseTitle:"印刷を一時停止",pauseMessage:"「{{name}}」の現在の印刷を一時停止しますか?",pauseButton:"印刷を一時停止",resumeTitle:"印刷を再開",resumeMessage:"「{{name}}」の印刷を再開しますか?",resumeButton:"印刷を再開",powerOnTitle:"プリンターの電源をオン",powerOnMessage:"「{{name}}」の電源をオンにしますか?",powerOnButton:"電源オン",powerOffTitle:"プリンターの電源をオフ",powerOffMessage:"「{{name}}」の電源をオフにしますか?",powerOffWarning:"警告: 「{{name}}」は現在印刷中です!電源をオフにしますか?印刷が中断され、プリンターが損傷する可能性があります。",powerOffButton:"電源オフ"},discovery:{title:"プリンター",searching:"検索中...",scanning:"スキャン中...",scanProgress:"スキャン中... {{scanned}}/{{total}}",foundPrinters:"{{count}}台のプリンターを検出",noPrintersFound:"プリンターが見つかりません",noPrintersFoundSubnet:"指定されたサブネットにプリンターが見つかりません。",noPrintersFoundNetwork:"ネットワーク上にプリンターが見つかりません。",allConfigured:"検出されたすべてのプリンターは既に設定済みです。",alreadyAdded:"追加済み",select:"選択",manualEntry:"手動入力",addFromCloud:"クラウドから追加",subnetToScan:"スキャンするサブネット",dockerNote:"Dockerを検出しました。プリンターのサブネットをCIDR表記で入力してください。docker-compose.ymlでnetwork_mode: hostが必要です。",scanSubnet:"サブネットをスキャンしてプリンターを検出",discoverNetwork:"ネットワーク上のプリンターを検出",scanningSubnet:"サブネットでBambuプリンターをスキャン中...",scanningNetwork:"ネットワークをスキャン中...",serialRequired:"シリアル番号が必要です",unknown:"不明",failedToStart:"印刷の開始に失敗しました"},filaments:"フィラメント",openCameraOverlay:"カメラオーバーレイを開く",openCameraWindow:"カメラを新しいウィンドウで開く",firmwareUpdateAvailable:"ファームウェアアップデートあり: {{current}} → {{latest}}",firmwareUpToDate:"ファームウェア {{version}} — 最新",firmwareUpdateButton:"アップデート",plateDetection:{noPermission:"このページにアクセスする権限がありません。",enabledClick:"プレートチェック有効 - クリックして無効化",disabledClick:"プレートチェック無効 - クリックして有効化",manageCalibration:"プレート検出キャリブレーションを管理",calibrationRequired:"キャリブレーションが必要です",calibrationInstructions:"ビルドプレートが<strong>完全に空</strong>であることを確認してから、キャリブレーションをクリックしてください。",calibrationDescription:"キャリブレーションは空のプレートのリファレンス画像を撮影します。以降のチェックではこのリファレンスと比較してオブジェクトを検出します。",calibrationTip:"<strong>ヒント:</strong> 異なるプレート用に最大5つのキャリブレーションを保存できます。チェック時に最適なものが自動的に使用されます。",plateEmpty:"プレートは空のようです",objectsDetected:"オブジェクトを検出しました",confidence:"信頼度",difference:"差分",analysisPreview:"分析プレビュー:",analysisLegend:"緑の枠 = 検出エリア、赤のオーバーレイ = キャリブレーションとの差分",savedReferences:"保存済みリファレンス ({{count}}/{{max}})",deleteReference:"リファレンスを削除",labelPlaceholder:"ラベル...",clickToEdit:"{{label}} - クリックして編集",clickToAddLabel:"クリックしてラベルを追加"},fans:{partCooling:"パーツ冷却ファン",auxiliary:"補助ファン",chamber:"チャンバーファン"},clickToViewHmsErrors:"クリックしてHMSエラーを表示",estimatedCompletion:"完了予定時刻",slotOptions:"スロットオプション",amsPopup:{friendlyName:"AMS名",friendlyNamePlaceholder:"例: AMS フレンドリー名",serialNumber:"シリアル番号",firmwareVersion:"ファームウェア",save:"保存",clear:"クリア",noEditPermission:"AMS ユニットの名前を変更する権限がありません"},firmwareModal:{title:"ファームウェアアップデート",titleUpToDate:"ファームウェア情報",currentVersion:"現在のバージョン",latestVersion:"最新バージョン",releaseNotes:"リリースノート",checkingPrereqs:"前提条件を確認中...",sdCardReady:"SDカード準備完了。下をクリックしてファームウェアをアップロードしてください。",uploadedSuccess:"ファームウェアをSDカードにアップロードしました!",applyInstructions:"プリンターでアップデートを適用するには:",step1:"プリンターのタッチスクリーンで設定に移動",step2:"ファームウェアに移動",step3:"SDカードからアップデートを選択",step4:"アップデートには10〜20分かかります",done:"完了",starting:"開始中...",uploadFirmware:"ファームウェアをアップロード",uploadFailed:"アップロード開始に失敗しました: {{error}}",uploadedToast:"ファームウェアをアップロードしました!プリンター画面からアップデートを実行してください。"},accessCodePlaceholder:"プリンター設定から取得",roi:{title:"プリンター",xStart:"X開始",yStart:"Y開始",width:"幅",height:"高さ",instruction:"ビルドプレートに焦点を合わせるように検出エリアを調整してください。プレビューの緑の枠が現在のエリアを示しています。"},developerModeWarning:"開発者LANモードが有効になっていません: {{names}}。一部の機能が動作しない可能性があります。",howToEnable:"有効化方法",incompatibleFile:"このファイルは{{slicedFor}}用にスライスされていますが、このプリンターは{{printerModel}}です",dropNotPrintable:".gcodeおよび.gcode.3mfファイルのみ印刷できます",dropToPrint:"ドロップして印刷",cannotPrint:"プリンター使用中"},archives:{title:"印刷アーカイブ",searchPlaceholder:"アーカイブを検索...",filterByPrinter:"プリンターで絞り込み",filterByStatus:"ステータスで絞り込み",sortBy:"並べ替え",sortNewest:"新しい順",sortOldest:"古い順",sortName:"名前順",sortDuration:"時間順",sortLargest:"大きい順",sortSmallest:"小さい順",sortSize:"サイズ",noArchives:"アーカイブが見つかりません",noArchivesSearch:"検索条件に一致するアーカイブがありません",noArchivesYet:"アーカイブはまだありません",loadingArchives:"アーカイブを読み込み中...",releaseToUpload:"ドロップしてアップロード",showAll:"すべて表示",showFavoritesOnly:"お気に入りのみ表示",gridView:"グリッド表示",listView:"リスト表示",calendarView:"カレンダー表示",logView:"印刷ログ",manageTags:"タグを管理",showFailedPrints:"失敗した印刷を表示",hideFailedPrints:"失敗した印刷を非表示",printTime:"印刷時間",filamentUsed:"フィラメント使用量",cost:"コスト",reprint:"再印刷",preview:"プレビュー",deleteArchive:"アーカイブを削除",deleteConfirm:"このアーカイブを削除しますか?",favorite:"お気に入り",unfavorite:"お気に入りから削除",viewDetails:"詳細を表示",status:{completed:"完了",failed:"失敗",stopped:"中止"},toast:{source3mfAttached:"ソース3MFを添付しました: {{filename}}",failedUploadSource3mf:"ソース3MFのアップロードに失敗しました",source3mfRemoved:"ソース3MFを削除しました",failedRemoveSource3mf:"ソース3MFの削除に失敗しました",f3dAttached:"F3Dを添付しました: {{filename}}",failedUploadF3d:"F3Dのアップロードに失敗しました",f3dRemoved:"F3Dを削除しました",failedRemoveF3d:"F3Dの削除に失敗しました",timelapseAttached:"タイムラプスを添付しました: {{filename}}",timelapseAlreadyAttached:"タイムラプスは既に添付されています",noMatchingTimelapse:"一致するタイムラプスが見つかりません",failedScanTimelapse:"タイムラプスのスキャンに失敗しました",failedAttachTimelapse:"タイムラプスの添付に失敗しました",timelapseRemoved:"タイムラプスを削除しました",failedRemoveTimelapse:"タイムラプスの削除に失敗しました",timelapseUploaded:"タイムラプスをアップロードしました: {{filename}}",failedUploadTimelapse:"タイムラプスのアップロードに失敗しました",archiveDeleted:"アーカイブを削除しました",failedDeleteArchive:"アーカイブの削除に失敗しました",addedToFavorites:"お気に入りに追加しました",removedFromFavorites:"お気に入りから削除しました",projectUpdated:"プロジェクトを更新しました",failedUpdateProject:"プロジェクトの更新に失敗しました",linkCopied:"リンクをクリップボードにコピーしました",failedCopyLink:"リンクのコピーに失敗しました",photoDeleted:"写真を削除しました",failedDeletePhoto:"写真の削除に失敗しました",failedDeleteArchives:"アーカイブの削除に失敗しました",failedUpdateFavorites:"お気に入りの更新に失敗しました",exportDownloaded:"エクスポートをダウンロードしました",exportFailed:"エクスポートに失敗しました"},menu:{print:"印刷",schedule:"スケジュール",openInBambuStudio:"スライサーで開く",slice:"スライス",externalLink:"外部リンク",viewOnMakerWorld:"MakerWorldで表示",preview3d:"3Dプレビュー",viewTimelapse:"タイムラプスを表示",scanForTimelapse:"タイムラプスをスキャン",uploadTimelapse:"タイムラプスをアップロード",removeTimelapse:"タイムラプスを削除",downloadSource3mf:"ソース3MFをダウンロード",uploadSource3mf:"ソース3MFをアップロード",replaceSource3mf:"ソース3MFを置換",removeSource3mf:"ソース3MFを削除",uploadF3d:"F3Dをアップロード",replaceF3d:"F3Dを置換",downloadF3d:"Fusion 360デザインファイルをダウンロード",removeF3d:"F3Dを削除",download:"ダウンロード",copyDownloadLink:"ダウンロードリンクをコピー",qrCode:"QRコード",viewPhotos:"{{count}}枚の写真を表示",viewPhotosCount:"写真を表示 ({{count}})",projectPage:"プロジェクトページ",addToFavorites:"お気に入りに追加",removeFromFavorites:"お気に入りから削除",edit:"編集",goToProject:"プロジェクトへ: {{name}}",addToProject:"プロジェクトに追加",removeFromProject:"プロジェクトから削除",loading:"アーカイブを読み込み中...",noProjectsAvailable:"利用可能なプロジェクトがありません",select:"選択",deselect:"選択解除",delete:"削除"},permission:{noReprint:"このアーカイブを再印刷する権限がありません",noAddToQueue:"キューに追加する権限がありません",noUpdateArchives:"アーカイブを更新する権限がありません",noUploadFiles:"ファイルをアップロードする権限がありません",noDownload:"アーカイブをダウンロードする権限がありません",noCopyLink:"ダウンロードリンクをコピーする権限がありません",noDelete:"このアーカイブを削除する権限がありません",noCreate:"アーカイブを作成する権限がありません"},card:{previousPlate:"前のプレート",nextPlate:"次のプレート",plateNumber:"プレート {{number}}",moreOptions:"その他のオプション",addToFavorites:"お気に入りに追加",removeFromFavorites:"お気に入りから削除",cancelled:"キャンセル",failed:"失敗",duplicate:"重複",duplicateTitle:"このモデルは以前印刷されています",openSource3mf:"ソース3MFをBambu Studioで開く(右クリックでオプション表示)",downloadF3d:"Fusion 360デザインファイルをダウンロード",viewTimelapse:"タイムラプスを表示",viewPhoto:"写真を表示",viewPhotos:"{{count}}枚の写真を表示",openFolder:"フォルダーを開く: {{name}}",slicedFile:"スライス済みファイル - 印刷可能",sourceFile:"ソースファイルのみ - AMSマッピング不可",gcode:"GCODE",source:"ソース",project:"プロジェクト",estimated:"推定: {{time}}",actual:"実際: {{time}}",accuracy:"精度: {{percent}}%",filament:"{{weight}}g",layer:"レイヤー",layers:"レイヤー",object:"{{count}}オブジェクト",objects:"{{count}}オブジェクト",slicedFor:"{{model}}用にスライス",uploadedBy:"アップロード者",noPermissionReprint:"再印刷する権限がありません",noFileForReprint:"3MFファイルがありません — 印刷記録時にプリンターからファイルをダウンロードできませんでした",noPermissionEdit:"プロファイルを編集する権限がありません",noPermissionDelete:"アーカイブを削除する権限がありません",reprint:"再印刷",schedulePrint:"印刷をスケジュール",schedule:"スケジュール",openInBambuStudio:"スライサーで開く",openInBambuStudioToSlice:"スライサーでスライス",slice:"スライス",externalLink:"外部リンク",makerWorld:"MakerWorld: {{designer}}",viewProject:"プロジェクトを表示",noExternalLink:"外部リンクなし",preview3d:"3Dプレビュー",download:"ダウンロード",edit:"編集",delete:"削除"},modal:{deleteArchive:"アーカイブを削除",deleteConfirm:"このアーカイブを削除しますか?",deleteButton:"削除",removeSource3mf:"ソース3MFを削除",removeSource3mfConfirm:'"{{name}}"からソース3MFファイルを削除してもよろしいですか?元のスライサープロジェクトファイルが削除されます。',removeButton:"削除",removeF3d:"F3Dを削除",removeF3dConfirm:'"{{name}}"からFusion 360デザインファイルを削除してもよろしいですか?',removeTimelapse:"タイムラプスを削除",removeTimelapseConfirm:'"{{name}}"からタイムラプス動画を削除してもよろしいですか?',timelapse:"{{name}} - タイムラプス",selectTimelapse:"タイムラプスを選択",selectTimelapseDesc:"自動一致が見つかりませんでした。この印刷のタイムラプスを選択してください:",deleteArchives:"印刷アーカイブを削除",deleteArchivesConfirm:"{{count}}件のアーカイブを削除しますか?この操作は元に戻せません。",deleteCount:"{{count}}件を削除"},page:{title:"印刷アーカイブ",printsCount:"{{count}}回印刷",dropFilesHere:".3mfファイルをここにドロップ",releaseToUpload:"ドロップしてアップロード",only3mfSupported:".3mfファイルのみ対応しています",close:"閉じる",selected:"{{count}}件選択中",selectAll:"すべて選択",tags:"タグ",project:"プロジェクト",favorite:"お気に入り",delete:"削除",toggledFavorites:"{{count}}件のアーカイブのお気に入りを切替えました",failedUpdateFavorites:"お気に入りの更新に失敗しました",archivesDeleted:"{{count}}件のアーカイブを削除しました",failedDeleteArchives:"アーカイブの削除に失敗しました",photoDeleted:"写真を削除しました",failedDeletePhoto:"写真の削除に失敗しました"},list:{name:"名前",printer:"プリンター",date:"日付",size:"サイズ",actions:"操作",hasTimelapse:"タイムラプスあり"},log:{date:"日時",printName:"印刷名",printer:"プリンター",user:"ユーザー",status:"ステータス",duration:"所要時間",filament:"フィラメント",allPrinters:"全プリンター",allUsers:"全ユーザー",allStatuses:"全ステータス",cancelled:"キャンセル",skipped:"スキップ",dateFrom:"開始日",dateTo:"終了日",noEntries:"印刷ログが見つかりません",showing:"{{total}}件中{{count}}件を表示",rowsPerPage:"行数",page:"ページ",prev:"前へ",next:"次へ",clearLog:"ログをクリア",clearLogTitle:"印刷ログをクリア",clearLogConfirm:"すべての印刷ログエントリが完全に削除されます。アーカイブとキューアイテムには影響しません。この操作は元に戻せません。よろしいですか?",clearLogButton:"すべてクリア",cleared:"{{count}}件のログエントリを削除しました",clearFailed:"印刷ログの削除に失敗しました"}},queue:{title:"印刷キュー",subtitle:"印刷ジョブのスケジュールと管理",addToQueue:"キューに追加",print:"印刷",reprint:"再印刷",schedulePrint:"印刷をスケジュール",editQueueItem:"キューアイテムを編集",printToPrinters:"{{count}}台のプリンターで印刷",queueToPrinters:"{{count}}台のプリンターでキュー追加",queueAllPlates:"全{{count}}プレートをキューに追加",printQueued:"キューに追加しました",itemsQueued:"{{count}}件をキューに追加しました",sending:"送信中...",sendingProgress:"送信中 {{current}}/{{total}}...",adding:"追加中...",addingProgress:"追加中 {{current}}/{{total}}...",savingProgress:"保存中 {{current}}/{{total}}...",clearQueue:"キューをクリア",clearHistory:"履歴をクリア",emptyQueue:"キューは空です",position:"順番",scheduledTime:"予定時刻",moveUp:"上に移動",moveDown:"下に移動",startNow:"今すぐ開始",printingInProgress:"印刷中...",viewArchive:"アーカイブを表示",viewInFileManager:"ファイルマネージャーで表示",itemCount:"{{count}}件",itemCount_plural:"{{count}}件のアイテム",dragToReorder:"ドラッグして並べ替え(ASAPのみ)",reorderHint:"順番はASAPアイテムのみに影響します。スケジュール済みアイテムは設定時刻に実行されます。",addedBy:"{{username}}が追加",nextInQueue:"次のキュー",clearPlate:"プレートをクリアして次を開始",clearPlateSuccess:"プレートをクリアしました — 次の印刷の準備完了",plateReady:"プレートをクリアしました — 次の印刷の準備完了",plateNumber:"プレート {{index}}",sections:{currentlyPrinting:"印刷中",queued:"キュー中",history:"履歴"},status:{pending:"待機中",waiting:"待機中",printing:"印刷中",paused:"一時停止",completed:"完了",failed:"失敗",skipped:"スキップ",cancelled:"キャンセル済み"},summary:{printing:"印刷中",queued:"キュー中",totalTime:"キュー合計時間",totalWeight:"キュー合計重量",history:"履歴"},filter:{allPrinters:"すべてのプリンター",unassigned:"未割当",allStatus:"すべてのステータス",allLocations:"すべてのロケーション",any:"すべて"},sort:{byPosition:"順番で並べ替え",byName:"名前で並べ替え",byPrinter:"プリンターで並べ替え",bySchedule:"スケジュールで並べ替え",byDate:"日付で並べ替え",ascendingOldest:"昇順(古い順)",descendingNewest:"降順(新しい順)"},badges:{staged:"ステージ済み",requiresPrevious:"前の成功が必要",autoPowerOff:"自動電源オフ"},empty:{title:"スケジュールされた印刷はありません",description:"アーカイブページのコンテキストメニューから「スケジュール」オプションを使用するか、ファイルをドラッグ&ドロップして始めましょう。"},time:{asap:"即時",overdue:"期限超過",now:"今すぐ",lessThanMinute:"1分以内",inMinutes:"{{count}}分後",inHours:"{{count}}時間後"},actions:{stopPrint:"印刷を停止",startPrint:"印刷を開始",requeue:"再キュー"},bulkEdit:{title:"{{count}}件のアイテムを編集",title_plural:"{{count}}件のアイテムを編集",description:"変更した設定のみが選択されたアイテムに適用されます。",printer:"プリンター",noChange:"— 変更なし —",queueOptions:"キューオプション",staged:"ステージ済み",autoPowerOff:"印刷後に自動電源オフ",requirePrevious:"前の成功を必要とする",printOptions:"印刷オプション",bedLevelling:"ベッドレベリング",flowCalibration:"フローキャリブレーション",vibrationCalibration:"振動キャリブレーション",layerInspection:"第一層検査",timelapse:"タイムラプス",useAms:"AMS使用",applyChanges:"変更を適用",selectAll:"すべて選択",deselectAll:"すべて選択解除",selected:"{{count}}件選択中",editSelected:"選択を編集",cancelSelected:"選択をキャンセル"},confirm:{cancelTitle:"スケジュール済み印刷をキャンセル",cancelMessage:"「{{name}}」をキャンセルしますか?",stopTitle:"印刷を停止",stopMessage:"現在の印刷「{{name}}」を停止しますか?プリンター上の印刷ジョブがキャンセルされます。",removeTitle:"履歴から削除",removeMessage:"「{{name}}」をキュー履歴から削除しますか?",clearHistoryTitle:"履歴をクリア",clearHistoryMessage:"{{count}}件の履歴をすべて削除しますか?",cancelButton:"印刷をキャンセル",stopButton:"印刷を停止",thisPrint:"この印刷",thisItem:"このアイテム"},toast:{cancelled:"キャンセル済み",cancelFailed:"アイテムのキャンセルに失敗しました",removed:"キューアイテムを削除しました",removeFailed:"プロジェクトからのアーカイブ削除に失敗しました",stopped:"印刷を停止しました",stopFailed:"印刷の停止に失敗しました",released:"印刷をキューにリリースしました",startFailed:"印刷の開始に失敗しました",reorderFailed:"キューの並べ替えに失敗しました",historyCleared:"{{count}}件の履歴をクリアしました",clearHistoryFailed:"履歴のクリアに失敗しました",updateFailed:"アイテムの更新に失敗しました",bulkCancelled:"{{count}}件のアイテムをキャンセルしました",bulkCancelFailed:"アイテムのキャンセルに失敗しました"},permissions:{noStopPrint:"印刷を停止する権限がありません",noStartPrint:"印刷を開始する権限がありません",noEdit:"このキューアイテムを編集する権限がありません",noCancel:"このキューアイテムをキャンセルする権限がありません",noRequeue:"アイテムを再キューする権限がありません",noRemove:"このキューアイテムを削除する権限がありません",noClearHistory:"すべての履歴をクリアする権限がありません",noEditItems:"キューアイテムを編集する権限がありません",noCancelItems:"キューアイテムをキャンセルする権限がありません"}},backgroundDispatch:{unknownFile:"不明なファイル",unknownPrinter:"不明なプリンター",startingPrints:"印刷開始中",progressSummary:"{{complete}}/{{total}} 完了 • 配信済み: {{dispatched}} • 処理中: {{processing}}",expandDetails:"配信詳細を展開",collapseDetails:"配信詳細を折りたたむ",dismissToast:"配信トーストを閉じる",cancelDispatchJob:"配信ジョブをキャンセル",cancel:"キャンセル",cancelling:"キャンセル中…",status:{dispatched:"配信済み",processing:"処理中",completed:"完了",failed:"失敗",cancelled:"キャンセル済み"},toast:{cancellingUpload:"アップロードをキャンセル中...",cancelled:"配信をキャンセルしました",cancelFailed:"配信のキャンセルに失敗しました",completeWithFailures:"バックグラウンド配信完了: {{completed}} 件成功、{{failed}} 件失敗",completeSuccess:"バックグラウンド配信完了: {{completed}} 件成功",printStartedRemaining:"{{completed}} 件の印刷を開始、残り {{remaining}} 件送信中..."}},stats:{title:"統計",subtitle:"ウィジェットをドラッグして並べ替え。目のアイコンをクリックして非表示。",overview:"概要",totalPrints:"総印刷数",successRate:"成功率",totalPrintTime:"総印刷時間",printTime:"印刷時間",totalFilament:"総フィラメント使用量",filamentUsed:"フィラメント使用量",filamentCost:"フィラメントコスト",totalCost:"総コスト",energyUsed:"エネルギー使用量",energyCost:"エネルギーコスト",averagePrintTime:"平均印刷時間",printsPerDay:"1日あたりの印刷数",byPrinter:"プリンター別",printsByPrinter:"プリンター別印刷数",byMaterial:"素材別",byMonth:"月別",last7Days:"過去7日間",last30Days:"過去30日間",last90Days:"過去90日間",allTime:"全期間",quickStats:"クイック統計",printActivity:"印刷アクティビティ",filamentTypes:"フィラメントタイプ",filamentTrends:"フィラメントトレンド",failureAnalysis:"失敗分析",timeAccuracy:"時間精度",successful:"成功",failed:"失敗",perfectEstimate:"100% = 完全な推定",noTimeAccuracyData:"時間精度データがありません",noFilamentData:"フィラメントデータがありません",noPrinterData:"プリンターデータがありません",noPrintData:"印刷データがありません",noPrintDataLast30Days:"過去30日間の印刷データがありません",failureReasons:"失敗理由",topFailureReasons:"主な失敗理由",failedPrintsCount:"{{failed}} / {{total}} 件の印刷が失敗",lastWeekRate:"先週: {{rate}}%",resetLayout:"レイアウトをリセット",recalculateCosts:"コストを再計算",recalculateCostsHint:"現在のフィラメント価格ですべてのアーカイブコストを再計算",exportStats:"統計をエクスポート",exportAsCsv:"CSVでエクスポート",exportAsExcel:"Excelでエクスポート",hiddenCount:"{{count}}件非表示",exportDownloaded:"エクスポートをダウンロードしました",exportFailed:"エクスポートに失敗しました",layoutReset:"レイアウトをリセットしました",recalculatedCosts:"{{count}}件のアーカイブのコストを再計算しました",recalculateFailed:"コストの再計算に失敗しました",loadingStats:"統計を読み込み中...",noPermissionResetLayout:"レイアウトをリセットする権限がありません",noPermissionRecalculate:"コストを再計算する権限がありません",noPrintDataInRange:"選択した期間にデータがありません",periodFilament:"フィラメント使用量",periodCost:"コスト",avgPerPrint:"1印刷あたりの平均",usageOverTime:"時間推移",filamentByWeight:"重量",printDuration:"印刷時間分布",printerUtilization:"プリンター稼働率",filamentSuccess:"素材別成功率",printHabits:"印刷習慣",printTimeOfDay:"時間帯別プリント",colorDistribution:"カラー分布",noColorData:"カラーデータがありません",records:"記録",longestPrint:"最長プリント",heaviestPrint:"最重プリント",mostExpensivePrint:"最高額",busiestDay:"最多プリント日",successStreak:"連続成功",streakPrint:"連続プリント",streakPrints:"{{count}}連続プリント",printerStats:"プリンター統計",hours:"時間",avgPrints:"平均印刷数",noArchiveData:"印刷データがありません",filamentByTime:"推移",avgWeight:"平均重量",avgTime:"平均時間",filamentByPrints:"印刷数",timeframe:{today:"今日","this-week":"今週","this-month":"今月","last-7":"過去7日間","last-30":"過去30日間","last-90":"過去90日間","this-year":"今年","all-time":"全期間",custom:"カスタム",from:"開始",to:"終了"}},maintenance:{title:"メンテナンス",overview:"概要",allOk:"すべてのメンテナンスは最新です",dueCount:"{{count}}件の期限到来",dueCount_plural:"{{count}}件の期限到来",warningCount:"{{count}}件の警告",warningCount_plural:"{{count}}件の警告",totalPrintTime:"総印刷時間",nextMaintenance:"次回メンテナンス",nothingDue:"予定なし",tasks:"タスク",lastPerformed:"前回実施日",interval:"間隔",hoursRemaining:"残り{{hours}}時間",hoursOverdue:"{{hours}}時間超過",markDone:"完了にする",performMaintenance:"メンテナンスを実施",history:"履歴",noHistory:"メンテナンス履歴がありません",editPrintHours:"印刷時間を編集",currentHours:"現在の時間",statusTab:"ステータス",settingsTab:"設定",overdueCount:"{{count}}件超過",dueSoonCount:"{{count}}件まもなく期限",dueSoon:"まもなく期限",allGood:"問題なし",overdueBy:"{{duration}}超過",dueIn:"あと{{duration}}",timeLeft:"残り{{duration}}",day:"1日",days:"日",week:"1週間",weeks:"{{count}}週間",month:"1ヶ月",months:"{{count}}ヶ月",year:"1年",maintenanceTypes:"メンテナンスタイプ",maintenanceTypesDescription:"システムタイプとカスタムメンテナンスタスク",addCustomType:"カスタムタイプを追加",restoreDefaults:"デフォルトタスクを復元",intervalType:"インターバルタイプ",intervalValue:"間隔 ({{type}})",icon:"アイコン",documentationLink:"ドキュメントリンク(任意)",assignToPrinters:"プリンターに割り当て",selectAtLeastOnePrinter:"プリンターを1台以上選択してください",addType:"タイプを追加",custom:"カスタム",printHours:"印刷時間",calendarDays:"カレンダー日数",exampleName:"例: HEPAフィルター交換",viewDocumentation:"ドキュメントを表示",timeBasedInterval:"時間ベースのインターバル",intervalOverrides:"インターバルのオーバーライド",intervalOverridesDescription:"特定のプリンターの間隔をカスタマイズ",assignedToPrinters:"割り当て済みプリンター:",noPrintersAssigned:"プリンター未割り当て",addPrinterShort:"追加:",printersAssignedClick:"{{count}}台のプリンターを割り当て済み - クリックして管理",removeFromPrinter:"このプリンターから削除",types:{lubricateCarbonRods:"カーボンロッドの潤滑",lubricateRails:"リニアレールの潤滑",cleanNozzle:"ノズル/ホットエンドの清掃",checkBelts:"ベルト張力の確認",cleanBuildPlate:"ビルドプレートの清掃",checkExtruder:"エクストルーダーギアの確認",checkCooling:"冷却ファンの確認",generalInspection:"総合点検",cleanCarbonRods:"カーボンロッドの清掃",lubricateSteelRods:"スチールロッドの潤滑",cleanSteelRods:"スチールロッドの清掃",cleanLinearRails:"リニアレールの清掃",checkPtfeTube:"PTFEチューブの確認",replaceHepaFilter:"HEPAフィルター交換",replaceCarbonFilter:"カーボンフィルター交換",lubricateLeftNozzleRail:"左ノズルレールの潤滑"},maintenanceComplete:"メンテナンスを完了としてマークしました",typeUpdated:"メンテナンスタイプを更新しました",typeDeleted:"メンテナンスタイプを削除しました",defaultsRestored:"デフォルトタスクを{{count}}件復元しました",printHoursUpdated:"印刷時間を更新しました",printerAssigned:"プリンターを割り当てました",printerRemoved:"プリンターを削除しました",deleteTypeConfirm:"「{{name}}」を削除しますか?",deleteSystemTypeTitle:"デフォルトのメンテナンスタスクを削除しますか?",deleteSystemTypeMessage:"デフォルトのメンテナンスタスク「{{name}}」を削除してもよろしいですか?",noPermissionUpdate:"メンテナンス記録を更新する権限がありません",noPermissionPerform:"メンテナンスを実行する権限がありません",noPermissionEditTypes:"メンテナンスタイプを編集する権限がありません",noPermissionDeleteTypes:"メンテナンスタイプを削除する権限がありません",noPermissionEditHours:"メンテナンス時間を編集する権限がありません",noPermissionRemovePrinter:"プリンターの割り当てを解除する権限がありません",noPermissionAssignPrinter:"プリンターを割り当てる権限がありません",noPermissionEditIntervals:"メンテナンス間隔を編集する権限がありません",configureSettings:"メンテナンスタイプと間隔を設定"},settings:{title:"設定",general:"一般",tabs:{general:"一般",smartPlugs:"スマートプラグ",notifications:"通知",filament:"フィラメント",network:"ネットワーク",apiKeys:"APIキー",virtualPrinter:"仮想プリンター",users:"認証",backup:"バックアップ",emailAuth:"メール認証"},email:{smtpSettings:"SMTP設定",smtpHost:"SMTPサーバー",smtpPort:"SMTPポート",security:"セキュリティ",authentication:"認証",username:"ユーザー名",password:"パスワード",fromEmail:"送信元メールアドレス",fromName:"送信者名",testConnection:"SMTP接続テスト",testRecipient:"テスト受信者メール",sendTest:"テストメール送信",sending:"送信中...",save:"設定を保存",saving:"保存中...",advancedAuth:"高度な認証",advancedAuthEnabled:"高度な認証が有効です",advancedAuthEnabledDesc:"メールベースのユーザー管理機能が有効になっています。新規ユーザーには自動生成されたパスワードがメールで送信され、ユーザーはパスワード忘れ機能でパスワードをリセットできます。",advancedAuthDisabled:"高度な認証が無効です",advancedAuthDisabledDesc:"高度な認証を有効にして、ユーザー管理のメールベース機能を有効化してください。",enable:"有効にする",disable:"無効にする",feature1:"パスワードは自動生成され、新規ユーザーにメールで送信されます",feature2:"ユーザーはユーザー名またはメールでログインできます",feature3:"パスワード忘れ機能が利用可能です",feature4:"管理者はメールでユーザーパスワードをリセットできます",errors:{requiredFields:"すべての必須フィールドに入力してください",usernameRequired:"認証が有効な場合、ユーザー名は必須です",enterTestEmail:"テストメールアドレスを入力してください",smtpServerAndEmail:"テストする前にSMTPサーバーと送信元メールを入力してください",usernamePasswordRequired:"認証が有効な場合、ユーザー名とパスワードは必須です",configureSmtpFirst:"最初にSMTP設定を構成してテストしてください"},success:{settingsSaved:"SMTP設定を保存しました"},securityOptions:{starttls:"STARTTLS (ポート 587)",ssl:"SSL/TLS (ポート 465)",none:"なし (ポート 25)"},authOptions:{enabled:"有効",disabled:"無効"}},appearance:"外観",notifications:"通知",smartPlugs:"スマートプラグ",spoolman:"Spoolman",updates:"アップデート",language:"言語",languageDescription:"表示言語を選択してください",theme:"テーマ",themeLight:"ライト",themeDark:"ダーク",themeSystem:"システム設定に従う",defaultView:"デフォルト画面",defaultViewDescription:"アプリ起動時に表示するページ",checkForUpdates:"アップデートを確認",autoUpdate:"自動アップデート",currentVersion:"現在のバージョン",latestVersion:"最新バージョン",upToDate:"最新です",updateAvailable:"アップデートあり",notificationLanguage:"通知の言語",notificationLanguageDescription:"プッシュ通知の言語",bedCooledThreshold:"ベッド冷却しきい値",bedCooledThresholdDescription:"印刷後にベッドが冷却されたと見なす温度",notificationProviders:"通知プロバイダー",addProvider:"プロバイダーを追加",editProvider:"プロバイダーを編集",providerType:"プロバイダーの種類",testNotification:"テスト通知",testSuccess:"テスト通知を送信しました",testFailed:"テスト通知の送信に失敗しました",quietHours:"おやすみ時間",quietHoursDescription:"この時間帯は通知を送信しません",quietHoursStart:"開始",quietHoursEnd:"終了",events:{title:"通知イベント",printStart:"印刷開始",printComplete:"印刷完了",printFailed:"印刷失敗",printStopped:"印刷中止",printProgress:"進捗マイルストーン",printProgressDescription:"25%, 50%, 75%で通知",printerOffline:"プリンターオフライン",printerError:"プリンターエラー",filamentLow:"フィラメント残量低下",maintenanceDue:"メンテナンス期限",maintenanceDueDescription:"メンテナンスが必要なときに通知"},smartPlug:{title:"スマートプラグ",add:"スマートプラグを追加",edit:"スマートプラグを編集",name:"名前",ipAddress:"IPアドレス",linkedPrinter:"連携プリンター",autoOn:"自動電源オン",autoOnDescription:"印刷開始時に電源を入れる",autoOff:"自動電源オフ",autoOffDescription:"印刷完了後に電源を切る",offDelay:"オフ遅延",offDelayMinutes:"印刷後の待機時間(分)",offDelayTemp:"ノズル温度が下回ったとき",currentState:"現在の状態",turnOn:"電源オン",turnOff:"電源オフ"},filamentTracking:"フィラメント追跡",filamentTrackingDesc:"フィラメントスプールの追跡方法を選択してください。内蔵インベントリまたは外部Spoolmanサーバーを使用できます。",trackingModeBuiltIn:"内蔵インベントリ",trackingModeBuiltInDesc:"RFID自動検出と使用量追跡を含む",trackingModeSpoolmanDesc:"外部フィラメント管理サーバー",builtInFeatureRfid:"AMS内のBambu Lab RFIDスプールを自動検出",builtInFeatureUsage:"プリントごとのフィラメント消費量を追跡",builtInFeatureCatalog:"スプール、カラー、K値プロファイルを管理",builtInFeatureThirdParty:"サードパーティ製スプールをインベントリスプールに割り当て可能",amsSyncButton:"AMSから重量を同期",amsSyncTitle:"AMSからスプール重量を同期",amsSyncMessage:"接続されたプリンターの現在のAMS残量値で、すべてのインベントリスプール重量を上書きします。破損した重量データの復旧に使用してください。プリンターがオンラインである必要があります。",amsSyncing:"同期中...",amsSyncSuccess:"{{synced}}個のスプールを同期、{{skipped}}個をスキップ",amsSyncError:"AMSからの重量同期に失敗しました",spoolmanUrl:"Spoolman URL",spoolmanUrlHint:"Spoolmanサーバーのurl(例:http://localhost:7912)",spoolmanConnected:"接続中",spoolmanDisconnected:"未接続",status:"ステータス",connect:"接続",disconnect:"切断",howSyncWorks:"同期の仕組み",syncInfoRfidOnly:"RFIDを搭載した公式Bambu Labスプールのみ同期されます",syncInfoAutoCreate:"新しいスプールは初回同期時にSpoolmanに自動作成されます",syncInfoThirdPartySkipped:"Bambu Lab以外のスプール(サードパーティ、リフィル)はスキップされます",linkingExistingSpools:"既存スプールのリンク",linkingExistingSpoolsDesc:"既存のSpoolmanスプールをAMSにリンクするには、AMSスロットにカーソルを合わせて「Spoolmanにリンク」をクリックしてください。",syncMode:"同期モード",syncModeAuto:"自動",syncModeManual:"手動のみ",syncModeAutoDesc:"変更が検出されるとAMSデータが自動的に同期されます",syncModeManualDesc:"手動でトリガーした場合のみ同期",syncAmsData:"AMSデータを同期",syncAmsDataDesc:"プリンターのAMSデータをSpoolmanに手動同期",allPrinters:"全プリンター",noDefaultPrinter:"デフォルトなし(毎回選択)",sidebarOrder:"サイドバーの順序",saveThumbnails:"サムネイルを保存",captureFinishPhoto:"完了写真を撮影",noPrintersConfigured:"プリンターが設定されていません",archiveMode:{always:"常にアーカイブを作成",never:"アーカイブを作成しない",ask:"毎回確認"},checkForUpdatesLabel:"アップデートを確認",checkPrinterFirmware:"プリンターファームウェアの確認",includeBetaUpdates:"ベータ版を含める",includeBetaUpdatesDesc:"アップデート確認時にベータ版およびプレリリース版を通知する",enableRetry:"リトライを有効化",homeAssistantDescription:"Home Assistantに接続してHA REST APIでスマートプラグを制御します。switch、light、input_booleanエンティティに対応しています。",environmentManagedLabel:"(環境変数で管理)",autoEnabledViaEnv:"環境変数により自動的に有効化されました",urlFromEnvReadOnly:"HA_URL環境変数で設定された値(読み取り専用)",tokenFromEnvReadOnly:"HA_TOKEN環境変数で設定された値(読み取り専用)",mqttConnectedTo:"接続先:",prometheusDescription:"プリンターデータをPrometheus形式で公開",noSmartPlugsTitle:"スマートプラグが設定されていません",noSmartPlugsDescription:"Tasmotaベースのスマートプラグを追加して、エネルギー消費を追跡し、電源制御を自動化します。",noProvidersTitle:"プロバイダーが設定されていません",noProvidersDescription:"アラートを受信するにはプロバイダーを追加してください。",noTemplatesAvailable:"テンプレートがありません。バックエンドを再起動してデフォルトテンプレートを生成してください。",apiPermissionView:"プリンターステータスとキューを表示",apiPermissionEdit:"印刷キューにアイテムを追加・削除",apiKeysEmptyTitle:"APIキーがありません",apiKeysEmptyDescription:"外部サービスと連携するためのAPIキーを作成してください。",noUsersFound:"ユーザーが見つかりません",noGroupsFound:"グループが見つかりません",noGroupsAvailable:"利用可能なグループがありません",passwordsDoNotMatch:"パスワードが一致しません",systemGroupWarning:"システムグループ名は変更できません",authDisabledTitle:"認証が無効です",authDisabledFeature1:"システムへのアクセスにログインを要求",authDisabledFeature2:"グループベースの権限で複数ユーザーを作成",authDisabledFeature3:"50以上のきめ細かな権限でアクセスを制御",userHasCreated:"このユーザーは以下を作成しています:",userItemsQuestion:"これらのアイテムをどうしますか?",deleteUserConfirm:"このユーザーを削除してもよろしいですか?この操作は元に戻せません。",actionCannotBeUndone:"この操作は元に戻せません",addFirstSmartPlug:"最初のスマートプラグを追加",providers:"プロバイダー",log:"ログ",testAll:"すべてテスト",testResults:"テスト結果",testPassedCount:"{{count}}件成功",testFailedCount:"{{count}}件失敗",messageTemplates:"メッセージテンプレート",messageTemplatesDescription:"各イベントの通知メッセージをカスタマイズ。",apiKeys:"APIキー",apiKeysDescription:"外部連携やWebhook用のAPIキーを作成します。",createKey:"キーを作成",apiKeyCreated:"APIキーを作成しました",apiKeyCopyWarning:"今すぐこのキーをコピーしてください - 再表示されません!",useInApiBrowser:"APIブラウザーで使用",createNewApiKey:"新しいAPIキーを作成",keyName:"キー名",keyNamePlaceholder:"例: Home Assistant, OctoPrint",readStatus:"ステータスの読み取り",readStatusDescription:"プリンターのステータスとキューを表示",manageQueue:"キューの管理",manageQueueDescription:"印刷キューへのアイテムの追加と削除",controlPrinter:"プリンターの制御",controlPrinterDescription:"印刷の一時停止、再開、停止",unnamedKey:"名前なしキー",lastUsed:"最終使用:",read:"読み取り",control:"制御",createFirstKey:"最初のキーを作成",webhookEndpoints:"Webhookエンドポイント",webhookApiKeyHint:"X-API-KeyヘッダーでAPIキーを使用してください。",webhook:{getAllStatus:"全プリンターステータスを取得",getSpecificStatus:"特定のプリンターステータスを取得",addToQueue:"印刷キューに追加",pausePrint:"印刷を一時停止",resumePrint:"印刷を再開",stopPrint:"印刷を停止"},apiBrowser:"APIブラウザ",apiBrowserDescription:"すべての利用可能なAPIエンドポイントを探索してテストします。",apiKeyForTesting:"テスト用APIキー",apiKeyPlaceholder:"CallMeBot APIキー",apiKeyHint:"このキーはX-API-Keyヘッダーとしてリクエストに送信されます。",deleteApiKeyTitle:"APIキーを削除",deleteApiKeyMessage:"このAPIキーを削除してもよろしいですか?このキーを使用しているすべての連携が動作しなくなります。",deleteKey:"キーを削除",amsDisplayThresholds:"AMS表示しきい値",amsThresholdsDescription:"AMS湿度と温度インジケーターの色しきい値を設定します。",humidity:"湿度",goodGreen:"良好(緑)≤",fairOrange:"普通(オレンジ)≤",aboveFairBad:"普通のしきい値以上は赤(悪い)で表示",temperature:"温度",goodBlue:"良好(青)≤",aboveFairHot:"普通のしきい値以上は赤(高温)で表示",historyRetention:"履歴の保持",keepSensorHistory:"センサー履歴の保持期間",historyRetentionDescription:"古い湿度と温度データは自動的に削除されます",printModal:"印刷ダイアログ",expandCustomMapping:"カスタムマッピングをデフォルトで展開",expandCustomMappingDescription:"複数プリンターに印刷する際、プリンターごとのAMSマッピングを展開表示",authentication:"認証",authEnabledDescription:"ユーザー認証でインスタンスが保護されています",authDisabledDescription:"認証を有効にして、ユーザーアカウントの作成、権限の管理、Bambuddyインスタンスのセキュリティを確保しましょう。",authDisabledMessage:"認証を有効にして、ユーザーアカウントの作成、権限の管理、Bambuddyインスタンスのセキュリティを確保しましょう。",enableAuthentication:"認証を有効にする",currentUser:"現在のユーザー",changePassword:"パスワードを変更",admin:"管理者",users:"ユーザー",addUser:"ユーザーを追加",groups:"グループ",addGroup:"グループを追加",system:"システム",noDescription:"説明なし",userCount:"{{count}}人のユーザー",permissionCount:"{{count}}件の権限",createUser:"ユーザーを作成",username:"ユーザー名",enterUsername:"ユーザー名を入力",password:"パスワード",enterPassword:"パスワードを入力(6文字以上)",confirmPassword:"パスワードの確認",confirmPasswordPlaceholder:"パスワードを確認",viewReleaseOnGitHub:"GitHubでリリースを表示",turnAllPlugsOn:"すべてのプラグをオン",turnAllPlugsOff:"すべてのプラグをオフ",clearNotificationLogs:"通知ログをクリア",clearLogsMessage:"30日以上前のすべての通知ログを完全に削除します。この操作は元に戻せません。",clearLogs:"通知ログを削除",resetUiPreferences:"UI設定をリセット",resetUiPreferencesMessage:"すべてのUI設定をデフォルトにリセットします:サイドバー順序、テーマ、ダッシュボードレイアウト、表示モード、ソート設定。プリンター、アーカイブ、サーバー設定は影響を受けません。クリア後にページがリロードされます。",resetPreferences:"設定をリセット",deleteGroupTitle:"グループを削除",deleteGroupMessage:"このグループを削除しますか?このグループのユーザーはこれらの権限を失います。",deleteGroup:"グループを削除",disableAuthenticationTitle:"認証を無効化",disableAuthenticationMessage:"認証を無効にしますか?Bambuddyインスタンスにログインなしでアクセスできるようになります。ユーザーはデータベースに残りますが、認証は無効になります。",disableAuthentication:"認証を無効化",configureBambuddy:"Bambuddyを設定",systemDefault:"システムデフォルト",archiveSettings:"アーカイブ設定",newWindow:"新しいウィンドウ",embeddedOverlay:"埋め込みオーバーレイ",preferredSlicer:"優先スライサー",preferredSlicerDescription:"ファイルを開くスライサーアプリケーションを選択",externalCameras:"外部カメラ",costTracking:"コスト追跡",printsOnly:"印刷のみ",totalConsumption:"総消費量",dataManagement:"データ管理",storageUsage:"ストレージ使用量",storageUsageDescription:"カテゴリ別のデータ使用量の内訳",storageUsageTotal:"合計",storageUsageErrors:"エラー",storageUsageOtherBreakdown:"その他(静的アセット、スクリプト、設定ファイルを含む)",storageUsageSystem:"システム",storageUsageData:"データ",storageUsageUnavailable:"ストレージ使用量情報は利用できません",clearNotificationLogsDescription:"30日以上前の通知ログを削除",resetUiPreferencesDescription:"サイドバー順序、テーマ、表示モード、レイアウト設定をリセット。プリンター、アーカイブ、設定は影響を受けません。",enableHomeAssistant:"Home Assistantを有効化",enableMqtt:"MQTTを有効化",useTls:"TLSを使用",enableMetricsEndpoint:"メトリクスエンドポイントを有効化",availableMetrics:"利用可能なメトリクス",editUser:"ユーザーを編集",deleteUserTitle:"ユーザーを削除",groupName:"グループ名",leaveEmptyForAnonymous:"匿名の場合は空のまま",leaveEmptyForNoAuth:"認証なしの場合は空のまま",enterNewPassword:"新しいパスワードを入力",confirmNewPassword:"新しいパスワードを確認",enterGroupName:"グループ名を入力",enterDescriptionOptional:"説明を入力(任意)",enterCurrentPassword:"現在のパスワードを入力",enterNewPasswordMin6:"新しいパスワードを入力(6文字以上)",toast:{keyCopied:"キーをクリップボードにコピーしました",copyFailed:"キーのコピーに失敗しました",keyAddedToBrowser:"キーをAPIブラウザに追加しました",clearLogsFailed:"ログの削除に失敗しました",uiPreferencesReset:"UI設定をリセットしました。更新中...",authDisabled:"認証を無効にしました",authDisableFailed:"認証の無効化に失敗しました",apiKeyCreated:"APIキーを作成しました",apiKeyDeleted:"APIキーを削除しました",userCreated:"ユーザーが正常に作成されました",userUpdated:"ユーザーが正常に更新されました",userDeleted:"ユーザーが正常に削除されました",groupCreated:"グループを作成しました",groupUpdated:"グループを更新しました",groupDeleted:"グループを削除しました",fillRequiredFields:"必須項目をすべて入力してください",passwordsDoNotMatch:"パスワードが一致しません",passwordTooShort:"パスワードは6文字以上必要です",enterGroupName:"グループ名を入力",settingsSaved:"設定を保存しました",cameraSettingsSaved:"カメラ設定を保存しました",enterCameraUrl:"カメラURLを入力してください",passwordChanged:"パスワードが正常に変更されました",connectionFailed:"接続失敗",testFailed:"テスト通知の送信に失敗しました",cameraConnected:"カメラ接続{{resolution}}"},testConnection:"接続テスト",catalog:{spoolCatalog:"スプールカタログ",spoolCatalogDescription:"ブランド/タイプ別の空スプール重量。スプール追加時の自動重量検索に使用されます。",searchCatalog:"カタログを検索...",addNewEntry:"新しいエントリを追加",namePlaceholder:"名前(例:Bambu Lab - プラスチック)",weight:"重量",type:"タイプ",default:"デフォルト",custom:"カスタム",noMatch:"検索に一致するエントリがありません",empty:"カタログにエントリがありません",deleteEntry:"エントリを削除",deleteConfirm:"「{{name}}」を削除してもよろしいですか?",resetCatalog:"カタログをリセット",resetConfirm:"カタログをデフォルトにリセットしますか?カスタムエントリはすべて削除されます。",loadFailed:"スプールカタログの読み込みに失敗しました",nameWeightRequired:"名前と重量は必須です",entryAdded:"エントリを追加しました",addFailed:"エントリの追加に失敗しました",entryUpdated:"エントリを更新しました",updateFailed:"エントリの更新に失敗しました",entryDeleted:"エントリを削除しました",deleteFailed:"エントリの削除に失敗しました",resetSuccess:"カタログをデフォルトにリセットしました",resetFailed:"カタログのリセットに失敗しました",exported:"{{count}}件のエントリをエクスポートしました",imported:"{{added}}件のエントリをインポートしました({{skipped}}件スキップ)",importFailed:"インポートに失敗しました:無効なJSON形式",exportTooltip:"カタログをJSONにエクスポート",importTooltip:"JSONからカタログをインポート",resetTooltip:"デフォルトにリセット",selectedCount:"{{count}}件選択中",deleteSelected:"選択を削除",bulkDeleteConfirm:"{{count}}件のエントリーを削除してもよろしいですか?",bulkDeleted:"{{count}}件のエントリーを削除しました",bulkDeleteFailed:"エントリーの削除に失敗しました"},colorCatalog:{title:"カラーカタログ",description:"メーカー/素材別のフィラメントカラー。スプール追加時の自動カラー検索に使用されます。",searchColors:"カラーを検索...",allManufacturers:"すべてのメーカー",addNewColor:"新しいカラーを追加",manufacturer:"メーカー",colorName:"カラー名",hex:"Hex",materialOptional:"素材(任意)",showing:"{{total}}件中{{filtered}}件を表示",noMatch:"検索に一致するカラーがありません",empty:"カタログにカラーがありません",deleteColor:"カラーを削除",deleteConfirm:"「{{name}}」を削除してもよろしいですか?",resetCatalog:"カラーカタログをリセット",resetConfirm:"カタログをデフォルトにリセットしますか?カスタムカラーはすべて削除されます。",sync:"同期",starting:"開始中...",syncTooltip:"FilamentColors.xyzから同期(2000+カラー)",loadFailed:"カラーカタログの読み込みに失敗しました",fieldsRequired:"メーカー、カラー名、Hexカラーは必須です",colorAdded:"カラーを追加しました",addFailed:"カラーの追加に失敗しました",colorUpdated:"カラーを更新しました",updateFailed:"カラーの更新に失敗しました",colorDeleted:"カラーを削除しました",deleteFailed:"カラーの削除に失敗しました",resetSuccess:"カラーカタログをデフォルトにリセットしました",resetFailed:"カタログのリセットに失敗しました",syncUpToDate:"最新の状態です({{count}}件のカラーを確認)",syncComplete:"{{added}}件の新しいカラーを追加しました({{skipped}}件は既に存在)",syncError:"同期エラー",syncFailed:"FilamentColors.xyzからの同期に失敗しました",exported:"{{count}}件のカラーをエクスポートしました",imported:"{{added}}件のカラーをインポートしました({{skipped}}件スキップ)",importFailed:"インポートに失敗しました:無効なJSON形式",selectedCount:"{{count}}件選択中",deleteSelected:"選択を削除",bulkDeleteConfirm:"{{count}}件のカラーを削除してもよろしいですか?",bulkDeleted:"{{count}}件のカラーを削除しました",bulkDeleteFailed:"カラーの削除に失敗しました"},dateFormat:"日付形式",dateFormatUs:"US (MM/DD/YYYY)",dateFormatEu:"EU (DD/MM/YYYY)",dateFormatIso:"ISO (YYYY-MM-DD)",timeFormat:"時刻形式",timeFormat12:"12時間制 (3:30 PM)",timeFormat24:"24時間制 (15:30)",defaultPrinter:"デフォルトプリンター",defaultPrinterDescription:"アップロード、再印刷、その他の操作でこのプリンターを事前選択します。",slicerBambuStudio:"Bambu Studio",slicerOrcaSlicer:"OrcaSlicer",sidebarOrderDescription:"サイドバーの項目をドラッグして並べ替え。ここでデフォルトの順序にリセット。",reset:"リセット",darkMode:"ダークモード",lightMode:"ライトモード",active:"(アクティブ)",background:"背景",accent:"アクセント",style:"スタイル",bgNeutral:"ニュートラル",bgWarm:"ウォーム",bgCool:"クール",bgOled:"OLEDブラック",bgSlate:"スレートブルー",bgForest:"フォレストグリーン",accentGreen:"グリーン",accentTeal:"ティール",accentBlue:"ブルー",accentOrange:"オレンジ",accentPurple:"パープル",accentRed:"レッド",styleClassic:"クラシック",styleGlow:"グロー",styleVibrant:"ビビッド",themeToggleHint:"サイドバーの太陽/月アイコンでダークモードとライトモードを切り替えます。",autoArchivePrints:"印刷を自動アーカイブ",autoArchiveDescription:"印刷完了時に3MFファイルを自動保存",saveThumbnailsDescription:"3MFファイルからプレビュー画像を抽出して保存",captureFinishPhotoDescription:"印刷完了時にプリンターカメラから写真を撮影",ffmpegNotInstalled:"ffmpegがインストールされていません",ffmpegRequired:"カメラ撮影にはffmpegが必要です。<brew>brew install ffmpeg</brew>(macOS)または<apt>apt install ffmpeg</apt>(Linux)でインストールしてください。",camera:"カメラ",cameraViewMode:"カメラ表示モード",cameraOverlayDescription:"メイン画面上にリサイズ可能なオーバーレイでカメラを表示",cameraWindowDescription:"別のブラウザウィンドウでカメラを表示",externalCamerasDescription:"内蔵プリンターカメラの代わりに外部カメラを設定。MJPEGストリーム、RTSP、HTTPスナップショット、USBカメラ(V4L2)をサポート。有効にすると、ライブビューと完了写真に外部カメラが使用されます。",cameraPlaceholderUsb:"デバイスパス (/dev/video0)",cameraPlaceholderUrl:"カメラURL (rtsp://... または http://...)",cameraTypeMjpeg:"MJPEGストリーム",cameraTypeRtsp:"RTSPストリーム",cameraTypeSnapshot:"HTTPスナップショット",cameraTypeUsb:"USBカメラ (V4L2)",test:"テスト",connected:"接続済み",disconnected:"未接続",currency:"通貨",defaultFilamentCost:"デフォルトフィラメントコスト(kg単価)",electricityCost:"電気料金(kWh単価)",energyDisplayMode:"エネルギー表示モード",energyModePrintDescription:"ダッシュボードに印刷中の消費エネルギーの合計を表示",energyModeTotalDescription:"ダッシュボードにスマートプラグの累計エネルギーを表示",fileManager:"ファイルマネージャー",createArchiveEntry:"印刷時にアーカイブエントリを作成",createArchiveEntryDescription:"ファイルマネージャーから印刷時に、オプションでアーカイブエントリを作成",lowDiskSpaceWarning:"ディスク容量不足の警告",lowDiskSpaceDescription:"空きディスク容量がこのしきい値を下回った場合に警告を表示",printerFirmware:"プリンターファームウェア",checkFirmwareDescription:"Bambu Labのプリンターファームウェア更新を確認",bambuddySoftware:"Bambuddyソフトウェア",autoCheckDescription:"起動時に自動的に新しいバージョンを確認",checkNow:"今すぐ確認",updateAvailableVersion:"アップデート利用可能: v{{version}}",releaseNotes:"リリースノート",updateViaDocker:"Docker Composeでアップデート:",installUpdate:"アップデートをインストール",latestVersionRunning:"最新バージョンを使用しています",failedToCheckUpdates:"アップデートの確認に失敗しました: {{error}}",backupRestore:"バックアップと復元",backupRestoreDescription:"設定のエクスポート/インポートとGitHubバックアップの設定",goToBackup:"バックアップへ",externalUrl:"外部URL",externalUrlDescription:"Bambuddyがアクセス可能な外部URL。通知画像や外部連携に使用されます。",bambuddyUrl:"Bambuddy URL",externalUrlHint:"プロトコルとポートを含めてください(例: http://192.168.1.100:8000)",ftpRetry:"FTPリトライ",ftpRetryDescription:"プリンターのWi-Fiが不安定な場合にFTP操作をリトライ。3MFダウンロード、印刷アップロード、タイムラプスダウンロード、ファームウェア更新に適用。",autoRetryDescription:"失敗したFTP操作を自動的にリトライ",retryAttempts:"リトライ回数",retryDelay:"リトライ遅延",connectionTimeout:"接続タイムアウト",time_one:"{{count}}回",time_other:"{{count}}回",second_one:"{{count}}秒",second_other:"{{count}}秒",nSeconds:"{{count}}秒",increaseForWeakWifi:"Wi-Fiが弱いプリンター用に増やしてください",homeAssistant:"Home Assistant",homeAssistantFullDescription:"Home Assistantに接続してHA REST API経由でスマートプラグを制御。switch、light、input_boolean、scriptエンティティをサポート。",homeAssistantUrl:"Home Assistant URL",longLivedAccessToken:"長期アクセストークン",haTokenHint:"HAでトークンを作成: プロフィール → 長期アクセストークン → トークンを作成",connectionSuccessful:"接続成功",connectionFailed:"接続失敗",haConnectionSuccess:"Home Assistantへの接続に成功しました。",haConnectionFailed:"Home Assistantへの接続に失敗しました。",mqttPublishing:"MQTTパブリッシュ",mqttDescription:"Node-RED、Home Assistant、その他の自動化システムとの統合のため、外部MQTTブローカーにBamBuddyイベントをパブリッシュ。",mqttEnableDescription:"外部MQTTブローカーにイベントをパブリッシュ",brokerHostname:"ブローカーホスト名",port:"ポート",usernameOptional:"ユーザー名(オプション)",passwordOptional:"パスワード(オプション)",topicPrefix:"トピックプレフィックス",topicPrefixHint:"トピック形式: {{prefix}}/printers/<serial>/status 等",prometheusMetrics:"Prometheusメトリクス",prometheusEndpointDescription:"Prometheus/Grafanaモニタリング用に<code>/api/v1/metrics</code>でプリンターメトリクスを公開。",bearerTokenOptional:"Bearerトークン(オプション)",bearerTokenHint:"設定時、リクエストに<code>Authorization: Bearer <token></code>が必要",metricsConnectionStatus:"接続状態",metricsPrinterState:"プリンター状態(idle/printing等)",metricsPrintProgress:"印刷進捗 0-100%",metricsBedTemp:"ベッド温度",metricsNozzleTemp:"ノズル温度",metricsPrintsTotal:"結果別の総印刷数",metricsMore:"...その他(レイヤー、ファン、キュー、フィラメント使用量)",smartPlugsDescription:"スマートプラグ(TasmotaまたはHome Assistant)を接続して、電源制御の自動化とプリンターのエネルギー使用量を追跡。",allOn:"すべてオン",allOff:"すべてオフ",addSmartPlug:"スマートプラグを追加",energySummary:"エネルギー概要",currentPower:"現在の消費電力",plugsOnline:"{{reachable}}/{{total}}プラグオンライン",today:"今日",yesterday:"昨日",total:"合計",enablePlugsForSummary:"プラグを有効にしてエネルギー概要を表示",addNotificationProvider:"追加",systemBadge:"(システム)",creating:"作成中...",changing:"変更中...",deleteUserAndItems:"ユーザーとそのアイテムを削除",deleteUserKeepItems:"ユーザーを削除、アイテムは保持(オーナーなしになります)",ok:"OK"},notification:{printStarted:{title:"印刷開始",body:"{{printer}}: {{filename}} の印刷を開始しました"},printCompleted:{title:"印刷完了",body:"{{printer}}: {{filename}} が正常に完了しました"},printFailed:{title:"印刷失敗",body:"{{printer}}: {{filename}} が失敗しました"},printStopped:{title:"印刷中止",body:"{{printer}}: {{filename}} が中止されました"},printProgress:{title:"印刷進捗",body:"{{printer}}: {{filename}} は {{percent}}% 完了"},printerOffline:{title:"プリンターオフライン",body:"{{printer}} がオフラインです"},printerError:{title:"プリンターエラー",body:"{{printer}}: {{error}}"},filamentLow:{title:"フィラメント残量低下",body:"{{printer}}: フィラメントが残りわずかです"},maintenanceDue:{title:"メンテナンス期限",body:"{{printer}}: {{items}} の対応が必要です"}},errors:{generic:"問題が発生しました",networkError:"ネットワークエラーです。接続を確認してください。",notFound:"見つかりません",unauthorized:"認証エラー",serverError:"サーバーエラー",validationError:"入力内容を確認してください",printerConnectionFailed:"プリンターへの接続に失敗しました",saveFailed:"保存に失敗しました",deleteFailed:"削除に失敗しました",loadFailed:"データの読み込みに失敗しました"},hmsErrors:{title:"エラー - {{name}}",noErrors:"エラーなし",viewOnWiki:"Bambu Lab Wikiで表示",clearInstructions:"プリンターでエラーをクリアするとここからも消えます。",clearErrors:"エラーをクリア",clearSuccess:"HMSエラーをクリアしました",clearFailed:"HMSエラーのクリアに失敗しました"},mqttDebug:{title:"MQTTデバッグログ",searchPlaceholder:"トピックまたはペイロードで検索...",noMessages:"まだメッセージが記録されていません",startLoggingHint:"「ログ開始」をクリックしてMQTTメッセージのキャプチャを開始",noMessagesMatch:"フィルターに一致するメッセージがありません",adjustFilterHint:"検索条件やフィルター条件を調整してみてください",incoming:"受信",outgoing:"送信",loggingStopped:"ログ記録停止",loggingActive:"ログ記録中 - メッセージは自動更新されます",startLogging:"ログ記録を開始",stopLogging:"ログ停止",clearLog:"ログをクリア",topic:"トピック",timestamp:"タイムスタンプ",direction:"方向",all:"すべて"},printerFiles:{title:"ファイル管理",storageUsed:"使用中:",storageFree:"空き:",filterPlaceholder:"ファイルを検索...",deleteButton:"削除",deleteFiles:"{{count}}件のファイルを削除",deleteFileConfirm:"このファイルを削除しますか?",deleteFilesConfirm:"選択した{{count}}件のファイルを削除しますか?元に戻せません。",noFiles:"このディレクトリにファイルがありません",loadingFiles:"ファイルを読み込み中...",failedToLoad:"ファイルの読み込みに失敗しました",toast:{filesDeleted:"{{count}}件のファイルを削除しました",deleteFailed:"削除に失敗: {{error}}"}},confirm:{delete:"削除しますか?",unsavedChanges:"保存されていない変更があります。このページを離れますか?",clearQueue:"キューをクリアしますか?"},login:{title:"Bambuddy ログイン",subtitle:"アカウントにサインイン",username:"ユーザー名",usernamePlaceholder:"ユーザー名を入力",usernameOrEmail:"ユーザー名またはメール",usernameOrEmailPlaceholder:"ユーザー名または @ メール",password:"パスワード",passwordPlaceholder:"パスワードを入力",signIn:"サインイン",signingIn:"ログイン中...",forgotPassword:"パスワードをお忘れですか?",loginSuccess:"ログインしました",loginFailed:"ログインに失敗しました",enterCredentials:"ユーザー名とパスワードを入力してください",forgotPasswordTitle:"パスワードを忘れた場合",forgotPasswordMessage:"パスワードを忘れた場合は、システム管理者に連絡してリセットしてもらってください。",forgotPasswordEmailMessage:"メールアドレスを入力すると、新しいパスワードを送信します。",emailAddress:"メールアドレス",emailPlaceholder:"your.email@example.com",cancel:"キャンセル",sending:"送信中...",sendResetEmail:"リセットメールを送信",howToReset:"パスワードのリセット方法:",resetStep1:"Bambuddy管理者に連絡",resetStep2:"ユーザー管理でパスワードリセットを依頼",resetStep3:"管理者が新しい仮パスワードを設定",resetStep4:"新しいパスワードでログインし、設定で変更",gotIt:"了解"},setup:{title:"Bambuddy セットアップ",subtitle:"Bambuddyインスタンスの認証を設定",enableAuth:"認証を有効化",adminAccount:"管理者アカウント",adminAccountDesc:"既に管理者ユーザーが存在する場合、既存の管理者アカウントを使用して認証が有効化されます。既存の管理者を使用する場合は下のフィールドを空のままにするか、新しい認証情報を入力して新しい管理者ユーザーを作成してください。",adminUsername:"管理者ユーザー名",adminPassword:"管理者パスワード",optionalIfAdminExists:"(管理者ユーザーが存在する場合は任意)",adminUsernamePlaceholder:"管理者ユーザー名を入力(任意)",adminPasswordPlaceholder:"管理者パスワードを入力(任意)",confirmPassword:"パスワードの確認",confirmPasswordPlaceholder:"パスワードを確認",settingUp:"セットアップ中...",completeSetup:"セットアップを完了",toast:{authEnabledAdminCreated:"認証が有効になり、管理者ユーザーが作成されました",authEnabledExistingAdmins:"既存の管理者ユーザーを使用して認証が有効になりました",setupCompleted:"セットアップが完了しました",enterBothCredentials:"管理者のユーザー名とパスワードの両方を入力するか、既存の管理者を使用する場合は両方を空にしてください",passwordsDoNotMatch:"パスワードが一致しません",passwordTooShort:"パスワードは6文字以上必要です"}},changePassword:{title:"パスワードを変更",currentPassword:"現在のパスワード",currentPasswordPlaceholder:"現在のパスワードを入力",newPassword:"新しいパスワード",newPasswordPlaceholder:"新しいパスワードを入力(6文字以上)",confirmPassword:"新しいパスワード確認",confirmPasswordPlaceholder:"パスワードを確認",passwordsDoNotMatch:"パスワードが一致しません",passwordTooShort:"パスワードは6文字以上必要です",changing:"変更中...",success:"パスワードを変更しました",failed:"パスワードの変更に失敗しました"},plateAlert:{title:"印刷が一時停止されました!",message:"ビルドプレート上にオブジェクトが検出されました。印刷が自動的に一時停止されました。プレートをクリアして印刷を再開してください。",understand:"了解"},camera:{title:"カメラビュー",invalidPrinterId:"無効なプリンターID",live:"ライブ",snapshot:"スナップショット",restartStream:"ストリームを再開",refreshSnapshot:"スナップショットを更新",fullscreen:"フルスクリーン",exitFullscreen:"フルスクリーンを終了",connectingToCamera:"カメラに接続中...",capturingSnapshot:"スナップショットを撮影中...",connectionLost:"接続が切断されました",connectionFailed:"カメラ接続に失敗しました",reconnecting:"{{countdown}}秒後に再接続... (試行 {{attempt}}/{{max}})",reconnectNow:"今すぐ再接続",cameraUnavailable:"カメラが利用できません",cameraUnavailableDesc:"プリンターの電源がオンで接続されていることを確認してください。",noCamera:"カメラがありません",retry:"再試行",cameraStream:"カメラストリーム",zoomOut:"ズームアウト",zoomIn:"ズームイン",resetZoom:"ズームをリセット",recording:"録画中",startRecording:"録画開始",stopRecording:"録画停止",chamberLight:"チャンバーライト切替"},groups:{title:"グループ管理",subtitle:"アクセス制御の権限グループを管理",backToSettings:"設定に戻る",createGroup:"グループを作成",noPermission:"このページにアクセスする権限がありません。",system:"システム",noDescription:"説明なし",usersCount:"{{count}}人のユーザー",permissionsCount:"{{count}}個の権限",edit:"編集",delete:"削除",toast:{created:"グループを作成しました",updated:"グループを更新しました",deleted:"アーカイブを削除しました",enterGroupName:"グループ名を入力"},modal:{editGroup:"グループを編集",createGroup:"グループを作成",cancel:"キャンセル",saving:"保存中...",creating:"作成中...",saveChanges:"変更を保存"},form:{groupName:"グループ名",groupNamePlaceholder:"グループ名を入力",systemGroupWarning:"システムグループ名は変更できません",description:"説明",descriptionPlaceholder:"説明を入力(任意)",permissions:"権限"},deleteModal:{title:"グループを削除",message:"このグループを削除しますか?このグループのユーザーはこれらの権限を失います。",confirm:"確認"},editor:{title:"グループを編集",createTitle:"グループを作成",search:"権限を検索...",selectAll:"すべて選択",clearAll:"すべて解除",permissionsSelected:"{{count}}件選択",noResults:"検索に一致する権限がありません"}},users:{title:"ユーザー管理",subtitle:"ユーザーとBambuddyインスタンスへのアクセスを管理",backToSettings:"設定に戻る",createUser:"ユーザーを作成",noPermission:"このページにアクセスする権限がありません。",admin:"管理者",noGroups:"グループなし",active:"アクティブ",inactive:"非アクティブ",edit:"編集",delete:"削除",system:"システム",noGroupsAvailable:"利用可能なグループがありません",table:{username:"ユーザー名",groups:"グループ",status:"ステータス",actions:"アクション"},toast:{created:"ユーザーを作成しました",updated:"ユーザーを更新しました",deleted:"アーカイブを削除しました",fillRequired:"必須項目をすべて入力してください",passwordsDoNotMatch:"パスワードが一致しません",passwordTooShort:"パスワードは6文字以上必要です"},modal:{createUser:"ユーザーを作成",editUser:"ユーザーを編集",cancel:"キャンセル",creating:"作成中...",saving:"保存中...",saveChanges:"変更を保存",advancedAuthSubtitle:"高度な認証を使用"},form:{username:"ユーザー名",usernamePlaceholder:"ユーザー名を入力",email:"メール",emailPlaceholder:"user@example.com",password:"パスワード",passwordPlaceholder:"パスワードを入力",confirmPassword:"パスワードの確認",confirmPasswordPlaceholder:"パスワードを確認",newPasswordPlaceholder:"新しいパスワードを入力",confirmNewPasswordPlaceholder:"新しいパスワードを確認",leaveBlankToKeep:"(現在のパスワードを維持する場合は空白)",groups:"グループ",optional:"オプション",autoGeneratedPassword:"安全なパスワードが自動的に生成され、ユーザーにメールで送信されます。",passwordManagedByAdvancedAuth:"パスワードは高度な認証によって管理されています。「パスワードのリセット」を使用して、メールで新しいパスワードをユーザーに送信してください。",resetPassword:"パスワードのリセット",resettingPassword:"パスワードをリセット中..."},deleteModal:{title:"ユーザーを削除",message:"このユーザーを削除してもよろしいですか?この操作は元に戻せません。",confirm:"ユーザーを削除"}},streamOverlay:{title:"ストリームオーバーレイ",invalidPrinterId:"無効なプリンターID",cameraStream:"カメラストリーム",progress:"進捗",eta:"予想時間 {{minutes}} 分",printerIdle:"プリンター待機中",printerOffline:"プリンターオフライン",status:{printing:"印刷中",paused:"一時停止",finished:"完了",failed:"失敗",idle:"待機中",unknown:"不明"}},profiles:{title:"フィラメントプロファイル",subtitle:"スライサープリセットと圧力キャリブレーションの管理",tabs:{cloud:"クラウドプロファイル",local:"ローカルプロファイル",kprofiles:"Kプロファイル"},localProfiles:{title:"ローカルプロファイル",subtitle:"OrcaSlicerからスライサープリセットをインポート・管理",import:"プロファイルをインポート",importDesc:".bbscfg、.bbsflmt、.orca_filament、.zip、.jsonファイルをここにドロップ",importing:"インポート中...",search:"ローカルプリセットを検索...",noPresets:"ローカルプリセットがまだありません",badge:"ローカル",edit:"編集",delete:"削除",cancel:"キャンセル",deleteConfirmTitle:"プリセットを削除",deleteConfirm:"このプリセットを削除してもよろしいですか?元に戻せません。",source:"ソース",inheritsFrom:"継承元",filamentType:"タイプ",vendor:"メーカー",compatiblePrinters:"プリンター",nozzleTemp:"ノズル温度",cost:"コスト",density:"密度",pressureAdvance:"プレッシャーアドバンス",filament:"フィラメント",process:"プロセス",printer:"プリンター",toast:{importSuccess:"{{count}}件のプリセットをインポートしました",importSkipped:"{{count}}件のプリセットをスキップしました(重複)",importError:"インポート中に{{count}}件のエラーが発生しました",deleted:"プリセットを削除しました",updated:"プリセットを更新しました"}},connectedAs:"接続中:",logout:"ログアウト",noLogoutPermission:"ログアウトする権限がありません",failedToLoad:"ファイルの読み込みに失敗しました",retry:"リトライ",time:{justNow:"たった今",minsAgo:"{{count}}分前",hoursAgo:"{{count}}時間前",daysAgo:"{{count}}日前"},toast:{loggedOut:"ログアウトしました"},login:{title:"Bambuddy ログイン",subtitle:"アカウントにサインイン",email:"メールアドレス",password:"パスワード",region:"リージョン",regionGlobal:"グローバル",regionChina:"中国",verificationCode:"認証コード",totpCode:"認証アプリコード",checkEmail:"メール ({{email}}) に届いた6桁のコードを入力してください",enterTotpHint:"認証アプリの6桁のコードを入力してください",accessToken:"アクセストークン",accessTokenHint:"Bambu Labのアクセストークンを貼り付け(Bambu Studioから取得)",back:"戻る",loginButton:"ログイン",verifyButton:"認証",setTokenButton:"トークンを設定",useToken:"アクセストークンを使用",useEmail:"メールでログイン",toast:{loggedIn:"ログインしました",codeSent:"メールに認証コードを送信しました",enterTotp:"認証アプリのコードを入力してください",tokenSet:"トークンを設定しました"}},presets:{myPreset:"マイプリセット(編集可能)",duplicate:"複製",editable:"編集可能",failedToLoadDetails:"プリセットの詳細を読み込めませんでした",deleteConfirm:"このプロファイルを削除しますか?",deleteWarning:"「{{name}}」をBambu Cloudから完全に削除します。元に戻せません。",noDuplicatePermission:"プリセットを複製する権限がありません",noEditPermission:"プリセットを編集する権限がありません",noDeletePermission:"プロジェクトを削除する権限がありません",types:{filament:"フィラメント",printer:"プリンター",process:"プロセス"},toast:{deleted:"アーカイブを削除しました",created:"プリセットを作成しました",updated:"プリセットを更新しました",duplicated:"プリセットを複製しました",fieldAdded:'フィールド "{{key}}" を追加しました',exported:"プリセットをエクスポートしました"},baseLabel:"ベース: {{name}}",currentLabel:"現在: {{name}}",newPreset:"新規プリセット",editPreset:"プリセットを編集",duplicatePreset:"プリセットを複製",createNewPreset:"新しいプリセットを作成",customizeSettings:"新しいプリセットの設定をカスタマイズ",compareWithBase:"ベースプリセットと比較",compare:"比較",basePreset:"ベースプリセット",selectBasePreset:"ベースプリセットを選択...",presetName:"プリセット名",myCustomPreset:"カスタムプリセット",inheritsFrom:"継承元:",dropJsonToImport:"JSONファイルをドロップしてインポート",tabs:{common:"一般",allFields:"すべてのフィールド"},availableFields:"利用可能なフィールド",searchFieldsPlaceholder:"フィールドを検索...",noMatchingFields:"一致するフィールドがありません",allFieldsAdded:"すべてのフィールドが追加済みです",addCustomField:"カスタムフィールドを追加",yourOverrides:"オーバーライド一覧",noOverridesYet:"オーバーライドはまだありません",clickFieldsToAdd:"左のフィールドをクリックして追加",saveAsTemplate:"テンプレートとして保存",jsonTip:"ヒント: .jsonファイルをこのモーダルにドラッグ&ドロップして設定をインポート"},cloudView:{searchPlaceholder:"プリセットを検索...",templates:"テンプレート",refresh:"更新",newPreset:"新規プリセット",clearFilters:"フィルターをクリア",compareMode:"比較モード",selectAnotherPreset:"同じタイプ({{type}})の別のプリセットを選択",clickTwoPresets:"同じタイプのプリセットを2つクリックして比較",selectFirst:"1. 最初を選択",selectSecond:"2. 2番目を選択",compareNow:"比較を実行",lastSynced:"最終同期:",showingCount:"{{total}}件中{{shown}}件を表示",noPresetsFound:"プリセットが見つかりません",columns:{filament:"フィラメント",process:"プロセス",printer:"プリンター"},noFilamentPresets:"フィラメントプリセットなし",noProcessPresets:"プロセスプリセットなし",noPrinterPresets:"プリンタープリセットなし",filters:{type:"種類",owner:"所有者",printer:"プリンター",nozzle:"ノズル",filament:"フィラメント",layer:"レイヤー",all:"すべて",myPresets:"マイプリセット",builtIn:"ビルトイン",process:"プロセス"},noTemplatesPermission:"テンプレートを管理する権限がありません",noRefreshPermission:"プロファイルを更新する権限がありません",noCreatePermission:"プロジェクトを作成する権限がありません"},templates:{title:"フィラメントプロファイル",noTemplates:"テンプレートがありません。バックエンドを再起動してデフォルトテンプレートを作成してください。",createFirst:"プリセットエディタからテンプレートを作成",typeFilter:"タイプ:",deleteTitle:"テンプレートを削除",deleteWarning:"この操作は元に戻せません",deleteConfirm:"このプロファイルを削除しますか?",namePlaceholder:"テンプレート名",descriptionPlaceholder:"説明",settingsJson:"設定 (JSON)",fieldsCount:"{{count}}フィールド",shownInModals:"モーダルに表示",hiddenInModals:"モーダルで非表示",apply:"適用",toast:{deleted:"アーカイブを削除しました",updated:"テンプレートを更新しました",created:"テンプレートを作成しました",applied:"テンプレートを適用しました"}}},support:{debugLoggingActive:"デバッグログが有効です",manageLogs:"管理",collectItem7:"プリンター接続状態とファームウェアバージョン",collectItem8:"連携状態(Spoolman、MQTT、HA)",collectItem9:"ネットワークインターフェース(サブネットのみ)",collectItem10:"Pythonパッケージバージョン",collectItem11:"データベース健全性チェック",collectItem12:"Docker環境の詳細"},fileManager:{title:"ファイル管理",subtitle:"印刷ファイルの整理と管理",uploadFiles:"ファイルをアップロード",newFolder:"新しいフォルダ",folderName:"フォルダ名",folderNamePlaceholder:"例: 機能パーツ",renameFile:"ファイル名を変更",renameFolder:"フォルダ名を変更",moveFiles:"{{count}}件のファイルを移動",rootNoFolder:"ルート(フォルダなし)",current:"(現在)",linkFolder:"フォルダをリンク",linkFolderDescription:"「{{name}}」をプロジェクトまたはアーカイブにリンクしてすばやくアクセス。",project:"プロジェクト",archive:"アーカイブ",noProjectsFound:"プロジェクトが見つかりません",noArchivesFound:"アーカイブが見つかりません",unlink:"リンク解除",link:"リンク",dragDropFiles:"ファイルをここにドラッグ&ドロップ",dropFilesHere:"ここにファイルをドロップ",orClickToBrowse:"またはクリックして選択",allFileTypesSupported:"すべてのファイルタイプに対応。ZIPファイルは展開されます。",zipFilesDetected:"ZIPファイルを検出",zipExtractOptions:"ZIPファイルは展開されます。フォルダー構造の処理方法を選択:",preserveZipStructure:"ZIPのフォルダ構造を保持",createFolderFromZip:"ZIPファイル名からフォルダーを作成",stlThumbnailGeneration:"STLサムネイル生成",zipMayContainStl:"ZIPファイルにSTLファイルが含まれている場合があります。展開時にサムネイルを生成できます。",thumbnailsCanBeGenerated:"STLファイルのサムネイルを生成できます。大きなモデルは処理に時間がかかる場合があります。",generateThumbnailsForStl:"STLファイルのサムネイルを生成",threemfDetected:"3MFファイルを検出",threemfExtractionInfo:"プリンターモデル、素材、色、印刷設定は3MFファイルから自動的に抽出されます。",willBeExtracted:"• 展開予定",filesExtracted:"• {{count}}個のファイルを展開済み",uploadComplete:"アップロード完了: {{count}}個成功",uploadFailed:"アップロード失敗",zipFilesFailed:"{{count}}個のファイルが失敗",uploading:"アップロード中...",changeLink:"リンクを変更...",linkTo:"リンク先...",linkToProjectOrArchive:"プロジェクトまたはアーカイブにリンク",addToQueue:"キューに追加",schedulePrint:"印刷をスケジュール",generateThumbnail:"サムネイルを生成",generateThumbnails:"サムネイルを生成",generateThumbnailsForMissing:"サムネイルのないSTLファイルのサムネイルを生成",gridView:"グリッド表示",listView:"リスト表示",lowDiskSpaceWarning:"ディスク容量不足の警告",lowDiskSpaceDetails:"{{total}}中{{free}}の空き容量のみ。しきい値は設定で{{threshold}}GBに設定されています。",files:"ファイル",folders:"フォルダ",size:"サイズ",free:"空き:",allFiles:"すべてのファイル",wrap:"折り返し",enableTextWrapping:"テキスト折り返しを有効化",disableTextWrapping:"テキスト折り返しを無効化",dragToResizeTooltip:"ドラッグしてリサイズ、ダブルクリックでリセット",searchFiles:"ファイルを検索...",allTypes:"すべての種類",prints:"印刷回数",ascending:"昇順",descending:"降順",resultsCount:"{{total}}件中{{showing}}件",selectAll:"すべて選択",deselectAll:"すべて選択解除",selected:"{{count}}件選択中",adding:"追加中...",loadingFiles:"ファイルを読み込み中...",folderIsEmpty:"フォルダーは空です",noFilesYet:"ファイルはまだありません",folderEmptyDescription:"ファイルをアップロードするか、このフォルダーにファイルを移動して開始しましょう。",noFilesDescription:"印刷関連ファイルの整理を始めるにはファイルをアップロードしてください。",noMatchingFiles:"一致するファイルがありません",noMatchingFilesDescription:"現在の検索またはフィルター条件に一致するファイルがありません。",clearFilters:"フィルターをクリア",printedCount:"{{count}}回印刷済み",uploadedBy:"アップロード者",deleteFolder:"フォルダを削除",deleteFile:"ファイルを削除",deleteFilesCount:"{{count}}件のファイルを削除",deleteFolderConfirm:"このフォルダを削除しますか?中のファイルもすべて削除されます。",deleteFileConfirm:"このファイルを削除しますか?",deleteFilesConfirm:"選択した{{count}}件のファイルを削除しますか?この操作は元に戻せません。",deleting:"削除中...",noPermissionRenameFolder:"フォルダー名を変更する権限がありません",noPermissionLinkFolder:"フォルダーをリンクする権限がありません",noPermissionDeleteFolder:"フォルダーを削除する権限がありません",noPermissionPrint:"印刷する権限がありません",noPermissionAddToQueue:"キューに追加する権限がありません",noPermissionDownload:"ファイルをダウンロードする権限がありません",noPermissionRenameFile:"このファイル名を変更する権限がありません",noPermissionGenerateThumbnail:"サムネイルを生成する権限がありません",noPermissionDeleteFile:"このファイルを削除する権限がありません",noPermissionCreateFolder:"フォルダーを作成する権限がありません",noPermissionUpload:"ファイルをアップロードする権限がありません",noPermissionMoveFiles:"ファイルを移動する権限がありません",noPermissionDeleteFiles:"ファイルを削除する権限がありません",toast:{folderCreated:"フォルダを作成しました",folderDeleted:"フォルダを削除しました",fileDeleted:"ファイルを削除しました",filesDeleted:"{{count}}件のファイルを削除しました",filesMoved:"ファイルを移動しました",folderLinked:"フォルダをリンクしました",folderUnlinked:"フォルダのリンクを解除しました",addedToQueue:"{{count}}個のファイルをキューに追加しました",addedToQueuePartial:"{{added}}件追加、{{failed}}件失敗",failedToAddToQueue:"ファイルの追加に失敗: {{error}}",fileRenamed:"ファイル名を変更しました",folderRenamed:"フォルダ名を変更しました",thumbnailsGenerated:"{{count}}件のサムネイルを生成しました",thumbnailsGeneratedPartial:"{{succeeded}}件生成、{{failed}}件失敗",noStlMissingThumbnails:"サムネイルのないSTLファイルはありません",failedToGenerateThumbnails:"サムネイルの生成に失敗: {{error}}",thumbnailGenerated:"サムネイルを生成しました",failedToGenerateThumbnail:"サムネイルの生成に失敗: {{error}}"}},projects:{title:"プロジェクト",subtitle:"印刷プロジェクトを管理",newProject:"新規プロジェクト",editProject:"プロジェクトを編集",deleteProject:"プロジェクトを削除",projectName:"プロジェクト: {{name}}",description:"説明",noProjects:"プロジェクトはまだありません",noProjectsFiltered:"{{status}}のプロジェクトはありません",noProjectsFilteredHelp:"{{status}}のプロジェクトがありません。ステータスが変更されるとここに表示されます。",createFirst:"最初のプロジェクトを作成して、関連する印刷の整理、進捗管理、ビルドの管理を始めましょう。",createFirstButton:"最初のプロジェクトを作成",create:"作成",files:"ファイル",prints:"印刷",plates:"プレート",parts:"パーツ",lastModified:"最終更新日",deleteConfirm:"このプロジェクトを削除しますか?アーカイブとキューアイテムはリンク解除されますが、削除されません。",addFiles:"ファイルを追加",removeFile:"ファイルを削除",viewDetails:"詳細を表示",namePlaceholder:"プロジェクト名",descriptionPlaceholder:"プロジェクトの説明(任意)",color:"色",targetPlates:"目標プレート数",targetPlatesPlaceholder:"例: 10",targetPlatesHelp:"印刷ジョブの数",targetParts:"目標パーツ数",targetPartsPlaceholder:"例: 50",targetPartsHelp:"必要なオブジェクトの総数",tagsLabel:"タグ(カンマ区切り)",tagsPlaceholder:"カンマ区切りのタグ",dueDate:"期限",priority:"優先度",priorityLow:"低",priorityNormal:"通常",priorityHigh:"高",priorityUrgent:"緊急",statusActive:"進行中",statusCompleted:"完了",statusArchived:"アーカイブ済み",done:"完了",completed:"完了",failed:"失敗",inQueue:"キュー内",noPrintsYet:"印刷履歴なし",printJobs:"印刷ジョブ",partsPrinted:"印刷済みパーツ",failedParts:"失敗パーツ",import:"インポート",export:"エクスポート",importProject:"プロジェクトをインポート",exportAll:"すべてのプロジェクトをエクスポート",loading:"プロジェクトを読み込み中...",noEditPermission:"プロジェクトを編集する権限がありません",noDeletePermission:"プロジェクトを削除する権限がありません",noCreatePermission:"プロジェクトを作成する権限がありません",noImportPermission:"プロジェクトをインポートする権限がありません",noExportPermission:"プロジェクトをエクスポートする権限がありません",toast:{created:"プロジェクトを作成しました",updated:"プロジェクトを更新しました",deleted:"アーカイブを削除しました",imported:"プロジェクトをインポートしました",multipleImported:"{{count}}件のプロジェクトをインポートしました",importFailed:"インポートに失敗しました",exported:"プロジェクトをエクスポートしました(メタデータのみ)"}},projectDetail:{notFound:"見つかりません",backToProjects:"プロジェクト一覧に戻る",export:"エクスポート",exportProject:"プロジェクトをエクスポート",noExportPermission:"プロジェクトをエクスポートする権限がありません",noEditPermission:"このプロジェクトを編集する権限がありません",partOf:"所属先",priorityLabel:"優先度",noPrints:"このプロジェクトにはまだ印刷がありません",status:{active:"進行中",completed:"完了",archived:"アーカイブ済み"},priority:{low:"低",normal:"通常",high:"高",urgent:"緊急"},dueDate:{overdue:"期限超過",today:"今日が期限",daysLeft:"残り{{count}}日"},progress:{platesProgress:"プレート進捗",partsProgress:"パーツ進捗",printJobs:"印刷ジョブ",parts:"パーツ",percentComplete:"% 完了",remaining:"残り"},stats:{printJobs:"印刷ジョブ",total:"合計",failed:"失敗",partsPrinted:"印刷済みパーツ",printTime:"印刷時間",filamentUsed:"フィラメント使用量"},cost:{title:"コスト追跡",filamentCost:"フィラメント",energy:"エネルギー",budget:"予算",remaining:"残り"},subProjects:{title:"サブプロジェクト ({{count}})"},notes:{title:"メモ",noEditPermission:"このプロジェクトを編集する権限がありません",placeholder:"このプロジェクトについてメモを追加...",empty:"<空>"},files:{title:"ファイル",linkFolders:"ファイルマネージャーからフォルダーをリンク",forQuickAccess:"してクイックアクセスできるようにします。",fileCount:"{{count}}ファイル",empty:"<空>"},bom:{title:"部品表",acquired:"{{completed}}/{{total}} 取得済み",showAll:"すべて表示",hideDone:"完了を非表示",addPart:"パーツを追加",noAddPermission:"パーツを追加する権限がありません",partNamePlaceholder:"パーツ名",partName:"パーツ名",qty:"数量",price:"価格 ({{currency}})",sourcingUrlPlaceholder:"URL(任意)",remarksPlaceholder:"備考",deletePart:"パーツを削除",deleteConfirm:"「{{name}}」を削除しますか?",noUpdatePermission:"パーツを更新する権限がありません",noEditPermission:"このプロジェクトを編集する権限がありません",noDeletePermission:"プロジェクトを削除する権限がありません",totalCost:"合計コスト",empty:"<空>"},timeline:{title:"アクティビティタイムライン",empty:"<空>"},template:{saveAsTemplate:"テンプレートとして保存",noCreatePermission:"プロジェクトを作成する権限がありません"},queue:{title:"印刷キュー",viewAll:"すべて表示",printing:"印刷中",queued:"キューに追加"},prints:{title:"印刷 ({{count}})"},toast:{projectUpdated:"プロジェクトを更新しました",partAdded:"パーツを追加しました",partRemoved:"パーツを削除しました",exportFailed:"エクスポートに失敗しました",projectExported:"プロジェクトがエクスポートされました",templateCreated:"プロジェクトからテンプレートを作成しました"}},system:{title:"システム情報",version:"バージョン",uptime:"稼働時間",cpuUsage:"CPU使用率",memoryUsage:"メモリ使用量",diskUsage:"ディスク使用量",networkInfo:"ネットワーク情報",logs:"ログ",debugMode:"デバッグモード",enableDebug:"デバッグログを有効化",disableDebug:"デバッグログを無効化",downloadLogs:"ログをダウンロード",clearLogs:"通知ログを削除",dockerInfo:"Docker情報",containerName:"コンテナ名",imageName:"イメージ名",platform:"プラットフォーム",architecture:"アーキテクチャ"},library:{title:"フィラメントライブラリ",addFilament:"フィラメントを追加",editFilament:"フィラメントを編集",deleteFilament:"フィラメントを削除",vendor:"メーカー",material:"素材",color:"色",kFactor:"K値",temperature:"温度",noFilaments:"ライブラリにフィラメントがありません",deleteConfirm:"このフィラメントを削除しますか?",importFromPrinter:"プリンターからインポート",exportToFile:"ファイルにエクスポート"},spoolman:{title:"Spoolman連携",enabled:"Spoolman有効",url:"Spoolman URL",connected:"接続中",disconnected:"未接続",testConnection:"接続テスト",sync:"同期",syncing:"同期中...",lastSync:"最終同期",linkToSpoolman:"Spoolmanに連携",openInSpoolman:"Spoolmanで開く",unlinkSpool:"スプールのリンクを解除",unlinkConfirmTitle:"スプールのリンクを解除しますか?",unlinkConfirmMessage:"これにより、スプールがSpoolmanから切断されます。Spoolman内のスプールデータは変更されません。",selectSpool:"スプールを選択",noUnlinkedSpools:"Spoolmanに未連携のスプールが見つかりません。",linkSuccess:"スプールをSpoolmanにリンクしました",linkFailed:"スプールのリンクに失敗しました",unlinkSuccess:"スプールをSpoolmanから解除しました",unlinkFailed:"スプールのリンク解除に失敗しました",spoolId:"スプールID",fillSourceLabel:"(Spoolman)",weight:"重量",remaining:"残り",disableWeightSync:"AMS推定重量同期を無効化",disableWeightSyncDesc:"AMS推定値から残量を更新しません。AMSの割合ベースの推定よりもSpoolmanの使用量追跡を優先する場合に使用してください。新しいスプールは引き続きAMS推定値を初期重量として使用します。",reportPartialUsage:"失敗した印刷の部分使用量を報告",reportPartialUsageDesc:"印刷が失敗またはキャンセルされた場合、レイヤー進捗に基づいてその時点までの推定フィラメント使用量を報告します。"},inventory:{title:"スプール在庫管理",addSpool:"スプールを追加",editSpool:"スプールを編集",material:"素材",selectMaterial:"素材を選択...",subtype:"サブタイプ",brand:"ブランド",searchBrand:"ブランドを検索...",useCustomBrand:"「{{brand}}」を使用",useCustomMaterial:"カスタム素材を使用: {{material}}",colorName:"色名",colorNamePlaceholder:"Jade White, Fire Red...",color:"色",hexColor:"HEXカラー",pickColor:"カスタムカラーを選択",labelWeight:"表示重量",coreWeight:"空スプール重量",searchSpoolWeight:"スプール重量を検索...",weightUsed:"使用量",currentWeight:"残量",measuredWeight:"計測重量",costPerKg:"kgあたりのコスト",measuredWeightError:"計測重量は{{min}}gから{{max}}gの間で入力してください。",slicerFilament:"スライサーフィラメント",slicerFilamentName:"スライサープリセット名",slicerPreset:"スライサープリセット",searchPresets:"フィラメントプリセットを検索...",selectedPreset:"選択済み",noPresetsFound:"プリセットが見つかりません",tempOverrides:"温度オーバーライド",note:"メモ",notePlaceholder:"このスプールに関する追加メモ...",archive:"アーカイブ",restore:"復元",noSpools:"スプールがありません。最初のスプールを追加してください。",noManualSpools:"手動で追加されたスプールがありません。先にインベントリにスプールを追加してください。",kProfiles:"Kプロファイル",addKProfile:"Kプロファイルを追加",assignSpool:"スプールを割り当て",unassignSpool:"割り当て解除",assignSuccess:"スプールを割り当て、AMSスロットを設定しました",assignFailed:"スプールの割り当てに失敗しました",selectSpool:"このスロットに割り当てるスプールを選択",assigned:"割り当て済み",assigning:"割り当て中...",searchSpools:"スプールを検索...",allMaterials:"すべての素材",filterByBrand:"ブランドで絞り込み...",showArchived:"アーカイブ済みを表示",quickAdd:"クイック追加(在庫)",quantity:"数量",stock:"在庫",configured:"設定済み",spoolsCreated:"{{count}}本のスプールを作成しました",spoolCreated:"スプールを作成しました",spoolUpdated:"スプールを更新しました",spoolDeleted:"スプールを削除しました",spoolArchived:"スプールをアーカイブしました",spoolRestored:"スプールを復元しました",deleteConfirm:"このスプールを削除しますか?この操作は元に戻せません。",archiveConfirm:"このスプールをアーカイブしますか?",advancedSettings:"詳細設定",filamentInfoTab:"フィラメント情報",paProfileTab:"PAプロファイル",filamentInfo:"フィラメント",additional:"追加情報",loadingPresets:"クラウドプリセットを読み込み中...",cloudConnected:"クラウド接続済み",cloudNotConnected:"クラウド未接続(デフォルト使用)",recentColors:"最近",searchColors:"色を検索...",searchResults:"検索結果",allColors:"すべての色",commonColors:"一般的な色",showLess:"少なく表示",showAll:"すべて表示",noColorsFound:"一致する色がありません",noResults:"結果なし",selectMaterialFirst:"フィラメント情報タブで素材を選択してください。",noPrintersConfigured:"プリンターが設定されていません。プリンターを追加してください。",matchingFilter:"フィルター",anyBrand:"すべてのブランド",anyVariant:"すべてのバリアント",autoSelect:"自動選択",matches:"件一致",match:"件一致",noMatches:"一致なし",connected:"接続済み",offline:"オフライン",printerOffline:"プリンターがオフラインです。接続してキャリブレーションプロファイルを表示してください。",noKProfilesMatch:"選択したフィラメントに一致するKプロファイルがありません。",leftNozzle:"左ノズル",rightNozzle:"右ノズル",profilesSelected:"キャリブレーションプロファイル選択済み",totalInventory:"在庫合計",totalConsumed:"総消費量",byMaterial:"素材別",inPrinter:"プリンター内",lowStock:"残量少",sinceTracking:"追跡開始以降",loadedInAms:"AMS/Extに装填中",remaining:"残り",weightCheck:"重量チェック",lastWeighed:"最終計量",neverWeighed:"未計量",search:"スプールを検索...",showing:"表示",to:"〜",of:"/",show:"表示",spools:"スプール",spool:"スプール",page:"ページ",noSpoolsMatch:"結果なし",noSpoolsMatchDesc:"検索やフィルターを調整してみてください。",active:"アクティブ",archived:"アーカイブ済み",all:"すべて",used:"使用済み",new:"新規",clearFilters:"フィルターをクリア",table:"テーブル",cards:"カード",net:"正味",groupSimilar:"グループ化",groupedSpools:"{{count}}本の同一スプール",groupedRows:"行",columns:"列",configureColumns:"列の設定",configureColumnsDesc:"ドラッグして並べ替えるか、矢印を使用してください。目のアイコンで表示/非表示を切り替えます。",visible:"表示中",reset:"リセット",cancel:"キャンセル",applyChanges:"変更を適用",moveUp:"上へ移動",moveDown:"下へ移動",hideColumn:"列を非表示",showColumn:"列を表示",linkToSpool:"スプールにリンク",tagLinked:"タグがスプールにリンクされました",tagLinkFailed:"タグのリンクに失敗しました",tagAlreadyLinked:"タグは既に別のスプールにリンクされています",unknownTag:"不明なRFIDタグが検出されました",usageHistory:"使用履歴",noUsageHistory:"まだ使用記録がありません",printName:"プリント名",weightConsumed:"消費重量",clearHistory:"クリア",historyCleared:"使用履歴がクリアされました",fillSourceLabel:"(Inv)",lowStockThresholdError:"しきい値は0.1から99.9の間でなければなりません"},timelapse:{title:"タイムラプス",create:"タイムラプスを作成",download:"ダウンロード",delete:"削除",preview:"プレビュー",frameRate:"フレームレート",quality:"品質",processing:"バックアップファイルを処理中...",noTimelapses:"利用可能なタイムラプスがありません"},ams:{title:"AMS",slot:"スロット",empty:"<空>",emptySlot:"空のスロット",unknown:"不明",humidity:"湿度",temperature:"温度",filamentType:"フィラメントタイプ",filamentColor:"色",remaining:"残り",history:"AMS履歴",noHistory:"メンテナンス履歴がありません",configureSlot:"フィラメントプロファイルとK値でスロットを設定",externalSpool:"外部スプール",profile:"プロファイル",kFactor:"K値",fill:"充填率",configure:"設定",used:"使用済み",remainingUnit:"残り"},printModal:{title:"印刷を開始",selectPrinter:"プリンターを選択",selectPlate:"プレートを選択",filamentMapping:"フィラメントマッピング",totalCost:"合計コスト:",slotRemainingShort:" - 残{{grams}}g",printSettings:"印刷設定",bedLeveling:"ベッドレベリング",flowCalibration:"フローキャリブレーション",vibrationCalibration:"振動キャリブレーション",layerInspection:"第一層検査",timelapse:"タイムラプス",startPrint:"印刷を開始",addToQueue:"キューに追加",cancel:"キャンセル",noPrintersAvailable:"利用可能なプリンターがありません",printerBusy:"プリンターは使用中です",printerOffline:"プリンターはオフラインです",sameTypeDifferentColor:"同じ種類、異なる色",filamentTypeNotLoaded:"フィラメントタイプが未読み込み",openCalendar:"カレンダーを開く",leftNozzle:"L",rightNozzle:"R",leftNozzleTooltip:"左ノズル",rightNozzleTooltip:"右ノズル",filamentOverride:"フィラメントオーバーライド",filamentOverrideHint:"モデルベースの割り当てに使用するフィラメントをオプションで上書きします。スケジューラは元の3MF値ではなく、選択したフィラメントに基づいてマッチングします。",originalFilament:"オリジナル",overrideWith:"変更先",resetToOriginal:"オリジナルに戻す",forceColorMatch:"カラーマッチを強制"},backup:{title:"バックアップと復元",createBackup:"バックアップを作成",restoreBackup:"バックアップの復元",restoreDescription:"バックアップファイルからすべてのデータを置き換える",downloadBackup:"バックアップをダウンロード",uploadBackup:"バックアップをアップロード",lastBackup:"最終バックアップ",autoBackup:"自動バックアップ",backupNow:"今すぐバックアップ",restoreWarning:"警告: バックアップの復元は現在のすべてのデータを上書きします。",includeArchives:"アーカイブを含む",includeSettings:"設定を含む",includeProfiles:"プロファイルを含む",backupSuccess:"バックアップを作成しました",restoreSuccess:"バックアップを復元しました",backupFailed:"バックアップに失敗しました: {{error}}",restoreFailed:"復元に失敗しました",restoreNote:"復元中、仮想プリンターは停止されます",githubBackup:"GitHubバックアップ",enabled:"有効",cloudLoginRequired:"Bambu Cloudログインが必要です。GitHubバックアップを有効にするには、プロファイル → クラウドプロファイルからサインインしてください。",cloudLoginRequiredShort:"Cloudログインが必要",githubDescription:"プロファイルをプライベートGitHubリポジトリに自動的に同期し、バックアップとバージョン履歴を保持します。",repositoryUrl:"リポジトリURL",personalAccessToken:"個人アクセストークン",tokenSaved:"(保存済み)",enterNewToken:"新しいトークンを入力して更新",tokenHint:"Contents読み書き権限を持つきめ細かいトークン",branch:"ブランチ",manualOnly:"手動のみ",hourly:"毎時",daily:"毎日",weekly:"毎週",includeInBackup:"バックアップに含める",kProfiles:"Kプロファイル",kProfilesDescription:"接続されたプリンターからの圧力キャリブレーション",noPrintersConnected:"プリンターが接続されていません",printersConnected:"{{connected}}/{{total}} 接続済み",cloudProfiles:"クラウドプロファイル",cloudProfilesDescription:"Bambu Cloudからのフィラメント、プリンター、プロセスプリセット",appSettings:"アプリ設定",appSettingsDescription:"Bambuddy設定(データベース全体)",lastBackupAt:"最終バックアップ:",noBackupsYet:"バックアップはまだありません",next:"次回:",startingBackup:"バックアップを開始しています...",test:"テスト",enableBackup:"バックアップを有効化",testConnection:"接続テスト",enterRepoUrl:"リポジトリURLを入力してください",enterRepoAndToken:"リポジトリURLとアクセストークンを入力してください",repoRequired:"リポジトリURLは必須です",tokenRequired:"アクセストークンは必須です",githubBackupEnabled:"GitHubバックアップが有効になりました",tokenUpdated:"トークンが更新されました",settingsSaved:"設定が保存されました",failedToSave:"保存に失敗しました: {{message}}",backupCompleteFiles:"バックアップ完了 - {{count}}ファイルが更新されました",backupSkippedNoChanges:"バックアップをスキップ - 変更なし",backupFailed2:"バックアップに失敗しました: {{message}}",clearedLogs:"{{count}}件のログを削除しました",failedToClearLogs:"ログの削除に失敗しました: {{message}}",history:"履歴",clear:"クリア",date:"日付",status:"ステータス",commit:"コミット",localBackup:"ローカルバックアップ",localBackupDescription:"データベース、アーカイブ、アップロード、すべてのファイルを含むBambuddyデータの完全なバックアップを作成します。",downloadBackupLabel:"バックアップをダウンロード",completeBackupZip:"完全バックアップ: データベース + 全ファイル (ZIP)",download:"ダウンロード",preparingBackup:"バックアップを準備しています...",creatingArchive:"バックアップアーカイブを作成しています...大きなアーカイブの場合、時間がかかることがあります。",downloadingFile:"バックアップファイルをダウンロードしています...",backupDownloaded:"バックアップのダウンロードが成功しました",failedToCreateBackup:"バックアップの作成に失敗しました: {{message}}",restore:"復元",restoreReplacesAll:"復元はすべてのデータを置き換えます。",restoreReplacesAllDetail:"現在のデータベースとファイルは完全に置き換えられます。復元後に再起動が必要です。",restoreConfirmTitle:"バックアップを復元",restoreConfirmMessage:'"{{filename}}"から復元してもよろしいですか?現在のデータベースとすべてのファイルが完全に置き換えられます。復元後にアプリケーションの再起動が必要です。',restoreConfirmButton:"バックアップを復元",uploadingFile:"バックアップファイルをアップロードしています...",backupRestoredRestart:"バックアップが復元されました。Bambuddyを再起動してください。",failedToRestore:"バックアップの復元に失敗しました。ファイル形式を確認してください。",reloadNow:"今すぐリロード",creatingBackup:"バックアップを作成中",restoringBackup:"バックアップを復元中",preparing:"準備中...",processing:"処理中...",doNotClosePage:"このページを閉じたり、移動しないでください。大きなバックアップの場合、この操作には数分かかることがあります。",restoring:"復元中...",restoreComplete:"復元完了",restoreFailed2:"復元失敗",importSettings:"バックアップファイルから設定をインポート",pleaseWaitRestoring:"データの復元中です。お待ちください",selectBackupFile:"クリックしてバックアップファイルを選択 (.jsonまたは.zip)",duplicateHandling:"重複処理の仕組み:",matchPrinters:"プリンター",matchPrintersBy:"シリアル番号で照合",matchSmartPlugs:"スマートプラグ",matchSmartPlugsBy:"IPアドレスで照合",matchNotificationProviders:"通知プロバイダー",matchNotificationProvidersBy:"名前で照合",matchFilaments:"フィラメント",matchFilamentsBy:"名前 + タイプ + ブランドで照合",matchArchives:"アーカイブ",matchArchivesBy:"コンテンツハッシュで照合(常にスキップ)",matchPendingUploads:"保留中のアップロード",matchPendingUploadsBy:"ファイル名で照合",matchSettingsTemplates:"設定とテンプレート",matchSettingsTemplatesBy:"常に上書き",replaceExisting:"既存のデータを置き換え",keepExisting:"既存のデータを保持",overwriteDescription:"既に存在する項目をバックアップデータで上書き",keepDescription:"まだ存在しない項目のみ復元",overwriteCaution:"注意:",overwriteWarning:"上書きすると、現在の設定がバックアップのデータで置き換えられます。プリンターのアクセスコードはセキュリティのため上書きされません。",cancel:"キャンセル",processingBackup:"バックアップファイルを処理しています...",itemsRestored:"復元済み",itemsSkipped:"スキップ済み",restored:"復元済み",skippedAlreadyExist:"スキップ(既に存在)",filesCategory:"ファイル(3MF、サムネイルなど)",andMore:"...他{{count}}件",newApiKeysGenerated:"新しいAPIキーが生成されました",keysShownOnce:"これらのキーは一度だけ表示されます。今すぐコピーしてください!",copy:"コピー",noDataFound:"バックアップファイルに復元するデータが見つかりませんでした。",close:"閉じる",categories:{settings:"設定",notification_providers:"通知プロバイダー",notification_templates:"通知テンプレート",smart_plugs:"スマートプラグ",printers:"プリンター",filaments:"フィラメント",maintenance_types:"メンテナンスタイプ",archives:"アーカイブ",projects:"プロジェクト",pending_uploads:"保留中のアップロード",external_links:"外部リンク",api_keys:"APIキー"}},tags:{title:"タグ",addTag:"タグを追加",editTag:"タグを編集",deleteTag:"タグを削除",tagName:"タグ名",tagColor:"タグの色",noTags:"タグがありません",deleteConfirm:"このタグを削除しますか?",manageTags:"タグを管理"},uploadModal:{title:"3MFファイルのアップロード",dragDrop:".3mfファイルをここにドラッグ&ドロップ",or:"または",browseFiles:"ファイルを参照",extractionInfo:"プリンターモデルは3MFファイルのメタデータから自動的に抽出されます。",uploaded:"アップロード済み",failed:"アップロードに失敗しました",uploading:"アップロード中...",upload:"アップロード",uploadFailed:"アップロード失敗"},editArchive:{title:"アーカイブを編集",name:"名前",namePlaceholder:"印刷名",printer:"プリンター",noPrinter:"プリンターなし",project:"プロジェクト",noProject:"プロジェクトなし",itemsPrinted:"印刷数",itemsPrintedHelp:"この印刷ジョブで製造したアイテム数",notes:"メモ",notesPlaceholder:"この印刷についてメモを追加...",externalLink:"外部リンク",externalLinkPlaceholder:"https://...",externalLinkHelp:"Printables、Thingiverse、その他のソースへのリンク",tags:"タグ",tagsPlaceholder:"タグを追加...",addMoreTags:"タグをさらに追加...",matchingTags:'"{{query}}" に一致',existingTags:"既存のタグ",clickToAdd:"(クリックして追加)",status:"ステータス",failureReason:"失敗理由",selectReason:"理由を選択...",photos:"印刷結果の写真",photosHelp:"+ をクリックして印刷結果の写真を追加",printResult:"印刷結果",saving:"保存中...",failureReasons:{adhesionFailure:"定着不良",spaghettiDetached:"スパゲッティ / 剥離",layerShift:"レイヤーシフト",cloggedNozzle:"ノズル詰まり",filamentRunout:"フィラメント切れ",warping:"反り",stringing:"糸引き",underExtrusion:"押出不足",powerFailure:"電源障害",userCancelled:"ユーザーによるキャンセル",other:"その他"},statuses:{completed:"完了",failed:"失敗",aborted:"キャンセル",printing:"印刷中"}},kProfiles:{title:"Kプロファイル",noPrintersConfigured:"プリンターが設定されていません",addPrinterInSettings:"Kプロファイルを管理するには設定でプリンターを追加してください",noActivePrinters:"アクティブなプリンターがありません",enablePrinterConnection:"Kプロファイルを表示するにはプリンター接続を有効にしてください",loadingProfiles:"Kプロファイルを読み込み中...",printerOffline:"プリンターオフライン",printerOfflineDesc:"選択したプリンターは接続されていません。電源を入れてKプロファイルを表示してください。",noMatchingProfiles:"一致するプロファイルなし",noMatchingProfilesDesc:"検索条件に一致するプロファイルがありません",noKProfiles:"Kプロファイルなし",noKProfilesDesc:"{{diameter}}mmノズル用の圧力キャリブレーションプロファイルが見つかりません",createFirstProfile:"最初のプロファイルを作成",printer:"プリンター",nozzle:"ノズル",refresh:"更新",addProfile:"K-プロファイルを追加",export:"エクスポート",import:"インポート",select:"選択",selectAll:"すべて選択",delete:"削除",searchPlaceholder:"名前またはフィラメントで検索...",allExtruders:"すべてのエクストルーダー",leftOnly:"左のみ",rightOnly:"右のみ",allFlow:"すべてのフロー",hfOnly:"HFのみ",sOnly:"Sのみ",sortName:"ソート: 名前",sortKValue:"ソート: K値",sortFilament:"ソート: フィラメント",leftExtruder:"左エクストルーダー",rightExtruder:"右エクストルーダー",modal:{addTitle:"Kプロファイルを追加",editTitle:"Kプロファイルを編集",profileName:"プロファイル名",profileNamePlaceholder:"マイPLAプロファイル",kValue:"K値",kValuePlaceholder:"0.020",kValueHelp:"一般的な範囲: PLA 0.01〜0.06、PETG 0.02〜0.10",filament:"フィラメント",selectFilament:"フィラメントを選択...",noFilamentsHelp:"フィラメントが見つかりません。Bambu Studioでまずプロファイルを作成してください。",flowType:"フロータイプ",highFlow:"ハイフロー",standard:"スタンダード",nozzleSize:"ノズルサイズ",extruder:"エクストルーダー",extruders:"エクストルーダー",left:"左",right:"右",notes:"メモ(ローカル保存)",notesPlaceholder:"このプロファイルのメモを追加...",notesHelp:"メモはBambuddyに保存され、プリンターには保存されません",syncing:"プリンターと同期中...",savingExtruder:"エクストルーダーに保存中 {{current}}/{{total}}...",pleaseWait:"お待ちください"},deleteConfirm:{title:"プロファイルを削除",cannotUndo:"元に戻せません",message:"「{{name}}」をプリンターから削除しますか?"},bulkDelete:{title:"プロファイルを削除",cannotUndo:"元に戻せません",message:"選択した{{count}}件のプロファイルをプリンターから削除しますか?"},toast:{profileSaved:"Kプロファイルを保存しました",profilesSaved:"Kプロファイルを{{count}}台のエクストルーダーに保存しました",selectAtLeastOneExtruder:"エクストルーダーを1つ以上選択してください",profileDeleted:"Kプロファイルを削除しました",profilesDeleted:"{{count}}件のプロファイルを削除しました",exportedProfiles:"{{count}}件のプロファイルをエクスポートしました",importedProfiles:"{{total}}件中{{imported}}件のプロファイルをインポートしました",noProfilesToExport:"エクスポートするプロファイルがありません",invalidFileFormat:"無効なファイル形式",failedToParseImport:"インポートファイルの解析に失敗しました",failedToSaveBatch:"Kプロファイルの保存に失敗しました",noteSaved:"メモを保存しました",failedToSaveNote:"メモの保存に失敗しました"},permission:{noRead:"プロファイルを更新する権限がありません",noCreate:"プロファイルを追加する権限がありません",noUpdate:"Kプロファイルを更新する権限がありません",noDelete:"Kプロファイルを削除する権限がありません",noExport:"プロファイルをエクスポートする権限がありません",noImport:"プロファイルをインポートする権限がありません"}},virtualPrinter:{title:"仮想プリンター",running:"稼働中",stopped:"停止",description:{default:"Bambu StudioとOrcaSlicerに表示される仮想プリンターを有効化。このプリンターに送信されたファイルは印刷せずに直接アーカイブされます。",proxy:"スライサーのトラフィックを実際のプリンターに転送するプロキシを有効化。任意のネットワーク経由でリモート印刷が可能です。"},enable:{title:"仮想プリンターを有効化",visibleInSlicer:"スライサーの検出リストに「Bambuddy」として表示",proxyingTo:"{{name}}にプロキシ中",notActive:"非アクティブ"},model:{title:"プリンターモデル",description:"エミュレートするプリンターモデルを選択。",restartWarning:"モデルを変更すると仮想プリンターが再起動されます"},accessCode:{title:"アクセスコード",isSet:"アクセスコードが設定されています",notSet:"アクセスコード未設定 - 有効化に必要です",placeholder:"8文字のコードを入力",placeholderChange:"新しいコードを入力して変更",hint:"正確に8文字必要です。スライサーの認証に使用されます。",charCount:"({{count}}/8)"},targetPrinter:{title:"ターゲットプリンター",configured:"プロキシターゲット設定済み",notConfigured:"ターゲットプリンター未選択 - プロキシモードに必要です",placeholder:"プリンターを選択...",hint:"スライサートラフィックの転送先プリンターを選択。プリンターはLANモードである必要があります。",noPrinters:"プリンターが設定されていません。プロキシモードを使用するにはまずプリンターを追加してください。"},remoteInterface:{title:"ネットワークインターフェース上書き",configured:"インターフェース上書き有効",optional:"オプション — 自動検出IPが間違っている場合に使用(複数NIC、Docker、VPNなど)",placeholder:"自動検出(デフォルト)...",hint:"SSDPで広告され、TLS証明書に使用されるIPアドレスを上書きします。Bambuddyに複数のネットワークインターフェースがある場合に便利です。"},mode:{title:"モード",archive:"アーカイブ",archiveDesc:"ファイルを即座にアーカイブ",review:"レビュー",reviewDesc:"アーカイブ前にレビュー",queue:"キュー",queueDesc:"アーカイブしてキューに追加",proxy:"プロキシ",proxyDesc:"実際のプリンターに転送"},autoDispatch:{title:"自動ディスパッチ",description:"キューに追加されたときに自動的に印刷を開始します。オフの場合、手動ディスパッチを待ちます。"},setupRequired:{title:"セットアップが必要です",description:"仮想プリンター機能を使用するには追加のシステム設定が必要です。ポートフォワーディング、ファイアウォールルール、プラットフォーム固有の設定が含まれます。",readGuide:"有効にする前にセットアップガイドをお読みください"},howItWorks:{title:"仕組み",step1:"同じLAN上では、仮想プリンターはスライサー(Bambu Studio / OrcaSlicer)に自動的に表示されます。他のネットワークからは、IPアドレスとアクセスコードで手動で追加してください。",step2:"アーカイブ、レビュー、キューモードでは、スライサーの「送信」ボタンを使用して3MFファイルをBambuddyにアップロードします。スライサーは「印刷成功」と表示しますが、ファイルは保存され、印刷はされません。",step3:"プロキシモードでは、仮想プリンターはすべてのトラフィックを実際のプリンターに転送します。直接接続されているかのように印刷がすぐに開始されます。"},status:{title:"ステータス詳細",printerName:"プリンター名",model:"モデル",serialNumber:"シリアル番号",mode:"モード",pendingFiles:"保留中のファイル",targetPrinter:"ターゲットプリンター",ftpPort:"FTPポート",mqttPort:"MQTTポート",ftpConnections:"FTP接続数",mqttConnections:"MQTT接続数"},toast:{updated:"仮想プリンター設定を更新しました",failedToUpdate:"設定の更新に失敗しました",accessCodeRequired:"先にアクセスコードを設定してください",targetPrinterRequired:"先にターゲットプリンターを選択してください",bindIpRequired:"先にバインドIPを設定してください",accessCodeEmpty:"アクセスコードは空にできません",accessCodeLength:"アクセスコードは8文字である必要があります",created:"仮想プリンターを作成しました",failedToCreate:"仮想プリンターの作成に失敗しました",deleted:"仮想プリンターを削除しました",failedToDelete:"仮想プリンターの削除に失敗しました"},list:{title:"仮想プリンター",add:"追加",addFirst:"仮想プリンターを追加",empty:"仮想プリンターが設定されていません。追加して始めましょう。"},bindIp:{title:"バインドインターフェース",placeholder:"インターフェースを選択...",hint:"この仮想プリンターがバインドするネットワークインターフェース。プリンターごとに一意である必要があります。"},proxy:{accessCodeHint:"プロキシモードでは、スライサーにターゲットプリンターのアクセスコードを使用してください。接続は実際のプリンターに透過的に転送されます。"},addDialog:{title:"仮想プリンターを追加",name:"名前",hint:"アクセスコード、ターゲットプリンター、その他の設定は作成後に設定できます。",create:"作成"},deleteConfirm:{title:"仮想プリンターを削除",message:"「{{name}}」を削除してもよろしいですか?このプリンターのすべてのサービスが停止されます。"}},modelViewer:{openInSlicer:"スライサーで開く",tabs:{model:"3Dモデル",gcode:"G-codeプレビュー"},notAvailable:"利用不可",notSliced:"未スライス",plates:"プレート",allPlates:"全プレート",plateNumber:"プレート {{number}}",plateCount:"{{count}} プレート",plateCount_other:"{{count}} プレート",objectCount:"{{count}} オブジェクト",objectCount_other:"{{count}} オブジェクト",filamentCount:"{{count}} フィラメント",filamentCount_other:"{{count}} フィラメント",eta:"予想時間 {{minutes}} 分",noPreview:"このファイルのプレビューは利用できません",pagination:{pageOf:"ページ {{current}} / {{total}}",prev:"前へ",next:"次へ"},errors:{failedToLoad:"ファイルの読み込みに失敗しました",noMeshes:"3MFファイルにメッシュが見つかりません",unsupportedFormat:"サポートされていないファイル形式です"}},maintenanceDescriptions:{lubricateCarbonRods:"カーボンロッドに潤滑剤を塗布してスムーズな動きを確保",lubricateRails:"リニアレールの潤滑",cleanNozzle:"ノズル/ホットエンドの清掃",checkBelts:"ベルト張力の確認",cleanBuildPlate:"ビルドプレートの清掃",checkExtruder:"エクストルーダーギアの確認",checkCooling:"冷却ファンの確認",generalInspection:"総合点検",cleanCarbonRods:"カーボンロッドの清掃",lubricateSteelRods:"スチールロッドに潤滑剤を塗布してスムーズな動きを確保",cleanSteelRods:"スチールロッドの清掃",cleanLinearRails:"リニアレールを拭いてほこりや汚れを除去",checkPtfeTube:"PTFEチューブの確認",replaceHepaFilter:"HEPAフィルター交換",replaceCarbonFilter:"カーボンフィルター交換",lubricateLeftNozzleRail:"左ノズルレールの潤滑"},smartPlugs:{offline:"オフライン",admin:"管理",openPlugAdminPage:"プラグ管理ページを開く",deleteSmartPlug:"スマートプラグを削除",turnOnSmartPlug:"スマートプラグをオンにする",turnOffSmartPlug:"スマートプラグをオフにする",turnOn:"オンにする",turnOff:"オフにする",addSmartPlug:{scanningNetwork:"ネットワークをスキャン中...",chooseEntity:"エンティティを選択...",connectionFailed:"接続失敗",searchEntities:"エンティティを検索...",searchPowerSensors:"電力センサーを検索...",searchEnergySensors:"エネルギーセンサーを検索...",placeholders:{plugName:"リビングルームプラグ",mqttStateOnValue:"ON, true, 1",mqttSameAsPower:"電力トピックと同じ、または異なる"}},linkedTo:"リンク先:",monitorOnly:"監視のみ",alerts:"アラート",scheduleOn:"オン {{time}}",scheduleOff:"オフ {{time}}",on:"オン",off:"オフ",power:"電力",kwhToday:"本日のkWh",settings:"設定",automationSettings:"自動化設定",showInSwitchbar:"スイッチバーに表示",quickAccessSidebar:"サイドバーからクイックアクセス",enabled:"有効",enableAutomation:"このプラグの自動化を有効にする",autoOn:"自動オン",autoOnDescription:"印刷開始時にオンにする",autoOff:"自動オフ",autoOffDescription:"印刷完了時にオフにする(ワンショット)",turnOffDelayMode:"オフ遅延モード",time:"時間",temp:"温度",delayMinutes:"遅延(分)",tempThreshold:"温度しきい値(°C)",tempThresholdDescription:"ノズルがこの温度以下に冷却されるとオフになります",edit:"編集",deleteConfirm:'"{{name}}"を削除してもよろしいですか?この操作は取り消せません。',turnOnConfirm:'"{{name}}"をオンにしてもよろしいですか?',turnOffConfirm:'"{{name}}"をオフにしてもよろしいですか?接続されたデバイスの電源が切れます。',failedToTurn:'"{{name}}"を{{action}}できませんでした',unknown:"不明",addTitle:"スマートプラグを追加",editTitle:"スマートプラグを編集",stopScanning:"スキャン停止",discoverTasmota:"Tasmotaデバイスを検出",foundDevices:"{{count}}台のデバイスが見つかりました - クリックして選択:",noDevicesFound:"ネットワーク上にTasmotaデバイスが見つかりません",haNotConfigured:"Home Assistantが設定されていません。設定場所:",haSettingsPath:"設定 → ネットワーク → Home Assistant",selectEntity:"エンティティを選択 *",ipAddress:"IPアドレス *",nameLabel:"名前 *",username:"ユーザー名",password:"パスワード",authHint:"Tasmotaデバイスが認証を必要としない場合は空のままにしてください",linkToPrinter:"プリンターにリンク",noPrinter:"プリンターなし(手動制御のみ)",linkingDescription:"リンクすると印刷開始/完了時に自動でオン/オフできます",powerAlerts:"電力アラート",alertAbove:"上限アラート(W)",alertBelow:"下限アラート(W)",alertDescription:"電力消費がこれらのしきい値を超えた場合に通知します。無効にするには空のままにしてください。",dailySchedule:"デイリースケジュール",turnOnAt:"オンにする時刻",turnOffAt:"オフにする時刻",scheduleDescription:"毎日これらの時刻にプラグを自動的にオン/オフします。スキップするには空のままにしてください。",showOnPrinterCard:"プリンターカードに表示",displayOnPrinterCard:"プリンターカードにボタンを表示",connectedResult:"接続成功!",deviceLabel:"デバイス: {{name}} - ",stateLabel:"状態: {{state}}",test:"テスト",delete:"削除",save:"保存",add:"追加",cancel:"キャンセル",failedToStartScan:"スキャンを開始できませんでした",nameRequired:"名前は必須です",entityRequired:"Home AssistantプラグにはエンティティIDが必要です",mqttTopicRequired:"電力、エネルギー、または状態監視用に少なくとも1つのMQTTトピックを設定する必要があります",loadingEntities:"エンティティを読み込み中...",loading:"読み込み中...",failedToLoadEntities:"エンティティの読み込みに失敗しました: {{error}}",noEntitiesMatching:'"{{search}}"に一致するエンティティが見つかりません',noEntitiesAvailable:"利用可能なエンティティがありません",searchingEntities:"すべてのエンティティを検索中({{count}}件見つかりました)",showingEntities:"switch、light、input_booleanを表示({{count}}件利用可能)",energyMonitoringOptional:"エネルギー監視(オプション)",energyMonitoringHint:"電力/エネルギーデータを提供するセンサーを検索して選択します。",powerSensorW:"電力センサー(W)",energyTodayKwh:"本日のエネルギー(kWh)",totalEnergyKwh:"総エネルギー(kWh)",noMatchingSensors:"一致するセンサーがありません",none:"なし",mqttNotConfigured:"MQTTブローカーが設定されていません。ブローカーアドレスを設定してください:",mqttSettingsPath:"設定 → ネットワーク → MQTT配信",mqttNotConfiguredSuffix:"(配信を有効にする必要はありません。ブローカーの詳細を入力するだけです)。",mqttMonitorOnlyDescription:"MQTTプラグはMQTTサブスクリプション経由で電力/エネルギーデータを受信します。オン/オフ制御は利用できません - MQTTブローカーまたはホームオートメーションシステムを使用してください。",powerMonitoring:"電力監視",energyMonitoring:"エネルギー監視",stateMonitoring:"状態監視",optional:"オプション",topic:"トピック",jsonPath:"JSONパス",multiplier:"乗数",onValue:"ON値",mqttPowerHint:`JSONパスはJSONペイロードから値を抽出します(例: "power_l1")。トピックが生の数値を送信する場合は空のままにしてください。
- 乗数: mW→Wは0.001、kW→Wは1000を使用。`,mqttEnergyHint:`JSONパスはJSONペイロードから値を抽出します。生の値の場合は空のままにしてください。
- 乗数: Wh→kWhは0.001、MWh→kWhは1000を使用。`,mqttStateHint:`JSONパスはJSONペイロードから値を抽出します。生の値の場合は空のままにしてください。
- ON値: "ON"を意味する正確な文字列。自動検出(ON、true、1)の場合は空のままにしてください。`,noSwitchesInSwitchbar:"スイッチバーにスイッチがありません",enableSwitchbarHint:"設定 > スマートプラグで「スイッチバーに表示」を有効にしてください"},notifications:{providerTypes:{callmebot:"CallMeBot/WhatsApp",ntfy:"ntfy",pushover:"Pushover",telegram:"Telegram",email:"メール",discord:"Discord",webhook:"Webhook",homeassistant:"Home Assistant"},providerDescriptions:{email:"SMTPメール通知",telegram:"Telegramボット経由の通知",discord:"Webhook経由でDiscordチャンネルに送信",ntfy:"無料のセルフホスト可能なプッシュ通知",pushover:"シンプルで信頼性の高いプッシュ通知",callmebot:"CallMeBot経由の無料WhatsApp通知",webhook:"任意のURLへの汎用HTTP POST",homeassistant:"Home Assistantダッシュボードの永続通知"},lastSuccess:"最終: {{date}}",error:"エラー",printer:"プリンター:",allPrinters:"すべてのプリンター",sendTestNotification:"テスト通知を送信",eventSettings:"イベント設定",enabled:"有効",sendFromProvider:"このプロバイダーから通知を送信",printEvents:"印刷イベント",printerStatus:"プリンターステータス",amsAlarms:"AMSアラーム",amsHtAlarms:"AMS-HTアラーム",printQueue:"印刷キュー",start:"開始",plateCheck:"プレートチェック",complete:"完了",failed:"失敗",stopped:"停止",progress:"進捗",offline:"オフライン",lowFilament:"フィラメント残量低下",maintenance:"メンテナンス",amsHumidity:"AMS湿度",amsTemp:"AMS温度",amsHtHumidity:"AMS-HT湿度",amsHtTemp:"AMS-HT温度",bedCooled:"ベッド冷却済み",quiet:"静音",digest:"ダイジェスト {{time}}",printStarted:"印刷開始",plateNotEmpty:"プレートが空でない",plateNotEmptyDescription:"印刷前にオブジェクトが検出されました",printCompleted:"印刷完了",bedCooledLabel:"ベッド冷却済み",bedCooledDescription:"印刷後にベッドがしきい値以下に冷却",printFailed:"印刷失敗",printStopped:"印刷停止",progressMilestones:"進捗マイルストーン",progressMilestonesDescription:"25%、50%、75%で通知",printerOffline:"プリンターオフライン",printerError:"プリンターエラー",lowFilamentLabel:"フィラメント残量低下",maintenanceDue:"メンテナンス期限",maintenanceDueDescription:"メンテナンスが必要な場合に通知",amsHumidityHigh:"AMS湿度高",amsHumidityHighDescription:"通常AMSの湿度がしきい値を超過",amsTemperatureHigh:"AMS温度高",amsTemperatureHighDescription:"通常AMSの温度がしきい値を超過",amsHtHumidityHigh:"AMS-HT湿度高",amsHtHumidityHighDescription:"AMS-HTの湿度がしきい値を超過",amsHtTemperatureHigh:"AMS-HT温度高",amsHtTemperatureHighDescription:"AMS-HTの温度がしきい値を超過",jobAdded:"ジョブ追加",jobAddedDescription:"キューにジョブが追加されました",jobAssigned:"ジョブ割り当て",jobAssignedDescription:"モデルベースのジョブがプリンターに割り当てられました",jobStarted:"ジョブ開始",jobStartedDescription:"キュージョブの印刷が開始されました",jobWaiting:"ジョブ待機中",jobWaitingDescription:"フィラメント待ちのジョブ",jobSkipped:"ジョブスキップ",jobSkippedDescription:"ジョブがスキップされました(前のジョブが失敗)",jobFailed:"ジョブ失敗",jobFailedDescription:"ジョブの開始に失敗しました",queueComplete:"キュー完了",queueCompleteDescription:"すべてのキュージョブが完了しました",quietHours:"静音時間",noNotificationsDuring:"この時間帯は通知を送信しません",editProviderToChangeQuietHours:"プロバイダーを編集して静音時間を変更",dailyDigest:"デイリーダイジェスト",batchNotifications:"通知をまとめて1日のサマリーとして送信",sendAt:"{{time}}に送信",editProviderToChangeDigestTime:"プロバイダーを編集してダイジェスト時刻を変更",edit:"編集",deleteProvider:"通知プロバイダーを削除",deleteConfirm:'"{{name}}"を削除してもよろしいですか?この操作は取り消せません。',delete:"削除",addTitle:"通知プロバイダーを追加",editTitle:"通知プロバイダーを編集",nameLabel:"名前 *",namePlaceholder:"マイ通知",providerTypeLabel:"プロバイダータイプ *",configuration:"設定",testConfiguration:"設定をテスト",printerFilter:"プリンターフィルター",onlyFromPrinter:"このプリンターからのイベントのみ通知を送信",quietHoursDnd:"静音時間(おやすみモード)",quietStart:"開始",quietEnd:"終了",dailyDigestLabel:"デイリーダイジェスト",sendDigestAt:"ダイジェスト送信時刻",digestCollected:"イベントが収集され、この時刻にまとめて送信されます",notificationEvents:"通知イベント",progressPercent:"(25%、50%、75%)",bedCooledAfterPrint:"(印刷完了後)",cancel:"キャンセル",save:"保存",add:"追加",nameRequired:"名前は必須です",fieldRequired:"{{field}}は必須です",phoneNumber:"電話番号",apiKey:"APIキー",serverUrl:"サーバーURL",topic:"トピック",authToken:"認証トークン",userKey:"ユーザーキー",appToken:"アプリトークン",priority:"優先度",botToken:"ボットトークン",chatId:"チャットID",smtpServer:"SMTPサーバー",smtpPort:"SMTPポート",security:"セキュリティ",authentication:"認証",username:"ユーザー名",password:"パスワード",fromEmail:"送信元メール",toEmail:"宛先メール",webhookUrl:"Webhook URL",payloadFormat:"ペイロード形式",authorization:"認可",titleFieldName:"タイトルフィールド名",messageFieldName:"メッセージフィールド名",editTemplate:"テンプレートを編集: {{name}}",titleLabel:"タイトル",bodyLabel:"本文",titlePlaceholder:"通知タイトル...",bodyPlaceholder:"通知本文...",availableVariables:"利用可能な変数",clickToInsert:"クリックして本文のカーソル位置に挿入",livePreview:"ライブプレビュー",hide:"非表示",show:"表示",loadingPreview:"プレビューを読み込み中...",enterTemplateContent:"テンプレートの内容を入力するとプレビューが表示されます",titlePreview:"タイトル:",bodyPreview:"本文:",resetToDefault:"デフォルトにリセット",titleRequired:"タイトルは必須です",bodyRequired:"本文は必須です",notificationLog:"通知ログ",showFailedOnly:"失敗のみ",last24Hours:"過去24時間",last7Days:"過去7日間",last30Days:"過去30日間",last90Days:"過去90日間",justNow:"たった今",noFailedNotifications:"失敗した通知はありません",noNotificationsLogged:"記録された通知はありません",unknownProvider:"不明なプロバイダー",logTitle:"タイトル",logMessage:"メッセージ",logError:"エラー",logProvider:"プロバイダー: {{type}}",logTime:"時刻: {{time}}",refresh:"更新",clearOld:"古いものを削除",statsSummary:"過去{{days}}日間:",statsNotifications:"通知",statsSent:"{{count}}件送信",statsFailed:"{{count}}件失敗",eventTypes:{print_start:"印刷開始",print_complete:"印刷完了",print_failed:"印刷失敗",print_stopped:"印刷停止",print_progress:"進捗",printer_offline:"プリンターオフライン",printer_error:"プリンターエラー",filament_low:"フィラメント残量低下",maintenance_due:"メンテナンス期限",test:"テスト"}},richTextEditor:{bold:"太字",italic:"斜体",underline:"下線",bulletList:"箇条書きリスト",numberedList:"番号付きリスト",alignLeft:"左揃え",alignCenter:"中央揃え",alignRight:"右揃え",addLink:"リンクを追加",removeLink:"リンクを削除"},externalLinks:{noLinksConfigured:"外部リンクが設定されていません",deleteLink:"リンクを削除",removeCustomIcon:"カスタムアイコンを削除",openInNewTab:"新しいタブで開く",placeholders:{linkName:"マイリンク"}},keyboardShortcuts:{title:"キーボードショートカット",navigation:"ナビゲーション",archivesSection:"アーカイブ",kProfilesSection:"Kプロファイル",generalSection:"全般",shortcuts:{goToPrinters:"プリンターへ移動",goToArchives:"アーカイブへ移動",goToQueue:"キューへ移動",goToStats:"統計へ移動",goToProfiles:"クラウドプロファイルへ移動",goToSettings:"設定へ移動",focusSearch:"検索にフォーカス",openUploadModal:"アップロードモーダルを開く",clearSelection:"選択をクリア / 入力をぼかす",contextMenu:"カードのコンテキストメニュー",refreshProfiles:"プロファイルを更新",newProfile:"新しいプロファイル",exitSelectionMode:"選択モードを終了",showHelp:"このヘルプを表示"},footer:"Escキーを押すか外側をクリックして閉じます"},notificationLog:{title:"通知ログ",events:{printStarted:"印刷開始",printComplete:"印刷完了",printFailed:"印刷失敗",printStopped:"印刷停止",progress:"進捗",printerOffline:"プリンターオフライン",printerError:"プリンターエラー",lowFilament:"フィラメント残量低下",maintenanceDue:"メンテナンス期限",test:"テスト"},timeAgo:{justNow:"たった今",minutesAgo:"{{minutes}}分前",hoursAgo:"{{hours}}時間前"}},restoreBackup:{title:"バックアップを復元",restoring:"復元中...",restoreComplete:"復元完了",restoreFailed:"復元失敗",importSettings:"バックアップファイルから設定をインポート",pleaseWait:"データの復元中です。しばらくお待ちください",clickToSelect:"クリックしてバックアップファイルを選択(.jsonまたは.zip)",howDuplicateHandling:"重複の処理方法:",categories:{printers:"プリンター",smartPlugs:"スマートプラグ",notificationProviders:"通知プロバイダー",filaments:"フィラメント",archives:"アーカイブ",pendingUploads:"保留中のアップロード",settingsTemplates:"設定とテンプレート"},matchingInfo:{printers:"シリアル番号で照合",smartPlugs:"IPアドレスで照合",notificationProviders:"名前で照合",filaments:"名前+タイプ+ブランドで照合",archives:"コンテンツハッシュで照合",pendingUploads:"ファイル名で照合",settingsTemplates:"常に上書き"},replaceExisting:"既存データを置き換え",keepExisting:"既存データを保持",replaceDescription:"既に存在するアイテムをバックアップデータで上書き",keepDescription:"まだ存在しないアイテムのみを復元",caution:"注意:",cautionText:"上書きすると現在の構成がバックアップデータに置き換えられます。セキュリティ上の理由から、プリンターのアクセスコードは上書きされません。",itemsRestored:"復元されたアイテム",itemsSkipped:"スキップされたアイテム",restored:"復元済み",skipped:"スキップ(既に存在)",filesLabel:"ファイル(3MF、サムネイルなど)",newApiKeysGenerated:"新しいAPIキーが生成されました",newApiKeysWarning:"これらのキーは一度だけ表示されます。今すぐコピーしてください!",processingBackup:"バックアップファイルを処理中...",noDataFound:"バックアップファイルに復元するデータが見つかりませんでした。",failedToRestore:"バックアップの復元に失敗しました。ファイル形式を確認してください。"},backupExport:{title:"バックアップをエクスポート",selectData:"含めるデータを選択",selectAll:"すべて選択",selectNone:"なし",categoryDescriptions:{settings:"言語、テーマ、更新設定",notifications:"ntfy、Pushover、Discordなど",templates:"カスタムメッセージテンプレート",smartPlugs:"Tasmotaプラグ設定",externalLinks:"サイドバーの外部サービスへのリンク",printers:"プリンター情報(アクセスコード除外)",plateDetection:"空プレート参照画像",filaments:"フィラメントの種類とコスト",maintenance:"カスタムメンテナンススケジュール",archives:"すべての印刷データ+ファイル(3MF、サムネイル、写真)",projects:"プロジェクト、BOMアイテム、添付ファイル",pendingUploads:"仮想プリンターアップロード待機中",apiKeys:"Webhook APIキー(インポート時に新しいキーが生成されます)"},requiresPrinters:"プリンターを選択する必要があります",zipFileWarning:"ZIPファイルが作成されます。",zipFileDescription:"すべての3MFファイル、サムネイル、タイムラプス、写真が含まれます。これには時間がかかり、大きなファイルになる可能性があります。",includeAccessCodes:"アクセスコードを含める",includeAccessCodesDescription:"別のマシンへの転送用",includeAccessCodesWarning:"アクセスコードはプレーンテキストで含まれます。このバックアップファイルを安全に保管してください!",categoriesSelected:"{{selectedCount}}カテゴリー選択済み"},pendingUploads:{placeholders:{notes:"この印刷に関するメモを追加..."},discardUpload:"アップロードを破棄",archiveAllUploads:"すべてのアップロードをアーカイブ",discardAllUploads:"すべてのアップロードを破棄",archive:"アーカイブ",timeAgo:{justNow:"たった今",minutesAgo:"{{minutes}}分前",hoursAgo:"{{hours}}時間前",daysAgo:"{{days}}日前"}},apiBrowser:{placeholders:{requestBody:"JSONリクエストボディ...",searchEndpoints:"エンドポイントを検索..."}},configureAmsSlot:{title:"AMSスロットの設定",slotConfigured:"スロットを設定しました!",configuringSlot:"スロットを設定中:",slotLabel:"{{ams}} スロット {{slot}}",searchPresets:"プリセットを検索...",colorPlaceholder:"色名またはHex(例: 茶色、FF8800)",clearCustomColor:"カスタム色をクリア",noCloudPresets:"クラウドプリセットがありません。Bambu Cloudにログインして同期してください。",noPresetsAvailable:"プリセットがありません。Bambu Cloudにログインするか、ローカルプロファイルをインポートしてください。",noMatchingPresets:"一致するプリセットが見つかりません。",custom:"カスタム",builtin:"内蔵",settingsSentToPrinter:"設定をプリンターに送信しました",filamentProfile:"フィラメントプロファイル",kProfileLabel:"Kプロファイル(Pressure Advance)",filteringFor:"フィルター中: {{material}}",noKProfile:"Kプロファイルなし(デフォルト0.020を使用)",noMatchingKProfiles:"一致するKプロファイルが見つかりません。デフォルトK=0.020が使用されます。",selectFilamentFirst:"まずフィラメントプロファイルを選択してください",kFromCalibration:"K={{value}}(プリンターキャリブレーションから)",customColorLabel:"カスタム色(オプション)",presetColors:"{{name}}の色:",showLessColors:"色を減らす",showMoreColors:"色をもっと表示",clear:"クリア",hexLabel:"Hex: #{{hex}}",resetting:"リセット中...",resetSlot:"スロットをリセット",cancel:"キャンセル",configuring:"設定中...",configureSlot:"スロットを設定"},githubBackup:{title:"GitHubバックアップ",history:"履歴",downloadBackup:"バックアップをダウンロード",restoreBackup:"バックアップを復元",noBackupsYet:"バックアップはまだありません"},emailSettings:{placeholders:{fromName:"BamBuddy"}},tagManagement:{searchTags:"タグを検索...",renameTag:"タグ名を変更",deleteTag:"タグを削除"},notificationTemplates:{placeholders:{title:"通知タイトル...",body:"通知本文..."}},batchTag:{placeholders:{newTag:"新しいタグを入力..."}},photoGallery:{deletePhoto:"写真を削除"},filamentHoverCard:{copySpoolUuid:"スプールUUIDをコピー"},kProfilesView:{hasNote:"メモあり",copyProfile:"プロファイルをコピー"},layout:{openMenu:"メニューを開く",noPermissionSystemInfo:"システム情報を表示する権限がありません"},dashboard:{dragToReorder:"ドラッグして並べ替え",hideWidget:"ウィジェットを非表示"},notificationProviderCard:{deleteNotificationProvider:"通知プロバイダーを削除"},fileManagerModal:{closeFileManager:"ファイルマネージャーを閉じる",sortFiles:"ファイルを並べ替え",goToParentFolder:"親フォルダーへ移動",threeView:"3Dビュー"},embeddedCameraViewer:{refreshStream:"ストリームを更新",close:"閉じる",zoomOut:"ズームアウト",resetZoom:"ズームをリセット",zoomIn:"ズームイン",dragToResize:"ドラッグしてサイズ変更"},timelapseViewer:{skipBack5s:"5秒戻る",skipForward5s:"5秒進む"},notificationProviders:{descriptions:{email:"SMTP電子メール通知",telegram:"Telegramボット経由の通知",discord:"Webhookを介してDiscordチャンネルに送信",ntfy:"無料でセルフホスト可能なプッシュ通知",pushover:"シンプルで信頼性の高いプッシュ通知",callmebot:"CallMeBot経由の無料WhatsApp通知",webhook:"任意のURLへのジェネリックHTTP POST"}},logViewer:{searchPlaceholder:"メッセージまたはロガー名を検索...",noLogEntries:"ログエントリが見つかりません"},switchbarPopover:{noSwitchesInSwitchbar:"スイッチバーにスイッチがありません"},projectPageModal:{placeholders:{title:"タイトル",designer:"デザイナー",license:"ライセンス",description:"説明を入力...",profileTitle:"プロファイルタイトル",profileDescription:"プロファイルの説明..."}},spoolmanSettings:{},time:{unknown:"-",waiting:"待機中",justNow:"たった今",now:"今すぐ",minsAgo:"{{count}}分前",inMins:"あと{{count}}分",hoursAgo:"{{count}}時間前",inHours:"あと{{count}}時間",daysAgo:"{{count}}日前",inDays:"あと{{count}}日"},spoolbuddy:{nav:{dashboard:"ダッシュボード",ams:"AMS",inventory:"インベントリ",writeTag:"書込み",settings:"設定"},status:{nfcReady:"NFC準備完了",nfcOff:"NFCオフ",offline:"オフライン",online:"オンライン",noPrinters:"プリンターなし",deviceOffline:"デバイスオフライン",waitingConnection:"デバイス接続を待っています...",systemReady:"システム準備完了",status:"ステータス"},dashboard:{readyToScan:"スキャン準備完了",idleMessage:"スプールを計量台に置いて識別します",nfcHint:"NFCタグは自動的に読み取られます",device:"デバイス",syncWeight:"重量同期",weightSynced:"同期完了!",unknownTag:"不明なタグ",newTag:"新しいタグを検出",onScale:"計量中",linkSpool:"スプールにリンク",linkTagTitle:"タグをスプールにリンク",linkTag:"タグをリンク",selectSpool:"このタグにリンクするスプールを選択:",noUntagged:"タグなしのスプールが見つかりません",tagDetected:"タグ検出",noTag:"タグなし",tagId:"タグ",grossWeight:"総重量",spoolSize:"スプールサイズ",close:"閉じる",currentSpool:"現在のスプール"},modal:{spoolDetected:"スプール検出",assignToAms:"AMSに割り当て",syncWeight:"重量同期",weightSynced:"同期完了!",syncing:"同期中...",newTagDetected:"新しいタグを検出",addToInventory:"インベントリに追加",assignToAmsTitle:"AMSに割り当て",selectSlot:"スロットを選択",assign:"割り当て",assigning:"割り当て中...",assignSuccess:"割り当て完了!",assignError:"スプールの割り当てに失敗しました。再試行してください。",noPrinterSelected:"プリンターを選択...",noAmsDetected:"このプリンターにAMSが検出されません",slot:"スロット"},weight:{noReading:"読み取りなし",stable:"安定",measuring:"計測中...",tare:"風袋引き",calibrate:"キャリブレーション"},spool:{remaining:"残量",material:"素材",brand:"ブランド",color:"色",coreWeight:"コア",labelWeight:"ラベル",scaleWeight:"計量",netWeight:"正味",lastUsed:"最終使用"},ams:{noData:"AMSが検出されません",connectAms:"AMSを接続してスロットを表示",noPrinter:"プリンター未選択",selectPrinter:"上部バーからプリンターを選択",printerDisconnected:"プリンター切断",humidity:"湿度",level:"レベル",active:"アクティブ",slot:"スロット",empty:"空"},inventory:{search:"スプールを検索...",empty:"インベントリにスプールがありません",noResults:"一致するスプールがありません",spools:"スプール",addSpool:"スプール追加"},settings:{tabDevice:"デバイス",tabDisplay:"ディスプレイ",tabScale:"計量",tabUpdates:"アップデート",nfcReader:"NFCリーダー",type:"タイプ",connection:"接続",notConnected:"N/A",deviceInfo:"デバイス情報",hostname:"ホスト",uptime:"稼働時間",brightness:"明るさ",saved:"保存済み",noBacklight:"DSIバックライトが検出されませんでした。明るさ制御にはDSIディスプレイが必要です。",screenBlank:"画面オフタイムアウト",screenBlankDesc:"操作がないと画面がオフになります。タッチで復帰。",displayNote:"明るさはソフトウェアフィルターとして適用されます。",scaleCalibration:"計量キャリブレーション",currentWeight:"現在の重量",tareOffset:"風袋",calFactor:"係数",knownWeight:"既知の重量",calStep1:"計量台からすべてのアイテムを取り除き、ゼロ設定を押してください。",calStep2:"既知の重量を計量台に置いてください。",setZero:"ゼロ設定",calibrateNow:"キャリブレーション",calibrated:"キャリブレーション済み",tareSet:"風袋コマンドを送信しました。デバイスを待っています...",tareFailed:"風袋コマンドの送信に失敗しました",zeroSet:"ゼロ点を設定しました。既知の重量を計量台に置いてください。",calibrationDone:"キャリブレーション完了!",calibrationFailed:"キャリブレーションに失敗しました",lastCalibrated:"最終キャリブレーション",stable:"安定",settling:"安定化中...",firmware:"ファームウェア",scale:"計量",noDevice:"SpoolBuddyデバイスが見つかりません",daemonVersion:"デーモンバージョン",currentVersion:"現在",versionPending:"デーモンを待っています...",checking:"確認中...",checkUpdates:"アップデートを確認",updateAvailable:"アップデートあり",updateInstructions:"SSH経由で更新:SpoolBuddyインストールスクリプトを実行してください。",upToDate:"最新です",includeBeta:"ベータ版を含む"},writeTag:{tabExisting:"既存のスプール",tabNew:"新規スプール",tabReplace:"タグ交換",searchPlaceholder:"素材、色、ブランドで検索...",noUntaggedSpools:"タグなしのスプールがありません",noTaggedSpools:"タグ付きのスプールがありません",selectSpool:"スプールを選択し、NTAGをリーダーに置いてください",placeTag:"NTAGをリーダーに置いてください",tagReady:"タグ検出 — 書込み準備完了",writeTag:"タグ書込み",replaceTag:"タグ交換",writing:"タグ書込み中...",waiting:"SpoolBuddyを待機中...",writeSuccess:"タグの書込みが完了しました!",writeFailed:"書込み失敗",queueFailed:"書込みコマンドのキューに失敗しました",tryAgain:"再試行",cancel:"キャンセル",replaceWarning:"古いタグのリンクが解除され、新しいタグに置き換わります。",deviceOffline:"SpoolBuddyはオフラインです",material:"素材",colorName:"色名",color:"色",brand:"ブランド",weight:"重量 (g)",createSpool:"スプール作成",creating:"作成中...",spoolCreated:"スプール作成完了!書込み準備ができました。",createFailed:"スプールの作成に失敗しました"}},bugReport:{title:"バグを報告",description:"説明",descriptionPlaceholder:"何が問題でしたか?問題を説明してください...",email:"メールアドレス(任意)",emailPlaceholder:"your@email.com",emailPrivacy:"入力された場合、メールアドレスはGitHub Issueの折りたたみセクションに含まれ、メンテナーがフォローアップできるようになります。",screenshot:"スクリーンショット",uploadOrPaste:"画像をアップロード、貼り付け、またはドラッグ",dataCollectedSummary:"レポートに含まれるデータは?",dataIncluded:"含まれるもの:",dataIncludedList:"アプリバージョン、OS、アーキテクチャ、Pythonバージョン、データベース統計(件数のみ)、プリンターモデル、ノズル数、ファームウェアバージョン、接続状態、統合状態(Spoolman、MQTT、HA)、非機密設定、ネットワークインターフェース数、Docker詳細、依存関係バージョン。",dataNeverIncluded:"含まれないもの:",dataNeverIncludedList:"プリンター名、シリアル番号、アクセスコード、パスワード、IPアドレス、メールアドレス、APIキー、トークン、Webhook URL、ホスト名、ユーザー名。",submit:"送信",collectingLogs:"診断ログを収集中...",collectingLogsHint:"デバッグログを有効化し、プリンターから最新データを取得しています。",submitting:"バグレポートを送信中...",submitSuccess:"バグレポートが正常に送信されました!",submitFailed:"バグレポートの送信に失敗しました",thankYou:"ありがとうございます!",submitted:"バグレポートが送信されました。",viewIssue:"Issueを表示",unexpectedError:"予期しないエラーが発生しました",countdownSeconds:"{{seconds}}秒"}},ede={nav:{printers:"Stampanti",archives:"Archivi",queue:"Coda",stats:"Statistiche",profiles:"Profili",maintenance:"Manutenzione",projects:"Progetti",inventory:"Filamento",files:"File",settings:"Impostazioni",system:"Sistema",collapseSidebar:"Comprimi barra laterale",expandSidebar:"Espandi barra laterale",update:"Aggiorna",updateAvailable:"Aggiornamento disponibile: v{{version}}",updateAvailableBanner:"Versione {{version}} disponibile!",viewUpdate:"Vedi aggiornamento",viewOnGithub:"Vedi su GitHub",keyboardShortcuts:"Scorciatoie da tastiera (?)",switchToLight:"Passa a tema chiaro",switchToDark:"Passa a tema scuro",smartSwitches:"Interruttori Smart",logout:"Esci"},common:{save:"Salva",saving:"Salvataggio...",cancel:"Annulla",delete:"Elimina",edit:"Modifica",add:"Aggiungi",close:"Chiudi",confirm:"Conferma",loading:"Caricamento...",error:"Errore",success:"Successo",warning:"Avviso",enabled:"Abilitato",disabled:"Disabilitato",yes:"Si",no:"No",on:"On",off:"Off",all:"Tutti",none:"Nessuno",search:"Cerca",filter:"Filtro",sort:"Ordina",refresh:"Aggiorna",download:"Scarica",upload:"Carica",uploading:"Caricamento...",uploadFailed:"Caricamento fallito",actions:"Azioni",status:"Stato",name:"Nome",description:"Descrizione",date:"Data",time:"Ora",hours:"ore",minutes:"minuti",seconds:"secondi",days:"giorni",enable:"Abilita",disable:"Disabilita",permissions:"Permessi",noPrinters:"Nessuna stampante configurata",noData:"Nessun dato disponibile",linkNotFound:"Link non trovato",required:"Obbligatorio",optional:"Opzionale",dismiss:"Chiudi",apply:"Applica",reset:"Reimposta",export:"Esporta",import:"Importa",clear:"Pulisci",selectAll:"Seleziona tutto",deselectAll:"Deseleziona tutto",noChange:"— Nessun cambio —",unchanged:"Invariato",unassigned:"Non assegnato",unknown:"Sconosciuto",unknownError:"Errore sconosciuto",today:"Oggi",tomorrow:"Domani",asap:"ASAP",overdue:"Scaduto",now:"Ora",collapse:"Comprimi",expand:"Espandi",viewArchive:"Vedi archivio",viewInFileManager:"Vedi nel Gestore file",addedBy:"Aggiunto da {{username}}",prints:"stampe",more:"+{{count}} altre",ascending:"Crescente",descending:"Decrescente",printer:"Stampante",remove:"Rimuovi",type:"Tipo",print:"Stampa",rename:"Rinomina",move:"Sposta",create:"Crea",duplicate:"Duplica",left:"Sinistra",right:"Destra"},printers:{title:"Stampanti",addPrinter:"Aggiungi Stampante",editPrinter:"Modifica Stampante",deletePrinter:"Elimina Stampante",printerName:"Nome Stampante",serialNumber:"Numero Seriale",ipAddress:"Indirizzo IP",accessCode:"Codice di Accesso",model:"Modello",nozzleCount:"Numero Ugelli",autoArchive:"Auto Archiviazione",status:{available:"Disponibile",idle:"Inattiva",printing:"In stampa",paused:"In pausa",offline:"Offline",error:"Errore",finished:"Finita",unknown:"Sconosciuto"},temperatures:{nozzle:"Ugello",bed:"Piatto",chamber:"Camera"},progress:"{{percent}}% completato",timeRemaining:"{{time}} rimanente",deleteConfirm:'Sei sicuro di eliminare "{{name}}"?',maintenanceOk:"Manutenzione OK",maintenanceWarning:"{{count}} avviso",maintenanceWarning_plural:"{{count}} avvisi",maintenanceDue:"{{count}} in scadenza",maintenanceDue_plural:"{{count}} in scadenza",sort:{name:"Nome",status:"Stato",model:"Modello",location:"Posizione",ascending:"Ordina crescente",descending:"Ordina decrescente"},cardSize:{small:"Schede piccole",medium:"Schede medie",large:"Schede grandi",extraLarge:"Schede extra grandi"},hideOffline:"Nascondi offline",nextAvailable:"Prossima disponibile",powerOn:"Accendi",offlinePrintersWithPlugs:"Stampanti offline con smart plug",noPrintersConfigured:"Nessuna stampante configurata",readyToPrint:"Pronta a stampare",external:"Esterna",extL:"Ext-L",extR:"Ext-R",deleteArchives:"Elimina archivi stampa",noLabel:"Nessuna etichetta",printPreview:"Anteprima stampa",width:"Larghezza",height:"Altezza",noObjectsFound:"Nessun oggetto trovato",objectsLoadedOnPrintStart:"Gli oggetti sono caricati quando inizia una stampa",willBeSkipped:"Verra saltato",name:"Nome",serialCannotBeChanged:"Il numero seriale non può essere cambiato",locationHelp:"Usato per raggruppare stampanti e filtrare i lavori in coda",wifiSignal:{veryWeak:"Molto debole",weak:"Debole",fair:"Discreto",good:"Buono",excellent:"Eccellente"},maintenanceUpToDate:"Tutta la manutenzione aggiornata - Clicca per vedere",chamberLightOn:"Accendi luce camera",chamberLightOff:"Spegni luce camera",files:"File",browseFiles:"Sfoglia file stampante",autoOffAfterPrint:"Spegnimento automatico dopo stampa",autoOffExecuted:"Spegnimento automatico eseguito - accendi la stampante per reimpostare",hmsErrors:"Errori HMS",viewHmsErrors:"Vedi {{count}} errore(i) HMS",resume:"Riprendi",pause:"Pausa",stop:"Ferma",camera:"Camera",skipObject:"Salta Oggetto",reconnect:"Riconnetti",mqttDebug:"Debug MQTT",printerInformation:"Informazioni stampante",copyToClipboard:"Copia",copied:"Copiato!",state:"Stato",wifiSignalLabel:"Segnale WiFi",developerMode:"Modalità sviluppatore",enabled:"Attivato",disabled:"Disattivato",addedOn:"Aggiunta il",sdCard:"Scheda SD",inserted:"Inserita",notInserted:"Non inserita",totalPrintHours:"Ore di stampa",activeNozzle:"Attivo: ugello {{nozzle}}",nozzleRack:"Rack Ugelli",nozzleDocked:"Agganciato",nozzleMounted:"Montato",nozzleActive:"Attivo",nozzleIdle:"Inattivo",nozzleDiameter:"Diametro",nozzleType:"Tipo",nozzleStatus:"Stato",nozzleFilament:"Filamento",nozzleWear:"Usura",nozzleMaxTemp:"Temp Max",nozzleSerial:"Seriale",nozzleHardenedSteel:"Acciaio Temprato",nozzleStainlessSteel:"Acciaio Inox",nozzleTungstenCarbide:"Carburo di Tungsteno",nozzleFlow:"Flusso",nozzleHighFlow:"Alto Flusso",nozzleStandardFlow:"Standard",firmwareUpdate:"Aggiornamento Firmware",firmwareInstructions:"Sul touchscreen della stampante, vai a",firmwareNav:"Vai a",settings:"Impostazioni",firmware:"Firmware",discoverPrinters:"Trova Stampanti",searching:"Ricerca...",manualEntry:"Inserimento manuale",addFromCloud:"Aggiungi da Cloud",toast:{printerDeleted:"Stampante eliminata",printerAdded:"Stampante aggiunta",printerUpdated:"Stampante aggiornata",failedToDelete:"Impossibile eliminare stampante",failedToAdd:"Impossibile aggiungere stampante",failedToUpdate:"Impossibile aggiornare stampante",commandSent:"Comando inviato",failedToSendCommand:"Impossibile inviare comando",turnedOn:"{{name}} accesa",failedToPowerOn:"Impossibile accendere {{name}}",scriptTriggered:"Script avviato",printStopped:"Stampa fermata",printPaused:"Stampa in pausa",printResumed:"Stampa ripresa",referenceDeleted:"Riferimento eliminato",detectionAreaSaved:"Area rilevamento salvata",failedToRunScript:"Impossibile eseguire script",failedToStopPrint:"Impossibile fermare stampa",failedToPausePrint:"Impossibile mettere in pausa stampa",failedToResumePrint:"Impossibile riprendere stampa",failedToControlChamberLight:"Impossibile controllare luce camera",failedToUpdateSetting:"Impossibile aggiornare impostazione",failedToSkipObjects:"Impossibile saltare oggetti",failedToRereadRfid:"Impossibile rileggere RFID",failedToCheckPlate:"Impossibile controllare piatto",failedToUpdateLabel:"Impossibile aggiornare etichetta",failedToDeleteReference:"Impossibile eliminare riferimento",failedToSaveDetectionArea:"Impossibile salvare area rilevamento",plateCheckEnabled:"Controllo piatto abilitato",plateCheckDisabled:"Controllo piatto disabilitato",calibrationSaved:"Calibrazione salvata!",calibrationFailed:"Calibrazione non riuscita",rfidRereadInitiated:"Rilettura RFID avviata"},connection:{connected:"Connesso",offline:"Offline"},queue:{inQueue:"{{count}} stampa in coda",inQueue_plural:"{{count}} stampe in coda"},controls:"Controlli",rfid:{reread:"Rileggi RFID"},permission:{noAdd:"Non hai il permesso di aggiungere stampanti",noEdit:"Non hai il permesso di modificare stampanti",noDelete:"Non hai il permesso di eliminare stampanti",noControl:"Non hai il permesso di controllare stampanti",noFiles:"Non hai il permesso di accedere ai file stampante",noAmsRfid:"Non hai il permesso di rileggere AMS RFID",noSmartPlugControl:"Non hai il permesso di controllare smart plug",noCamera:"Non hai il permesso di visualizzare le telecamere"},modal:{addTitle:"Aggiungi Stampante",editTitle:"Modifica Stampante",myPrinter:"La mia Stampante",selectModel:"Seleziona modello...",locationGroup:"Posizione / Gruppo (opzionale)",locationPlaceholder:"es. Officina, Ufficio, Cantina",autoArchiveLabel:"Archivia automaticamente stampe completate",fromPrinterSettings:"Dalle impostazioni della stampante",modelOptional:"Modello (opzionale)",saveChanges:"Salva modifiche"},skipObjects:{tooltip:"Salta oggetti",onlyWhilePrinting:"Salta oggetti (solo durante la stampa)",requiresMultiple:"Salta oggetti (richiede 2+ oggetti)",title:"Salta Oggetti",matchIdsInfo:"Abbina gli ID con il display della stampante",printerShowsIds:"Lo schermo mostra gli ID oggetto sul piatto",skipSelected:"Salta selezionati",skipping:"Saltando...",noObjectsSelected:"Nessun oggetto selezionato",selectObjectsToSkip:"Seleziona gli oggetti da saltare nella stampa corrente",skipped:"saltato",objectsSkipped:"Oggetti saltati",activeCount:"{{count}} attivi",waitForLayer:"Attendi il layer 2+ per saltare oggetti (attualmente layer {{layer}})",skip:"Salta",confirmTitle:"Saltare oggetto?",confirmMessage:'Sei sicuro di voler saltare "{{name}}"? Questa azione non può essere annullata.'},confirm:{deleteTitle:"Elimina Stampante",deleteMessage:'Sei sicuro di eliminare "{{name}}"? Questo rimuoverà tutte le impostazioni di connessione.',deleteArchivesNote:"Tutta la cronologia di stampa sarà eliminata definitivamente.",keepArchivesNote:"La cronologia sarà mantenuta ma non più associata a questa stampante.",stopTitle:"Ferma Stampa",stopMessage:'Sei sicuro di fermare la stampa corrente su "{{name}}"? Questo annullerà il lavoro di stampa.',stopButton:"Ferma Stampa",pauseTitle:"Pausa Stampa",pauseMessage:'Sei sicuro di mettere in pausa la stampa corrente su "{{name}}"?',pauseButton:"Pausa Stampa",resumeTitle:"Riprendi Stampa",resumeMessage:'Sei sicuro di riprendere la stampa su "{{name}}"?',resumeButton:"Riprendi Stampa",powerOnTitle:"Accendi Stampante",powerOnMessage:'Sei sicuro di accendere "{{name}}"?',powerOnButton:"Accendi",powerOffTitle:"Spegni Stampante",powerOffMessage:'Sei sicuro di spegnere "{{name}}"?',powerOffWarning:'AVVISO: "{{name}}" sta stampando! Sei sicuro di spegnere? Questo interromperà la stampa e potrebbe danneggiare la stampante.',powerOffButton:"Spegni"},discovery:{title:"Trova Stampanti",searching:"Ricerca...",scanning:"Scansione...",scanProgress:"Scansione... {{scanned}}/{{total}}",foundPrinters:"Trovate {{count}} stampante(i)",noPrintersFound:"Nessuna stampante trovata",noPrintersFoundSubnet:"Nessuna stampante trovata nella sottorete specificata.",noPrintersFoundNetwork:"Nessuna stampante trovata sulla rete.",allConfigured:"Tutte le stampanti trovate sono già configurate.",alreadyAdded:"Già aggiunta",select:"Seleziona",manualEntry:"Inserimento manuale",addFromCloud:"Aggiungi da Cloud",subnetToScan:"Sottorete da scansionare",dockerNote:"Docker rilevato. Inserisci la sottorete della stampante in notazione CIDR. Richiede network_mode: host in docker-compose.yml.",scanSubnet:"Scansiona sottorete per stampanti",discoverNetwork:"Trova stampanti in rete",scanningSubnet:"Scansione sottorete per stampanti Bambu...",scanningNetwork:"Scansione rete...",serialRequired:"Seriale richiesto",unknown:"Sconosciuto",failedToStart:"Avvio ricerca non riuscito"},filaments:"Filamenti",openCameraOverlay:"Apri overlay camera",openCameraWindow:"Apri camera in nuova finestra",firmwareUpdateAvailable:"Aggiornamento firmware disponibile: {{current}} → {{latest}}",firmwareUpToDate:"Firmware {{version}} — Aggiornato",firmwareUpdateButton:"Aggiorna",plateDetection:{noPermission:"Non hai il permesso di aggiornare le stampanti",enabledClick:"Controllo piatto abilitato - Clicca per disabilitare",disabledClick:"Controllo piatto disabilitato - Clicca per abilitare",manageCalibration:"Gestisci calibrazione rilevamento piatto",calibrationRequired:"Calibrazione richiesta",calibrationInstructions:"Assicurati che il piatto sia <strong>completamente vuoto</strong>, poi clicca Calibra.",calibrationDescription:"La calibrazione salva un'immagine di riferimento del piatto vuoto. I controlli futuri confronteranno con questo riferimento per rilevare oggetti.",calibrationTip:"<strong>Suggerimento:</strong> Puoi salvare fino a 5 calibrazioni per piatti diversi. Il sistema usa automaticamente la migliore corrispondenza durante il controllo.",plateEmpty:"Il piatto sembra vuoto",objectsDetected:"Oggetti rilevati sul piatto",confidence:"Confidenza",difference:"Differenza",analysisPreview:"Anteprima analisi:",analysisLegend:"Riquadro verde = area rilevamento, overlay rosso = differenze dalla calibrazione",savedReferences:"Riferimenti salvati ({{count}}/{{max}})",deleteReference:"Elimina riferimento",labelPlaceholder:"Etichetta...",clickToEdit:"{{label}} - Clicca per modificare",clickToAddLabel:"Clicca per aggiungere etichetta"},fans:{partCooling:"Ventola raffreddamento parte",auxiliary:"Ventola ausiliaria",chamber:"Ventola camera"},clickToViewHmsErrors:"Clicca per vedere errori HMS",estimatedCompletion:"Tempo completamento stimato",slotOptions:"Opzioni slot",amsPopup:{friendlyName:"Nome AMS",friendlyNamePlaceholder:"es. Nome AMS amichevole",serialNumber:"Numero di serie",firmwareVersion:"Firmware",save:"Salva",clear:"Cancella",noEditPermission:"Non hai il permesso di rinominare le unità AMS"},firmwareModal:{title:"Aggiornamento Firmware",titleUpToDate:"Info Firmware",currentVersion:"Corrente:",latestVersion:"Ultima:",releaseNotes:"Note di rilascio",checkingPrereqs:"Controllo prerequisiti...",sdCardReady:"SD pronta. Clicca sotto per caricare firmware.",uploadedSuccess:"Firmware caricato su SD!",applyInstructions:"Per applicare l'aggiornamento sulla stampante:",step1:"Sul touchscreen della stampante, vai a <strong>Impostazioni</strong>",step2:"Vai a <strong>Firmware</strong>",step3:"Seleziona <strong>Aggiorna da SD</strong>",step4:"L'aggiornamento richiede 10-20 minuti",done:"Fatto",starting:"Avvio...",uploadFirmware:"Carica Firmware",uploadFailed:"Avvio caricamento fallito: {{error}}",uploadedToast:"Firmware caricato! Avvia aggiornamento dal display."},accessCodePlaceholder:"Lascia vuoto per mantenere quello attuale",roi:{title:"Area di rilevamento (ROI)",xStart:"X Inizio",yStart:"Y Inizio",width:"Larghezza",height:"Altezza",instruction:"Regola l'area di rilevamento per focalizzare il piatto. Il riquadro verde mostra l'area corrente."},developerModeWarning:"La modalità sviluppatore LAN non è attivata su: {{names}}. Alcune funzionalità potrebbero non funzionare.",howToEnable:"Come attivare",incompatibleFile:"Questo file è stato preparato per {{slicedFor}}, ma questa stampante è una {{printerModel}}",dropNotPrintable:"Solo i file .gcode e .gcode.3mf possono essere stampati",dropToPrint:"Rilascia per stampare",cannotPrint:"Stampante occupata"},archives:{title:"Archivi di stampa",searchPlaceholder:"Cerca archivi...",filterByPrinter:"Filtra per stampante",filterByStatus:"Filtra per stato",sortBy:"Ordina per",sortNewest:"Più recenti",sortOldest:"Meno recenti",sortName:"Nome",sortDuration:"Durata",sortLargest:"Più grandi",sortSmallest:"Più piccoli",sortSize:"Dimensione",noArchives:"Nessun archivio trovato",noArchivesSearch:"Nessun archivio corrisponde alla ricerca",noArchivesYet:"Nessun archivio ancora",loadingArchives:"Caricamento archivi...",releaseToUpload:"Rilascia per caricare",showAll:"Mostra tutti",showFavoritesOnly:"Solo preferiti",gridView:"Vista griglia",listView:"Vista elenco",calendarView:"Vista calendario",logView:"Registro stampe",manageTags:"Gestisci tag",showFailedPrints:"Mostra stampe fallite",hideFailedPrints:"Nascondi stampe fallite",printTime:"Tempo di stampa",filamentUsed:"Filamento usato",cost:"Costo",reprint:"Ristampa",preview:"Anteprima",deleteArchive:"Elimina archivio",deleteConfirm:"Sei sicuro di eliminare questo archivio?",favorite:"Preferito",unfavorite:"Rimuovi dai preferiti",viewDetails:"Vedi dettagli",status:{completed:"Completato",failed:"Fallito",stopped:"Fermato"},toast:{source3mfAttached:"Sorgente 3MF allegata: {{filename}}",failedUploadSource3mf:"Caricamento sorgente 3MF non riuscito",source3mfRemoved:"Sorgente 3MF rimossa",failedRemoveSource3mf:"Rimozione sorgente 3MF non riuscita",f3dAttached:"F3D allegato: {{filename}}",failedUploadF3d:"Caricamento F3D non riuscito",f3dRemoved:"F3D rimosso",failedRemoveF3d:"Rimozione F3D non riuscita",timelapseAttached:"Timelapse allegato: {{filename}}",timelapseAlreadyAttached:"Timelapse già allegato",noMatchingTimelapse:"Nessun timelapse corrispondente",failedScanTimelapse:"Scansione timelapse non riuscita",failedAttachTimelapse:"Allegato timelapse non riuscito",timelapseRemoved:"Timelapse rimosso",failedRemoveTimelapse:"Impossibile rimuovere il timelapse",timelapseUploaded:"Timelapse caricato: {{filename}}",failedUploadTimelapse:"Impossibile caricare il timelapse",archiveDeleted:"Archivio eliminato",failedDeleteArchive:"Eliminazione archivio non riuscita",addedToFavorites:"Aggiunto ai preferiti",removedFromFavorites:"Rimosso dai preferiti",projectUpdated:"Progetto aggiornato",failedUpdateProject:"Aggiornamento progetto non riuscito",linkCopied:"Link copiato negli appunti",failedCopyLink:"Copia link non riuscita",photoDeleted:"Foto eliminata",failedDeletePhoto:"Eliminazione foto non riuscita",failedDeleteArchives:"Eliminazione archivi non riuscita",failedUpdateFavorites:"Aggiornamento preferiti non riuscito",exportDownloaded:"Export scaricato",exportFailed:"Export non riuscito"},menu:{print:"Stampa",schedule:"Programma",openInBambuStudio:"Apri nello slicer",slice:"Slice",externalLink:"Link esterno",viewOnMakerWorld:"Vedi su MakerWorld",preview3d:"Anteprima 3D",viewTimelapse:"Vedi Timelapse",scanForTimelapse:"Cerca Timelapse",uploadTimelapse:"Carica timelapse",removeTimelapse:"Rimuovi timelapse",downloadSource3mf:"Scarica Sorgente 3MF",uploadSource3mf:"Carica Sorgente 3MF",replaceSource3mf:"Sostituisci Sorgente 3MF",removeSource3mf:"Rimuovi Sorgente 3MF",uploadF3d:"Carica F3D",replaceF3d:"Sostituisci F3D",downloadF3d:"Scarica F3D",removeF3d:"Rimuovi F3D",download:"Scarica",copyDownloadLink:"Copia link download",qrCode:"QR Code",viewPhotos:"Vedi foto",viewPhotosCount:"Vedi foto ({{count}})",projectPage:"Pagina progetto",addToFavorites:"Aggiungi ai preferiti",removeFromFavorites:"Rimuovi dai preferiti",edit:"Modifica",goToProject:"Vai al progetto: {{name}}",addToProject:"Aggiungi al progetto",removeFromProject:"Rimuovi dal progetto",loading:"Caricamento...",noProjectsAvailable:"Nessun progetto disponibile",select:"Seleziona",deselect:"Deseleziona",delete:"Elimina"},permission:{noReprint:"Non hai il permesso di ristampare questo archivio",noAddToQueue:"Non hai il permesso di aggiungere alla coda",noUpdateArchives:"Non hai il permesso di aggiornare archivi",noUploadFiles:"Non hai il permesso di caricare file",noDownload:"Non hai il permesso di scaricare archivi",noCopyLink:"Non hai il permesso di copiare link download",noDelete:"Non hai il permesso di eliminare questo archivio",noCreate:"Non hai il permesso di creare archivi"},card:{previousPlate:"Piatto precedente",nextPlate:"Piatto successivo",plateNumber:"Piatto {{index}}",moreOptions:"Clic destro per altre opzioni",addToFavorites:"Aggiungi ai preferiti",removeFromFavorites:"Rimuovi dai preferiti",cancelled:"annullato",failed:"fallito",duplicate:"duplicato",duplicateTitle:"Questo modello è stato stampato prima",openSource3mf:"Apri sorgente 3MF in Bambu Studio (clic destro per altre opzioni)",downloadF3d:"Scarica file design Fusion 360",viewTimelapse:"Vedi timelapse",viewPhoto:"Vedi 1 foto",viewPhotos:"Vedi {{count}} foto",openFolder:"Apri cartella: {{name}}",slicedFile:"File slice - pronto a stampare",sourceFile:"Solo file sorgente - nessuna mappatura AMS disponibile",gcode:"GCODE",source:"SOURCE",project:"Progetto: {{name}}",estimated:"Stimato: {{time}}",actual:"Reale: {{time}}",accuracy:"Accuratezza: {{percent}}%",filament:"{{weight}}g",layer:"{{count}} strato",layers:"{{count}} strati",object:"{{count}} oggetto",objects:"{{count}} oggetti",slicedFor:"Sliced per {{model}}",uploadedBy:"Caricato da",noPermissionReprint:"Non hai il permesso di ristampare",noFileForReprint:"Nessun file 3MF disponibile — il file non è stato scaricato dalla stampante durante la registrazione",noPermissionEdit:"Non hai il permesso di modificare archivi",noPermissionDelete:"Non hai il permesso di eliminare archivi",reprint:"Ristampa",schedulePrint:"Programma Stampa",schedule:"Programma",openInBambuStudio:"Apri nello slicer",openInBambuStudioToSlice:"Apri nello slicer per slicing",slice:"Slice",externalLink:"Link esterno",makerWorld:"MakerWorld: {{designer}}",viewProject:"Vedi progetto",noExternalLink:"Nessun link esterno",preview3d:"Anteprima 3D",download:"Scarica",edit:"Modifica",delete:"Elimina"},modal:{deleteArchive:"Elimina Archivio",deleteConfirm:'Sei sicuro di eliminare "{{name}}"? Questa azione non può essere annullata.',deleteButton:"Elimina",removeSource3mf:"Rimuovi Sorgente 3MF",removeSource3mfConfirm:'Sei sicuro di rimuovere il file sorgente 3MF da "{{name}}"? Questo eliminerà il progetto slicer originale.',removeButton:"Rimuovi",removeF3d:"Rimuovi F3D",removeF3dConfirm:'Sei sicuro di rimuovere il file Fusion 360 da "{{name}}"?',removeTimelapse:"Rimuovi timelapse",removeTimelapseConfirm:'Sei sicuro di voler rimuovere il video timelapse da "{{name}}"?',timelapse:"{{name}} - Timelapse",selectTimelapse:"Seleziona Timelapse",selectTimelapseDesc:"Nessun abbinamento automatico trovato. Seleziona il timelapse per questa stampa:",deleteArchives:"Elimina Archivi",deleteArchivesConfirm:"Sei sicuro di eliminare {{count}} archivio(i)? Questa azione non può essere annullata.",deleteCount:"Elimina {{count}}"},page:{title:"Archivi",printsCount:"{{filtered}} di {{total}} stampe",dropFilesHere:"Rilascia file .3mf qui",releaseToUpload:"Rilascia per caricare",only3mfSupported:"Solo file .3mf supportati",close:"Chiudi",selected:"{{count}} selezionati",selectAll:"Seleziona tutto",tags:"Tag",project:"Progetto",favorite:"Preferito",delete:"Elimina",toggledFavorites:"Preferiti aggiornati per {{count}} archivio(i)",failedUpdateFavorites:"Aggiornamento preferiti non riuscito",archivesDeleted:"{{count}} archivio(i) eliminati",failedDeleteArchives:"Eliminazione archivi non riuscita",photoDeleted:"Foto eliminata",failedDeletePhoto:"Eliminazione foto non riuscita"},list:{name:"Nome",printer:"Stampante",date:"Data",size:"Dimensione",actions:"Azioni",hasTimelapse:"Ha timelapse"},log:{date:"Data",printName:"Nome stampa",printer:"Stampante",user:"Utente",status:"Stato",duration:"Durata",filament:"Filamento",allPrinters:"Tutte le stampanti",allUsers:"Tutti gli utenti",allStatuses:"Tutti gli stati",cancelled:"Annullato",skipped:"Saltato",dateFrom:"Dal",dateTo:"Al",noEntries:"Nessuna voce di registro trovata",showing:"{{count}} di {{total}} voci",rowsPerPage:"Righe",page:"Pagina",prev:"Prec.",next:"Succ.",clearLog:"Cancella registro",clearLogTitle:"Cancella registro stampe",clearLogConfirm:"Tutte le voci del registro di stampa verranno eliminate permanentemente. Gli archivi e gli elementi della coda non sono interessati. Questa azione non può essere annullata. Sei sicuro?",clearLogButton:"Cancella tutto",cleared:"{{count}} voci di registro cancellate",clearFailed:"Impossibile cancellare il registro stampe"}},queue:{title:"Coda di stampa",subtitle:"Programma e gestisci i tuoi lavori di stampa",addToQueue:"Aggiungi alla coda",print:"Stampa",reprint:"Ristampa",schedulePrint:"Programma Stampa",editQueueItem:"Modifica elemento coda",printToPrinters:"Stampa su {{count}} Stampanti",queueToPrinters:"Metti in coda su {{count}} Stampanti",queueAllPlates:"Metti in coda tutte le {{count}} piastre",printQueued:"Stampa in coda",itemsQueued:"{{count}} elementi in coda",sending:"Invio...",sendingProgress:"Invio {{current}}/{{total}}...",adding:"Aggiunta...",addingProgress:"Aggiunta {{current}}/{{total}}...",savingProgress:"Salvataggio {{current}}/{{total}}...",clearQueue:"Svuota coda",clearHistory:"Svuota cronologia",emptyQueue:"La coda è vuota",position:"Posizione",scheduledTime:"Ora programmata",moveUp:"Sposta su",moveDown:"Sposta giù",startNow:"Avvia ora",printingInProgress:"Stampa in corso...",viewArchive:"Vedi archivio",viewInFileManager:"Vedi nel Gestore file",itemCount:"{{count}} elemento",itemCount_plural:"{{count}} elementi",dragToReorder:"Trascina per riordinare (solo ASAP)",reorderHint:"La posizione influisce solo sugli elementi ASAP. Quelli programmati partono all'orario.",addedBy:"Aggiunto da {{name}}",nextInQueue:"Prossimo in coda",clearPlate:"Libera piatto e avvia il prossimo",clearPlateSuccess:"Piatto liberato — pronto per la prossima stampa",plateReady:"Piatto liberato — pronto per la prossima stampa",plateNumber:"Piatto {{index}}",sections:{currentlyPrinting:"In stampa",queued:"In coda",history:"Cronologia"},status:{pending:"In attesa",waiting:"In attesa",printing:"In stampa",paused:"In pausa",completed:"Completato",failed:"Fallito",skipped:"Saltato",cancelled:"Annullato"},summary:{printing:"In stampa",queued:"In coda",totalTime:"Tempo totale coda",totalWeight:"Peso totale della coda",history:"Cronologia"},filter:{allPrinters:"Tutte le stampanti",unassigned:"Non assegnato",allStatus:"Tutti gli stati",allLocations:"Tutte le posizioni",any:"Qualsiasi"},sort:{byPosition:"Ordina per posizione",byName:"Ordina per nome",byPrinter:"Ordina per stampante",bySchedule:"Ordina per programma",byDate:"Ordina per data",ascendingOldest:"Crescente (più vecchi)",descendingNewest:"Decrescente (più recenti)"},badges:{staged:"In staging",requiresPrevious:"Richiede successo precedente",autoPowerOff:"Spegnimento automatico"},empty:{title:"Nessuna stampa programmata",description:`Programma una stampa dalla pagina Archivi usando l'opzione "Programma" nel menu contestuale, o trascina i file per iniziare.`},time:{asap:"ASAP",overdue:"Scaduto",now:"Ora",lessThanMinute:"Tra meno di un minuto",inMinutes:"Tra {{count}} min",inHours:"Tra {{count}} ore"},actions:{stopPrint:"Ferma Stampa",startPrint:"Avvia Stampa",requeue:"Rimetti in coda"},bulkEdit:{title:"Modifica {{count}} elemento",title_plural:"Modifica {{count}} elementi",description:"Solo le impostazioni modificate saranno applicate agli elementi selezionati.",printer:"Stampante",noChange:"— Nessun cambio —",queueOptions:"Opzioni coda",staged:"In staging (avvio manuale)",autoPowerOff:"Spegnimento automatico dopo stampa",requirePrevious:"Richiede successo precedente",printOptions:"Opzioni stampa",bedLevelling:"Livellamento piatto",flowCalibration:"Calibrazione flusso",vibrationCalibration:"Calibrazione vibrazioni",layerInspection:"Controllo primo layer",timelapse:"Timelapse",useAms:"Usa AMS",applyChanges:"Applica modifiche",selectAll:"Seleziona tutto",deselectAll:"Deseleziona tutto",selected:"{{count}} selezionati",editSelected:"Modifica selezionati",cancelSelected:"Annulla selezionati"},confirm:{cancelTitle:"Annulla stampa programmata",cancelMessage:'Sei sicuro di annullare "{{name}}"?',stopTitle:"Ferma Stampa",stopMessage:'Sei sicuro di fermare la stampa corrente "{{name}}"? Questo annullerà il lavoro sulla stampante.',removeTitle:"Rimuovi dalla cronologia",removeMessage:'Sei sicuro di rimuovere "{{name}}" dalla cronologia coda?',clearHistoryTitle:"Svuota cronologia",clearHistoryMessage:"Sei sicuro di rimuovere {{count}} elemento(i) dalla cronologia?",cancelButton:"Annulla Stampa",stopButton:"Ferma Stampa",thisPrint:"questa stampa",thisItem:"questo elemento"},toast:{cancelled:"Elemento coda annullato",cancelFailed:"Annullamento non riuscito",removed:"Elemento coda rimosso",removeFailed:"Rimozione non riuscita",stopped:"Stampa fermata",stopFailed:"Impossibile fermare stampa",released:"Stampa rilasciata in coda",startFailed:"Avvio stampa non riuscito",reorderFailed:"Riordino coda non riuscito",historyCleared:"Cancellati {{count}} elementi cronologia",clearHistoryFailed:"Svuotamento cronologia non riuscito",updateFailed:"Aggiornamento elementi non riuscito",bulkCancelled:"Annullati {{count}} elementi",bulkCancelFailed:"Annullamento elementi non riuscito"},permissions:{noStopPrint:"Non hai il permesso di fermare stampe",noStartPrint:"Non hai il permesso di avviare stampe",noEdit:"Non hai il permesso di modificare questo elemento coda",noCancel:"Non hai il permesso di annullare questo elemento coda",noRequeue:"Non hai il permesso di rimettere in coda elementi",noRemove:"Non hai il permesso di rimuovere questo elemento coda",noClearHistory:"Non hai il permesso di svuotare tutta la cronologia",noEditItems:"Non hai il permesso di modificare elementi coda",noCancelItems:"Non hai il permesso di annullare elementi coda"}},backgroundDispatch:{unknownFile:"File sconosciuto",unknownPrinter:"Stampante sconosciuta",startingPrints:"Avvio stampe",progressSummary:"{{complete}}/{{total}} completati • Inviati: {{dispatched}} • In elaborazione: {{processing}}",expandDetails:"Espandi dettagli dispatch",collapseDetails:"Comprimi dettagli dispatch",dismissToast:"Chiudi notifica dispatch",cancelDispatchJob:"Annulla job dispatch",cancel:"Annulla",cancelling:"Annullamento…",status:{dispatched:"Inviato",processing:"In elaborazione",completed:"Completato",failed:"Fallito",cancelled:"Annullato"},toast:{cancellingUpload:"Annullamento upload...",cancelled:"Dispatch annullato",cancelFailed:"Impossibile annullare il dispatch",completeWithFailures:"Dispatch in background completato: {{completed}} riusciti, {{failed}} falliti",completeSuccess:"Dispatch in background completato: {{completed}} riusciti",printStartedRemaining:"{{completed}} stampa/e avviata/e, {{remaining}} in invio..."}},stats:{title:"Dashboard",subtitle:"Trascina i widget per riordinare. Clicca l'icona occhio per nascondere.",overview:"Panoramica",totalPrints:"Stampe totali",successRate:"Tasso di successo",totalPrintTime:"Tempo totale di stampa",printTime:"Tempo di stampa",totalFilament:"Filamento totale usato",filamentUsed:"Filamento usato",filamentCost:"Costo filamento",totalCost:"Costo totale",energyUsed:"Energia usata",energyCost:"Costo energia",averagePrintTime:"Tempo medio di stampa",printsPerDay:"Stampe al giorno",byPrinter:"Per stampante",printsByPrinter:"Stampe per stampante",byMaterial:"Per materiale",byMonth:"Per mese",last7Days:"Ultimi 7 giorni",last30Days:"Ultimi 30 giorni",last90Days:"Ultimi 90 giorni",allTime:"Sempre",quickStats:"Statistiche rapide",printActivity:"Attivita di stampa",filamentTypes:"Tipi di filamento",filamentTrends:"Trend filamento",failureAnalysis:"Analisi guasti",timeAccuracy:"Accuratezza tempo",successful:"Riuscite:",failed:"Fallite:",perfectEstimate:"100% = stima perfetta",noTimeAccuracyData:"Nessun dato accuratezza tempo",noFilamentData:"Nessun dato filamento",noPrinterData:"Nessun dato stampante",noPrintData:"Nessun dato stampa",noPrintDataLast30Days:"Nessun dato stampa negli ultimi 30 giorni",failureReasons:"Cause guasto",topFailureReasons:"Cause principali",failedPrintsCount:"{{failed}} / {{total}} stampe fallite",lastWeekRate:"Settimana scorsa: {{rate}}%",resetLayout:"Reimposta layout",recalculateCosts:"Ricalcola costi",recalculateCostsHint:"Ricalcola tutti i costi archivi usando i prezzi filamento correnti",exportStats:"Esporta statistiche",exportAsCsv:"Esporta come CSV",exportAsExcel:"Esporta come Excel",hiddenCount:"{{count}} Nascosti",exportDownloaded:"Export scaricato",exportFailed:"Export non riuscito",layoutReset:"Layout reimpostato",recalculatedCosts:"Costi ricalcolati per {{count}} archivi",recalculateFailed:"Ricalcolo costi non riuscito",loadingStats:"Caricamento statistiche...",noPermissionResetLayout:"Non hai il permesso di reimpostare il layout",noPermissionRecalculate:"Non hai il permesso di ricalcolare i costi",noPrintDataInRange:"Nessun dato nel periodo selezionato",periodFilament:"Filamento utilizzato",periodCost:"Costo",avgPerPrint:"Media per stampa",usageOverTime:"Utilizzo nel tempo",filamentByWeight:"Peso",printDuration:"Durata stampa",printerUtilization:"Utilizzo stampante",filamentSuccess:"Successo per materiale",printHabits:"Abitudini di stampa",printTimeOfDay:"Ora di stampa",colorDistribution:"Distribuzione colori",noColorData:"Nessun dato colore disponibile",records:"Record",longestPrint:"Stampa più lunga",heaviestPrint:"Stampa più pesante",mostExpensivePrint:"Più costosa",busiestDay:"Giorno più attivo",successStreak:"Serie di successi",streakPrint:"stampa consecutiva",streakPrints:"{{count}} stampe consecutive",printerStats:"Statistiche stampante",hours:"ore",avgPrints:"Media stampe",noArchiveData:"Nessun dato di stampa disponibile",filamentByTime:"Tempo",avgWeight:"Media peso",avgTime:"Media tempo",filamentByPrints:"Stampe",timeframe:{today:"Oggi","this-week":"Questa settimana","this-month":"Questo mese","last-7":"Ultimi 7 giorni","last-30":"Ultimi 30 giorni","last-90":"Ultimi 90 giorni","this-year":"Quest'anno","all-time":"Tutto",custom:"Personalizzato",from:"Da",to:"A"}},maintenance:{title:"Manutenzione",overview:"Panoramica",allOk:"Tutta la manutenzione aggiornata",dueCount:"{{count}} elemento in scadenza",dueCount_plural:"{{count}} elementi in scadenza",warningCount:"{{count}} avviso",warningCount_plural:"{{count}} avvisi",totalPrintTime:"Tempo totale di stampa",nextMaintenance:"Prossima manutenzione",nothingDue:"Niente in scadenza",tasks:"Attivita",lastPerformed:"Ultima esecuzione",interval:"Intervallo",hoursRemaining:"{{hours}}h rimanenti",hoursOverdue:"{{hours}}h in ritardo",markDone:"Segna come fatto",performMaintenance:"Esegui manutenzione",history:"Cronologia",noHistory:"Nessuna cronologia manutenzione",editPrintHours:"Modifica ore stampa",currentHours:"Ore attuali",statusTab:"Stato",settingsTab:"Impostazioni",overdueCount:"{{count}} in ritardo",dueSoonCount:"{{count}} in scadenza",dueSoon:"In scadenza",allGood:"Tutto ok",overdueBy:"In ritardo di {{duration}}",dueIn:"Scade tra {{duration}}",timeLeft:"{{duration}} rimanenti",day:"1 giorno",days:"{{count}} giorni",week:"1 settimana",weeks:"{{count}} settimane",month:"1 mese",months:"{{count}} mesi",year:"1 anno",maintenanceTypes:"Tipi di manutenzione",maintenanceTypesDescription:"Tipi di sistema e tue attivita personalizzate",addCustomType:"Aggiungi tipo personalizzato",restoreDefaults:"Ripristina attivita predefinite",intervalType:"Tipo intervallo",intervalValue:"Intervallo ({{type}})",icon:"Icona",documentationLink:"Link documentazione (opzionale)",assignToPrinters:"Assegna alle stampanti",selectAtLeastOnePrinter:"Seleziona almeno una stampante",addType:"Aggiungi tipo",custom:"Personalizzato",printHours:"Ore di stampa",calendarDays:"Giorni calendario",exampleName:"es. Sostituisci filtro HEPA",viewDocumentation:"Vedi documentazione",timeBasedInterval:"Intervallo basato sul tempo",intervalOverrides:"Override intervallo",intervalOverridesDescription:"Personalizza intervalli per stampanti specifiche",assignedToPrinters:"Assegnato alle stampanti:",noPrintersAssigned:"Nessuna stampante assegnata",addPrinterShort:"Aggiungi:",printersAssignedClick:"{{count}} stampante(i) assegnata - clicca per gestire",removeFromPrinter:"Rimuovi da questa stampante",types:{lubricateCarbonRods:"Lubrifica aste in carbonio",lubricateRails:"Lubrifica guide lineari",cleanNozzle:"Pulisci ugello/Hotend",checkBelts:"Controlla tensione cinghie",cleanBuildPlate:"Pulisci piatto",checkExtruder:"Controlla ingranaggi estrusore",checkCooling:"Controlla ventole raffreddamento",generalInspection:"Ispezione generale",cleanCarbonRods:"Pulisci aste in carbonio",lubricateSteelRods:"Lubrifica aste in acciaio",cleanSteelRods:"Pulisci aste in acciaio",cleanLinearRails:"Pulisci guide lineari",checkPtfeTube:"Controlla tubo PTFE",replaceHepaFilter:"Sostituisci filtro HEPA",replaceCarbonFilter:"Sostituisci filtro carbone",lubricateLeftNozzleRail:"Lubrifica guida ugello sinistro"},maintenanceComplete:"Manutenzione segnata come completata",typeUpdated:"Tipo manutenzione aggiornato",typeDeleted:"Tipo manutenzione eliminato",defaultsRestored:"Ripristinate {{count}} attivita predefinite",printHoursUpdated:"Ore di stampa aggiornate",printerAssigned:"Stampante assegnata",printerRemoved:"Stampante rimossa",deleteTypeConfirm:'Eliminare "{{name}}"?',deleteSystemTypeTitle:"Eliminare attività di manutenzione predefinita?",deleteSystemTypeMessage:`Sei sicuro di voler eliminare l'attività di manutenzione predefinita "{{name}}"?`,noPermissionUpdate:"Non hai il permesso di aggiornare elementi manutenzione",noPermissionPerform:"Non hai il permesso di eseguire manutenzione",noPermissionEditTypes:"Non hai il permesso di modificare tipi manutenzione",noPermissionDeleteTypes:"Non hai il permesso di eliminare tipi manutenzione",noPermissionEditHours:"Non hai il permesso di modificare ore stampa",noPermissionRemovePrinter:"Non hai il permesso di rimuovere assegnazioni stampanti",noPermissionAssignPrinter:"Non hai il permesso di assegnare stampanti",noPermissionEditIntervals:"Non hai il permesso di modificare intervalli",configureSettings:"Configura tipi e intervalli manutenzione"},settings:{title:"Impostazioni",general:"Generale",tabs:{general:"Generale",smartPlugs:"Prese smart",notifications:"Notifiche",filament:"Filamento",network:"Rete",apiKeys:"Chiavi API",virtualPrinter:"Stampante virtuale",users:"Utenti",backup:"Backup",emailAuth:"Autenticazione Email"},email:{smtpSettings:"Configurazione SMTP",smtpHost:"Server SMTP",smtpPort:"Porta SMTP",security:"Sicurezza",authentication:"Autenticazione",username:"Nome utente",password:"Password",fromEmail:"Email mittente",fromName:"Nome mittente",testConnection:"Testa connessione SMTP",testRecipient:"Email destinatario test",sendTest:"Invia email di test",sending:"Invio...",save:"Salva impostazioni",saving:"Salvataggio...",advancedAuth:"Autenticazione avanzata",advancedAuthEnabled:"L'autenticazione avanzata è abilitata",advancedAuthEnabledDesc:"Le funzionalità di gestione utenti via email sono attive. I nuovi utenti riceveranno password generate automaticamente via email e potranno reimpostare la password tramite la funzione di recupero.",advancedAuthDisabled:"L'autenticazione avanzata è disabilitata",advancedAuthDisabledDesc:"Abilita l'autenticazione avanzata per attivare le funzionalità email per la gestione utenti.",enable:"Abilita",disable:"Disabilita",feature1:"Le password vengono generate automaticamente e inviate via email ai nuovi utenti",feature2:"Gli utenti possono accedere con nome utente o email",feature3:"La funzione di recupero password è disponibile",feature4:"Gli amministratori possono reimpostare le password utente via email",errors:{requiredFields:"Compilare tutti i campi obbligatori",usernameRequired:"Il nome utente è obbligatorio quando l'autenticazione è abilitata",enterTestEmail:"Inserire un indirizzo email di test",smtpServerAndEmail:"Compilare Server SMTP e Email mittente prima di testare",usernamePasswordRequired:"Nome utente e password sono obbligatori quando l'autenticazione è abilitata",configureSmtpFirst:"Configurare e testare le impostazioni SMTP prima"},success:{settingsSaved:"Impostazioni SMTP salvate con successo"},securityOptions:{starttls:"STARTTLS (Porta 587)",ssl:"SSL/TLS (Porta 465)",none:"Nessuna (Porta 25)"},authOptions:{enabled:"Abilitata",disabled:"Disabilitata"}},appearance:"Aspetto",notifications:"Notifiche",smartPlugs:"Prese smart",spoolman:"Spoolman",updates:"Aggiornamenti",language:"Lingua",languageDescription:"Seleziona la lingua preferita",theme:"Tema",themeLight:"Chiaro",themeDark:"Scuro",themeSystem:"Sistema",defaultView:"Vista predefinita",defaultViewDescription:"Pagina da mostrare all'apertura dell'app",checkForUpdates:"Controlla aggiornamenti",autoUpdate:"Aggiornamento automatico",currentVersion:"Versione attuale",latestVersion:"Ultima versione",upToDate:"Sei aggiornato",updateAvailable:"Aggiornamento disponibile",notificationLanguage:"Lingua notifiche",notificationLanguageDescription:"Lingua per notifiche push",bedCooledThreshold:"Soglia raffreddamento piatto",bedCooledThresholdDescription:"Temperatura sotto la quale il piatto è considerato raffreddato dopo una stampa",notificationProviders:"Provider notifiche",addProvider:"Aggiungi provider",editProvider:"Modifica provider",providerType:"Tipo provider",testNotification:"Notifica di test",testSuccess:"Notifica di test inviata",testFailed:"Invio notifica di test fallito",quietHours:"Ore silenziose",quietHoursDescription:"Non disturbare in queste ore",quietHoursStart:"Inizio",quietHoursEnd:"Fine",events:{title:"Eventi notifica",printStart:"Stampa avviata",printComplete:"Stampa completata",printFailed:"Stampa fallita",printStopped:"Stampa interrotta",printProgress:"Avanzamento",printProgressDescription:"Notifica al 25%, 50%, 75%",printerOffline:"Stampante offline",printerError:"Errore stampante",filamentLow:"Filamento in esaurimento",maintenanceDue:"Manutenzione dovuta",maintenanceDueDescription:"Notifica quando serve manutenzione"},smartPlug:{title:"Prese smart",add:"Aggiungi presa smart",edit:"Modifica presa smart",name:"Nome",ipAddress:"Indirizzo IP",linkedPrinter:"Stampante collegata",autoOn:"Accensione automatica",autoOnDescription:"Accendi all'avvio stampa",autoOff:"Spegnimento automatico",autoOffDescription:"Spegni dopo il completamento",offDelay:"Ritardo spegnimento",offDelayMinutes:"Minuti dopo la stampa",offDelayTemp:"Quando ugello sotto temperatura",currentState:"Stato attuale",turnOn:"Accendi",turnOff:"Spegni"},filamentTracking:"Tracciamento filamento",filamentTrackingDesc:"Scegli come tracciare le bobine di filamento. Puoi usare l'inventario integrato o collegare un server Spoolman esterno.",trackingModeBuiltIn:"Inventario integrato",trackingModeBuiltInDesc:"Riconoscimento RFID automatico e tracciamento dell'uso inclusi",trackingModeSpoolmanDesc:"Server esterno per la gestione del filamento",builtInFeatureRfid:"Rileva automaticamente le bobine Bambu Lab RFID nell'AMS",builtInFeatureUsage:"Traccia il consumo di filamento per stampa",builtInFeatureCatalog:"Gestisci bobine, colori e profili K-factor",builtInFeatureThirdParty:"Le bobine di terze parti possono essere assegnate alle bobine dell'inventario",amsSyncButton:"Sincronizza pesi dall'AMS",amsSyncTitle:"Sincronizza pesi bobine dall'AMS",amsSyncMessage:"Questo sovrascriverà tutti i pesi delle bobine dell'inventario con i valori attuali di percentuale rimanente dell'AMS dalle stampanti connesse. Usa questa funzione per recuperare dati di peso corrotti. Le stampanti devono essere online.",amsSyncing:"Sincronizzazione...",amsSyncSuccess:"{{synced}} bobina/e sincronizzata/e, {{skipped}} saltata/e",amsSyncError:"Impossibile sincronizzare i pesi dall'AMS",spoolmanUrl:"URL Spoolman",spoolmanUrlHint:"URL del server Spoolman (es. http://localhost:7912)",spoolmanConnected:"Connesso",spoolmanDisconnected:"Disconnesso",status:"Stato",connect:"Connetti",disconnect:"Disconnetti",howSyncWorks:"Come funziona la sincronizzazione",syncInfoRfidOnly:"Solo le bobine ufficiali Bambu Lab con RFID vengono sincronizzate",syncInfoAutoCreate:"Le nuove bobine vengono create automaticamente in Spoolman alla prima sincronizzazione",syncInfoThirdPartySkipped:"Le bobine non Bambu Lab (terze parti, ricaricate) vengono saltate",linkingExistingSpools:"Collegamento bobine esistenti",linkingExistingSpoolsDesc:`Per collegare le bobine Spoolman esistenti all'AMS, passa il mouse su uno slot AMS e clicca "Collega a Spoolman".`,syncMode:"Modalità sincronizzazione",syncModeAuto:"Automatica",syncModeManual:"Solo manuale",syncModeAutoDesc:"I dati AMS si sincronizzano automaticamente quando vengono rilevate modifiche",syncModeManualDesc:"Sincronizzazione solo quando attivata manualmente",syncAmsData:"Sincronizza dati AMS",syncAmsDataDesc:"Sincronizza manualmente i dati AMS della stampante su Spoolman",allPrinters:"Tutte le stampanti",noDefaultPrinter:"Nessuna predefinita (chiedi ogni volta)",sidebarOrder:"Ordine barra laterale",saveThumbnails:"Salva miniature",captureFinishPhoto:"Acquisisci foto finale",noPrintersConfigured:"Nessuna stampante configurata",archiveMode:{always:"Crea sempre voce archivio",never:"Non creare mai voce archivio",ask:"Chiedi ogni volta"},checkForUpdatesLabel:"Controlla aggiornamenti",checkPrinterFirmware:"Controlla firmware stampante",includeBetaUpdates:"Includi versioni beta",includeBetaUpdatesDesc:"Notifica versioni beta e prerelease durante il controllo aggiornamenti",enableRetry:"Abilita retry",homeAssistantDescription:"Controlla prese smart tramite Home Assistant",environmentManagedLabel:"(Gestito dall'ambiente)",autoEnabledViaEnv:"Abilitato automaticamente tramite variabili d'ambiente",urlFromEnvReadOnly:"Valore impostato dalla variabile d'ambiente HA_URL (sola lettura)",tokenFromEnvReadOnly:"Valore impostato dalla variabile d'ambiente HA_TOKEN (sola lettura)",mqttConnectedTo:"Connesso a",prometheusDescription:"Esponi dati stampante in formato Prometheus",noSmartPlugsTitle:"Nessuna presa smart configurata",noSmartPlugsDescription:"Aggiungi una presa smart Tasmota per monitorare energia e automatizzare il controllo.",noProvidersTitle:"Nessun provider configurato",noProvidersDescription:"Aggiungi un provider per ricevere avvisi.",noTemplatesAvailable:"Nessun template disponibile. Riavvia il backend per generare i template predefiniti.",apiPermissionView:"Visualizza stato stampante e coda",apiPermissionEdit:"Aggiungi e rimuovi elementi dalla coda di stampa",apiKeysEmptyTitle:"Nessuna chiave API",apiKeysEmptyDescription:"Crea una chiave API per integrare servizi esterni.",noUsersFound:"Nessun utente trovato",noGroupsFound:"Nessun gruppo trovato",noGroupsAvailable:"Nessun gruppo disponibile",passwordsDoNotMatch:"Le password non coincidono",systemGroupWarning:"I nomi dei gruppi di sistema non possono essere modificati",authDisabledTitle:"Autenticazione disabilitata",authDisabledFeature1:"Richiedi accesso per usare il sistema",authDisabledFeature2:"Crea più utenti con permessi basati sui gruppi",authDisabledFeature3:"Controlla accesso con 50+ permessi granulari",userHasCreated:"Questo utente ha creato:",userItemsQuestion:"Cosa vuoi fare con questi elementi?",deleteUserConfirm:"Sei sicuro di voler eliminare questo utente?",actionCannotBeUndone:"Questa azione non può essere annullata.",addFirstSmartPlug:"Aggiungi la tua prima presa smart",providers:"Provider",log:"Log",testAll:"Testa tutto",testResults:"Risultati test",testPassedCount:"{{count}} riusciti",testFailedCount:"{{count}} falliti",messageTemplates:"Template messaggi",messageTemplatesDescription:"Personalizza i messaggi per ogni evento.",apiKeys:"Chiavi API",apiKeysDescription:"Crea chiavi API per integrazioni esterne e webhook.",createKey:"Crea chiave",apiKeyCreated:"Chiave API creata con successo",apiKeyCopyWarning:"Copia questa chiave ora - non verra mostrata di nuovo!",useInApiBrowser:"Usa nel Browser API",createNewApiKey:"Crea nuova chiave API",keyName:"Nome chiave",keyNamePlaceholder:"es., Home Assistant, OctoPrint",readStatus:"Leggi stato",readStatusDescription:"Visualizza stato stampante e coda",manageQueue:"Gestisci coda",manageQueueDescription:"Aggiungi e rimuovi elementi dalla coda di stampa",controlPrinter:"Controlla stampante",controlPrinterDescription:"Metti in pausa, riprendi e ferma stampe",unnamedKey:"Chiave senza nome",lastUsed:"Ultimo uso",read:"Lettura",control:"Controllo",createFirstKey:"Crea la tua prima chiave",webhookEndpoints:"Endpoint webhook",webhookApiKeyHint:"Usa la tua chiave API nell'header X-API-Key.",webhook:{getAllStatus:"Ottieni stato di tutte le stampanti",getSpecificStatus:"Ottieni stato di una stampante",addToQueue:"Aggiungi alla coda di stampa",pausePrint:"Metti in pausa stampa",resumePrint:"Riprendi stampa",stopPrint:"Ferma stampa"},apiBrowser:"Browser API",apiBrowserDescription:"Esplora e testa tutti gli endpoint API disponibili.",apiKeyForTesting:"Chiave API per test",apiKeyPlaceholder:"Incolla qui la tua chiave API per testare gli endpoint autenticati...",apiKeyHint:"Questa chiave verra inviata come header X-API-Key.",deleteApiKeyTitle:"Elimina chiave API",deleteApiKeyMessage:"Sei sicuro di voler eliminare questa chiave API? Le integrazioni che la usano non funzioneranno più.",deleteKey:"Elimina chiave",amsDisplayThresholds:"Soglie visualizzazione AMS",amsThresholdsDescription:"Configura soglie colore per umidità e temperatura AMS.",humidity:"Umidità",goodGreen:"Buono (verde)",fairOrange:"Discreto (arancione)",aboveFairBad:"Sopra soglia discreta mostra rosso (scarso)",temperature:"Temperatura",goodBlue:"Buono (blu)",aboveFairHot:"Sopra soglia discreta mostra rosso (caldo)",historyRetention:"Conservazione cronologia",keepSensorHistory:"Mantieni cronologia sensori per",historyRetentionDescription:"I dati più vecchi saranno eliminati automaticamente",printModal:"Modale stampa",expandCustomMapping:"Espandi mapping personalizzato di default",expandCustomMappingDescription:"Quando stampi su più stampanti, mostra mapping AMS per stampante espanso",authentication:"Autenticazione",authEnabledDescription:"La tua istanza è protetta con autenticazione",authDisabledDescription:"Abilita per richiedere accesso e gestire utenti",authDisabledMessage:"Abilita autenticazione per creare account, gestire permessi e proteggere la tua istanza Bambuddy.",enableAuthentication:"Abilita autenticazione",currentUser:"Utente corrente",changePassword:"Cambia password",admin:"Admin",users:"Utenti",addUser:"Aggiungi utente",groups:"Gruppi",addGroup:"Aggiungi gruppo",system:"Sistema",noDescription:"Nessuna descrizione",userCount:"{{count}} utenti",permissionCount:"{{count}} permessi",createUser:"Crea utente",username:"Nome utente",enterUsername:"Inserisci nome utente",password:"Password",enterPassword:"Inserisci password (min 6 caratteri)",confirmPassword:"Conferma password",confirmPasswordPlaceholder:"Conferma password",viewReleaseOnGitHub:"Vedi release su GitHub",turnAllPlugsOn:"Accendi tutte le prese",turnAllPlugsOff:"Spegni tutte le prese",clearNotificationLogs:"Cancella log notifiche",clearLogsMessage:"Questo eliminerà definitivamente tutti i log notifiche più vecchi di 30 giorni. Questa azione non può essere annullata.",clearLogs:"Cancella log",resetUiPreferences:"Reimposta preferenze UI",resetUiPreferencesMessage:"Questo reimposterà le preferenze UI ai valori predefiniti: ordine barra laterale, tema, layout dashboard, modalità vista e preferenze ordinamento. Stampanti, archivi e impostazioni server NON saranno modificati. La pagina si ricaricherà dopo la cancellazione.",resetPreferences:"Reimposta preferenze",deleteGroupTitle:"Elimina gruppo",deleteGroupMessage:"Sei sicuro di voler eliminare questo gruppo? Gli utenti in questo gruppo perderanno questi permessi.",deleteGroup:"Elimina gruppo",disableAuthenticationTitle:"Disabilita autenticazione",disableAuthenticationMessage:"Sei sicuro di voler disabilitare l'autenticazione? Questo renderà la tua istanza Bambuddy accessibile senza login. Tutti gli utenti resteranno nel database ma l'autenticazione sarà disabilitata.",disableAuthentication:"Disabilita autenticazione",configureBambuddy:"Configura Bambuddy",systemDefault:"Predefinito di sistema",archiveSettings:"Impostazioni archivio",newWindow:"Nuova finestra",embeddedOverlay:"Overlay incorporato",preferredSlicer:"Slicer preferito",preferredSlicerDescription:"Scegli quale applicazione slicer usare per aprire i file",externalCameras:"Camere esterne",costTracking:"Tracciamento costi",printsOnly:"Solo stampe",totalConsumption:"Consumo totale",dataManagement:"Gestione dati",storageUsage:"Memoria utilizzata",storageUsageDescription:"Ripartizione della memoria per categoria",storageUsageTotal:"Totale",storageUsageErrors:"Errori",storageUsageOtherBreakdown:"Altro (include risorse statiche, script e file di configurazione)",storageUsageSystem:"Sistema",storageUsageData:"Dati",storageUsageUnavailable:"Informazioni sull'utilizzo della memoria non disponibili",clearNotificationLogsDescription:"Elimina log notifiche più vecchi di 30 giorni",resetUiPreferencesDescription:"Reimposta ordine barra laterale, tema, modalità vista e preferenze layout. Stampanti, archivi e impostazioni non vengono modificati.",enableHomeAssistant:"Abilita Home Assistant",enableMqtt:"Abilita MQTT",useTls:"Usa TLS",enableMetricsEndpoint:"Abilita endpoint metriche",availableMetrics:"Metriche disponibili",editUser:"Modifica utente",deleteUserTitle:"Elimina utente",groupName:"Nome gruppo",leaveEmptyForAnonymous:"Lascia vuoto per anonimo",leaveEmptyForNoAuth:"Lascia vuoto per nessuna autenticazione",enterNewPassword:"Inserisci nuova password",confirmNewPassword:"Conferma nuova password",enterGroupName:"Inserisci nome gruppo",enterDescriptionOptional:"Inserisci descrizione (opzionale)",enterCurrentPassword:"Inserisci password attuale",enterNewPasswordMin6:"Inserisci nuova password (min 6 caratteri)",toast:{keyCopied:"Chiave copiata negli appunti",copyFailed:"Copia chiave fallita",keyAddedToBrowser:"Chiave aggiunta al Browser API",clearLogsFailed:"Eliminazione log fallita",uiPreferencesReset:"Preferenze UI reimpostate. Aggiornamento...",authDisabled:"Autenticazione disabilitata con successo",authDisableFailed:"Disabilitazione autenticazione fallita",apiKeyCreated:"Chiave API creata",apiKeyDeleted:"Chiave API eliminata",userCreated:"Utente creato con successo",userUpdated:"Utente aggiornato con successo",userDeleted:"Utente eliminato con successo",groupCreated:"Gruppo creato con successo",groupUpdated:"Gruppo aggiornato con successo",groupDeleted:"Gruppo eliminato con successo",fillRequiredFields:"Compila tutti i campi obbligatori",passwordsDoNotMatch:"Le password non coincidono",passwordTooShort:"La password deve essere di almeno 6 caratteri",enterGroupName:"Inserisci un nome gruppo",settingsSaved:"Impostazioni salvate",cameraSettingsSaved:"Impostazioni camera salvate",enterCameraUrl:"Inserisci un URL camera",passwordChanged:"Password cambiata con successo",connectionFailed:"Connessione fallita",testFailed:"Test fallito",cameraConnected:"Camera connessa{{resolution}}"},testConnection:"Testa connessione",catalog:{spoolCatalog:"Catalogo bobine",spoolCatalogDescription:"Pesi delle bobine vuote per marca/tipo. Utilizzato per la ricerca automatica del peso quando si aggiungono bobine.",searchCatalog:"Cerca nel catalogo...",addNewEntry:"Aggiungi nuova voce",namePlaceholder:"Nome (es. Bambu Lab - Plastica)",weight:"Peso",type:"Tipo",default:"Predefinito",custom:"Personalizzato",noMatch:"Nessuna voce corrisponde alla ricerca",empty:"Nessuna voce nel catalogo",deleteEntry:"Elimina voce",deleteConfirm:'Sei sicuro di voler eliminare "{{name}}"?',resetCatalog:"Ripristina catalogo",resetConfirm:"Ripristinare il catalogo ai valori predefiniti? Tutte le voci personalizzate verranno rimosse.",loadFailed:"Impossibile caricare il catalogo bobine",nameWeightRequired:"Nome e peso sono obbligatori",entryAdded:"Voce aggiunta",addFailed:"Impossibile aggiungere la voce",entryUpdated:"Voce aggiornata",updateFailed:"Impossibile aggiornare la voce",entryDeleted:"Voce eliminata",deleteFailed:"Impossibile eliminare la voce",resetSuccess:"Catalogo ripristinato ai valori predefiniti",resetFailed:"Impossibile ripristinare il catalogo",exported:"{{count}} voci esportate",imported:"{{added}} voci importate ({{skipped}} saltate)",importFailed:"Impossibile importare: formato JSON non valido",exportTooltip:"Esporta catalogo in JSON",importTooltip:"Importa catalogo da JSON",resetTooltip:"Ripristina valori predefiniti",selectedCount:"{{count}} selezionati",deleteSelected:"Elimina selezionati",bulkDeleteConfirm:"Eliminare {{count}} voci?",bulkDeleted:"{{count}} voci eliminate",bulkDeleteFailed:"Impossibile eliminare le voci"},colorCatalog:{title:"Catalogo colori",description:"Colori del filamento per produttore/materiale. Utilizzato per la ricerca automatica del colore quando si aggiungono bobine.",searchColors:"Cerca colori...",allManufacturers:"Tutti i produttori",addNewColor:"Aggiungi nuovo colore",manufacturer:"Produttore",colorName:"Nome colore",hex:"Hex",materialOptional:"Materiale (opzionale)",showing:"Visualizzazione di {{filtered}} su {{total}} colori",noMatch:"Nessun colore corrisponde alla ricerca",empty:"Nessun colore nel catalogo",deleteColor:"Elimina colore",deleteConfirm:'Sei sicuro di voler eliminare "{{name}}"?',resetCatalog:"Ripristina catalogo colori",resetConfirm:"Ripristinare il catalogo ai valori predefiniti? Tutti i colori personalizzati verranno rimossi.",sync:"Sincronizza",starting:"Avvio...",syncTooltip:"Sincronizza da FilamentColors.xyz (2000+ colori, potrebbe richiedere un minuto)",loadFailed:"Impossibile caricare il catalogo colori",fieldsRequired:"Produttore, nome colore e colore hex sono obbligatori",colorAdded:"Colore aggiunto",addFailed:"Impossibile aggiungere il colore",colorUpdated:"Colore aggiornato",updateFailed:"Impossibile aggiornare il colore",colorDeleted:"Colore eliminato",deleteFailed:"Impossibile eliminare il colore",resetSuccess:"Catalogo colori ripristinato ai valori predefiniti",resetFailed:"Impossibile ripristinare il catalogo",syncUpToDate:"Già aggiornato ({{count}} colori verificati)",syncComplete:"{{added}} nuovi colori aggiunti ({{skipped}} già esistenti)",syncError:"Errore di sincronizzazione",syncFailed:"Impossibile sincronizzare da FilamentColors.xyz",exported:"{{count}} colori esportati",imported:"{{added}} colori importati ({{skipped}} saltati)",importFailed:"Impossibile importare: formato JSON non valido",selectedCount:"{{count}} selezionati",deleteSelected:"Elimina selezionati",bulkDeleteConfirm:"Eliminare {{count}} colori?",bulkDeleted:"{{count}} colori eliminati",bulkDeleteFailed:"Impossibile eliminare i colori"},dateFormat:"Formato data",dateFormatUs:"US (MM/GG/AAAA)",dateFormatEu:"EU (GG/MM/AAAA)",dateFormatIso:"ISO (AAAA-MM-GG)",timeFormat:"Formato ora",timeFormat12:"12 ore (3:30 PM)",timeFormat24:"24 ore (15:30)",defaultPrinter:"Stampante predefinita",defaultPrinterDescription:"Preseleziona questa stampante per upload, ristampe e altre operazioni.",slicerBambuStudio:"Bambu Studio",slicerOrcaSlicer:"OrcaSlicer",sidebarOrderDescription:"Trascina gli elementi nella barra laterale per riordinare. Ripristina l'ordine predefinito qui.",reset:"Ripristina",darkMode:"Modalità scura",lightMode:"Modalità chiara",active:"(attivo)",background:"Sfondo",accent:"Accento",style:"Stile",bgNeutral:"Neutro",bgWarm:"Caldo",bgCool:"Freddo",bgOled:"OLED Nero",bgSlate:"Blu ardesia",bgForest:"Verde foresta",accentGreen:"Verde",accentTeal:"Verde acqua",accentBlue:"Blu",accentOrange:"Arancione",accentPurple:"Viola",accentRed:"Rosso",styleClassic:"Classico",styleGlow:"Luminoso",styleVibrant:"Vibrante",themeToggleHint:"Passa tra modalità scura e chiara con l'icona sole/luna nella barra laterale.",autoArchivePrints:"Archiviazione automatica stampe",autoArchiveDescription:"Salva automaticamente i file 3MF al completamento delle stampe",saveThumbnailsDescription:"Estrai e salva le immagini di anteprima dai file 3MF",captureFinishPhotoDescription:"Scatta una foto dalla fotocamera della stampante al completamento della stampa",ffmpegNotInstalled:"ffmpeg non installato",ffmpegRequired:"L'acquisizione dalla fotocamera richiede ffmpeg. Installalo tramite <brew>brew install ffmpeg</brew> (macOS) o <apt>apt install ffmpeg</apt> (Linux).",camera:"Fotocamera",cameraViewMode:"Modalità visualizzazione fotocamera",cameraOverlayDescription:"La fotocamera si apre in un overlay ridimensionabile sulla schermata principale",cameraWindowDescription:"La fotocamera si apre in una finestra separata del browser",externalCamerasDescription:"Configura fotocamere esterne per sostituire la fotocamera integrata della stampante. Supporta stream MJPEG, RTSP, snapshot HTTP e fotocamere USB (V4L2). Quando abilitata, la fotocamera esterna viene usata per la vista in diretta e le foto di completamento.",cameraPlaceholderUsb:"Percorso dispositivo (/dev/video0)",cameraPlaceholderUrl:"URL fotocamera (rtsp://... o http://...)",cameraTypeMjpeg:"Stream MJPEG",cameraTypeRtsp:"Stream RTSP",cameraTypeSnapshot:"Snapshot HTTP",cameraTypeUsb:"Fotocamera USB (V4L2)",test:"Test",connected:"Connesso",disconnected:"Disconnesso",currency:"Valuta",defaultFilamentCost:"Costo filamento predefinito (per kg)",electricityCost:"Costo elettricità per kWh",energyDisplayMode:"Modalità visualizzazione energia",energyModePrintDescription:"La dashboard mostra la somma dell'energia usata durante le stampe",energyModeTotalDescription:"La dashboard mostra l'energia totale dalle prese smart",fileManager:"Gestore file",createArchiveEntry:"Crea voce archivio durante la stampa",createArchiveEntryDescription:"Quando si stampa dal gestore file, crea opzionalmente una voce di archivio",lowDiskSpaceWarning:"Avviso spazio disco insufficiente",lowDiskSpaceDescription:"Mostra avviso quando lo spazio disco scende sotto questa soglia",printerFirmware:"Firmware stampante",checkFirmwareDescription:"Controlla aggiornamenti firmware da Bambu Lab",bambuddySoftware:"Software Bambuddy",autoCheckDescription:"Controlla automaticamente nuove versioni all'avvio",checkNow:"Controlla ora",updateAvailableVersion:"Aggiornamento disponibile: v{{version}}",releaseNotes:"Note di rilascio",updateViaDocker:"Aggiorna tramite Docker Compose:",installUpdate:"Installa aggiornamento",latestVersionRunning:"Stai usando l'ultima versione",failedToCheckUpdates:"Controllo aggiornamenti fallito: {{error}}",backupRestore:"Backup e ripristino",backupRestoreDescription:"Esporta/importa impostazioni e configura backup GitHub",goToBackup:"Vai al backup",externalUrl:"URL esterno",externalUrlDescription:"L'URL esterno dove Bambuddy è accessibile. Usato per immagini di notifica e integrazioni esterne.",bambuddyUrl:"URL Bambuddy",externalUrlHint:"Includi protocollo e porta (es. http://192.168.1.100:8000)",ftpRetry:"Riprova FTP",ftpRetryDescription:"Riprova le operazioni FTP quando il WiFi della stampante è instabile. Si applica a download 3MF, upload stampe, download timelapse e aggiornamenti firmware.",autoRetryDescription:"Riprova automaticamente le operazioni FTP fallite",retryAttempts:"Tentativi di ripetizione",retryDelay:"Ritardo ripetizione",connectionTimeout:"Timeout connessione",time_one:"{{count}} volta",time_other:"{{count}} volte",second_one:"{{count}} secondo",second_other:"{{count}} secondi",nSeconds:"{{count}} secondi",increaseForWeakWifi:"Aumenta per stampanti con WiFi debole",homeAssistant:"Home Assistant",homeAssistantFullDescription:"Connetti a Home Assistant per controllare le prese smart tramite l'API REST HA. Supporta entità switch, light, input_boolean e script.",homeAssistantUrl:"URL Home Assistant",longLivedAccessToken:"Token di accesso a lunga durata",haTokenHint:"Crea un token in HA: Profilo → Token di accesso a lunga durata → Crea token",connectionSuccessful:"Connessione riuscita",connectionFailed:"Connessione fallita",haConnectionSuccess:"Connesso con successo a Home Assistant.",haConnectionFailed:"Connessione a Home Assistant fallita.",mqttPublishing:"Pubblicazione MQTT",mqttDescription:"Pubblica eventi BamBuddy su un broker MQTT esterno per l'integrazione con Node-RED, Home Assistant e altri sistemi di automazione.",mqttEnableDescription:"Pubblica eventi su broker MQTT esterno",brokerHostname:"Hostname broker",port:"Porta",usernameOptional:"Nome utente (opzionale)",passwordOptional:"Password (opzionale)",topicPrefix:"Prefisso topic",topicPrefixHint:"I topic saranno: {{prefix}}/printers/<serial>/status, ecc.",prometheusMetrics:"Metriche Prometheus",prometheusEndpointDescription:"Esponi metriche stampante su <code>/api/v1/metrics</code> per monitoraggio Prometheus/Grafana.",bearerTokenOptional:"Token Bearer (opzionale)",bearerTokenHint:"Se impostato, le richieste devono includere <code>Authorization: Bearer <token></code>",metricsConnectionStatus:"Stato connessione",metricsPrinterState:"Stato stampante (idle/printing/ecc)",metricsPrintProgress:"Progresso stampa 0-100%",metricsBedTemp:"Temperatura piatto",metricsNozzleTemp:"Temperatura ugello",metricsPrintsTotal:"Stampe totali per risultato",metricsMore:"...e altro (strati, ventole, coda, consumo filamento)",smartPlugsDescription:"Connetti prese smart (Tasmota o Home Assistant) per automatizzare il controllo dell'alimentazione e monitorare il consumo energetico delle stampanti.",allOn:"Tutte accese",allOff:"Tutte spente",addSmartPlug:"Aggiungi presa smart",energySummary:"Riepilogo energia",currentPower:"Potenza attuale",plugsOnline:"{{reachable}}/{{total}} prese online",today:"Oggi",yesterday:"Ieri",total:"Totale",enablePlugsForSummary:"Abilita le prese per vedere il riepilogo energia",addNotificationProvider:"Aggiungi",systemBadge:"(Sistema)",creating:"Creazione...",changing:"Modifica...",deleteUserAndItems:"Elimina utente E i suoi elementi",deleteUserKeepItems:"Elimina utente, mantieni elementi (diventeranno senza proprietario)",ok:"OK"},notification:{printStarted:{title:"Stampa avviata",body:"{{printer}}: {{filename}} ha iniziato a stampare"},printCompleted:{title:"Stampa completata",body:"{{printer}}: {{filename}} completata con successo"},printFailed:{title:"Stampa fallita",body:"{{printer}}: {{filename}} fallita"},printStopped:{title:"Stampa interrotta",body:"{{printer}}: {{filename}} interrotta"},printProgress:{title:"Avanzamento stampa",body:"{{printer}}: {{filename}} al {{percent}}% completamento"},printerOffline:{title:"Stampante offline",body:"{{printer}} e offline"},printerError:{title:"Errore stampante",body:"{{printer}}: {{error}}"},filamentLow:{title:"Filamento in esaurimento",body:"{{printer}}: Filamento in esaurimento"},maintenanceDue:{title:"Manutenzione dovuta",body:"{{printer}}: {{items}} richiedono attenzione"}},errors:{generic:"Qualcosa e andato storto",networkError:"Errore di rete. Controlla la connessione.",notFound:"Non trovato",unauthorized:"Non autorizzato",serverError:"Errore server",validationError:"Controlla i dati inseriti",printerConnectionFailed:"Connessione alla stampante fallita",saveFailed:"Salvataggio modifiche fallito",deleteFailed:"Eliminazione fallita",loadFailed:"Caricamento dati fallito"},hmsErrors:{title:"Errori - {{name}}",noErrors:"Nessun errore",viewOnWiki:"Vedi su Bambu Lab Wiki",clearInstructions:"Cancella gli errori sulla stampante per rimuoverli qui.",clearErrors:"Cancella errori",clearSuccess:"Errori HMS cancellati",clearFailed:"Impossibile cancellare gli errori HMS"},mqttDebug:{title:"Log debug MQTT",searchPlaceholder:"Cerca topic o payload...",noMessages:"Nessun messaggio registrato",startLoggingHint:'Clicca "Avvia logging" per iniziare a catturare messaggi MQTT',noMessagesMatch:"Nessun messaggio corrisponde al filtro",adjustFilterHint:"Prova a modificare la ricerca o i filtri",incoming:"In ingresso",outgoing:"In uscita",loggingStopped:"Logging fermato",loggingActive:"Logging attivo - i messaggi si aggiornano automaticamente",startLogging:"Avvia logging",stopLogging:"Ferma logging",clearLog:"Pulisci log",topic:"Topic",timestamp:"Timestamp",direction:"Direzione",all:"Tutti"},printerFiles:{title:"Gestore file",storageUsed:"Usato:",storageFree:"Libero:",filterPlaceholder:"Filtra file...",deleteButton:"Elimina",deleteFiles:"Elimina {{count}} file",deleteFileConfirm:'Eliminare "{{name}}"? Questa azione non può essere annullata.',deleteFilesConfirm:"Eliminare {{count}} file selezionati? Questa azione non può essere annullata.",noFiles:"Nessun file sulla stampante",loadingFiles:"Caricamento file...",failedToLoad:"Caricamento file fallito",toast:{filesDeleted:"Eliminati {{count}} file",deleteFailed:"Eliminazione fallita: {{error}}"}},confirm:{delete:"Sei sicuro di voler eliminare questo?",unsavedChanges:"Hai modifiche non salvate. Sei sicuro di voler uscire?",clearQueue:"Sei sicuro di voler svuotare la coda?"},login:{title:"Login Bambuddy",subtitle:"Accedi al tuo account",username:"Nome utente",usernamePlaceholder:"Inserisci il nome utente",usernameOrEmail:"Nome utente o email",usernameOrEmailPlaceholder:"Nome utente o @ Email",password:"Password",passwordPlaceholder:"Inserisci la password",signIn:"Accedi",signingIn:"Accesso in corso...",forgotPassword:"Hai dimenticato la password?",loginSuccess:"Accesso riuscito",loginFailed:"Accesso fallito",enterCredentials:"Inserisci nome utente e password",forgotPasswordTitle:"Password dimenticata",forgotPasswordMessage:"Se hai dimenticato la password, contatta il tuo amministratore di sistema per reimpostarla.",forgotPasswordEmailMessage:"Inserisci il tuo indirizzo email e ti invieremo una nuova password.",emailAddress:"Indirizzo email",emailPlaceholder:"tua.email@esempio.com",cancel:"Annulla",sending:"Invio...",sendResetEmail:"Invia email di reimpostazione",howToReset:"Come reimpostare la password:",resetStep1:"Contatta il tuo amministratore Bambuddy",resetStep2:"Chiedi di reimpostare la password in Gestione utenti",resetStep3:"Possono impostare una nuova password temporanea",resetStep4:"Accedi con la nuova password e cambiala in Impostazioni",gotIt:"Capito"},setup:{title:"Configurazione Bambuddy",subtitle:"Configura autenticazione per la tua istanza Bambuddy",enableAuth:"Abilita autenticazione",adminAccount:"Account admin",adminAccountDesc:"Se esistono già admin, l'autenticazione verrà abilitata usando gli account esistenti. Lascia i campi sotto vuoti per usare gli admin esistenti, oppure inserisci nuove credenziali per creare un nuovo utente admin.",adminUsername:"Nome utente admin",adminPassword:"Password admin",optionalIfAdminExists:"(opzionale se esistono admin)",adminUsernamePlaceholder:"Inserisci nome utente admin (opzionale)",adminPasswordPlaceholder:"Inserisci password admin (opzionale)",confirmPassword:"Conferma password",confirmPasswordPlaceholder:"Conferma password admin",settingUp:"Configurazione...",completeSetup:"Completa configurazione",toast:{authEnabledAdminCreated:"Autenticazione abilitata e utente admin creato",authEnabledExistingAdmins:"Autenticazione abilitata usando admin esistenti",setupCompleted:"Configurazione completata",enterBothCredentials:"Inserisci nome utente e password admin, oppure lascia entrambi vuoti per usare admin esistenti",passwordsDoNotMatch:"Le password non coincidono",passwordTooShort:"La password deve essere di almeno 6 caratteri"}},changePassword:{title:"Cambia password",currentPassword:"Password attuale",currentPasswordPlaceholder:"Inserisci password attuale",newPassword:"Nuova password",newPasswordPlaceholder:"Inserisci nuova password (min 6 caratteri)",confirmPassword:"Conferma nuova password",confirmPasswordPlaceholder:"Conferma nuova password",passwordsDoNotMatch:"Le password non coincidono",passwordTooShort:"La password deve essere di almeno 6 caratteri",changing:"Modifica in corso...",success:"Password cambiata con successo",failed:"Modifica password fallita"},plateAlert:{title:"Stampa in pausa!",message:"Oggetti rilevati sul piatto. La stampa è stata messa automaticamente in pausa. Svuota il piatto e riprendi la stampa.",understand:"Ho capito"},camera:{title:"Vista camera",invalidPrinterId:"ID stampante non valido",live:"Live",snapshot:"Snapshot",restartStream:"Riavvia stream",refreshSnapshot:"Aggiorna snapshot",fullscreen:"Schermo intero",exitFullscreen:"Esci da schermo intero",connectingToCamera:"Connessione alla camera...",capturingSnapshot:"Acquisizione snapshot...",connectionLost:"Connessione persa",connectionFailed:"Connessione camera fallita",reconnecting:"Riconnessione tra {{countdown}}s... (tentativo {{attempt}}/{{max}})",reconnectNow:"Riconnetti ora",cameraUnavailable:"Camera non disponibile",cameraUnavailableDesc:"Assicurati che la stampante sia accesa e connessa.",noCamera:"Nessuna camera disponibile",retry:"Riprova",cameraStream:"Stream camera",zoomOut:"Zoom indietro",zoomIn:"Zoom avanti",resetZoom:"Reset zoom",recording:"Registrazione",startRecording:"Avvia registrazione",stopRecording:"Ferma registrazione",chamberLight:"Accendi/Spegni luce camera"},groups:{title:"Gestione gruppi",subtitle:"Gestisci gruppi permessi per controllo accesso",backToSettings:"Torna a Impostazioni",createGroup:"Crea gruppo",noPermission:"Non hai il permesso di accedere a questa pagina.",system:"Sistema",noDescription:"Nessuna descrizione",usersCount:"{{count}} utenti",permissionsCount:"{{count}} permessi",edit:"Modifica",delete:"Elimina",toast:{created:"Gruppo creato con successo",updated:"Gruppo aggiornato con successo",deleted:"Gruppo eliminato con successo",enterGroupName:"Inserisci un nome gruppo"},modal:{editGroup:"Modifica gruppo",createGroup:"Crea gruppo",cancel:"Annulla",saving:"Salvataggio...",creating:"Creazione...",saveChanges:"Salva modifiche"},form:{groupName:"Nome gruppo",groupNamePlaceholder:"Inserisci nome gruppo",systemGroupWarning:"I nomi dei gruppi di sistema non possono essere modificati",description:"Descrizione",descriptionPlaceholder:"Inserisci descrizione (opzionale)",permissions:"Permessi ({{count}} selezionati)"},deleteModal:{title:"Elimina gruppo",message:"Sei sicuro di voler eliminare questo gruppo? Gli utenti in questo gruppo perderanno questi permessi.",confirm:"Elimina gruppo"},editor:{title:"Modifica gruppo",createTitle:"Crea gruppo",search:"Cerca permessi...",selectAll:"Seleziona tutto",clearAll:"Deseleziona tutto",permissionsSelected:"{{count}} selezionati",noResults:"Nessun permesso corrisponde alla ricerca"}},users:{title:"Gestione utenti",subtitle:"Gestisci utenti e accesso alla tua istanza Bambuddy",backToSettings:"Torna a Impostazioni",createUser:"Crea utente",noPermission:"Non hai il permesso di accedere a questa pagina.",admin:"Admin",noGroups:"Nessun gruppo",active:"Attivo",inactive:"Inattivo",edit:"Modifica",delete:"Elimina",system:"Sistema",noGroupsAvailable:"Nessun gruppo disponibile",table:{username:"Nome utente",groups:"Gruppi",status:"Stato",actions:"Azioni"},toast:{created:"Utente creato con successo",updated:"Utente aggiornato con successo",deleted:"Utente eliminato con successo",fillRequired:"Compila tutti i campi obbligatori",passwordsDoNotMatch:"Le password non coincidono",passwordTooShort:"La password deve essere di almeno 6 caratteri"},modal:{createUser:"Crea utente",editUser:"Modifica utente",cancel:"Annulla",creating:"Creazione...",saving:"Salvataggio...",saveChanges:"Salva modifiche",advancedAuthSubtitle:"con autenticazione avanzata"},form:{username:"Nome utente",usernamePlaceholder:"Inserisci nome utente",email:"Email",emailPlaceholder:"utente@esempio.com",password:"Password",passwordPlaceholder:"Inserisci password",confirmPassword:"Conferma password",confirmPasswordPlaceholder:"Conferma password",newPasswordPlaceholder:"Inserisci nuova password",confirmNewPasswordPlaceholder:"Conferma nuova password",leaveBlankToKeep:"lascia vuoto per mantenere attuale",groups:"Gruppi",optional:"opzionale",autoGeneratedPassword:"Una password sicura verrà generata automaticamente e inviata via email all'utente.",passwordManagedByAdvancedAuth:`La password è gestita dall'autenticazione avanzata. Usa "Reimposta password" per inviare una nuova password all'utente via email.`,resetPassword:"Reimposta password",resettingPassword:"Reimpostazione password..."},deleteModal:{title:"Elimina utente",message:"Sei sicuro di voler eliminare questo utente? Questa azione non può essere annullata.",confirm:"Elimina utente"}},streamOverlay:{title:"Overlay stream",invalidPrinterId:"ID stampante non valido",cameraStream:"Stream camera",progress:"Avanzamento",eta:"ETA",printerIdle:"Stampante inattiva",printerOffline:"Stampante offline",status:{printing:"In stampa",paused:"In pausa",finished:"Completata",failed:"Fallita",idle:"Inattiva",unknown:"Sconosciuto"}},profiles:{title:"Profili",subtitle:"Gestisci preset slicer e calibrazioni pressure advance",tabs:{cloud:"Profili cloud",local:"Profili locali",kprofiles:"K-Profiles"},localProfiles:{title:"Profili locali",subtitle:"Importa e gestisci preset slicer da OrcaSlicer",import:"Importa profili",importDesc:"Trascina file .bbscfg, .bbsflmt, .orca_filament, .zip o .json qui",importing:"Importazione...",search:"Cerca preset locali...",noPresets:"Nessun preset locale ancora",badge:"Locale",edit:"Modifica",delete:"Elimina",cancel:"Annulla",deleteConfirmTitle:"Elimina preset",deleteConfirm:"Sei sicuro di voler eliminare questo preset? Questa azione non può essere annullata.",source:"Fonte",inheritsFrom:"Eredita da",filamentType:"Tipo",vendor:"Produttore",compatiblePrinters:"Stampanti",nozzleTemp:"Temp. ugello",cost:"Costo",density:"Densità",pressureAdvance:"Pressure Advance",filament:"Filamento",process:"Processo",printer:"Stampante",toast:{importSuccess:"{{count}} preset importati",importSkipped:"{{count}} preset saltati (duplicati)",importError:"{{count}} errori durante l'importazione",deleted:"Preset eliminato",updated:"Preset aggiornato"}},connectedAs:"Connesso come",logout:"Esci",noLogoutPermission:"Non hai il permesso di disconnetterti",failedToLoad:"Caricamento profili fallito",retry:"Riprova",time:{justNow:"Proprio ora",minsAgo:"{{count}}m fa",hoursAgo:"{{count}}h fa",daysAgo:"{{count}}g fa"},toast:{loggedOut:"Disconnesso"},login:{title:"Connetti a Bambu Cloud",subtitle:"Sincronizza i preset del slicer tra dispositivi",email:"Email",password:"Password",region:"Regione",regionGlobal:"Globale",regionChina:"Cina",verificationCode:"Codice di verifica",totpCode:"Codice autenticatore",checkEmail:"Controlla la tua email ({{email}}) per un codice a 6 cifre",enterTotpHint:"Inserisci il codice a 6 cifre dalla tua app autenticatore",accessToken:"Access Token",accessTokenHint:"Incolla il tuo access token Bambu Lab (da Bambu Studio)",back:"Indietro",loginButton:"Accedi",verifyButton:"Verifica",setTokenButton:"Imposta token",useToken:"Usa access token invece",useEmail:"Accedi con email invece",toast:{loggedIn:"Accesso riuscito",codeSent:"Codice di verifica inviato via email",enterTotp:"Inserisci il codice dalla tua app autenticatore",tokenSet:"Token impostato con successo"}},presets:{myPreset:"Il mio preset (modificabile)",duplicate:"Duplica",editable:"Modificabile",failedToLoadDetails:"Caricamento dettagli preset fallito",deleteConfirm:"Eliminare questo preset?",deleteWarning:'Questo eliminerà definitivamente "{{name}}" da Bambu Cloud. Questa azione non può essere annullata.',noDuplicatePermission:"Non hai il permesso di duplicare preset",noEditPermission:"Non hai il permesso di modificare preset",noDeletePermission:"Non hai il permesso di eliminare preset",types:{filament:"Preset filamento",printer:"Preset stampante",process:"Preset processo"},toast:{deleted:"Preset eliminato",created:"Preset creato",updated:"Preset aggiornato",duplicated:"Preset duplicato",fieldAdded:'Campo "{{key}}" aggiunto',exported:"Preset esportato"},baseLabel:"Base: {{name}}",currentLabel:"Corrente: {{name}}",newPreset:"Nuovo preset",editPreset:"Modifica preset",duplicatePreset:"Duplica preset",createNewPreset:"Crea nuovo preset",customizeSettings:"Personalizza le impostazioni per il nuovo preset",compareWithBase:"Confronta con base",compare:"Confronta",basePreset:"Preset base",selectBasePreset:"Seleziona preset base...",presetName:"Nome preset",myCustomPreset:"Il mio preset personalizzato",inheritsFrom:"Deriva da",dropJsonToImport:"Rilascia JSON per importare",tabs:{common:"Comune",allFields:"Tutti i campi"},availableFields:"Campi disponibili",searchFieldsPlaceholder:"Cerca campi...",noMatchingFields:"Nessun campo corrispondente",allFieldsAdded:"Tutti i campi aggiunti",addCustomField:"Aggiungi campo personalizzato",yourOverrides:"Le tue override",noOverridesYet:"Nessun override ancora",clickFieldsToAdd:"Clicca i campi a sinistra per aggiungerli",saveAsTemplate:"Salva come template",jsonTip:"Suggerimento: trascina e rilascia un file .json ovunque in questa modale per importare impostazioni"},cloudView:{searchPlaceholder:"Cerca preset...",templates:"Template",refresh:"Aggiorna",newPreset:"Nuovo preset",clearFilters:"Pulisci filtri",compareMode:"Modalita confronto",selectAnotherPreset:"Seleziona un altro preset {{type}}",clickTwoPresets:"Clicca due preset dello stesso tipo per confrontare",selectFirst:"1. Seleziona il primo",selectSecond:"2. Seleziona il secondo",compareNow:"Confronta ora",lastSynced:"Ultima sincronizzazione:",showingCount:"Mostrati {{showing}} di {{total}} preset",noPresetsFound:"Nessun preset trovato",columns:{filament:"Filamento",process:"Processo",printer:"Stampante"},noFilamentPresets:"Nessun preset filamento",noProcessPresets:"Nessun preset processo",noPrinterPresets:"Nessun preset stampante",filters:{type:"Tipo",owner:"Proprietario",printer:"Stampante",nozzle:"Ugello",filament:"Filamento",layer:"Layer",all:"Tutti",myPresets:"I miei preset",builtIn:"Integrati",process:"Processo"},noTemplatesPermission:"Non hai il permesso di gestire i template",noRefreshPermission:"Non hai il permesso di aggiornare i profili",noCreatePermission:"Non hai il permesso di creare preset"},templates:{title:"Template rapidi",noTemplates:"Nessun template ancora",createFirst:"Crea template dall'editor preset",typeFilter:"Tipo:",deleteTitle:"Elimina template",deleteWarning:"Questa azione non può essere annullata",deleteConfirm:'Sei sicuro di voler eliminare "{{name}}"?',namePlaceholder:"Nome template",descriptionPlaceholder:"Descrizione",settingsJson:"Impostazioni (JSON)",fieldsCount:"{{count}} campi",shownInModals:"Mostrati nelle modali",hiddenInModals:"Nascosti nelle modali",apply:"Applica",toast:{deleted:"Template eliminato",updated:"Template aggiornato",created:"Template creato",applied:"Template applicato"}}},support:{debugLoggingActive:"Log debug attivo",manageLogs:"Gestisci",collectItem7:"Connettività stampante e versioni firmware",collectItem8:"Stato integrazioni (Spoolman, MQTT, HA)",collectItem9:"Interfacce di rete (solo subnet)",collectItem10:"Versioni dei pacchetti Python",collectItem11:"Controlli di integrità del database",collectItem12:"Dettagli dell'ambiente Docker"},fileManager:{title:"Gestore file",subtitle:"Organizza e gestisci i tuoi file di stampa",uploadFiles:"Carica file",newFolder:"Nuova cartella",folderName:"Nome cartella",folderNamePlaceholder:"es., Parti funzionali",renameFile:"Rinomina file",renameFolder:"Rinomina cartella",moveFiles:"Sposta {{count}} file",rootNoFolder:"Root (nessuna cartella)",current:"corrente",linkFolder:"Collega cartella",linkFolderDescription:'Collega "{{name}}" a un progetto o archivio per accesso rapido.',project:"Progetto",archive:"Archivio",noProjectsFound:"Nessun progetto trovato",noArchivesFound:"Nessun archivio trovato",unlink:"Scollega",link:"Collega",dragDropFiles:"Trascina e rilascia file qui",dropFilesHere:"Rilascia file qui",orClickToBrowse:"oppure clicca per sfogliare",allFileTypesSupported:"Tutti i tipi di file supportati. I file ZIP saranno estratti.",zipFilesDetected:"File ZIP rilevati",zipExtractOptions:"I file ZIP saranno estratti. Scegli come gestire la struttura cartelle:",preserveZipStructure:"Mantieni struttura cartelle dal ZIP",createFolderFromZip:"Crea cartella dal nome ZIP",stlThumbnailGeneration:"Generazione miniature STL",zipMayContainStl:"I file ZIP possono contenere STL. Le miniature possono essere generate durante l'estrazione.",thumbnailsCanBeGenerated:"Le miniature possono essere generate per file STL. I modelli grandi possono richiedere più tempo.",generateThumbnailsForStl:"Genera miniature per file STL",threemfDetected:"File 3MF rilevati",threemfExtractionInfo:"Modello stampante, materiale, colore e impostazioni stampa saranno estratti automaticamente dai file 3MF.",willBeExtracted:"Sara estratto",filesExtracted:"{{count}} file estratti",uploadComplete:"Caricamento completato: {{succeeded}} riusciti",uploadFailed:"Caricamento fallito",zipFilesFailed:"{{count}} file falliti",uploading:"Caricamento...",changeLink:"Cambia collegamento...",linkTo:"Collega a...",linkToProjectOrArchive:"Collega a progetto o archivio",addToQueue:"Aggiungi alla coda",schedulePrint:"Pianifica",generateThumbnail:"Genera miniatura",generateThumbnails:"Genera miniature",generateThumbnailsForMissing:"Genera miniature per STL senza miniatura",gridView:"Vista griglia",listView:"Vista elenco",lowDiskSpaceWarning:"Avviso spazio disco basso",lowDiskSpaceDetails:"Solo {{free}} liberi su {{total}} totali. La soglia e {{threshold}} GB nelle impostazioni.",files:"File",folders:"Cartelle",size:"Dimensione",free:"Libero",allFiles:"Tutti i file",wrap:"A capo",enableTextWrapping:"Abilita a capo testo",disableTextWrapping:"Disabilita a capo testo",dragToResizeTooltip:"Trascina per ridimensionare, doppio clic per reset",searchFiles:"Cerca file...",allTypes:"Tutti i tipi",prints:"Stampe",ascending:"Crescente",descending:"Decrescente",resultsCount:"{{showing}} di {{total}} file",selectAll:"Seleziona tutto",deselectAll:"Deseleziona tutto",selected:"{{count}} selezionati",adding:"Aggiunta...",loadingFiles:"Caricamento file...",folderIsEmpty:"La cartella e vuota",noFilesYet:"Nessun file ancora",folderEmptyDescription:"Carica file o sposta file in questa cartella per iniziare.",noFilesDescription:"Carica file per iniziare a organizzare i file di stampa.",noMatchingFiles:"Nessun file corrispondente",noMatchingFilesDescription:"Nessun file corrisponde ai criteri di ricerca o filtro.",clearFilters:"Pulisci filtri",printedCount:"Stampato {{count}}x",uploadedBy:"Caricato da",deleteFolder:"Elimina cartella",deleteFile:"Elimina file",deleteFilesCount:"Elimina {{count}} file",deleteFolderConfirm:"Sei sicuro di voler eliminare questa cartella? Tutti i file dentro saranno eliminati.",deleteFileConfirm:"Sei sicuro di voler eliminare questo file?",deleteFilesConfirm:"Sei sicuro di voler eliminare {{count}} file selezionati? Questa azione non può essere annullata.",deleting:"Eliminazione...",noPermissionRenameFolder:"Non hai il permesso di rinominare cartelle",noPermissionLinkFolder:"Non hai il permesso di collegare cartelle",noPermissionDeleteFolder:"Non hai il permesso di eliminare cartelle",noPermissionPrint:"Non hai il permesso di stampare",noPermissionAddToQueue:"Non hai il permesso di aggiungere alla coda",noPermissionDownload:"Non hai il permesso di scaricare file",noPermissionRenameFile:"Non hai il permesso di rinominare questo file",noPermissionGenerateThumbnail:"Non hai il permesso di generare miniature",noPermissionDeleteFile:"Non hai il permesso di eliminare questo file",noPermissionCreateFolder:"Non hai il permesso di creare cartelle",noPermissionUpload:"Non hai il permesso di caricare file",noPermissionMoveFiles:"Non hai il permesso di spostare file",noPermissionDeleteFiles:"Non hai il permesso di eliminare file",toast:{folderCreated:"Cartella creata",folderDeleted:"Cartella eliminata",fileDeleted:"File eliminato",filesDeleted:"Eliminati {{count}} file",filesMoved:"File spostati",folderLinked:"Cartella collegata",folderUnlinked:"Cartella scollegata",addedToQueue:"Aggiunti {{count}} file alla coda",addedToQueuePartial:"Aggiunti {{added}} file, {{failed}} falliti",failedToAddToQueue:"Aggiunta file fallita: {{error}}",fileRenamed:"File rinominato",folderRenamed:"Cartella rinominata",thumbnailsGenerated:"Generate {{count}} miniature",thumbnailsGeneratedPartial:"Generate {{succeeded}} miniature, {{failed}} fallite",noStlMissingThumbnails:"Nessun file STL senza miniature",failedToGenerateThumbnails:"Generazione miniature fallita: {{error}}",thumbnailGenerated:"Miniatura generata",failedToGenerateThumbnail:"Generazione miniatura fallita: {{error}}"}},projects:{title:"Progetti",subtitle:"Organizza e traccia i tuoi progetti di stampa 3D",newProject:"Nuovo progetto",editProject:"Modifica progetto",deleteProject:"Elimina progetto",projectName:"Nome progetto",description:"Descrizione",noProjects:"Nessun progetto ancora",noProjectsFiltered:"Nessun progetto {{status}}",noProjectsFilteredHelp:"Non hai progetti {{status}}. I progetti appariranno qui quando il loro stato cambia.",createFirst:"Crea il tuo primo progetto per organizzare stampe correlate, tracciare progressi e gestire i tuoi build.",createFirstButton:"Crea il tuo primo progetto",create:"Crea",files:"File",prints:"Stampe",plates:"piatti",parts:"parti",lastModified:"Ultima modifica",deleteConfirm:"Sei sicuro di voler eliminare questo progetto? Archivi e elementi in coda saranno scollegati ma non eliminati.",addFiles:"Aggiungi file",removeFile:"Rimuovi file",viewDetails:"Vedi dettagli",namePlaceholder:"es., Build Voron 2.4",descriptionPlaceholder:"Descrizione opzionale...",color:"Colore",targetPlates:"Piatti target",targetPlatesPlaceholder:"es., 25",targetPlatesHelp:"Numero di job di stampa",targetParts:"Parti target",targetPartsPlaceholder:"es., 150",targetPartsHelp:"Totale oggetti necessari",tagsLabel:"Tag (separati da virgola)",tagsPlaceholder:"es., voron, funzionale, regalo",dueDate:"Data scadenza",priority:"Priorita",priorityLow:"Bassa",priorityNormal:"Normale",priorityHigh:"Alta",priorityUrgent:"Urgente",statusActive:"Attivo",statusCompleted:"Completato",statusArchived:"Archiviato",done:"Fatto",completed:"completato",failed:"fallito",inQueue:"in coda",noPrintsYet:"Nessuna stampa ancora",printJobs:"Job di stampa (piatti)",partsPrinted:"Parti stampate",failedParts:"Parti fallite",import:"Importa",export:"Esporta",importProject:"Importa progetto",exportAll:"Esporta tutti i progetti",loading:"Caricamento progetti...",noEditPermission:"Non hai il permesso di modificare progetti",noDeletePermission:"Non hai il permesso di eliminare progetti",noCreatePermission:"Non hai il permesso di creare progetti",noImportPermission:"Non hai il permesso di importare progetti",noExportPermission:"Non hai il permesso di esportare progetti",toast:{created:"Progetto creato",updated:"Progetto aggiornato",deleted:"Progetto eliminato",imported:"Progetto importato",multipleImported:"{{count}} progetti importati",importFailed:"Import fallito",exported:"Progetti esportati (solo metadati)"}},projectDetail:{notFound:"Progetto non trovato",backToProjects:"Torna a Progetti",export:"Esporta",exportProject:"Esporta progetto",noExportPermission:"Non hai il permesso di esportare progetti",noEditPermission:"Non hai il permesso di modificare progetti",partOf:"Parte di:",priorityLabel:"Priorita:",noPrints:"Nessuna stampa in questo progetto ancora",status:{active:"Attivo",completed:"Completato",archived:"Archiviato"},priority:{low:"Bassa",normal:"Normale",high:"Alta",urgent:"Urgente"},dueDate:{overdue:"Scaduto",today:"Scade oggi",daysLeft:"{{count}} giorni rimanenti"},progress:{platesProgress:"Avanzamento piatti",partsProgress:"Avanzamento parti",printJobs:"job di stampa",parts:"parti",percentComplete:"{{percent}}% completato",remaining:"{{count}} rimanenti"},stats:{printJobs:"Job di stampa",total:"totale",failed:"{{count}} falliti",partsPrinted:"{{count}} parti stampate",printTime:"Tempo di stampa",filamentUsed:"Filamento usato"},cost:{title:"Tracciamento costi",filamentCost:"Costo filamento",energy:"Energia",budget:"Budget",remaining:"Rimanente"},subProjects:{title:"Sotto-progetti ({{count}})"},notes:{title:"Note",noEditPermission:"Non hai il permesso di modificare le note",placeholder:"Aggiungi note su questo progetto...",empty:"Nessuna nota ancora. Clicca Modifica per aggiungere note."},files:{title:"File",linkFolders:"Collega cartelle dal Gestore file",forQuickAccess:"a questo progetto per accesso rapido.",fileCount:"{{count}} file",empty:"Nessuna cartella collegata. Vai a Gestore file e collega una cartella a questo progetto."},bom:{title:"Distinta materiali",acquired:"{{completed}}/{{total}} acquisiti",showAll:"Mostra tutti",hideDone:"Nascondi completati",addPart:"Aggiungi parte",noAddPermission:"Non hai il permesso di aggiungere parti",partNamePlaceholder:"Nome parte (es., viti M3x8)",partName:"Nome parte",qty:"Qta",price:"Prezzo ({{currency}})",sourcingUrlPlaceholder:"URL fornitura (opzionale)",remarksPlaceholder:"Note (opzionale)",deletePart:"Elimina parte",deleteConfirm:'Sei sicuro di voler eliminare "{{name}}"?',noUpdatePermission:"Non hai il permesso di aggiornare parti",noEditPermission:"Non hai il permesso di modificare parti",noDeletePermission:"Non hai il permesso di eliminare parti",totalCost:"Costo totale:",empty:"Nessuna parte nella distinta materiali. Aggiungi hardware, elettronica o altri componenti da reperire."},timeline:{title:"Timeline attivita",empty:"Nessuna attivita ancora."},template:{saveAsTemplate:"Salva come template",noCreatePermission:"Non hai il permesso di creare template"},queue:{title:"Coda",viewAll:"Vedi tutto",printing:"{{count}} in stampa",queued:"{{count}} in coda"},prints:{title:"Stampe ({{count}})"},toast:{projectUpdated:"Progetto aggiornato",partAdded:"Parte aggiunta",partRemoved:"Parte rimossa",exportFailed:"Export fallito",projectExported:"Progetto esportato",templateCreated:"Template creato"}},system:{title:"Informazioni sistema",version:"Versione",uptime:"Tempo attivo",cpuUsage:"Uso CPU",memoryUsage:"Uso memoria",diskUsage:"Uso disco",networkInfo:"Info rete",logs:"Log",debugMode:"Modalita debug",enableDebug:"Abilita log debug",disableDebug:"Disabilita log debug",downloadLogs:"Scarica log",clearLogs:"Cancella log",dockerInfo:"Info Docker",containerName:"Nome container",imageName:"Nome immagine",platform:"Piattaforma",architecture:"Architettura"},library:{title:"Libreria filamenti",addFilament:"Aggiungi filamento",editFilament:"Modifica filamento",deleteFilament:"Elimina filamento",vendor:"Produttore",material:"Materiale",color:"Colore",kFactor:"K Factor",temperature:"Temperatura",noFilaments:"Nessun filamento in libreria",deleteConfirm:"Sei sicuro di voler eliminare questo filamento?",importFromPrinter:"Importa da stampante",exportToFile:"Esporta su file"},spoolman:{title:"Integrazione Spoolman",enabled:"Spoolman abilitato",url:"URL Spoolman",connected:"Connesso",disconnected:"Non connesso",testConnection:"Testa connessione",sync:"Sincronizza",syncing:"Sincronizzazione...",lastSync:"Ultima sincronizzazione",linkToSpoolman:"Collega a Spoolman",openInSpoolman:"Apri in Spoolman",unlinkSpool:"Scollega bobina",unlinkConfirmTitle:"Scollegare bobina?",unlinkConfirmMessage:"Questo disconnetterà lo spool da Spoolman. I dati dello spool in Spoolman rimarranno invariati.",selectSpool:"Seleziona bobina",noUnlinkedSpools:"Nessuna bobina scollegata disponibile",linkSuccess:"Bobina collegata a Spoolman con successo",linkFailed:"Collegamento bobina fallito",unlinkSuccess:"Bobina scollegata da Spoolman con successo",unlinkFailed:"Impossibile scollegare la bobina",spoolId:"ID bobina",fillSourceLabel:"(Spoolman)",weight:"Peso",remaining:"Rimanente",disableWeightSync:"Disabilita sync peso stimato AMS",disableWeightSyncDesc:"Non aggiornare la capacità rimanente dalle stime AMS. Usalo se preferisci il tracciamento di Spoolman rispetto alle stime AMS. Le nuove bobine useranno comunque la stima AMS come peso iniziale.",reportPartialUsage:"Segnala uso parziale per stampe fallite",reportPartialUsageDesc:"Quando una stampa fallisce o viene annullata, segnala il filamento stimato usato fino a quel punto in base all'avanzamento layer."},inventory:{title:"Inventario Bobine",addSpool:"Aggiungi Bobina",editSpool:"Modifica Bobina",material:"Materiale",selectMaterial:"Seleziona materiale...",subtype:"Sottotipo",brand:"Marchio",searchBrand:"Cerca marchio...",useCustomBrand:'Usa "{{brand}}"',useCustomMaterial:"Usa materiale personalizzato: {{material}}",colorName:"Nome Colore",colorNamePlaceholder:"Jade White, Fire Red...",color:"Colore",hexColor:"Colore Hex",pickColor:"Scegli colore personalizzato",labelWeight:"Peso da Etichetta",coreWeight:"Peso Bobina Vuota",searchSpoolWeight:"Cerca peso bobina...",weightUsed:"Utilizzato",currentWeight:"Peso Rimanente",measuredWeight:"Peso Misurato",costPerKg:"Costo per kg",measuredWeightError:"Il peso misurato deve essere compreso tra {{min}}g e {{max}}g.",slicerFilament:"Filamento Slicer",slicerFilamentName:"Nome Preset Slicer",slicerPreset:"Preset Slicer",searchPresets:"Cerca preset filamento...",selectedPreset:"Selezionato",noPresetsFound:"Nessun preset trovato",tempOverrides:"Override Temperatura",note:"Nota",notePlaceholder:"Eventuali note aggiuntive su questa bobina...",archive:"Archivia",restore:"Ripristina",noSpools:"Ancora nessuna bobina. Aggiungi la tua prima bobina per iniziare.",noManualSpools:"Nessuna bobina aggiunta manualmente disponibile. Aggiungi prima una bobina al tuo inventario.",kProfiles:"K-Profiles",addKProfile:"Aggiungi K-Profile",assignSpool:"Assegna Bobina",unassignSpool:"Scollega",assignSuccess:"Bobina assegnata e slot AMS configurato",assignFailed:"Assegnazione bobina fallita",selectSpool:"Seleziona una bobina da assegnare a questo slot",assigned:"Assegnato",assigning:"Assegnazione...",searchSpools:"Cerca bobine...",allMaterials:"Tutti i Materiali",filterByBrand:"Filtra per marchio...",showArchived:"Mostra archiviate",quickAdd:"Aggiunta rapida (Scorta)",quantity:"Quantità",stock:"Scorta",configured:"Configurata",spoolsCreated:"{{count}} bobine create",spoolCreated:"Bobina creata",spoolUpdated:"Bobina aggiornata",spoolDeleted:"Bobina eliminata",spoolArchived:"Bobina archiviata",spoolRestored:"Bobina ripristinata",deleteConfirm:"Sei sicuro di voler eliminare questa bobina? Questa azione non può essere annullata.",archiveConfirm:"Sei sicuro di voler archiviare questa bobina?",advancedSettings:"Impostazioni Avanzate",filamentInfoTab:"Info filamento",paProfileTab:"Profilo PA",filamentInfo:"Filamento",additional:"Aggiuntivo",loadingPresets:"Caricamento preset cloud...",cloudConnected:"Cloud connesso",cloudNotConnected:"Cloud non connesso (valori predefiniti)",recentColors:"Recenti",searchColors:"Cerca colori...",searchResults:"Risultati della ricerca",allColors:"Tutti i colori",commonColors:"Colori comuni",showLess:"Mostra meno",showAll:"Mostra tutto",noColorsFound:"Nessun colore corrisponde alla ricerca",noResults:"Nessun risultato trovato",selectMaterialFirst:"Selezionare prima un materiale nella scheda Info filamento.",noPrintersConfigured:"Nessuna stampante configurata. Aggiungi stampanti per usare i profili PA.",matchingFilter:"Corrispondenti",anyBrand:"Qualsiasi marca",anyVariant:"Qualsiasi variante",autoSelect:"Selezione automatica",matches:"corrispondenze",match:"corrispondenza",noMatches:"Nessuna corrispondenza",connected:"Connessa",offline:"Offline",printerOffline:"La stampante è offline. Connetti per visualizzare i profili di calibrazione.",noKProfilesMatch:"Nessun profilo K corrisponde al filamento selezionato.",leftNozzle:"Ugello sinistro",rightNozzle:"Ugello destro",profilesSelected:"profili di calibrazione selezionati",totalInventory:"Inventario totale",totalConsumed:"Totale consumato",byMaterial:"Per materiale",inPrinter:"In stampante",lowStock:"Scorta bassa",sinceTracking:"Dall'inizio del tracciamento",loadedInAms:"Caricato in AMS/Est",remaining:"Rimanente",weightCheck:"Controllo Peso",lastWeighed:"Ultima pesatura",neverWeighed:"Mai pesato",search:"Cerca bobine...",showing:"Visualizzazione",to:"a",of:"di",show:"Mostra",spools:"bobine",spool:"bobina",page:"Pagina",noSpoolsMatch:"Nessun risultato trovato",noSpoolsMatchDesc:"Prova a modificare la ricerca o i filtri per trovare quello che cerchi.",active:"Attive",archived:"Archiviate",all:"Tutte",used:"Usato",new:"Nuovo",clearFilters:"Cancella filtri",table:"Tabella",cards:"Schede",net:"Netto",groupSimilar:"Raggruppa",groupedSpools:"{{count}} bobine identiche",groupedRows:"righe",columns:"Colonne",configureColumns:"Configura colonne",configureColumnsDesc:"Trascina per riordinare le colonne o usa le frecce. Attiva/disattiva la visibilità con l'icona dell'occhio.",visible:"visibili",reset:"Ripristina",cancel:"Annulla",applyChanges:"Applica modifiche",moveUp:"Sposta su",moveDown:"Sposta giù",hideColumn:"Nascondi colonna",showColumn:"Mostra colonna",linkToSpool:"Collega a bobina",tagLinked:"Tag collegato alla bobina",tagLinkFailed:"Impossibile collegare il tag",tagAlreadyLinked:"Tag già collegato a un'altra bobina",unknownTag:"Tag RFID sconosciuto rilevato",usageHistory:"Cronologia utilizzo",noUsageHistory:"Nessun utilizzo registrato",printName:"Nome stampa",weightConsumed:"Peso consumato",clearHistory:"Cancella",historyCleared:"Cronologia utilizzo cancellata",fillSourceLabel:"(Inv)",lowStockThresholdError:"La soglia deve essere tra 0.1 e 99.9"},timelapse:{title:"Timelapse",create:"Crea timelapse",download:"Scarica",delete:"Elimina",preview:"Anteprima",frameRate:"Frame rate",quality:"Qualità",processing:"Elaborazione...",noTimelapses:"Nessun timelapse disponibile"},ams:{title:"AMS",slot:"Slot",empty:"Vuoto",emptySlot:"Slot vuoto",unknown:"Sconosciuto",humidity:"Umidità",temperature:"Temperatura",filamentType:"Tipo filamento",filamentColor:"Colore",remaining:"Rimanente",history:"Cronologia AMS",noHistory:"Nessuna cronologia disponibile",configureSlot:"Configura slot",externalSpool:"Bobina esterna",profile:"Profilo",kFactor:"K Factor",fill:"Livello",configure:"Configura",used:"utilizzato",remainingUnit:"rimanente"},printModal:{title:"Avvia stampa",selectPrinter:"Seleziona stampante",selectPlate:"Seleziona piatto",filamentMapping:"Mappatura filamento",totalCost:"Costo totale:",slotRemainingShort:" - {{grams}}g rim.",printSettings:"Impostazioni stampa",bedLeveling:"Livellamento piatto",flowCalibration:"Calibrazione flusso",vibrationCalibration:"Calibrazione vibrazioni",layerInspection:"Ispezione primo layer",timelapse:"Timelapse",startPrint:"Avvia stampa",addToQueue:"Aggiungi alla coda",cancel:"Annulla",noPrintersAvailable:"Nessuna stampante disponibile",printerBusy:"Stampante occupata",printerOffline:"Stampante offline",sameTypeDifferentColor:"Stesso tipo, colore diverso",filamentTypeNotLoaded:"Tipo di filamento non caricato",openCalendar:"Apri calendario",leftNozzle:"L",rightNozzle:"R",leftNozzleTooltip:"Ugello sinistro",rightNozzleTooltip:"Ugello destro",filamentOverride:"Sostituzione filamento",filamentOverrideHint:"Sostituisci opzionalmente i filamenti per l'assegnazione basata sul modello. Lo scheduler abbinerà i filamenti selezionati invece dei valori 3MF originali.",originalFilament:"Originale",overrideWith:"Sostituisci con",resetToOriginal:"Ripristina originale",forceColorMatch:"Corrispondenza colore forzata"},backup:{title:"Backup e ripristino",createBackup:"Crea backup",restoreBackup:"Ripristina backup",restoreDescription:"Sostituisci tutti i dati da un file di backup",downloadBackup:"Scarica backup",uploadBackup:"Carica backup",lastBackup:"Ultimo backup",autoBackup:"Backup automatico",backupNow:"Esegui backup ora",restoreWarning:"Avviso: il ripristino sovrascriverà tutti i dati attuali.",includeArchives:"Includi archivi",includeSettings:"Includi impostazioni",includeProfiles:"Includi profili",backupSuccess:"Backup creato con successo",restoreSuccess:"Backup ripristinato con successo",backupFailed:"Backup fallito",restoreFailed:"Ripristino fallito",restoreNote:"La stampante virtuale verrà fermata durante il ripristino",githubBackup:"Backup GitHub",enabled:"Abilitato",cloudLoginRequired:"Accesso Bambu Cloud richiesto. Accedi in Profili → Profili Cloud per abilitare il backup GitHub.",cloudLoginRequiredShort:"Accesso Cloud richiesto",githubDescription:"Sincronizza automaticamente i tuoi profili con un repository GitHub privato per backup e cronologia delle versioni.",repositoryUrl:"URL del repository",personalAccessToken:"Token di accesso personale",tokenSaved:"(salvato)",enterNewToken:"Inserisci un nuovo token per aggiornare",tokenHint:"Token a grana fine con permesso di lettura/scrittura dei contenuti",branch:"Branch",manualOnly:"Solo manuale",hourly:"Ogni ora",daily:"Giornaliero",weekly:"Settimanale",includeInBackup:"Includi nel backup",kProfiles:"K-Profili",kProfilesDescription:"Calibrazione dell'avanzamento pressione dalle stampanti connesse",noPrintersConnected:"Nessuna stampante connessa",printersConnected:"{{connected}}/{{total}} connesse",cloudProfiles:"Profili Cloud",cloudProfilesDescription:"Preset di filamento, stampante e processo da Bambu Cloud",appSettings:"Impostazioni App",appSettingsDescription:"Configurazione Bambuddy (database completo)",lastBackupAt:"Ultimo backup:",noBackupsYet:"Nessun backup ancora",next:"Prossimo:",startingBackup:"Avvio del backup...",test:"Test",enableBackup:"Abilita backup",testConnection:"Testa connessione",enterRepoUrl:"Inserisci l'URL del repository",enterRepoAndToken:"Inserisci l'URL del repository e il token di accesso",repoRequired:"L'URL del repository è obbligatorio",tokenRequired:"Il token di accesso è obbligatorio",githubBackupEnabled:"Backup GitHub abilitato",tokenUpdated:"Token aggiornato",settingsSaved:"Impostazioni salvate",failedToSave:"Salvataggio fallito: {{message}}",backupCompleteFiles:"Backup completato - {{count}} file aggiornati",backupSkippedNoChanges:"Backup saltato - nessuna modifica",backupFailed2:"Backup fallito: {{message}}",clearedLogs:"{{count}} log eliminati",failedToClearLogs:"Eliminazione log fallita: {{message}}",history:"Cronologia",clear:"Cancella",date:"Data",status:"Stato",commit:"Commit",localBackup:"Backup locale",localBackupDescription:"Crea un backup completo dei tuoi dati Bambuddy includendo database, archivi, upload e tutti i file.",downloadBackupLabel:"Scarica backup",completeBackupZip:"Backup completo: database + tutti i file (ZIP)",download:"Scarica",preparingBackup:"Preparazione del backup...",creatingArchive:"Creazione dell'archivio di backup... Potrebbe richiedere del tempo per archivi di grandi dimensioni.",downloadingFile:"Download del file di backup...",backupDownloaded:"Backup scaricato con successo",failedToCreateBackup:"Creazione del backup fallita: {{message}}",restore:"Ripristina",restoreReplacesAll:"Il ripristino sostituisce tutti i dati.",restoreReplacesAllDetail:"Il database e i file attuali verranno completamente sostituiti. È necessario un riavvio dopo il ripristino.",restoreConfirmTitle:"Ripristina backup",restoreConfirmMessage:`Sei sicuro di voler ripristinare da "{{filename}}"? Questo sostituirà completamente il tuo database e tutti i file. L'applicazione dovrà essere riavviata dopo il ripristino.`,restoreConfirmButton:"Ripristina backup",uploadingFile:"Caricamento del file di backup...",backupRestoredRestart:"Backup ripristinato. Riavvia Bambuddy.",failedToRestore:"Ripristino del backup fallito. Controlla il formato del file.",reloadNow:"Ricarica ora",creatingBackup:"Creazione del backup",restoringBackup:"Ripristino del backup",preparing:"Preparazione...",processing:"Elaborazione...",doNotClosePage:"Non chiudere questa pagina e non navigare altrove. Questa operazione potrebbe richiedere diversi minuti per backup di grandi dimensioni.",restoring:"Ripristino in corso...",restoreComplete:"Ripristino completato",restoreFailed2:"Ripristino fallito",importSettings:"Importa impostazioni da un file di backup",pleaseWaitRestoring:"Attendere durante il ripristino dei dati",selectBackupFile:"Clicca per selezionare un file di backup (.json o .zip)",duplicateHandling:"Come funziona la gestione dei duplicati:",matchPrinters:"Stampanti",matchPrintersBy:"corrispondenza per numero di serie",matchSmartPlugs:"Smart Plug",matchSmartPlugsBy:"corrispondenza per indirizzo IP",matchNotificationProviders:"Provider di notifica",matchNotificationProvidersBy:"corrispondenza per nome",matchFilaments:"Filamenti",matchFilamentsBy:"corrispondenza per nome + tipo + marca",matchArchives:"Archivi",matchArchivesBy:"corrispondenza per hash del contenuto (sempre saltato)",matchPendingUploads:"Upload in sospeso",matchPendingUploadsBy:"corrispondenza per nome file",matchSettingsTemplates:"Impostazioni e modelli",matchSettingsTemplatesBy:"sempre sovrascritti",replaceExisting:"Sostituisci dati esistenti",keepExisting:"Mantieni dati esistenti",overwriteDescription:"Sovrascrivi gli elementi già esistenti con i dati del backup",keepDescription:"Ripristina solo gli elementi che non esistono ancora",overwriteCaution:"Attenzione:",overwriteWarning:"La sovrascrittura sostituirà le configurazioni attuali con i dati del backup. I codici di accesso delle stampanti non vengono mai sovrascritti per sicurezza.",cancel:"Annulla",processingBackup:"Elaborazione del file di backup...",itemsRestored:"Elementi ripristinati",itemsSkipped:"Elementi saltati",restored:"Ripristinati",skippedAlreadyExist:"Saltati (già esistenti)",filesCategory:"File (3MF, miniature, ecc.)",andMore:"...e altri {{count}}",newApiKeysGenerated:"Nuove chiavi API generate",keysShownOnce:"Queste chiavi vengono mostrate solo una volta. Copiale ora!",copy:"Copia",noDataFound:"Nessun dato da ripristinare trovato nel file di backup.",close:"Chiudi",categories:{settings:"Impostazioni",notification_providers:"Provider di notifica",notification_templates:"Modelli di notifica",smart_plugs:"Smart Plug",printers:"Stampanti",filaments:"Filamenti",maintenance_types:"Tipi di manutenzione",archives:"Archivi",projects:"Progetti",pending_uploads:"Upload in sospeso",external_links:"Link esterni",api_keys:"Chiavi API"}},tags:{title:"Tag",addTag:"Aggiungi tag",editTag:"Modifica tag",deleteTag:"Elimina tag",tagName:"Nome tag",tagColor:"Colore tag",noTags:"Nessun tag",deleteConfirm:"Sei sicuro di voler eliminare questo tag?",manageTags:"Gestisci tag"},uploadModal:{title:"Carica file 3MF",dragDrop:"Trascina e rilascia file .3mf qui",or:"o",browseFiles:"Sfoglia file",extractionInfo:"Il modello stampante sarà estratto automaticamente dai metadati del file 3MF.",uploaded:"caricati",failed:"falliti",uploading:"Caricamento...",upload:"Carica",uploadFailed:"Caricamento fallito"},editArchive:{title:"Modifica archivio",name:"Nome",namePlaceholder:"Nome stampa",printer:"Stampante",noPrinter:"Nessuna stampante",project:"Progetto",noProject:"Nessun progetto",itemsPrinted:"Elementi stampati",itemsPrintedHelp:"Numero di elementi prodotti in questo job di stampa",notes:"Note",notesPlaceholder:"Aggiungi note su questa stampa...",externalLink:"Link esterno",externalLinkPlaceholder:"https://printables.com/model/...",externalLinkHelp:"Link a Printables, Thingiverse o altra fonte",tags:"Tag",tagsPlaceholder:"Aggiungi tag...",addMoreTags:"Aggiungi altri tag...",matchingTags:'Tag corrispondenti "{{query}}"',existingTags:"Tag esistenti",clickToAdd:"(clicca per aggiungere)",status:"Stato",failureReason:"Motivo fallimento",selectReason:"Seleziona motivo...",photos:"Foto del risultato stampato",photosHelp:"Clicca + per aggiungere foto del risultato stampato",printResult:"Risultato stampa",saving:"Salvataggio...",failureReasons:{adhesionFailure:"Fallimento adesione",spaghettiDetached:"Spaghetti / staccato",layerShift:"Spostamento layer",cloggedNozzle:"Ugello intasato",filamentRunout:"Filamento esaurito",warping:"Warping",stringing:"Stringing",underExtrusion:"Sotto-estrusione",powerFailure:"Mancanza corrente",userCancelled:"Annullato dall'utente",other:"Altro"},statuses:{completed:"Completato",failed:"Fallito",aborted:"Annullato",printing:"In stampa"}},kProfiles:{title:"K-Profiles",noPrintersConfigured:"Nessuna stampante configurata",addPrinterInSettings:"Aggiungi una stampante in Impostazioni per gestire i K-profiles",noActivePrinters:"Nessuna stampante attiva",enablePrinterConnection:"Abilita una connessione stampante per vedere i K-profiles",loadingProfiles:"Caricamento K-Profiles...",printerOffline:"Stampante offline",printerOfflineDesc:"La stampante selezionata non e connessa. Accendila per vedere i K-profiles.",noMatchingProfiles:"Nessun profilo corrispondente",noMatchingProfilesDesc:"Nessun profilo corrisponde ai criteri di ricerca",noKProfiles:"Nessun K-Profile",noKProfilesDesc:"Nessun profilo pressure advance per ugello da {{diameter}}mm",createFirstProfile:"Crea primo profilo",printer:"Stampante",nozzle:"Ugello",refresh:"Aggiorna",addProfile:"Aggiungi profilo",export:"Esporta",import:"Importa",select:"Seleziona",selectAll:"Seleziona tutto",delete:"Elimina",searchPlaceholder:"Cerca per nome o filamento...",allExtruders:"Tutti gli estrusori",leftOnly:"Solo sinistro",rightOnly:"Solo destro",allFlow:"Tutto flow",hfOnly:"Solo HF",sOnly:"Solo S",sortName:"Ordina: Nome",sortKValue:"Ordina: K-Value",sortFilament:"Ordina: Filamento",leftExtruder:"Estrusore sinistro",rightExtruder:"Estrusore destro",modal:{addTitle:"Aggiungi K-Profile",editTitle:"Modifica K-Profile",profileName:"Nome profilo",profileNamePlaceholder:"Il mio profilo PLA",kValue:"K-Value",kValuePlaceholder:"0.020",kValueHelp:"Intervallo tipico: 0.01 - 0.06 per PLA, 0.02 - 0.10 per PETG",filament:"Filamento",selectFilament:"Seleziona filamento...",noFilamentsHelp:"Nessun filamento trovato. Crea prima un K-profile in Bambu Studio.",flowType:"Tipo flow",highFlow:"High Flow",standard:"Standard",nozzleSize:"Dimensione ugello",extruder:"Estrusore",extruders:"Estrusori",left:"Sinistra",right:"Destra",notes:"Note (salvate localmente)",notesPlaceholder:"Aggiungi note su questo profilo...",notesHelp:"Le note sono salvate in Bambuddy, non sulla stampante",syncing:"Sincronizzazione con stampante...",savingExtruder:"Salvataggio su estrusore {{current}}/{{total}}...",pleaseWait:"Attendere"},deleteConfirm:{title:"Elimina profilo",cannotUndo:"Questo non può essere annullato",message:'Sei sicuro di voler eliminare "{{name}}" dalla stampante?'},bulkDelete:{title:"Elimina profili",cannotUndo:"Questo non può essere annullato",message:"Sei sicuro di voler eliminare {{count}} profili selezionati dalla stampante?"},toast:{profileSaved:"K-profile salvato",profilesSaved:"K-profile salvato su {{count}} estrusori",selectAtLeastOneExtruder:"Seleziona almeno un estrusore",profileDeleted:"K-profile eliminato",profilesDeleted:"Eliminati {{count}} profili",exportedProfiles:"Esportati {{count}} profili",importedProfiles:"Importati {{count}} di {{total}} profili",noProfilesToExport:"Nessun profilo da esportare",invalidFileFormat:"Formato file non valido",failedToParseImport:"Parsing file import fallito",failedToSaveBatch:"Salvataggio K-profiles fallito",noteSaved:"Nota salvata",failedToSaveNote:"Salvataggio nota fallito"},permission:{noRead:"Non hai il permesso di aggiornare i profili",noCreate:"Non hai il permesso di aggiungere profili",noUpdate:"Non hai il permesso di aggiornare K-profiles",noDelete:"Non hai il permesso di eliminare K-profiles",noExport:"Non hai il permesso di esportare profili",noImport:"Non hai il permesso di importare profili"}},virtualPrinter:{title:"Stampante virtuale",running:"In esecuzione",stopped:"Ferma",description:{default:"Abilita una stampante virtuale che appare in Bambu Studio e OrcaSlicer. I file inviati a questa stampante saranno archiviati senza stampare.",proxy:"Abilita un proxy che inoltra il traffico slicer a una stampante reale, permettendo la stampa remota su qualsiasi rete."},enable:{title:"Abilita stampante virtuale",visibleInSlicer:'Visibile come "Bambuddy" nella ricerca slicer',proxyingTo:"In proxy verso {{name}}",notActive:"Non attivo"},model:{title:"Modello stampante",description:"Seleziona il modello stampante da emulare.",restartWarning:"Cambiare il modello riavviera la stampante virtuale"},accessCode:{title:"Codice accesso",isSet:"Codice accesso impostato",notSet:"Nessun codice accesso impostato - richiesto per abilitare",placeholder:"Inserisci codice 8 caratteri",placeholderChange:"Inserisci nuovo codice per cambiare",hint:"Deve essere esattamente 8 caratteri. Usato dagli slicer per autenticarsi.",charCount:"({{count}}/8)"},targetPrinter:{title:"Stampante target",configured:"Target proxy configurato",notConfigured:"Nessuna stampante target selezionata - richiesta per modalita proxy",placeholder:"Seleziona una stampante...",hint:"Seleziona la stampante a cui fare proxy. La stampante deve essere in modalita LAN.",noPrinters:"Nessuna stampante configurata. Aggiungi una stampante per usare la modalita proxy."},remoteInterface:{title:"Sovrascrittura interfaccia di rete",configured:"Sovrascrittura interfaccia attiva",optional:"Opzionale - usare se l'IP rilevato automaticamente e sbagliato (es. piu NIC, Docker, VPN)",placeholder:"Rilevamento automatico (predefinito)...",hint:"Sovrascrive l'indirizzo IP pubblicizzato via SSDP e usato nel certificato TLS. Utile quando Bambuddy ha piu interfacce di rete."},mode:{title:"Modalita",archive:"Archivio",archiveDesc:"Archivia subito i file",review:"Revisione",reviewDesc:"Rivedi prima di archiviare",queue:"Coda",queueDesc:"Archivia e aggiungi alla coda",proxy:"Proxy",proxyDesc:"Inoltra a stampante reale"},autoDispatch:{title:"Avvio automatico",description:"Avvia automaticamente le stampe aggiunte alla coda. Se disattivato, le stampe attendono l'avvio manuale."},setupRequired:{title:"Configurazione necessaria",description:"La stampante virtuale richiede configurazioni di sistema aggiuntive prima di funzionare. Include port forwarding, regole firewall e impostazioni specifiche della piattaforma.",readGuide:"Leggi la guida prima di abilitare"},howItWorks:{title:"Come funziona",step1:"Sulla stessa LAN, le stampanti virtuali appaiono automaticamente nel tuo slicer (Bambu Studio / OrcaSlicer). Da altre reti, aggiungile manualmente tramite indirizzo IP e codice di accesso.",step2:'In modalità Archivio, Revisione e Coda, usa il pulsante "Invia" nel tuo slicer per caricare file 3MF su Bambuddy. Lo slicer mostrerà "Stampa riuscita" — il file viene salvato, non stampato.',step3:"In modalità Proxy, la stampante virtuale inoltra tutto il traffico a una stampante reale — le stampe partono immediatamente come con una connessione diretta."},status:{title:"Dettagli stato",printerName:"Nome stampante",model:"Modello",serialNumber:"Numero seriale",mode:"Modalita",pendingFiles:"File in sospeso",targetPrinter:"Stampante target",ftpPort:"Porta FTP",mqttPort:"Porta MQTT",ftpConnections:"Connessioni FTP",mqttConnections:"Connessioni MQTT"},toast:{updated:"Impostazioni stampante virtuale aggiornate",failedToUpdate:"Aggiornamento impostazioni fallito",accessCodeRequired:"Imposta prima un codice accesso",targetPrinterRequired:"Seleziona prima una stampante target",bindIpRequired:"Impostare prima un indirizzo IP",accessCodeEmpty:"Il codice accesso non può essere vuoto",accessCodeLength:"Il codice accesso deve essere esattamente 8 caratteri",created:"Stampante virtuale creata",failedToCreate:"Impossibile creare la stampante virtuale",deleted:"Stampante virtuale eliminata",failedToDelete:"Impossibile eliminare la stampante virtuale"},list:{title:"Stampanti virtuali",add:"Aggiungi",addFirst:"Aggiungi stampante virtuale",empty:"Nessuna stampante virtuale configurata. Aggiungine una per iniziare."},bindIp:{title:"Interfaccia di rete",placeholder:"Seleziona interfaccia...",hint:"Interfaccia di rete a cui questa stampante virtuale si collega. Deve essere unica per stampante."},proxy:{accessCodeHint:"In modalita proxy, usa il codice di accesso della stampante di destinazione nello slicer. La connessione viene inoltrata in modo trasparente alla stampante reale."},addDialog:{title:"Aggiungi stampante virtuale",name:"Nome",hint:"Potrai configurare il codice di accesso, la stampante di destinazione e altre impostazioni dopo la creazione.",create:"Crea"},deleteConfirm:{title:"Elimina stampante virtuale",message:'Sei sicuro di voler eliminare "{{name}}"? Tutti i servizi di questa stampante verranno interrotti.'}},modelViewer:{openInSlicer:"Apri nello slicer",tabs:{model:"Modello 3D",gcode:"Anteprima G-code"},notAvailable:"non disponibile",notSliced:"non sezionato",plates:"Piatti",allPlates:"Tutti i piatti",plateNumber:"Piatto {{number}}",plateCount:"{{count}} piatto",plateCount_other:"{{count}} piatti",objectCount:"{{count}} oggetto",objectCount_other:"{{count}} oggetti",filamentCount:"{{count}} filamento",filamentCount_other:"{{count}} filamenti",eta:"ETA {{minutes}} min",noPreview:"Nessuna anteprima disponibile per questo file",pagination:{pageOf:"Pagina {{current}} di {{total}}",prev:"Prec",next:"Succ"},errors:{failedToLoad:"Caricamento file fallito",noMeshes:"Nessuna mesh trovata nel file 3MF",unsupportedFormat:"Formato file non supportato"}},maintenanceDescriptions:{lubricateCarbonRods:"Applica lubrificante alle aste in carbonio per un movimento fluido",lubricateRails:"Applica lubrificante alle guide lineari per un movimento fluido",cleanNozzle:"Pulisci hotend e ugello per prevenire intasamenti",checkBelts:"Verifica tensione cinghie per stampe accurate",cleanBuildPlate:"Pulisci il piatto per migliorare l'adesione",checkExtruder:"Ispeziona ingranaggi estrusore per usura",checkCooling:"Assicurati che le ventole di raffreddamento funzionino",generalInspection:"Ispezione generale stampante",cleanCarbonRods:"Pulisci le aste in carbonio per ridurre attrito",lubricateSteelRods:"Applica lubrificante alle aste in acciaio per un movimento fluido",cleanSteelRods:"Pulisci le aste in acciaio per ridurre attrito",cleanLinearRails:"Pulisci le guide lineari per rimuovere polvere e detriti",checkPtfeTube:"Ispeziona il tubo PTFE per usura o danni",replaceHepaFilter:"Sostituisci filtro HEPA per qualità aria",replaceCarbonFilter:"Sostituisci filtro a carbone attivo",lubricateLeftNozzleRail:"Lubrifica guida ugello sinistro (serie H2)"},smartPlugs:{offline:"Offline",admin:"Amministrazione",openPlugAdminPage:"Apri pagina amministrazione presa",deleteSmartPlug:"Elimina presa smart",turnOnSmartPlug:"Accendi presa smart",turnOffSmartPlug:"Spegni presa smart",turnOn:"Accendi",turnOff:"Spegni",addSmartPlug:{scanningNetwork:"Scansione rete...",chooseEntity:"Scegli un'entità...",connectionFailed:"Connessione fallita",searchEntities:"Cerca entità...",searchPowerSensors:"Cerca sensori di potenza...",searchEnergySensors:"Cerca sensori di energia...",placeholders:{plugName:"Presa soggiorno",mqttStateOnValue:"ON, true, 1",mqttSameAsPower:"Stesso del topic potenza, o diverso"}},linkedTo:"Collegato a:",monitorOnly:"Solo monitoraggio",alerts:"Avvisi",scheduleOn:"On {{time}}",scheduleOff:"Off {{time}}",on:"On",off:"Off",power:"Potenza",kwhToday:"kWh Oggi",settings:"Impostazioni",automationSettings:"Impostazioni automazione",showInSwitchbar:"Mostra nella barra interruttori",quickAccessSidebar:"Accesso rapido dalla barra laterale",enabled:"Abilitato",enableAutomation:"Abilita automazione per questa presa",autoOn:"Auto On",autoOnDescription:"Accendi quando inizia la stampa",autoOff:"Auto Off",autoOffDescription:"Spegni quando la stampa è completata (una tantum)",turnOffDelayMode:"Modalità ritardo spegnimento",time:"Tempo",temp:"Temp",delayMinutes:"Ritardo (minuti)",tempThreshold:"Soglia temperatura (°C)",tempThresholdDescription:"Si spegne quando l'ugello si raffredda sotto questa temperatura",edit:"Modifica",deleteConfirm:'Sei sicuro di voler eliminare "{{name}}"? Questa azione non può essere annullata.',turnOnConfirm:'Sei sicuro di voler accendere "{{name}}"?',turnOffConfirm:`Sei sicuro di voler spegnere "{{name}}"? Questo interromperà l'alimentazione del dispositivo collegato.`,failedToTurn:'Impossibile {{action}} "{{name}}"',unknown:"Sconosciuto",addTitle:"Aggiungi presa smart",editTitle:"Modifica presa smart",stopScanning:"Interrompi scansione",discoverTasmota:"Scopri dispositivi Tasmota",foundDevices:"{{count}} dispositivo/i trovato/i - clicca per selezionare:",noDevicesFound:"Nessun dispositivo Tasmota trovato nella rete",haNotConfigured:"Home Assistant non è configurato. Configuralo in",haSettingsPath:"Impostazioni → Rete → Home Assistant",selectEntity:"Seleziona entità *",ipAddress:"Indirizzo IP *",nameLabel:"Nome *",username:"Nome utente",password:"Password",authHint:"Lascia vuoto se il tuo dispositivo Tasmota non richiede autenticazione",linkToPrinter:"Collega alla stampante",noPrinter:"Nessuna stampante (solo controllo manuale)",linkingDescription:"Il collegamento abilita accensione/spegnimento automatico all'inizio/fine stampa",powerAlerts:"Avvisi potenza",alertAbove:"Avviso se sopra (W)",alertBelow:"Avviso se sotto (W)",alertDescription:"Ricevi notifiche quando il consumo supera queste soglie. Lascia vuoto per disabilitare quella direzione.",dailySchedule:"Programma giornaliero",turnOnAt:"Accendi alle",turnOffAt:"Spegni alle",scheduleDescription:"Accendi/spegni automaticamente la presa a questi orari ogni giorno. Lascia vuoto per saltare quell'azione.",showOnPrinterCard:"Mostra sulla scheda stampante",displayOnPrinterCard:"Mostra pulsante sulla scheda stampante",connectedResult:"Connesso!",deviceLabel:"Dispositivo: {{name}} - ",stateLabel:"Stato: {{state}}",test:"Test",delete:"Elimina",save:"Salva",add:"Aggiungi",cancel:"Annulla",failedToStartScan:"Impossibile avviare la scansione",nameRequired:"Il nome è obbligatorio",entityRequired:"L'entità è obbligatoria per le prese Home Assistant",mqttTopicRequired:"Almeno un topic MQTT deve essere configurato per potenza, energia o monitoraggio stato",loadingEntities:"Caricamento entità...",loading:"Caricamento...",failedToLoadEntities:"Impossibile caricare le entità: {{error}}",noEntitiesMatching:'Nessuna entità trovata corrispondente a "{{search}}"',noEntitiesAvailable:"Nessuna entità disponibile",searchingEntities:"Ricerca in tutte le entità ({{count}} trovate)",showingEntities:"Mostrando switch, light, input_boolean ({{count}} disponibili)",energyMonitoringOptional:"Monitoraggio energia (Opzionale)",energyMonitoringHint:"Cerca e seleziona i sensori che forniscono dati di potenza/energia.",powerSensorW:"Sensore potenza (W)",energyTodayKwh:"Energia oggi (kWh)",totalEnergyKwh:"Energia totale (kWh)",noMatchingSensors:"Nessun sensore corrispondente",none:"Nessuno",mqttNotConfigured:"Broker MQTT non configurato. Imposta l'indirizzo del broker in",mqttSettingsPath:"Impostazioni → Rete → Pubblicazione MQTT",mqttNotConfiguredSuffix:"(non è necessario abilitare la pubblicazione, basta inserire i dettagli del broker).",mqttMonitorOnlyDescription:"Le prese MQTT ricevono dati di potenza/energia tramite sottoscrizione MQTT. Il controllo on/off non è disponibile - usa il tuo broker MQTT o sistema domotico.",powerMonitoring:"Monitoraggio potenza",energyMonitoring:"Monitoraggio energia",stateMonitoring:"Monitoraggio stato",optional:"opzionale",topic:"Topic",jsonPath:"Percorso JSON",multiplier:"Moltiplicatore",onValue:"Valore ON",mqttPowerHint:`Il percorso JSON estrae il valore dal payload JSON (es. "power_l1"). Lascia vuoto se il topic pubblica valori numerici grezzi.
- Usa moltiplicatore 0.001 per mW→W, 1000 per kW→W.`,mqttEnergyHint:`Il percorso JSON estrae il valore dal payload JSON. Lascia vuoto per valori grezzi.
- Usa moltiplicatore 0.001 per Wh→kWh, 1000 per MWh→kWh.`,mqttStateHint:`Il percorso JSON estrae il valore dal payload JSON. Lascia vuoto per valori grezzi.
- Valore ON: la stringa esatta che significa "ON". Lascia vuoto per rilevamento auto (ON, true, 1).`,noSwitchesInSwitchbar:"Nessun interruttore nella barra",enableSwitchbarHint:'Abilita "Mostra nella barra interruttori" in Impostazioni > Smart Plugs'},notifications:{providerTypes:{callmebot:"CallMeBot/WhatsApp",ntfy:"ntfy",pushover:"Pushover",telegram:"Telegram",email:"Email",discord:"Discord",webhook:"Webhook",homeassistant:"Home Assistant"},providerDescriptions:{email:"Notifiche email tramite SMTP",telegram:"Notifiche tramite bot Telegram",discord:"Invia a un canale Discord tramite webhook",ntfy:"Notifiche push gratuite e self-hostabili",pushover:"Notifiche push semplici e affidabili",callmebot:"Notifiche WhatsApp gratuite tramite CallMeBot",webhook:"POST HTTP generico verso qualsiasi URL",homeassistant:"Notifiche persistenti nella dashboard di Home Assistant"},lastSuccess:"Ultimo: {{date}}",error:"Errore",printer:"Stampante:",allPrinters:"Tutte le stampanti",sendTestNotification:"Invia notifica di prova",eventSettings:"Impostazioni eventi",enabled:"Abilitato",sendFromProvider:"Invia notifiche da questo provider",printEvents:"Eventi di stampa",printerStatus:"Stato stampante",amsAlarms:"Allarmi AMS",amsHtAlarms:"Allarmi AMS-HT",printQueue:"Coda di stampa",start:"Avvio",plateCheck:"Controllo piatto",complete:"Completato",failed:"Fallito",stopped:"Interrotto",progress:"Avanzamento",offline:"Offline",lowFilament:"Filamento scarso",maintenance:"Manutenzione",amsHumidity:"Umidità AMS",amsTemp:"Temp AMS",amsHtHumidity:"Umidità AMS-HT",amsHtTemp:"Temp AMS-HT",bedCooled:"Piatto raffreddato",quiet:"Silenzioso",digest:"Riepilogo {{time}}",printStarted:"Stampa avviata",plateNotEmpty:"Piatto non vuoto",plateNotEmptyDescription:"Oggetti rilevati prima della stampa",printCompleted:"Stampa completata",bedCooledLabel:"Piatto raffreddato",bedCooledDescription:"Piatto raffreddato sotto la soglia dopo la stampa",printFailed:"Stampa fallita",printStopped:"Stampa interrotta",progressMilestones:"Traguardi di avanzamento",progressMilestonesDescription:"Notifica al 25%, 50%, 75%",printerOffline:"Stampante offline",printerError:"Errore stampante",lowFilamentLabel:"Filamento scarso",maintenanceDue:"Manutenzione necessaria",maintenanceDueDescription:"Notifica quando è necessaria la manutenzione",amsHumidityHigh:"Umidità AMS elevata",amsHumidityHighDescription:"L'umidità dell'AMS standard supera la soglia",amsTemperatureHigh:"Temperatura AMS elevata",amsTemperatureHighDescription:"La temperatura dell'AMS standard supera la soglia",amsHtHumidityHigh:"Umidità AMS-HT elevata",amsHtHumidityHighDescription:"L'umidità dell'AMS-HT supera la soglia",amsHtTemperatureHigh:"Temperatura AMS-HT elevata",amsHtTemperatureHighDescription:"La temperatura dell'AMS-HT supera la soglia",jobAdded:"Lavoro aggiunto",jobAddedDescription:"Lavoro aggiunto alla coda",jobAssigned:"Lavoro assegnato",jobAssignedDescription:"Lavoro basato su modello assegnato alla stampante",jobStarted:"Lavoro avviato",jobStartedDescription:"Lavoro in coda avviato per la stampa",jobWaiting:"Lavoro in attesa",jobWaitingDescription:"Lavoro in attesa di filamento",jobSkipped:"Lavoro saltato",jobSkippedDescription:"Lavoro saltato (precedente fallito)",jobFailed:"Lavoro fallito",jobFailedDescription:"Avvio del lavoro fallito",queueComplete:"Coda completata",queueCompleteDescription:"Tutti i lavori in coda completati",quietHours:"Ore silenziose",noNotificationsDuring:"Nessuna notifica durante queste ore",editProviderToChangeQuietHours:"Modifica il provider per cambiare le ore silenziose",dailyDigest:"Riepilogo giornaliero",batchNotifications:"Raggruppa le notifiche in un unico riepilogo giornaliero",sendAt:"Invia alle {{time}}",editProviderToChangeDigestTime:"Modifica il provider per cambiare l'orario del riepilogo",edit:"Modifica",deleteProvider:"Elimina provider di notifica",deleteConfirm:'Sei sicuro di voler eliminare "{{name}}"? Questa azione non può essere annullata.',delete:"Elimina",addTitle:"Aggiungi provider di notifica",editTitle:"Modifica provider di notifica",nameLabel:"Nome *",namePlaceholder:"Le mie notifiche",providerTypeLabel:"Tipo di provider *",configuration:"Configurazione",testConfiguration:"Testa configurazione",printerFilter:"Filtro stampante",onlyFromPrinter:"Invia notifiche solo per eventi da questa stampante",quietHoursDnd:"Ore silenziose (Non disturbare)",quietStart:"Inizio",quietEnd:"Fine",dailyDigestLabel:"Riepilogo giornaliero",sendDigestAt:"Invia riepilogo alle",digestCollected:"Gli eventi verranno raccolti e inviati come riepilogo unico a quest'ora",notificationEvents:"Eventi di notifica",progressPercent:"(25%, 50%, 75%)",bedCooledAfterPrint:"(dopo il completamento della stampa)",cancel:"Annulla",save:"Salva",add:"Aggiungi",nameRequired:"Il nome è obbligatorio",fieldRequired:"{{field}} è obbligatorio",phoneNumber:"Numero di telefono",apiKey:"Chiave API",serverUrl:"URL del server",topic:"Argomento",authToken:"Token di autenticazione",userKey:"Chiave utente",appToken:"Token applicazione",priority:"Priorità",botToken:"Token del bot",chatId:"ID chat",smtpServer:"Server SMTP",smtpPort:"Porta SMTP",security:"Sicurezza",authentication:"Autenticazione",username:"Nome utente",password:"Password",fromEmail:"Email mittente",toEmail:"Email destinatario",webhookUrl:"URL webhook",payloadFormat:"Formato payload",authorization:"Autorizzazione",titleFieldName:"Nome campo titolo",messageFieldName:"Nome campo messaggio",editTemplate:"Modifica modello: {{name}}",titleLabel:"Titolo",bodyLabel:"Corpo",titlePlaceholder:"Titolo della notifica...",bodyPlaceholder:"Corpo della notifica...",availableVariables:"Variabili disponibili",clickToInsert:"Clicca per inserire alla posizione del cursore nel corpo",livePreview:"Anteprima live",hide:"Nascondi",show:"Mostra",loadingPreview:"Caricamento anteprima...",enterTemplateContent:"Inserisci il contenuto del modello per vedere l'anteprima",titlePreview:"Titolo:",bodyPreview:"Corpo:",resetToDefault:"Ripristina predefinito",titleRequired:"Il titolo è obbligatorio",bodyRequired:"Il corpo è obbligatorio",notificationLog:"Registro notifiche",showFailedOnly:"Solo fallite",last24Hours:"Ultime 24 ore",last7Days:"Ultimi 7 giorni",last30Days:"Ultimi 30 giorni",last90Days:"Ultimi 90 giorni",justNow:"Proprio ora",noFailedNotifications:"Nessuna notifica fallita",noNotificationsLogged:"Nessuna notifica registrata",unknownProvider:"Provider sconosciuto",logTitle:"Titolo",logMessage:"Messaggio",logError:"Errore",logProvider:"Provider: {{type}}",logTime:"Ora: {{time}}",refresh:"Aggiorna",clearOld:"Cancella vecchie",statsSummary:"Ultimi {{days}} giorni:",statsNotifications:"notifiche",statsSent:"{{count}} inviate",statsFailed:"{{count}} fallite",eventTypes:{print_start:"Stampa avviata",print_complete:"Stampa completata",print_failed:"Stampa fallita",print_stopped:"Stampa interrotta",print_progress:"Avanzamento",printer_offline:"Stampante offline",printer_error:"Errore stampante",filament_low:"Filamento scarso",maintenance_due:"Manutenzione necessaria",test:"Prova"}},richTextEditor:{bold:"Grassetto",italic:"Corsivo",underline:"Sottolineato",bulletList:"Elenco puntato",numberedList:"Elenco numerato",alignLeft:"Allinea a sinistra",alignCenter:"Allinea al centro",alignRight:"Allinea a destra",addLink:"Aggiungi link",removeLink:"Rimuovi link"},externalLinks:{noLinksConfigured:"Nessun link esterno configurato",deleteLink:"Elimina link",removeCustomIcon:"Rimuovi icona personalizzata",openInNewTab:"Apri in nuova scheda",placeholders:{linkName:"Il mio link"}},keyboardShortcuts:{title:"Scorciatoie da tastiera",navigation:"Navigazione",archivesSection:"Archivi",kProfilesSection:"Profili K",generalSection:"Generale",shortcuts:{goToPrinters:"Vai a Stampanti",goToArchives:"Vai ad Archivi",goToQueue:"Vai a Coda",goToStats:"Vai a Statistiche",goToProfiles:"Vai a Profili cloud",goToSettings:"Vai a Impostazioni",focusSearch:"Vai alla ricerca",openUploadModal:"Apri finestra di caricamento",clearSelection:"Cancella selezione / deseleziona input",contextMenu:"Menu contestuale sulle schede",refreshProfiles:"Aggiorna profili",newProfile:"Nuovo profilo",exitSelectionMode:"Esci dalla modalità selezione",showHelp:"Mostra questa guida"},footer:"Premi Esc o clicca fuori per chiudere"},notificationLog:{title:"Registro notifiche",events:{printStarted:"Stampa avviata",printComplete:"Stampa completata",printFailed:"Stampa fallita",printStopped:"Stampa interrotta",progress:"Avanzamento",printerOffline:"Stampante offline",printerError:"Errore stampante",lowFilament:"Filamento in esaurimento",maintenanceDue:"Manutenzione in scadenza",test:"Test"},timeAgo:{justNow:"Adesso",minutesAgo:"{{minutes}} min fa",hoursAgo:"{{hours}} ore fa"}},restoreBackup:{title:"Ripristina backup",restoring:"Ripristino...",restoreComplete:"Ripristino completato",restoreFailed:"Ripristino fallito",importSettings:"Importa impostazioni da un file di backup",pleaseWait:"Attendere il ripristino dei dati",clickToSelect:"Clicca per selezionare il file di backup (.json o .zip)",howDuplicateHandling:"Come funziona la gestione dei duplicati:",categories:{printers:"Stampanti",smartPlugs:"Prese smart",notificationProviders:"Provider di notifica",filaments:"Filamenti",archives:"Archivi",pendingUploads:"Caricamenti in sospeso",settingsTemplates:"Impostazioni e modelli"},matchingInfo:{printers:"abbinati per numero di serie",smartPlugs:"abbinati per indirizzo IP",notificationProviders:"abbinati per nome",filaments:"abbinati per nome + tipo + marca",archives:"abbinati per hash del contenuto",pendingUploads:"abbinati per nome file",settingsTemplates:"sempre sovrascritti"},replaceExisting:"Sostituisci dati esistenti",keepExisting:"Mantieni dati esistenti",replaceDescription:"Sovrascrivi gli elementi già esistenti con i dati del backup",keepDescription:"Ripristina solo gli elementi che non esistono già",caution:"Attenzione:",cautionText:"La sovrascrittura sostituirà le configurazioni attuali con i dati del backup. I codici di accesso delle stampanti non vengono mai sovrascritti per sicurezza.",itemsRestored:"Elementi ripristinati",itemsSkipped:"Elementi saltati",restored:"Ripristinati",skipped:"Saltati (già esistenti)",filesLabel:"File (3MF, miniature, ecc.)",newApiKeysGenerated:"Nuove chiavi API generate",newApiKeysWarning:"Queste chiavi vengono mostrate una sola volta. Copiale adesso!",processingBackup:"Elaborazione file di backup...",noDataFound:"Nessun dato trovato da ripristinare nel file di backup.",failedToRestore:"Impossibile ripristinare il backup. Verificare il formato del file."},backupExport:{title:"Esporta backup",selectData:"Seleziona i dati da includere",selectAll:"Seleziona tutto",selectNone:"Deseleziona tutto",categoryDescriptions:{settings:"Lingua, tema, preferenze di aggiornamento",notifications:"ntfy, Pushover, Discord, ecc.",templates:"Modelli di messaggi personalizzati",smartPlugs:"Configurazioni prese Tasmota",externalLinks:"Link della barra laterale a servizi esterni",printers:"Info stampanti (codici di accesso esclusi)",plateDetection:"Immagini di riferimento piatto vuoto",filaments:"Tipi di filamento e costi",maintenance:"Programmi di manutenzione personalizzati",archives:"Tutti i dati di stampa + file (3MF, miniature, foto)",projects:"Progetti, elementi BOM e allegati",pendingUploads:"Caricamenti della stampante virtuale in attesa di revisione",apiKeys:"Chiavi API webhook (nuove chiavi generate all'importazione)"},requiresPrinters:"Richiede la selezione di Stampanti",zipFileWarning:"Verrà creato un file ZIP.",zipFileDescription:"Include tutti i file 3MF, miniature, timelapse e foto. Potrebbe richiedere tempo e produrre un file di grandi dimensioni.",includeAccessCodes:"Includi codici di accesso",includeAccessCodesDescription:"Per il trasferimento su un'altra macchina",includeAccessCodesWarning:"I codici di accesso saranno inclusi in testo semplice. Mantieni sicuro questo file di backup!",categoriesSelected:"{{selectedCount}} categorie selezionate"},pendingUploads:{placeholders:{notes:"Aggiungi note su questa stampa..."},discardUpload:"Scarta caricamento",archiveAllUploads:"Archivia tutti i caricamenti",discardAllUploads:"Scarta tutti i caricamenti",archive:"Archivia",timeAgo:{justNow:"Adesso",minutesAgo:"{{minutes}} min fa",hoursAgo:"{{hours}} ore fa",daysAgo:"{{days}} giorni fa"}},apiBrowser:{placeholders:{requestBody:"Corpo della richiesta JSON...",searchEndpoints:"Cerca endpoint..."}},configureAmsSlot:{title:"Configura Slot AMS",slotConfigured:"Slot configurato!",configuringSlot:"Configurazione slot:",slotLabel:"{{ams}} Slot {{slot}}",searchPresets:"Cerca preset...",colorPlaceholder:"Nome colore o hex (es. marrone, FF8800)",clearCustomColor:"Cancella colore personalizzato",noCloudPresets:"Nessun preset cloud. Accedi a Bambu Cloud per sincronizzare.",noPresetsAvailable:"Nessun preset disponibile. Accedi a Bambu Cloud o importa profili locali.",noMatchingPresets:"Nessun preset corrispondente trovato.",custom:"Personalizzato",builtin:"Integrato",settingsSentToPrinter:"Impostazioni inviate alla stampante",filamentProfile:"Profilo filamento",kProfileLabel:"Profilo K (Pressure Advance)",filteringFor:"Filtrando per: {{material}}",noKProfile:"Nessun profilo K (usa predefinito 0.020)",noMatchingKProfiles:"Nessun profilo K corrispondente. Verrà usato K=0.020 predefinito.",selectFilamentFirst:"Seleziona prima un profilo filamento",kFromCalibration:"K={{value}} dalla calibrazione stampante",customColorLabel:"Colore personalizzato (opzionale)",presetColors:"Colori {{name}}:",showLessColors:"Mostra meno colori",showMoreColors:"Mostra più colori",clear:"Cancella",hexLabel:"Hex: #{{hex}}",resetting:"Ripristino...",resetSlot:"Ripristina slot",cancel:"Annulla",configuring:"Configurazione...",configureSlot:"Configura slot"},githubBackup:{title:"Backup GitHub",history:"Cronologia",downloadBackup:"Scarica backup",restoreBackup:"Ripristina backup",noBackupsYet:"Nessun backup ancora"},emailSettings:{placeholders:{fromName:"BamBuddy"}},tagManagement:{searchTags:"Cerca tag...",renameTag:"Rinomina tag",deleteTag:"Elimina tag"},notificationTemplates:{placeholders:{title:"Titolo notifica...",body:"Corpo notifica..."}},batchTag:{placeholders:{newTag:"Inserisci nuovo tag..."}},photoGallery:{deletePhoto:"Elimina foto"},filamentHoverCard:{copySpoolUuid:"Copia UUID bobina"},kProfilesView:{hasNote:"Ha una nota",copyProfile:"Copia profilo"},layout:{openMenu:"Apri menu",noPermissionSystemInfo:"Non hai il permesso di visualizzare le informazioni di sistema"},dashboard:{dragToReorder:"Trascina per riordinare",hideWidget:"Nascondi widget"},notificationProviderCard:{deleteNotificationProvider:"Elimina provider di notifica"},fileManagerModal:{closeFileManager:"Chiudi gestore file",sortFiles:"Ordina file",goToParentFolder:"Vai alla cartella superiore",threeView:"Vista 3D"},embeddedCameraViewer:{refreshStream:"Aggiorna stream",close:"Chiudi",zoomOut:"Rimpicciolisci",resetZoom:"Reimposta zoom",zoomIn:"Ingrandisci",dragToResize:"Trascina per ridimensionare"},timelapseViewer:{skipBack5s:"Indietro 5s",skipForward5s:"Avanti 5s"},notificationProviders:{descriptions:{email:"Notifiche email via SMTP",telegram:"Notifiche tramite bot Telegram",discord:"Invia a canale Discord tramite webhook",ntfy:"Notifiche push gratuite e self-hostabili",pushover:"Notifiche push semplici e affidabili",callmebot:"Notifiche WhatsApp gratuite tramite CallMeBot",webhook:"POST HTTP generico a qualsiasi URL"}},logViewer:{searchPlaceholder:"Cerca messaggio o nome logger...",noLogEntries:"Nessuna voce di log trovata"},switchbarPopover:{noSwitchesInSwitchbar:"Nessun interruttore nella barra"},projectPageModal:{placeholders:{title:"Titolo",designer:"Designer",license:"Licenza",description:"Inserisci descrizione...",profileTitle:"Titolo profilo",profileDescription:"Descrizione profilo..."}},spoolmanSettings:{},time:{unknown:"-",waiting:"In attesa",justNow:"Proprio ora",now:"Ora",minsAgo:"{{count}}m fa",inMins:"tra {{count}}m",hoursAgo:"{{count}}h fa",inHours:"tra {{count}}h",daysAgo:"{{count}}g fa",inDays:"tra {{count}}g"},spoolbuddy:{nav:{dashboard:"Dashboard",ams:"AMS",inventory:"Inventario",writeTag:"Scrivi",settings:"Impostazioni"},status:{nfcReady:"NFC pronto",nfcOff:"NFC spento",offline:"Offline",online:"Online",noPrinters:"Nessuna stampante",deviceOffline:"Dispositivo offline",waitingConnection:"In attesa della connessione...",systemReady:"Sistema pronto",status:"Stato"},dashboard:{readyToScan:"Pronto per la scansione",idleMessage:"Posiziona una bobina sulla bilancia per identificarla",nfcHint:"Il tag NFC verrà letto automaticamente",device:"Dispositivo",syncWeight:"Sincronizza peso",weightSynced:"Sincronizzato!",unknownTag:"Tag sconosciuto",newTag:"Nuovo tag rilevato",onScale:"sulla bilancia",linkSpool:"Collega a bobina",linkTagTitle:"Collega tag a bobina",linkTag:"Collega tag",selectSpool:"Seleziona una bobina da collegare a questo tag:",noUntagged:"Nessuna bobina senza tag trovata",tagDetected:"Tag rilevato",noTag:"Nessun tag",tagId:"Tag",grossWeight:"Peso lordo",spoolSize:"Dimensione bobina",close:"Chiudi",currentSpool:"Bobina attuale"},modal:{spoolDetected:"Bobina rilevata",assignToAms:"Assegna all'AMS",syncWeight:"Sincronizza peso",weightSynced:"Sincronizzato!",syncing:"Sincronizzazione...",newTagDetected:"Nuovo tag rilevato",addToInventory:"Aggiungi all'inventario",assignToAmsTitle:"Assegna all'AMS",selectSlot:"Seleziona uno slot",assign:"Assegna",assigning:"Assegnazione...",assignSuccess:"Assegnato!",assignError:"Impossibile assegnare la bobina. Riprovare.",noPrinterSelected:"Seleziona una stampante...",noAmsDetected:"Nessun AMS rilevato su questa stampante",slot:"Slot"},weight:{noReading:"Nessuna lettura",stable:"Stabile",measuring:"Misurazione...",tare:"Tara",calibrate:"Calibra"},spool:{remaining:"Rimanente",material:"Materiale",brand:"Marca",color:"Colore",coreWeight:"Nucleo",labelWeight:"Etichetta",scaleWeight:"Bilancia",netWeight:"Netto",lastUsed:"Ultimo utilizzo"},ams:{noData:"Nessun AMS rilevato",connectAms:"Collega un AMS per vedere gli slot",noPrinter:"Nessuna stampante selezionata",selectPrinter:"Seleziona una stampante dalla barra superiore",printerDisconnected:"Stampante disconnessa",humidity:"Umidità",level:"Livello",active:"Attivo",slot:"Slot",empty:"Vuoto"},inventory:{search:"Cerca bobine...",empty:"Nessuna bobina nell'inventario",noResults:"Nessuna bobina corrispondente",spools:"bobine",addSpool:"Aggiungi bobina"},settings:{tabDevice:"Dispositivo",tabDisplay:"Display",tabScale:"Bilancia",tabUpdates:"Aggiornamenti",nfcReader:"Lettore NFC",type:"Tipo",connection:"Connessione",notConnected:"N/A",deviceInfo:"Info dispositivo",hostname:"Host",uptime:"Tempo di attività",brightness:"Luminosità",saved:"Salvato",noBacklight:"Nessuna retroilluminazione DSI rilevata. Il controllo luminosità richiede un display DSI.",screenBlank:"Timeout spegnimento schermo",screenBlankDesc:"Lo schermo si spegne dopo inattività. Tocca per riattivare.",displayNote:"La luminosità viene applicata come filtro software.",scaleCalibration:"Calibrazione bilancia",currentWeight:"Peso attuale",tareOffset:"Tara",calFactor:"Fattore",knownWeight:"Peso noto",calStep1:"Rimuovere tutto dalla bilancia e premere Imposta zero.",calStep2:"Posizionare il peso noto sulla bilancia.",setZero:"Imposta zero",calibrateNow:"Calibra",calibrated:"Calibrato",tareSet:"Comando tara inviato. In attesa del dispositivo...",tareFailed:"Invio comando tara fallito",zeroSet:"Punto zero impostato. Posizionare il peso noto sulla bilancia.",calibrationDone:"Calibrazione completata!",calibrationFailed:"Calibrazione fallita",lastCalibrated:"Ultima calibrazione",stable:"Stabile",settling:"Stabilizzazione...",firmware:"Firmware",scale:"Bilancia",noDevice:"Nessun dispositivo SpoolBuddy trovato",daemonVersion:"Versione daemon",currentVersion:"Attuale",versionPending:"In attesa del daemon...",checking:"Verifica...",checkUpdates:"Verifica aggiornamenti",updateAvailable:"Aggiornamento disponibile",updateInstructions:"Aggiorna via SSH: esegui lo script di installazione SpoolBuddy.",upToDate:"Aggiornato",includeBeta:"Includi versioni beta"},writeTag:{tabExisting:"Bobina esistente",tabNew:"Nuova bobina",tabReplace:"Sostituisci tag",searchPlaceholder:"Cerca per materiale, colore, marca...",noUntaggedSpools:"Nessuna bobina senza tag",noTaggedSpools:"Nessuna bobina con tag",selectSpool:"Seleziona una bobina, poi posiziona un NTAG sul lettore",placeTag:"Posiziona un NTAG sul lettore",tagReady:"Tag rilevato — pronto per la scrittura",writeTag:"Scrivi tag",replaceTag:"Sostituisci tag",writing:"Scrittura tag...",waiting:"In attesa di SpoolBuddy...",writeSuccess:"Tag scritto con successo!",writeFailed:"Scrittura fallita",queueFailed:"Impossibile accodare il comando di scrittura",tryAgain:"Riprova",cancel:"Annulla",replaceWarning:"Il vecchio tag verrà scollegato. Il nuovo tag lo sostituirà.",deviceOffline:"SpoolBuddy è offline",material:"Materiale",colorName:"Nome colore",color:"Colore",brand:"Marca",weight:"Peso (g)",createSpool:"Crea bobina",creating:"Creazione...",spoolCreated:"Bobina creata! Pronto per la scrittura.",createFailed:"Impossibile creare la bobina"}},bugReport:{title:"Segnala un bug",description:"Descrizione",descriptionPlaceholder:"Cosa è andato storto? Descrivi il problema...",email:"Email (opzionale)",emailPlaceholder:"tua@email.it",emailPrivacy:"Se fornita, la tua email sarà inclusa in una sezione compressa dell'issue GitHub per permettere al manutentore di contattarti.",screenshot:"Screenshot",uploadOrPaste:"Carica, incolla o trascina un'immagine",dataCollectedSummary:"Quali dati sono inclusi nel report?",dataIncluded:"Inclusi:",dataIncludedList:"Versione app, OS, architettura, versione Python, statistiche database (solo conteggi), modelli stampante, numero ugelli, versioni firmware, stato connessione, stato integrazioni (Spoolman, MQTT, HA), impostazioni non sensibili, conteggio interfacce di rete, dettagli Docker, versioni dipendenze.",dataNeverIncluded:"Mai inclusi:",dataNeverIncludedList:"Nomi stampanti, numeri di serie, codici di accesso, password, indirizzi IP, indirizzi email, chiavi API, token, URL webhook, nomi host o nomi utente.",submit:"Invia",collectingLogs:"Raccolta dei log diagnostici...",collectingLogsHint:"Registrazione debug attivata, interrogazione delle stampanti per dati aggiornati.",submitting:"Invio segnalazione bug...",submitSuccess:"Segnalazione bug inviata con successo!",submitFailed:"Impossibile inviare la segnalazione bug",thankYou:"Grazie!",submitted:"La tua segnalazione bug è stata inviata.",viewIssue:"Vedi issue",unexpectedError:"Si è verificato un errore imprevisto",countdownSeconds:"{{seconds}}s"}},tde={nav:{printers:"Impressoras",archives:"Arquivos",queue:"Fila",stats:"Estatísticas",profiles:"Perfis",maintenance:"Manutenção",projects:"Projetos",inventory:"Inventário",files:"Gerenciador de Arquivos",settings:"Configurações",system:"Sistema",collapseSidebar:"Recolher barra lateral",expandSidebar:"Expandir barra lateral",update:"Atualizar",updateAvailable:"Atualização disponível: v{{version}}",updateAvailableBanner:"Versão {{version}} está disponível!",viewUpdate:"Ver atualização",viewOnGithub:"Ver no GitHub",keyboardShortcuts:"Atalhos de teclado (?)",switchToLight:"Mudar para modo claro",switchToDark:"Mudar para modo escuro",smartSwitches:"Interruptores inteligentes",logout:"Sair"},common:{save:"Salvar",saving:"Salvando...",cancel:"Cancelar",delete:"Excluir",edit:"Editar",add:"Adicionar",close:"Fechar",confirm:"Confirmar",loading:"Carregando...",error:"Erro",success:"Sucesso",warning:"Aviso",enabled:"Ativado",disabled:"Desativado",yes:"Sim",no:"Não",on:"Ligado",off:"Desligado",all:"Todos",none:"Nenhum",search:"Pesquisar",filter:"Filtrar",sort:"Ordenar",refresh:"Atualizar",download:"Baixar",upload:"Enviar",uploading:"Enviando...",uploadFailed:"Falha no envio",actions:"Ações",status:"Status",name:"Nome",description:"Descrição",date:"Data",time:"Hora",hours:"Horas",minutes:"Minutos",seconds:"Segundos",days:"Dias",enable:"Ativar",disable:"Desativar",permissions:"Permissões",noPrinters:"Nenhuma impressora configurada",noData:"Nenhum dado disponível",linkNotFound:"Link não encontrado",required:"Obrigatório",optional:"Opcional",dismiss:"Dispensar",apply:"Aplicar",reset:"Redefinir",export:"Exportar",import:"Importar",clear:"Limpar",selectAll:"Selecionar tudo",deselectAll:"Desmarcar tudo",noChange:"— Sem alterações —",unchanged:"Inalterado",unassigned:"Não atribuído",unknown:"Desconhecido",unknownError:"Erro desconhecido",today:"Hoje",tomorrow:"Amanhã",asap:"O mais rápido possível",overdue:"Atrasado",now:"Agora",collapse:"Recolher",expand:"Expandir",viewArchive:"Ver arquivo",viewInFileManager:"Ver no Gerenciador de Arquivos",addedBy:"Adicionado por {{username}}",prints:"impressões",more:"+{{count}} mais",ascending:"Crescente",descending:"Decrescente",printer:"Impressora",remove:"Remover",type:"Tipo",print:"Imprimir",rename:"Renomear",move:"Mover",create:"Criar",duplicate:"Duplicar",left:"Esquerda",right:"Direita"},printers:{title:"Impressoras",addPrinter:"Adicionar Impressora",editPrinter:"Editar Impressora",deletePrinter:"Excluir Impressora",printerName:"Nome da Impressora",serialNumber:"Número de Série",ipAddress:"Endereço IP / Nome do Host",accessCode:"Código de Acesso",model:"Modelo",nozzleCount:"Número de Bicos",autoArchive:"Arquivamento Automático",status:{available:"Disponível",idle:"Ocioso",printing:"Imprimindo",paused:"Pausado",offline:"Offline",error:"Erro",finished:"Concluído",unknown:"Desconhecido"},temperatures:{nozzle:"Bico",bed:"Cama",chamber:"Câmara"},progress:"{{percent}}% concluído",timeRemaining:"{{time}} restante",deleteConfirm:'Tem certeza de que deseja excluir "{{name}}"?',maintenanceOk:"Manutenção OK",maintenanceWarning:"{{count}} aviso",maintenanceWarning_plural:"{{count}} avisos",maintenanceDue:"{{count}} devido",maintenanceDue_plural:"{{count}} devido",sort:{name:"Nome",status:"Status",model:"Modelo",location:"Localização",ascending:"Ordem crescente",descending:"Ordem decrescente"},cardSize:{small:"Cartões pequenos",medium:"Cartões médios",large:"Cartões grandes",extraLarge:"Cartões extra grandes"},hideOffline:"Ocultar offline",nextAvailable:"Próximo disponível",powerOn:"Ligar",offlinePrintersWithPlugs:"Impressoras offline com tomadas inteligentes",noPrintersConfigured:"Nenhuma impressora configurada ainda",readyToPrint:"Pronto para imprimir",external:"Externo",extL:"Ext-L",extR:"Ext-R",deleteArchives:"Excluir arquivos de impressão",noLabel:"Sem etiqueta",printPreview:"Pré-visualização de impressão",width:"Largura",height:"Altura",noObjectsFound:"Nenhum objeto encontrado",objectsLoadedOnPrintStart:"Objetos são carregados quando uma impressão começa",willBeSkipped:"Será ignorado",name:"Nome",serialCannotBeChanged:"Número de série não pode ser alterado",locationHelp:"Usado para agrupar impressoras e filtrar trabalhos na fila",wifiSignal:{veryWeak:"Muito fraco",weak:"Fraco",fair:"Regular",good:"Bom",excellent:"Excelente"},maintenanceUpToDate:"Toda a manutenção está em dia - Clique para ver",chamberLightOn:"Ligar luz da câmara",chamberLightOff:"Desligar luz da câmara",files:"Arquivos",browseFiles:"Procurar arquivos da impressora",autoOffAfterPrint:"Desligamento automático após impressão",autoOffExecuted:"Desligamento automático executado - ligue a impressora para reiniciar",hmsErrors:"Erros HMS",viewHmsErrors:"Ver {{count}} erro(s) HMS",resume:"Retomar",pause:"Pausar",stop:"Parar",camera:"âmera",skipObject:"Ignorar objeto",reconnect:"Reconectar",mqttDebug:"Depuração MQTT",printerInformation:"Informações da impressora",copyToClipboard:"Copiar",copied:"Copiado!",state:"Estado",wifiSignalLabel:"Sinal WiFi",developerMode:"Modo desenvolvedor",enabled:"Ativado",disabled:"Desativado",addedOn:"Adicionada em",sdCard:"Cartão SD",inserted:"Inserido",notInserted:"Não inserido",totalPrintHours:"Horas de impressão",activeNozzle:"Ativo: {{nozzle}} bico",nozzleRack:"Suporte de bicos",nozzleDocked:"Acoplado",nozzleMounted:"Montado",nozzleActive:"Ativo",nozzleIdle:"Ocioso",nozzleDiameter:"Diâmetro",nozzleType:"Tipo",nozzleStatus:"Status",nozzleFilament:"Filamento",nozzleWear:"Desgaste",nozzleMaxTemp:"Temp Máx",nozzleSerial:"Serial",nozzleHardenedSteel:"Aço Endurecido",nozzleStainlessSteel:"Aço Inoxidável",nozzleTungstenCarbide:"Carboneto de Tungstênio",nozzleFlow:"Fluxo",nozzleHighFlow:"Alto Fluxo",nozzleStandardFlow:"Fluxo Padrão",firmwareUpdate:"Atualização de Firmware",firmwareInstructions:"No visor da impressora, vá para",firmwareNav:"Navegar para",settings:"Configurações",firmware:"Firmware",discoverPrinters:"Descobrir Impressoras",searching:"Procurando...",manualEntry:"Entrada Manual",addFromCloud:"Adicionar da Nuvem",toast:{printerDeleted:"Impressora excluída",printerAdded:"Impressora adicionada",printerUpdated:"Impressora atualizada",failedToDelete:"Falha ao excluir impressora",failedToAdd:"Falha ao adicionar impressora",failedToUpdate:"Falha ao atualizar impressora",commandSent:"Comando enviado",failedToSendCommand:"Falha ao enviar comando",turnedOn:"{{name}} ligado",failedToPowerOn:"Falha ao ligar {{name}}",scriptTriggered:"Script acionado",printStopped:"Impressão parada",printPaused:"Impressão pausada",printResumed:"Impressão retomada",referenceDeleted:"Referência excluída",detectionAreaSaved:"Área de detecção salva",failedToRunScript:"Falha ao executar script",failedToStopPrint:"Falha ao parar impressão",failedToPausePrint:"Falha ao pausar impressão",failedToResumePrint:"Falha ao retomar impressão",failedToControlChamberLight:"Falha ao controlar a luz da câmara",failedToUpdateSetting:"Falha ao atualizar configuração",failedToSkipObjects:"Falha ao ignorar objetos",failedToRereadRfid:"Falha ao reler RFID",failedToCheckPlate:"Falha ao verificar a placa",failedToUpdateLabel:"Falha ao atualizar etiqueta",failedToDeleteReference:"Falha ao excluir referência",failedToSaveDetectionArea:"Falha ao salvar área de detecção",plateCheckEnabled:"Verificação da placa ativada",plateCheckDisabled:"Verificação da placa desativada",calibrationSaved:"Calibração salva!",calibrationFailed:"Falha na calibração",rfidRereadInitiated:"Releitura de RFID iniciada"},connection:{connected:"Conectado",offline:"Offline"},queue:{inQueue:"{{count}} impressão na fila",inQueue_plural:"{{count}} impressões na fila"},controls:"Controles",rfid:{reread:"Releitura de RFID"},permission:{noAdd:"Você não tem permissão para adicionar impressoras",noEdit:"Você não tem permissão para editar impressoras",noDelete:"Você não tem permissão para excluir impressoras",noControl:"Você não tem permissão para controlar impressoras",noFiles:"Você não tem permissão para acessar arquivos de impressora",noAmsRfid:"Você não tem permissão para reler RFID AMS",noSmartPlugControl:"Você não tem permissão para controlar tomadas inteligentes",noCamera:"Você não tem permissão para visualizar câmeras"},modal:{addTitle:"Adicionar Impressora",editTitle:"Editar Impressora",myPrinter:"Minha Impressora",selectModel:"Selecionar modelo...",locationGroup:"Localização / Grupo (opcional)",locationPlaceholder:"ex.: Oficina, Escritório, Porão",autoArchiveLabel:"Arquivar automaticamente impressões concluídas",fromPrinterSettings:"A partir das configurações da impressora",modelOptional:"Modelo (opcional)",saveChanges:"Salvar alterações"},skipObjects:{tooltip:"Ignorar objetos",onlyWhilePrinting:"Ignorar objetos (apenas durante a impressão)",requiresMultiple:"Ignorar objetos (requer 2+ objetos)",title:"Ignorar Objetos",matchIdsInfo:"Correspondência de IDs com o display da sua impressora",printerShowsIds:"A tela da impressora mostra os IDs dos objetos na placa de construção",skipSelected:"Ignorar Selecionados",skipping:"Ignorando...",noObjectsSelected:"Nenhum objeto selecionado",selectObjectsToSkip:"Selecione os objetos que deseja ignorar na impressão atual",skipped:"Ignorado",objectsSkipped:"Objetos ignorados",activeCount:"{{count}} ativo",waitForLayer:"Aguarde a camada 2+ para ignorar objetos (atualmente na camada {{layer}})",skip:"Ignorar",confirmTitle:"Ignorar Objeto?",confirmMessage:'Tem certeza de que deseja ignorar "{{name}}"? Isso não pode ser desfeito.'},confirm:{deleteTitle:"Excluir Impressora",deleteMessage:'Tem certeza de que deseja excluir "{{name}}"? Isso removerá todas as configurações de conexão.',deleteArchivesNote:"Todo o histórico de impressão desta impressora será permanentemente excluído.",keepArchivesNote:"O histórico de impressão será mantido, mas não estará mais associado a esta impressora.",stopTitle:"Parar Impressão",stopMessage:'Tem certeza de que deseja parar a impressão atual em "{{name}}"? Isso cancelará o trabalho de impressão.',stopButton:"Parar Impressão",pauseTitle:"Pausar Impressão",pauseMessage:'Tem certeza de que deseja pausar a impressão atual em "{{name}}"?',pauseButton:"Pausar Impressão",resumeTitle:"Retomar Impressão",resumeMessage:'Tem certeza de que deseja retomar a impressão em "{{name}}"?',resumeButton:"Retomar Impressão",powerOnTitle:"Ligar Impressora",powerOnMessage:'Tem certeza de que deseja ligar a impressora "{{name}}"?',powerOnButton:"Ligar",powerOffTitle:"Desligar Impressora",powerOffMessage:'Tem certeza de que deseja desligar a impressora "{{name}}"?',powerOffWarning:'AVISO: "{{name}}" está imprimindo no momento! Tem certeza de que deseja desligar a impressora? Isso interromperá a impressão e pode danificar a impressora.',powerOffButton:"Desligar"},discovery:{title:"Descobrir Impressoras",searching:"Procurando...",scanning:"Escaneando...",scanProgress:"Escaneando... {{scanned}}/{{total}}",foundPrinters:"{{count}} impressora(s) encontrada(s)",noPrintersFound:"Nenhuma impressora encontrada",noPrintersFoundSubnet:"Nenhuma impressora encontrada na sub-rede especificada.",noPrintersFoundNetwork:"Nenhuma impressora encontrada na rede.",allConfigured:"Todas as impressoras descobertas já estão configuradas.",alreadyAdded:"Já adicionada",select:"Selecionar",manualEntry:"Entrada Manual",addFromCloud:"Adicionar da Nuvem",subnetToScan:"Sub-rede para escanear",dockerNote:"Docker detectado. Insira a sub-rede da sua impressora em notação CIDR. Requer network_mode: host no docker-compose.yml.",scanSubnet:"Escanear Sub-rede para Impressoras",discoverNetwork:"Descobrir Impressoras na Rede",scanningSubnet:"Escaneando sub-rede para impressoras Bambu...",scanningNetwork:"Escaneando rede...",serialRequired:"Serial necessário",unknown:"Desconhecido",failedToStart:"Falha ao iniciar a descoberta"},filaments:"Filamentos",openCameraOverlay:"Abrir sobreposição da câmera",openCameraWindow:"Abrir câmera em nova janela",firmwareUpdateAvailable:"Atualização de firmware disponível: {{current}} → {{latest}}",firmwareUpToDate:"Firmware {{version}} — Atualizado",firmwareUpdateButton:"Atualizar",plateDetection:{noPermission:"Você não tem permissão para atualizar impressoras",enabledClick:"Verificação da placa ativada - Clique para desativar",disabledClick:"Verificação da placa desativada - Clique para ativar",manageCalibration:"Gerenciar calibração da detecção da placa",calibrationRequired:"Calibração necessária",calibrationInstructions:"Certifique-se de que a placa de construção esteja <strong>completamente vazia</strong>, em seguida clique em Calibrar.",calibrationDescription:"A calibração captura uma imagem de referência da placa vazia. Verificações futuras compararão com esta referência para detectar objetos.",calibrationTip:"<strong>Dica:</strong> Você pode armazenar até 5 calibrações para diferentes placas. O sistema usa automaticamente a melhor correspondência ao verificar.",plateEmpty:"A placa parece vazia",objectsDetected:"Objetos detectados na placa",confidence:"Confiança",difference:"Diferença",analysisPreview:"Pré-visualização da análise:",analysisLegend:"Caixa verde = área de detecção, Sobreposição vermelha = diferenças em relação à calibração",savedReferences:"Referências salvas ({{count}}/{{max}})",deleteReference:"Excluir referência",labelPlaceholder:"Etiqueta...",clickToEdit:"{{label}} - Clique para editar",clickToAddLabel:"Clique para adicionar etiqueta"},fans:{partCooling:"Ventilador de resfriamento da peça",auxiliary:"Ventilador auxiliar",chamber:"Ventilador da câmara"},clickToViewHmsErrors:"Clique para ver erros do HMS",estimatedCompletion:"Tempo estimado de conclusão",slotOptions:"Opções de slot",amsPopup:{friendlyName:"Nome do AMS",friendlyNamePlaceholder:"ex.: Nome amigável do AMS",serialNumber:"Número de série",firmwareVersion:"Firmware",save:"Salvar",clear:"Limpar",noEditPermission:"Você não tem permissão para renomear unidades AMS"},firmwareModal:{title:"Atualização de Firmware",titleUpToDate:"Informações do Firmware",currentVersion:"Atual:",latestVersion:"Última:",releaseNotes:"Notas de Lançamento",checkingPrereqs:"Verificando pré-requisitos...",sdCardReady:"Cartão SD pronto. Clique abaixo para enviar o firmware.",uploadedSuccess:"Firmware enviado para o cartão SD!",applyInstructions:"Para aplicar a atualização na sua impressora:",step1:"Na tela sensível ao toque da impressora, vá para <strong>Configurações</strong>",step2:"Navegue até <strong>Firmware</strong>",step3:"Selecione <strong>Atualizar a partir do cartão SD</strong>",step4:"A atualização levará de 10 a 20 minutos",done:"Concluído",starting:"Iniciando...",uploadFirmware:"Enviar Firmware",uploadFailed:"Falha ao iniciar o envio: {{error}}",uploadedToast:"Firmware enviado! Inicie a atualização na tela da impressora."},accessCodePlaceholder:"Deixe vazio para manter o atual",roi:{title:"Área de Detecção (ROI)",xStart:"Início X",yStart:"Início Y",width:"Largura",height:"Altura",instruction:"Ajuste a área de detecção para focar na placa de construção. A caixa verde na pré-visualização mostra a área atual."},developerModeWarning:"O modo desenvolvedor LAN não está ativado em: {{names}}. Alguns recursos podem não funcionar.",howToEnable:"Como ativar",incompatibleFile:"Este arquivo foi fatiado para {{slicedFor}}, mas esta impressora é uma {{printerModel}}",dropNotPrintable:"Apenas arquivos .gcode e .gcode.3mf podem ser impressos",dropToPrint:"Solte para imprimir",cannotPrint:"Impressora ocupada"},archives:{title:"Arquivos de Impressão",searchPlaceholder:"Pesquisar arquivos...",filterByPrinter:"Filtrar por impressora",filterByStatus:"Filtrar por status",sortBy:"Ordenar por",sortNewest:"Mais recentes primeiro",sortOldest:"Mais antigos primeiro",sortName:"Nome",sortDuration:"Duração",sortLargest:"Maiores primeiro",sortSmallest:"Menores primeiro",sortSize:"Tamanho",noArchives:"Nenhum arquivo encontrado",noArchivesSearch:"Nenhum arquivo corresponde à sua pesquisa",noArchivesYet:"Ainda não há arquivos",loadingArchives:"Carregando arquivos...",releaseToUpload:"Solte para enviar",showAll:"Mostrar todos",showFavoritesOnly:"Mostrar apenas favoritos",gridView:"Visualização em grade",listView:"Visualização em lista",calendarView:"Visualização em calendário",logView:"Registro de impressão",manageTags:"Gerenciar etiquetas",showFailedPrints:"Mostrar impressões falhas",hideFailedPrints:"Ocultar impressões falhas",printTime:"Tempo de impressão",filamentUsed:"Filamento usado",cost:"Custo",reprint:"Reimprimir",preview:"Pré-visualizar",deleteArchive:"Excluir arquivo",deleteConfirm:"Tem certeza de que deseja excluir este arquivo?",favorite:"Favorito",unfavorite:"Remover dos favoritos",viewDetails:"Ver detalhes",status:{completed:"Concluído",failed:"Falhou",stopped:"Parado"},toast:{source3mfAttached:"Arquivo de origem 3MF anexado: {{filename}}",failedUploadSource3mf:"Falha ao enviar arquivo de origem 3MF",source3mfRemoved:"Arquivo de origem 3MF removido",failedRemoveSource3mf:"Falha ao remover arquivo de origem 3MF",f3dAttached:"F3D anexado: {{filename}}",failedUploadF3d:"Falha ao enviar F3D",f3dRemoved:"F3D removido",failedRemoveF3d:"Falha ao remover F3D",timelapseAttached:"Timelapse anexado: {{filename}}",timelapseAlreadyAttached:"Timelapse já anexado",noMatchingTimelapse:"Nenhum timelapse correspondente encontrado",failedScanTimelapse:"Falha ao escanear timelapse",failedAttachTimelapse:"Falha ao anexar timelapse",timelapseRemoved:"Timelapse removido",failedRemoveTimelapse:"Falha ao remover timelapse",timelapseUploaded:"Timelapse enviado: {{filename}}",failedUploadTimelapse:"Falha ao enviar timelapse",archiveDeleted:"Arquivo excluído",failedDeleteArchive:"Falha ao excluir arquivo",addedToFavorites:"Adicionado aos favoritos",removedFromFavorites:"Removido dos favoritos",projectUpdated:"Projeto atualizado",failedUpdateProject:"Falha ao atualizar projeto",linkCopied:"Link copiado para a área de transferência",failedCopyLink:"Falha ao copiar link",photoDeleted:"Foto excluída",failedDeletePhoto:"Falha ao excluir foto",failedDeleteArchives:"Falha ao excluir arquivos",failedUpdateFavorites:"Falha ao atualizar favoritos",exportDownloaded:"Exportação baixada",exportFailed:"Falha na exportação"},menu:{print:"Imprimir",schedule:"Agendar",openInBambuStudio:"Abrir no Slicer",slice:"Fatiar",externalLink:"Link externo",viewOnMakerWorld:"Ver no MakerWorld",preview3d:"Pré-visualização 3D",viewTimelapse:"Ver Timelapse",scanForTimelapse:"Escanear Timelapse",uploadTimelapse:"Enviar Timelapse",removeTimelapse:"Remover Timelapse",downloadSource3mf:"Baixar Source 3MF",uploadSource3mf:"Enviar Source 3MF",replaceSource3mf:"Substituir Source 3MF",removeSource3mf:"Remover Source 3MF",uploadF3d:"Enviar F3D",replaceF3d:"Substituir F3D",downloadF3d:"Baixar F3D",removeF3d:"Remover F3D",download:"Baixar",copyDownloadLink:"Copiar link de download",qrCode:"Qr Code",viewPhotos:"Ver fotos",viewPhotosCount:"Ver fotos ({{count}})",projectPage:"Página do projeto",addToFavorites:"Adicionar aos favoritos",removeFromFavorites:"Remover dos favoritos",edit:"Editar",goToProject:"Ir para o projeto: {{name}}",addToProject:"Adicionar ao projeto",removeFromProject:"Remover do projeto",loading:"Carregando...",noProjectsAvailable:"Nenhum projeto disponível",select:"Selecionar",deselect:"Desmarcar",delete:"Excluir"},permission:{noReprint:"Você não tem permissão para reimprimir este arquivo",noAddToQueue:"Você não tem permissão para adicionar à fila",noUpdateArchives:"Você não tem permissão para atualizar arquivos",noUploadFiles:"Você não tem permissão para enviar arquivos",noDownload:"Você não tem permissão para baixar arquivos",noCopyLink:"Você não tem permissão para copiar links de download",noDelete:"Você não tem permissão para excluir este arquivo",noCreate:"Você não tem permissão para criar arquivos"},card:{previousPlate:"Placa anterior",nextPlate:"Próxima placa",plateNumber:"Placa {{index}}",moreOptions:"Clique com o botão direito para mais opções",addToFavorites:"Adicionar aos favoritos",removeFromFavorites:"Remover dos favoritos",cancelled:"cancelado",failed:"falha",duplicate:"duplicado",duplicateTitle:"Este modelo já foi impresso antes",openSource3mf:"Abrir source 3MF no Bambu Studio (clique com o botão direito para mais opções)",downloadF3d:"Baixar arquivo de design do Fusion 360",viewTimelapse:"Ver timelapse",viewPhoto:"Ver 1 foto",viewPhotos:"Ver {{count}} fotos",openFolder:"Abrir pasta: {{name}}",slicedFile:"Arquivo fatiado - pronto para imprimir",sourceFile:"Apenas arquivo fonte - nenhum mapeamento AMS disponível",gcode:"GCODE",source:"SOURCE",project:"Projeto: {{name}}",estimated:"Estimado: {{time}}",actual:"Real: {{time}}",accuracy:"Precisão: {{percent}}%",filament:"{{weight}}g",layer:"{{count}} camada",layers:"{{count}} camadas",object:"{{count}} objeto",objects:"{{count}} objetos",slicedFor:"Fatiado para {{model}}",uploadedBy:"Enviado por",noPermissionReprint:"Você não tem permissão para reimprimir",noFileForReprint:"Nenhum arquivo 3MF disponível — o arquivo não pôde ser baixado da impressora quando a impressão foi registrada",noPermissionEdit:"Você não tem permissão para editar arquivos",noPermissionDelete:"Você não tem permissão para excluir arquivos",reprint:"Reimprimir",schedulePrint:"Agendar impressão",schedule:"Agendar",openInBambuStudio:"Abrir no Bambu Studio",openInBambuStudioToSlice:"Abrir no Bambu Studio para fatiar",slice:"Fatiar",externalLink:"Link externo",makerWorld:"MakerWorld: {{designer}}",viewProject:"Ver projeto",noExternalLink:"Nenhum link externo",preview3d:"Visualização 3D",download:"Baixar",edit:"Editar",delete:"Excluir"},modal:{deleteArchive:"Excluir Arquivo",deleteConfirm:'Tem certeza de que deseja excluir "{{name}}"? Esta ação não pode ser desfeita.',deleteButton:"Excluir",removeSource3mf:"Remover Source 3MF",removeSource3mfConfirm:'Tem certeza de que deseja remover o arquivo source 3MF de "{{name}}"? Isso excluirá o arquivo original do projeto do fatiador.',removeButton:"Remover",removeF3d:"Remover F3D",removeF3dConfirm:'Tem certeza de que deseja remover o arquivo de design do Fusion 360 de "{{name}}"?',removeTimelapse:"Remover Timelapse",removeTimelapseConfirm:'Tem certeza de que deseja remover o vídeo timelapse de "{{name}}"?',timelapse:"{{name}} - Timelapse",selectTimelapse:"Selecionar Timelapse",selectTimelapseDesc:"Nenhuma correspondência automática encontrada. Selecione o timelapse para esta impressão:",deleteArchives:"Excluir Arquivos",deleteArchivesConfirm:"Tem certeza de que deseja excluir {{count}} arquivo(s)? Esta ação não pode ser desfeita.",deleteCount:"Excluir {{count}}"},page:{title:"Arquivos",printsCount:"{{filtered}} de {{total}} impressões",dropFilesHere:"Solte arquivos .3mf aqui",releaseToUpload:"Solte para enviar",only3mfSupported:"Apenas arquivos .3mf são suportados",close:"Fechar",selected:"{{count}} selecionado(s)",selectAll:"Selecionar Todos",tags:"Tags",project:"Projeto",favorite:"Favorito",delete:"Excluir",toggledFavorites:"Favoritos alternados para {{count}} arquivo(s)",failedUpdateFavorites:"Falha ao atualizar favoritos",archivesDeleted:"{{count}} arquivo(s) excluído(s)",failedDeleteArchives:"Falha ao excluir arquivos",photoDeleted:"Foto excluída",failedDeletePhoto:"Falha ao excluir foto"},list:{name:"Nome",printer:"Impressora",date:"Data",size:"Tamanho",actions:"Ações",hasTimelapse:"Possui timelapse"},log:{date:"Data",printName:"Nome da Impressão",printer:"Impressora",user:"Usuário",status:"Status",duration:"Duração",filament:"Filamento",allPrinters:"Todas as Impressoras",allUsers:"Todos os Usuários",allStatuses:"Todos os Status",cancelled:"Cancelado",skipped:"Ignorado",dateFrom:"De",dateTo:"Até",noEntries:"Nenhuma entrada de registro de impressão encontrada",showing:"Mostrando {{count}} de {{total}} entradas",rowsPerPage:"Linhas",page:"Página",prev:"Anterior",next:"Próxima",clearLog:"Limpar Registro",clearLogTitle:"Limpar Registro de Impressão",clearLogConfirm:"Todas as entradas do registro de impressão serão permanentemente excluídas. Arquivos e itens da fila não serão afetados. Esta ação não pode ser desfeita. Tem certeza?",clearLogButton:"Limpar Tudo",cleared:"{{count}} entradas do registro de impressão limpas",clearFailed:"Falha ao limpar o registro de impressão"}},queue:{title:"Fila de Impressão",subtitle:"Agende e gerencie seus trabalhos de impressão",addToQueue:"Adicionar à Fila",print:"Imprimir",reprint:"Reimprimir",schedulePrint:"Agendar Impressão",editQueueItem:"Editar Item da Fila",printToPrinters:"Imprimir para {{count}} Impressoras",queueToPrinters:"Adicionar à Fila para {{count}} Impressoras",queueAllPlates:"Adicionar todas as {{count}} placas à fila",printQueued:"Impressão adicionada à fila",itemsQueued:"{{count}} itens adicionados à fila",sending:"Enviando...",sendingProgress:"Enviando {{current}}/{{total}}...",adding:"Adicionando...",addingProgress:"Adicionando {{current}}/{{total}}...",savingProgress:"Salvando {{current}}/{{total}}...",clearQueue:"Limpar Fila",clearHistory:"Limpar Histórico",emptyQueue:"Fila vazia",position:"Posição",scheduledTime:"Hora Agendada",moveUp:"Mover para Cima",moveDown:"Mover para Baixo",startNow:"Iniciar Agora",printingInProgress:"Impressão em andamento...",viewArchive:"Ver Arquivo",viewInFileManager:"Ver no Gerenciador de Arquivos",itemCount:"{{count}} item",itemCount_plural:"{{count}} itens",dragToReorder:"Arraste para reordenar (apenas ASAP)",reorderHint:"A posição afeta apenas itens ASAP. Itens agendados são executados no horário definido.",addedBy:"Adicionado por {{name}}",nextInQueue:"Próximo na fila",clearPlate:"Limpar Placa e Iniciar Próximo",clearPlateSuccess:"Placa limpa — pronta para a próxima impressão",plateReady:"Placa limpa — pronta para a próxima impressão",plateNumber:"Placa {{index}}",sections:{currentlyPrinting:"Imprimindo Atualmente",queued:"Na Fila",history:"Histórico"},status:{pending:"Pendente",waiting:"Aguardando",printing:"Imprimindo",paused:"Pausado",completed:"Concluído",failed:"Falhou",skipped:"Ignorado",cancelled:"Cancelado"},summary:{printing:"Imprimindo",queued:"Na Fila",totalTime:"Tempo Total da Fila",totalWeight:"Peso Total da Fila",history:"Histórico"},filter:{allPrinters:"Todas as Impressoras",unassigned:"Não Atribuído",allStatus:"Todos os Status",allLocations:"Todos os Locais",any:"Qualquer"},sort:{byPosition:"Ordenar por Posição",byName:"Ordenar por Nome",byPrinter:"Ordenar por Impressora",bySchedule:"Ordenar por Agendamento",byDate:"Ordenar por Data",ascendingOldest:"Crescente (mais antigo primeiro)",descendingNewest:"Decrescente (mais recente primeiro)"},badges:{staged:"Preparado (início manual)",requiresPrevious:"Requer sucesso anterior",autoPowerOff:"Desligamento automático"},empty:{title:"Nenhuma impressão agendada",description:'Agende uma impressão a partir da página de Arquivos usando a opção "Agendar" no menu de contexto, ou arraste e solte arquivos para começar.'},time:{asap:"ASAP",overdue:"Atrasado",now:"Agora",lessThanMinute:"Em menos de um minuto",inMinutes:"Em {{count}} min",inHours:"Em {{count}} horas"},actions:{stopPrint:"Parar Impressão",startPrint:"Iniciar Impressão",requeue:"Reenfileirar"},bulkEdit:{title:"Editar {{count}} Item",title_plural:"Editar {{count}} Itens",description:"Apenas as configurações alteradas serão aplicadas aos itens selecionados.",printer:"Impressora",noChange:"— Sem alterações —",queueOptions:"Opções de Fila",staged:"Preparado (início manual)",autoPowerOff:"Desligamento automático após impressão",requirePrevious:"Requer sucesso anterior",printOptions:"Opções de Impressão",bedLevelling:"Nivelamento da Mesa",flowCalibration:"Calibração de Fluxo",vibrationCalibration:"Calibração de Vibração",layerInspection:"Inspeção da Primeira Camada",timelapse:"Timelapse",useAms:"Usar AMS",applyChanges:"Aplicar Alterações",selectAll:"Selecionar Todos",deselectAll:"Desmarcar Todos",selected:"{{count}} selecionado(s)",editSelected:"Editar Selecionados",cancelSelected:"Cancelar Selecionados"},confirm:{cancelTitle:"Cancelar Impressão Agendada",cancelMessage:'Tem certeza de que deseja cancelar "{{name}}"?',stopTitle:"Parar Impressão",stopMessage:'Tem certeza de que deseja parar a impressão atual "{{name}}"? Isso cancelará o trabalho de impressão na impressora.',removeTitle:"Remover do Histórico",removeMessage:'Tem certeza de que deseja remover "{{name}}" do histórico da fila?',clearHistoryTitle:"Limpar Histórico",clearHistoryMessage:"Tem certeza de que deseja remover todos os {{count}} itens do histórico?",cancelButton:"Cancelar Impressão",stopButton:"Parar Impressão",thisPrint:"esta impressão",thisItem:"este item"},toast:{cancelled:"Item da fila cancelado",cancelFailed:"Falha ao cancelar item",removed:"Item da fila removido",removeFailed:"Falha ao remover item",stopped:"Impressão parada",stopFailed:"Falha ao parar impressão",released:"Impressão liberada para a fila",startFailed:"Falha ao iniciar impressão",reorderFailed:"Falha ao reordenar fila",historyCleared:"Limpar {{count}} item(s) do histórico",clearHistoryFailed:"Falha ao limpar histórico",updateFailed:"Falha ao atualizar itens",bulkCancelled:"Cancelado {{count}} item(s)",bulkCancelFailed:"Falha ao cancelar itens"},permissions:{noStopPrint:"Você não tem permissão para parar impressões",noStartPrint:"Você não tem permissão para iniciar impressões",noEdit:"Você não tem permissão para editar este item da fila",noCancel:"Você não tem permissão para cancelar este item da fila",noRequeue:"Você não tem permissão para reenfileirar itens",noRemove:"Você não tem permissão para remover este item da fila",noClearHistory:"Você não tem permissão para limpar todo o histórico",noEditItems:"Você não tem permissão para editar itens da fila",noCancelItems:"Você não tem permissão para cancelar itens da fila"}},backgroundDispatch:{unknownFile:"Unknown file",unknownPrinter:"Unknown printer",startingPrints:"Starting prints",progressSummary:"{{complete}}/{{total}} complete • Dispatched: {{dispatched}} • Processing: {{processing}}",expandDetails:"Expand dispatch details",collapseDetails:"Collapse dispatch details",dismissToast:"Dismiss dispatch toast",cancelDispatchJob:"Cancel dispatch job",cancel:"Cancel",cancelling:"Cancelling…",status:{dispatched:"Dispatched",processing:"Processing",completed:"Completed",failed:"Failed",cancelled:"Cancelled"},toast:{cancellingUpload:"Cancelling upload...",cancelled:"Dispatch cancelled",cancelFailed:"Failed to cancel dispatch",completeWithFailures:"Background dispatch complete: {{completed}} succeeded, {{failed}} failed",completeSuccess:"Background dispatch complete: {{completed}} succeeded",printStartedRemaining:"{{completed}} impressão(ões) iniciada(s), {{remaining}} enviando..."}},stats:{title:"Dashboard",subtitle:"Arraste os widgets para reorganizar. Clique no ícone de olho para ocultar.",overview:"Visão Geral",totalPrints:"Total de Impressões",successRate:"Taxa de Sucesso",totalPrintTime:"Tempo Total de Impressão",printTime:"Tempo de Impressão",totalFilament:"Filamento Total Utilizado",filamentUsed:"Filamento Utilizado",filamentCost:"Custo do Filamento",totalCost:"Custo Total",energyUsed:"Energia Utilizada",energyCost:"Custo da Energia",averagePrintTime:"Tempo Médio de Impressão",printsPerDay:"Impressões por Dia",byPrinter:"Por Impressora",printsByPrinter:"Impressões por Impressora",byMaterial:"Por Material",byMonth:"Por Mês",last7Days:"Últimos 7 Dias",last30Days:"Últimos 30 Dias",last90Days:"Últimos 90 Dias",allTime:"Todo o Tempo",quickStats:"Estatísticas Rápidas",printActivity:"Atividade de Impressão",filamentTypes:"Tipos de Filamento",filamentTrends:"Tendências de Filamento",failureAnalysis:"Análise de Falhas",timeAccuracy:"Precisão do Tempo",successful:"Bem-sucedido:",failed:"Falhou:",perfectEstimate:"100% = estimativa perfeita",noTimeAccuracyData:"Nenhum dado de precisão de tempo disponível",noFilamentData:"Nenhum dado de filamento disponível",noPrinterData:"Nenhum dado de impressora disponível",noPrintData:"Nenhum dado de impressão disponível",noPrintDataLast30Days:"Nenhum dado de impressão nos últimos 30 dias",failureReasons:"Razões de Falha",topFailureReasons:"Principais Razões de Falha",failedPrintsCount:"{{failed}} / {{total}} impressões falharam",lastWeekRate:"Última semana: {{rate}}%",resetLayout:"Redefinir Layout",recalculateCosts:"Recalcular Custos",recalculateCostsHint:"Recalcular todos os custos do arquivo usando os preços atuais do filamento",exportStats:"Exportar Estatísticas",exportAsCsv:"Exportar como CSV",exportAsExcel:"Exportar como Excel",hiddenCount:"{{count}} Oculto",exportDownloaded:"Exportação baixada",exportFailed:"Falha na exportação",layoutReset:"Layout redefinido",recalculatedCosts:"Custos recalculados para {{count}} arquivos",recalculateFailed:"Falha ao recalcular custos",loadingStats:"Carregando estatísticas...",noPermissionResetLayout:"Você não tem permissão para redefinir o layout",noPermissionRecalculate:"Você não tem permissão para recalcular custos",noPrintDataInRange:"Sem dados no período selecionado",periodFilament:"Filamento usado",periodCost:"Custo",avgPerPrint:"Média por impressão",usageOverTime:"Uso ao longo do tempo",filamentByWeight:"Peso",printDuration:"Duração da impressão",printerUtilization:"Utilização da impressora",filamentSuccess:"Sucesso por material",printHabits:"Hábitos de impressão",printTimeOfDay:"Horário de impressão",colorDistribution:"Distribuição de cores",noColorData:"Nenhum dado de cor disponível",records:"Recordes",longestPrint:"Impressão mais longa",heaviestPrint:"Impressão mais pesada",mostExpensivePrint:"Mais cara",busiestDay:"Dia mais movimentado",successStreak:"Sequência de sucesso",streakPrint:"impressão consecutiva",streakPrints:"{{count}} impressões consecutivas",printerStats:"Estatísticas da impressora",hours:"horas",avgPrints:"Méd. impressões",noArchiveData:"Nenhum dado de impressão disponível",filamentByTime:"Tempo",avgWeight:"Méd. peso",avgTime:"Méd. tempo",filamentByPrints:"Impressões",timeframe:{today:"Hoje","this-week":"Esta semana","this-month":"Este mês","last-7":"Últimos 7 dias","last-30":"Últimos 30 dias","last-90":"Últimos 90 dias","this-year":"Este ano","all-time":"Todo o período",custom:"Personalizado",from:"De",to:"Até"}},maintenance:{title:"Manutenção",overview:"Visão Geral",allOk:"Todas as manutenções estão em dia",dueCount:"{{count}} item pendente",dueCount_plural:"{{count}} itens pendentes",warningCount:"{{count}} aviso",warningCount_plural:"{{count}} avisos",totalPrintTime:"Tempo Total de Impressão",nextMaintenance:"Próxima Manutenção",nothingDue:"Nada pendente",tasks:"Tarefas",lastPerformed:"Última execução",interval:"Intervalo",hoursRemaining:"{{hours}}h restantes",hoursOverdue:"{{hours}}h atrasadas",markDone:"Marcar como Concluída",performMaintenance:"Realizar Manutenção",history:"Histórico",noHistory:"Nenhum histórico de manutenção",editPrintHours:"Editar Horas de Impressão",currentHours:"Horas Atuais",statusTab:"Status",settingsTab:"Configurações",overdueCount:"{{count}} atrasado",dueSoonCount:"{{count}} prestes a vencer",dueSoon:"Prestes a vencer",allGood:"Tudo certo",overdueBy:"Atrasado por {{duration}}",dueIn:"Vence em {{duration}}",timeLeft:"{{duration}} restantes",day:"1 dia",days:"{{count}} dias",week:"1 semana",weeks:"{{count}} semanas",month:"1 mês",months:"{{count}} meses",year:"1 ano",maintenanceTypes:"Tipos de Manutenção",maintenanceTypesDescription:"Tipos de sistema e suas tarefas de manutenção personalizadas",addCustomType:"Adicionar Tipo Personalizado",restoreDefaults:"Restaurar Tarefas Padrão",intervalType:"Tipo de Intervalo",intervalValue:"Intervalo ({{type}})",icon:"Icon",documentationLink:"Link da Documentação (opcional)",assignToPrinters:"Atribuir a Impressoras",selectAtLeastOnePrinter:"Selecione pelo menos uma impressora",addType:"Adicionar Tipo",custom:"Personalizado",printHours:"Horas de Impressão",calendarDays:"Dias de Calendário",exampleName:"ex., Substituir Filtro HEPA",viewDocumentation:"Ver documentação",timeBasedInterval:"Intervalo baseado em tempo",intervalOverrides:"Substituições de Intervalo",intervalOverridesDescription:"Personalize os intervalos para impressoras específicas",assignedToPrinters:"Atribuído a impressoras:",noPrintersAssigned:"Nenhuma impressora atribuída",addPrinterShort:"Adicionar:",printersAssignedClick:"{{count}} impressora(s) atribuída(s) - clique para gerenciar",removeFromPrinter:"Remover desta impressora",types:{lubricateCarbonRods:"Lubricar Barras de Carbono",lubricateRails:"Lubricar Trilhos Lineares",cleanNozzle:"Limpar Bico/Hotend",checkBelts:"Verificar Tensão das Correias",cleanBuildPlate:"Limpar Plataforma de Impressão",checkExtruder:"Verificar Engrenagens do Extrusor",checkCooling:"Verificar Ventiladores de Resfriamento",generalInspection:"Inspeção Geral",cleanCarbonRods:"Limpar Barras de Carbono",lubricateSteelRods:"Lubrificar Barras de Aço",cleanSteelRods:"Limpar Barras de Aço",cleanLinearRails:"Limpar Trilhos Lineares",checkPtfeTube:"Verificar Tubo PTFE",replaceHepaFilter:"Substituir Filtro HEPA",replaceCarbonFilter:"Substituir Filtro de Carbono",lubricateLeftNozzleRail:"Lubrificar Trilho do Bico Esquerdo"},maintenanceComplete:"Manutenção marcada como concluída",typeUpdated:"Tipo de manutenção atualizado",typeDeleted:"Tipo de manutenção excluído",defaultsRestored:"Restauradas {{count}} tarefa(s) padrão",printHoursUpdated:"Horas de impressão atualizadas",printerAssigned:"Impressora atribuída",printerRemoved:"Impressora removida",deleteTypeConfirm:'Excluir "{{name}}"?',deleteSystemTypeTitle:"Excluir tarefa de manutenção padrão?",deleteSystemTypeMessage:'Tem certeza de que deseja excluir a tarefa de manutenção padrão "{{name}}"?',noPermissionUpdate:"Você não tem permissão para atualizar itens de manutenção",noPermissionPerform:"Você não tem permissão para realizar manutenção",noPermissionEditTypes:"Você não tem permissão para editar tipos de manutenção",noPermissionDeleteTypes:"Você não tem permissão para excluir tipos de manutenção",noPermissionEditHours:"Você não tem permissão para editar horas de impressão",noPermissionRemovePrinter:"Você não tem permissão para remover atribuições de impressora",noPermissionAssignPrinter:"Você não tem permissão para atribuir impressoras",noPermissionEditIntervals:"Você não tem permissão para editar intervalos",configureSettings:"Configure tipos de manutenção e intervalos"},settings:{title:"Configurações",general:"Geral",tabs:{general:"Geral",smartPlugs:"Tomadas Inteligentes",notifications:"Notificações",filament:"Filamento",network:"Rede",apiKeys:"Chaves API",virtualPrinter:"Impressora Virtual",users:"Autenticação",backup:"Backup",emailAuth:"Autenticação por Email"},email:{smtpSettings:"Configuração SMTP",smtpHost:"Servidor SMTP",smtpPort:"Porta SMTP",security:"Segurança",authentication:"Autenticação",username:"Nome de Usuário",password:"Senha",fromEmail:"Email de Remetente",fromName:"Nome de Remetente",testConnection:"Testar Conexão SMTP",testRecipient:"Email de Teste",sendTest:"Enviar Email de Teste",sending:"Enviando...",save:"Salvar Configurações",saving:"Salvando...",advancedAuth:"Autenticação Avançada",advancedAuthEnabled:"Autenticação Avançada está habilitada",advancedAuthEnabledDesc:"Recursos de gerenciamento de usuários baseados em email estão ativos. Novos usuários receberão senhas geradas automaticamente por email, e os usuários podem redefinir suas senhas através do recurso de esqueci minha senha.",advancedAuthDisabled:"Autenticação Avançada está desabilitada",advancedAuthDisabledDesc:"Habilite a autenticação avançada para ativar recursos baseados em email para gerenciamento de usuários.",enable:"Habilitar",disable:"Desabilitar",feature1:"Senhas são geradas automaticamente e enviadas por email para novos usuários",feature2:"Usuários podem fazer login com nome de usuário ou email",feature3:"Recurso de esqueci minha senha está disponível",feature4:"Administradores podem redefinir senhas de usuários via email",errors:{requiredFields:"Por favor, preencha todos os campos obrigatórios",usernameRequired:"Nome de usuário é obrigatório quando a autenticação está habilitada",enterTestEmail:"Por favor, insira um endereço de email de teste",smtpServerAndEmail:"Por favor, preencha o servidor SMTP e o email de remetente antes de testar",usernamePasswordRequired:"Nome de usuário e senha são obrigatórios quando a autenticação está habilitada",configureSmtpFirst:"Por favor, configure e teste as configurações SMTP primeiro"},success:{settingsSaved:"Configurações SMTP salvas com sucesso"},securityOptions:{starttls:"STARTTLS (Porta 587)",ssl:"SSL/TLS (Porta 465)",none:"Nenhuma (Porta 25)"},authOptions:{enabled:"Habilitado",disabled:"Desabilitado"}},appearance:"Aparência",notifications:"Notificações",smartPlugs:"Tomadas Inteligentes",spoolman:"Spoolman",updates:"Atualizações",language:"Idioma",languageDescription:"Selecione seu idioma preferido",theme:"Tema",themeLight:"Claro",themeDark:"Escuro",themeSystem:"Sistema",defaultView:"Visualização Padrão",defaultViewDescription:"Página a ser exibida ao abrir o aplicativo",checkForUpdates:"Verificar Atualizações",autoUpdate:"Atualização Automática",currentVersion:"Versão Atual",latestVersion:"Última Versão",upToDate:"Você está atualizado",updateAvailable:"Atualização disponível",notificationLanguage:"Idioma das Notificações",notificationLanguageDescription:"Idioma para notificações push",bedCooledThreshold:"Limite de Resfriamento da Cama",bedCooledThresholdDescription:"Temperatura abaixo da qual a cama é considerada resfriada após uma impressão",notificationProviders:"Provedores de Notificação",addProvider:"Adicionar Provedor",editProvider:"Editar Provedor",providerType:"Tipo de Provedor",testNotification:"Testar Notificação",testSuccess:"Notificação de teste enviada com sucesso",testFailed:"Falha ao enviar notificação de teste",quietHours:"Horas de Silêncio",quietHoursDescription:"Não perturbe durante essas horas",quietHoursStart:"Início",quietHoursEnd:"Fim",events:{title:"Eventos de Notificação",printStart:"Impressão Iniciada",printComplete:"Impressão Concluída",printFailed:"Falha na Impressão",printStopped:"Impressão Interrompida",printProgress:"Marcos de Progresso",printProgressDescription:"Notificar em 25%, 50%, 75%",printerOffline:"Impressora Offline",printerError:"Erro na Impressora",filamentLow:"Filamento Baixo",maintenanceDue:"Manutenção Pendente",maintenanceDueDescription:"Notificar quando a manutenção for necessária"},smartPlug:{title:"Tomadas Inteligentes",add:"Adicionar Tomada Inteligente",edit:"Editar Tomada Inteligente",name:"Nome",ipAddress:"Endereço IP",linkedPrinter:"Impressora Vinculada",autoOn:"Ligar Automaticamente",autoOnDescription:"Ligar quando a impressão começar",autoOff:"Desligar Automaticamente",autoOffDescription:"Desligar após a conclusão da impressão",offDelay:"Atraso para Desligar",offDelayMinutes:"Minutos após a impressão",offDelayTemp:"Quando o bico estiver abaixo da temperatura",currentState:"Estado Atual",turnOn:"Ligar",turnOff:"Desligar"},filamentTracking:"Rastreamento de Filamento",filamentTrackingDesc:"Escolha como rastrear seus rolos de filamento. Você pode usar o inventário interno ou conectar a um servidor Spoolman externo.",trackingModeBuiltIn:"Inventário Interno",trackingModeBuiltInDesc:"Correspondência automática de RFID e rastreamento de uso incluídos",trackingModeSpoolmanDesc:"Servidor de gerenciamento de filamento externo",builtInFeatureRfid:"Detecta automaticamente rolos RFID da Bambu Lab no AMS",builtInFeatureUsage:"Rastreia o consumo de filamento por impressão",builtInFeatureCatalog:"Gerencia rolos, cores e perfis de fator K",builtInFeatureThirdParty:"Rolos de terceiros podem ser atribuídos aos rolos do inventário",amsSyncButton:"Sincronizar Pesos do AMS",amsSyncTitle:"Sincronizar Pesos dos Rolos do AMS",amsSyncMessage:"Isso substituirá todos os pesos dos rolos do inventário pelos valores atuais de % restante do AMS das impressoras conectadas. Use isso para recuperar dados de peso corrompidos. As impressoras devem estar online.",amsSyncing:"Sincronizando...",amsSyncSuccess:"{{synced}} rolo(s) sincronizado(s), {{skipped}} ignorado(s)",amsSyncError:"Falha ao sincronizar pesos do AMS",spoolmanUrl:"Spoolman URL",spoolmanUrlHint:"URL do seu servidor Spoolman (por exemplo, http://localhost:7912)",spoolmanConnected:"Conectado",spoolmanDisconnected:"Desconectado",status:"Status",connect:"Conectar",disconnect:"Desconectar",howSyncWorks:"Como a Sincronização Funciona",syncInfoRfidOnly:"Apenas rolos oficiais da Bambu Lab com RFID são sincronizados",syncInfoAutoCreate:"Novos rolos são criados automaticamente no Spoolman na primeira sincronização",syncInfoThirdPartySkipped:"Rolos não oficiais da Bambu Lab (terceiros, reabastecidos) são ignorados",linkingExistingSpools:"Vinculando Rolos Existentes",linkingExistingSpoolsDesc:'Para vincular rolos existentes do Spoolman ao seu AMS, passe o mouse sobre um slot do AMS e clique em "Vincular ao Spoolman".',syncMode:"Modo de Sincronização",syncModeAuto:"Automático",syncModeManual:"Apenas Manual",syncModeAutoDesc:"Os dados do AMS são sincronizados automaticamente quando alterações são detectadas",syncModeManualDesc:"Somente sincronize quando acionado manualmente",syncAmsData:"Sincronizar Dados do AMS",syncAmsDataDesc:"Sincronize manualmente os dados do AMS da impressora com o Spoolman",allPrinters:"Todas as Impressoras",noDefaultPrinter:"Sem padrão (perguntar a cada vez)",sidebarOrder:"Ordem da barra lateral",saveThumbnails:"Salvar miniaturas",captureFinishPhoto:"Capturar foto de conclusão",noPrintersConfigured:"Nenhuma impressora configurada",archiveMode:{always:"Sempre criar entrada de arquivo",never:"Nunca criar entrada de arquivo",ask:"Perguntar a cada vez"},checkForUpdatesLabel:"Verificar atualizações",checkPrinterFirmware:"Verificar firmware da impressora",includeBetaUpdates:"Incluir versões beta",includeBetaUpdatesDesc:"Notificar sobre versões beta e pré-lançamento ao verificar atualizações",enableRetry:"Habilitar tentativa",homeAssistantDescription:"Controlar tomadas inteligentes via Home Assistant",environmentManagedLabel:"(Gerenciado pelo Ambiente)",autoEnabledViaEnv:"Habilitado automaticamente via variáveis de ambiente",urlFromEnvReadOnly:"Valor definido pela variável de ambiente HA_URL (somente leitura)",tokenFromEnvReadOnly:"Valor definido pela variável de ambiente HA_TOKEN (somente leitura)",mqttConnectedTo:"Conectado a",prometheusDescription:"Expor dados da impressora no formato Prometheus",noSmartPlugsTitle:"Nenhuma tomada inteligente configurada",noSmartPlugsDescription:"Adicione uma tomada inteligente baseada em Tasmota para monitorar o consumo de energia e automatizar o controle de energia.",noProvidersTitle:"Nenhum provedor configurado",noProvidersDescription:"Adicione um provedor para receber alertas.",noTemplatesAvailable:"Nenhum modelo disponível. Reinicie o backend para gerar os modelos padrão.",apiPermissionView:"Visualizar status da impressora e fila",apiPermissionEdit:"Adicionar e remover itens da fila de impressão",apiKeysEmptyTitle:"Nenhuma chave API",apiKeysEmptyDescription:"Crie uma chave API para integrar com serviços externos.",noUsersFound:"Nenhum usuário encontrado",noGroupsFound:"Nenhum grupo encontrado",noGroupsAvailable:"Nenhum grupo disponível",passwordsDoNotMatch:"As senhas não coincidem",systemGroupWarning:"Os nomes dos grupos do sistema não podem ser alterados",authDisabledTitle:"Autenticação Desativada",authDisabledFeature1:"Exigir login para acessar o sistema",authDisabledFeature2:"Criar múltiplos usuários com permissões baseadas em grupos",authDisabledFeature3:"Controlar acesso com mais de 50 permissões granulares",userHasCreated:"Este usuário criou:",userItemsQuestion:"O que você gostaria de fazer com esses itens?",deleteUserConfirm:"Tem certeza de que deseja excluir este usuário?",actionCannotBeUndone:"Esta ação não pode ser desfeita.",addFirstSmartPlug:"Adicione sua primeira tomada inteligente",providers:"Provedores",log:"Registro",testAll:"Testar tudo",testResults:"Resultados do teste",testPassedCount:"{{count}} aprovado",testFailedCount:"{{count}} falhou",messageTemplates:"Modelos de mensagem",messageTemplatesDescription:"Personalize as mensagens de notificação para cada evento.",apiKeys:"Chaves API",apiKeysDescription:"Crie chaves API para integrações externas e webhooks.",createKey:"Criar Chave",apiKeyCreated:"Chave API criada com sucesso",apiKeyCopyWarning:"Copie esta chave agora - ela não será exibida novamente!",useInApiBrowser:"Usar no Navegador API",createNewApiKey:"Criar Nova Chave API",keyName:"Nome da Chave",keyNamePlaceholder:"e.g., Home Assistant, OctoPrint",readStatus:"Status de Leitura",readStatusDescription:"Visualizar status da impressora e fila",manageQueue:"Gerenciar Fila",manageQueueDescription:"Adicionar e remover itens da fila de impressão",controlPrinter:"Controlar Impressora",controlPrinterDescription:"Pausar, retomar e parar impressões",unnamedKey:"Chave Sem Nome",lastUsed:"Último uso",read:"Ler",control:"Controlar",createFirstKey:"Crie sua primeira chave",webhookEndpoints:"Endpoints de Webhook",webhookApiKeyHint:"Use sua chave API no cabeçalho X-API-Key.",webhook:{getAllStatus:"Obter status de todas as impressoras",getSpecificStatus:"Obter status de uma impressora específica",addToQueue:"Adicionar à fila de impressão",pausePrint:"Pausar impressão",resumePrint:"Retomar impressão",stopPrint:"Parar impressão"},apiBrowser:"Navegador API",apiBrowserDescription:"Explore e teste todos os endpoints de API disponíveis.",apiKeyForTesting:"Chave API para Teste",apiKeyPlaceholder:"Cole sua chave API aqui para testar endpoints autenticados...",apiKeyHint:"Esta chave será enviada como cabeçalho X-API-Key nas solicitações.",deleteApiKeyTitle:"Excluir Chave API",deleteApiKeyMessage:"Tem certeza de que deseja excluir esta chave API? Quaisquer integrações usando esta chave deixarão de funcionar.",deleteKey:"Excluir Chave",amsDisplayThresholds:"Limiares de Exibição AMS",amsThresholdsDescription:"Configure os limiares de cores para os indicadores de umidade e temperatura do AMS.",humidity:"Umidade",goodGreen:"Bom (verde)",fairOrange:"Razoável (laranja)",aboveFairBad:"Acima do limiar razoável mostra como vermelho (ruim)",temperature:"Temperatura",goodBlue:"Bom (azul)",aboveFairHot:"Acima do limiar razoável mostra como vermelho (quente)",historyRetention:"Retenção de Histórico",keepSensorHistory:"Manter histórico do sensor por",historyRetentionDescription:"Dados antigos de umidade e temperatura serão automaticamente excluídos",printModal:"Modal de Impressão",expandCustomMapping:"Expandir mapeamento personalizado por padrão",expandCustomMappingDescription:"Ao imprimir em várias impressoras, mostrar o mapeamento AMS por impressora expandido",authentication:"Autenticação",authEnabledDescription:"Sua instância está protegida com autenticação de usuário",authDisabledDescription:"Ative para exigir login e gerenciar o acesso dos usuários",authDisabledMessage:"Ative a autenticação para criar contas de usuário, gerenciar permissões e proteger sua instância do Bambuddy.",enableAuthentication:"Ativar Autenticação",currentUser:"Usuário Atual",changePassword:"Alterar Senha",admin:"Administrador",users:"Usuários",addUser:"Adicionar Usuário",groups:"Grupos",addGroup:"Adicionar Grupo",system:"Sistema",noDescription:"Sem descrição",userCount:"{{count}} usuários",permissionCount:"{{count}} permissões",createUser:"Criar Usuário",username:"Nome de Usuário",enterUsername:"Digite o nome de usuário",password:"Senha",enterPassword:"Digite a senha (mínimo 6 caracteres)",confirmPassword:"Confirmar Senha",confirmPasswordPlaceholder:"Confirme a senha",viewReleaseOnGitHub:"Ver lançamento no GitHub",turnAllPlugsOn:"Ligar todas as tomadas",turnAllPlugsOff:"Desligar todas as tomadas",clearNotificationLogs:"Limpar Logs de Notificação",clearLogsMessage:"Isso excluirá permanentemente todos os logs de notificação com mais de 30 dias. Esta ação não pode ser desfeita.",clearLogs:"Limpar Logs",resetUiPreferences:"Redefinir Preferências de UI",resetUiPreferencesMessage:"Isso redefinirá todas as preferências de UI para os padrões: ordem da barra lateral, tema, layout do painel, modos de exibição e preferências de classificação. Suas impressoras, arquivos e configurações do servidor NÃO serão afetados. A página será recarregada após a limpeza.",resetPreferences:"Redefinir Preferências",deleteGroupTitle:"Excluir Grupo",deleteGroupMessage:"Tem certeza de que deseja excluir este grupo? Usuários neste grupo perderão essas permissões.",deleteGroup:"Excluir Grupo",disableAuthenticationTitle:"Desativar Autenticação",disableAuthenticationMessage:"Tem certeza de que deseja desativar a autenticação? Isso tornará sua instância do Bambuddy acessível sem login. Todos os usuários permanecerão no banco de dados, mas a autenticação será desativada.",disableAuthentication:"Desativar Autenticação",configureBambuddy:"Configurar Bambuddy",systemDefault:"Padrão do Sistema",archiveSettings:"Configurações de Arquivo",newWindow:"Nova Janela",embeddedOverlay:"Sobreposição Incorporada",preferredSlicer:"Fatiador Preferido",preferredSlicerDescription:"Escolha qual aplicativo de fatiamento abrirá os arquivos",externalCameras:"Câmeras Externas",costTracking:"Rastreamento de Custos",printsOnly:"Apenas Impressões",totalConsumption:"Consumo Total",dataManagement:"Gerenciamento de Dados",storageUsage:"Uso de Armazenamento",storageUsageDescription:"Detalhamento do uso de dados por categoria",storageUsageTotal:"Total",storageUsageErrors:"Erros",storageUsageOtherBreakdown:"Outros (inclui ativos estáticos, scripts e arquivos de configuração)",storageUsageSystem:"Sistema",storageUsageData:"Dados",storageUsageUnavailable:"Informações de uso de armazenamento indisponíveis",clearNotificationLogsDescription:"Excluir logs de notificação com mais de 30 dias",resetUiPreferencesDescription:"Redefinir ordem da barra lateral, tema, modos de exibição e preferências de layout. Impressoras, arquivos e configurações não são afetados.",enableHomeAssistant:"Ativar Home Assistant",enableMqtt:"Ativar MQTT",useTls:"Usar TLS",enableMetricsEndpoint:"Ativar Endpoint de Métricas",availableMetrics:"Métricas Disponíveis",editUser:"Editar Usuário",deleteUserTitle:"Excluir Usuário",groupName:"Nome do Grupo",leaveEmptyForAnonymous:"Deixe vazio para anônimo",leaveEmptyForNoAuth:"Deixe vazio para sem autenticação",enterNewPassword:"Digite a nova senha",confirmNewPassword:"Confirme a nova senha",enterGroupName:"Digite o nome do grupo",enterDescriptionOptional:"Digite a descrição (opcional)",enterCurrentPassword:"Digite a senha atual",enterNewPasswordMin6:"Digite a nova senha (mínimo 6 caracteres)",toast:{keyCopied:"Chave copiada para a área de transferência",copyFailed:"Falha ao copiar a chave",keyAddedToBrowser:"Chave adicionada ao Navegador de API",clearLogsFailed:"Falha ao limpar logs",uiPreferencesReset:"Preferências de UI redefinidas. Atualizando...",authDisabled:"Autenticação desativada com sucesso",authDisableFailed:"Falha ao desativar a autenticação",apiKeyCreated:"Chave de API criada",apiKeyDeleted:"Chave de API excluída",userCreated:"Usuário criado com sucesso",userUpdated:"Usuário atualizado com sucesso",userDeleted:"Usuário excluído com sucesso",groupCreated:"Grupo criado com sucesso",groupUpdated:"Grupo atualizado com sucesso",groupDeleted:"Grupo excluído com sucesso",fillRequiredFields:"Por favor, preencha todos os campos obrigatórios",passwordsDoNotMatch:"As senhas não coincidem",passwordTooShort:"A senha deve ter pelo menos 6 caracteres",enterGroupName:"Por favor, insira um nome de grupo",settingsSaved:"Configurações salvas",cameraSettingsSaved:"Configurações da câmera salvas",enterCameraUrl:"Por favor, insira a URL da câmera",passwordChanged:"Senha alterada com sucesso",connectionFailed:"Falha na conexão",testFailed:"Falha no teste",cameraConnected:"Câmera conectada{{resolution}}"},testConnection:"Testar Conexão",catalog:{spoolCatalog:"Catálogo de Carretéis",spoolCatalogDescription:"Pesos de carretéis vazios por marca/tipo. Usado para pesquisa automática de peso ao adicionar carretéis.",searchCatalog:"Pesquisar no catálogo...",addNewEntry:"Adicionar Nova Entrada",namePlaceholder:"Nome (ex.: Bambu Lab - Plástico)",weight:"Peso",type:"Tipo",default:"Padrão",custom:"Personalizado",noMatch:"Nenhuma entrada corresponde à sua pesquisa",empty:"Nenhuma entrada no catálogo",deleteEntry:"Excluir Entrada",deleteConfirm:'Tem certeza de que deseja excluir "{{name}}"?',resetCatalog:"Redefinir Catálogo",resetConfirm:"Redefinir catálogo para os padrões? Isso removerá todas as entradas personalizadas.",loadFailed:"Falha ao carregar o catálogo de carretéis",nameWeightRequired:"Nome e peso são obrigatórios",entryAdded:"Entrada adicionada",addFailed:"Falha ao adicionar entrada",entryUpdated:"Entrada atualizada",updateFailed:"Falha ao atualizar entrada",entryDeleted:"Entrada excluída",deleteFailed:"Falha ao excluir entrada",resetSuccess:"Catálogo redefinido para os padrões",resetFailed:"Falha ao redefinir catálogo",exported:"Exportadas {{count}} entradas",imported:"Importadas {{added}} entradas ({{skipped}} ignoradas)",importFailed:"Falha ao importar: formato JSON inválido",exportTooltip:"Exportar catálogo para JSON",importTooltip:"Importar catálogo de JSON",resetTooltip:"Redefinir para os padrões",selectedCount:"{{count}} selecionados",deleteSelected:"Excluir Selecionados",bulkDeleteConfirm:"Tem certeza de que deseja excluir {{count}} entradas?",bulkDeleted:"{{count}} entradas excluídas",bulkDeleteFailed:"Falha ao excluir entradas"},colorCatalog:{title:"Catálogo de Cores",description:"Cores de filamento por fabricante/material. Usado para pesquisa automática de cores ao adicionar carretéis.",searchColors:"Pesquisar cores...",allManufacturers:"Todos os fabricantes",addNewColor:"Adicionar Nova Cor",manufacturer:"Fabricante",colorName:"Nome da Cor",hex:"Hex",materialOptional:"Material (opcional)",showing:"Mostrando {{filtered}} de {{total}} cores",noMatch:"Nenhuma cor corresponde à sua pesquisa",empty:"Nenhuma cor no catálogo",deleteColor:"Excluir Cor",deleteConfirm:'Tem certeza de que deseja excluir "{{name}}"?',resetCatalog:"Redefinir Catálogo de Cores",resetConfirm:"Redefinir catálogo para os padrões? Isso removerá todas as cores personalizadas.",sync:"Sincronizar",starting:"Iniciando...",syncTooltip:"Sincronizar do FilamentColors.xyz (2000+ cores, pode levar um minuto)",loadFailed:"Falha ao carregar o catálogo de cores",fieldsRequired:"Fabricante, nome da cor e cor hex são obrigatórios",colorAdded:"Cor adicionada",addFailed:"Falha ao adicionar cor",colorUpdated:"Cor atualizada",updateFailed:"Falha ao atualizar cor",colorDeleted:"Cor excluída",deleteFailed:"Falha ao excluir cor",resetSuccess:"Catálogo de cores redefinido para os padrões",resetFailed:"Falha ao redefinir catálogo",syncUpToDate:"Já está atualizado ({{count}} cores verificadas)",syncComplete:"Adicionadas {{added}} novas cores ({{skipped}} já existiam)",syncError:"Erro de sincronização",syncFailed:"Falha ao sincronizar do FilamentColors.xyz",exported:"Exportadas {{count}} cores",imported:"Importadas {{added}} cores ({{skipped}} ignoradas)",importFailed:"Falha ao importar: formato JSON inválido",selectedCount:"{{count}} selecionados",deleteSelected:"Excluir Selecionados",bulkDeleteConfirm:"Tem certeza de que deseja excluir {{count}} cores?",bulkDeleted:"{{count}} cores excluídas",bulkDeleteFailed:"Falha ao excluir cores"},dateFormat:"Formato de data",dateFormatUs:"US (MM/DD/AAAA)",dateFormatEu:"EU (DD/MM/AAAA)",dateFormatIso:"ISO (AAAA-MM-DD)",timeFormat:"Formato de hora",timeFormat12:"12 horas (3:30 PM)",timeFormat24:"24 horas (15:30)",defaultPrinter:"Impressora padrão",defaultPrinterDescription:"Pré-selecionar esta impressora para uploads, reimpressões e outras operações.",slicerBambuStudio:"Bambu Studio",slicerOrcaSlicer:"OrcaSlicer",sidebarOrderDescription:"Arraste itens na barra lateral para reordenar. Restaurar ordem padrão aqui.",reset:"Redefinir",darkMode:"Modo escuro",lightMode:"Modo claro",active:"(ativo)",background:"Fundo",accent:"Destaque",style:"Estilo",bgNeutral:"Neutro",bgWarm:"Quente",bgCool:"Frio",bgOled:"OLED Preto",bgSlate:"Azul ardósia",bgForest:"Verde floresta",accentGreen:"Verde",accentTeal:"Azul-petróleo",accentBlue:"Azul",accentOrange:"Laranja",accentPurple:"Roxo",accentRed:"Vermelho",styleClassic:"Clássico",styleGlow:"Brilhante",styleVibrant:"Vibrante",themeToggleHint:"Alternar entre modo escuro e claro usando o ícone de sol/lua na barra lateral.",autoArchivePrints:"Arquivar impressões automaticamente",autoArchiveDescription:"Salvar automaticamente arquivos 3MF quando impressões forem concluídas",saveThumbnailsDescription:"Extrair e salvar imagens de pré-visualização dos arquivos 3MF",captureFinishPhotoDescription:"Tirar foto da câmera da impressora quando a impressão for concluída",ffmpegNotInstalled:"ffmpeg não instalado",ffmpegRequired:"A captura de câmera requer ffmpeg. Instale via <brew>brew install ffmpeg</brew> (macOS) ou <apt>apt install ffmpeg</apt> (Linux).",camera:"Câmera",cameraViewMode:"Modo de visualização da câmera",cameraOverlayDescription:"A câmera abre em uma sobreposição redimensionável na tela principal",cameraWindowDescription:"A câmera abre em uma janela separada do navegador",externalCamerasDescription:"Configure câmeras externas para substituir a câmera integrada da impressora. Suporta streams MJPEG, RTSP, snapshots HTTP e câmeras USB (V4L2). Quando habilitada, a câmera externa é usada para visualização ao vivo e fotos de conclusão.",cameraPlaceholderUsb:"Caminho do dispositivo (/dev/video0)",cameraPlaceholderUrl:"URL da câmera (rtsp://... ou http://...)",cameraTypeMjpeg:"Stream MJPEG",cameraTypeRtsp:"Stream RTSP",cameraTypeSnapshot:"Snapshot HTTP",cameraTypeUsb:"Câmera USB (V4L2)",test:"Testar",connected:"Conectado",disconnected:"Desconectado",currency:"Moeda",defaultFilamentCost:"Custo padrão do filamento (por kg)",electricityCost:"Custo da eletricidade por kWh",energyDisplayMode:"Modo de exibição de energia",energyModePrintDescription:"O painel mostra a soma da energia usada durante as impressões",energyModeTotalDescription:"O painel mostra a energia total dos plugues inteligentes",fileManager:"Gerenciador de arquivos",createArchiveEntry:"Criar entrada de arquivo ao imprimir",createArchiveEntryDescription:"Ao imprimir pelo gerenciador de arquivos, criar opcionalmente uma entrada de arquivo",lowDiskSpaceWarning:"Aviso de pouco espaço em disco",lowDiskSpaceDescription:"Mostrar aviso quando o espaço livre em disco ficar abaixo deste limite",printerFirmware:"Firmware da impressora",checkFirmwareDescription:"Verificar atualizações de firmware da Bambu Lab",bambuddySoftware:"Software Bambuddy",autoCheckDescription:"Verificar automaticamente novas versões ao iniciar",checkNow:"Verificar agora",updateAvailableVersion:"Atualização disponível: v{{version}}",releaseNotes:"Notas da versão",updateViaDocker:"Atualizar via Docker Compose:",installUpdate:"Instalar atualização",latestVersionRunning:"Você está usando a versão mais recente",failedToCheckUpdates:"Falha ao verificar atualizações: {{error}}",backupRestore:"Backup e Restauração",backupRestoreDescription:"Exportar/importar configurações e configurar backup do GitHub",goToBackup:"Ir para backup",externalUrl:"URL externa",externalUrlDescription:"A URL externa onde o Bambuddy está acessível. Usada para imagens de notificação e integrações externas.",bambuddyUrl:"URL do Bambuddy",externalUrlHint:"Inclua protocolo e porta (ex: http://192.168.1.100:8000)",ftpRetry:"Tentativa FTP",ftpRetryDescription:"Tentar novamente operações FTP quando o WiFi da impressora é instável. Aplica-se a downloads 3MF, uploads de impressão, downloads de timelapse e atualizações de firmware.",autoRetryDescription:"Tentar novamente automaticamente operações FTP que falharam",retryAttempts:"Tentativas de reenvio",retryDelay:"Atraso entre tentativas",connectionTimeout:"Tempo limite de conexão",time_one:"{{count}} vez",time_other:"{{count}} vezes",second_one:"{{count}} segundo",second_other:"{{count}} segundos",nSeconds:"{{count}} segundos",increaseForWeakWifi:"Aumente para impressoras com WiFi fraco",homeAssistant:"Home Assistant",homeAssistantFullDescription:"Conecte ao Home Assistant para controlar plugues inteligentes via API REST do HA. Suporta entidades switch, light, input_boolean e script.",homeAssistantUrl:"URL do Home Assistant",longLivedAccessToken:"Token de acesso de longa duração",haTokenHint:"Crie um token no HA: Perfil → Tokens de acesso de longa duração → Criar token",connectionSuccessful:"Conexão bem-sucedida",connectionFailed:"Falha na conexão",haConnectionSuccess:"Conectado com sucesso ao Home Assistant.",haConnectionFailed:"Falha ao conectar ao Home Assistant.",mqttPublishing:"Publicação MQTT",mqttDescription:"Publique eventos do BamBuddy para um broker MQTT externo para integração com Node-RED, Home Assistant e outros sistemas de automação.",mqttEnableDescription:"Publicar eventos no broker MQTT externo",brokerHostname:"Hostname do broker",port:"Porta",usernameOptional:"Usuário (opcional)",passwordOptional:"Senha (opcional)",topicPrefix:"Prefixo do tópico",topicPrefixHint:"Os tópicos serão: {{prefix}}/printers/<serial>/status, etc.",prometheusMetrics:"Métricas Prometheus",prometheusEndpointDescription:"Expor métricas da impressora em <code>/api/v1/metrics</code> para monitoramento Prometheus/Grafana.",bearerTokenOptional:"Token Bearer (opcional)",bearerTokenHint:"Se definido, as requisições devem incluir <code>Authorization: Bearer <token></code>",metricsConnectionStatus:"Status da conexão",metricsPrinterState:"Estado da impressora (idle/printing/etc)",metricsPrintProgress:"Progresso da impressão 0-100%",metricsBedTemp:"Temperatura da mesa",metricsNozzleTemp:"Temperatura do bico",metricsPrintsTotal:"Total de impressões por resultado",metricsMore:"...e mais (camadas, ventoinhas, fila, uso de filamento)",smartPlugsDescription:"Conecte plugues inteligentes (Tasmota ou Home Assistant) para automatizar o controle de energia e rastrear o consumo energético das suas impressoras.",allOn:"Ligar todos",allOff:"Desligar todos",addSmartPlug:"Adicionar plugue inteligente",energySummary:"Resumo de energia",currentPower:"Potência atual",plugsOnline:"{{reachable}}/{{total}} plugues online",today:"Hoje",yesterday:"Ontem",total:"Total",enablePlugsForSummary:"Habilite os plugues para ver o resumo de energia",addNotificationProvider:"Adicionar",systemBadge:"(Sistema)",creating:"Criando...",changing:"Alterando...",deleteUserAndItems:"Excluir usuário E seus itens",deleteUserKeepItems:"Excluir usuário, manter itens (ficarão sem dono)",ok:"OK"},notification:{printStarted:{title:"Impressão Iniciada",body:"{{printer}}: {{filename}} iniciou a impressão"},printCompleted:{title:"Impressão Concluída",body:"{{printer}}: {{filename}} foi concluída com sucesso"},printFailed:{title:"Falha na Impressão",body:"{{printer}}: {{filename}} falhou"},printStopped:{title:"Impressão Interrompida",body:"{{printer}}: {{filename}} foi interrompida"},printProgress:{title:"Progresso da Impressão",body:"{{printer}}: {{filename}} está {{percent}}% concluída"},printerOffline:{title:"Impressora Offline",body:"{{printer}} está offline"},printerError:{title:"Erro na Impressora",body:"{{printer}}: {{error}}"},filamentLow:{title:"Filamento Baixo",body:"{{printer}}: O filamento está acabando"},maintenanceDue:{title:"Manutenção Pendente",body:"{{printer}}: {{items}} precisam de atenção"}},errors:{generic:"Algo deu errado",networkError:"Erro de rede. Por favor, verifique sua conexão.",notFound:"Não encontrado",unauthorized:"Não autorizado",serverError:"Erro no servidor",validationError:"Por favor, verifique sua entrada",printerConnectionFailed:"Falha ao conectar à impressora",saveFailed:"Falha ao salvar alterações",deleteFailed:"Falha ao excluir",loadFailed:"Falha ao carregar dados"},hmsErrors:{title:"Erros - {{name}}",noErrors:"Nenhum erro",viewOnWiki:"Ver no Bambu Lab Wiki",clearInstructions:"Limpe os erros na impressora para descartá-los aqui.",clearErrors:"Limpar Erros",clearSuccess:"Erros HMS limpos",clearFailed:"Falha ao limpar erros HMS"},mqttDebug:{title:"MQTT Log de Depuração",searchPlaceholder:"Pesquisar tópico ou payload...",noMessages:"Nenhuma mensagem registrada ainda",startLoggingHint:'Clique em "Iniciar Registro" para começar a capturar mensagens MQTT',noMessagesMatch:"Nenhuma mensagem corresponde ao seu filtro",adjustFilterHint:"Tente ajustar seus critérios de pesquisa ou filtro",incoming:"Entrada",outgoing:"Saída",loggingStopped:"Registro interrompido",loggingActive:"Registro ativo - as mensagens serão atualizadas automaticamente",startLogging:"Iniciar Registro",stopLogging:"Parar Registro",clearLog:"Limpar Registro",topic:"ópico",timestamp:"Carimbo de Data/Hora",direction:"Direção",all:"Todos"},printerFiles:{title:"Gerenciador de Arquivos",storageUsed:"Usado:",storageFree:"Livre:",filterPlaceholder:"Filtrar arquivos...",deleteButton:"Excluir",deleteFiles:"Excluir {{count}} arquivos",deleteFileConfirm:'Excluir "{{name}}"? Isso não pode ser desfeito.',deleteFilesConfirm:"Excluir {{count}} arquivos selecionados? Isso não pode ser desfeito.",noFiles:"Nenhum arquivo na impressora",loadingFiles:"Carregando arquivos...",failedToLoad:"Falha ao carregar arquivos",toast:{filesDeleted:"Arquivos excluídos: {{count}}",deleteFailed:"Falha ao excluir: {{error}}"}},confirm:{delete:"Tem certeza de que deseja excluir isso?",unsavedChanges:"Você tem alterações não salvas. Tem certeza de que deseja sair?",clearQueue:"Tem certeza de que deseja limpar a fila?"},login:{title:"Bambuddy Login",subtitle:"Faça login na sua conta",username:"Nome de usuário",usernamePlaceholder:"Digite seu nome de usuário",usernameOrEmail:"Nome de usuário ou Email",usernameOrEmailPlaceholder:"Nome de usuário ou Email",password:"Senha",passwordPlaceholder:"Digite sua senha",signIn:"Entrar",signingIn:"Entrando...",forgotPassword:"Esqueceu sua senha?",loginSuccess:"Login realizado com sucesso",loginFailed:"Falha no login",enterCredentials:"Por favor, insira nome de usuário e senha",forgotPasswordTitle:"Esqueceu a Senha",forgotPasswordMessage:"Se você esqueceu sua senha, entre em contato com o administrador do sistema para redefini-la.",forgotPasswordEmailMessage:"Digite seu endereço de email e enviaremos uma nova senha.",emailAddress:"Endereço de Email",emailPlaceholder:"seu.email@exemplo.com",cancel:"Cancelar",sending:"Enviando...",sendResetEmail:"Enviar Email de Redefinição",howToReset:"Como redefinir sua senha:",resetStep1:"Entre em contato com o administrador do Bambuddy",resetStep2:"Peça para redefinir sua senha na Gestão de Usuários",resetStep3:"Eles podem definir uma nova senha temporária para você",resetStep4:"Faça login com a nova senha e altere-a nas Configurações",gotIt:"Entendi"},setup:{title:"Bambuddy Configuração",subtitle:"Configure a autenticação para sua instância do Bambuddy",enableAuth:"Ativar Autenticação",adminAccount:"Conta de Administrador",adminAccountDesc:"Se usuários administradores já existirem, a autenticação será ativada usando as contas de administrador existentes. Deixe os campos abaixo vazios para usar os administradores existentes ou insira novas credenciais para criar um novo usuário administrador.",adminUsername:"Nome de usuário do administrador",adminPassword:"Senha do administrador",optionalIfAdminExists:"(opcional se usuários administradores existirem)",adminUsernamePlaceholder:"Digite o nome de usuário do administrador (opcional)",adminPasswordPlaceholder:"Digite a senha do administrador (opcional)",confirmPassword:"Confirmar Senha",confirmPasswordPlaceholder:"Confirme a senha do administrador",settingUp:"Configurando...",completeSetup:"Concluir Configuração",toast:{authEnabledAdminCreated:"Autenticação ativada e usuário administrador criado",authEnabledExistingAdmins:"Autenticação ativada usando usuários administradores existentes",setupCompleted:"Configuração concluída",enterBothCredentials:"Por favor, insira o nome de usuário e a senha do administrador, ou deixe ambos vazios para usar os usuários administradores existentes",passwordsDoNotMatch:"As senhas não coincidem",passwordTooShort:"A senha deve ter pelo menos 6 caracteres"}},changePassword:{title:"Alterar Senha",currentPassword:"Senha Atual",currentPasswordPlaceholder:"Digite a senha atual",newPassword:"Nova Senha",newPasswordPlaceholder:"Digite a nova senha (mínimo 6 caracteres)",confirmPassword:"Confirmar Senha",confirmPasswordPlaceholder:"Confirme a nova senha",passwordsDoNotMatch:"As senhas não coincidem",passwordTooShort:"A senha deve ter pelo menos 6 caracteres",changing:"Alterando...",success:"Senha alterada com sucesso",failed:"Falha ao alterar a senha"},plateAlert:{title:"Impressão Pausada!",message:"Objetos detectados na mesa de impressão. A impressão foi automaticamente pausada. Por favor, limpe a mesa e retome a impressão.",understand:"Entendi"},camera:{title:"Visualização da Câmera",invalidPrinterId:"ID da impressora inválido",live:"Ao Vivo",snapshot:"Captura",restartStream:"Reiniciar transmissão",refreshSnapshot:"Atualizar captura",fullscreen:"Tela Cheia",exitFullscreen:"Sair da Tela Cheia",connectingToCamera:"Conectando à câmera...",capturingSnapshot:"Capturando imagem...",connectionLost:"Conexão perdida",connectionFailed:"Falha na conexão com a câmera",reconnecting:"Reconectando em {{countdown}}s... (tentativa {{attempt}}/{{max}})",reconnectNow:"Reconectar agora",cameraUnavailable:"Câmera indisponível",cameraUnavailableDesc:"Certifique-se de que a impressora está ligada e conectada.",noCamera:"Nenhuma câmera disponível",retry:"Tentar novamente",cameraStream:"Transmissão da câmera",zoomOut:"Reduzir zoom",zoomIn:"Aumentar zoom",resetZoom:"Redefinir zoom",recording:"Gravando",startRecording:"Iniciar gravação",stopRecording:"Parar gravação",chamberLight:"Alternar luz da câmara"},groups:{title:"Gerenciamento de Grupos",subtitle:"Gerenciar grupos de permissão para controle de acesso",backToSettings:"Voltar para Configurações",createGroup:"Criar Grupo",noPermission:"Você não tem permissão para acessar esta página.",system:"Sistema",noDescription:"Sem descrição",usersCount:"{{count}} usuários",permissionsCount:"{{count}} permissões",edit:"Editar",delete:"Excluir",toast:{created:"Grupo criado com sucesso",updated:"Grupo atualizado com sucesso",deleted:"Grupo excluído com sucesso",enterGroupName:"Por favor, insira um nome para o grupo"},modal:{editGroup:"Editar Grupo",createGroup:"Criar Grupo",cancel:"Cancelar",saving:"Salvando...",creating:"Criando...",saveChanges:"Salvar Alterações"},form:{groupName:"Nome do Grupo",groupNamePlaceholder:"Insira o nome do grupo",systemGroupWarning:"Os nomes dos grupos do sistema não podem ser alterados",description:"Descrição",descriptionPlaceholder:"Insira a descrição (opcional)",permissions:"Permissões ({{count}} selecionadas)"},deleteModal:{title:"Excluir Grupo",message:"Tem certeza de que deseja excluir este grupo? Os usuários deste grupo perderão essas permissões.",confirm:"Excluir Grupo"},editor:{title:"Editar Grupo",createTitle:"Criar Grupo",search:"Pesquisar permissões...",selectAll:"Selecionar Tudo",clearAll:"Limpar Tudo",permissionsSelected:"{{count}} selecionada(s)",noResults:"Nenhuma permissão corresponde à sua pesquisa"}},users:{title:"Gerenciamento de Usuários",subtitle:"Gerenciar usuários e seu acesso à sua instância do Bambuddy",backToSettings:"Voltar para Configurações",createUser:"Criar Usuário",noPermission:"Você não tem permissão para acessar esta página.",admin:"Admin",noGroups:"Sem grupos",active:"Ativo",inactive:"Inativo",edit:"Editar",delete:"Excluir",system:"Sistema",noGroupsAvailable:"Nenhum grupo disponível",table:{username:"Nome de Usuário",groups:"Grupos",status:"Status",actions:"Ações"},toast:{created:"Usuário criado com sucesso",updated:"Usuário atualizado com sucesso",deleted:"Usuário excluído com sucesso",fillRequired:"Por favor, preencha todos os campos obrigatórios",passwordsDoNotMatch:"As senhas não coincidem",passwordTooShort:"A senha deve ter pelo menos 6 caracteres"},modal:{createUser:"Criar Usuário",editUser:"Editar Usuário",cancel:"Cancelar",creating:"Criando...",saving:"Salvando...",saveChanges:"Salvar Alterações",advancedAuthSubtitle:"com Autenticação Avançada"},form:{username:"Nome de Usuário",usernamePlaceholder:"Insira o nome de usuário",email:"Email",emailPlaceholder:"user@example.com",password:"Senha",passwordPlaceholder:"Insira a senha",confirmPassword:"Confirmar Senha",confirmPasswordPlaceholder:"Confirme a senha",newPasswordPlaceholder:"Insira a nova senha",confirmNewPasswordPlaceholder:"Confirme a nova senha",leaveBlankToKeep:"deixe em branco para manter a atual",groups:"Grupos",optional:"opcional",autoGeneratedPassword:"Uma senha segura será gerada automaticamente e enviada por e-mail ao usuário.",passwordManagedByAdvancedAuth:'A senha é gerenciada pela Autenticação Avançada. Use "Redefinir Senha" para enviar uma nova senha ao usuário por e-mail.',resetPassword:"Redefinir Senha",resettingPassword:"Redefinindo Senha..."},deleteModal:{title:"Excluir Usuário",message:"Tem certeza de que deseja excluir este usuário? Esta ação não pode ser desfeita.",confirm:"Excluir Usuário"}},streamOverlay:{title:"Stream Overlay",invalidPrinterId:"ID da impressora inválido",cameraStream:"Transmissão da câmera",progress:"Progresso da impressão",eta:"ETA",printerIdle:"Impressora ociosa",printerOffline:"Impressora offline",status:{printing:"Imprimindo",paused:"Pausado",finished:"Concluído",failed:"Falhou",idle:"Ocioso",unknown:"Desconhecido"}},profiles:{title:"Perfis",subtitle:"Gerencie seus presets de fatiador e calibrações de avanço de pressão",tabs:{cloud:"Perfis na Nuvem",local:"Perfis Locais",kprofiles:"K-Perfis"},localProfiles:{title:"Perfis Locais",subtitle:"Importe e gerencie presets de fatiador do OrcaSlicer",import:"Importar Perfis",importDesc:"Solte arquivos .bbscfg, .bbsflmt, .orca_filament, .zip ou .json aqui",importing:"Importando...",search:"Pesquisar presets locais...",noPresets:"Nenhum preset local ainda",badge:"Local",edit:"Editar",delete:"Excluir",cancel:"Cancelar",deleteConfirmTitle:"Excluir Preset",deleteConfirm:"Tem certeza de que deseja excluir este preset? Esta ação não pode ser desfeita.",source:"Fonte",inheritsFrom:"Herdado de",filamentType:"Tipo",vendor:"Fornecedor",compatiblePrinters:"Impressoras Compatíveis",nozzleTemp:"Temperatura do Bico",cost:"Custo",density:"Densidade",pressureAdvance:"Avanço de Pressão",filament:"Filamento",process:"Processo",printer:"Impressora",toast:{importSuccess:"{{count}} preset(s) importada(s)",importSkipped:"{{count}} preset(s) ignorada(s) (duplicadas)",importError:"{{count}} erro(s) durante a importação",deleted:"Preset excluído",updated:"Preset atualizado"}},connectedAs:"Conectado como",logout:"Sair",noLogoutPermission:"Você não tem permissão para sair",failedToLoad:"Falha ao carregar perfis",retry:"Tentar novamente",time:{justNow:"Agora mesmo",minsAgo:"há {{count}} minutos",hoursAgo:"há {{count}} horas",daysAgo:"há {{count}} dias"},toast:{loggedOut:"Desconectado"},login:{title:"Conectar ao Bambu Cloud",subtitle:"Sincronize seus presets de fatiador entre dispositivos",email:"Email",password:"Senha",region:"Região",regionGlobal:"Global",regionChina:"China",verificationCode:"Código de Verificação",totpCode:"Código do Autenticador",checkEmail:"Verifique seu email ({{email}}) para um código de 6 dígitos",enterTotpHint:"Digite o código de 6 dígitos do seu aplicativo autenticador",accessToken:"Token de Acesso",accessTokenHint:"Cole seu token de acesso Bambu Lab (do Bambu Studio)",back:"Voltar",loginButton:"Entrar",verifyButton:"Verificar",setTokenButton:"Definir Token",useToken:"Usar token de acesso em vez disso",useEmail:"Entrar com email em vez disso",toast:{loggedIn:"Conectado com sucesso",codeSent:"Código de verificação enviado para seu email",enterTotp:"Digite o código do seu aplicativo autenticador",tokenSet:"Token definido com sucesso"}},presets:{myPreset:"Meu preset (editável)",duplicate:"Duplicar",editable:"Editável",failedToLoadDetails:"Falha ao carregar detalhes do preset",deleteConfirm:"Excluir este preset?",deleteWarning:'Isso excluirá permanentemente "{{name}}" do Bambu Cloud. Esta ação não pode ser desfeita.',noDuplicatePermission:"Você não tem permissão para duplicar presets",noEditPermission:"Você não tem permissão para editar presets",noDeletePermission:"Você não tem permissão para excluir presets",types:{filament:"Preset de filamento",printer:"Preset de impressora",process:"Preset de processo"},toast:{deleted:"Preset excluído",created:"Preset criado",updated:"Preset atualizado",duplicated:"Preset duplicado",fieldAdded:'Campo "{{key}}" adicionado',exported:"Preset exportado"},baseLabel:"Base: {{name}}",currentLabel:"Atual: {{name}}",newPreset:"Novo Preset",editPreset:"Editar Preset",duplicatePreset:"Duplicar Preset",createNewPreset:"Criar Novo Preset",customizeSettings:"Personalizar configurações para seu novo preset",compareWithBase:"Comparar com o preset base",compare:"Comparar",basePreset:"Preset Base",selectBasePreset:"Selecionar preset base...",presetName:"Nome do Preset",myCustomPreset:"Meu preset personalizado",inheritsFrom:"Herdado de",dropJsonToImport:"Solte o arquivo JSON para importar",tabs:{common:"Comum",allFields:"Todos os Campos"},availableFields:"Campos Disponíveis",searchFieldsPlaceholder:"Pesquisar campos...",noMatchingFields:"Nenhum campo correspondente",allFieldsAdded:"Todos os campos adicionados",addCustomField:"Adicionar campo personalizado",yourOverrides:"Suas Substituições",noOverridesYet:"Nenhuma substituição ainda",clickFieldsToAdd:"Clique nos campos à esquerda para adicioná-los",saveAsTemplate:"Salvar como modelo",jsonTip:"Dica: Arraste e solte um arquivo .json em qualquer lugar deste modal para importar configurações"},cloudView:{searchPlaceholder:"Pesquisar presets...",templates:"Modelos",refresh:"Atualizar",newPreset:"Novo Preset",clearFilters:"Limpar filtros",compareMode:"Modo de Comparação",selectAnotherPreset:"Selecionar outro preset {{type}}",clickTwoPresets:"Clique em dois presets do mesmo tipo para comparar",selectFirst:"1. Selecionar primeiro",selectSecond:"2. Selecionar segundo",compareNow:"Comparar Agora",lastSynced:"Última sincronização:",showingCount:"Mostrando {{showing}} de {{total}} presets",noPresetsFound:"Nenhum preset encontrado",columns:{filament:"Filamento",process:"Processo",printer:"Impressora"},noFilamentPresets:"Nenhum preset de filamento",noProcessPresets:"Nenhum preset de processo",noPrinterPresets:"Nenhum preset de impressora",filters:{type:"Tipo",owner:"Proprietário",printer:"Impressora",nozzle:"Bico",filament:"Filamento",layer:"Camada",all:"Todos",myPresets:"Meus Presets",builtIn:"Integrado",process:"Processo"},noTemplatesPermission:"Você não tem permissão para gerenciar modelos",noRefreshPermission:"Você não tem permissão para atualizar perfis",noCreatePermission:"Você não tem permissão para criar presets"},templates:{title:"Modelos Rápidos",noTemplates:"Nenhum modelo ainda",createFirst:"Crie modelos a partir do editor de presets",typeFilter:"Tipo:",deleteTitle:"Excluir Modelo",deleteWarning:"Esta ação não pode ser desfeita",deleteConfirm:'Tem certeza de que deseja excluir "{{name}}"?',namePlaceholder:"Nome do modelo",descriptionPlaceholder:"Descrição",settingsJson:"Configurações (JSON)",fieldsCount:"{{count}} campos",shownInModals:"Exibido em modais",hiddenInModals:"Oculto em modais",apply:"Aplicar",toast:{deleted:"Modelo excluído",updated:"Modelo atualizado",created:"Modelo criado",applied:"Modelo aplicado"}}},support:{debugLoggingActive:"Registro de depuração ativo",manageLogs:"Gerenciar",collectItem7:"Conectividade da impressora e versões de firmware",collectItem8:"Status de integração (Spoolman, MQTT, HA)",collectItem9:"Interfaces de rede (somente sub-redes)",collectItem10:"Versões de pacotes Python",collectItem11:"Verificações de integridade do banco de dados",collectItem12:"Detalhes do ambiente Docker"},fileManager:{title:"Gerenciador de Arquivos",subtitle:"Organize e gerencie seus arquivos de impressão",uploadFiles:"Enviar Arquivos",newFolder:"Nova Pasta",folderName:"Nome da Pasta",folderNamePlaceholder:"ex.: Peças Funcionais",renameFile:"Renomear Arquivo",renameFolder:"Renomear Pasta",moveFiles:"Mover {{count}} Arquivo(s)",rootNoFolder:"Raiz (Sem Pasta)",current:"Atual",linkFolder:"Vincular Pasta",linkFolderDescription:'Vincular "{{name}}" a um projeto ou arquivo para acesso rápido.',project:"Projeto",archive:"Arquivo",noProjectsFound:"Nenhum projeto encontrado",noArchivesFound:"Nenhum arquivo encontrado",unlink:"Desvincular",link:"Vincular",dragDropFiles:"Arraste e solte os arquivos aqui",dropFilesHere:"Solte os arquivos aqui",orClickToBrowse:"ou clique para procurar",allFileTypesSupported:"Todos os tipos de arquivos são suportados. Arquivos ZIP serão extraídos.",zipFilesDetected:"Arquivos ZIP detectados",zipExtractOptions:"Arquivos ZIP serão extraídos. Escolha como lidar com a estrutura de pastas:",preserveZipStructure:"Preservar estrutura de pastas do ZIP",createFolderFromZip:"Criar pasta a partir do nome do arquivo ZIP",stlThumbnailGeneration:"Geração de miniaturas STL",zipMayContainStl:"Arquivos ZIP podem conter arquivos STL. Miniaturas podem ser geradas durante a extração.",thumbnailsCanBeGenerated:"Miniaturas podem ser geradas para arquivos STL. Modelos grandes podem levar mais tempo para processar.",generateThumbnailsForStl:"Gerar miniaturas para arquivos STL",threemfDetected:"Arquivos 3MF detectados",threemfExtractionInfo:"Modelo da impressora, material, cor e configurações de impressão serão extraídos automaticamente dos arquivos 3MF.",willBeExtracted:"Será extraído",filesExtracted:"{{count}} arquivos extraídos",uploadComplete:"Upload concluído: {{succeeded}} bem-sucedidos",uploadFailed:"Falha no envio",zipFilesFailed:"{{count}} arquivos falharam",uploading:"Enviando...",changeLink:"Alterar link...",linkTo:"Vincular a...",linkToProjectOrArchive:"Vincular a projeto ou arquivo",addToQueue:"Adicionar à fila",schedulePrint:"Agendar impressão",generateThumbnail:"Gerar miniatura",generateThumbnails:"Gerar miniaturas",generateThumbnailsForMissing:"Gerar miniaturas para arquivos STL que não possuem",gridView:"Visualização em grade",listView:"Visualização em lista",lowDiskSpaceWarning:"Aviso de pouco espaço em disco",lowDiskSpaceDetails:"Apenas {{free}} livres de {{total}} no total. O limite está definido para {{threshold}} GB nas configurações.",files:"Arquivos",folders:"Pastas",size:"Tamanho",free:"Livre",allFiles:"Todos os arquivos",wrap:"Quebrar texto",enableTextWrapping:"Ativar quebra de texto",disableTextWrapping:"Desativar quebra de texto",dragToResizeTooltip:"Arraste para redimensionar, clique duas vezes para redefinir",searchFiles:"Pesquisar arquivos...",allTypes:"Todos os tipos",prints:"Impressões",ascending:"Crescente",descending:"Decrescente",resultsCount:"{{showing}} de {{total}} arquivos",selectAll:"Selecionar tudo",deselectAll:"Desmarcar tudo",selected:"{{count}} selecionado(s)",adding:"Adicionando...",loadingFiles:"Carregando arquivos...",folderIsEmpty:"A pasta está vazia",noFilesYet:"Nenhum arquivo ainda",folderEmptyDescription:"Envie arquivos ou mova arquivos para esta pasta para começar.",noFilesDescription:"Envie arquivos para começar a organizar seus arquivos relacionados à impressão.",noMatchingFiles:"Nenhum arquivo correspondente",noMatchingFilesDescription:"Nenhum arquivo corresponde aos seus critérios de pesquisa ou filtro.",clearFilters:"Limpar filtros",printedCount:"Impresso {{count}}x",uploadedBy:"Enviado por",deleteFolder:"Excluir pasta",deleteFile:"Excluir arquivo",deleteFilesCount:"Excluir {{count}} arquivos",deleteFolderConfirm:"Tem certeza de que deseja excluir esta pasta? Todos os arquivos dentro também serão excluídos.",deleteFileConfirm:"Tem certeza de que deseja excluir este arquivo?",deleteFilesConfirm:"Tem certeza de que deseja excluir {{count}} arquivos selecionados? Esta ação não pode ser desfeita.",deleting:"Excluindo...",noPermissionRenameFolder:"Você não tem permissão para renomear pastas",noPermissionLinkFolder:"Você não tem permissão para vincular pastas",noPermissionDeleteFolder:"Você não tem permissão para excluir pastas",noPermissionPrint:"Você não tem permissão para imprimir",noPermissionAddToQueue:"Você não tem permissão para adicionar à fila",noPermissionDownload:"Você não tem permissão para baixar arquivos",noPermissionRenameFile:"Você não tem permissão para renomear este arquivo",noPermissionGenerateThumbnail:"Você não tem permissão para gerar miniaturas",noPermissionDeleteFile:"Você não tem permissão para excluir este arquivo",noPermissionCreateFolder:"Você não tem permissão para criar pastas",noPermissionUpload:"Você não tem permissão para enviar arquivos",noPermissionMoveFiles:"Você não tem permissão para mover arquivos",noPermissionDeleteFiles:"Você não tem permissão para excluir arquivos",toast:{folderCreated:"Pasta criada",folderDeleted:"Pasta excluída",fileDeleted:"Arquivo excluído",filesDeleted:"Excluídos {{count}} arquivos",filesMoved:"Arquivos movidos",folderLinked:"Pasta vinculada",folderUnlinked:"Pasta desvinculada",addedToQueue:"Adicionado {{count}} arquivo(s) à fila",addedToQueuePartial:"Adicionado {{added}} arquivo(s), {{failed}} falharam",failedToAddToQueue:"Falha ao adicionar arquivos: {{error}}",fileRenamed:"Arquivo renomeado",folderRenamed:"Pasta renomeada",thumbnailsGenerated:"Geradas {{count}} miniatura(s)",thumbnailsGeneratedPartial:"Geradas {{succeeded}} miniatura(s), {{failed}} falharam",noStlMissingThumbnails:"Nenhum arquivo STL sem miniatura",failedToGenerateThumbnails:"Falha ao gerar miniaturas: {{error}}",thumbnailGenerated:"Miniatura gerada",failedToGenerateThumbnail:"Falha ao gerar miniatura: {{error}}"}},projects:{title:"Projetos",subtitle:"Organize e acompanhe seus projetos de impressão 3D",newProject:"Novo Projeto",editProject:"Editar Projeto",deleteProject:"Excluir Projeto",projectName:"Nome do Projeto",description:"Descrição",noProjects:"Nenhum projeto ainda",noProjectsFiltered:"Nenhum projeto {{status}}",noProjectsFilteredHelp:"Você não tem nenhum projeto {{status}}. Os projetos aparecerão aqui quando seu status mudar.",createFirst:"Crie seu primeiro projeto para começar a organizar impressões relacionadas, acompanhar o progresso e gerenciar suas construções.",createFirstButton:"Crie Seu Primeiro Projeto",create:"Criar",files:"Arquivos",prints:"Impressões",plates:"Placas",parts:"Peças",lastModified:"Última Modificação",deleteConfirm:"Tem certeza de que deseja excluir este projeto? Arquivos e itens da fila serão desvinculados, mas não excluídos.",addFiles:"Adicionar Arquivos",removeFile:"Remover Arquivo",viewDetails:"Ver Detalhes",namePlaceholder:"ex., Voron 2.4 Build",descriptionPlaceholder:"Descrição opcional...",color:"Cor",targetPlates:"Placas Alvo",targetPlatesPlaceholder:"ex., 25",targetPlatesHelp:"Número de trabalhos de impressão",targetParts:"Peças Alvo",targetPartsPlaceholder:"ex., 150",targetPartsHelp:"Total de objetos necessários",tagsLabel:"Tags (separadas por vírgula)",tagsPlaceholder:"ex., voron, funcional, presente",dueDate:"Data de Vencimento",priority:"Prioridade",priorityLow:"Baixa",priorityNormal:"Normal",priorityHigh:"Alta",priorityUrgent:"Urgente",statusActive:"Ativo",statusCompleted:"Concluído",statusArchived:"Arquivado",done:"Concluído",completed:"Concluído",failed:"Falhou",inQueue:"Na fila",noPrintsYet:"Nenhuma impressão ainda",printJobs:"Trabalhos de impressão (placas)",partsPrinted:"Peças impressas",failedParts:"Peças falhadas",import:"Importar",export:"Exportar",importProject:"Importar projeto",exportAll:"Exportar todos os projetos",loading:"Carregando projetos...",noEditPermission:"Você não tem permissão para editar projetos",noDeletePermission:"Você não tem permissão para excluir projetos",noCreatePermission:"Você não tem permissão para criar projetos",noImportPermission:"Você não tem permissão para importar projetos",noExportPermission:"Você não tem permissão para exportar projetos",toast:{created:"Projeto criado",updated:"Projeto atualizado",deleted:"Projeto excluído",imported:"Projeto importado",multipleImported:"{{count}} projetos importados",importFailed:"Falha na importação",exported:"Projetos exportados (apenas metadados)"}},projectDetail:{notFound:"Projeto não encontrado",backToProjects:"Voltar para Projetos",export:"Exportar",exportProject:"Exportar projeto",noExportPermission:"Você não tem permissão para exportar projetos",noEditPermission:"Você não tem permissão para editar projetos",partOf:"Parte de:",priorityLabel:"Prioridade:",noPrints:"Nenhuma impressão neste projeto ainda",status:{active:"Ativo",completed:"Concluído",archived:"Arquivado"},priority:{low:"Baixa",normal:"Normal",high:"Alta",urgent:"Urgente"},dueDate:{overdue:"Atrasado",today:"Vence hoje",daysLeft:"{{count}} dias restantes"},progress:{platesProgress:"Progresso das Placas",partsProgress:"Progresso das Peças",printJobs:"Trabalhos de Impressão",parts:"Peças",percentComplete:"{{percent}}% concluído",remaining:"{{count}} restantes"},stats:{printJobs:"Trabalhos de Impressão",total:"total",failed:"{{count}} falhou",partsPrinted:"{{count}} peças impressas",printTime:"Tempo de Impressão",filamentUsed:"Filamento Usado"},cost:{title:"Rastreamento de Custos",filamentCost:"Custo do Filamento",energy:"Energia",budget:"Orçamento",remaining:"Restante"},subProjects:{title:"Sub-projetos ({{count}})"},notes:{title:"Notas",noEditPermission:"Você não tem permissão para editar notas",placeholder:"Adicione notas sobre este projeto...",empty:"Nenhuma nota ainda. Clique em Editar para adicionar notas."},files:{title:"Arquivos",linkFolders:"Vincular pastas do Gerenciador de Arquivos",forQuickAccess:"a este projeto para acesso rápido.",fileCount:"{{count}} arquivo(s)",empty:"Nenhuma pasta vinculada. Vá para o Gerenciador de Arquivos e vincule uma pasta a este projeto."},bom:{title:"Lista de Materiais",acquired:"{{completed}}/{{total}} adquiridos",showAll:"Mostrar todos",hideDone:"Ocultar concluídos",addPart:"Adicionar Peça",noAddPermission:"Você não tem permissão para adicionar peças",partNamePlaceholder:"Nome da peça (ex.: parafusos M3x8)",partName:"Nome da peça",qty:"Quantidade",price:"Preço ({{currency}})",sourcingUrlPlaceholder:"URL de fornecimento (opcional)",remarksPlaceholder:"Observações (opcional)",deletePart:"Excluir Peça",deleteConfirm:'Tem certeza de que deseja excluir "{{name}}"?',noUpdatePermission:"Você não tem permissão para atualizar peças",noEditPermission:"Você não tem permissão para editar peças",noDeletePermission:"Você não tem permissão para excluir peças",totalCost:"Custo total:",empty:"Nenhuma peça na lista de materiais. Adicione hardware, eletrônicos ou outros componentes para rastrear o que precisa ser adquirido."},timeline:{title:"Linha do Tempo de Atividades",empty:"Nenhuma atividade ainda."},template:{saveAsTemplate:"Salvar como Modelo",noCreatePermission:"Você não tem permissão para criar modelos"},queue:{title:"Fila",viewAll:"Ver todos",printing:"{{count}} imprimindo",queued:"{{count}} na fila"},prints:{title:"Impressões ({{count}})"},toast:{projectUpdated:"Projeto atualizado",partAdded:"Peça adicionada",partRemoved:"Peça removida",exportFailed:"Falha na exportação",projectExported:"Projeto exportado",templateCreated:"Modelo criado"}},system:{title:"Informações do Sistema",version:"Versão",uptime:"Tempo de Atividade",cpuUsage:"Uso da CPU",memoryUsage:"Uso da Memória",diskUsage:"Uso do Disco",networkInfo:"Informações de Rede",logs:"Logs",debugMode:"Modo de Depuração",enableDebug:"Ativar Registro de Depuração",disableDebug:"Desativar Registro de Depuração",downloadLogs:"Baixar Logs",clearLogs:"Limpar Logs",dockerInfo:"Informações do Docker",containerName:"Nome do Contêiner",imageName:"Nome da Imagem",platform:"Plataforma",architecture:"Arquitetura"},library:{title:"Biblioteca de Filamentos",addFilament:"Adicionar Filamento",editFilament:"Editar Filamento",deleteFilament:"Excluir Filamento",vendor:"Fornecedor",material:"Material",color:"Cor",kFactor:"Fator K",temperature:"Temperatura",noFilaments:"Nenhum filamento na biblioteca",deleteConfirm:"Tem certeza de que deseja excluir este filamento?",importFromPrinter:"Importar da Impressora",exportToFile:"Exportar para Arquivo"},spoolman:{title:"Integração com Spoolman",enabled:"Spoolman Ativado",url:"URL do Spoolman",connected:"Conectado",disconnected:"Não Conectado",testConnection:"Testar Conexão",sync:"Sincronizar",syncing:"Sincronizando...",lastSync:"Última Sincronização",linkToSpoolman:"Vincular ao Spoolman",openInSpoolman:"Abrir no Spoolman",unlinkSpool:"Desvincular Carretel",unlinkConfirmTitle:"Desvincular carretel?",unlinkConfirmMessage:"Isso desconectará o carretel do Spoolman. Os dados do carretel no Spoolman permanecerão inalterados.",selectSpool:"Selecionar Carretel",noUnlinkedSpools:"Nenhum carretel desvinculado disponível",linkSuccess:"Carretel vinculado ao Spoolman com sucesso",linkFailed:"Falha ao vincular carretel",unlinkSuccess:"Carretel desvinculado do Spoolman com sucesso",unlinkFailed:"Falha ao desvincular carretel",spoolId:"Carretel ID (Spool ID)",fillSourceLabel:"(Spoolman)",weight:"Peso",remaining:"Restante",disableWeightSync:"Desativar Sincronização de Peso Estimado do AMS",disableWeightSyncDesc:"Não atualize a capacidade restante a partir das estimativas do AMS. Use isso se preferir o rastreamento de uso do Spoolman em vez das estimativas baseadas em porcentagem do AMS. Novos carretéis ainda usarão a estimativa do AMS como seu peso inicial.",reportPartialUsage:"Relatar Uso Parcial para Impressões Falhadas",reportPartialUsageDesc:"Quando uma impressão falha ou é cancelada, relate o filamento estimado usado até aquele ponto com base no progresso das camadas."},inventory:{title:"Inventário de Carretéis",addSpool:"Adicionar Carretel",editSpool:"Editar Carretel",material:"Material",selectMaterial:"Selecionar material...",subtype:"Subtipo",brand:"Marca",searchBrand:"Pesquisar marca...",useCustomBrand:'Usar "{{brand}}"',useCustomMaterial:"Usar material personalizado: {{material}}",colorName:"Nome da Cor",colorNamePlaceholder:"Jade White, Fire Red...",color:"Cor",hexColor:"Cor Hexadecimal",pickColor:"Escolher cor personalizada",labelWeight:"Peso da Etiqueta",coreWeight:"Peso do Carretel Vazio",searchSpoolWeight:"Pesquisar peso do carretel...",weightUsed:"Usado",currentWeight:"Peso Restante",measuredWeight:"Peso Medido",costPerKg:"Custo por kg",measuredWeightError:"O peso medido deve estar entre {{min}}g e {{max}}g.",slicerFilament:"Filamento do Fatiador",slicerFilamentName:"Nome do Predefinido do Fatiador",slicerPreset:"Predefinido do Fatiador",searchPresets:"Pesquisar predefinições de filamento...",selectedPreset:"Selecionado",noPresetsFound:"Nenhuma predefinição encontrada",tempOverrides:"Substituições de Temperatura",note:"Nota",notePlaceholder:"Quaisquer notas adicionais sobre este spool...",archive:"Arquivar",restore:"Restaurar",noSpools:"Nenhum carretel ainda. Adicione seu primeiro carretel para começar.",noManualSpools:"Nenhum carretel adicionado manualmente disponível. Adicione um carretel ao seu inventário primeiro.",kProfiles:"K-Perfis",addKProfile:"Adicionar K-Perfil",assignSpool:"Atribuir Carretel",unassignSpool:"Desatribuir",assignSuccess:"Carretel atribuído e slot AMS configurado",assignFailed:"Falha ao atribuir carretel",selectSpool:"Selecione um carretel para atribuir a este slot",assigned:"Atribuído",assigning:"Atribuindo...",searchSpools:"Pesquisar carretéis...",allMaterials:"Todos os Materiais",filterByBrand:"Filtrar por marca...",showArchived:"Mostrar arquivados",quickAdd:"Adição rápida (Estoque)",quantity:"Quantidade",stock:"Estoque",configured:"Configurado",spoolsCreated:"{{count}} carretéis criados",spoolCreated:"Carretel criado",spoolUpdated:"Carretel atualizado",spoolDeleted:"Carretel excluído",spoolArchived:"Carretel arquivado",spoolRestored:"Carretel restaurado",deleteConfirm:"Tem certeza de que deseja excluir este carretel? Esta ação não pode ser desfeita.",archiveConfirm:"Tem certeza de que deseja arquivar este carretel?",advancedSettings:"Configurações Avançadas",filamentInfoTab:"Informações do Filamento",paProfileTab:"Perfil PA",filamentInfo:"Filamento",additional:"Adicional",loadingPresets:"Carregando predefinições da nuvem...",cloudConnected:"Nuvem conectada",cloudNotConnected:"Nuvem não conectada (usando padrões)",recentColors:"Recentes",searchColors:"Pesquisar cores...",searchResults:"Resultados da pesquisa",allColors:"Todas as cores",commonColors:"Cores comuns",showLess:"Mostrar menos",showAll:"Mostrar tudo",noColorsFound:"Nenhuma cor corresponde à sua pesquisa",noResults:"Nenhum resultado encontrado",selectMaterialFirst:"Por favor, selecione um material primeiro na aba Informações do Filamento.",noPrintersConfigured:"Nenhuma impressora configurada. Adicione impressoras para usar perfis PA.",matchingFilter:"Correspondente",anyBrand:"Qualquer marca",anyVariant:"Qualquer variante",autoSelect:"Seleção automática",matches:"correspondências",match:"correspondência",noMatches:"Nenhuma correspondência",connected:"Conectado",offline:"Offline",printerOffline:"A impressora está offline. Conecte-se para visualizar os perfis de calibração.",noKProfilesMatch:"Nenhum K-perfil corresponde ao filamento selecionado.",leftNozzle:"Bico Esquerdo",rightNozzle:"Bico Direito",profilesSelected:"perfil(is) de calibração selecionado(s)",totalInventory:"Inventário Total",totalConsumed:"Total Consumido",byMaterial:"Por Material",inPrinter:"Na Impressora",lowStock:"Estoque Baixo",sinceTracking:"Desde o início do rastreamento",loadedInAms:"Carregado no AMS/Ext",remaining:"Restante",weightCheck:"Verificação de Peso",lastWeighed:"Última pesagem",neverWeighed:"Nunca pesado",search:"Pesquisar carretéis...",showing:"Mostrando",to:"até",of:"de",show:"Mostrar",spools:"carretéis",spool:"carretel",page:"Página",noSpoolsMatch:"Nenhum resultado encontrado",noSpoolsMatchDesc:"Tente ajustar sua pesquisa ou filtros para encontrar o que você está procurando.",active:"Ativo",archived:"Arquivado",all:"Todos",used:"Usado",new:"Novo",clearFilters:"Limpar filtros",table:"Tabela",cards:"Cartões",net:"Líquido",groupSimilar:"Agrupar",groupedSpools:"{{count}} carretéis idênticos",groupedRows:"linhas",columns:"Colunas",configureColumns:"Configurar Colunas",configureColumnsDesc:"Arraste para reordenar as colunas ou use as setas. Alterne a visibilidade com o ícone de olho.",visible:"Visível",reset:"Redefinir",cancel:"Cancelar",applyChanges:"Aplicar Alterações",moveUp:"Mover para cima",moveDown:"Mover para baixo",hideColumn:"Ocultar coluna",showColumn:"Mostrar coluna",linkToSpool:"Vincular ao Carretel",tagLinked:"Tag vinculada ao carretel",tagLinkFailed:"Falha ao vincular tag",tagAlreadyLinked:"Tag já vinculada a outro carretel",unknownTag:"Tag RFID desconhecida detectada",usageHistory:"Histórico de Uso",noUsageHistory:"Nenhum uso registrado ainda",printName:"Nome da Impressão",weightConsumed:"Peso Consumido",clearHistory:"Limpar",historyCleared:"Histórico de uso limpo",fillSourceLabel:"(Inv)",lowStockThresholdError:"O limite deve estar entre 0.1 e 99.9"},timelapse:{title:"Timelapse",create:"Criar Timelapse",download:"Baixar",delete:"Excluir",preview:"Visualizar",frameRate:"Taxa de Quadros",quality:"Qualidade",processing:"Processando...",noTimelapses:"Nenhum timelapse disponível"},ams:{title:"AMS",slot:"Slot",empty:"Vazio",emptySlot:"Slot vazio",unknown:"Desconhecido",humidity:"Umidade",temperature:"Temperatura",filamentType:"Tipo de Filamento",filamentColor:"Cor",remaining:"Restante",history:"Histórico do AMS",noHistory:"Nenhum histórico disponível",configureSlot:"Configurar Slot",externalSpool:"Carretel Externo",profile:"Perfil",kFactor:"Fator K",fill:"Preencher",configure:"Configurar",used:"usado",remainingUnit:"restante"},printModal:{title:"Iniciar Impressão",selectPrinter:"Selecionar Impressora",selectPlate:"Selecionar Placa",filamentMapping:"Mapeamento de Filamento",totalCost:"Custo total:",slotRemainingShort:" - {{grams}}g rest.",printSettings:"Configurações de Impressão",bedLeveling:"Nivelamento da Mesa",flowCalibration:"Calibração de Fluxo",vibrationCalibration:"Calibração de Vibração",layerInspection:"Inspeção da Primeira Camada",timelapse:"Timelapse",startPrint:"Iniciar Impressão",addToQueue:"Adicionar à Fila",cancel:"Cancelar",noPrintersAvailable:"Nenhuma impressora disponível",printerBusy:"Impressora ocupada",printerOffline:"Impressora offline",sameTypeDifferentColor:"Mesmo tipo, cor diferente",filamentTypeNotLoaded:"Tipo de filamento não carregado",openCalendar:"Abrir calendário",leftNozzle:"L",rightNozzle:"R",leftNozzleTooltip:"Bico esquerdo",rightNozzleTooltip:"Bico direito",filamentOverride:"Substituição de Filamento",filamentOverrideHint:"Substitua opcionalmente os filamentos para atribuição baseada em modelo. O agendador usará os filamentos selecionados em vez dos valores originais do 3MF.",originalFilament:"Original",overrideWith:"Substituir por",resetToOriginal:"Restaurar original",forceColorMatch:"Forçar correspondência de cor"},backup:{title:"Bakup e Restauração",createBackup:"Criar Backup",restoreBackup:"Restaurar Backup",restoreDescription:"Substituir todos os dados a partir de um arquivo de backup",downloadBackup:"Baixar Backup",uploadBackup:"Enviar Backup",lastBackup:"Último Backup",autoBackup:"Auto Backup",backupNow:"Fazer Backup Agora",restoreWarning:"Aviso: Restaurar um backup substituirá todos os dados atuais.",includeArchives:"Incluir Arquivos",includeSettings:"Incluir Configurações",includeProfiles:"Incluir Perfis",backupSuccess:"Backup criado com sucesso",restoreSuccess:"Backup restaurado com sucesso",backupFailed:"Falha ao criar backup",restoreFailed:"Falha ao restaurar backup",restoreNote:"A impressora virtual será parada durante a restauração",githubBackup:"Backup GitHub",enabled:"Ativado",cloudLoginRequired:"Login no Bambu Cloud necessário. Entre em Perfis → Perfis Cloud para ativar o backup GitHub.",cloudLoginRequiredShort:"Login Cloud necessário",githubDescription:"Sincronize automaticamente seus perfis com um repositório GitHub privado para backup e histórico de versões.",repositoryUrl:"URL do repositório",personalAccessToken:"Token de acesso pessoal",tokenSaved:"(salvo)",enterNewToken:"Digite um novo token para atualizar",tokenHint:"Token de granularidade fina com permissão de leitura/escrita de conteúdo",branch:"Branch",manualOnly:"Apenas manual",hourly:"A cada hora",daily:"Diário",weekly:"Semanal",includeInBackup:"Incluir no backup",kProfiles:"K-Perfis",kProfilesDescription:"Calibração de avanço de pressão das impressoras conectadas",noPrintersConnected:"Nenhuma impressora conectada",printersConnected:"{{connected}}/{{total}} conectadas",cloudProfiles:"Perfis Cloud",cloudProfilesDescription:"Predefinições de filamento, impressora e processo do Bambu Cloud",appSettings:"Configurações do App",appSettingsDescription:"Configuração do Bambuddy (banco de dados completo)",lastBackupAt:"Último backup:",noBackupsYet:"Nenhum backup ainda",next:"Próximo:",startingBackup:"Iniciando backup...",test:"Testar",enableBackup:"Ativar backup",testConnection:"Testar conexão",enterRepoUrl:"Digite a URL do repositório",enterRepoAndToken:"Digite a URL do repositório e o token de acesso",repoRequired:"A URL do repositório é obrigatória",tokenRequired:"O token de acesso é obrigatório",githubBackupEnabled:"Backup GitHub ativado",tokenUpdated:"Token atualizado",settingsSaved:"Configurações salvas",failedToSave:"Falha ao salvar: {{message}}",backupCompleteFiles:"Backup concluído - {{count}} arquivos atualizados",backupSkippedNoChanges:"Backup ignorado - sem alterações",backupFailed2:"Falha no backup: {{message}}",clearedLogs:"{{count}} logs removidos",failedToClearLogs:"Falha ao limpar logs: {{message}}",history:"Histórico",clear:"Limpar",date:"Data",status:"Status",commit:"Commit",localBackup:"Backup local",localBackupDescription:"Crie um backup completo dos seus dados do Bambuddy incluindo banco de dados, arquivos, uploads e todos os ficheiros.",downloadBackupLabel:"Baixar backup",completeBackupZip:"Backup completo: banco de dados + todos os arquivos (ZIP)",download:"Baixar",preparingBackup:"Preparando backup...",creatingArchive:"Criando arquivo de backup... Isso pode demorar para backups grandes.",downloadingFile:"Baixando arquivo de backup...",backupDownloaded:"Backup baixado com sucesso",failedToCreateBackup:"Falha ao criar backup: {{message}}",restore:"Restaurar",restoreReplacesAll:"A restauração substitui todos os dados.",restoreReplacesAllDetail:"Seu banco de dados e arquivos atuais serão completamente substituídos. É necessário reiniciar após a restauração.",restoreConfirmTitle:"Restaurar backup",restoreConfirmMessage:'Tem certeza de que deseja restaurar de "{{filename}}"? Isso substituirá completamente seu banco de dados e todos os arquivos. O aplicativo precisará ser reiniciado após a restauração.',restoreConfirmButton:"Restaurar backup",uploadingFile:"Enviando arquivo de backup...",backupRestoredRestart:"Backup restaurado. Por favor, reinicie o Bambuddy.",failedToRestore:"Falha ao restaurar backup. Verifique o formato do arquivo.",reloadNow:"Recarregar agora",creatingBackup:"Criando backup",restoringBackup:"Restaurando backup",preparing:"Preparando...",processing:"Processando...",doNotClosePage:"Por favor, não feche esta página nem navegue para outro lugar. Esta operação pode levar vários minutos para backups grandes.",restoring:"Restaurando...",restoreComplete:"Restauração concluída",restoreFailed2:"Falha na restauração",importSettings:"Importar configurações de um arquivo de backup",pleaseWaitRestoring:"Aguarde enquanto seus dados estão sendo restaurados",selectBackupFile:"Clique para selecionar um arquivo de backup (.json ou .zip)",duplicateHandling:"Como funciona o tratamento de duplicatas:",matchPrinters:"Impressoras",matchPrintersBy:"correspondência por número de série",matchSmartPlugs:"Smart Plugs",matchSmartPlugsBy:"correspondência por endereço IP",matchNotificationProviders:"Provedores de notificação",matchNotificationProvidersBy:"correspondência por nome",matchFilaments:"Filamentos",matchFilamentsBy:"correspondência por nome + tipo + marca",matchArchives:"Arquivos",matchArchivesBy:"correspondência por hash de conteúdo (sempre ignorado)",matchPendingUploads:"Uploads pendentes",matchPendingUploadsBy:"correspondência por nome do arquivo",matchSettingsTemplates:"Configurações e modelos",matchSettingsTemplatesBy:"sempre sobrescritos",replaceExisting:"Substituir dados existentes",keepExisting:"Manter dados existentes",overwriteDescription:"Sobrescrever itens que já existem com dados do backup",keepDescription:"Restaurar apenas itens que ainda não existem",overwriteCaution:"Cuidado:",overwriteWarning:"A sobrescrita substituirá suas configurações atuais pelos dados do backup. Códigos de acesso das impressoras nunca são sobrescritos por segurança.",cancel:"Cancelar",processingBackup:"Processando arquivo de backup...",itemsRestored:"Itens restaurados",itemsSkipped:"Itens ignorados",restored:"Restaurados",skippedAlreadyExist:"Ignorados (já existem)",filesCategory:"Arquivos (3MF, miniaturas, etc.)",andMore:"...e mais {{count}}",newApiKeysGenerated:"Novas chaves API geradas",keysShownOnce:"Estas chaves são exibidas apenas uma vez. Copie-as agora!",copy:"Copiar",noDataFound:"Nenhum dado para restaurar foi encontrado no arquivo de backup.",close:"Fechar",categories:{settings:"Configurações",notification_providers:"Provedores de notificação",notification_templates:"Modelos de notificação",smart_plugs:"Smart Plugs",printers:"Impressoras",filaments:"Filamentos",maintenance_types:"Tipos de manutenção",archives:"Arquivos",projects:"Projetos",pending_uploads:"Uploads pendentes",external_links:"Links externos",api_keys:"Chaves API"}},tags:{title:"Tags",addTag:"Adicionar Tag",editTag:"Editar Tag",deleteTag:"Excluir Tag",tagName:"Nome da Tag",tagColor:"Cor da Tag",noTags:"Nenhuma tag",deleteConfirm:"Tem certeza de que deseja excluir esta tag?",manageTags:"Gerenciar Tags"},uploadModal:{title:"Upload Arquivos 3MF",dragDrop:"Arraste e solte arquivos .3mf aqui",or:"ou",browseFiles:"Procurar Arquivos",extractionInfo:"O modelo da impressora será extraído automaticamente dos metadados do arquivo 3MF.",uploaded:"enviado",failed:"falhou",uploading:"Enviando...",upload:"Enviar",uploadFailed:"Falha no envio"},editArchive:{title:"Editar Arquivo",name:"Nome",namePlaceholder:"Nome da impressão",printer:"Impressora",noPrinter:"Nenhuma impressora",project:"Projeto",noProject:"Nenhum projeto",itemsPrinted:"Itens Impressos",itemsPrintedHelp:"Número de itens produzidos neste trabalho de impressão",notes:"Notas",notesPlaceholder:"Adicione notas sobre esta impressão...",externalLink:"Link Externo",externalLinkPlaceholder:"https://printables.com/model/...",externalLinkHelp:"Link para Printables, Thingiverse ou outra fonte",tags:"Tags",tagsPlaceholder:"Adicionar tags...",addMoreTags:"Adicionar mais tags...",matchingTags:'Correspondendo "{{query}}"',existingTags:"Tags existentes",clickToAdd:"(clique para adicionar)",status:"Status",failureReason:"Motivo da Falha",selectReason:"Selecione o motivo...",photos:"Fotos do Resultado da Impressão",photosHelp:"Clique em + para adicionar fotos do seu resultado impresso",printResult:"Resultado da Impressão",saving:"Salvando...",failureReasons:{adhesionFailure:"Falha de adesão",spaghettiDetached:"Spaghetti / Destacado",layerShift:"Deslocamento de camada",cloggedNozzle:"Bico entupido",filamentRunout:"Fim do filamento",warping:"Warping",stringing:"Stringing",underExtrusion:"Under-extrusion",powerFailure:"Falha de energia",userCancelled:"Cancelado pelo usuário",other:"Outro"},statuses:{completed:"Concluído",failed:"Falhou",aborted:"Cancelado",printing:"Imprimindo"}},kProfiles:{title:"K-Profiles",noPrintersConfigured:"Nenhuma impressora configurada",addPrinterInSettings:"Adicione uma impressora nas Configurações para gerenciar K-profiles",noActivePrinters:"Nenhuma impressora ativa",enablePrinterConnection:"Ative a conexão da impressora para visualizar seus K-profiles",loadingProfiles:"Carregando K-Profiles...",printerOffline:"Impressora Offline",printerOfflineDesc:"A impressora selecionada não está conectada. Ligue-a para visualizar os K-profiles.",noMatchingProfiles:"Nenhum Perfil Correspondente",noMatchingProfilesDesc:"Nenhum perfil corresponde aos seus critérios de pesquisa",noKProfiles:"Nenhum K-Profile",noKProfilesDesc:"Nenhum perfil de avanço de pressão encontrado para bico de {{diameter}}mm",createFirstProfile:"Criar Primeiro Perfil",printer:"Impressora",nozzle:"Bico",refresh:"Atualizar",addProfile:"Adicionar Perfil",export:"Exportar",import:"Importar",select:"Selecionar",selectAll:"Selecionar Todos",delete:"Excluir",searchPlaceholder:"Pesquisar por nome ou filamento...",allExtruders:"Todos os Extrusores",leftOnly:"Apenas Esquerdo",rightOnly:"Apenas Direito",allFlow:"Todo Fluxo",hfOnly:"Apenas HF",sOnly:"Apenas S",sortName:"Ordenar: Nome",sortKValue:"Ordenar: Valor K",sortFilament:"Ordenar: Filamento",leftExtruder:"Extrusor Esquerdo",rightExtruder:"Extrusor Direito",modal:{addTitle:"Adicionar K-Profile",editTitle:"Editar K-Profile",profileName:"Nome do Perfil",profileNamePlaceholder:"Meu Perfil PLA",kValue:"Valor K",kValuePlaceholder:"0.020",kValueHelp:"Faixa típica: 0.01 - 0.06 para PLA, 0.02 - 0.10 para PETG",filament:"Filamento",selectFilament:"Selecionar filamento...",noFilamentsHelp:"Nenhum filamento encontrado. Crie um K-profile no Bambu Studio primeiro.",flowType:"Tipo de Fluxo",highFlow:"Alto Fluxo",standard:"Padrão",nozzleSize:"Tamanho do Bico",extruder:"Extrusor",extruders:"Extrusores",left:"Esquerdo",right:"Direito",notes:"Notas (armazenadas localmente)",notesPlaceholder:"Adicione notas sobre este perfil...",notesHelp:"As notas são salvas no Bambuddy, não na impressora",syncing:"Sincronizando com a impressora...",savingExtruder:"Salvando no extrusor {{current}}/{{total}}...",pleaseWait:"Por favor, aguarde"},deleteConfirm:{title:"Excluir Perfil",cannotUndo:"Isso não pode ser desfeito",message:'Tem certeza de que deseja excluir "{{name}}" da impressora?'},bulkDelete:{title:"Excluir Perfis",cannotUndo:"Isso não pode ser desfeito",message:"Tem certeza de que deseja excluir {{count}} perfis selecionados da impressora?"},toast:{profileSaved:"K-profile salvo",profilesSaved:"K-profile salvo em {{count}} extrusores",selectAtLeastOneExtruder:"Por favor, selecione pelo menos um extrusor",profileDeleted:"K-profile excluído",profilesDeleted:"{{count}} perfis excluídos",exportedProfiles:"{{count}} perfis exportados",importedProfiles:"{{count}} de {{total}} perfis importados",noProfilesToExport:"Nenhum perfil para exportar",invalidFileFormat:"Formato de arquivo inválido",failedToParseImport:"Falha ao analisar o arquivo de importação",failedToSaveBatch:"Falha ao salvar K-profiles",noteSaved:"Nota salva",failedToSaveNote:"Falha ao salvar nota"},permission:{noRead:"Você não tem permissão para atualizar perfis",noCreate:"Você não tem permissão para adicionar perfis",noUpdate:"Você não tem permissão para atualizar K-profiles",noDelete:"Você não tem permissão para excluir K-profiles",noExport:"Você não tem permissão para exportar perfis",noImport:"Você não tem permissão para importar perfis"}},virtualPrinter:{title:"Impressora Virtual",running:"Em execução",stopped:"Parada",description:{default:"Ative uma impressora virtual que aparece no Bambu Studio e no OrcaSlicer. Os arquivos enviados para esta impressora serão arquivados diretamente sem impressão.",proxy:"Ative um proxy que retransmite o tráfego do slicer para uma impressora real, permitindo impressão remota em qualquer rede."},enable:{title:"Ativar Impressora Virtual",visibleInSlicer:'Visível como "Bambuddy" na descoberta do slicer',proxyingTo:"Proxy para {{name}}",notActive:"Não ativo"},model:{title:"Modelo da Impressora",description:"Selecione qual modelo de impressora emular.",restartWarning:"Alterar o modelo reiniciará a impressora virtual"},accessCode:{title:"Código de acesso",isSet:"O código de acesso está definido",notSet:"Nenhum código de acesso definido — necessário para ativar.",placeholder:"Digite um código de 8 caracteres",placeholderChange:"Digite um novo código para alterar",hint:"Deve ter exatamente 8 caracteres. Usado pelos slicers para autenticação.",charCount:"({{count}}/8)"},targetPrinter:{title:"Impressora Alvo",configured:"Proxy alvo configurado",notConfigured:"Nenhuma impressora alvo selecionada - necessário para o modo proxy",placeholder:"Selecione uma impressora...",hint:"Selecione a impressora para a qual o tráfego do slicer será enviado. A impressora deve estar no modo LAN.",noPrinters:"Nenhuma impressora configurada. Adicione uma impressora primeiro para usar o modo proxy."},remoteInterface:{title:"Substituição da Interface de Rede",configured:"Substituição da interface ativa",optional:"Opcional - use se o IP detectado automaticamente estiver errado (por exemplo, várias NICs, Docker, VPN)",placeholder:"Detecção automática (padrão)...",hint:"Substitua o endereço IP anunciado via SSDP e usado no certificado TLS. Útil quando o Bambuddy possui várias interfaces de rede."},mode:{title:"Modo",archive:"Arquivar",archiveDesc:"Arquivar arquivos imediatamente",review:"Revisar",reviewDesc:"Revisar antes de arquivar",queue:"Fila",queueDesc:"Arquivar e adicionar à fila",proxy:"Proxy",proxyDesc:"Retransmitir para impressora real"},autoDispatch:{title:"Envio automático",description:"Iniciar impressões automaticamente quando adicionadas à fila. Quando desativado, as impressões aguardam envio manual."},setupRequired:{title:"Configuração Necessária",description:"O recurso de impressora virtual requer configuração adicional do sistema antes de funcionar. Isso inclui encaminhamento de portas, regras de firewall e configurações específicas da plataforma.",readGuide:"Leia o guia de configuração antes de ativar"},howItWorks:{title:"Como funciona",step1:"Complete o guia de configuração para sua plataforma",step2:"Ative a impressora virtual e defina um código de acesso",step3:'No Bambu Studio ou OrcaSlicer, vá para "Adicionar Impressora"'},status:{title:"Detalhes do Status",printerName:"Nome da Impressora",model:"Modelo",serialNumber:"Número de Série",mode:"Modo",pendingFiles:"Arquivos Pendentes",targetPrinter:"Impressora Alvo",ftpPort:"Porta FTP",mqttPort:"Porta MQTT",ftpConnections:"Conexões FTP",mqttConnections:"Conexões MQTT"},toast:{updated:"Configurações da impressora virtual atualizadas",failedToUpdate:"Falha ao atualizar as configurações",accessCodeRequired:"Defina um código de acesso primeiro",targetPrinterRequired:"Selecione uma impressora alvo primeiro",bindIpRequired:"Defina um IP de ligação primeiro",accessCodeEmpty:"O código de acesso não pode estar vazio",accessCodeLength:"O código de acesso deve ter exatamente 8 caracteres",created:"Impressora virtual criada",failedToCreate:"Falha ao criar impressora virtual",deleted:"Impressora virtual excluída",failedToDelete:"Falha ao excluir impressora virtual"},list:{title:"Impressoras Virtuais",add:"Adicionar",addFirst:"Adicionar Impressora Virtual",empty:"Nenhuma impressora virtual configurada. Adicione uma para começar."},bindIp:{title:"Interface de Rede",placeholder:"Selecionar interface...",hint:"Interface de rede para esta impressora virtual. Deve ser única por impressora."},proxy:{accessCodeHint:"No modo proxy, use o código de acesso da impressora alvo no slicer. A conexão é encaminhada de forma transparente para a impressora real."},addDialog:{title:"Adicionar Impressora Virtual",name:"Nome",hint:"Você pode configurar o código de acesso, impressora alvo e outras configurações após a criação.",create:"Criar"},deleteConfirm:{title:"Excluir Impressora Virtual",message:'Tem certeza que deseja excluir "{{name}}"? Isso irá parar todos os serviços desta impressora.'}},modelViewer:{openInSlicer:"Abrir no Slicer",tabs:{model:"Modelo 3D",gcode:"Pré-visualização G-code"},notAvailable:"Não disponível",notSliced:"Não fatiado",plates:"Placas",allPlates:"Todas as Placas",plateNumber:"Placa {{number}}",plateCount:"{{count}} placa",plateCount_other:"{{count}} placas",objectCount:"{{count}} objeto",objectCount_other:"{{count}} objetos",filamentCount:"{{count}} filamento",filamentCount_other:"{{count}} filamentos",eta:"ETA {{minutes}} min",noPreview:"Pré-visualização não disponível para este arquivo",pagination:{pageOf:"Página {{current}} de {{total}}",prev:"Anterior",next:"Próximo"},errors:{failedToLoad:"Falha ao carregar o arquivo",noMeshes:"Nenhuma malha encontrada no arquivo 3MF",unsupportedFormat:"Formato de arquivo não suportado"}},maintenanceDescriptions:{lubricateCarbonRods:"Aplique lubrificante nos eixos de carbono para um movimento suave",lubricateRails:"Aplique lubrificante nos trilhos lineares para um movimento suave",cleanNozzle:"Limpe o hotend e o bico para evitar entupimentos",checkBelts:"Verifique a tensão das correias para impressões precisas",cleanBuildPlate:"Limpe a placa de construção para melhor adesão",checkExtruder:"Verifique as engrenagens do extrusor quanto ao desgaste",checkCooling:"Verifique se os ventiladores de resfriamento estão funcionando corretamente",generalInspection:"Inspeção geral da impressora",cleanCarbonRods:"Limpe os eixos de carbono para reduzir o atrito",lubricateSteelRods:"Aplique lubrificante nas barras de aço para um movimento suave",cleanSteelRods:"Limpe as barras de aço para reduzir o atrito",cleanLinearRails:"Limpe os trilhos lineares para remover poeira e detritos",checkPtfeTube:"Verifique o tubo PTFE quanto ao desgaste ou danos",replaceHepaFilter:"Substitua o filtro HEPA para qualidade do ar",replaceCarbonFilter:"Substitua o filtro de carbono ativado",lubricateLeftNozzleRail:"Lubrifique o trilho do bico esquerdo (série H2)"},smartPlugs:{offline:"Offline",admin:"Admin",openPlugAdminPage:"Abrir o painel de administração da tomada inteligente",deleteSmartPlug:"Excluir Tomada Inteligente",turnOnSmartPlug:"Ligar Tomada Inteligente",turnOffSmartPlug:"Desligar Tomada Inteligente",turnOn:"Ligar",turnOff:"Desligar",addSmartPlug:{scanningNetwork:"Procurando na rede...",chooseEntity:"Escolha uma entidade...",connectionFailed:"Falha na conexão",searchEntities:"Pesquisar entidades...",searchPowerSensors:"Pesquisar sensores de energia...",searchEnergySensors:"Pesquisar sensores de energia...",placeholders:{plugName:"Tomada da Sala",mqttStateOnValue:"ON, true, 1",mqttSameAsPower:"Mesmo que o tópico de energia, ou diferente"}},linkedTo:"Vinculado a:",monitorOnly:"Apenas monitoramento",alerts:"Alertas",scheduleOn:"Ligar {{time}}",scheduleOff:"Desligar {{time}}",on:"Ligado",off:"Desligado",power:"Potência",kwhToday:"kWh Hoje",settings:"Configurações",automationSettings:"Configurações de automação",showInSwitchbar:"Mostrar na barra de interruptores",quickAccessSidebar:"Acesso rápido pela barra lateral",enabled:"Ativado",enableAutomation:"Ativar automação para este plugue",autoOn:"Auto Ligar",autoOnDescription:"Ligar quando a impressão iniciar",autoOff:"Auto Desligar",autoOffDescription:"Desligar quando a impressão terminar (única vez)",turnOffDelayMode:"Modo de atraso para desligar",time:"Tempo",temp:"Temp",delayMinutes:"Atraso (minutos)",tempThreshold:"Limite de temperatura (°C)",tempThresholdDescription:"Desliga quando o bico esfria abaixo desta temperatura",edit:"Editar",deleteConfirm:'Tem certeza que deseja excluir "{{name}}"? Esta ação não pode ser desfeita.',turnOnConfirm:'Tem certeza que deseja ligar "{{name}}"?',turnOffConfirm:'Tem certeza que deseja desligar "{{name}}"? Isso cortará a energia do dispositivo conectado.',failedToTurn:'Falha ao {{action}} "{{name}}"',unknown:"Desconhecido",addTitle:"Adicionar plugue inteligente",editTitle:"Editar plugue inteligente",stopScanning:"Parar varredura",discoverTasmota:"Descobrir dispositivos Tasmota",foundDevices:"{{count}} dispositivo(s) encontrado(s) - clique para selecionar:",noDevicesFound:"Nenhum dispositivo Tasmota encontrado na sua rede",haNotConfigured:"Home Assistant não está configurado. Configure em",haSettingsPath:"Configurações → Rede → Home Assistant",selectEntity:"Selecionar entidade *",ipAddress:"Endereço IP *",nameLabel:"Nome *",username:"Usuário",password:"Senha",authHint:"Deixe vazio se seu dispositivo Tasmota não requer autenticação",linkToPrinter:"Vincular à impressora",noPrinter:"Sem impressora (apenas controle manual)",linkingDescription:"A vinculação permite ligar/desligar automaticamente ao iniciar/terminar impressão",powerAlerts:"Alertas de potência",alertAbove:"Alertar se acima (W)",alertBelow:"Alertar se abaixo (W)",alertDescription:"Receba notificações quando o consumo de energia ultrapassar estes limites. Deixe vazio para desativar essa direção.",dailySchedule:"Programação diária",turnOnAt:"Ligar às",turnOffAt:"Desligar às",scheduleDescription:"Ligar/desligar automaticamente o plugue nestes horários diariamente. Deixe vazio para pular essa ação.",showOnPrinterCard:"Mostrar no cartão da impressora",displayOnPrinterCard:"Exibir botão no cartão da impressora",connectedResult:"Conectado!",deviceLabel:"Dispositivo: {{name}} - ",stateLabel:"Estado: {{state}}",test:"Testar",delete:"Excluir",save:"Salvar",add:"Adicionar",cancel:"Cancelar",failedToStartScan:"Falha ao iniciar varredura",nameRequired:"Nome é obrigatório",entityRequired:"Entidade é obrigatória para plugues Home Assistant",mqttTopicRequired:"Pelo menos um tópico MQTT deve ser configurado para potência, energia ou monitoramento de estado",loadingEntities:"Carregando entidades...",loading:"Carregando...",failedToLoadEntities:"Falha ao carregar entidades: {{error}}",noEntitiesMatching:'Nenhuma entidade encontrada correspondente a "{{search}}"',noEntitiesAvailable:"Nenhuma entidade disponível",searchingEntities:"Buscando todas as entidades ({{count}} encontradas)",showingEntities:"Mostrando switch, light, input_boolean ({{count}} disponíveis)",energyMonitoringOptional:"Monitoramento de energia (Opcional)",energyMonitoringHint:"Pesquise e selecione sensores que fornecem dados de potência/energia.",powerSensorW:"Sensor de potência (W)",energyTodayKwh:"Energia hoje (kWh)",totalEnergyKwh:"Energia total (kWh)",noMatchingSensors:"Nenhum sensor correspondente",none:"Nenhum",mqttNotConfigured:"Broker MQTT não configurado. Defina o endereço do broker em",mqttSettingsPath:"Configurações → Rede → Publicação MQTT",mqttNotConfiguredSuffix:"(você não precisa ativar a publicação, apenas preencha os detalhes do broker).",mqttMonitorOnlyDescription:"Plugues MQTT recebem dados de potência/energia via assinatura MQTT. O controle liga/desliga não está disponível - use seu broker MQTT ou sistema de automação residencial.",powerMonitoring:"Monitoramento de potência",energyMonitoring:"Monitoramento de energia",stateMonitoring:"Monitoramento de estado",optional:"opcional",topic:"Tópico",jsonPath:"Caminho JSON",multiplier:"Multiplicador",onValue:"Valor ON",mqttPowerHint:`O caminho JSON extrai o valor do payload JSON (ex: "power_l1"). Deixe vazio se o tópico publica valores numéricos brutos.
- Use multiplicador 0.001 para mW→W, 1000 para kW→W.`,mqttEnergyHint:`O caminho JSON extrai o valor do payload JSON. Deixe vazio para valores brutos.
- Use multiplicador 0.001 para Wh→kWh, 1000 para MWh→kWh.`,mqttStateHint:`O caminho JSON extrai o valor do payload JSON. Deixe vazio para valores brutos.
- Valor ON: a string exata que significa "ON". Deixe vazio para detecção automática (ON, true, 1).`,noSwitchesInSwitchbar:"Nenhum interruptor na barra",enableSwitchbarHint:'Ative "Mostrar na barra de interruptores" em Configurações > Smart Plugs'},notifications:{providerTypes:{callmebot:"CallMeBot/WhatsApp",ntfy:"ntfy",pushover:"Pushover",telegram:"Telegram",email:"E-mail",discord:"Discord",webhook:"Webhook",homeassistant:"Home Assistant"},providerDescriptions:{email:"Notificações por e-mail SMTP",telegram:"Notificações via bot do Telegram",discord:"Enviar para canal do Discord via webhook",ntfy:"Notificações push gratuitas e auto-hospedáveis",pushover:"Notificações push simples e confiáveis",callmebot:"Notificações gratuitas via WhatsApp pelo CallMeBot",webhook:"POST HTTP genérico para qualquer URL",homeassistant:"Notificações persistentes no painel do Home Assistant"},lastSuccess:"Último: {{date}}",error:"Erro",printer:"Impressora:",allPrinters:"Todas as impressoras",sendTestNotification:"Enviar Notificação de Teste",eventSettings:"Configurações de Eventos",enabled:"Ativado",sendFromProvider:"Enviar notificações deste provedor",printEvents:"Eventos de Impressão",printerStatus:"Status da Impressora",amsAlarms:"Alarmes do AMS",amsHtAlarms:"Alarmes do AMS-HT",printQueue:"Fila de Impressão",start:"Início",plateCheck:"Verificação da Mesa",complete:"Concluído",failed:"Falhou",stopped:"Parado",progress:"Progresso",offline:"Offline",lowFilament:"Filamento Baixo",maintenance:"Manutenção",amsHumidity:"Umidade do AMS",amsTemp:"Temp. do AMS",amsHtHumidity:"Umidade do AMS-HT",amsHtTemp:"Temp. do AMS-HT",bedCooled:"Mesa Resfriada",quiet:"Silencioso",digest:"Resumo {{time}}",printStarted:"Impressão Iniciada",plateNotEmpty:"Mesa Não Vazia",plateNotEmptyDescription:"Objetos detectados antes da impressão",printCompleted:"Impressão Concluída",bedCooledLabel:"Mesa Resfriada",bedCooledDescription:"Mesa resfriou abaixo do limite após a impressão",printFailed:"Impressão Falhou",printStopped:"Impressão Parada",progressMilestones:"Marcos de Progresso",progressMilestonesDescription:"Notificar em 25%, 50%, 75%",printerOffline:"Impressora Offline",printerError:"Erro da Impressora",lowFilamentLabel:"Filamento Baixo",maintenanceDue:"Manutenção Necessária",maintenanceDueDescription:"Notificar quando manutenção for necessária",amsHumidityHigh:"Umidade Alta do AMS",amsHumidityHighDescription:"Umidade do AMS regular excede o limite",amsTemperatureHigh:"Temperatura Alta do AMS",amsTemperatureHighDescription:"Temperatura do AMS regular excede o limite",amsHtHumidityHigh:"Umidade Alta do AMS-HT",amsHtHumidityHighDescription:"Umidade do AMS-HT excede o limite",amsHtTemperatureHigh:"Temperatura Alta do AMS-HT",amsHtTemperatureHighDescription:"Temperatura do AMS-HT excede o limite",jobAdded:"Trabalho Adicionado",jobAddedDescription:"Trabalho adicionado à fila",jobAssigned:"Trabalho Atribuído",jobAssignedDescription:"Trabalho baseado em modelo atribuído à impressora",jobStarted:"Trabalho Iniciado",jobStartedDescription:"Trabalho da fila começou a imprimir",jobWaiting:"Trabalho Aguardando",jobWaitingDescription:"Trabalho aguardando filamento",jobSkipped:"Trabalho Pulado",jobSkippedDescription:"Trabalho pulado (anterior falhou)",jobFailed:"Trabalho Falhou",jobFailedDescription:"Trabalho falhou ao iniciar",queueComplete:"Fila Concluída",queueCompleteDescription:"Todos os trabalhos da fila finalizados",quietHours:"Horário de Silêncio",noNotificationsDuring:"Sem notificações durante essas horas",editProviderToChangeQuietHours:"Edite o provedor para alterar o horário de silêncio",dailyDigest:"Resumo Diário",batchNotifications:"Agrupar notificações em um único resumo diário",sendAt:"Enviar às {{time}}",editProviderToChangeDigestTime:"Edite o provedor para alterar o horário do resumo",edit:"Editar",deleteProvider:"Excluir Provedor de Notificação",deleteConfirm:'Tem certeza que deseja excluir "{{name}}"? Isso não pode ser desfeito.',delete:"Excluir",addTitle:"Adicionar Provedor de Notificação",editTitle:"Editar Provedor de Notificação",nameLabel:"Nome *",namePlaceholder:"Minhas Notificações",providerTypeLabel:"Tipo de Provedor *",configuration:"Configuração",testConfiguration:"Testar Configuração",printerFilter:"Filtro de Impressora",onlyFromPrinter:"Enviar notificações apenas para eventos desta impressora",quietHoursDnd:"Horário de Silêncio (Não Perturbe)",quietStart:"Início",quietEnd:"Fim",dailyDigestLabel:"Resumo Diário",sendDigestAt:"Enviar resumo às",digestCollected:"Os eventos serão coletados e enviados como um único resumo neste horário",notificationEvents:"Eventos de Notificação",progressPercent:"(25%, 50%, 75%)",bedCooledAfterPrint:"(após conclusão da impressão)",cancel:"Cancelar",save:"Salvar",add:"Adicionar",nameRequired:"Nome é obrigatório",fieldRequired:"{{field}} é obrigatório",phoneNumber:"Número de Telefone",apiKey:"Chave da API",serverUrl:"URL do Servidor",topic:"Tópico",authToken:"Token de Autenticação",userKey:"Chave do Usuário",appToken:"Token do Aplicativo",priority:"Prioridade",botToken:"Token do Bot",chatId:"ID do Chat",smtpServer:"Servidor SMTP",smtpPort:"Porta SMTP",security:"Segurança",authentication:"Autenticação",username:"Usuário",password:"Senha",fromEmail:"E-mail de Origem",toEmail:"E-mail de Destino",webhookUrl:"URL do Webhook",payloadFormat:"Formato do Payload",authorization:"Autorização",titleFieldName:"Nome do Campo de Título",messageFieldName:"Nome do Campo de Mensagem",editTemplate:"Editar Modelo: {{name}}",titleLabel:"Título",bodyLabel:"Corpo",titlePlaceholder:"Título da notificação...",bodyPlaceholder:"Corpo da notificação...",availableVariables:"Variáveis Disponíveis",clickToInsert:"Clique para inserir na posição do cursor no corpo",livePreview:"Pré-visualização ao Vivo",hide:"Ocultar",show:"Mostrar",loadingPreview:"Carregando pré-visualização...",enterTemplateContent:"Insira o conteúdo do modelo para ver a pré-visualização",titlePreview:"Título:",bodyPreview:"Corpo:",resetToDefault:"Restaurar Padrão",titleRequired:"Título é obrigatório",bodyRequired:"Corpo é obrigatório",notificationLog:"Registro de Notificações",showFailedOnly:"Apenas falhas",last24Hours:"Últimas 24 horas",last7Days:"Últimos 7 dias",last30Days:"Últimos 30 dias",last90Days:"Últimos 90 dias",justNow:"Agora mesmo",noFailedNotifications:"Nenhuma notificação com falha",noNotificationsLogged:"Nenhuma notificação registrada",unknownProvider:"Provedor Desconhecido",logTitle:"Título",logMessage:"Mensagem",logError:"Erro",logProvider:"Provedor: {{type}}",logTime:"Hora: {{time}}",refresh:"Atualizar",clearOld:"Limpar Antigos",statsSummary:"Últimos {{days}} dias:",statsNotifications:"notificações",statsSent:"{{count}} enviadas",statsFailed:"{{count}} com falha",eventTypes:{print_start:"Impressão Iniciada",print_complete:"Impressão Concluída",print_failed:"Impressão Falhou",print_stopped:"Impressão Parada",print_progress:"Progresso",printer_offline:"Impressora Offline",printer_error:"Erro da Impressora",filament_low:"Filamento Baixo",maintenance_due:"Manutenção Necessária",test:"Teste"}},richTextEditor:{bold:"Negrito",italic:"Itálico",underline:"Sublinhado",bulletList:"Lista com marcadores",numberedList:"Lista numerada",alignLeft:"Alinhar à esquerda",alignCenter:"Centralizar",alignRight:"Alinhar à direita",addLink:"Adicionar link",removeLink:"Remover link"},externalLinks:{noLinksConfigured:"Nenhum link externo configurado",deleteLink:"Excluir link",removeCustomIcon:"Remover ícone personalizado",openInNewTab:"Abrir em nova aba",placeholders:{linkName:"Meu Link"}},keyboardShortcuts:{title:"Atalhos de Teclado",navigation:"Navegação",archivesSection:"Arquivos",kProfilesSection:"K-Profiles",generalSection:"Geral",shortcuts:{goToPrinters:"Ir para Impressoras",goToArchives:"Ir para Arquivos",goToQueue:"Ir para Fila",goToStats:"Ir para Estatísticas",goToProfiles:"Ir para Perfis na Nuvem",goToSettings:"Ir para Configurações",focusSearch:"Focar na pesquisa",openUploadModal:"Abrir modal de upload",clearSelection:"Limpar seleção / desfocar input",contextMenu:"Menu de contexto nos cartões",refreshProfiles:"Atualizar perfis",newProfile:"Novo perfil",exitSelectionMode:"Sair do modo de seleção",showHelp:"Mostrar esta ajuda"},footer:"Pressione Esc ou clique fora para fechar"},notificationLog:{title:"Registro de Notificações",events:{printStarted:"Impressão Iniciada",printComplete:"Impressão Concluída",printFailed:"Impressão Falhou",printStopped:"Impressão Interrompida",progress:"Progresso",printerOffline:"Impressora Offline",printerError:"Erro na Impressora",lowFilament:"Filamento Baixo",maintenanceDue:"Manutenção Pendente",test:"Teste"},timeAgo:{justNow:"Agora mesmo",minutesAgo:"há {{minutes}} minutos",hoursAgo:"há {{hours}} horas"}},restoreBackup:{title:"Restaurar Backup",restoring:"Restaurando...",restoreComplete:"Restauração Concluída",restoreFailed:"Falha na Restauração",importSettings:"Importar configurações de um arquivo de backup",pleaseWait:"Aguarde enquanto seus dados estão sendo restaurados",clickToSelect:"Clique para selecionar o arquivo de backup (.json ou .zip)",howDuplicateHandling:"Como funciona o tratamento de duplicatas:",categories:{printers:"Impressoras",smartPlugs:"Tomadas Inteligentes",notificationProviders:"Provedores de Notificação",filaments:"Filamentos",archives:"Arquivos",pendingUploads:"Uploads Pendentes",settingsTemplates:"Configurações e Modelos"},matchingInfo:{printers:"correspondem pelo número de série",smartPlugs:"correspondem pelo endereço IP",notificationProviders:"correspondem pelo nome",filaments:"correspondem pelo nome + tipo + marca",archives:"correspondem pelo hash do conteúdo",pendingUploads:"correspondem pelo nome do arquivo",settingsTemplates:"sempre sobrescrito"},replaceExisting:"Substituir dados existentes",keepExisting:"Manter dados existentes",replaceDescription:"Substituir itens que já existem com os dados do backup",keepDescription:"Restaurar apenas itens que não existem",caution:"Atenção:",cautionText:"Sobrescrever substituirá suas configurações atuais pelos dados do backup. Os códigos de acesso da impressora nunca são sobrescritos por segurança.",itemsRestored:"Itens Restaurados",itemsSkipped:"Itens Ignorados",restored:"Restaurado",skipped:"Ignorado (já existe)",filesLabel:"Arquivos (3MF, miniaturas, etc.)",newApiKeysGenerated:"Novas Chaves API Geradas",newApiKeysWarning:"Essas chaves são exibidas apenas uma vez. Copie-as agora!",processingBackup:"Processando arquivo de backup...",noDataFound:"Nenhum dado foi encontrado para restaurar no arquivo de backup.",failedToRestore:"Falha ao restaurar o backup. Verifique o formato do arquivo."},backupExport:{title:"Exportar Backup",selectData:"Selecione os dados a incluir",selectAll:"Selecionar Todos",selectNone:"Selecionar Nenhum",categoryDescriptions:{settings:"Idioma, tema, preferências de atualização",notifications:"ntfy, Pushover, Discord, etc.",templates:"Modelos de mensagens personalizadas",smartPlugs:"Configurações de tomadas Tasmota",externalLinks:"Links da barra lateral para serviços externos",printers:"Informações da impressora (códigos de acesso excluídos)",plateDetection:"Imagens de referência de placa vazia",filaments:"Tipos e custos de filamento",maintenance:"Cronogramas de manutenção personalizados",archives:"Todos os dados de impressão + arquivos (3MF, miniaturas, fotos)",projects:"Projetos, itens de BOM e anexos",pendingUploads:"Uploads de impressora virtual aguardando revisão",apiKeys:"Chaves API de webhook (novas chaves geradas na importação)"},requiresPrinters:"Requer que as impressoras sejam selecionadas",zipFileWarning:"Um arquivo ZIP será criado.",zipFileDescription:"Inclui todos os arquivos 3MF, miniaturas, timelapses e fotos. Isso pode levar algum tempo e resultar em um arquivo grande.",includeAccessCodes:"Incluir Códigos de Acesso",includeAccessCodesDescription:"Para transferir para outra máquina",includeAccessCodesWarning:"Os códigos de acesso serão incluídos em texto simples. Mantenha este arquivo de backup seguro!",categoriesSelected:"{{selectedCount}} categorias selecionadas"},pendingUploads:{placeholders:{notes:"Adicione notas sobre esta impressão..."},discardUpload:"Descartar Upload",archiveAllUploads:"Arquivar Todos os Uploads",discardAllUploads:"Descartar Todos os Uploads",archive:"Arquivar",timeAgo:{justNow:"Agora mesmo",minutesAgo:"há {{minutes}} minutos",hoursAgo:"há {{hours}} horas",daysAgo:"há {{days}} dias"}},apiBrowser:{placeholders:{requestBody:"Corpo da requisição JSON...",searchEndpoints:"Pesquisar endpoints..."}},configureAmsSlot:{title:"Configurar Slot AMS",slotConfigured:"Slot Configurado!",configuringSlot:"Configurando slot:",slotLabel:"{{ams}} Slot {{slot}}",searchPresets:"Pesquisar predefinições...",colorPlaceholder:"Nome da cor ou hex (ex.: marrom, FF8800)",clearCustomColor:"Limpar cor personalizada",noCloudPresets:"Nenhuma predefinição na nuvem. Faça login no Bambu Cloud para sincronizar.",noPresetsAvailable:"Nenhuma predefinição disponível. Faça login no Bambu Cloud ou importe perfis locais.",noMatchingPresets:"Nenhuma predefinição correspondente encontrada.",custom:"Personalizado",builtin:"Integrado",settingsSentToPrinter:"Configurações enviadas para a impressora",filamentProfile:"Perfil de Filamento",kProfileLabel:"Perfil K (Avanço de Pressão)",filteringFor:"Filtrando por: {{material}}",noKProfile:"Nenhum perfil K (usar padrão 0.020)",noMatchingKProfiles:"Nenhum perfil K correspondente encontrado. O K padrão=0.020 será usado.",selectFilamentFirst:"Selecione um perfil de filamento primeiro",kFromCalibration:"K={{value}} da calibração da impressora",customColorLabel:"Cor Personalizada (opcional)",presetColors:"Cores de {{name}}:",showLessColors:"Mostrar menos cores",showMoreColors:"Mostrar mais cores",clear:"Limpar",hexLabel:"Hex: #{{hex}}",resetting:"Redefinindo...",resetSlot:"Redefinir Slot",cancel:"Cancelar",configuring:"Configurando...",configureSlot:"Configurar Slot"},githubBackup:{title:"Backup do GitHub",history:"Histórico",downloadBackup:"Baixar Backup",restoreBackup:"Restaurar Backup",noBackupsYet:"Nenhum backup ainda"},emailSettings:{placeholders:{fromName:"BamBuddy"}},tagManagement:{searchTags:"Pesquisar tags...",renameTag:"Renomear tag",deleteTag:"Excluir tag"},notificationTemplates:{placeholders:{title:"Título da notificação...",body:"Corpo da notificação..."}},batchTag:{placeholders:{newTag:"Digite uma nova tag..."}},photoGallery:{deletePhoto:"Excluir foto"},filamentHoverCard:{copySpoolUuid:"Copiar UUID do carretel"},kProfilesView:{hasNote:"Possui nota",copyProfile:"Copiar perfil"},layout:{openMenu:"Abrir menu",noPermissionSystemInfo:"Você não tem permissão para visualizar informações do sistema"},dashboard:{dragToReorder:"Arrastar para reordenar",hideWidget:"Ocultar widget"},notificationProviderCard:{deleteNotificationProvider:"Excluir provedor de notificação"},fileManagerModal:{closeFileManager:"Fechar gerenciador de arquivos",sortFiles:"Ordenar arquivos",goToParentFolder:"Ir para a pasta pai",threeView:"Visualização 3D"},embeddedCameraViewer:{refreshStream:"Atualizar stream",close:"Fechar",zoomOut:"Reduzir zoom",resetZoom:"Redefinir zoom",zoomIn:"Aumentar zoom",dragToResize:"Arrastar para redimensionar"},timelapseViewer:{skipBack5s:"Voltar 5s",skipForward5s:"Avançar 5s"},notificationProviders:{descriptions:{email:"Notificações por email SMTP",telegram:"Notificações via bot do Telegram",discord:"Enviar para canal do Discord via webhook",ntfy:"Notificações push gratuitas e auto-hospedáveis",pushover:"Notificações push simples e confiáveis",callmebot:"Notificações gratuitas via WhatsApp pelo CallMeBot",webhook:"POST HTTP genérico para qualquer URL"}},logViewer:{searchPlaceholder:"Pesquisar mensagem ou nome do logger...",noLogEntries:"Nenhuma entrada de log encontrada"},switchbarPopover:{noSwitchesInSwitchbar:"Nenhum switch na barra de switches"},projectPageModal:{placeholders:{title:"Título",designer:"Designer",license:"Licença",description:"Digite a descrição...",profileTitle:"Título do perfil",profileDescription:"Descrição do perfil..."}},spoolmanSettings:{},time:{unknown:"-",waiting:"Aguardando",justNow:"Agora mesmo",now:"Agora",minsAgo:"{{count}}min atrás",inMins:"em {{count}}min",hoursAgo:"{{count}}h atrás",inHours:"em {{count}}h",daysAgo:"{{count}}d atrás",inDays:"em {{count}}d"},spoolbuddy:{nav:{dashboard:"Painel",ams:"AMS",inventory:"Inventário",writeTag:"Escrever",settings:"Configurações"},status:{nfcReady:"NFC pronto",nfcOff:"NFC desligado",offline:"Offline",online:"Online",noPrinters:"Sem impressoras",deviceOffline:"Dispositivo offline",waitingConnection:"Aguardando conexão do dispositivo...",systemReady:"Sistema pronto",status:"Status"},dashboard:{readyToScan:"Pronto para escanear",idleMessage:"Coloque um carretel na balança para identificá-lo",nfcHint:"A tag NFC será lida automaticamente",device:"Dispositivo",syncWeight:"Sincronizar peso",weightSynced:"Sincronizado!",unknownTag:"Tag desconhecida",newTag:"Nova tag detectada",onScale:"na balança",linkSpool:"Vincular ao carretel",linkTagTitle:"Vincular tag ao carretel",linkTag:"Vincular tag",selectSpool:"Selecione um carretel para vincular a esta tag:",noUntagged:"Nenhum carretel sem tag encontrado",tagDetected:"Tag detectada",noTag:"Sem tag",tagId:"Tag",grossWeight:"Peso bruto",spoolSize:"Tamanho do carretel",close:"Fechar",currentSpool:"Carretel Atual"},modal:{spoolDetected:"Carretel Detectado",assignToAms:"Atribuir ao AMS",syncWeight:"Sincronizar Peso",weightSynced:"Sincronizado!",syncing:"Sincronizando...",newTagDetected:"Nova Tag Detectada",addToInventory:"Adicionar ao Inventário",assignToAmsTitle:"Atribuir ao AMS",selectSlot:"Selecionar um slot",assign:"Atribuir",assigning:"Atribuindo...",assignSuccess:"Atribuído!",assignError:"Falha ao atribuir carretel. Tente novamente.",noPrinterSelected:"Selecionar uma impressora...",noAmsDetected:"Nenhum AMS detectado nesta impressora",slot:"Slot"},weight:{noReading:"Sem leitura",stable:"Estável",measuring:"Medindo...",tare:"Tarar",calibrate:"Calibrar"},spool:{remaining:"Restante",material:"Material",brand:"Marca",color:"Cor",coreWeight:"Núcleo",labelWeight:"Rótulo",scaleWeight:"Balança",netWeight:"Líquido",lastUsed:"Último uso"},ams:{noData:"Nenhum AMS detectado",connectAms:"Conecte um AMS para ver os slots",noPrinter:"Nenhuma impressora selecionada",selectPrinter:"Selecione uma impressora na barra superior",printerDisconnected:"Impressora desconectada",humidity:"Umidade",level:"Nível",active:"Ativo",slot:"Slot",empty:"Vazio"},inventory:{search:"Buscar carretéis...",empty:"Nenhum carretel no inventário",noResults:"Nenhum carretel correspondente",spools:"carretéis",addSpool:"Adicionar carretel"},settings:{tabDevice:"Dispositivo",tabDisplay:"Tela",tabScale:"Balança",tabUpdates:"Atualizações",nfcReader:"Leitor NFC",type:"Tipo",connection:"Conexão",notConnected:"N/A",deviceInfo:"Info do dispositivo",hostname:"Host",uptime:"Tempo de atividade",brightness:"Brilho",saved:"Salvo",noBacklight:"Nenhuma retroiluminação DSI detectada. O controle de brilho requer uma tela DSI.",screenBlank:"Tempo para desligar tela",screenBlankDesc:"A tela desliga após inatividade. Toque para despertar.",displayNote:"O brilho é aplicado como filtro de software.",scaleCalibration:"Calibração da balança",currentWeight:"Peso atual",tareOffset:"Tara",calFactor:"Fator",knownWeight:"Peso conhecido",calStep1:"Remova todos os itens da balança e pressione Definir zero.",calStep2:"Coloque o peso conhecido na balança.",setZero:"Definir zero",calibrateNow:"Calibrar",calibrated:"Calibrado",tareSet:"Comando de tara enviado. Aguardando dispositivo...",tareFailed:"Falha ao enviar comando de tara",zeroSet:"Ponto zero definido. Coloque o peso conhecido na balança.",calibrationDone:"Calibração concluída!",calibrationFailed:"Falha na calibração",lastCalibrated:"Última calibração",stable:"Estável",settling:"Estabilizando...",firmware:"Firmware",scale:"Balança",noDevice:"Nenhum dispositivo SpoolBuddy encontrado",daemonVersion:"Versão do daemon",currentVersion:"Atual",versionPending:"Aguardando daemon...",checking:"Verificando...",checkUpdates:"Verificar atualizações",updateAvailable:"Atualização disponível",updateInstructions:"Atualize via SSH: execute o script de instalação do SpoolBuddy.",upToDate:"Atualizado",includeBeta:"Incluir versões beta"},writeTag:{tabExisting:"Bobina existente",tabNew:"Nova bobina",tabReplace:"Substituir tag",searchPlaceholder:"Buscar por material, cor, marca...",noUntaggedSpools:"Nenhuma bobina sem tag",noTaggedSpools:"Nenhuma bobina com tag",selectSpool:"Selecione uma bobina e coloque um NTAG no leitor",placeTag:"Coloque um NTAG no leitor",tagReady:"Tag detectado — pronto para gravar",writeTag:"Gravar Tag",replaceTag:"Substituir Tag",writing:"Gravando tag...",waiting:"Aguardando SpoolBuddy...",writeSuccess:"Tag gravado com sucesso!",writeFailed:"Falha na gravação",queueFailed:"Falha ao enfileirar comando de gravação",tryAgain:"Tentar novamente",cancel:"Cancelar",replaceWarning:"O tag antigo será desvinculado. O novo tag o substituirá.",deviceOffline:"SpoolBuddy está offline",material:"Material",colorName:"Nome da cor",color:"Cor",brand:"Marca",weight:"Peso (g)",createSpool:"Criar bobina",creating:"Criando...",spoolCreated:"Bobina criada! Pronto para gravar.",createFailed:"Falha ao criar bobina"}},bugReport:{title:"Reportar um bug",description:"Descrição",descriptionPlaceholder:"O que deu errado? Por favor, descreva o problema...",email:"Email (opcional)",emailPlaceholder:"seu@email.com.br",emailPrivacy:"Se fornecido, seu email será incluído em uma seção recolhida da issue no GitHub para que o mantenedor possa entrar em contato.",screenshot:"Captura de tela",uploadOrPaste:"Enviar, colar ou arrastar uma imagem",dataCollectedSummary:"Quais dados são incluídos no relatório?",dataIncluded:"Incluídos:",dataIncludedList:"Versão do app, SO, arquitetura, versão Python, estatísticas do banco de dados (apenas contagens), modelos de impressora, quantidade de bicos, versões de firmware, status de conexão, status de integrações (Spoolman, MQTT, HA), configurações não sensíveis, contagem de interfaces de rede, detalhes Docker, versões de dependências.",dataNeverIncluded:"Nunca incluídos:",dataNeverIncludedList:"Nomes de impressoras, números de série, códigos de acesso, senhas, endereços IP, endereços de email, chaves de API, tokens, URLs de webhook, nomes de host ou nomes de usuário.",submit:"Enviar",collectingLogs:"Coletando logs de diagnóstico...",collectingLogsHint:"Log de depuração ativado, consultando impressoras para dados atualizados.",submitting:"Enviando relatório de bug...",submitSuccess:"Relatório de bug enviado com sucesso!",submitFailed:"Falha ao enviar relatório de bug",thankYou:"Obrigado!",submitted:"Seu relatório de bug foi enviado.",viewIssue:"Ver issue",unexpectedError:"Ocorreu um erro inesperado",countdownSeconds:"{{seconds}}s"}},nde={nav:{printers:"打印机",archives:"归档",queue:"队列",stats:"统计",profiles:"配置文件",maintenance:"维护",projects:"项目",inventory:"耗材",files:"文件管理器",settings:"设置",system:"系统",collapseSidebar:"收起侧边栏",expandSidebar:"展开侧边栏",update:"更新",updateAvailable:"有可用更新:v{{version}}",updateAvailableBanner:"版本 {{version}} 已发布!",viewUpdate:"查看更新",viewOnGithub:"在 GitHub 上查看",keyboardShortcuts:"键盘快捷键 (?)",switchToLight:"切换到浅色模式",switchToDark:"切换到深色模式",smartSwitches:"智能开关",logout:"退出登录"},common:{save:"保存",saving:"保存中...",cancel:"取消",delete:"删除",edit:"编辑",add:"添加",close:"关闭",confirm:"确认",loading:"加载中...",error:"错误",success:"成功",warning:"警告",enabled:"已启用",disabled:"已禁用",yes:"是",no:"否",on:"开",off:"关",all:"全部",none:"无",search:"搜索",filter:"筛选",sort:"排序",refresh:"刷新",download:"下载",upload:"上传",uploading:"上传中...",uploadFailed:"上传失败",actions:"操作",status:"状态",name:"名称",description:"描述",date:"日期",time:"时间",hours:"小时",minutes:"分钟",seconds:"秒",days:"天",enable:"启用",disable:"禁用",permissions:"权限",noPrinters:"未配置打印机",noData:"暂无数据",linkNotFound:"未找到链接",required:"必填",optional:"可选",dismiss:"关闭",apply:"应用",reset:"重置",export:"导出",import:"导入",clear:"清除",selectAll:"全选",deselectAll:"取消全选",noChange:"— 不更改 —",unchanged:"未更改",unassigned:"未分配",unknown:"未知",unknownError:"未知错误",today:"今天",tomorrow:"明天",asap:"尽快",overdue:"已逾期",now:"现在",collapse:"收起",expand:"展开",viewArchive:"查看归档",viewInFileManager:"在文件管理器中查看",addedBy:"由 {{username}} 添加",prints:"次打印",more:"还有 {{count}} 个",ascending:"升序",descending:"降序",printer:"打印机",remove:"移除",type:"类型",print:"打印",rename:"重命名",move:"移动",create:"创建",duplicate:"复制",left:"左",right:"右"},printers:{title:"打印机",addPrinter:"添加打印机",editPrinter:"编辑打印机",deletePrinter:"删除打印机",printerName:"打印机名称",serialNumber:"序列号",ipAddress:"IP 地址 / 主机名",accessCode:"访问码",model:"型号",nozzleCount:"喷嘴数量",autoArchive:"自动归档",status:{available:"可用",idle:"空闲",printing:"打印中",paused:"已暂停",offline:"离线",error:"错误",finished:"已完成",unknown:"未知"},temperatures:{nozzle:"喷嘴",bed:"热床",chamber:"腔室"},progress:"{{percent}}% 完成",timeRemaining:"剩余 {{time}}",deleteConfirm:'确定要删除"{{name}}"吗?',maintenanceOk:"维护正常",maintenanceWarning:"{{count}} 个警告",maintenanceWarning_plural:"{{count}} 个警告",maintenanceDue:"{{count}} 个到期",maintenanceDue_plural:"{{count}} 个到期",sort:{name:"名称",status:"状态",model:"型号",location:"位置",ascending:"升序排列",descending:"降序排列"},cardSize:{small:"小卡片",medium:"中卡片",large:"大卡片",extraLarge:"超大卡片"},hideOffline:"隐藏离线",nextAvailable:"下一个可用",powerOn:"开机",offlinePrintersWithPlugs:"带智能插座的离线打印机",noPrintersConfigured:"尚未配置打印机",readyToPrint:"准备打印",external:"外部",extL:"外置左",extR:"外置右",deleteArchives:"删除打印归档",noLabel:"无标签",printPreview:"打印预览",width:"宽度",height:"高度",noObjectsFound:"未找到对象",objectsLoadedOnPrintStart:"对象在打印开始时加载",willBeSkipped:"将被跳过",name:"名称",serialCannotBeChanged:"序列号无法更改",locationHelp:"用于分组打印机和筛选队列任务",wifiSignal:{veryWeak:"非常弱",weak:"弱",fair:"一般",good:"良好",excellent:"优秀"},maintenanceUpToDate:"所有维护均已完成 - 点击查看",chamberLightOn:"打开腔室灯",chamberLightOff:"关闭腔室灯",files:"文件",browseFiles:"浏览打印机文件",autoOffAfterPrint:"打印后自动关机",autoOffExecuted:"已执行自动关机 - 开启打印机以重置",hmsErrors:"HMS 错误",viewHmsErrors:"查看 {{count}} 个 HMS 错误",resume:"继续",pause:"暂停",stop:"停止",camera:"摄像头",skipObject:"跳过对象",reconnect:"重新连接",mqttDebug:"MQTT 调试",printerInformation:"打印机信息",copyToClipboard:"复制",copied:"已复制!",state:"状态",wifiSignalLabel:"WiFi 信号",developerMode:"开发者模式",enabled:"已启用",disabled:"已禁用",addedOn:"添加日期",sdCard:"SD 卡",inserted:"已插入",notInserted:"未插入",totalPrintHours:"打印时长",activeNozzle:"当前:{{nozzle}} 喷嘴",nozzleRack:"喷嘴架",nozzleDocked:"已停靠",nozzleMounted:"已安装",nozzleActive:"使用中",nozzleIdle:"空闲",nozzleDiameter:"直径",nozzleType:"类型",nozzleStatus:"状态",nozzleFilament:"耗材",nozzleWear:"磨损",nozzleMaxTemp:"最高温度",nozzleSerial:"序列号",nozzleHardenedSteel:"硬化钢",nozzleStainlessSteel:"不锈钢",nozzleTungstenCarbide:"碳化钨",nozzleFlow:"流量",nozzleHighFlow:"高流量",nozzleStandardFlow:"标准",firmwareUpdate:"固件更新",firmwareInstructions:"在打印机触摸屏上,前往",firmwareNav:"导航到",settings:"设置",firmware:"固件",discoverPrinters:"发现打印机",searching:"搜索中...",manualEntry:"手动输入",addFromCloud:"从云端添加",toast:{printerDeleted:"打印机已删除",printerAdded:"打印机已添加",printerUpdated:"打印机已更新",failedToDelete:"删除打印机失败",failedToAdd:"添加打印机失败",failedToUpdate:"更新打印机失败",commandSent:"命令已发送",failedToSendCommand:"发送命令失败",turnedOn:"{{name}} 已开启",failedToPowerOn:"开启 {{name}} 失败",scriptTriggered:"脚本已触发",printStopped:"打印已停止",printPaused:"打印已暂停",printResumed:"打印已继续",referenceDeleted:"参考已删除",detectionAreaSaved:"检测区域已保存",failedToRunScript:"运行脚本失败",failedToStopPrint:"停止打印失败",failedToPausePrint:"暂停打印失败",failedToResumePrint:"继续打印失败",failedToControlChamberLight:"控制腔室灯失败",failedToUpdateSetting:"更新设置失败",failedToSkipObjects:"跳过对象失败",failedToRereadRfid:"重新读取 RFID 失败",failedToCheckPlate:"检查打印板失败",failedToUpdateLabel:"更新标签失败",failedToDeleteReference:"删除参考失败",failedToSaveDetectionArea:"保存检测区域失败",plateCheckEnabled:"打印板检查已启用",plateCheckDisabled:"打印板检查已禁用",calibrationSaved:"校准已保存!",calibrationFailed:"校准失败",rfidRereadInitiated:"已发起 RFID 重新读取"},connection:{connected:"已连接",offline:"离线"},queue:{inQueue:"队列中有 {{count}} 个打印任务",inQueue_plural:"队列中有 {{count}} 个打印任务"},controls:"控制",rfid:{reread:"重新读取 RFID"},permission:{noAdd:"您没有添加打印机的权限",noEdit:"您没有编辑打印机的权限",noDelete:"您没有删除打印机的权限",noControl:"您没有控制打印机的权限",noFiles:"您没有访问打印机文件的权限",noAmsRfid:"您没有重新读取 AMS RFID 的权限",noSmartPlugControl:"您没有控制智能插座的权限",noCamera:"您没有查看摄像头的权限"},modal:{addTitle:"添加打印机",editTitle:"编辑打印机",myPrinter:"我的打印机",selectModel:"选择型号...",locationGroup:"位置 / 分组(可选)",locationPlaceholder:"例如:工作室、办公室、地下室",autoArchiveLabel:"自动归档已完成的打印",fromPrinterSettings:"来自打印机设置",modelOptional:"型号(可选)",saveChanges:"保存更改"},skipObjects:{tooltip:"跳过对象",onlyWhilePrinting:"跳过对象(仅在打印时)",requiresMultiple:"跳过对象(需要2个以上对象)",title:"跳过对象",matchIdsInfo:"将 ID 与打印机显示屏上的 ID 进行对照",printerShowsIds:"打印机屏幕上显示构建板上对象的 ID",skipSelected:"跳过所选",skipping:"跳过中...",noObjectsSelected:"未选择对象",selectObjectsToSkip:"选择要从当前打印中跳过的对象",skipped:"已跳过",objectsSkipped:"对象已跳过",activeCount:"{{count}} 个活跃",waitForLayer:"等待第2层以上才能跳过对象(当前第 {{layer}} 层)",skip:"跳过",confirmTitle:"跳过对象?",confirmMessage:'确定要跳过"{{name}}"吗?此操作无法撤销。'},confirm:{deleteTitle:"删除打印机",deleteMessage:'确定要删除"{{name}}"吗?这将移除所有连接设置。',deleteArchivesNote:"此打印机的所有打印历史将被永久删除。",keepArchivesNote:"打印历史将保留,但不再与此打印机关联。",stopTitle:"停止打印",stopMessage:'确定要停止"{{name}}"上的当前打印吗?这将取消打印任务。',stopButton:"停止打印",pauseTitle:"暂停打印",pauseMessage:'确定要暂停"{{name}}"上的当前打印吗?',pauseButton:"暂停打印",resumeTitle:"继续打印",resumeMessage:'确定要继续"{{name}}"上的打印吗?',resumeButton:"继续打印",powerOnTitle:"开启打印机",powerOnMessage:'确定要打开"{{name}}"的电源吗?',powerOnButton:"开机",powerOffTitle:"关闭打印机",powerOffMessage:'确定要关闭"{{name}}"的电源吗?',powerOffWarning:'警告:"{{name}}"正在打印中!确定要关闭电源吗?这将中断打印并可能损坏打印机。',powerOffButton:"关机"},discovery:{title:"发现打印机",searching:"搜索中...",scanning:"扫描中...",scanProgress:"扫描中... {{scanned}}/{{total}}",foundPrinters:"发现 {{count}} 台打印机",noPrintersFound:"未找到打印机",noPrintersFoundSubnet:"在指定子网中未找到打印机。",noPrintersFoundNetwork:"在网络上未找到打印机。",allConfigured:"所有发现的打印机已配置完毕。",alreadyAdded:"已添加",select:"选择",manualEntry:"手动输入",addFromCloud:"从云端添加",subnetToScan:"要扫描的子网",dockerNote:"检测到 Docker 环境。请以 CIDR 格式输入打印机所在子网。需要在 docker-compose.yml 中设置 network_mode: host。",scanSubnet:"扫描子网查找打印机",discoverNetwork:"在网络上发现打印机",scanningSubnet:"正在扫描子网查找拓竹打印机...",scanningNetwork:"正在扫描网络...",serialRequired:"需要序列号",unknown:"未知",failedToStart:"启动发现失败"},filaments:"耗材",openCameraOverlay:"打开摄像头叠加层",openCameraWindow:"在新窗口中打开摄像头",firmwareUpdateAvailable:"固件更新可用:{{current}} → {{latest}}",firmwareUpToDate:"固件 {{version}} — 已是最新",firmwareUpdateButton:"更新",plateDetection:{noPermission:"您没有更新打印机的权限",enabledClick:"打印板检查已启用 - 点击禁用",disabledClick:"打印板检查已禁用 - 点击启用",manageCalibration:"管理打印板检测校准",calibrationRequired:"需要校准",calibrationInstructions:"请确保构建板<strong>完全空置</strong>,然后点击校准。",calibrationDescription:"校准会拍摄空置打印板的参考图像。后续检查将与此参考进行比较以检测物体。",calibrationTip:"<strong>提示:</strong>您最多可以为不同的打印板存储5个校准。系统会在检查时自动使用最佳匹配。",plateEmpty:"打印板似乎是空的",objectsDetected:"在打印板上检测到物体",confidence:"置信度",difference:"差异",analysisPreview:"分析预览:",analysisLegend:"绿色框 = 检测区域,红色覆盖 = 与校准的差异",savedReferences:"已保存的参考 ({{count}}/{{max}})",deleteReference:"删除参考",labelPlaceholder:"标签...",clickToEdit:"{{label}} - 点击编辑",clickToAddLabel:"点击添加标签"},fans:{partCooling:"零件冷却风扇",auxiliary:"辅助风扇",chamber:"腔室风扇"},clickToViewHmsErrors:"点击查看 HMS 错误",estimatedCompletion:"预计完成时间",slotOptions:"槽位选项",amsPopup:{friendlyName:"AMS 名称",friendlyNamePlaceholder:"例如 AMS 友好名称",serialNumber:"序列号",firmwareVersion:"固件",save:"保存",clear:"清除",noEditPermission:"您没有重命名 AMS 单元的权限"},firmwareModal:{title:"固件更新",titleUpToDate:"固件信息",currentVersion:"当前版本:",latestVersion:"最新版本:",releaseNotes:"发布说明",checkingPrereqs:"正在检查前提条件...",sdCardReady:"SD 卡已就绪。点击下方上传固件。",uploadedSuccess:"固件已上传到 SD 卡!",applyInstructions:"在打印机上应用更新:",step1:"在打印机触摸屏上,前往<strong>设置</strong>",step2:"导航到<strong>固件</strong>",step3:"选择<strong>从 SD 卡更新</strong>",step4:"更新将需要 10-20 分钟",done:"完成",starting:"启动中...",uploadFirmware:"上传固件",uploadFailed:"上传启动失败:{{error}}",uploadedToast:"固件已上传!请在打印机屏幕上触发更新。"},accessCodePlaceholder:"留空以保持当前值",roi:{title:"检测区域 (ROI)",xStart:"X 起点",yStart:"Y 起点",width:"宽度",height:"高度",instruction:"调整检测区域以聚焦到构建板。预览中的绿色框显示当前区域。"},developerModeWarning:"以下打印机未启用开发者局域网模式:{{names}}。某些功能可能无法使用。",howToEnable:"如何启用",incompatibleFile:"此文件是为 {{slicedFor}} 切片的,但该打印机是 {{printerModel}}",dropNotPrintable:"只能打印 .gcode 和 .gcode.3mf 文件",dropToPrint:"拖放以打印",cannotPrint:"打印机忙碌"},archives:{title:"打印归档",searchPlaceholder:"搜索归档...",filterByPrinter:"按打印机筛选",filterByStatus:"按状态筛选",sortBy:"排序方式",sortNewest:"最新优先",sortOldest:"最旧优先",sortName:"名称",sortDuration:"时长",sortLargest:"最大优先",sortSmallest:"最小优先",sortSize:"大小",noArchives:"未找到归档",noArchivesSearch:"没有匹配搜索的归档",noArchivesYet:"暂无归档",loadingArchives:"加载归档中...",releaseToUpload:"释放以上传",showAll:"显示全部",showFavoritesOnly:"仅显示收藏",gridView:"网格视图",listView:"列表视图",calendarView:"日历视图",logView:"打印日志",manageTags:"管理标签",showFailedPrints:"显示失败的打印",hideFailedPrints:"隐藏失败的打印",printTime:"打印时间",filamentUsed:"耗材用量",cost:"成本",reprint:"重新打印",preview:"预览",deleteArchive:"删除归档",deleteConfirm:"确定要删除此归档吗?",favorite:"收藏",unfavorite:"取消收藏",viewDetails:"查看详情",status:{completed:"已完成",failed:"失败",stopped:"已停止"},toast:{source3mfAttached:"源 3MF 已附加:{{filename}}",failedUploadSource3mf:"上传源 3MF 失败",source3mfRemoved:"源 3MF 已移除",failedRemoveSource3mf:"移除源 3MF 失败",f3dAttached:"F3D 已附加:{{filename}}",failedUploadF3d:"上传 F3D 失败",f3dRemoved:"F3D 已移除",failedRemoveF3d:"移除 F3D 失败",timelapseAttached:"延时摄影已附加:{{filename}}",timelapseAlreadyAttached:"延时摄影已附加",noMatchingTimelapse:"未找到匹配的延时摄影",failedScanTimelapse:"扫描延时摄影失败",failedAttachTimelapse:"附加延时摄影失败",timelapseRemoved:"延时摄影已移除",failedRemoveTimelapse:"移除延时摄影失败",timelapseUploaded:"延时摄影已上传:{{filename}}",failedUploadTimelapse:"上传延时摄影失败",archiveDeleted:"归档已删除",failedDeleteArchive:"删除归档失败",addedToFavorites:"已添加到收藏",removedFromFavorites:"已从收藏中移除",projectUpdated:"项目已更新",failedUpdateProject:"更新项目失败",linkCopied:"链接已复制到剪贴板",failedCopyLink:"复制链接失败",photoDeleted:"照片已删除",failedDeletePhoto:"删除照片失败",failedDeleteArchives:"删除归档失败",failedUpdateFavorites:"更新收藏失败",exportDownloaded:"导出已下载",exportFailed:"导出失败"},menu:{print:"打印",schedule:"排程",openInBambuStudio:"在切片软件中打开",slice:"切片",externalLink:"外部链接",viewOnMakerWorld:"在 MakerWorld 上查看",preview3d:"3D 预览",viewTimelapse:"查看延时摄影",scanForTimelapse:"扫描延时摄影",uploadTimelapse:"上传延时摄影",removeTimelapse:"移除延时摄影",downloadSource3mf:"下载源 3MF",uploadSource3mf:"上传源 3MF",replaceSource3mf:"替换源 3MF",removeSource3mf:"移除源 3MF",uploadF3d:"上传 F3D",replaceF3d:"替换 F3D",downloadF3d:"下载 F3D",removeF3d:"移除 F3D",download:"下载",copyDownloadLink:"复制下载链接",qrCode:"二维码",viewPhotos:"查看照片",viewPhotosCount:"查看照片 ({{count}})",projectPage:"项目页面",addToFavorites:"添加到收藏",removeFromFavorites:"从收藏中移除",edit:"编辑",goToProject:"前往项目:{{name}}",addToProject:"添加到项目",removeFromProject:"从项目中移除",loading:"加载中...",noProjectsAvailable:"无可用项目",select:"选择",deselect:"取消选择",delete:"删除"},permission:{noReprint:"您没有重新打印此归档的权限",noAddToQueue:"您没有添加到队列的权限",noUpdateArchives:"您没有更新归档的权限",noUploadFiles:"您没有上传文件的权限",noDownload:"您没有下载归档的权限",noCopyLink:"您没有复制下载链接的权限",noDelete:"您没有删除此归档的权限",noCreate:"您没有创建归档的权限"},card:{previousPlate:"上一个板",nextPlate:"下一个板",plateNumber:"板 {{index}}",moreOptions:"右键查看更多选项",addToFavorites:"添加到收藏",removeFromFavorites:"从收藏中移除",cancelled:"已取消",failed:"失败",duplicate:"重复",duplicateTitle:"此模型之前已打印过",openSource3mf:"在 Bambu Studio 中打开源 3MF(右键查看更多选项)",downloadF3d:"下载 Fusion 360 设计文件",viewTimelapse:"查看延时摄影",viewPhoto:"查看 1 张照片",viewPhotos:"查看 {{count}} 张照片",openFolder:"打开文件夹:{{name}}",slicedFile:"已切片文件 - 可以打印",sourceFile:"仅源文件 - 无 AMS 映射可用",gcode:"GCODE",source:"源文件",project:"项目:{{name}}",estimated:"预计:{{time}}",actual:"实际:{{time}}",accuracy:"准确度:{{percent}}%",filament:"{{weight}}g",layer:"{{count}} 层",layers:"{{count}} 层",object:"{{count}} 个对象",objects:"{{count}} 个对象",slicedFor:"为 {{model}} 切片",uploadedBy:"上传者",noPermissionReprint:"您没有重新打印的权限",noFileForReprint:"无可用的 3MF 文件 — 打印记录时无法从打印机下载该文件",noPermissionEdit:"您没有编辑归档的权限",noPermissionDelete:"您没有删除归档的权限",reprint:"重新打印",schedulePrint:"排程打印",schedule:"排程",openInBambuStudio:"在切片软件中打开",openInBambuStudioToSlice:"在切片软件中打开进行切片",slice:"切片",externalLink:"外部链接",makerWorld:"MakerWorld:{{designer}}",viewProject:"查看项目",noExternalLink:"无外部链接",preview3d:"3D 预览",download:"下载",edit:"编辑",delete:"删除"},modal:{deleteArchive:"删除归档",deleteConfirm:'确定要删除"{{name}}"吗?此操作无法撤销。',deleteButton:"删除",removeSource3mf:"移除源 3MF",removeSource3mfConfirm:'确定要从"{{name}}"中移除源 3MF 文件吗?这将删除原始切片项目文件。',removeButton:"移除",removeF3d:"移除 F3D",removeF3dConfirm:'确定要从"{{name}}"中移除 Fusion 360 设计文件吗?',removeTimelapse:"移除延时摄影",removeTimelapseConfirm:'确定要从"{{name}}"中移除延时摄影视频吗?',timelapse:"{{name}} - 延时摄影",selectTimelapse:"选择延时摄影",selectTimelapseDesc:"未找到自动匹配。请选择此打印的延时摄影:",deleteArchives:"删除归档",deleteArchivesConfirm:"确定要删除 {{count}} 个归档吗?此操作无法撤销。",deleteCount:"删除 {{count}} 个"},page:{title:"归档",printsCount:"{{filtered}} / {{total}} 次打印",dropFilesHere:"将 .3mf 文件拖放到此处",releaseToUpload:"释放以上传",only3mfSupported:"仅支持 .3mf 文件",close:"关闭",selected:"已选择 {{count}} 个",selectAll:"全选",tags:"标签",project:"项目",favorite:"收藏",delete:"删除",toggledFavorites:"已切换 {{count}} 个归档的收藏状态",failedUpdateFavorites:"更新收藏失败",archivesDeleted:"已删除 {{count}} 个归档",failedDeleteArchives:"删除归档失败",photoDeleted:"照片已删除",failedDeletePhoto:"删除照片失败"},list:{name:"名称",printer:"打印机",date:"日期",size:"大小",actions:"操作",hasTimelapse:"有延时摄影"},log:{date:"日期",printName:"打印名称",printer:"打印机",user:"用户",status:"状态",duration:"时长",filament:"耗材",allPrinters:"所有打印机",allUsers:"所有用户",allStatuses:"所有状态",cancelled:"已取消",skipped:"已跳过",dateFrom:"从",dateTo:"到",noEntries:"未找到打印日志条目",showing:"显示 {{count}} / {{total}} 条",rowsPerPage:"行数",page:"页",prev:"上一页",next:"下一页",clearLog:"清除日志",clearLogTitle:"清除打印日志",clearLogConfirm:"所有打印日志条目将被永久删除。归档和队列项目不受影响。此操作无法撤销。确定要继续吗?",clearLogButton:"全部清除",cleared:"已清除 {{count}} 条日志",clearFailed:"清除打印日志失败"}},queue:{title:"打印队列",subtitle:"排程和管理您的打印任务",addToQueue:"添加到队列",print:"打印",reprint:"重新打印",schedulePrint:"排程打印",editQueueItem:"编辑队列项目",printToPrinters:"打印到 {{count}} 台打印机",queueToPrinters:"排队到 {{count}} 台打印机",queueAllPlates:"将全部 {{count}} 个热床加入队列",printQueued:"已加入打印队列",itemsQueued:"{{count}} 个任务已加入队列",sending:"发送中...",sendingProgress:"发送中 {{current}}/{{total}}...",adding:"添加中...",addingProgress:"添加中 {{current}}/{{total}}...",savingProgress:"保存中 {{current}}/{{total}}...",clearQueue:"清空队列",clearHistory:"清除历史",emptyQueue:"队列为空",position:"位置",scheduledTime:"排程时间",moveUp:"上移",moveDown:"下移",startNow:"立即开始",printingInProgress:"打印进行中...",viewArchive:"查看归档",viewInFileManager:"在文件管理器中查看",itemCount:"{{count}} 个项目",itemCount_plural:"{{count}} 个项目",dragToReorder:"拖动以重新排序(仅限尽快)",reorderHint:'位置仅影响"尽快"项目。排程项目按设定时间运行。',addedBy:"由 {{name}} 添加",nextInQueue:"队列中的下一个",clearPlate:"清理打印板并开始下一个",clearPlateSuccess:"打印板已清理 — 准备进行下一个打印",plateReady:"打印板已清理 — 准备进行下一个打印",plateNumber:"板 {{index}}",sections:{currentlyPrinting:"正在打印",queued:"排队中",history:"历史"},status:{pending:"等待中",waiting:"等待中",printing:"打印中",paused:"已暂停",completed:"已完成",failed:"失败",skipped:"已跳过",cancelled:"已取消"},summary:{printing:"打印中",queued:"排队中",totalTime:"总队列时间",totalWeight:"总队列重量",history:"历史"},filter:{allPrinters:"所有打印机",unassigned:"未分配",allStatus:"所有状态",allLocations:"所有位置",any:"任意"},sort:{byPosition:"按位置排序",byName:"按名称排序",byPrinter:"按打印机排序",bySchedule:"按排程排序",byDate:"按日期排序",ascendingOldest:"升序(最旧优先)",descendingNewest:"降序(最新优先)"},badges:{staged:"已暂存",requiresPrevious:"需要前一个成功",autoPowerOff:"自动关机"},empty:{title:"没有排程的打印",description:'从归档页面使用右键菜单中的"排程"选项来排程打印,或拖放文件开始。'},time:{asap:"尽快",overdue:"已逾期",now:"现在",lessThanMinute:"不到一分钟",inMinutes:"{{count}} 分钟后",inHours:"{{count}} 小时后"},actions:{stopPrint:"停止打印",startPrint:"开始打印",requeue:"重新排队"},bulkEdit:{title:"编辑 {{count}} 个项目",title_plural:"编辑 {{count}} 个项目",description:"仅更改的设置将应用于所选项目。",printer:"打印机",noChange:"— 不更改 —",queueOptions:"队列选项",staged:"暂存(手动开始)",autoPowerOff:"打印后自动关机",requirePrevious:"要求前一个成功",printOptions:"打印选项",bedLevelling:"热床调平",flowCalibration:"流量校准",vibrationCalibration:"振动校准",layerInspection:"首层检查",timelapse:"延时摄影",useAms:"使用 AMS",applyChanges:"应用更改",selectAll:"全选",deselectAll:"取消全选",selected:"已选择 {{count}} 个",editSelected:"编辑所选",cancelSelected:"取消所选"},confirm:{cancelTitle:"取消排程打印",cancelMessage:'确定要取消"{{name}}"吗?',stopTitle:"停止打印",stopMessage:'确定要停止当前打印"{{name}}"吗?这将取消打印机上的打印任务。',removeTitle:"从历史中移除",removeMessage:'确定要从队列历史中移除"{{name}}"吗?',clearHistoryTitle:"清除历史",clearHistoryMessage:"确定要从历史中移除所有 {{count}} 个项目吗?",cancelButton:"取消打印",stopButton:"停止打印",thisPrint:"此打印",thisItem:"此项目"},toast:{cancelled:"队列项目已取消",cancelFailed:"取消项目失败",removed:"队列项目已移除",removeFailed:"移除项目失败",stopped:"打印已停止",stopFailed:"停止打印失败",released:"打印已释放到队列",startFailed:"开始打印失败",reorderFailed:"重新排序队列失败",historyCleared:"已清除 {{count}} 条历史记录",clearHistoryFailed:"清除历史失败",updateFailed:"更新项目失败",bulkCancelled:"已取消 {{count}} 个项目",bulkCancelFailed:"批量取消项目失败"},permissions:{noStopPrint:"您没有停止打印的权限",noStartPrint:"您没有开始打印的权限",noEdit:"您没有编辑此队列项目的权限",noCancel:"您没有取消此队列项目的权限",noRequeue:"您没有重新排队的权限",noRemove:"您没有移除此队列项目的权限",noClearHistory:"您没有清除所有历史的权限",noEditItems:"您没有编辑队列项目的权限",noCancelItems:"您没有取消队列项目的权限"}},backgroundDispatch:{unknownFile:"未知文件",unknownPrinter:"未知打印机",startingPrints:"正在开始打印",progressSummary:"{{complete}}/{{total}} 完成 • 已分发:{{dispatched}} • 处理中:{{processing}}",expandDetails:"展开分发详情",collapseDetails:"收起分发详情",dismissToast:"关闭分发通知",cancelDispatchJob:"取消分发任务",cancel:"取消",cancelling:"取消中…",status:{dispatched:"已分发",processing:"处理中",completed:"已完成",failed:"失败",cancelled:"已取消"},toast:{cancellingUpload:"取消上传中...",cancelled:"分发已取消",cancelFailed:"取消分发失败",completeWithFailures:"后台分发完成:{{completed}} 成功,{{failed}} 失败",completeSuccess:"后台分发完成:{{completed}} 成功",printStartedRemaining:"{{completed}} 个打印已开始,{{remaining}} 个正在发送..."}},stats:{title:"仪表板",subtitle:"拖动小部件以重新排列。点击眼睛图标隐藏。",overview:"概览",totalPrints:"总打印次数",successRate:"成功率",totalPrintTime:"总打印时间",printTime:"打印时间",totalFilament:"总耗材用量",filamentUsed:"耗材用量",filamentCost:"耗材成本",totalCost:"总成本",energyUsed:"能耗",energyCost:"能源成本",averagePrintTime:"平均打印时间",printsPerDay:"每日打印次数",byPrinter:"按打印机",printsByPrinter:"各打印机打印次数",byMaterial:"按材料",byMonth:"按月份",last7Days:"最近 7 天",last30Days:"最近 30 天",last90Days:"最近 90 天",allTime:"全部时间",quickStats:"快速统计",printActivity:"打印活动",filamentTypes:"耗材类型",filamentTrends:"耗材趋势",failureAnalysis:"失败分析",timeAccuracy:"时间准确度",successful:"成功:",failed:"失败:",perfectEstimate:"100% = 完美估计",noTimeAccuracyData:"暂无时间准确度数据",noFilamentData:"暂无耗材数据",noPrinterData:"暂无打印机数据",noPrintData:"暂无打印数据",noPrintDataLast30Days:"最近 30 天无打印数据",failureReasons:"失败原因",topFailureReasons:"主要失败原因",failedPrintsCount:"{{failed}} / {{total}} 次打印失败",lastWeekRate:"上周:{{rate}}%",resetLayout:"重置布局",recalculateCosts:"重新计算成本",recalculateCostsHint:"使用当前耗材价格重新计算所有归档成本",exportStats:"导出统计",exportAsCsv:"导出为 CSV",exportAsExcel:"导出为 Excel",hiddenCount:"{{count}} 个已隐藏",exportDownloaded:"导出已下载",exportFailed:"导出失败",layoutReset:"布局已重置",recalculatedCosts:"已为 {{count}} 个归档重新计算成本",recalculateFailed:"重新计算成本失败",loadingStats:"加载统计数据中...",noPermissionResetLayout:"您没有重置布局的权限",noPermissionRecalculate:"您没有重新计算成本的权限",noPrintDataInRange:"所选范围内无打印数据",periodFilament:"期间耗材",periodCost:"期间成本",avgPerPrint:"每次打印平均",usageOverTime:"随时间的使用量",filamentByWeight:"重量",printDuration:"打印时长",printerUtilization:"打印机利用率",filamentSuccess:"按材料成功率",printHabits:"打印习惯",printTimeOfDay:"打印时段",colorDistribution:"颜色分布",noColorData:"暂无颜色数据",records:"记录",longestPrint:"最长打印",heaviestPrint:"最重打印",mostExpensivePrint:"最贵打印",busiestDay:"最忙碌的一天",successStreak:"连续成功",streakPrint:"连续打印",streakPrints:"{{count}} 次连续打印",printerStats:"打印机统计",hours:"小时",avgPrints:"平均打印",noArchiveData:"暂无打印数据",filamentByTime:"时间",avgWeight:"平均重量",avgTime:"平均时间",filamentByPrints:"打印次数",timeframe:{today:"今天","this-week":"本周","this-month":"本月","last-7":"最近 7 天","last-30":"最近 30 天","last-90":"最近 90 天","this-year":"今年","all-time":"全部时间",custom:"自定义范围",from:"从",to:"到"}},maintenance:{title:"维护",overview:"概览",allOk:"所有维护均已完成",dueCount:"{{count}} 项到期",dueCount_plural:"{{count}} 项到期",warningCount:"{{count}} 个警告",warningCount_plural:"{{count}} 个警告",totalPrintTime:"总打印时间",nextMaintenance:"下次维护",nothingDue:"无到期项目",tasks:"任务",lastPerformed:"上次执行",interval:"间隔",hoursRemaining:"剩余 {{hours}} 小时",hoursOverdue:"逾期 {{hours}} 小时",markDone:"标记为完成",performMaintenance:"执行维护",history:"历史",noHistory:"无维护历史",editPrintHours:"编辑打印时间",currentHours:"当前小时数",statusTab:"状态",settingsTab:"设置",overdueCount:"{{count}} 个逾期",dueSoonCount:"{{count}} 个即将到期",dueSoon:"即将到期",allGood:"一切正常",overdueBy:"逾期 {{duration}}",dueIn:"{{duration}} 后到期",timeLeft:"剩余 {{duration}}",day:"1 天",days:"{{count}} 天",week:"1 周",weeks:"{{count}} 周",month:"1 个月",months:"{{count}} 个月",year:"1 年",maintenanceTypes:"维护类型",maintenanceTypesDescription:"系统类型和您的自定义维护任务",addCustomType:"添加自定义类型",restoreDefaults:"恢复默认任务",intervalType:"间隔类型",intervalValue:"间隔 ({{type}})",icon:"图标",documentationLink:"文档链接(可选)",assignToPrinters:"分配给打印机",selectAtLeastOnePrinter:"至少选择一台打印机",addType:"添加类型",custom:"自定义",printHours:"打印小时数",calendarDays:"日历天数",exampleName:"例如:更换 HEPA 过滤器",viewDocumentation:"查看文档",timeBasedInterval:"基于时间的间隔",intervalOverrides:"间隔覆盖",intervalOverridesDescription:"为特定打印机自定义间隔",assignedToPrinters:"已分配给打印机:",noPrintersAssigned:"未分配打印机",addPrinterShort:"添加:",printersAssignedClick:"已分配 {{count}} 台打印机 - 点击管理",removeFromPrinter:"从此打印机移除",types:{lubricateCarbonRods:"润滑碳纤维杆",lubricateRails:"润滑线性导轨",cleanNozzle:"清洁喷嘴/热端",checkBelts:"检查皮带张力",cleanBuildPlate:"清洁构建板",checkExtruder:"检查挤出机齿轮",checkCooling:"检查冷却风扇",generalInspection:"综合检查",cleanCarbonRods:"清洁碳纤维杆",lubricateSteelRods:"润滑钢杆",cleanSteelRods:"清洁钢杆",cleanLinearRails:"清洁线性导轨",checkPtfeTube:"检查 PTFE 管",replaceHepaFilter:"更换 HEPA 过滤器",replaceCarbonFilter:"更换活性炭过滤器",lubricateLeftNozzleRail:"润滑左喷嘴导轨"},maintenanceComplete:"维护已标记为完成",typeUpdated:"维护类型已更新",typeDeleted:"维护类型已删除",defaultsRestored:"已恢复 {{count}} 个默认任务",printHoursUpdated:"打印小时数已更新",printerAssigned:"打印机已分配",printerRemoved:"打印机已移除",deleteTypeConfirm:'删除"{{name}}"?',deleteSystemTypeTitle:"删除默认维护任务?",deleteSystemTypeMessage:'确定要删除默认维护任务"{{name}}"吗?',noPermissionUpdate:"您没有更新维护项目的权限",noPermissionPerform:"您没有执行维护的权限",noPermissionEditTypes:"您没有编辑维护类型的权限",noPermissionDeleteTypes:"您没有删除维护类型的权限",noPermissionEditHours:"您没有编辑打印时间的权限",noPermissionRemovePrinter:"您没有移除打印机分配的权限",noPermissionAssignPrinter:"您没有分配打印机的权限",noPermissionEditIntervals:"您没有编辑间隔的权限",configureSettings:"配置维护类型和间隔"},settings:{title:"设置",general:"通用",tabs:{general:"通用",smartPlugs:"智能插座",notifications:"通知",filament:"耗材",network:"网络",apiKeys:"API 密钥",virtualPrinter:"虚拟打印机",users:"身份验证",backup:"备份",emailAuth:"邮箱认证"},email:{smtpSettings:"SMTP 配置",smtpHost:"SMTP 服务器",smtpPort:"SMTP 端口",security:"安全",authentication:"认证",username:"用户名",password:"密码",fromEmail:"发件邮箱",fromName:"发件人名称",testConnection:"测试 SMTP 连接",testRecipient:"测试收件邮箱",sendTest:"发送测试邮件",sending:"发送中...",save:"保存设置",saving:"保存中...",advancedAuth:"高级认证",advancedAuthEnabled:"高级认证已启用",advancedAuthEnabledDesc:"基于邮箱的用户管理功能已激活。新用户将通过邮件收到自动生成的密码,用户可以通过忘记密码功能重置密码。",advancedAuthDisabled:"高级认证已禁用",advancedAuthDisabledDesc:"启用高级认证以激活基于邮箱的用户管理功能。",enable:"启用",disable:"禁用",feature1:"密码自动生成并通过邮件发送给新用户",feature2:"用户可以使用用户名或邮箱登录",feature3:"忘记密码功能可用",feature4:"管理员可以通过邮件重置用户密码",errors:{requiredFields:"请填写所有必填字段",usernameRequired:"启用认证时需要用户名",enterTestEmail:"请输入测试邮箱地址",smtpServerAndEmail:"测试前请填写 SMTP 服务器和发件邮箱",usernamePasswordRequired:"启用认证时需要用户名和密码",configureSmtpFirst:"请先配置并测试 SMTP 设置"},success:{settingsSaved:"SMTP 设置保存成功"},securityOptions:{starttls:"STARTTLS(端口 587)",ssl:"SSL/TLS(端口 465)",none:"无(端口 25)"},authOptions:{enabled:"已启用",disabled:"已禁用"}},appearance:"外观",notifications:"通知",smartPlugs:"智能插座",spoolman:"Spoolman",updates:"更新",language:"语言",languageDescription:"选择您的首选语言",theme:"主题",themeLight:"浅色",themeDark:"深色",themeSystem:"跟随系统",defaultView:"默认视图",defaultViewDescription:"打开应用时显示的页面",checkForUpdates:"检查更新",autoUpdate:"自动更新",currentVersion:"当前版本",latestVersion:"最新版本",upToDate:"已是最新版本",updateAvailable:"有可用更新",notificationLanguage:"通知语言",notificationLanguageDescription:"推送通知的语言",bedCooledThreshold:"热床冷却阈值",bedCooledThresholdDescription:"打印后热床被视为已冷却的温度",notificationProviders:"通知提供商",addProvider:"添加提供商",editProvider:"编辑提供商",providerType:"提供商类型",testNotification:"测试通知",testSuccess:"测试通知发送成功",testFailed:"发送测试通知失败",quietHours:"免打扰时间",quietHoursDescription:"在此时间段内不发送通知",quietHoursStart:"开始",quietHoursEnd:"结束",events:{title:"通知事件",printStart:"打印开始",printComplete:"打印完成",printFailed:"打印失败",printStopped:"打印停止",printProgress:"进度里程碑",printProgressDescription:"在 25%、50%、75% 时通知",printerOffline:"打印机离线",printerError:"打印机错误",filamentLow:"耗材不足",maintenanceDue:"维护到期",maintenanceDueDescription:"需要维护时通知"},smartPlug:{title:"智能插座",add:"添加智能插座",edit:"编辑智能插座",name:"名称",ipAddress:"IP 地址",linkedPrinter:"关联打印机",autoOn:"自动开启",autoOnDescription:"打印开始时开启",autoOff:"自动关闭",autoOffDescription:"打印完成后关闭",offDelay:"关闭延迟",offDelayMinutes:"打印后分钟数",offDelayTemp:"当喷嘴温度低于",currentState:"当前状态",turnOn:"开启",turnOff:"关闭"},filamentTracking:"耗材追踪",filamentTrackingDesc:"选择如何追踪您的耗材。您可以使用内置库存或连接外部 Spoolman 服务器。",trackingModeBuiltIn:"内置库存",trackingModeBuiltInDesc:"包含 RFID 自动匹配和用量追踪",trackingModeSpoolmanDesc:"外部耗材管理服务器",builtInFeatureRfid:"自动检测 AMS 中的拓竹 RFID 耗材",builtInFeatureUsage:"追踪每次打印的耗材消耗",builtInFeatureCatalog:"管理耗材、颜色和 K 值配置文件",builtInFeatureThirdParty:"第三方耗材可分配到库存耗材",amsSyncButton:"从 AMS 同步重量",amsSyncTitle:"从 AMS 同步耗材重量",amsSyncMessage:"这将使用已连接打印机的当前 AMS 剩余百分比值覆盖所有库存耗材重量。用于从损坏的重量数据中恢复。打印机必须在线。",amsSyncing:"同步中...",amsSyncSuccess:"已同步 {{synced}} 个耗材,跳过 {{skipped}} 个",amsSyncError:"从 AMS 同步重量失败",spoolmanUrl:"Spoolman URL",spoolmanUrlHint:"Spoolman 服务器的 URL(例如 http://localhost:7912)",spoolmanConnected:"已连接",spoolmanDisconnected:"未连接",status:"状态",connect:"连接",disconnect:"断开",howSyncWorks:"同步工作原理",syncInfoRfidOnly:"仅同步带有 RFID 的官方拓竹耗材",syncInfoAutoCreate:"首次同步时自动在 Spoolman 中创建新耗材",syncInfoThirdPartySkipped:"非拓竹耗材(第三方、重新填充的)将被跳过",linkingExistingSpools:"链接现有耗材",linkingExistingSpoolsDesc:'要将现有的 Spoolman 耗材链接到您的 AMS,请将鼠标悬停在 AMS 槽位上并点击"链接到 Spoolman"。',syncMode:"同步模式",syncModeAuto:"自动",syncModeManual:"仅手动",syncModeAutoDesc:"检测到更改时自动同步 AMS 数据",syncModeManualDesc:"仅在手动触发时同步",syncAmsData:"同步 AMS 数据",syncAmsDataDesc:"手动将打印机 AMS 数据同步到 Spoolman",allPrinters:"所有打印机",noDefaultPrinter:"无默认(每次询问)",sidebarOrder:"侧边栏顺序",saveThumbnails:"保存缩略图",captureFinishPhoto:"拍摄完成照片",noPrintersConfigured:"未配置打印机",archiveMode:{always:"始终创建归档条目",never:"从不创建归档条目",ask:"每次询问"},checkForUpdatesLabel:"检查更新",checkPrinterFirmware:"检查打印机固件",includeBetaUpdates:"包含测试版本",includeBetaUpdatesDesc:"检查更新时通知测试版和预发布版本",enableRetry:"启用重试",homeAssistantDescription:"通过 Home Assistant 控制智能插座",environmentManagedLabel:"(环境变量管理)",autoEnabledViaEnv:"通过环境变量自动启用",urlFromEnvReadOnly:"值由 HA_URL 环境变量设置(只读)",tokenFromEnvReadOnly:"值由 HA_TOKEN 环境变量设置(只读)",mqttConnectedTo:"已连接到",prometheusDescription:"以 Prometheus 格式暴露打印机数据",noSmartPlugsTitle:"未配置智能插座",noSmartPlugsDescription:"添加基于 Tasmota 的智能插座以追踪能耗并自动化电源控制。",noProvidersTitle:"未配置提供商",noProvidersDescription:"添加提供商以接收警报。",noTemplatesAvailable:"无可用模板。重启后端以加载默认模板。",apiPermissionView:"查看打印机状态和队列",apiPermissionEdit:"添加和移除打印队列中的项目",apiKeysEmptyTitle:"无 API 密钥",apiKeysEmptyDescription:"创建 API 密钥以与外部服务集成。",noUsersFound:"未找到用户",noGroupsFound:"未找到组",noGroupsAvailable:"无可用组",passwordsDoNotMatch:"密码不匹配",systemGroupWarning:"系统组名称不可更改",authDisabledTitle:"身份验证已禁用",authDisabledFeature1:"需要登录才能访问系统",authDisabledFeature2:"创建多个用户并基于组的权限管理",authDisabledFeature3:"使用 50+ 个细粒度权限控制访问",userHasCreated:"此用户已创建:",userItemsQuestion:"您想如何处理这些项目?",deleteUserConfirm:"确定要删除此用户吗?",actionCannotBeUndone:"此操作无法撤销。",addFirstSmartPlug:"添加您的第一个智能插座",providers:"提供商",log:"日志",testAll:"全部测试",testResults:"测试结果",testPassedCount:"{{count}} 个通过",testFailedCount:"{{count}} 个失败",messageTemplates:"消息模板",messageTemplatesDescription:"自定义每个事件的通知消息。",apiKeys:"API 密钥",apiKeysDescription:"创建 API 密钥用于外部集成和 Webhook。",createKey:"创建密钥",apiKeyCreated:"API 密钥创建成功",apiKeyCopyWarning:"请立即复制此密钥 - 它不会再次显示!",useInApiBrowser:"在 API 浏览器中使用",createNewApiKey:"创建新 API 密钥",keyName:"密钥名称",keyNamePlaceholder:"例如:Home Assistant、OctoPrint",readStatus:"读取状态",readStatusDescription:"查看打印机状态和队列",manageQueue:"管理队列",manageQueueDescription:"添加和移除打印队列中的项目",controlPrinter:"控制打印机",controlPrinterDescription:"暂停、继续和停止打印",unnamedKey:"未命名密钥",lastUsed:"上次使用",read:"读取",control:"控制",createFirstKey:"创建您的第一个密钥",webhookEndpoints:"Webhook 端点",webhookApiKeyHint:"在 X-API-Key 请求头中使用您的 API 密钥。",webhook:{getAllStatus:"获取所有打印机状态",getSpecificStatus:"获取特定打印机状态",addToQueue:"添加到打印队列",pausePrint:"暂停打印",resumePrint:"继续打印",stopPrint:"停止打印"},apiBrowser:"API 浏览器",apiBrowserDescription:"浏览和测试所有可用的 API 端点。",apiKeyForTesting:"测试用 API 密钥",apiKeyPlaceholder:"在此粘贴您的 API 密钥以测试需要认证的端点...",apiKeyHint:"此密钥将作为 X-API-Key 请求头随请求发送。",deleteApiKeyTitle:"删除 API 密钥",deleteApiKeyMessage:"确定要删除此 API 密钥吗?使用此密钥的所有集成将停止工作。",deleteKey:"删除密钥",amsDisplayThresholds:"AMS 显示阈值",amsThresholdsDescription:"配置 AMS 湿度和温度指示器的颜色阈值。",humidity:"湿度",goodGreen:"良好(绿色)",fairOrange:"一般(橙色)",aboveFairBad:"超过一般阈值显示为红色(差)",temperature:"温度",goodBlue:"良好(蓝色)",aboveFairHot:"超过一般阈值显示为红色(热)",historyRetention:"历史保留",keepSensorHistory:"保留传感器历史",historyRetentionDescription:"较旧的湿度和温度数据将被自动删除",printModal:"打印对话框",expandCustomMapping:"默认展开自定义映射",expandCustomMappingDescription:"打印到多台打印机时,默认展开显示每台打印机的 AMS 映射",authentication:"身份验证",authEnabledDescription:"您的实例已通过用户身份验证保护",authDisabledDescription:"启用以要求登录并管理用户访问",authDisabledMessage:"启用身份验证以创建用户账户、管理权限并保护您的 Bambuddy 实例。",enableAuthentication:"启用身份验证",currentUser:"当前用户",changePassword:"修改密码",admin:"管理员",users:"用户",addUser:"添加用户",groups:"组",addGroup:"添加组",system:"系统",noDescription:"无描述",userCount:"{{count}} 个用户",permissionCount:"{{count}} 个权限",createUser:"创建用户",username:"用户名",enterUsername:"输入用户名",password:"密码",enterPassword:"输入密码(至少 6 个字符)",confirmPassword:"确认密码",confirmPasswordPlaceholder:"确认密码",viewReleaseOnGitHub:"在 GitHub 上查看发布",turnAllPlugsOn:"开启所有插座",turnAllPlugsOff:"关闭所有插座",clearNotificationLogs:"清除通知日志",clearLogsMessage:"这将永久删除所有 30 天前的通知日志。此操作无法撤销。",clearLogs:"清除日志",resetUiPreferences:"重置 UI 偏好",resetUiPreferencesMessage:"这将重置所有 UI 偏好为默认值:侧边栏顺序、主题、仪表板布局、视图模式和排序偏好。您的打印机、归档和服务器设置不会受到影响。清除后页面将重新加载。",resetPreferences:"重置偏好",deleteGroupTitle:"删除组",deleteGroupMessage:"确定要删除此组吗?此组中的用户将失去这些权限。",deleteGroup:"删除组",disableAuthenticationTitle:"禁用身份验证",disableAuthenticationMessage:"确定要禁用身份验证吗?这将使您的 Bambuddy 实例无需登录即可访问。所有用户将保留在数据库中但身份验证将被禁用。",disableAuthentication:"禁用身份验证",configureBambuddy:"配置 Bambuddy",systemDefault:"系统默认",archiveSettings:"归档设置",newWindow:"新窗口",embeddedOverlay:"嵌入式叠加层",preferredSlicer:"首选切片软件",preferredSlicerDescription:"选择要用于打开文件的切片软件",externalCameras:"外部摄像头",costTracking:"成本追踪",printsOnly:"仅打印",totalConsumption:"总消耗",dataManagement:"数据管理",storageUsage:"存储使用情况",storageUsageDescription:"按类别的数据使用情况明细",storageUsageTotal:"总计",storageUsageErrors:"错误",storageUsageOtherBreakdown:"其他(包括静态资源、脚本和配置文件)",storageUsageSystem:"系统",storageUsageData:"数据",storageUsageUnavailable:"存储使用信息不可用",clearNotificationLogsDescription:"删除 30 天前的通知日志",resetUiPreferencesDescription:"重置侧边栏顺序、主题、视图模式和布局偏好。打印机、归档和设置不受影响。",enableHomeAssistant:"启用 Home Assistant",enableMqtt:"启用 MQTT",useTls:"使用 TLS",enableMetricsEndpoint:"启用指标端点",availableMetrics:"可用指标",editUser:"编辑用户",deleteUserTitle:"删除用户",groupName:"组名称",leaveEmptyForAnonymous:"留空为匿名",leaveEmptyForNoAuth:"留空为无认证",enterNewPassword:"输入新密码",confirmNewPassword:"确认新密码",enterGroupName:"输入组名称",enterDescriptionOptional:"输入描述(可选)",enterCurrentPassword:"输入当前密码",enterNewPasswordMin6:"输入新密码(至少 6 个字符)",toast:{keyCopied:"密钥已复制到剪贴板",copyFailed:"复制密钥失败",keyAddedToBrowser:"密钥已添加到 API 浏览器",clearLogsFailed:"清除日志失败",uiPreferencesReset:"UI 偏好已重置。刷新中...",authDisabled:"身份验证已成功禁用",authDisableFailed:"禁用身份验证失败",apiKeyCreated:"API 密钥已创建",apiKeyDeleted:"API 密钥已删除",userCreated:"用户创建成功",userUpdated:"用户更新成功",userDeleted:"用户删除成功",groupCreated:"组创建成功",groupUpdated:"组更新成功",groupDeleted:"组删除成功",fillRequiredFields:"请填写所有必填字段",passwordsDoNotMatch:"密码不匹配",passwordTooShort:"密码至少需要 6 个字符",enterGroupName:"请输入组名称",settingsSaved:"设置已保存",cameraSettingsSaved:"摄像头设置已保存",enterCameraUrl:"请输入摄像头 URL",passwordChanged:"密码修改成功",connectionFailed:"连接失败",testFailed:"测试失败",cameraConnected:"摄像头已连接{{resolution}}"},testConnection:"测试连接",catalog:{spoolCatalog:"耗材目录",spoolCatalogDescription:"按品牌/类型的空耗材重量。用于添加耗材时的自动重量查找。",searchCatalog:"搜索目录...",addNewEntry:"添加新条目",namePlaceholder:"名称(例如:Bambu Lab - 塑料)",weight:"重量",type:"类型",default:"默认",custom:"自定义",noMatch:"没有条目匹配您的搜索",empty:"目录中没有条目",deleteEntry:"删除条目",deleteConfirm:'确定要删除"{{name}}"吗?',resetCatalog:"重置目录",resetConfirm:"重置目录为默认值?这将移除所有自定义条目。",loadFailed:"加载耗材目录失败",nameWeightRequired:"名称和重量为必填项",entryAdded:"条目已添加",addFailed:"添加条目失败",entryUpdated:"条目已更新",updateFailed:"更新条目失败",entryDeleted:"条目已删除",deleteFailed:"删除条目失败",resetSuccess:"目录已重置为默认值",resetFailed:"重置目录失败",exported:"已导出 {{count}} 条",imported:"已导入 {{added}} 条(跳过 {{skipped}} 条)",importFailed:"导入失败:无效的 JSON 格式",exportTooltip:"导出目录为 JSON",importTooltip:"从 JSON 导入目录",resetTooltip:"重置为默认值",selectedCount:"已选择 {{count}} 项",deleteSelected:"删除所选",bulkDeleteConfirm:"确定要删除 {{count}} 个条目吗?",bulkDeleted:"已删除 {{count}} 个条目",bulkDeleteFailed:"删除条目失败"},colorCatalog:{title:"颜色目录",description:"按制造商/材料的耗材颜色。用于添加耗材时的自动颜色查找。",searchColors:"搜索颜色...",allManufacturers:"所有制造商",addNewColor:"添加新颜色",manufacturer:"制造商",colorName:"颜色名称",hex:"十六进制",materialOptional:"材料(可选)",showing:"显示 {{filtered}} / {{total}} 种颜色",noMatch:"没有颜色匹配您的搜索",empty:"目录中没有颜色",deleteColor:"删除颜色",deleteConfirm:'确定要删除"{{name}}"吗?',resetCatalog:"重置颜色目录",resetConfirm:"重置目录为默认值?这将移除所有自定义颜色。",sync:"同步",starting:"启动中...",syncTooltip:"从 FilamentColors.xyz 同步(2000+ 种颜色,可能需要一分钟)",loadFailed:"加载颜色目录失败",fieldsRequired:"制造商、颜色名称和十六进制颜色为必填项",colorAdded:"颜色已添加",addFailed:"添加颜色失败",colorUpdated:"颜色已更新",updateFailed:"更新颜色失败",colorDeleted:"颜色已删除",deleteFailed:"删除颜色失败",resetSuccess:"颜色目录已重置为默认值",resetFailed:"重置目录失败",syncUpToDate:"已是最新(检查了 {{count}} 种颜色)",syncComplete:"添加了 {{added}} 种新颜色({{skipped}} 种已存在)",syncError:"同步错误",syncFailed:"从 FilamentColors.xyz 同步失败",exported:"已导出 {{count}} 种颜色",imported:"已导入 {{added}} 种颜色(跳过 {{skipped}} 种)",importFailed:"导入失败:无效的 JSON 格式",selectedCount:"已选择 {{count}} 项",deleteSelected:"删除所选",bulkDeleteConfirm:"确定要删除 {{count}} 种颜色吗?",bulkDeleted:"已删除 {{count}} 种颜色",bulkDeleteFailed:"删除颜色失败"},dateFormat:"日期格式",dateFormatUs:"美式 (MM/DD/YYYY)",dateFormatEu:"欧式 (DD/MM/YYYY)",dateFormatIso:"ISO (YYYY-MM-DD)",timeFormat:"时间格式",timeFormat12:"12小时制 (3:30 PM)",timeFormat24:"24小时制 (15:30)",defaultPrinter:"默认打印机",defaultPrinterDescription:"为上传、重印和其他操作预选此打印机。",slicerBambuStudio:"Bambu Studio",slicerOrcaSlicer:"OrcaSlicer",sidebarOrderDescription:"拖拽侧边栏项目以重新排序。在此处重置为默认顺序。",reset:"重置",darkMode:"深色模式",lightMode:"浅色模式",active:"(当前)",background:"背景",accent:"强调色",style:"样式",bgNeutral:"中性",bgWarm:"暖色",bgCool:"冷色",bgOled:"OLED 纯黑",bgSlate:"石板蓝",bgForest:"森林绿",accentGreen:"绿色",accentTeal:"青色",accentBlue:"蓝色",accentOrange:"橙色",accentPurple:"紫色",accentRed:"红色",styleClassic:"经典",styleGlow:"发光",styleVibrant:"鲜艳",themeToggleHint:"使用侧边栏中的太阳/月亮图标在深色和浅色模式之间切换。",autoArchivePrints:"自动归档打印",autoArchiveDescription:"打印完成时自动保存3MF文件",saveThumbnailsDescription:"从3MF文件中提取并保存预览图像",captureFinishPhotoDescription:"打印完成时从打印机摄像头拍照",ffmpegNotInstalled:"未安装ffmpeg",ffmpegRequired:"摄像头捕获需要ffmpeg。通过 <brew>brew install ffmpeg</brew>(macOS)或 <apt>apt install ffmpeg</apt>(Linux)安装。",camera:"摄像头",cameraViewMode:"摄像头查看模式",cameraOverlayDescription:"摄像头在主屏幕上以可调大小的覆盖层打开",cameraWindowDescription:"摄像头在单独的浏览器窗口中打开",externalCamerasDescription:"配置外部摄像头以替换内置打印机摄像头。支持MJPEG流、RTSP、HTTP快照和USB摄像头(V4L2)。启用后,外部摄像头将用于实时查看和完成照片。",cameraPlaceholderUsb:"设备路径 (/dev/video0)",cameraPlaceholderUrl:"摄像头URL (rtsp://... 或 http://...)",cameraTypeMjpeg:"MJPEG 流",cameraTypeRtsp:"RTSP 流",cameraTypeSnapshot:"HTTP 快照",cameraTypeUsb:"USB 摄像头 (V4L2)",test:"测试",connected:"已连接",disconnected:"未连接",currency:"货币",defaultFilamentCost:"默认耗材成本(每公斤)",electricityCost:"每千瓦时电费",energyDisplayMode:"能源显示模式",energyModePrintDescription:"仪表板显示打印期间使用的能源总和",energyModeTotalDescription:"仪表板显示智能插座的累计能源",fileManager:"文件管理器",createArchiveEntry:"打印时创建归档条目",createArchiveEntryDescription:"从文件管理器打印时,可选择创建归档条目",lowDiskSpaceWarning:"磁盘空间不足警告",lowDiskSpaceDescription:"当可用磁盘空间低于此阈值时显示警告",printerFirmware:"打印机固件",checkFirmwareDescription:"检查Bambu Lab的打印机固件更新",bambuddySoftware:"Bambuddy 软件",autoCheckDescription:"启动时自动检查新版本",checkNow:"立即检查",updateAvailableVersion:"可用更新:v{{version}}",releaseNotes:"发布说明",updateViaDocker:"通过 Docker Compose 更新:",installUpdate:"安装更新",latestVersionRunning:"您正在运行最新版本",failedToCheckUpdates:"检查更新失败:{{error}}",backupRestore:"备份与恢复",backupRestoreDescription:"导出/导入设置并配置GitHub备份",goToBackup:"前往备份",externalUrl:"外部URL",externalUrlDescription:"Bambuddy可访问的外部URL。用于通知图像和外部集成。",bambuddyUrl:"Bambuddy URL",externalUrlHint:"包含协议和端口(例如:http://192.168.1.100:8000)",ftpRetry:"FTP重试",ftpRetryDescription:"当打印机WiFi不稳定时重试FTP操作。适用于3MF下载、打印上传、延时摄影下载和固件更新。",autoRetryDescription:"自动重试失败的FTP操作",retryAttempts:"重试次数",retryDelay:"重试延迟",connectionTimeout:"连接超时",time_one:"{{count}}次",time_other:"{{count}}次",second_one:"{{count}}秒",second_other:"{{count}}秒",nSeconds:"{{count}}秒",increaseForWeakWifi:"对WiFi信号弱的打印机增加此值",homeAssistant:"Home Assistant",homeAssistantFullDescription:"连接到Home Assistant,通过HA REST API控制智能插座。支持switch、light、input_boolean和script实体。",homeAssistantUrl:"Home Assistant URL",longLivedAccessToken:"长期访问令牌",haTokenHint:"在HA中创建令牌:个人资料 → 长期访问令牌 → 创建令牌",connectionSuccessful:"连接成功",connectionFailed:"连接失败",haConnectionSuccess:"已成功连接到Home Assistant。",haConnectionFailed:"连接Home Assistant失败。",mqttPublishing:"MQTT发布",mqttDescription:"将BamBuddy事件发布到外部MQTT代理,用于与Node-RED、Home Assistant和其他自动化系统集成。",mqttEnableDescription:"向外部MQTT代理发布事件",brokerHostname:"代理主机名",port:"端口",usernameOptional:"用户名(可选)",passwordOptional:"密码(可选)",topicPrefix:"主题前缀",topicPrefixHint:"主题格式:{{prefix}}/printers/<serial>/status 等",prometheusMetrics:"Prometheus 指标",prometheusEndpointDescription:"在 <code>/api/v1/metrics</code> 公开打印机指标,用于Prometheus/Grafana监控。",bearerTokenOptional:"Bearer令牌(可选)",bearerTokenHint:"设置后,请求必须包含 <code>Authorization: Bearer <token></code>",metricsConnectionStatus:"连接状态",metricsPrinterState:"打印机状态(空闲/打印中等)",metricsPrintProgress:"打印进度 0-100%",metricsBedTemp:"热床温度",metricsNozzleTemp:"喷嘴温度",metricsPrintsTotal:"按结果分类的总打印数",metricsMore:"...以及更多(层数、风扇、队列、耗材用量)",smartPlugsDescription:"连接智能插座(Tasmota或Home Assistant)以自动化电源控制并跟踪打印机的能源使用情况。",allOn:"全部开启",allOff:"全部关闭",addSmartPlug:"添加智能插座",energySummary:"能源概要",currentPower:"当前功率",plugsOnline:"{{reachable}}/{{total}} 个插座在线",today:"今天",yesterday:"昨天",total:"总计",enablePlugsForSummary:"启用插座以查看能源概要",addNotificationProvider:"添加",systemBadge:"(系统)",creating:"创建中...",changing:"修改中...",deleteUserAndItems:"删除用户及其所有项目",deleteUserKeepItems:"删除用户,保留项目(将变为无主项目)",ok:"确定"},notification:{printStarted:{title:"打印已开始",body:"{{printer}}:{{filename}} 已开始打印"},printCompleted:{title:"打印已完成",body:"{{printer}}:{{filename}} 已成功完成"},printFailed:{title:"打印失败",body:"{{printer}}:{{filename}} 打印失败"},printStopped:{title:"打印已停止",body:"{{printer}}:{{filename}} 已停止"},printProgress:{title:"打印进度",body:"{{printer}}:{{filename}} 已完成 {{percent}}%"},printerOffline:{title:"打印机离线",body:"{{printer}} 已离线"},printerError:{title:"打印机错误",body:"{{printer}}:{{error}}"},filamentLow:{title:"耗材不足",body:"{{printer}}:耗材即将用完"},maintenanceDue:{title:"维护到期",body:"{{printer}}:{{items}} 需要关注"}},errors:{generic:"出了点问题",networkError:"网络错误。请检查您的连接。",notFound:"未找到",unauthorized:"未授权",serverError:"服务器错误",validationError:"请检查您的输入",printerConnectionFailed:"连接打印机失败",saveFailed:"保存更改失败",deleteFailed:"删除失败",loadFailed:"加载数据失败"},hmsErrors:{title:"错误 - {{name}}",noErrors:"无错误",viewOnWiki:"在拓竹 Wiki 上查看",clearInstructions:"在打印机上清除错误以在此处消除它们。",clearErrors:"清除错误",clearSuccess:"HMS 错误已清除",clearFailed:"清除 HMS 错误失败"},mqttDebug:{title:"MQTT 调试日志",searchPlaceholder:"搜索主题或负载...",noMessages:"尚未记录消息",startLoggingHint:'点击"开始记录"以开始捕获 MQTT 消息',noMessagesMatch:"没有消息匹配您的筛选条件",adjustFilterHint:"尝试调整您的搜索或筛选条件",incoming:"传入",outgoing:"传出",loggingStopped:"记录已停止",loggingActive:"记录中 - 消息将自动刷新",startLogging:"开始记录",stopLogging:"停止记录",clearLog:"清除日志",topic:"主题",timestamp:"时间戳",direction:"方向",all:"全部"},printerFiles:{title:"文件管理器",storageUsed:"已用:",storageFree:"剩余:",filterPlaceholder:"筛选文件...",deleteButton:"删除",deleteFiles:"删除 {{count}} 个文件",deleteFileConfirm:'删除"{{name}}"?此操作无法撤销。',deleteFilesConfirm:"删除 {{count}} 个选中的文件?此操作无法撤销。",noFiles:"打印机上没有文件",loadingFiles:"加载文件中...",failedToLoad:"加载文件失败",toast:{filesDeleted:"已删除 {{count}} 个文件",deleteFailed:"删除失败:{{error}}"}},confirm:{delete:"确定要删除吗?",unsavedChanges:"您有未保存的更改。确定要离开吗?",clearQueue:"确定要清空队列吗?"},login:{title:"Bambuddy 登录",subtitle:"登录您的账户",username:"用户名",usernamePlaceholder:"输入您的用户名",usernameOrEmail:"用户名或邮箱",usernameOrEmailPlaceholder:"用户名或 @ 邮箱",password:"密码",passwordPlaceholder:"输入您的密码",signIn:"登录",signingIn:"登录中...",forgotPassword:"忘记密码?",loginSuccess:"登录成功",loginFailed:"登录失败",enterCredentials:"请输入用户名和密码",forgotPasswordTitle:"忘记密码",forgotPasswordMessage:"如果您忘记了密码,请联系系统管理员进行重置。",forgotPasswordEmailMessage:"输入您的邮箱地址,我们将向您发送新密码。",emailAddress:"邮箱地址",emailPlaceholder:"your.email@example.com",cancel:"取消",sending:"发送中...",sendResetEmail:"发送重置邮件",howToReset:"如何重置密码:",resetStep1:"联系您的 Bambuddy 管理员",resetStep2:"请他们在用户管理中重置您的密码",resetStep3:"他们可以为您设置一个临时密码",resetStep4:"使用新密码登录并在设置中修改密码",gotIt:"知道了"},setup:{title:"Bambuddy 设置",subtitle:"为您的 Bambuddy 实例配置身份验证",enableAuth:"启用身份验证",adminAccount:"管理员账户",adminAccountDesc:"如果管理员用户已存在,将使用现有管理员账户启用身份验证。如需使用现有管理员,请将下方字段留空,或输入新凭据创建新管理员用户。",adminUsername:"管理员用户名",adminPassword:"管理员密码",optionalIfAdminExists:"(如管理员用户已存在则为可选)",adminUsernamePlaceholder:"输入管理员用户名(可选)",adminPasswordPlaceholder:"输入管理员密码(可选)",confirmPassword:"确认密码",confirmPasswordPlaceholder:"确认管理员密码",settingUp:"设置中...",completeSetup:"完成设置",toast:{authEnabledAdminCreated:"身份验证已启用并创建了管理员用户",authEnabledExistingAdmins:"使用现有管理员用户启用了身份验证",setupCompleted:"设置完成",enterBothCredentials:"请输入管理员用户名和密码,或将两者留空以使用现有管理员用户",passwordsDoNotMatch:"密码不匹配",passwordTooShort:"密码至少需要 6 个字符"}},changePassword:{title:"修改密码",currentPassword:"当前密码",currentPasswordPlaceholder:"输入当前密码",newPassword:"新密码",newPasswordPlaceholder:"输入新密码(至少 6 个字符)",confirmPassword:"确认新密码",confirmPasswordPlaceholder:"确认新密码",passwordsDoNotMatch:"密码不匹配",passwordTooShort:"密码至少需要 6 个字符",changing:"修改中...",success:"密码修改成功",failed:"密码修改失败"},plateAlert:{title:"打印已暂停!",message:"在构建板上检测到物体。打印已自动暂停。请清理打印板并继续打印。",understand:"我知道了"},camera:{title:"摄像头视图",invalidPrinterId:"无效的打印机 ID",live:"实时",snapshot:"快照",restartStream:"重启流",refreshSnapshot:"刷新快照",fullscreen:"全屏",exitFullscreen:"退出全屏",connectingToCamera:"连接摄像头中...",capturingSnapshot:"拍摄快照中...",connectionLost:"连接已断开",connectionFailed:"摄像头连接失败",reconnecting:"{{countdown}} 秒后重新连接...(第 {{attempt}}/{{max}} 次尝试)",reconnectNow:"立即重新连接",cameraUnavailable:"摄像头不可用",cameraUnavailableDesc:"请确保打印机已通电并已连接。",noCamera:"无可用摄像头",retry:"重试",cameraStream:"摄像头流",zoomOut:"缩小",zoomIn:"放大",resetZoom:"重置缩放",recording:"录制中",startRecording:"开始录制",stopRecording:"停止录制",chamberLight:"切换腔室灯"},groups:{title:"组管理",subtitle:"管理访问控制的权限组",backToSettings:"返回设置",createGroup:"创建组",noPermission:"您没有访问此页面的权限。",system:"系统",noDescription:"无描述",usersCount:"{{count}} 个用户",permissionsCount:"{{count}} 个权限",edit:"编辑",delete:"删除",toast:{created:"组创建成功",updated:"组更新成功",deleted:"组删除成功",enterGroupName:"请输入组名称"},modal:{editGroup:"编辑组",createGroup:"创建组",cancel:"取消",saving:"保存中...",creating:"创建中...",saveChanges:"保存更改"},form:{groupName:"组名称",groupNamePlaceholder:"输入组名称",systemGroupWarning:"系统组名称不可更改",description:"描述",descriptionPlaceholder:"输入描述(可选)",permissions:"权限(已选 {{count}} 个)"},deleteModal:{title:"删除组",message:"确定要删除此组吗?此组中的用户将失去这些权限。",confirm:"删除组"},editor:{title:"编辑组",createTitle:"创建组",search:"搜索权限...",selectAll:"全选",clearAll:"清除全部",permissionsSelected:"已选 {{count}} 个",noResults:"没有权限匹配您的搜索"}},users:{title:"用户管理",subtitle:"管理用户及其对 Bambuddy 实例的访问",backToSettings:"返回设置",createUser:"创建用户",noPermission:"您没有访问此页面的权限。",admin:"管理员",noGroups:"无组",active:"活跃",inactive:"非活跃",edit:"编辑",delete:"删除",system:"系统",noGroupsAvailable:"无可用组",table:{username:"用户名",groups:"组",status:"状态",actions:"操作"},toast:{created:"用户创建成功",updated:"用户更新成功",deleted:"用户删除成功",fillRequired:"请填写所有必填字段",passwordsDoNotMatch:"密码不匹配",passwordTooShort:"密码至少需要 6 个字符"},modal:{createUser:"创建用户",editUser:"编辑用户",cancel:"取消",creating:"创建中...",saving:"保存中...",saveChanges:"保存更改",advancedAuthSubtitle:"使用高级认证"},form:{username:"用户名",usernamePlaceholder:"输入用户名",email:"邮箱",emailPlaceholder:"user@example.com",password:"密码",passwordPlaceholder:"输入密码",confirmPassword:"确认密码",confirmPasswordPlaceholder:"确认密码",newPasswordPlaceholder:"输入新密码",confirmNewPasswordPlaceholder:"确认新密码",leaveBlankToKeep:"留空以保持当前值",groups:"组",optional:"可选",autoGeneratedPassword:"将自动生成安全密码并通过邮件发送给用户。",passwordManagedByAdvancedAuth:'密码由高级认证管理。使用"重置密码"通过邮件向用户发送新密码。',resetPassword:"重置密码",resettingPassword:"重置密码中..."},deleteModal:{title:"删除用户",message:"确定要删除此用户吗?此操作无法撤销。",confirm:"删除用户"}},streamOverlay:{title:"流叠加层",invalidPrinterId:"无效的打印机 ID",cameraStream:"摄像头流",progress:"进度",eta:"预计完成时间",printerIdle:"打印机空闲",printerOffline:"打印机离线",status:{printing:"打印中",paused:"已暂停",finished:"已完成",failed:"失败",idle:"空闲",unknown:"未知"}},profiles:{title:"配置文件",subtitle:"管理您的切片预设和压力推进校准",tabs:{cloud:"云端配置文件",local:"本地配置文件",kprofiles:"K 值配置"},localProfiles:{title:"本地配置文件",subtitle:"从 OrcaSlicer 导入和管理切片预设",import:"导入配置文件",importDesc:"将 .bbscfg、.bbsflmt、.orca_filament、.zip 或 .json 文件拖放到此处",importing:"导入中...",search:"搜索本地预设...",noPresets:"暂无本地预设",badge:"本地",edit:"编辑",delete:"删除",cancel:"取消",deleteConfirmTitle:"删除预设",deleteConfirm:"确定要删除此预设吗?此操作无法撤销。",source:"来源",inheritsFrom:"继承自",filamentType:"类型",vendor:"厂商",compatiblePrinters:"兼容打印机",nozzleTemp:"喷嘴温度",cost:"成本",density:"密度",pressureAdvance:"压力推进",filament:"耗材",process:"工艺",printer:"打印机",toast:{importSuccess:"已导入 {{count}} 个预设",importSkipped:"跳过 {{count}} 个预设(重复)",importError:"导入时出现 {{count}} 个错误",deleted:"预设已删除",updated:"预设已更新"}},connectedAs:"已连接为",logout:"退出登录",noLogoutPermission:"您没有退出登录的权限",failedToLoad:"加载配置文件失败",retry:"重试",time:{justNow:"刚刚",minsAgo:"{{count}} 分钟前",hoursAgo:"{{count}} 小时前",daysAgo:"{{count}} 天前"},toast:{loggedOut:"已退出登录"},login:{title:"连接到拓竹云",subtitle:"跨设备同步您的切片预设",email:"邮箱",password:"密码",region:"地区",regionGlobal:"全球",regionChina:"中国",verificationCode:"验证码",totpCode:"验证器代码",checkEmail:"检查您的邮箱 ({{email}}) 获取 6 位验证码",enterTotpHint:"输入验证器应用中的 6 位代码",accessToken:"访问令牌",accessTokenHint:"粘贴您的拓竹访问令牌(来自 Bambu Studio)",back:"返回",loginButton:"登录",verifyButton:"验证",setTokenButton:"设置令牌",useToken:"改用访问令牌",useEmail:"改用邮箱登录",toast:{loggedIn:"登录成功",codeSent:"验证码已发送到您的邮箱",enterTotp:"输入验证器应用中的代码",tokenSet:"令牌设置成功"}},presets:{myPreset:"我的预设(可编辑)",duplicate:"复制",editable:"可编辑",failedToLoadDetails:"加载预设详情失败",deleteConfirm:"删除此预设?",deleteWarning:'这将从拓竹云中永久删除"{{name}}"。此操作无法撤销。',noDuplicatePermission:"您没有复制预设的权限",noEditPermission:"您没有编辑预设的权限",noDeletePermission:"您没有删除预设的权限",types:{filament:"耗材预设",printer:"打印机预设",process:"工艺预设"},toast:{deleted:"预设已删除",created:"预设已创建",updated:"预设已更新",duplicated:"预设已复制",fieldAdded:'字段"{{key}}"已添加',exported:"预设已导出"},baseLabel:"基础:{{name}}",currentLabel:"当前:{{name}}",newPreset:"新建预设",editPreset:"编辑预设",duplicatePreset:"复制预设",createNewPreset:"创建新预设",customizeSettings:"自定义新预设的设置",compareWithBase:"与基础预设比较",compare:"比较",basePreset:"基础预设",selectBasePreset:"选择基础预设...",presetName:"预设名称",myCustomPreset:"我的自定义预设",inheritsFrom:"继承自",dropJsonToImport:"拖放 JSON 以导入",tabs:{common:"常用",allFields:"所有字段"},availableFields:"可用字段",searchFieldsPlaceholder:"搜索字段...",noMatchingFields:"没有匹配的字段",allFieldsAdded:"所有字段已添加",addCustomField:"添加自定义字段",yourOverrides:"您的覆盖值",noOverridesYet:"暂无覆盖值",clickFieldsToAdd:"点击左侧的字段进行添加",saveAsTemplate:"保存为模板",jsonTip:"提示:将 .json 文件拖放到此对话框的任意位置以导入设置"},cloudView:{searchPlaceholder:"搜索预设...",templates:"模板",refresh:"刷新",newPreset:"新建预设",clearFilters:"清除筛选",compareMode:"比较模式",selectAnotherPreset:"选择另一个 {{type}} 预设",clickTwoPresets:"点击两个相同类型的预设进行比较",selectFirst:"1. 选择第一个",selectSecond:"2. 选择第二个",compareNow:"立即比较",lastSynced:"上次同步:",showingCount:"显示 {{showing}} / {{total}} 个预设",noPresetsFound:"未找到预设",columns:{filament:"耗材",process:"工艺",printer:"打印机"},noFilamentPresets:"无耗材预设",noProcessPresets:"无工艺预设",noPrinterPresets:"无打印机预设",filters:{type:"类型",owner:"所有者",printer:"打印机",nozzle:"喷嘴",filament:"耗材",layer:"层",all:"全部",myPresets:"我的预设",builtIn:"内置",process:"工艺"},noTemplatesPermission:"您没有管理模板的权限",noRefreshPermission:"您没有刷新配置文件的权限",noCreatePermission:"您没有创建预设的权限"},templates:{title:"快速模板",noTemplates:"暂无模板",createFirst:"从预设编辑器创建模板",typeFilter:"类型:",deleteTitle:"删除模板",deleteWarning:"此操作无法撤销",deleteConfirm:'确定要删除"{{name}}"吗?',namePlaceholder:"模板名称",descriptionPlaceholder:"描述",settingsJson:"设置 (JSON)",fieldsCount:"{{count}} 个字段",shownInModals:"在对话框中显示",hiddenInModals:"在对话框中隐藏",apply:"应用",toast:{deleted:"模板已删除",updated:"模板已更新",created:"模板已创建",applied:"模板已应用"}}},support:{debugLoggingActive:"调试日志记录已激活",manageLogs:"管理",collectItem7:"打印机连接和固件版本",collectItem8:"集成状态(Spoolman、MQTT、HA)",collectItem9:"网络接口(仅子网)",collectItem10:"Python 包版本",collectItem11:"数据库健康检查",collectItem12:"Docker 环境详情"},fileManager:{title:"文件管理器",subtitle:"组织和管理您的打印文件",uploadFiles:"上传文件",newFolder:"新建文件夹",folderName:"文件夹名称",folderNamePlaceholder:"例如:功能零件",renameFile:"重命名文件",renameFolder:"重命名文件夹",moveFiles:"移动 {{count}} 个文件",rootNoFolder:"根目录(无文件夹)",current:"当前",linkFolder:"链接文件夹",linkFolderDescription:'将"{{name}}"链接到项目或归档以便快速访问。',project:"项目",archive:"归档",noProjectsFound:"未找到项目",noArchivesFound:"未找到归档",unlink:"取消链接",link:"链接",dragDropFiles:"将文件拖放到此处",dropFilesHere:"将文件放在此处",orClickToBrowse:"或点击浏览",allFileTypesSupported:"支持所有文件类型。ZIP 文件将被解压。",zipFilesDetected:"检测到 ZIP 文件",zipExtractOptions:"ZIP 文件将被解压。选择如何处理文件夹结构:",preserveZipStructure:"保留 ZIP 中的文件夹结构",createFolderFromZip:"从 ZIP 文件名创建文件夹",stlThumbnailGeneration:"STL 缩略图生成",zipMayContainStl:"ZIP 文件可能包含 STL 文件。可以在解压时生成缩略图。",thumbnailsCanBeGenerated:"可以为 STL 文件生成缩略图。大型模型可能需要更长时间处理。",generateThumbnailsForStl:"为 STL 文件生成缩略图",threemfDetected:"检测到 3MF 文件",threemfExtractionInfo:"将自动从 3MF 文件中提取打印机型号、材料、颜色和打印设置。",willBeExtracted:"将被解压",filesExtracted:"已解压 {{count}} 个文件",uploadComplete:"上传完成:{{succeeded}} 个成功",uploadFailed:"{{count}} 个失败",zipFilesFailed:"{{count}} 个文件失败",uploading:"上传中...",changeLink:"更改链接...",linkTo:"链接到...",linkToProjectOrArchive:"链接到项目或归档",addToQueue:"添加到队列",schedulePrint:"排程",generateThumbnail:"生成缩略图",generateThumbnails:"生成缩略图",generateThumbnailsForMissing:"为缺少缩略图的 STL 文件生成缩略图",gridView:"网格视图",listView:"列表视图",lowDiskSpaceWarning:"磁盘空间不足警告",lowDiskSpaceDetails:"仅剩 {{free}}(总共 {{total}})。阈值设置为 {{threshold}} GB。",files:"文件",folders:"文件夹",size:"大小",free:"剩余",allFiles:"所有文件",wrap:"换行",enableTextWrapping:"启用文本换行",disableTextWrapping:"禁用文本换行",dragToResizeTooltip:"拖动调整大小,双击重置",searchFiles:"搜索文件...",allTypes:"所有类型",prints:"打印",ascending:"升序",descending:"降序",resultsCount:"{{showing}} / {{total}} 个文件",selectAll:"全选",deselectAll:"取消全选",selected:"已选择 {{count}} 个",adding:"添加中...",loadingFiles:"加载文件中...",folderIsEmpty:"文件夹为空",noFilesYet:"暂无文件",folderEmptyDescription:"上传文件或将文件移入此文件夹以开始使用。",noFilesDescription:"上传文件以开始组织您的打印相关文件。",noMatchingFiles:"没有匹配的文件",noMatchingFilesDescription:"没有文件匹配您当前的搜索或筛选条件。",clearFilters:"清除筛选",printedCount:"已打印 {{count}} 次",uploadedBy:"上传者",deleteFolder:"删除文件夹",deleteFile:"删除文件",deleteFilesCount:"删除 {{count}} 个文件",deleteFolderConfirm:"确定要删除此文件夹吗?其中的所有文件也将被删除。",deleteFileConfirm:"确定要删除此文件吗?",deleteFilesConfirm:"确定要删除 {{count}} 个选中的文件吗?此操作无法撤销。",deleting:"删除中...",noPermissionRenameFolder:"您没有重命名文件夹的权限",noPermissionLinkFolder:"您没有链接文件夹的权限",noPermissionDeleteFolder:"您没有删除文件夹的权限",noPermissionPrint:"您没有打印的权限",noPermissionAddToQueue:"您没有添加到队列的权限",noPermissionDownload:"您没有下载文件的权限",noPermissionRenameFile:"您没有重命名此文件的权限",noPermissionGenerateThumbnail:"您没有生成缩略图的权限",noPermissionDeleteFile:"您没有删除此文件的权限",noPermissionCreateFolder:"您没有创建文件夹的权限",noPermissionUpload:"您没有上传文件的权限",noPermissionMoveFiles:"您没有移动文件的权限",noPermissionDeleteFiles:"您没有删除文件的权限",toast:{folderCreated:"文件夹已创建",folderDeleted:"文件夹已删除",fileDeleted:"文件已删除",filesDeleted:"已删除 {{count}} 个文件",filesMoved:"文件已移动",folderLinked:"文件夹已链接",folderUnlinked:"文件夹已取消链接",addedToQueue:"已将 {{count}} 个文件添加到队列",addedToQueuePartial:"已添加 {{added}} 个文件,{{failed}} 个失败",failedToAddToQueue:"添加文件失败:{{error}}",fileRenamed:"文件已重命名",folderRenamed:"文件夹已重命名",thumbnailsGenerated:"已生成 {{count}} 个缩略图",thumbnailsGeneratedPartial:"已生成 {{succeeded}} 个缩略图,{{failed}} 个失败",noStlMissingThumbnails:"没有缺少缩略图的 STL 文件",failedToGenerateThumbnails:"生成缩略图失败:{{error}}",thumbnailGenerated:"缩略图已生成",failedToGenerateThumbnail:"生成缩略图失败:{{error}}"}},projects:{title:"项目",subtitle:"组织和跟踪您的 3D 打印项目",newProject:"新建项目",editProject:"编辑项目",deleteProject:"删除项目",projectName:"项目名称",description:"描述",noProjects:"暂无项目",noProjectsFiltered:"没有{{status}}项目",noProjectsFilteredHelp:"您没有任何{{status}}项目。当项目状态更改时,它们将出现在这里。",createFirst:"创建您的第一个项目以开始组织相关打印、跟踪进度和管理构建。",createFirstButton:"创建您的第一个项目",create:"创建",files:"文件",prints:"打印",plates:"板",parts:"零件",lastModified:"最后修改",deleteConfirm:"确定要删除此项目吗?归档和队列项目将被取消链接但不会被删除。",addFiles:"添加文件",removeFile:"移除文件",viewDetails:"查看详情",namePlaceholder:"例如:Voron 2.4 构建",descriptionPlaceholder:"可选描述...",color:"颜色",targetPlates:"目标板数",targetPlatesPlaceholder:"例如:25",targetPlatesHelp:"打印任务数量",targetParts:"目标零件数",targetPartsPlaceholder:"例如:150",targetPartsHelp:"所需零件总数",tagsLabel:"标签(逗号分隔)",tagsPlaceholder:"例如:voron、功能件、礼物",dueDate:"截止日期",priority:"优先级",priorityLow:"低",priorityNormal:"普通",priorityHigh:"高",priorityUrgent:"紧急",statusActive:"进行中",statusCompleted:"已完成",statusArchived:"已归档",done:"完成",completed:"已完成",failed:"失败",inQueue:"队列中",noPrintsYet:"暂无打印",printJobs:"打印任务(板)",partsPrinted:"已打印零件",failedParts:"失败零件",import:"导入",export:"导出",importProject:"导入项目",exportAll:"导出所有项目",loading:"加载项目中...",noEditPermission:"您没有编辑项目的权限",noDeletePermission:"您没有删除项目的权限",noCreatePermission:"您没有创建项目的权限",noImportPermission:"您没有导入项目的权限",noExportPermission:"您没有导出项目的权限",toast:{created:"项目已创建",updated:"项目已更新",deleted:"项目已删除",imported:"项目已导入",multipleImported:"已导入 {{count}} 个项目",importFailed:"导入失败",exported:"项目已导出(仅元数据)"}},projectDetail:{notFound:"未找到项目",backToProjects:"返回项目",export:"导出",exportProject:"导出项目",noExportPermission:"您没有导出项目的权限",noEditPermission:"您没有编辑项目的权限",partOf:"属于:",priorityLabel:"优先级:",noPrints:"此项目暂无打印",status:{active:"进行中",completed:"已完成",archived:"已归档"},priority:{low:"低",normal:"普通",high:"高",urgent:"紧急"},dueDate:{overdue:"已逾期",today:"今天到期",daysLeft:"还有 {{count}} 天"},progress:{platesProgress:"板进度",partsProgress:"零件进度",printJobs:"打印任务",parts:"零件",percentComplete:"{{percent}}% 完成",remaining:"剩余 {{count}} 个"},stats:{printJobs:"打印任务",total:"总计",failed:"{{count}} 个失败",partsPrinted:"已打印 {{count}} 个零件",printTime:"打印时间",filamentUsed:"耗材用量"},cost:{title:"成本追踪",filamentCost:"耗材成本",energy:"能源",budget:"预算",remaining:"剩余"},subProjects:{title:"子项目 ({{count}})"},notes:{title:"备注",noEditPermission:"您没有编辑备注的权限",placeholder:"添加关于此项目的备注...",empty:"暂无备注。点击编辑添加备注。"},files:{title:"文件",linkFolders:"从文件管理器链接文件夹",forQuickAccess:"到此项目以便快速访问。",fileCount:"{{count}} 个文件",empty:"未链接文件夹。前往文件管理器将文件夹链接到此项目。"},bom:{title:"材料清单",acquired:"已获取 {{completed}}/{{total}}",showAll:"显示全部",hideDone:"隐藏已完成",addPart:"添加零件",noAddPermission:"您没有添加零件的权限",partNamePlaceholder:"零件名称(例如:M3x8 螺丝)",partName:"零件名称",qty:"数量",price:"价格 ({{currency}})",sourcingUrlPlaceholder:"采购链接(可选)",remarksPlaceholder:"备注(可选)",deletePart:"删除零件",deleteConfirm:'确定要删除"{{name}}"吗?',noUpdatePermission:"您没有更新零件的权限",noEditPermission:"您没有编辑零件的权限",noDeletePermission:"您没有删除零件的权限",totalCost:"总成本:",empty:"材料清单中没有零件。添加硬件、电子元件或其他组件以跟踪需要采购的物品。"},timeline:{title:"活动时间线",empty:"暂无活动。"},template:{saveAsTemplate:"保存为模板",noCreatePermission:"您没有创建模板的权限"},queue:{title:"队列",viewAll:"查看全部",printing:"{{count}} 个打印中",queued:"{{count}} 个排队中"},prints:{title:"打印 ({{count}})"},toast:{projectUpdated:"项目已更新",partAdded:"零件已添加",partRemoved:"零件已移除",exportFailed:"导出失败",projectExported:"项目已导出",templateCreated:"模板已创建"}},system:{title:"系统信息",version:"版本",uptime:"运行时间",cpuUsage:"CPU 使用率",memoryUsage:"内存使用率",diskUsage:"磁盘使用率",networkInfo:"网络信息",logs:"日志",debugMode:"调试模式",enableDebug:"启用调试日志",disableDebug:"禁用调试日志",downloadLogs:"下载日志",clearLogs:"清除日志",dockerInfo:"Docker 信息",containerName:"容器名称",imageName:"镜像名称",platform:"平台",architecture:"架构"},library:{title:"耗材库",addFilament:"添加耗材",editFilament:"编辑耗材",deleteFilament:"删除耗材",vendor:"厂商",material:"材料",color:"颜色",kFactor:"K 值",temperature:"温度",noFilaments:"耗材库中没有耗材",deleteConfirm:"确定要删除此耗材吗?",importFromPrinter:"从打印机导入",exportToFile:"导出到文件"},spoolman:{title:"Spoolman 集成",enabled:"Spoolman 已启用",url:"Spoolman URL",connected:"已连接",disconnected:"未连接",testConnection:"测试连接",sync:"同步",syncing:"同步中...",lastSync:"上次同步",linkToSpoolman:"链接到 Spoolman",openInSpoolman:"在 Spoolman 中打开",unlinkSpool:"取消链接耗材",unlinkConfirmTitle:"解开线轴?",unlinkConfirmMessage:"这将断开卷轴与 Spoolman 的连接。Spoolman 中的卷轴数据将保持不变。",selectSpool:"选择耗材",noUnlinkedSpools:"无未链接的耗材",linkSuccess:"耗材已成功链接到 Spoolman",linkFailed:"链接耗材失败",unlinkSuccess:"已成功从 Spoolman 取消链接耗材",unlinkFailed:"取消链接耗材失败",spoolId:"耗材 ID",fillSourceLabel:"(Spoolman)",weight:"重量",remaining:"剩余",disableWeightSync:"禁用 AMS 估计重量同步",disableWeightSyncDesc:"不从 AMS 估计值更新剩余容量。如果您更喜欢 Spoolman 的用量追踪而非 AMS 百分比估计,请使用此选项。新耗材仍将使用 AMS 估计值作为初始重量。",reportPartialUsage:"报告失败打印的部分用量",reportPartialUsageDesc:"当打印失败或被取消时,根据层进度报告估计的耗材使用量。"},inventory:{title:"耗材库存",addSpool:"添加耗材",editSpool:"编辑耗材",material:"材料",selectMaterial:"选择材料...",subtype:"子类型",brand:"品牌",searchBrand:"搜索品牌...",useCustomBrand:'使用"{{brand}}"',useCustomMaterial:"使用自定义材料:{{material}}",colorName:"颜色名称",colorNamePlaceholder:"翡翠白、烈焰红...",color:"颜色",hexColor:"十六进制颜色",pickColor:"选择自定义颜色",labelWeight:"标签重量",coreWeight:"空盘重量",searchSpoolWeight:"搜索耗材重量...",weightUsed:"已使用",currentWeight:"剩余重量",measuredWeight:"称量重量",costPerKg:"每公斤成本",measuredWeightError:"称量重量必须在 {{min}}g 到 {{max}}g 之间。",slicerFilament:"切片耗材",slicerFilamentName:"切片预设名称",slicerPreset:"切片预设",searchPresets:"搜索耗材预设...",selectedPreset:"已选择",noPresetsFound:"未找到预设",tempOverrides:"温度覆盖",note:"备注",notePlaceholder:"关于此耗材的任何备注...",archive:"归档",restore:"恢复",noSpools:"暂无耗材。添加您的第一个耗材开始使用。",noManualSpools:"没有手动添加的耗材。请先向库存中添加耗材。",kProfiles:"K 值配置",addKProfile:"添加 K 值配置",assignSpool:"分配耗材",unassignSpool:"取消分配",assignSuccess:"耗材已分配,AMS 槽位已配置",assignFailed:"分配耗材失败",selectSpool:"选择要分配到此槽位的耗材",assigned:"已分配",assigning:"分配中...",searchSpools:"搜索耗材...",allMaterials:"所有材料",filterByBrand:"按品牌筛选...",showArchived:"显示已归档",quickAdd:"快速添加(库存)",quantity:"数量",stock:"库存",configured:"已配置",spoolsCreated:"已创建 {{count}} 个耗材",spoolCreated:"耗材已创建",spoolUpdated:"耗材已更新",spoolDeleted:"耗材已删除",spoolArchived:"耗材已归档",spoolRestored:"耗材已恢复",deleteConfirm:"确定要删除此耗材吗?此操作无法撤销。",archiveConfirm:"确定要归档此耗材吗?",advancedSettings:"高级设置",filamentInfoTab:"耗材信息",paProfileTab:"PA 配置",filamentInfo:"耗材",additional:"附加",loadingPresets:"加载云端预设中...",cloudConnected:"云端已连接",cloudNotConnected:"云端未连接(使用默认值)",recentColors:"最近",searchColors:"搜索颜色...",searchResults:"搜索结果",allColors:"所有颜色",commonColors:"常用颜色",showLess:"显示更少",showAll:"显示全部",noColorsFound:"没有颜色匹配您的搜索",noResults:"未找到匹配项",selectMaterialFirst:"请先在耗材信息选项卡中选择材料。",noPrintersConfigured:"未配置打印机。添加打印机以使用 PA 配置。",matchingFilter:"匹配",anyBrand:"任何品牌",anyVariant:"任何变体",autoSelect:"自动选择",matches:"匹配",match:"匹配",noMatches:"无匹配",connected:"已连接",offline:"离线",printerOffline:"打印机离线。连接后查看校准配置。",noKProfilesMatch:"没有 K 值配置匹配所选耗材。",leftNozzle:"左喷嘴",rightNozzle:"右喷嘴",profilesSelected:"个校准配置已选择",totalInventory:"总库存",totalConsumed:"总消耗",byMaterial:"按材料",inPrinter:"在打印机中",lowStock:"库存不足",sinceTracking:"自开始追踪",loadedInAms:"已装载到 AMS/外置",remaining:"剩余",weightCheck:"重量检查",lastWeighed:"上次称量",neverWeighed:"从未称量",search:"搜索耗材...",showing:"显示",to:"到",of:"共",show:"显示",spools:"个耗材",spool:"个耗材",page:"页",noSpoolsMatch:"未找到结果",noSpoolsMatchDesc:"尝试调整您的搜索或筛选条件。",active:"活跃",archived:"已归档",all:"全部",used:"已使用",new:"新的",clearFilters:"清除筛选",table:"表格",cards:"卡片",net:"净重",groupSimilar:"分组",groupedSpools:"{{count}} 个相同耗材",groupedRows:"行",columns:"列",configureColumns:"配置列",configureColumnsDesc:"拖动以重新排序列或使用箭头。使用眼睛图标切换可见性。",visible:"可见",reset:"重置",cancel:"取消",applyChanges:"应用更改",moveUp:"上移",moveDown:"下移",hideColumn:"隐藏列",showColumn:"显示列",linkToSpool:"链接到耗材",tagLinked:"标签已链接到耗材",tagLinkFailed:"链接标签失败",tagAlreadyLinked:"标签已链接到其他耗材",unknownTag:"检测到未知 RFID 标签",usageHistory:"使用历史",noUsageHistory:"暂无使用记录",printName:"打印名称",weightConsumed:"消耗重量",clearHistory:"清除",historyCleared:"使用历史已清除",fillSourceLabel:"(库存)",lowStockThresholdError:"阈值必须在 0.1 到 99.9 之间"},timelapse:{title:"延时摄影",create:"创建延时摄影",download:"下载",delete:"删除",preview:"预览",frameRate:"帧率",quality:"质量",processing:"处理中...",noTimelapses:"无可用延时摄影"},ams:{title:"AMS",slot:"槽位",empty:"空",emptySlot:"空槽位",unknown:"未知",humidity:"湿度",temperature:"温度",filamentType:"耗材类型",filamentColor:"颜色",remaining:"剩余",history:"AMS 历史",noHistory:"无可用历史",configureSlot:"配置槽位",externalSpool:"外置耗材",profile:"配置",kFactor:"K 值",fill:"填充",configure:"配置",used:"已使用",remainingUnit:"剩余"},printModal:{title:"开始打印",selectPrinter:"选择打印机",selectPlate:"选择板",filamentMapping:"耗材映射",totalCost:"总成本:",slotRemainingShort:" - 剩余 {{grams}}g",printSettings:"打印设置",bedLeveling:"热床调平",flowCalibration:"流量校准",vibrationCalibration:"振动校准",layerInspection:"首层检查",timelapse:"延时摄影",startPrint:"开始打印",addToQueue:"添加到队列",cancel:"取消",noPrintersAvailable:"无可用打印机",printerBusy:"打印机忙碌",printerOffline:"打印机离线",sameTypeDifferentColor:"相同类型,不同颜色",filamentTypeNotLoaded:"耗材类型未装载",openCalendar:"打开日历",leftNozzle:"左",rightNozzle:"右",leftNozzleTooltip:"左喷嘴",rightNozzleTooltip:"右喷嘴",filamentOverride:"耗材覆盖",filamentOverrideHint:"可选覆盖用于基于模型的耗材分配。调度器将使用您选择的耗材而不是原始 3MF 值进行匹配。",originalFilament:"原始",overrideWith:"覆盖为",resetToOriginal:"恢复为原始",forceColorMatch:"强制颜色匹配"},backup:{title:"备份与恢复",createBackup:"创建备份",restoreBackup:"恢复备份",restoreDescription:"从备份文件替换所有数据",downloadBackup:"下载备份",uploadBackup:"上传备份",lastBackup:"上次备份",autoBackup:"自动备份",backupNow:"立即备份",restoreWarning:"警告:恢复备份将覆盖所有当前数据。",includeArchives:"包含归档",includeSettings:"包含设置",includeProfiles:"包含配置文件",backupSuccess:"备份创建成功",restoreSuccess:"备份恢复成功",backupFailed:"备份失败",restoreFailed:"恢复失败",restoreNote:"恢复期间虚拟打印机将停止",githubBackup:"GitHub 备份",enabled:"已启用",cloudLoginRequired:"需要登录 Bambu Cloud。请在 配置文件 → 云配置文件 中登录以启用 GitHub 备份。",cloudLoginRequiredShort:"需要Cloud登录",githubDescription:"自动将您的配置文件同步到私有 GitHub 仓库以进行备份和版本历史记录。",repositoryUrl:"仓库 URL",personalAccessToken:"个人访问令牌",tokenSaved:"(已保存)",enterNewToken:"输入新令牌以更新",tokenHint:"具有内容读写权限的细粒度令牌",branch:"分支",manualOnly:"仅手动",hourly:"每小时",daily:"每天",weekly:"每周",includeInBackup:"包含在备份中",kProfiles:"K 配置文件",kProfilesDescription:"来自已连接打印机的压力推进校准",noPrintersConnected:"没有打印机连接",printersConnected:"{{connected}}/{{total}} 已连接",cloudProfiles:"云配置文件",cloudProfilesDescription:"来自 Bambu Cloud 的耗材、打印机和工艺预设",appSettings:"应用设置",appSettingsDescription:"Bambuddy 配置(完整数据库)",lastBackupAt:"上次备份:",noBackupsYet:"尚无备份",next:"下次:",startingBackup:"正在启动备份...",test:"测试",enableBackup:"启用备份",testConnection:"测试连接",enterRepoUrl:"请输入仓库 URL",enterRepoAndToken:"请输入仓库 URL 和访问令牌",repoRequired:"仓库 URL 为必填项",tokenRequired:"访问令牌为必填项",githubBackupEnabled:"GitHub 备份已启用",tokenUpdated:"令牌已更新",settingsSaved:"设置已保存",failedToSave:"保存失败:{{message}}",backupCompleteFiles:"备份完成 - {{count}} 个文件已更新",backupSkippedNoChanges:"备份已跳过 - 无更改",backupFailed2:"备份失败:{{message}}",clearedLogs:"已清除 {{count}} 条日志",failedToClearLogs:"清除日志失败:{{message}}",history:"历史记录",clear:"清除",date:"日期",status:"状态",commit:"提交",localBackup:"本地备份",localBackupDescription:"创建 Bambuddy 数据的完整备份,包括数据库、档案、上传和所有文件。",downloadBackupLabel:"下载备份",completeBackupZip:"完整备份:数据库 + 所有文件(ZIP)",download:"下载",preparingBackup:"正在准备备份...",creatingArchive:"正在创建备份归档...对于大型归档可能需要一些时间。",downloadingFile:"正在下载备份文件...",backupDownloaded:"备份下载成功",failedToCreateBackup:"创建备份失败:{{message}}",restore:"恢复",restoreReplacesAll:"恢复将替换所有数据。",restoreReplacesAllDetail:"您当前的数据库和文件将被完全替换。恢复后需要重启。",restoreConfirmTitle:"恢复备份",restoreConfirmMessage:'您确定要从"{{filename}}"恢复吗?这将完全替换您当前的数据库和所有文件。恢复后需要重启应用程序。',restoreConfirmButton:"恢复备份",uploadingFile:"正在上传备份文件...",backupRestoredRestart:"备份已恢复。请重启 Bambuddy。",failedToRestore:"恢复备份失败。请检查文件格式。",reloadNow:"立即重新加载",creatingBackup:"正在创建备份",restoringBackup:"正在恢复备份",preparing:"准备中...",processing:"处理中...",doNotClosePage:"请不要关闭此页面或导航离开。对于大型备份,此操作可能需要几分钟。",restoring:"恢复中...",restoreComplete:"恢复完成",restoreFailed2:"恢复失败",importSettings:"从备份文件导入设置",pleaseWaitRestoring:"请等待数据恢复中",selectBackupFile:"点击选择备份文件(.json 或 .zip)",duplicateHandling:"重复项处理方式:",matchPrinters:"打印机",matchPrintersBy:"按序列号匹配",matchSmartPlugs:"智能插座",matchSmartPlugsBy:"按 IP 地址匹配",matchNotificationProviders:"通知提供者",matchNotificationProvidersBy:"按名称匹配",matchFilaments:"耗材",matchFilamentsBy:"按名称 + 类型 + 品牌匹配",matchArchives:"档案",matchArchivesBy:"按内容哈希匹配(始终跳过)",matchPendingUploads:"待上传",matchPendingUploadsBy:"按文件名匹配",matchSettingsTemplates:"设置和模板",matchSettingsTemplatesBy:"始终覆盖",replaceExisting:"替换现有数据",keepExisting:"保留现有数据",overwriteDescription:"用备份数据覆盖已存在的项目",keepDescription:"仅恢复尚不存在的项目",overwriteCaution:"注意:",overwriteWarning:"覆盖将用备份数据替换您当前的配置。出于安全考虑,打印机访问代码永远不会被覆盖。",cancel:"取消",processingBackup:"正在处理备份文件...",itemsRestored:"已恢复项目",itemsSkipped:"已跳过项目",restored:"已恢复",skippedAlreadyExist:"已跳过(已存在)",filesCategory:"文件(3MF、缩略图等)",andMore:"...还有 {{count}} 项",newApiKeysGenerated:"已生成新的 API 密钥",keysShownOnce:"这些密钥仅显示一次。请立即复制!",copy:"复制",noDataFound:"在备份文件中未找到可恢复的数据。",close:"关闭",categories:{settings:"设置",notification_providers:"通知提供者",notification_templates:"通知模板",smart_plugs:"智能插座",printers:"打印机",filaments:"耗材",maintenance_types:"维护类型",archives:"档案",projects:"项目",pending_uploads:"待上传",external_links:"外部链接",api_keys:"API 密钥"}},tags:{title:"标签",addTag:"添加标签",editTag:"编辑标签",deleteTag:"删除标签",tagName:"标签名称",tagColor:"标签颜色",noTags:"无标签",deleteConfirm:"确定要删除此标签吗?",manageTags:"管理标签"},uploadModal:{title:"上传 3MF 文件",dragDrop:"将 .3mf 文件拖放到此处",or:"或",browseFiles:"浏览文件",extractionInfo:"将从 3MF 文件元数据中自动提取打印机型号。",uploaded:"已上传",failed:"失败",uploading:"上传中...",upload:"上传",uploadFailed:"上传失败"},editArchive:{title:"编辑归档",name:"名称",namePlaceholder:"打印名称",printer:"打印机",noPrinter:"无打印机",project:"项目",noProject:"无项目",itemsPrinted:"打印数量",itemsPrintedHelp:"此打印任务中生产的物品数量",notes:"备注",notesPlaceholder:"添加关于此打印的备注...",externalLink:"外部链接",externalLinkPlaceholder:"https://printables.com/model/...",externalLinkHelp:"链接到 Printables、Thingiverse 或其他来源",tags:"标签",tagsPlaceholder:"添加标签...",addMoreTags:"添加更多标签...",matchingTags:'匹配"{{query}}"',existingTags:"现有标签",clickToAdd:"(点击添加)",status:"状态",failureReason:"失败原因",selectReason:"选择原因...",photos:"打印成品照片",photosHelp:"点击 + 添加打印成品照片",printResult:"打印成品",saving:"保存中...",failureReasons:{adhesionFailure:"附着力失败",spaghettiDetached:"拉丝 / 脱落",layerShift:"层偏移",cloggedNozzle:"喷嘴堵塞",filamentRunout:"耗材用完",warping:"翘曲",stringing:"拉丝",underExtrusion:"挤出不足",powerFailure:"断电",userCancelled:"用户取消",other:"其他"},statuses:{completed:"已完成",failed:"失败",aborted:"已取消",printing:"打印中"}},kProfiles:{title:"K 值配置",noPrintersConfigured:"未配置打印机",addPrinterInSettings:"在设置中添加打印机以管理 K 值配置",noActivePrinters:"无活跃打印机",enablePrinterConnection:"启用打印机连接以查看其 K 值配置",loadingProfiles:"加载 K 值配置中...",printerOffline:"打印机离线",printerOfflineDesc:"所选打印机未连接。开启电源以查看 K 值配置。",noMatchingProfiles:"无匹配的配置",noMatchingProfilesDesc:"没有配置匹配您的搜索条件",noKProfiles:"无 K 值配置",noKProfilesDesc:"未找到 {{diameter}}mm 喷嘴的压力推进配置",createFirstProfile:"创建第一个配置",printer:"打印机",nozzle:"喷嘴",refresh:"刷新",addProfile:"添加配置",export:"导出",import:"导入",select:"选择",selectAll:"全选",delete:"删除",searchPlaceholder:"按名称或耗材搜索...",allExtruders:"所有挤出机",leftOnly:"仅左侧",rightOnly:"仅右侧",allFlow:"所有流量",hfOnly:"仅高流量",sOnly:"仅标准",sortName:"排序:名称",sortKValue:"排序:K 值",sortFilament:"排序:耗材",leftExtruder:"左挤出机",rightExtruder:"右挤出机",modal:{addTitle:"添加 K 值配置",editTitle:"编辑 K 值配置",profileName:"配置名称",profileNamePlaceholder:"我的 PLA 配置",kValue:"K 值",kValuePlaceholder:"0.020",kValueHelp:"典型范围:PLA 0.01 - 0.06,PETG 0.02 - 0.10",filament:"耗材",selectFilament:"选择耗材...",noFilamentsHelp:"未找到耗材。请先在 Bambu Studio 中创建 K 值配置。",flowType:"流量类型",highFlow:"高流量",standard:"标准",nozzleSize:"喷嘴尺寸",extruder:"挤出机",extruders:"挤出机",left:"左",right:"右",notes:"备注(本地存储)",notesPlaceholder:"添加关于此配置的备注...",notesHelp:"备注保存在 Bambuddy 中,不在打印机上",syncing:"与打印机同步中...",savingExtruder:"保存到挤出机 {{current}}/{{total}}...",pleaseWait:"请稍候"},deleteConfirm:{title:"删除配置",cannotUndo:"此操作无法撤销",message:'确定要从打印机删除"{{name}}"吗?'},bulkDelete:{title:"删除配置",cannotUndo:"此操作无法撤销",message:"确定要从打印机删除 {{count}} 个选中的配置吗?"},toast:{profileSaved:"K 值配置已保存",profilesSaved:"K 值配置已保存到 {{count}} 个挤出机",selectAtLeastOneExtruder:"请至少选择一个挤出机",profileDeleted:"K 值配置已删除",profilesDeleted:"已删除 {{count}} 个配置",exportedProfiles:"已导出 {{count}} 个配置",importedProfiles:"已导入 {{count}} / {{total}} 个配置",noProfilesToExport:"无可导出的配置",invalidFileFormat:"无效的文件格式",failedToParseImport:"解析导入文件失败",failedToSaveBatch:"批量保存 K 值配置失败",noteSaved:"备注已保存",failedToSaveNote:"保存备注失败"},permission:{noRead:"您没有刷新配置的权限",noCreate:"您没有添加配置的权限",noUpdate:"您没有更新 K 值配置的权限",noDelete:"您没有删除 K 值配置的权限",noExport:"您没有导出配置的权限",noImport:"您没有导入配置的权限"}},virtualPrinter:{title:"虚拟打印机",running:"运行中",stopped:"已停止",description:{default:"启用虚拟打印机,使其在 Bambu Studio 和 OrcaSlicer 中可见。发送到此打印机的文件将直接归档而不打印。",proxy:"启用代理,将切片软件流量中继到真实打印机,允许在任何网络上远程打印。"},enable:{title:"启用虚拟打印机",visibleInSlicer:'在切片软件发现中显示为"Bambuddy"',proxyingTo:"代理到 {{name}}",notActive:"未激活"},model:{title:"打印机型号",description:"选择要模拟的打印机型号。",restartWarning:"更改型号将重启虚拟打印机"},accessCode:{title:"访问码",isSet:"访问码已设置",notSet:"未设置访问码 - 需要设置才能启用",placeholder:"输入 8 位字符代码",placeholderChange:"输入新代码以更改",hint:"必须恰好 8 个字符。切片软件使用此代码进行认证。",charCount:"({{count}}/8)"},targetPrinter:{title:"目标打印机",configured:"代理目标已配置",notConfigured:"未选择目标打印机 - 代理模式需要设置",placeholder:"选择打印机...",hint:"选择要将切片软件流量代理到的打印机。打印机必须处于局域网模式。",noPrinters:"未配置打印机。请先添加打印机以使用代理模式。"},remoteInterface:{title:"网络接口覆盖",configured:"接口覆盖已激活",optional:"可选 - 当自动检测的 IP 不正确时使用(例如多网卡、Docker、VPN)",placeholder:"自动检测(默认)...",hint:"覆盖通过 SSDP 广播并在 TLS 证书中使用的 IP 地址。在 Bambuddy 有多个网络接口时很有用。"},mode:{title:"模式",archive:"归档",archiveDesc:"立即归档文件",review:"审核",reviewDesc:"归档前审核",queue:"队列",queueDesc:"归档并添加到队列",proxy:"代理",proxyDesc:"中继到真实打印机"},autoDispatch:{title:"自动派发",description:"添加到队列时自动开始打印。关闭后,打印任务等待手动派发。"},setupRequired:{title:"需要设置",description:"虚拟打印机功能需要额外的系统配置才能工作。包括端口转发、防火墙规则和平台特定设置。",readGuide:"启用前请阅读设置指南"},howItWorks:{title:"工作原理",step1:"在同一局域网中,虚拟打印机会通过发现机制自动出现在您的切片软件(Bambu Studio / OrcaSlicer)中。从其他网络,通过 IP 地址和访问码手动添加。",step2:'在归档、审核和队列模式下,使用切片软件中的"发送"按钮将 3MF 文件上传到 Bambuddy。切片软件会显示"打印成功"— 文件已存储,未打印。',step3:"在代理模式下,虚拟打印机将所有流量中继到真实打印机 — 打印会立即开始,就像直接连接一样。"},status:{title:"状态详情",printerName:"打印机名称",model:"型号",serialNumber:"序列号",mode:"模式",pendingFiles:"待处理文件",targetPrinter:"目标打印机",ftpPort:"FTP 端口",mqttPort:"MQTT 端口",ftpConnections:"FTP 连接",mqttConnections:"MQTT 连接"},toast:{updated:"虚拟打印机设置已更新",failedToUpdate:"更新设置失败",accessCodeRequired:"请先设置访问码",targetPrinterRequired:"请先选择目标打印机",bindIpRequired:"请先设置绑定 IP",accessCodeEmpty:"访问码不能为空",accessCodeLength:"访问码必须恰好 8 个字符",created:"虚拟打印机已创建",failedToCreate:"创建虚拟打印机失败",deleted:"虚拟打印机已删除",failedToDelete:"删除虚拟打印机失败"},list:{title:"虚拟打印机",add:"添加",addFirst:"添加虚拟打印机",empty:"未配置虚拟打印机。添加一个以开始使用。"},bindIp:{title:"绑定接口",placeholder:"选择接口...",hint:"此虚拟打印机绑定的网络接口。每台打印机必须唯一。"},proxy:{accessCodeHint:"在代理模式下,在切片软件中使用目标打印机的访问码。连接会透明转发到真实打印机。"},addDialog:{title:"添加虚拟打印机",name:"名称",hint:"创建后可以配置访问码、目标打印机和其他设置。",create:"创建"},deleteConfirm:{title:"删除虚拟打印机",message:'确定要删除"{{name}}"吗?这将停止此打印机的所有服务。'}},modelViewer:{openInSlicer:"在切片软件中打开",tabs:{model:"3D 模型",gcode:"G-code 预览"},notAvailable:"不可用",notSliced:"未切片",plates:"板",allPlates:"所有板",plateNumber:"板 {{number}}",plateCount:"{{count}} 个板",plateCount_other:"{{count}} 个板",objectCount:"{{count}} 个对象",objectCount_other:"{{count}} 个对象",filamentCount:"{{count}} 种耗材",filamentCount_other:"{{count}} 种耗材",eta:"预计 {{minutes}} 分钟",noPreview:"此文件无可用预览",pagination:{pageOf:"第 {{current}} / {{total}} 页",prev:"上一页",next:"下一页"},errors:{failedToLoad:"加载文件失败",noMeshes:"3MF 文件中未找到网格",unsupportedFormat:"不支持的文件格式"}},maintenanceDescriptions:{lubricateCarbonRods:"在碳纤维杆上涂抹润滑剂以确保顺畅运动",lubricateRails:"在线性导轨上涂抹润滑剂以确保顺畅运动",cleanNozzle:"清洁热端和喷嘴以防止堵塞",checkBelts:"检查皮带张力以确保打印精度",cleanBuildPlate:"清洁构建板以获得更好的附着力",checkExtruder:"检查挤出机齿轮磨损情况",checkCooling:"确保冷却风扇正常工作",generalInspection:"打印机综合检查",cleanCarbonRods:"清洁碳纤维杆以减少摩擦",lubricateSteelRods:"在钢杆上涂抹润滑剂以确保顺畅运动",cleanSteelRods:"清洁钢杆以减少摩擦",cleanLinearRails:"擦拭线性导轨以清除灰尘和碎屑",checkPtfeTube:"检查 PTFE 管的磨损或损坏",replaceHepaFilter:"更换 HEPA 过滤器以保证空气质量",replaceCarbonFilter:"更换活性炭过滤器",lubricateLeftNozzleRail:"润滑左喷嘴导轨(H2 系列)"},smartPlugs:{offline:"离线",admin:"管理",openPlugAdminPage:"打开插座管理页面",deleteSmartPlug:"删除智能插座",turnOnSmartPlug:"开启智能插座",turnOffSmartPlug:"关闭智能插座",turnOn:"开启",turnOff:"关闭",addSmartPlug:{scanningNetwork:"扫描网络中...",chooseEntity:"选择实体...",connectionFailed:"连接失败",searchEntities:"搜索实体...",searchPowerSensors:"搜索功率传感器...",searchEnergySensors:"搜索能量传感器...",placeholders:{plugName:"客厅插座",mqttStateOnValue:"ON、true、1",mqttSameAsPower:"与功率主题相同,或不同"}},linkedTo:"关联到:",monitorOnly:"仅监控",alerts:"警报",scheduleOn:"开启 {{time}}",scheduleOff:"关闭 {{time}}",on:"开启",off:"关闭",power:"功率",kwhToday:"今日kWh",settings:"设置",automationSettings:"自动化设置",showInSwitchbar:"在开关栏显示",quickAccessSidebar:"从侧边栏快速访问",enabled:"已启用",enableAutomation:"为此插座启用自动化",autoOn:"自动开启",autoOnDescription:"打印开始时开启",autoOff:"自动关闭",autoOffDescription:"打印完成时关闭(一次性)",turnOffDelayMode:"关闭延迟模式",time:"时间",temp:"温度",delayMinutes:"延迟(分钟)",tempThreshold:"温度阈值(°C)",tempThresholdDescription:"当喷嘴冷却到此温度以下时关闭",edit:"编辑",deleteConfirm:'确定要删除"{{name}}"吗?此操作无法撤销。',turnOnConfirm:'确定要开启"{{name}}"吗?',turnOffConfirm:'确定要关闭"{{name}}"吗?这将切断连接设备的电源。',failedToTurn:'无法{{action}}"{{name}}"',unknown:"未知",addTitle:"添加智能插座",editTitle:"编辑智能插座",stopScanning:"停止扫描",discoverTasmota:"发现Tasmota设备",foundDevices:"找到{{count}}个设备 - 点击选择:",noDevicesFound:"未在您的网络中找到Tasmota设备",haNotConfigured:"Home Assistant未配置。请在以下位置设置",haSettingsPath:"设置 → 网络 → Home Assistant",selectEntity:"选择实体 *",ipAddress:"IP地址 *",nameLabel:"名称 *",username:"用户名",password:"密码",authHint:"如果您的Tasmota设备不需要认证,请留空",linkToPrinter:"关联打印机",noPrinter:"无打印机(仅手动控制)",linkingDescription:"关联后可在打印开始/完成时自动开关",powerAlerts:"功率警报",alertAbove:"高于时警报(W)",alertBelow:"低于时警报(W)",alertDescription:"当电力消耗超过这些阈值时收到通知。留空以禁用该方向。",dailySchedule:"每日计划",turnOnAt:"开启时间",turnOffAt:"关闭时间",scheduleDescription:"每天在这些时间自动开关插座。留空以跳过该操作。",showOnPrinterCard:"在打印机卡片上显示",displayOnPrinterCard:"在打印机卡片上显示按钮",connectedResult:"已连接!",deviceLabel:"设备:{{name}} - ",stateLabel:"状态:{{state}}",test:"测试",delete:"删除",save:"保存",add:"添加",cancel:"取消",failedToStartScan:"无法开始扫描",nameRequired:"名称为必填项",entityRequired:"Home Assistant插座需要实体",mqttTopicRequired:"必须为功率、能源或状态监控配置至少一个MQTT主题",loadingEntities:"正在加载实体...",loading:"加载中...",failedToLoadEntities:"加载实体失败:{{error}}",noEntitiesMatching:'未找到匹配"{{search}}"的实体',noEntitiesAvailable:"无可用实体",searchingEntities:"搜索所有实体(找到{{count}}个)",showingEntities:"显示 switch、light、input_boolean({{count}}个可用)",energyMonitoringOptional:"能源监控(可选)",energyMonitoringHint:"搜索并选择提供功率/能源数据的传感器。",powerSensorW:"功率传感器(W)",energyTodayKwh:"今日能源(kWh)",totalEnergyKwh:"总能源(kWh)",noMatchingSensors:"无匹配的传感器",none:"无",mqttNotConfigured:"MQTT代理未配置。请在以下位置设置代理地址",mqttSettingsPath:"设置 → 网络 → MQTT发布",mqttNotConfiguredSuffix:"(您不需要启用发布,只需填写代理详细信息)。",mqttMonitorOnlyDescription:"MQTT插座通过MQTT订阅接收功率/能源数据。开关控制不可用 - 请使用您的MQTT代理或家庭自动化系统。",powerMonitoring:"功率监控",energyMonitoring:"能源监控",stateMonitoring:"状态监控",optional:"可选",topic:"主题",jsonPath:"JSON路径",multiplier:"乘数",onValue:"ON值",mqttPowerHint:`JSON路径从JSON负载中提取值(例如"power_l1")。如果主题发布原始数值,请留空。
- 乘数:mW→W使用0.001,kW→W使用1000。`,mqttEnergyHint:`JSON路径从JSON负载中提取值。原始值请留空。
- 乘数:Wh→kWh使用0.001,MWh→kWh使用1000。`,mqttStateHint:`JSON路径从JSON负载中提取值。原始值请留空。
- ON值:表示"ON"的确切字符串。留空以自动检测(ON、true、1)。`,noSwitchesInSwitchbar:"开关栏中没有开关",enableSwitchbarHint:'在设置 > 智能插座中启用"在开关栏显示"'},notifications:{providerTypes:{callmebot:"CallMeBot/WhatsApp",ntfy:"ntfy",pushover:"Pushover",telegram:"Telegram",email:"电子邮件",discord:"Discord",webhook:"Webhook",homeassistant:"Home Assistant"},providerDescriptions:{email:"SMTP 电子邮件通知",telegram:"通过 Telegram 机器人发送通知",discord:"通过 Webhook 发送到 Discord 频道",ntfy:"免费、可自托管的推送通知",pushover:"简单、可靠的推送通知",callmebot:"通过 CallMeBot 免费发送 WhatsApp 通知",webhook:"通用 HTTP POST 到任意 URL",homeassistant:"Home Assistant 仪表板中的持久通知"},lastSuccess:"上次:{{date}}",error:"错误",printer:"打印机:",allPrinters:"所有打印机",sendTestNotification:"发送测试通知",eventSettings:"事件设置",enabled:"已启用",sendFromProvider:"从此提供商发送通知",printEvents:"打印事件",printerStatus:"打印机状态",amsAlarms:"AMS 警报",amsHtAlarms:"AMS-HT 警报",printQueue:"打印队列",start:"开始",plateCheck:"热床检测",complete:"完成",failed:"失败",stopped:"已停止",progress:"进度",offline:"离线",lowFilament:"耗材不足",maintenance:"维护",amsHumidity:"AMS 湿度",amsTemp:"AMS 温度",amsHtHumidity:"AMS-HT 湿度",amsHtTemp:"AMS-HT 温度",bedCooled:"热床已冷却",quiet:"免打扰",digest:"摘要 {{time}}",printStarted:"打印已开始",plateNotEmpty:"热床非空",plateNotEmptyDescription:"打印前检测到物体",printCompleted:"打印已完成",bedCooledLabel:"热床已冷却",bedCooledDescription:"打印后热床温度降至阈值以下",printFailed:"打印失败",printStopped:"打印已停止",progressMilestones:"进度里程碑",progressMilestonesDescription:"在 25%、50%、75% 时通知",printerOffline:"打印机离线",printerError:"打印机错误",lowFilamentLabel:"耗材不足",maintenanceDue:"需要维护",maintenanceDueDescription:"需要维护时通知",amsHumidityHigh:"AMS 湿度过高",amsHumidityHighDescription:"普通 AMS 湿度超过阈值",amsTemperatureHigh:"AMS 温度过高",amsTemperatureHighDescription:"普通 AMS 温度超过阈值",amsHtHumidityHigh:"AMS-HT 湿度过高",amsHtHumidityHighDescription:"AMS-HT 湿度超过阈值",amsHtTemperatureHigh:"AMS-HT 温度过高",amsHtTemperatureHighDescription:"AMS-HT 温度超过阈值",jobAdded:"任务已添加",jobAddedDescription:"任务已添加到队列",jobAssigned:"任务已分配",jobAssignedDescription:"基于模型的任务已分配给打印机",jobStarted:"任务已开始",jobStartedDescription:"队列任务已开始打印",jobWaiting:"任务等待中",jobWaitingDescription:"任务正在等待耗材",jobSkipped:"任务已跳过",jobSkippedDescription:"任务已跳过(上一个失败)",jobFailed:"任务失败",jobFailedDescription:"任务启动失败",queueComplete:"队列已完成",queueCompleteDescription:"所有队列任务已完成",quietHours:"免打扰时段",noNotificationsDuring:"在此时段内不发送通知",editProviderToChangeQuietHours:"编辑提供商以更改免打扰时段",dailyDigest:"每日摘要",batchNotifications:"将通知汇总为每日摘要",sendAt:"发送于 {{time}}",editProviderToChangeDigestTime:"编辑提供商以更改摘要时间",edit:"编辑",deleteProvider:"删除通知提供商",deleteConfirm:'确定要删除"{{name}}"吗?此操作无法撤销。',delete:"删除",addTitle:"添加通知提供商",editTitle:"编辑通知提供商",nameLabel:"名称 *",namePlaceholder:"我的通知",providerTypeLabel:"提供商类型 *",configuration:"配置",testConfiguration:"测试配置",printerFilter:"打印机筛选",onlyFromPrinter:"仅发送来自此打印机的事件通知",quietHoursDnd:"免打扰时段",quietStart:"开始",quietEnd:"结束",dailyDigestLabel:"每日摘要",sendDigestAt:"发送摘要于",digestCollected:"事件将被收集并在此时间作为单条摘要发送",notificationEvents:"通知事件",progressPercent:"(25%、50%、75%)",bedCooledAfterPrint:"(打印完成后)",cancel:"取消",save:"保存",add:"添加",nameRequired:"名称为必填项",fieldRequired:"{{field}}为必填项",phoneNumber:"电话号码",apiKey:"API 密钥",serverUrl:"服务器 URL",topic:"主题",authToken:"认证令牌",userKey:"用户密钥",appToken:"应用令牌",priority:"优先级",botToken:"机器人令牌",chatId:"聊天 ID",smtpServer:"SMTP 服务器",smtpPort:"SMTP 端口",security:"安全",authentication:"认证",username:"用户名",password:"密码",fromEmail:"发件人邮箱",toEmail:"收件人邮箱",webhookUrl:"Webhook URL",payloadFormat:"负载格式",authorization:"授权",titleFieldName:"标题字段名",messageFieldName:"消息字段名",editTemplate:"编辑模板:{{name}}",titleLabel:"标题",bodyLabel:"正文",titlePlaceholder:"通知标题...",bodyPlaceholder:"通知正文...",availableVariables:"可用变量",clickToInsert:"点击插入到正文光标位置",livePreview:"实时预览",hide:"隐藏",show:"显示",loadingPreview:"加载预览中...",enterTemplateContent:"输入模板内容以查看预览",titlePreview:"标题:",bodyPreview:"正文:",resetToDefault:"恢复默认",titleRequired:"标题为必填项",bodyRequired:"正文为必填项",notificationLog:"通知日志",showFailedOnly:"仅显示失败",last24Hours:"最近 24 小时",last7Days:"最近 7 天",last30Days:"最近 30 天",last90Days:"最近 90 天",justNow:"刚刚",noFailedNotifications:"没有失败的通知",noNotificationsLogged:"没有通知记录",unknownProvider:"未知提供商",logTitle:"标题",logMessage:"消息",logError:"错误",logProvider:"提供商:{{type}}",logTime:"时间:{{time}}",refresh:"刷新",clearOld:"清除旧记录",statsSummary:"最近 {{days}} 天:",statsNotifications:"条通知",statsSent:"{{count}} 条已发送",statsFailed:"{{count}} 条失败",eventTypes:{print_start:"打印已开始",print_complete:"打印完成",print_failed:"打印失败",print_stopped:"打印已停止",print_progress:"进度",printer_offline:"打印机离线",printer_error:"打印机错误",filament_low:"耗材不足",maintenance_due:"需要维护",test:"测试"}},richTextEditor:{bold:"粗体",italic:"斜体",underline:"下划线",bulletList:"无序列表",numberedList:"有序列表",alignLeft:"左对齐",alignCenter:"居中对齐",alignRight:"右对齐",addLink:"添加链接",removeLink:"移除链接"},externalLinks:{noLinksConfigured:"未配置外部链接",deleteLink:"删除链接",removeCustomIcon:"移除自定义图标",openInNewTab:"在新标签页中打开",placeholders:{linkName:"我的链接"}},keyboardShortcuts:{title:"键盘快捷键",navigation:"导航",archivesSection:"归档",kProfilesSection:"K 值配置",generalSection:"通用",shortcuts:{goToPrinters:"前往打印机",goToArchives:"前往归档",goToQueue:"前往队列",goToStats:"前往统计",goToProfiles:"前往云端配置",goToSettings:"前往设置",focusSearch:"聚焦搜索",openUploadModal:"打开上传对话框",clearSelection:"清除选择 / 取消焦点",contextMenu:"卡片右键菜单",refreshProfiles:"刷新配置",newProfile:"新建配置",exitSelectionMode:"退出选择模式",showHelp:"显示此帮助"},footer:"按 Esc 或点击外部关闭"},notificationLog:{title:"通知日志",events:{printStarted:"打印开始",printComplete:"打印完成",printFailed:"打印失败",printStopped:"打印停止",progress:"进度",printerOffline:"打印机离线",printerError:"打印机错误",lowFilament:"耗材不足",maintenanceDue:"维护到期",test:"测试"},timeAgo:{justNow:"刚刚",minutesAgo:"{{minutes}} 分钟前",hoursAgo:"{{hours}} 小时前"}},restoreBackup:{title:"恢复备份",restoring:"恢复中...",restoreComplete:"恢复完成",restoreFailed:"恢复失败",importSettings:"从备份文件导入设置",pleaseWait:"请稍候,正在恢复您的数据",clickToSelect:"点击选择备份文件(.json 或 .zip)",howDuplicateHandling:"重复处理方式:",categories:{printers:"打印机",smartPlugs:"智能插座",notificationProviders:"通知提供商",filaments:"耗材",archives:"归档",pendingUploads:"待处理上传",settingsTemplates:"设置和模板"},matchingInfo:{printers:"按序列号匹配",smartPlugs:"按 IP 地址匹配",notificationProviders:"按名称匹配",filaments:"按名称 + 类型 + 品牌匹配",archives:"按内容哈希匹配",pendingUploads:"按文件名匹配",settingsTemplates:"始终覆盖"},replaceExisting:"替换现有数据",keepExisting:"保留现有数据",replaceDescription:"用备份数据覆盖已存在的项目",keepDescription:"仅恢复不存在的项目",caution:"注意:",cautionText:"覆盖将用备份数据替换您当前的配置。出于安全考虑,打印机访问码永远不会被覆盖。",itemsRestored:"已恢复项目",itemsSkipped:"已跳过项目",restored:"已恢复",skipped:"已跳过(已存在)",filesLabel:"文件(3MF、缩略图等)",newApiKeysGenerated:"已生成新 API 密钥",newApiKeysWarning:"这些密钥仅显示一次。请立即复制!",processingBackup:"处理备份文件中...",noDataFound:"备份文件中未找到可恢复的数据。",failedToRestore:"恢复备份失败。请检查文件格式。"},backupExport:{title:"导出备份",selectData:"选择要包含的数据",selectAll:"全选",selectNone:"全不选",categoryDescriptions:{settings:"语言、主题、更新偏好",notifications:"ntfy、Pushover、Discord 等",templates:"自定义消息模板",smartPlugs:"Tasmota 插座配置",externalLinks:"侧边栏外部服务链接",printers:"打印机信息(不含访问码)",plateDetection:"空打印板参考图像",filaments:"耗材类型和成本",maintenance:"自定义维护计划",archives:"所有打印数据 + 文件(3MF、缩略图、照片)",projects:"项目、材料清单和附件",pendingUploads:"虚拟打印机待审核的上传",apiKeys:"Webhook API 密钥(导入时生成新密钥)"},requiresPrinters:"需要选择打印机",zipFileWarning:"将创建 ZIP 文件。",zipFileDescription:"包括所有 3MF 文件、缩略图、延时摄影和照片。这可能需要一些时间并生成较大的文件。",includeAccessCodes:"包含访问码",includeAccessCodesDescription:"用于转移到另一台机器",includeAccessCodesWarning:"访问码将以明文形式包含。请妥善保管此备份文件!",categoriesSelected:"已选择 {{selectedCount}} 个类别"},pendingUploads:{placeholders:{notes:"添加关于此打印的备注..."},discardUpload:"丢弃上传",archiveAllUploads:"归档所有上传",discardAllUploads:"丢弃所有上传",archive:"归档",timeAgo:{justNow:"刚刚",minutesAgo:"{{minutes}} 分钟前",hoursAgo:"{{hours}} 小时前",daysAgo:"{{days}} 天前"}},apiBrowser:{placeholders:{requestBody:"JSON 请求体...",searchEndpoints:"搜索端点..."}},configureAmsSlot:{title:"配置 AMS 槽位",slotConfigured:"槽位已配置!",configuringSlot:"正在配置槽位:",slotLabel:"{{ams}} 槽位 {{slot}}",searchPresets:"搜索预设...",colorPlaceholder:"颜色名称或十六进制(例如:棕色、FF8800)",clearCustomColor:"清除自定义颜色",noCloudPresets:"无云端预设。登录拓竹云以同步。",noPresetsAvailable:"无可用预设。登录拓竹云或导入本地配置。",noMatchingPresets:"未找到匹配的预设。",custom:"自定义",builtin:"内置",settingsSentToPrinter:"设置已发送到打印机",filamentProfile:"耗材配置",kProfileLabel:"K 值配置(压力推进)",filteringFor:"筛选:{{material}}",noKProfile:"无 K 值配置(使用默认值 0.020)",noMatchingKProfiles:"未找到匹配的 K 值配置。将使用默认 K=0.020。",selectFilamentFirst:"请先选择耗材配置",kFromCalibration:"K={{value}}(来自打印机校准)",customColorLabel:"自定义颜色(可选)",presetColors:"{{name}} 颜色:",showLessColors:"显示更少颜色",showMoreColors:"显示更多颜色",clear:"清除",hexLabel:"十六进制:#{{hex}}",resetting:"重置中...",resetSlot:"重置槽位",cancel:"取消",configuring:"配置中...",configureSlot:"配置槽位"},githubBackup:{title:"GitHub 备份",history:"历史",downloadBackup:"下载备份",restoreBackup:"恢复备份",noBackupsYet:"暂无备份"},emailSettings:{placeholders:{fromName:"BamBuddy"}},tagManagement:{searchTags:"搜索标签...",renameTag:"重命名标签",deleteTag:"删除标签"},notificationTemplates:{placeholders:{title:"通知标题...",body:"通知正文..."}},batchTag:{placeholders:{newTag:"输入新标签..."}},photoGallery:{deletePhoto:"删除照片"},filamentHoverCard:{copySpoolUuid:"复制耗材 UUID"},kProfilesView:{hasNote:"有备注",copyProfile:"复制配置"},layout:{openMenu:"打开菜单",noPermissionSystemInfo:"您没有查看系统信息的权限"},dashboard:{dragToReorder:"拖动以重新排列",hideWidget:"隐藏小部件"},notificationProviderCard:{deleteNotificationProvider:"删除通知提供商"},fileManagerModal:{closeFileManager:"关闭文件管理器",sortFiles:"排序文件",goToParentFolder:"返回上级文件夹",threeView:"3D 视图"},embeddedCameraViewer:{refreshStream:"刷新流",close:"关闭",zoomOut:"缩小",resetZoom:"重置缩放",zoomIn:"放大",dragToResize:"拖动调整大小"},timelapseViewer:{skipBack5s:"后退 5 秒",skipForward5s:"前进 5 秒"},notificationProviders:{descriptions:{email:"SMTP 邮件通知",telegram:"通过 Telegram 机器人通知",discord:"通过 Webhook 发送到 Discord 频道",ntfy:"免费、可自托管的推送通知",pushover:"简单、可靠的推送通知",callmebot:"通过 CallMeBot 的免费 WhatsApp 通知",webhook:"通用 HTTP POST 到任意 URL"}},logViewer:{searchPlaceholder:"搜索消息或日志名称...",noLogEntries:"未找到日志条目"},switchbarPopover:{noSwitchesInSwitchbar:"切换栏中没有开关"},projectPageModal:{placeholders:{title:"标题",designer:"设计师",license:"许可证",description:"输入描述...",profileTitle:"配置标题",profileDescription:"配置描述..."}},spoolmanSettings:{},time:{unknown:"-",waiting:"等待中",justNow:"刚刚",now:"现在",minsAgo:"{{count}} 分钟前",inMins:"{{count}} 分钟后",hoursAgo:"{{count}} 小时前",inHours:"{{count}} 小时后",daysAgo:"{{count}} 天前",inDays:"{{count}} 天后"},spoolbuddy:{nav:{dashboard:"仪表板",ams:"AMS",inventory:"库存",writeTag:"写入",settings:"设置"},status:{nfcReady:"NFC 就绪",nfcOff:"NFC 关闭",offline:"离线",online:"在线",noPrinters:"无打印机",deviceOffline:"设备离线",waitingConnection:"等待设备连接...",systemReady:"系统就绪",status:"状态"},dashboard:{readyToScan:"准备扫描",idleMessage:"将耗材放在秤上以识别",nfcHint:"NFC 标签将自动读取",device:"设备",syncWeight:"同步重量",weightSynced:"已同步!",unknownTag:"未知标签",newTag:"检测到新标签",onScale:"在秤上",linkSpool:"链接到耗材",linkTagTitle:"将标签链接到耗材",linkTag:"链接标签",selectSpool:"选择要链接此标签的耗材:",noUntagged:"未找到没有标签的耗材",tagDetected:"检测到标签",noTag:"无标签",tagId:"标签",grossWeight:"毛重",spoolSize:"耗材盘尺寸",close:"关闭",currentSpool:"当前耗材"},modal:{spoolDetected:"检测到耗材",assignToAms:"分配到 AMS",syncWeight:"同步重量",weightSynced:"已同步!",syncing:"同步中...",newTagDetected:"检测到新标签",addToInventory:"添加到库存",assignToAmsTitle:"分配到 AMS",selectSlot:"选择槽位",assign:"分配",assigning:"分配中...",assignSuccess:"已分配!",assignError:"分配耗材失败。请重试。",noPrinterSelected:"选择打印机...",noAmsDetected:"此打印机未检测到 AMS",slot:"槽位"},weight:{noReading:"无读数",stable:"稳定",measuring:"测量中...",tare:"去皮",calibrate:"校准"},spool:{remaining:"剩余",material:"材料",brand:"品牌",color:"颜色",coreWeight:"空盘",labelWeight:"标签",scaleWeight:"秤重",netWeight:"净重",lastUsed:"上次使用"},ams:{noData:"未检测到 AMS",connectAms:"连接 AMS 以查看耗材槽位",noPrinter:"未选择打印机",selectPrinter:"从顶部栏选择打印机",printerDisconnected:"打印机已断开",humidity:"湿度",level:"余量",active:"活跃",slot:"槽位",empty:"空"},inventory:{search:"搜索耗材...",empty:"库存中没有耗材",noResults:"没有匹配的耗材",spools:"个耗材",addSpool:"添加耗材"},settings:{tabDevice:"设备",tabDisplay:"显示",tabScale:"秤",tabUpdates:"更新",nfcReader:"NFC 读卡器",type:"类型",connection:"连接",notConnected:"不适用",deviceInfo:"设备信息",hostname:"主机",uptime:"运行时间",brightness:"亮度",saved:"已保存",noBacklight:"未检测到 DSI 背光。亮度控制需要 DSI 显示屏。",screenBlank:"屏幕熄灭超时",screenBlankDesc:"不活动后屏幕关闭。触摸唤醒。",displayNote:"亮度作为软件滤镜应用。",scaleCalibration:"秤校准",currentWeight:"当前重量",tareOffset:"去皮",calFactor:"系数",knownWeight:"已知重量",calStep1:"移除秤上所有物品并按设置零点。",calStep2:"将已知重量放在秤上。",setZero:"设置零点",calibrateNow:"校准",calibrated:"已校准",tareSet:"去皮命令已发送。等待设备响应...",tareFailed:"发送去皮命令失败",zeroSet:"零点已设置。将已知重量放在秤上。",calibrationDone:"校准完成!",calibrationFailed:"校准失败",lastCalibrated:"上次校准",stable:"稳定",settling:"稳定中...",firmware:"固件",scale:"秤",noDevice:"未找到 SpoolBuddy 设备",daemonVersion:"守护进程版本",currentVersion:"当前",versionPending:"等待守护进程...",checking:"检查中...",checkUpdates:"检查更新",updateAvailable:"有可用更新",updateInstructions:"通过 SSH 更新:运行 SpoolBuddy 安装脚本进行升级。",upToDate:"已是最新",includeBeta:"包含测试版本"},writeTag:{tabExisting:"现有耗材",tabNew:"新耗材",tabReplace:"替换标签",searchPlaceholder:"按材料、颜色、品牌搜索...",noUntaggedSpools:"没有无标签的耗材",noTaggedSpools:"没有有标签的耗材",selectSpool:"选择一个耗材,然后将空白 NTAG 放在读卡器上",placeTag:"将 NTAG 放在读卡器上",tagReady:"检测到标签 — 准备写入",writeTag:"写入标签",replaceTag:"替换标签",writing:"写入标签中...",waiting:"等待 SpoolBuddy...",writeSuccess:"标签写入成功!",writeFailed:"写入失败",queueFailed:"排队写入命令失败",tryAgain:"重试",cancel:"取消",replaceWarning:"旧标签将被取消链接。新标签将替换它。",deviceOffline:"SpoolBuddy 离线",material:"材料",colorName:"颜色名称",color:"颜色",brand:"品牌",weight:"重量 (g)",createSpool:"创建耗材",creating:"创建中...",spoolCreated:"耗材已创建!准备写入。",createFailed:"创建耗材失败"}},bugReport:{title:"报告错误",description:"描述",descriptionPlaceholder:"出了什么问题?请描述问题...",email:"邮箱(可选)",emailPlaceholder:"your@email.com",emailPrivacy:"如果提供,您的邮箱将包含在GitHub Issue的折叠部分中,以便维护者后续跟进。",screenshot:"截图",uploadOrPaste:"上传、粘贴或拖拽图片",dataCollectedSummary:"报告中包含哪些数据?",dataIncluded:"包含:",dataIncludedList:"应用版本、操作系统、架构、Python版本、数据库统计(仅计数)、打印机型号、喷嘴数量、固件版本、连接状态、集成状态(Spoolman、MQTT、HA)、非敏感设置、网络接口数量、Docker详情、依赖版本。",dataNeverIncluded:"绝不包含:",dataNeverIncludedList:"打印机名称、序列号、访问代码、密码、IP地址、邮箱地址、API密钥、令牌、Webhook URL、主机名或用户名。",submit:"提交",collectingLogs:"正在收集诊断日志...",collectingLogsHint:"已启用调试日志,正在查询打印机获取最新数据。",submitting:"正在提交错误报告...",submitSuccess:"错误报告提交成功!",submitFailed:"提交错误报告失败",thankYou:"谢谢!",submitted:"您的错误报告已提交。",viewIssue:"查看Issue",unexpectedError:"发生了意外错误",countdownSeconds:"{{seconds}}秒"}},rde={en:{translation:Xce},de:{translation:Qce},fr:{translation:Zce},ja:{translation:Jce},it:{translation:ede},"pt-BR":{translation:tde},"zh-CN":{translation:nde}};Hs.use(rY).use(Pce).init({resources:rde,fallbackLng:"en",supportedLngs:["en","de","fr","ja","it","pt-BR","zh-CN"],detection:{order:["localStorage","navigator","htmlTag"],lookupLocalStorage:"bambutrack_language",caches:["localStorage"]},interpolation:{escapeValue:!1},react:{useSuspense:!1}});const LB=[{code:"en",name:"English",nativeName:"English"},{code:"de",name:"German",nativeName:"Deutsch"},{code:"fr",name:"French",nativeName:"Français"},{code:"ja",name:"Japanese",nativeName:"日本語"},{code:"it",name:"Italian",nativeName:"Italiano"},{code:"pt-BR",name:"Portuguese (Brazil)",nativeName:"Português (Brasil)"},{code:"zh-CN",name:"Chinese (Simplified)",nativeName:"简体中文"}];var OB="popstate";function ide(t={}){function e(r,a){let{pathname:s,search:o,hash:l}=r.location;return mD("",{pathname:s,search:o,hash:l},a.state&&a.state.usr||null,a.state&&a.state.key||"default")}function n(r,a){return typeof a=="string"?a:jv(a)}return sde(e,n,null,t)}function hi(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function yl(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function ade(){return Math.random().toString(36).substring(2,10)}function IB(t,e){return{usr:t.state,key:t.key,idx:e}}function mD(t,e,n=null,r){return{pathname:typeof t=="string"?t:t.pathname,search:"",hash:"",...typeof e=="string"?ax(e):e,state:n,key:e&&e.key||r||ade()}}function jv({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 ax(t){let e={};if(t){let n=t.indexOf("#");n>=0&&(e.hash=t.substring(n),t=t.substring(0,n));let r=t.indexOf("?");r>=0&&(e.search=t.substring(r),t=t.substring(0,r)),t&&(e.pathname=t)}return e}function sde(t,e,n,r={}){let{window:a=document.defaultView,v5Compat:s=!1}=r,o=a.history,l="POP",c=null,d=u();d==null&&(d=0,o.replaceState({...o.state,idx:d},""));function u(){return(o.state||{idx:null}).idx}function m(){l="POP";let b=u(),v=b==null?null:b-d;d=b,c&&c({action:l,location:x.location,delta:v})}function p(b,v){l="PUSH";let _=mD(x.location,b,v);d=u()+1;let k=IB(_,d),P=x.createHref(_);try{o.pushState(k,"",P)}catch(C){if(C instanceof DOMException&&C.name==="DataCloneError")throw C;a.location.assign(P)}s&&c&&c({action:l,location:x.location,delta:1})}function f(b,v){l="REPLACE";let _=mD(x.location,b,v);d=u();let k=IB(_,d),P=x.createHref(_);o.replaceState(k,"",P),s&&c&&c({action:l,location:x.location,delta:0})}function y(b){return ode(b)}let x={get action(){return l},get location(){return t(a,o)},listen(b){if(c)throw new Error("A history only accepts one active listener");return a.addEventListener(OB,m),c=b,()=>{a.removeEventListener(OB,m),c=null}},createHref(b){return e(a,b)},createURL:y,encodeLocation(b){let v=y(b);return{pathname:v.pathname,search:v.search,hash:v.hash}},push:p,replace:f,go(b){return o.go(b)}};return x}function ode(t,e=!1){let n="http://localhost";typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),hi(n,"No window.location.(origin|href) available to create URL");let r=typeof t=="string"?t:jv(t);return r=r.replace(/ $/,"%20"),!e&&r.startsWith("//")&&(r=n+r),new URL(r,n)}function iY(t,e,n="/"){return lde(t,e,n,!1)}function lde(t,e,n,r){let a=typeof e=="string"?ax(e):e,s=su(a.pathname||"/",n);if(s==null)return null;let o=aY(t);cde(o);let l=null;for(let c=0;l==null&&c<o.length;++c){let d=vde(s);l=xde(o[c],d,r)}return l}function aY(t,e=[],n=[],r="",a=!1){let s=(o,l,c=a,d)=>{let u={relativePath:d===void 0?o.path||"":d,caseSensitive:o.caseSensitive===!0,childrenIndex:l,route:o};if(u.relativePath.startsWith("/")){if(!u.relativePath.startsWith(r)&&c)return;hi(u.relativePath.startsWith(r),`Absolute route path "${u.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),u.relativePath=u.relativePath.slice(r.length)}let m=Qd([r,u.relativePath]),p=n.concat(u);o.children&&o.children.length>0&&(hi(o.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${m}".`),aY(o.children,e,p,m,c)),!(o.path==null&&!o.index)&&e.push({path:m,score:gde(m,o.index),routesMeta:p})};return t.forEach((o,l)=>{if(o.path===""||!o.path?.includes("?"))s(o,l);else for(let c of sY(o.path))s(o,l,!0,c)}),e}function sY(t){let e=t.split("/");if(e.length===0)return[];let[n,...r]=e,a=n.endsWith("?"),s=n.replace(/\?$/,"");if(r.length===0)return a?[s,""]:[s];let o=sY(r.join("/")),l=[];return l.push(...o.map(c=>c===""?s:[s,c].join("/"))),a&&l.push(...o),l.map(c=>t.startsWith("/")&&c===""?"/":c)}function cde(t){t.sort((e,n)=>e.score!==n.score?n.score-e.score:bde(e.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}var dde=/^:[\w-]+$/,ude=3,mde=2,hde=1,pde=10,fde=-2,zB=t=>t==="*";function gde(t,e){let n=t.split("/"),r=n.length;return n.some(zB)&&(r+=fde),e&&(r+=mde),n.filter(a=>!zB(a)).reduce((a,s)=>a+(dde.test(s)?ude:s===""?hde:pde),r)}function bde(t,e){return t.length===e.length&&t.slice(0,-1).every((r,a)=>r===e[a])?t[t.length-1]-e[e.length-1]:0}function xde(t,e,n=!1){let{routesMeta:r}=t,a={},s="/",o=[];for(let l=0;l<r.length;++l){let c=r[l],d=l===r.length-1,u=s==="/"?e:e.slice(s.length)||"/",m=I1({path:c.relativePath,caseSensitive:c.caseSensitive,end:d},u),p=c.route;if(!m&&d&&n&&!r[r.length-1].route.index&&(m=I1({path:c.relativePath,caseSensitive:c.caseSensitive,end:!1},u)),!m)return null;Object.assign(a,m.params),o.push({params:a,pathname:Qd([s,m.pathname]),pathnameBase:kde(Qd([s,m.pathnameBase])),route:p}),m.pathnameBase!=="/"&&(s=Qd([s,m.pathnameBase]))}return o}function I1(t,e){typeof t=="string"&&(t={path:t,caseSensitive:!1,end:!0});let[n,r]=yde(t.path,t.caseSensitive,t.end),a=e.match(n);if(!a)return null;let s=a[0],o=s.replace(/(.)\/+$/,"$1"),l=a.slice(1);return{params:r.reduce((d,{paramName:u,isOptional:m},p)=>{if(u==="*"){let y=l[p]||"";o=s.slice(0,s.length-y.length).replace(/(.)\/+$/,"$1")}const f=l[p];return m&&!f?d[u]=void 0:d[u]=(f||"").replace(/%2F/g,"/"),d},{}),pathname:s,pathnameBase:o,pattern:t}}function yde(t,e=!1,n=!0){yl(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 r=[],a="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,l,c)=>(r.push({paramName:l,isOptional:c!=null}),c?"/?([^\\/]+)?":"/([^\\/]+)")).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return t.endsWith("*")?(r.push({paramName:"*"}),a+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?a+="\\/*$":t!==""&&t!=="/"&&(a+="(?:(?=\\/|$))"),[new RegExp(a,e?void 0:"i"),r]}function vde(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return yl(!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 su(t,e){if(e==="/")return t;if(!t.toLowerCase().startsWith(e.toLowerCase()))return null;let n=e.endsWith("/")?e.length-1:e.length,r=t.charAt(n);return r&&r!=="/"?null:t.slice(n)||"/"}var wde=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function Sde(t,e="/"){let{pathname:n,search:r="",hash:a=""}=typeof t=="string"?ax(t):t,s;return n?(n=n.replace(/\/\/+/g,"/"),n.startsWith("/")?s=UB(n.substring(1),"/"):s=UB(n,e)):s=e,{pathname:s,search:Nde(r),hash:Cde(a)}}function UB(t,e){let n=e.replace(/\/+$/,"").split("/");return t.split("/").forEach(a=>{a===".."?n.length>1&&n.pop():a!=="."&&n.push(a)}),n.length>1?n.join("/"):"/"}function JA(t,e,n,r){return`Cannot include a '${t}' character in a manually specified \`to.${e}\` field [${JSON.stringify(r)}]. 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 _de(t){return t.filter((e,n)=>n===0||e.route.path&&e.route.path.length>0)}function MF(t){let e=_de(t);return e.map((n,r)=>r===e.length-1?n.pathname:n.pathnameBase)}function EF(t,e,n,r=!1){let a;typeof t=="string"?a=ax(t):(a={...t},hi(!a.pathname||!a.pathname.includes("?"),JA("?","pathname","search",a)),hi(!a.pathname||!a.pathname.includes("#"),JA("#","pathname","hash",a)),hi(!a.search||!a.search.includes("#"),JA("#","search","hash",a)));let s=t===""||a.pathname==="",o=s?"/":a.pathname,l;if(o==null)l=n;else{let m=e.length-1;if(!r&&o.startsWith("..")){let p=o.split("/");for(;p[0]==="..";)p.shift(),m-=1;a.pathname=p.join("/")}l=m>=0?e[m]:"/"}let c=Sde(a,l),d=o&&o!=="/"&&o.endsWith("/"),u=(s||o===".")&&n.endsWith("/");return!c.pathname.endsWith("/")&&(d||u)&&(c.pathname+="/"),c}var Qd=t=>t.join("/").replace(/\/\/+/g,"/"),kde=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),Nde=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,Cde=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t,Tde=class{constructor(t,e,n,r=!1){this.status=t,this.statusText=e||"",this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function Pde(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}function Ade(t){return t.map(e=>e.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var oY=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function lY(t,e){let n=t;if(typeof n!="string"||!wde.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,a=!1;if(oY)try{let s=new URL(window.location.href),o=n.startsWith("//")?new URL(s.protocol+n):new URL(n),l=su(o.pathname,e);o.origin===s.origin&&l!=null?n=l+o.search+o.hash:a=!0}catch{yl(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:a,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var cY=["POST","PUT","PATCH","DELETE"];new Set(cY);var Mde=["GET",...cY];new Set(Mde);var sx=w.createContext(null);sx.displayName="DataRouter";var sC=w.createContext(null);sC.displayName="DataRouterState";var Ede=w.createContext(!1),dY=w.createContext({isTransitioning:!1});dY.displayName="ViewTransition";var jde=w.createContext(new Map);jde.displayName="Fetchers";var Dde=w.createContext(null);Dde.displayName="Await";var Uo=w.createContext(null);Uo.displayName="Navigation";var P0=w.createContext(null);P0.displayName="Location";var Al=w.createContext({outlet:null,matches:[],isDataRoute:!1});Al.displayName="Route";var jF=w.createContext(null);jF.displayName="RouteError";var uY="REACT_ROUTER_ERROR",Rde="REDIRECT",Fde="ROUTE_ERROR_RESPONSE";function Lde(t){if(t.startsWith(`${uY}:${Rde}:{`))try{let e=JSON.parse(t.slice(28));if(typeof e=="object"&&e&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.location=="string"&&typeof e.reloadDocument=="boolean"&&typeof e.replace=="boolean")return e}catch{}}function Ode(t){if(t.startsWith(`${uY}:${Fde}:{`))try{let e=JSON.parse(t.slice(40));if(typeof e=="object"&&e&&typeof e.status=="number"&&typeof e.statusText=="string")return new Tde(e.status,e.statusText,e.data)}catch{}}function Ide(t,{relative:e}={}){hi(ox(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:r}=w.useContext(Uo),{hash:a,pathname:s,search:o}=E0(t,{relative:e}),l=s;return n!=="/"&&(l=s==="/"?n:Qd([n,s])),r.createHref({pathname:l,search:o,hash:a})}function ox(){return w.useContext(P0)!=null}function Zc(){return hi(ox(),"useLocation() may be used only in the context of a <Router> component."),w.useContext(P0).location}var mY="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function hY(t){w.useContext(Uo).static||w.useLayoutEffect(t)}function Ml(){let{isDataRoute:t}=w.useContext(Al);return t?Zde():zde()}function zde(){hi(ox(),"useNavigate() may be used only in the context of a <Router> component.");let t=w.useContext(sx),{basename:e,navigator:n}=w.useContext(Uo),{matches:r}=w.useContext(Al),{pathname:a}=Zc(),s=JSON.stringify(MF(r)),o=w.useRef(!1);return hY(()=>{o.current=!0}),w.useCallback((c,d={})=>{if(yl(o.current,mY),!o.current)return;if(typeof c=="number"){n.go(c);return}let u=EF(c,JSON.parse(s),a,d.relative==="path");t==null&&e!=="/"&&(u.pathname=u.pathname==="/"?e:Qd([e,u.pathname])),(d.replace?n.replace:n.push)(u,d.state,d)},[e,n,s,a,t])}var pY=w.createContext(null);function A0(){return w.useContext(pY)}function Ude(t){let e=w.useContext(Al).outlet;return w.useMemo(()=>e&&w.createElement(pY.Provider,{value:t},e),[e,t])}function M0(){let{matches:t}=w.useContext(Al),e=t[t.length-1];return e?e.params:{}}function E0(t,{relative:e}={}){let{matches:n}=w.useContext(Al),{pathname:r}=Zc(),a=JSON.stringify(MF(n));return w.useMemo(()=>EF(t,JSON.parse(a),r,e==="path"),[t,a,r,e])}function Bde(t,e){return fY(t,e)}function fY(t,e,n,r,a){hi(ox(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:s}=w.useContext(Uo),{matches:o}=w.useContext(Al),l=o[o.length-1],c=l?l.params:{},d=l?l.pathname:"/",u=l?l.pathnameBase:"/",m=l&&l.route;{let _=m&&m.path||"";bY(d,!m||_.endsWith("*")||_.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${d}" (under <Route path="${_}">) 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.
- Please change the parent <Route path="${_}"> to <Route path="${_==="/"?"*":`${_}/*`}">.`)}let p=Zc(),f;if(e){let _=typeof e=="string"?ax(e):e;hi(u==="/"||_.pathname?.startsWith(u),`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 "${u}" but pathname "${_.pathname}" was given in the \`location\` prop.`),f=_}else f=p;let y=f.pathname||"/",x=y;if(u!=="/"){let _=u.replace(/^\//,"").split("/");x="/"+y.replace(/^\//,"").split("/").slice(_.length).join("/")}let b=iY(t,{pathname:x});yl(m||b!=null,`No routes matched location "${f.pathname}${f.search}${f.hash}" `),yl(b==null||b[b.length-1].route.element!==void 0||b[b.length-1].route.Component!==void 0||b[b.length-1].route.lazy!==void 0,`Matched leaf route at location "${f.pathname}${f.search}${f.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=Gde(b&&b.map(_=>Object.assign({},_,{params:Object.assign({},c,_.params),pathname:Qd([u,s.encodeLocation?s.encodeLocation(_.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:_.pathname]),pathnameBase:_.pathnameBase==="/"?u:Qd([u,s.encodeLocation?s.encodeLocation(_.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:_.pathnameBase])})),o,n,r,a);return e&&v?w.createElement(P0.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",...f},navigationType:"POP"}},v):v}function Hde(){let t=Qde(),e=Pde(t)?`${t.status} ${t.statusText}`:t instanceof Error?t.message:JSON.stringify(t),n=t instanceof Error?t.stack:null,r="rgba(200,200,200, 0.5)",a={padding:"0.5rem",backgroundColor:r},s={padding:"2px 4px",backgroundColor:r},o=null;return console.error("Error handled by React Router default ErrorBoundary:",t),o=w.createElement(w.Fragment,null,w.createElement("p",null,"💿 Hey developer 👋"),w.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",w.createElement("code",{style:s},"ErrorBoundary")," or"," ",w.createElement("code",{style:s},"errorElement")," prop on your route.")),w.createElement(w.Fragment,null,w.createElement("h2",null,"Unexpected Application Error!"),w.createElement("h3",{style:{fontStyle:"italic"}},e),n?w.createElement("pre",{style:a},n):null,o)}var $de=w.createElement(Hde,null),gY=class extends w.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(){let t=this.state.error;if(this.context&&typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){const n=Ode(t.digest);n&&(t=n)}let e=t!==void 0?w.createElement(Al.Provider,{value:this.props.routeContext},w.createElement(jF.Provider,{value:t,children:this.props.component})):this.props.children;return this.context?w.createElement(qde,{error:t},e):e}};gY.contextType=Ede;var eM=new WeakMap;function qde({children:t,error:e}){let{basename:n}=w.useContext(Uo);if(typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){let r=Lde(e.digest);if(r){let a=eM.get(e);if(a)throw a;let s=lY(r.location,n);if(oY&&!eM.get(e))if(s.isExternal||r.reloadDocument)window.location.href=s.absoluteURL||s.to;else{const o=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(s.to,{replace:r.replace}));throw eM.set(e,o),o}return w.createElement("meta",{httpEquiv:"refresh",content:`0;url=${s.absoluteURL||s.to}`})}}return t}function Vde({routeContext:t,match:e,children:n}){let r=w.useContext(sx);return r&&r.static&&r.staticContext&&(e.route.errorElement||e.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=e.route.id),w.createElement(Al.Provider,{value:t},n)}function Gde(t,e=[],n=null,r=null,a=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 s=t,o=n?.errors;if(o!=null){let u=s.findIndex(m=>m.route.id&&o?.[m.route.id]!==void 0);hi(u>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(o).join(",")}`),s=s.slice(0,Math.min(s.length,u+1))}let l=!1,c=-1;if(n)for(let u=0;u<s.length;u++){let m=s[u];if((m.route.HydrateFallback||m.route.hydrateFallbackElement)&&(c=u),m.route.id){let{loaderData:p,errors:f}=n,y=m.route.loader&&!p.hasOwnProperty(m.route.id)&&(!f||f[m.route.id]===void 0);if(m.route.lazy||y){l=!0,c>=0?s=s.slice(0,c+1):s=[s[0]];break}}}let d=n&&r?(u,m)=>{r(u,{location:n.location,params:n.matches?.[0]?.params??{},unstable_pattern:Ade(n.matches),errorInfo:m})}:void 0;return s.reduceRight((u,m,p)=>{let f,y=!1,x=null,b=null;n&&(f=o&&m.route.id?o[m.route.id]:void 0,x=m.route.errorElement||$de,l&&(c<0&&p===0?(bY("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),y=!0,b=null):c===p&&(y=!0,b=m.route.hydrateFallbackElement||null)));let v=e.concat(s.slice(0,p+1)),_=()=>{let k;return f?k=x:y?k=b:m.route.Component?k=w.createElement(m.route.Component,null):m.route.element?k=m.route.element:k=u,w.createElement(Vde,{match:m,routeContext:{outlet:u,matches:v,isDataRoute:n!=null},children:k})};return n&&(m.route.ErrorBoundary||m.route.errorElement||p===0)?w.createElement(gY,{location:n.location,revalidation:n.revalidation,component:x,error:f,children:_(),routeContext:{outlet:null,matches:v,isDataRoute:!0},onError:d}):_()},null)}function DF(t){return`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Wde(t){let e=w.useContext(sx);return hi(e,DF(t)),e}function Kde(t){let e=w.useContext(sC);return hi(e,DF(t)),e}function Yde(t){let e=w.useContext(Al);return hi(e,DF(t)),e}function RF(t){let e=Yde(t),n=e.matches[e.matches.length-1];return hi(n.route.id,`${t} can only be used on routes that contain a unique "id"`),n.route.id}function Xde(){return RF("useRouteId")}function Qde(){let t=w.useContext(jF),e=Kde("useRouteError"),n=RF("useRouteError");return t!==void 0?t:e.errors?.[n]}function Zde(){let{router:t}=Wde("useNavigate"),e=RF("useNavigate"),n=w.useRef(!1);return hY(()=>{n.current=!0}),w.useCallback(async(a,s={})=>{yl(n.current,mY),n.current&&(typeof a=="number"?await t.navigate(a):await t.navigate(a,{fromRouteId:e,...s}))},[t,e])}var BB={};function bY(t,e,n){!e&&!BB[t]&&(BB[t]=!0,yl(!1,n))}w.memo(Jde);function Jde({routes:t,future:e,state:n,onError:r}){return fY(t,void 0,n,r,e)}function Tb({to:t,replace:e,state:n,relative:r}){hi(ox(),"<Navigate> may be used only in the context of a <Router> component.");let{static:a}=w.useContext(Uo);yl(!a,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:s}=w.useContext(Al),{pathname:o}=Zc(),l=Ml(),c=EF(t,MF(s),o,r==="path"),d=JSON.stringify(c);return w.useEffect(()=>{l(JSON.parse(d),{replace:e,state:n,relative:r})},[l,d,r,e,n]),null}function xY(t){return Ude(t.context)}function Mr(t){hi(!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 eue({basename:t="/",children:e=null,location:n,navigationType:r="POP",navigator:a,static:s=!1,unstable_useTransitions:o}){hi(!ox(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let l=t.replace(/^\/*/,"/"),c=w.useMemo(()=>({basename:l,navigator:a,static:s,unstable_useTransitions:o,future:{}}),[l,a,s,o]);typeof n=="string"&&(n=ax(n));let{pathname:d="/",search:u="",hash:m="",state:p=null,key:f="default"}=n,y=w.useMemo(()=>{let x=su(d,l);return x==null?null:{location:{pathname:x,search:u,hash:m,state:p,key:f},navigationType:r}},[l,d,u,m,p,f,r]);return yl(y!=null,`<Router basename="${l}"> is not able to match the URL "${d}${u}${m}" because it does not start with the basename, so the <Router> won't render anything.`),y==null?null:w.createElement(Uo.Provider,{value:c},w.createElement(P0.Provider,{children:e,value:y}))}function tue({children:t,location:e}){return Bde(hD(t),e)}function hD(t,e=[]){let n=[];return w.Children.forEach(t,(r,a)=>{if(!w.isValidElement(r))return;let s=[...e,a];if(r.type===w.Fragment){n.push.apply(n,hD(r.props.children,s));return}hi(r.type===Mr,`[${typeof r.type=="string"?r.type:r.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),hi(!r.props.index||!r.props.children,"An index route cannot have child routes.");let o={id:r.props.id||s.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,middleware:r.props.middleware,loader:r.props.loader,action:r.props.action,hydrateFallbackElement:r.props.hydrateFallbackElement,HydrateFallback:r.props.HydrateFallback,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.hasErrorBoundary===!0||r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(o.children=hD(r.props.children,s)),n.push(o)}),n}var o1="get",l1="application/x-www-form-urlencoded";function oC(t){return typeof HTMLElement<"u"&&t instanceof HTMLElement}function nue(t){return oC(t)&&t.tagName.toLowerCase()==="button"}function rue(t){return oC(t)&&t.tagName.toLowerCase()==="form"}function iue(t){return oC(t)&&t.tagName.toLowerCase()==="input"}function aue(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function sue(t,e){return t.button===0&&(!e||e==="_self")&&!aue(t)}function pD(t=""){return new URLSearchParams(typeof t=="string"||Array.isArray(t)||t instanceof URLSearchParams?t:Object.keys(t).reduce((e,n)=>{let r=t[n];return e.concat(Array.isArray(r)?r.map(a=>[n,a]):[[n,r]])},[]))}function oue(t,e){let n=pD(t);return e&&e.forEach((r,a)=>{n.has(a)||e.getAll(a).forEach(s=>{n.append(a,s)})}),n}var wS=null;function lue(){if(wS===null)try{new FormData(document.createElement("form"),0),wS=!1}catch{wS=!0}return wS}var cue=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function tM(t){return t!=null&&!cue.has(t)?(yl(!1,`"${t}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${l1}"`),null):t}function due(t,e){let n,r,a,s,o;if(rue(t)){let l=t.getAttribute("action");r=l?su(l,e):null,n=t.getAttribute("method")||o1,a=tM(t.getAttribute("enctype"))||l1,s=new FormData(t)}else if(nue(t)||iue(t)&&(t.type==="submit"||t.type==="image")){let l=t.form;if(l==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let c=t.getAttribute("formaction")||l.getAttribute("action");if(r=c?su(c,e):null,n=t.getAttribute("formmethod")||l.getAttribute("method")||o1,a=tM(t.getAttribute("formenctype"))||tM(l.getAttribute("enctype"))||l1,s=new FormData(l,t),!lue()){let{name:d,type:u,value:m}=t;if(u==="image"){let p=d?`${d}.`:"";s.append(`${p}x`,"0"),s.append(`${p}y`,"0")}else d&&s.append(d,m)}}else{if(oC(t))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=o1,r=null,a=l1,o=t}return s&&a==="text/plain"&&(o=s,s=void 0),{action:r,method:n.toLowerCase(),encType:a,formData:s,body:o}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function FF(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function uue(t,e,n,r){let a=typeof t=="string"?new URL(t,typeof window>"u"?"server://singlefetch/":window.location.origin):t;return n?a.pathname.endsWith("/")?a.pathname=`${a.pathname}_.${r}`:a.pathname=`${a.pathname}.${r}`:a.pathname==="/"?a.pathname=`_root.${r}`:e&&su(a.pathname,e)==="/"?a.pathname=`${e.replace(/\/$/,"")}/_root.${r}`:a.pathname=`${a.pathname.replace(/\/$/,"")}.${r}`,a}async function mue(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 hue(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 pue(t,e,n){let r=await Promise.all(t.map(async a=>{let s=e.routes[a.route.id];if(s){let o=await mue(s,n);return o.links?o.links():[]}return[]}));return xue(r.flat(1).filter(hue).filter(a=>a.rel==="stylesheet"||a.rel==="preload").map(a=>a.rel==="stylesheet"?{...a,rel:"prefetch",as:"style"}:{...a,rel:"prefetch"}))}function HB(t,e,n,r,a,s){let o=(c,d)=>n[d]?c.route.id!==n[d].route.id:!0,l=(c,d)=>n[d].pathname!==c.pathname||n[d].route.path?.endsWith("*")&&n[d].params["*"]!==c.params["*"];return s==="assets"?e.filter((c,d)=>o(c,d)||l(c,d)):s==="data"?e.filter((c,d)=>{let u=r.routes[c.route.id];if(!u||!u.hasLoader)return!1;if(o(c,d)||l(c,d))return!0;if(c.route.shouldRevalidate){let m=c.route.shouldRevalidate({currentUrl:new URL(a.pathname+a.search+a.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(t,window.origin),nextParams:c.params,defaultShouldRevalidate:!0});if(typeof m=="boolean")return m}return!0}):[]}function fue(t,e,{includeHydrateFallback:n}={}){return gue(t.map(r=>{let a=e.routes[r.route.id];if(!a)return[];let s=[a.module];return a.clientActionModule&&(s=s.concat(a.clientActionModule)),a.clientLoaderModule&&(s=s.concat(a.clientLoaderModule)),n&&a.hydrateFallbackModule&&(s=s.concat(a.hydrateFallbackModule)),a.imports&&(s=s.concat(a.imports)),s}).flat(1))}function gue(t){return[...new Set(t)]}function bue(t){let e={},n=Object.keys(t).sort();for(let r of n)e[r]=t[r];return e}function xue(t,e){let n=new Set;return new Set(e),t.reduce((r,a)=>{let s=JSON.stringify(bue(a));return n.has(s)||(n.add(s),r.push({key:s,link:a})),r},[])}function yY(){let t=w.useContext(sx);return FF(t,"You must render this element inside a <DataRouterContext.Provider> element"),t}function yue(){let t=w.useContext(sC);return FF(t,"You must render this element inside a <DataRouterStateContext.Provider> element"),t}var LF=w.createContext(void 0);LF.displayName="FrameworkContext";function vY(){let t=w.useContext(LF);return FF(t,"You must render this element inside a <HydratedRouter> element"),t}function vue(t,e){let n=w.useContext(LF),[r,a]=w.useState(!1),[s,o]=w.useState(!1),{onFocus:l,onBlur:c,onMouseEnter:d,onMouseLeave:u,onTouchStart:m}=e,p=w.useRef(null);w.useEffect(()=>{if(t==="render"&&o(!0),t==="viewport"){let x=v=>{v.forEach(_=>{o(_.isIntersecting)})},b=new IntersectionObserver(x,{threshold:.5});return p.current&&b.observe(p.current),()=>{b.disconnect()}}},[t]),w.useEffect(()=>{if(r){let x=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(x)}}},[r]);let f=()=>{a(!0)},y=()=>{a(!1),o(!1)};return n?t!=="intent"?[s,p,{}]:[s,p,{onFocus:by(l,f),onBlur:by(c,y),onMouseEnter:by(d,f),onMouseLeave:by(u,y),onTouchStart:by(m,f)}]:[!1,p,{}]}function by(t,e){return n=>{t&&t(n),n.defaultPrevented||e(n)}}function wue({page:t,...e}){let{router:n}=yY(),r=w.useMemo(()=>iY(n.routes,t,n.basename),[n.routes,t,n.basename]);return r?w.createElement(_ue,{page:t,matches:r,...e}):null}function Sue(t){let{manifest:e,routeModules:n}=vY(),[r,a]=w.useState([]);return w.useEffect(()=>{let s=!1;return pue(t,e,n).then(o=>{s||a(o)}),()=>{s=!0}},[t,e,n]),r}function _ue({page:t,matches:e,...n}){let r=Zc(),{future:a,manifest:s,routeModules:o}=vY(),{basename:l}=yY(),{loaderData:c,matches:d}=yue(),u=w.useMemo(()=>HB(t,e,d,s,r,"data"),[t,e,d,s,r]),m=w.useMemo(()=>HB(t,e,d,s,r,"assets"),[t,e,d,s,r]),p=w.useMemo(()=>{if(t===r.pathname+r.search+r.hash)return[];let x=new Set,b=!1;if(e.forEach(_=>{let k=s.routes[_.route.id];!k||!k.hasLoader||(!u.some(P=>P.route.id===_.route.id)&&_.route.id in c&&o[_.route.id]?.shouldRevalidate||k.hasClientLoader?b=!0:x.add(_.route.id))}),x.size===0)return[];let v=uue(t,l,a.unstable_trailingSlashAwareDataRequests,"data");return b&&x.size>0&&v.searchParams.set("_routes",e.filter(_=>x.has(_.route.id)).map(_=>_.route.id).join(",")),[v.pathname+v.search]},[l,a.unstable_trailingSlashAwareDataRequests,c,r,s,u,e,t,o]),f=w.useMemo(()=>fue(m,s),[m,s]),y=Sue(m);return w.createElement(w.Fragment,null,p.map(x=>w.createElement("link",{key:x,rel:"prefetch",as:"fetch",href:x,...n})),f.map(x=>w.createElement("link",{key:x,rel:"modulepreload",href:x,...n})),y.map(({key:x,link:b})=>w.createElement("link",{key:x,nonce:n.nonce,...b,crossOrigin:b.crossOrigin??n.crossOrigin})))}function kue(...t){return e=>{t.forEach(n=>{typeof n=="function"?n(e):n!=null&&(n.current=e)})}}var Nue=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{Nue&&(window.__reactRouterVersion="7.13.0")}catch{}function Cue({basename:t,children:e,unstable_useTransitions:n,window:r}){let a=w.useRef();a.current==null&&(a.current=ide({window:r,v5Compat:!0}));let s=a.current,[o,l]=w.useState({action:s.action,location:s.location}),c=w.useCallback(d=>{n===!1?l(d):w.startTransition(()=>l(d))},[n]);return w.useLayoutEffect(()=>s.listen(c),[s,c]),w.createElement(eue,{basename:t,children:e,location:o.location,navigationType:o.action,navigator:s,unstable_useTransitions:n})}var wY=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Js=w.forwardRef(function({onClick:e,discover:n="render",prefetch:r="none",relative:a,reloadDocument:s,replace:o,state:l,target:c,to:d,preventScrollReset:u,viewTransition:m,unstable_defaultShouldRevalidate:p,...f},y){let{basename:x,unstable_useTransitions:b}=w.useContext(Uo),v=typeof d=="string"&&wY.test(d),_=lY(d,x);d=_.to;let k=Ide(d,{relative:a}),[P,C,T]=vue(r,f),N=Aue(d,{replace:o,state:l,target:c,preventScrollReset:u,relative:a,viewTransition:m,unstable_defaultShouldRevalidate:p,unstable_useTransitions:b});function R(D){e&&e(D),D.defaultPrevented||N(D)}let A=w.createElement("a",{...f,...T,href:_.absoluteURL||k,onClick:_.isExternal||s?e:R,ref:kue(y,C),target:c,"data-discover":!v&&n==="render"?"true":void 0});return P&&!v?w.createElement(w.Fragment,null,A,w.createElement(wue,{page:k})):A});Js.displayName="Link";var rb=w.forwardRef(function({"aria-current":e="page",caseSensitive:n=!1,className:r="",end:a=!1,style:s,to:o,viewTransition:l,children:c,...d},u){let m=E0(o,{relative:d.relative}),p=Zc(),f=w.useContext(sC),{navigator:y,basename:x}=w.useContext(Uo),b=f!=null&&Rue(m)&&l===!0,v=y.encodeLocation?y.encodeLocation(m).pathname:m.pathname,_=p.pathname,k=f&&f.navigation&&f.navigation.location?f.navigation.location.pathname:null;n||(_=_.toLowerCase(),k=k?k.toLowerCase():null,v=v.toLowerCase()),k&&x&&(k=su(k,x)||k);const P=v!=="/"&&v.endsWith("/")?v.length-1:v.length;let C=_===v||!a&&_.startsWith(v)&&_.charAt(P)==="/",T=k!=null&&(k===v||!a&&k.startsWith(v)&&k.charAt(v.length)==="/"),N={isActive:C,isPending:T,isTransitioning:b},R=C?e:void 0,A;typeof r=="function"?A=r(N):A=[r,C?"active":null,T?"pending":null,b?"transitioning":null].filter(Boolean).join(" ");let D=typeof s=="function"?s(N):s;return w.createElement(Js,{...d,"aria-current":R,className:A,ref:u,style:D,to:o,viewTransition:l},typeof c=="function"?c(N):c)});rb.displayName="NavLink";var Tue=w.forwardRef(({discover:t="render",fetcherKey:e,navigate:n,reloadDocument:r,replace:a,state:s,method:o=o1,action:l,onSubmit:c,relative:d,preventScrollReset:u,viewTransition:m,unstable_defaultShouldRevalidate:p,...f},y)=>{let{unstable_useTransitions:x}=w.useContext(Uo),b=jue(),v=Due(l,{relative:d}),_=o.toLowerCase()==="get"?"get":"post",k=typeof l=="string"&&wY.test(l),P=C=>{if(c&&c(C),C.defaultPrevented)return;C.preventDefault();let T=C.nativeEvent.submitter,N=T?.getAttribute("formmethod")||o,R=()=>b(T||C.currentTarget,{fetcherKey:e,method:N,navigate:n,replace:a,state:s,relative:d,preventScrollReset:u,viewTransition:m,unstable_defaultShouldRevalidate:p});x&&n!==!1?w.startTransition(()=>R()):R()};return w.createElement("form",{ref:y,method:_,action:v,onSubmit:r?c:P,...f,"data-discover":!k&&t==="render"?"true":void 0})});Tue.displayName="Form";function Pue(t){return`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function SY(t){let e=w.useContext(sx);return hi(e,Pue(t)),e}function Aue(t,{target:e,replace:n,state:r,preventScrollReset:a,relative:s,viewTransition:o,unstable_defaultShouldRevalidate:l,unstable_useTransitions:c}={}){let d=Ml(),u=Zc(),m=E0(t,{relative:s});return w.useCallback(p=>{if(sue(p,e)){p.preventDefault();let f=n!==void 0?n:jv(u)===jv(m),y=()=>d(t,{replace:f,state:r,preventScrollReset:a,relative:s,viewTransition:o,unstable_defaultShouldRevalidate:l});c?w.startTransition(()=>y()):y()}},[u,d,m,n,r,e,t,a,s,o,l,c])}function OF(t){yl(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let e=w.useRef(pD(t)),n=w.useRef(!1),r=Zc(),a=w.useMemo(()=>oue(r.search,n.current?null:e.current),[r.search]),s=Ml(),o=w.useCallback((l,c)=>{const d=pD(typeof l=="function"?l(new URLSearchParams(a)):l);n.current=!0,s("?"+d,c)},[s,a]);return[a,o]}var Mue=0,Eue=()=>`__${String(++Mue)}__`;function jue(){let{router:t}=SY("useSubmit"),{basename:e}=w.useContext(Uo),n=Xde(),r=t.fetch,a=t.navigate;return w.useCallback(async(s,o={})=>{let{action:l,method:c,encType:d,formData:u,body:m}=due(s,e);if(o.navigate===!1){let p=o.fetcherKey||Eue();await r(p,n,o.action||l,{unstable_defaultShouldRevalidate:o.unstable_defaultShouldRevalidate,preventScrollReset:o.preventScrollReset,formData:u,body:m,formMethod:o.method||c,formEncType:o.encType||d,flushSync:o.flushSync})}else await a(o.action||l,{unstable_defaultShouldRevalidate:o.unstable_defaultShouldRevalidate,preventScrollReset:o.preventScrollReset,formData:u,body:m,formMethod:o.method||c,formEncType:o.encType||d,replace:o.replace,state:o.state,fromRouteId:n,flushSync:o.flushSync,viewTransition:o.viewTransition})},[r,a,e,n])}function Due(t,{relative:e}={}){let{basename:n}=w.useContext(Uo),r=w.useContext(Al);hi(r,"useFormAction must be used inside a RouteContext");let[a]=r.matches.slice(-1),s={...E0(t||".",{relative:e})},o=Zc();if(t==null){s.search=o.search;let l=new URLSearchParams(s.search),c=l.getAll("index");if(c.some(u=>u==="")){l.delete("index"),c.filter(m=>m).forEach(m=>l.append("index",m));let u=l.toString();s.search=u?`?${u}`:""}}return(!t||t===".")&&a.route.index&&(s.search=s.search?s.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(s.pathname=s.pathname==="/"?n:Qd([n,s.pathname])),jv(s)}function Rue(t,{relative:e}={}){let n=w.useContext(dY);hi(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=SY("useViewTransitionState"),a=E0(t,{relative:e});if(!n.isTransitioning)return!1;let s=su(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=su(n.nextLocation.pathname,r)||n.nextLocation.pathname;return I1(a.pathname,o)!=null||I1(a.pathname,s)!=null}var $d=WK();const Fue=Pl($d);var ff=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(t){return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Lue={setTimeout:(t,e)=>setTimeout(t,e),clearTimeout:t=>clearTimeout(t),setInterval:(t,e)=>setInterval(t,e),clearInterval:t=>clearInterval(t)},Oue=class{#t=Lue;#e=!1;setTimeoutProvider(t){this.#t=t}setTimeout(t,e){return this.#t.setTimeout(t,e)}clearTimeout(t){this.#t.clearTimeout(t)}setInterval(t,e){return this.#t.setInterval(t,e)}clearInterval(t){this.#t.clearInterval(t)}},mp=new Oue;function Iue(t){setTimeout(t,0)}var Up=typeof window>"u"||"Deno"in globalThis;function ms(){}function zue(t,e){return typeof t=="function"?t(e):t}function fD(t){return typeof t=="number"&&t>=0&&t!==1/0}function _Y(t,e){return Math.max(t+(e||0)-Date.now(),0)}function Um(t,e){return typeof t=="function"?t(e):t}function rl(t,e){return typeof t=="function"?t(e):t}function $B(t,e){const{type:n="all",exact:r,fetchStatus:a,predicate:s,queryKey:o,stale:l}=t;if(o){if(r){if(e.queryHash!==IF(o,e.options))return!1}else if(!Dv(e.queryKey,o))return!1}if(n!=="all"){const c=e.isActive();if(n==="active"&&!c||n==="inactive"&&c)return!1}return!(typeof l=="boolean"&&e.isStale()!==l||a&&a!==e.state.fetchStatus||s&&!s(e))}function qB(t,e){const{exact:n,status:r,predicate:a,mutationKey:s}=t;if(s){if(!e.options.mutationKey)return!1;if(n){if(Bp(e.options.mutationKey)!==Bp(s))return!1}else if(!Dv(e.options.mutationKey,s))return!1}return!(r&&e.state.status!==r||a&&!a(e))}function IF(t,e){return(e?.queryKeyHashFn||Bp)(t)}function Bp(t){return JSON.stringify(t,(e,n)=>gD(n)?Object.keys(n).sort().reduce((r,a)=>(r[a]=n[a],r),{}):n)}function Dv(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?Object.keys(e).every(n=>Dv(t[n],e[n])):!1}var Uue=Object.prototype.hasOwnProperty;function zF(t,e,n=0){if(t===e)return t;if(n>500)return e;const r=VB(t)&&VB(e);if(!r&&!(gD(t)&&gD(e)))return e;const s=(r?t:Object.keys(t)).length,o=r?e:Object.keys(e),l=o.length,c=r?new Array(l):{};let d=0;for(let u=0;u<l;u++){const m=r?u:o[u],p=t[m],f=e[m];if(p===f){c[m]=p,(r?u<s:Uue.call(t,m))&&d++;continue}if(p===null||f===null||typeof p!="object"||typeof f!="object"){c[m]=f;continue}const y=zF(p,f,n+1);c[m]=y,y===p&&d++}return s===l&&d===s?t:c}function Rv(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 VB(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function gD(t){if(!GB(t))return!1;const e=t.constructor;if(e===void 0)return!0;const n=e.prototype;return!(!GB(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(t)!==Object.prototype)}function GB(t){return Object.prototype.toString.call(t)==="[object Object]"}function Bue(t){return new Promise(e=>{mp.setTimeout(e,t)})}function bD(t,e,n){return typeof n.structuralSharing=="function"?n.structuralSharing(t,e):n.structuralSharing!==!1?zF(t,e):e}function Hue(t,e,n=0){const r=[...t,e];return n&&r.length>n?r.slice(1):r}function $ue(t,e,n=0){const r=[e,...t];return n&&r.length>n?r.slice(0,-1):r}var UF=Symbol();function kY(t,e){return!t.queryFn&&e?.initialPromise?()=>e.initialPromise:!t.queryFn||t.queryFn===UF?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}function BF(t,e){return typeof t=="function"?t(...e):!!t}function que(t,e,n){let r=!1,a;return Object.defineProperty(t,"signal",{enumerable:!0,get:()=>(a??=e(),r||(r=!0,a.aborted?n():a.addEventListener("abort",n,{once:!0})),a)}),t}var Vue=class extends ff{#t;#e;#n;constructor(){super(),this.#n=t=>{if(!Up&&window.addEventListener){const e=()=>t();return window.addEventListener("visibilitychange",e,!1),()=>{window.removeEventListener("visibilitychange",e)}}}}onSubscribe(){this.#e||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#e?.(),this.#e=void 0)}setEventListener(t){this.#n=t,this.#e?.(),this.#e=t(e=>{typeof e=="boolean"?this.setFocused(e):this.onFocus()})}setFocused(t){this.#t!==t&&(this.#t=t,this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(e=>{e(t)})}isFocused(){return typeof this.#t=="boolean"?this.#t:globalThis.document?.visibilityState!=="hidden"}},HF=new Vue;function xD(){let t,e;const n=new Promise((a,s)=>{t=a,e=s});n.status="pending",n.catch(()=>{});function r(a){Object.assign(n,a),delete n.resolve,delete n.reject}return n.resolve=a=>{r({status:"fulfilled",value:a}),t(a)},n.reject=a=>{r({status:"rejected",reason:a}),e(a)},n}var Gue=Iue;function Wue(){let t=[],e=0,n=l=>{l()},r=l=>{l()},a=Gue;const s=l=>{e?t.push(l):a(()=>{n(l)})},o=()=>{const l=t;t=[],l.length&&a(()=>{r(()=>{l.forEach(c=>{n(c)})})})};return{batch:l=>{let c;e++;try{c=l()}finally{e--,e||o()}return c},batchCalls:l=>(...c)=>{s(()=>{l(...c)})},schedule:s,setNotifyFunction:l=>{n=l},setBatchNotifyFunction:l=>{r=l},setScheduler:l=>{a=l}}}var Fi=Wue(),Kue=class extends ff{#t=!0;#e;#n;constructor(){super(),this.#n=t=>{if(!Up&&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.#e||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#e?.(),this.#e=void 0)}setEventListener(t){this.#n=t,this.#e?.(),this.#e=t(this.setOnline.bind(this))}setOnline(t){this.#t!==t&&(this.#t=t,this.listeners.forEach(n=>{n(t)}))}isOnline(){return this.#t}},z1=new Kue;function Yue(t){return Math.min(1e3*2**t,3e4)}function NY(t){return(t??"online")==="online"?z1.isOnline():!0}var yD=class extends Error{constructor(t){super("CancelledError"),this.revert=t?.revert,this.silent=t?.silent}};function CY(t){let e=!1,n=0,r;const a=xD(),s=()=>a.status!=="pending",o=x=>{if(!s()){const b=new yD(x);p(b),t.onCancel?.(b)}},l=()=>{e=!0},c=()=>{e=!1},d=()=>HF.isFocused()&&(t.networkMode==="always"||z1.isOnline())&&t.canRun(),u=()=>NY(t.networkMode)&&t.canRun(),m=x=>{s()||(r?.(),a.resolve(x))},p=x=>{s()||(r?.(),a.reject(x))},f=()=>new Promise(x=>{r=b=>{(s()||d())&&x(b)},t.onPause?.()}).then(()=>{r=void 0,s()||t.onContinue?.()}),y=()=>{if(s())return;let x;const b=n===0?t.initialPromise:void 0;try{x=b??t.fn()}catch(v){x=Promise.reject(v)}Promise.resolve(x).then(m).catch(v=>{if(s())return;const _=t.retry??(Up?0:3),k=t.retryDelay??Yue,P=typeof k=="function"?k(n,v):k,C=_===!0||typeof _=="number"&&n<_||typeof _=="function"&&_(n,v);if(e||!C){p(v);return}n++,t.onFail?.(n,v),Bue(P).then(()=>d()?void 0:f()).then(()=>{e?p(v):y()})})};return{promise:a,status:()=>a.status,cancel:o,continue:()=>(r?.(),a),cancelRetry:l,continueRetry:c,canStart:u,start:()=>(u()?y():f().then(y),a)}}var TY=class{#t;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),fD(this.gcTime)&&(this.#t=mp.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(Up?1/0:300*1e3))}clearGcTimeout(){this.#t&&(mp.clearTimeout(this.#t),this.#t=void 0)}},Xue=class extends TY{#t;#e;#n;#i;#r;#a;#o;constructor(t){super(),this.#o=!1,this.#a=t.defaultOptions,this.setOptions(t.options),this.observers=[],this.#i=t.client,this.#n=this.#i.getQueryCache(),this.queryKey=t.queryKey,this.queryHash=t.queryHash,this.#t=KB(this.options),this.state=t.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#r?.promise}setOptions(t){if(this.options={...this.#a,...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const e=KB(this.options);e.data!==void 0&&(this.setState(WB(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#n.remove(this)}setData(t,e){const n=bD(this.state.data,t,this.options);return this.#s({data:n,type:"success",dataUpdatedAt:e?.updatedAt,manual:e?.manual}),n}setState(t,e){this.#s({type:"setState",state:t,setStateOptions:e})}cancel(t){const e=this.#r?.promise;return this.#r?.cancel(t),e?e.then(ms).catch(ms):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#t)}isActive(){return this.observers.some(t=>rl(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===UF||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>Um(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:!_Y(this.state.dataUpdatedAt,t)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#r?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#r?.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.#r&&(this.#o?this.#r.cancel({revert:!0}):this.#r.cancelRetry()),this.scheduleGc()),this.#n.notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#s({type:"invalidate"})}async fetch(t,e){if(this.state.fetchStatus!=="idle"&&this.#r?.status()!=="rejected"){if(this.state.data!==void 0&&e?.cancelRefetch)this.cancel({silent:!0});else if(this.#r)return this.#r.continueRetry(),this.#r.promise}if(t&&this.setOptions(t),!this.options.queryFn){const l=this.observers.find(c=>c.options.queryFn);l&&this.setOptions(l.options)}const n=new AbortController,r=l=>{Object.defineProperty(l,"signal",{enumerable:!0,get:()=>(this.#o=!0,n.signal)})},a=()=>{const l=kY(this.options,e),d=(()=>{const u={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(u),u})();return this.#o=!1,this.options.persister?this.options.persister(l,d,this):l(d)},o=(()=>{const l={fetchOptions:e,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:a};return r(l),l})();this.options.behavior?.onFetch(o,this),this.#e=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==o.fetchOptions?.meta)&&this.#s({type:"fetch",meta:o.fetchOptions?.meta}),this.#r=CY({initialPromise:e?.initialPromise,fn:o.fetchFn,onCancel:l=>{l instanceof yD&&l.revert&&this.setState({...this.#e,fetchStatus:"idle"}),n.abort()},onFail:(l,c)=>{this.#s({type:"failed",failureCount:l,error:c})},onPause:()=>{this.#s({type:"pause"})},onContinue:()=>{this.#s({type:"continue"})},retry:o.options.retry,retryDelay:o.options.retryDelay,networkMode:o.options.networkMode,canRun:()=>!0});try{const l=await this.#r.start();if(l===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(l),this.#n.config.onSuccess?.(l,this),this.#n.config.onSettled?.(l,this.state.error,this),l}catch(l){if(l instanceof yD){if(l.silent)return this.#r.promise;if(l.revert){if(this.state.data===void 0)throw l;return this.state.data}}throw this.#s({type:"error",error:l}),this.#n.config.onError?.(l,this),this.#n.config.onSettled?.(this.state.data,l,this),l}finally{this.scheduleGc()}}#s(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,...PY(n.data,this.options),fetchMeta:t.meta??null};case"success":const r={...n,...WB(t.data,t.dataUpdatedAt),dataUpdateCount:n.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#e=t.manual?r:void 0,r;case"error":const a=t.error;return{...n,error:a,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,fetchFailureReason:a,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...n,isInvalidated:!0};case"setState":return{...n,...t.state}}};this.state=e(this.state),Fi.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),this.#n.notify({query:this,type:"updated",action:t})})}};function PY(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:NY(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function WB(t,e){return{data:t,dataUpdatedAt:e??Date.now(),error:null,isInvalidated:!1,status:"success"}}function KB(t){const e=typeof t.initialData=="function"?t.initialData():t.initialData,n=e!==void 0,r=n?typeof t.initialDataUpdatedAt=="function"?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var $F=class extends ff{constructor(t,e){super(),this.options=e,this.#t=t,this.#s=null,this.#o=xD(),this.bindMethods(),this.setOptions(e)}#t;#e=void 0;#n=void 0;#i=void 0;#r;#a;#o;#s;#p;#u;#m;#c;#d;#l;#h=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#e.addObserver(this),YB(this.#e,this.options)?this.#f():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return vD(this.#e,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return vD(this.#e,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#v(),this.#w(),this.#e.removeObserver(this)}setOptions(t){const e=this.options,n=this.#e;if(this.options=this.#t.defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof rl(this.options.enabled,this.#e)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#S(),this.#e.setOptions(this.options),e._defaulted&&!Rv(this.options,e)&&this.#t.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#e,observer:this});const r=this.hasListeners();r&&XB(this.#e,n,this.options,e)&&this.#f(),this.updateResult(),r&&(this.#e!==n||rl(this.options.enabled,this.#e)!==rl(e.enabled,this.#e)||Um(this.options.staleTime,this.#e)!==Um(e.staleTime,this.#e))&&this.#g();const a=this.#b();r&&(this.#e!==n||rl(this.options.enabled,this.#e)!==rl(e.enabled,this.#e)||a!==this.#l)&&this.#x(a)}getOptimisticResult(t){const e=this.#t.getQueryCache().build(this.#t,t),n=this.createResult(e,t);return Zue(this,n)&&(this.#i=n,this.#a=this.options,this.#r=this.#e.state),n}getCurrentResult(){return this.#i}trackResult(t,e){return new Proxy(t,{get:(n,r)=>(this.trackProp(r),e?.(r),r==="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,r))})}trackProp(t){this.#h.add(t)}getCurrentQuery(){return this.#e}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const e=this.#t.defaultQueryOptions(t),n=this.#t.getQueryCache().build(this.#t,e);return n.fetch().then(()=>this.createResult(n,e))}fetch(t){return this.#f({...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#i))}#f(t){this.#S();let e=this.#e.fetch(this.options,t);return t?.throwOnError||(e=e.catch(ms)),e}#g(){this.#v();const t=Um(this.options.staleTime,this.#e);if(Up||this.#i.isStale||!fD(t))return;const n=_Y(this.#i.dataUpdatedAt,t)+1;this.#c=mp.setTimeout(()=>{this.#i.isStale||this.updateResult()},n)}#b(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#e):this.options.refetchInterval)??!1}#x(t){this.#w(),this.#l=t,!(Up||rl(this.options.enabled,this.#e)===!1||!fD(this.#l)||this.#l===0)&&(this.#d=mp.setInterval(()=>{(this.options.refetchIntervalInBackground||HF.isFocused())&&this.#f()},this.#l))}#y(){this.#g(),this.#x(this.#b())}#v(){this.#c&&(mp.clearTimeout(this.#c),this.#c=void 0)}#w(){this.#d&&(mp.clearInterval(this.#d),this.#d=void 0)}createResult(t,e){const n=this.#e,r=this.options,a=this.#i,s=this.#r,o=this.#a,c=t!==n?t.state:this.#n,{state:d}=t;let u={...d},m=!1,p;if(e._optimisticResults){const R=this.hasListeners(),A=!R&&YB(t,e),D=R&&XB(t,n,e,r);(A||D)&&(u={...u,...PY(d.data,t.options)}),e._optimisticResults==="isRestoring"&&(u.fetchStatus="idle")}let{error:f,errorUpdatedAt:y,status:x}=u;p=u.data;let b=!1;if(e.placeholderData!==void 0&&p===void 0&&x==="pending"){let R;a?.isPlaceholderData&&e.placeholderData===o?.placeholderData?(R=a.data,b=!0):R=typeof e.placeholderData=="function"?e.placeholderData(this.#m?.state.data,this.#m):e.placeholderData,R!==void 0&&(x="success",p=bD(a?.data,R,e),m=!0)}if(e.select&&p!==void 0&&!b)if(a&&p===s?.data&&e.select===this.#p)p=this.#u;else try{this.#p=e.select,p=e.select(p),p=bD(a?.data,p,e),this.#u=p,this.#s=null}catch(R){this.#s=R}this.#s&&(f=this.#s,p=this.#u,y=Date.now(),x="error");const v=u.fetchStatus==="fetching",_=x==="pending",k=x==="error",P=_&&v,C=p!==void 0,N={status:x,fetchStatus:u.fetchStatus,isPending:_,isSuccess:x==="success",isError:k,isInitialLoading:P,isLoading:P,data:p,dataUpdatedAt:u.dataUpdatedAt,error:f,errorUpdatedAt:y,failureCount:u.fetchFailureCount,failureReason:u.fetchFailureReason,errorUpdateCount:u.errorUpdateCount,isFetched:u.dataUpdateCount>0||u.errorUpdateCount>0,isFetchedAfterMount:u.dataUpdateCount>c.dataUpdateCount||u.errorUpdateCount>c.errorUpdateCount,isFetching:v,isRefetching:v&&!_,isLoadingError:k&&!C,isPaused:u.fetchStatus==="paused",isPlaceholderData:m,isRefetchError:k&&C,isStale:qF(t,e),refetch:this.refetch,promise:this.#o,isEnabled:rl(e.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const R=N.data!==void 0,A=N.status==="error"&&!R,D=G=>{A?G.reject(N.error):R&&G.resolve(N.data)},$=()=>{const G=this.#o=N.promise=xD();D(G)},U=this.#o;switch(U.status){case"pending":t.queryHash===n.queryHash&&D(U);break;case"fulfilled":(A||N.data!==U.value)&&$();break;case"rejected":(!A||N.error!==U.reason)&&$();break}}return N}updateResult(){const t=this.#i,e=this.createResult(this.#e,this.options);if(this.#r=this.#e.state,this.#a=this.options,this.#r.data!==void 0&&(this.#m=this.#e),Rv(e,t))return;this.#i=e;const n=()=>{if(!t)return!0;const{notifyOnChangeProps:r}=this.options,a=typeof r=="function"?r():r;if(a==="all"||!a&&!this.#h.size)return!0;const s=new Set(a??this.#h);return this.options.throwOnError&&s.add("error"),Object.keys(this.#i).some(o=>{const l=o;return this.#i[l]!==t[l]&&s.has(l)})};this.#_({listeners:n()})}#S(){const t=this.#t.getQueryCache().build(this.#t,this.options);if(t===this.#e)return;const e=this.#e;this.#e=t,this.#n=t.state,this.hasListeners()&&(e?.removeObserver(this),t.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}#_(t){Fi.batch(()=>{t.listeners&&this.listeners.forEach(e=>{e(this.#i)}),this.#t.getQueryCache().notify({query:this.#e,type:"observerResultsUpdated"})})}};function Que(t,e){return rl(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&e.retryOnMount===!1)}function YB(t,e){return Que(t,e)||t.state.data!==void 0&&vD(t,e,e.refetchOnMount)}function vD(t,e,n){if(rl(e.enabled,t)!==!1&&Um(e.staleTime,t)!=="static"){const r=typeof n=="function"?n(t):n;return r==="always"||r!==!1&&qF(t,e)}return!1}function XB(t,e,n,r){return(t!==e||rl(r.enabled,t)===!1)&&(!n.suspense||t.state.status!=="error")&&qF(t,n)}function qF(t,e){return rl(e.enabled,t)!==!1&&t.isStaleByTime(Um(e.staleTime,t))}function Zue(t,e){return!Rv(t.getCurrentResult(),e)}function QB(t){return{onFetch:(e,n)=>{const r=e.options,a=e.fetchOptions?.meta?.fetchMore?.direction,s=e.state.data?.pages||[],o=e.state.data?.pageParams||[];let l={pages:[],pageParams:[]},c=0;const d=async()=>{let u=!1;const m=y=>{que(y,()=>e.signal,()=>u=!0)},p=kY(e.options,e.fetchOptions),f=async(y,x,b)=>{if(u)return Promise.reject();if(x==null&&y.pages.length)return Promise.resolve(y);const _=(()=>{const T={client:e.client,queryKey:e.queryKey,pageParam:x,direction:b?"backward":"forward",meta:e.options.meta};return m(T),T})(),k=await p(_),{maxPages:P}=e.options,C=b?$ue:Hue;return{pages:C(y.pages,k,P),pageParams:C(y.pageParams,x,P)}};if(a&&s.length){const y=a==="backward",x=y?Jue:ZB,b={pages:s,pageParams:o},v=x(r,b);l=await f(b,v,y)}else{const y=t??s.length;do{const x=c===0?o[0]??r.initialPageParam:ZB(r,l);if(c>0&&x==null)break;l=await f(l,x),c++}while(c<y)}return l};e.options.persister?e.fetchFn=()=>e.options.persister?.(d,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},n):e.fetchFn=d}}}function ZB(t,{pages:e,pageParams:n}){const r=e.length-1;return e.length>0?t.getNextPageParam(e[r],e,n[r],n):void 0}function Jue(t,{pages:e,pageParams:n}){return e.length>0?t.getPreviousPageParam?.(e[0],e,n[0],n):void 0}var eme=class extends TY{#t;#e;#n;#i;constructor(t){super(),this.#t=t.client,this.mutationId=t.mutationId,this.#n=t.mutationCache,this.#e=[],this.state=t.state||AY(),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.#e.includes(t)||(this.#e.push(t),this.clearGcTimeout(),this.#n.notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){this.#e=this.#e.filter(e=>e!==t),this.scheduleGc(),this.#n.notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){this.#e.length||(this.state.status==="pending"?this.scheduleGc():this.#n.remove(this))}continue(){return this.#i?.continue()??this.execute(this.state.variables)}async execute(t){const e=()=>{this.#r({type:"continue"})},n={client:this.#t,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#i=CY({fn:()=>this.options.mutationFn?this.options.mutationFn(t,n):Promise.reject(new Error("No mutationFn found")),onFail:(s,o)=>{this.#r({type:"failed",failureCount:s,error:o})},onPause:()=>{this.#r({type:"pause"})},onContinue:e,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});const r=this.state.status==="pending",a=!this.#i.canStart();try{if(r)e();else{this.#r({type:"pending",variables:t,isPaused:a}),this.#n.config.onMutate&&await this.#n.config.onMutate(t,this,n);const o=await this.options.onMutate?.(t,n);o!==this.state.context&&this.#r({type:"pending",context:o,variables:t,isPaused:a})}const s=await this.#i.start();return await this.#n.config.onSuccess?.(s,t,this.state.context,this,n),await this.options.onSuccess?.(s,t,this.state.context,n),await this.#n.config.onSettled?.(s,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(s,null,t,this.state.context,n),this.#r({type:"success",data:s}),s}catch(s){try{await this.#n.config.onError?.(s,t,this.state.context,this,n)}catch(o){Promise.reject(o)}try{await this.options.onError?.(s,t,this.state.context,n)}catch(o){Promise.reject(o)}try{await this.#n.config.onSettled?.(void 0,s,this.state.variables,this.state.context,this,n)}catch(o){Promise.reject(o)}try{await this.options.onSettled?.(void 0,s,t,this.state.context,n)}catch(o){Promise.reject(o)}throw this.#r({type:"error",error:s}),s}finally{this.#n.runNext(this)}}#r(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),Fi.batch(()=>{this.#e.forEach(n=>{n.onMutationUpdate(t)}),this.#n.notify({mutation:this,type:"updated",action:t})})}};function AY(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var tme=class extends ff{constructor(t={}){super(),this.config=t,this.#t=new Set,this.#e=new Map,this.#n=0}#t;#e;#n;build(t,e,n){const r=new eme({client:t,mutationCache:this,mutationId:++this.#n,options:t.defaultMutationOptions(e),state:n});return this.add(r),r}add(t){this.#t.add(t);const e=SS(t);if(typeof e=="string"){const n=this.#e.get(e);n?n.push(t):this.#e.set(e,[t])}this.notify({type:"added",mutation:t})}remove(t){if(this.#t.delete(t)){const e=SS(t);if(typeof e=="string"){const n=this.#e.get(e);if(n)if(n.length>1){const r=n.indexOf(t);r!==-1&&n.splice(r,1)}else n[0]===t&&this.#e.delete(e)}}this.notify({type:"removed",mutation:t})}canRun(t){const e=SS(t);if(typeof e=="string"){const r=this.#e.get(e)?.find(a=>a.state.status==="pending");return!r||r===t}else return!0}runNext(t){const e=SS(t);return typeof e=="string"?this.#e.get(e)?.find(r=>r!==t&&r.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){Fi.batch(()=>{this.#t.forEach(t=>{this.notify({type:"removed",mutation:t})}),this.#t.clear(),this.#e.clear()})}getAll(){return Array.from(this.#t)}find(t){const e={exact:!0,...t};return this.getAll().find(n=>qB(e,n))}findAll(t={}){return this.getAll().filter(e=>qB(t,e))}notify(t){Fi.batch(()=>{this.listeners.forEach(e=>{e(t)})})}resumePausedMutations(){const t=this.getAll().filter(e=>e.state.isPaused);return Fi.batch(()=>Promise.all(t.map(e=>e.continue().catch(ms))))}};function SS(t){return t.options.scope?.id}var nme=class extends ff{#t;#e=void 0;#n;#i;constructor(e,n){super(),this.#t=e,this.setOptions(n),this.bindMethods(),this.#r()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){const n=this.options;this.options=this.#t.defaultMutationOptions(e),Rv(this.options,n)||this.#t.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#n,observer:this}),n?.mutationKey&&this.options.mutationKey&&Bp(n.mutationKey)!==Bp(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.#r(),this.#a(e)}getCurrentResult(){return this.#e}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#r(),this.#a()}mutate(e,n){return this.#i=n,this.#n?.removeObserver(this),this.#n=this.#t.getMutationCache().build(this.#t,this.options),this.#n.addObserver(this),this.#n.execute(e)}#r(){const e=this.#n?.state??AY();this.#e={...e,isPending:e.status==="pending",isSuccess:e.status==="success",isError:e.status==="error",isIdle:e.status==="idle",mutate:this.mutate,reset:this.reset}}#a(e){Fi.batch(()=>{if(this.#i&&this.hasListeners()){const n=this.#e.variables,r=this.#e.context,a={client:this.#t,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type==="success"){try{this.#i.onSuccess?.(e.data,n,r,a)}catch(s){Promise.reject(s)}try{this.#i.onSettled?.(e.data,null,n,r,a)}catch(s){Promise.reject(s)}}else if(e?.type==="error"){try{this.#i.onError?.(e.error,n,r,a)}catch(s){Promise.reject(s)}try{this.#i.onSettled?.(void 0,e.error,n,r,a)}catch(s){Promise.reject(s)}}}this.listeners.forEach(n=>{n(this.#e)})})}};function JB(t,e){const n=new Set(e);return t.filter(r=>!n.has(r))}function rme(t,e,n){const r=t.slice(0);return r[e]=n,r}var ime=class extends ff{#t;#e;#n;#i;#r;#a;#o;#s;#p;#u=[];constructor(t,e,n){super(),this.#t=t,this.#i=n,this.#n=[],this.#r=[],this.#e=[],this.setQueries(e)}onSubscribe(){this.listeners.size===1&&this.#r.forEach(t=>{t.subscribe(e=>{this.#l(t,e)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#r.forEach(t=>{t.destroy()})}setQueries(t,e){this.#n=t,this.#i=e,Fi.batch(()=>{const n=this.#r,r=this.#d(this.#n);r.forEach(u=>u.observer.setOptions(u.defaultedQueryOptions));const a=r.map(u=>u.observer),s=a.map(u=>u.getCurrentResult()),o=n.length!==a.length,l=a.some((u,m)=>u!==n[m]),c=o||l,d=c?!0:s.some((u,m)=>{const p=this.#e[m];return!p||!Rv(u,p)});!c&&!d||(c&&(this.#u=r,this.#r=a),this.#e=s,this.hasListeners()&&(c&&(JB(n,a).forEach(u=>{u.destroy()}),JB(a,n).forEach(u=>{u.subscribe(m=>{this.#l(u,m)})})),this.#h()))})}getCurrentResult(){return this.#e}getQueries(){return this.#r.map(t=>t.getCurrentQuery())}getObservers(){return this.#r}getOptimisticResult(t,e){const n=this.#d(t),r=n.map(s=>s.observer.getOptimisticResult(s.defaultedQueryOptions)),a=n.map(s=>s.defaultedQueryOptions.queryHash);return[r,s=>this.#c(s??r,e,a),()=>this.#m(r,n)]}#m(t,e){return e.map((n,r)=>{const a=t[r];return n.defaultedQueryOptions.notifyOnChangeProps?a:n.observer.trackResult(a,s=>{e.forEach(o=>{o.observer.trackProp(s)})})})}#c(t,e,n){if(e){const r=this.#p,a=n!==void 0&&r!==void 0&&(r.length!==n.length||n.some((s,o)=>s!==r[o]));return(!this.#a||this.#e!==this.#s||a||e!==this.#o)&&(this.#o=e,this.#s=this.#e,n!==void 0&&(this.#p=n),this.#a=zF(this.#a,e(t))),this.#a}return t}#d(t){const e=new Map;this.#r.forEach(r=>{const a=r.options.queryHash;if(!a)return;const s=e.get(a);s?s.push(r):e.set(a,[r])});const n=[];return t.forEach(r=>{const a=this.#t.defaultQueryOptions(r),o=e.get(a.queryHash)?.shift()??new $F(this.#t,a);n.push({defaultedQueryOptions:a,observer:o})}),n}#l(t,e){const n=this.#r.indexOf(t);n!==-1&&(this.#e=rme(this.#e,n,e),this.#h())}#h(){if(this.hasListeners()){const t=this.#a,e=this.#m(this.#e,this.#u),n=this.#c(e,this.#i?.combine);t!==n&&Fi.batch(()=>{this.listeners.forEach(r=>{r(this.#e)})})}}},ame=class extends ff{constructor(t={}){super(),this.config=t,this.#t=new Map}#t;build(t,e,n){const r=e.queryKey,a=e.queryHash??IF(r,e);let s=this.get(a);return s||(s=new Xue({client:t,queryKey:r,queryHash:a,options:t.defaultQueryOptions(e),state:n,defaultOptions:t.getQueryDefaults(r)}),this.add(s)),s}add(t){this.#t.has(t.queryHash)||(this.#t.set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const e=this.#t.get(t.queryHash);e&&(t.destroy(),e===t&&this.#t.delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){Fi.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return this.#t.get(t)}getAll(){return[...this.#t.values()]}find(t){const e={exact:!0,...t};return this.getAll().find(n=>$B(e,n))}findAll(t={}){const e=this.getAll();return Object.keys(t).length>0?e.filter(n=>$B(t,n)):e}notify(t){Fi.batch(()=>{this.listeners.forEach(e=>{e(t)})})}onFocus(){Fi.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){Fi.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},sme=class{#t;#e;#n;#i;#r;#a;#o;#s;constructor(t={}){this.#t=t.queryCache||new ame,this.#e=t.mutationCache||new tme,this.#n=t.defaultOptions||{},this.#i=new Map,this.#r=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=HF.subscribe(async t=>{t&&(await this.resumePausedMutations(),this.#t.onFocus())}),this.#s=z1.subscribe(async t=>{t&&(await this.resumePausedMutations(),this.#t.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(t){return this.#t.findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return this.#e.findAll({...t,status:"pending"}).length}getQueryData(t){const e=this.defaultQueryOptions({queryKey:t});return this.#t.get(e.queryHash)?.state.data}ensureQueryData(t){const e=this.defaultQueryOptions(t),n=this.#t.build(this,e),r=n.state.data;return r===void 0?this.fetchQuery(t):(t.revalidateIfStale&&n.isStaleByTime(Um(e.staleTime,n))&&this.prefetchQuery(e),Promise.resolve(r))}getQueriesData(t){return this.#t.findAll(t).map(({queryKey:e,state:n})=>{const r=n.data;return[e,r]})}setQueryData(t,e,n){const r=this.defaultQueryOptions({queryKey:t}),s=this.#t.get(r.queryHash)?.state.data,o=zue(e,s);if(o!==void 0)return this.#t.build(this,r).setData(o,{...n,manual:!0})}setQueriesData(t,e,n){return Fi.batch(()=>this.#t.findAll(t).map(({queryKey:r})=>[r,this.setQueryData(r,e,n)]))}getQueryState(t){const e=this.defaultQueryOptions({queryKey:t});return this.#t.get(e.queryHash)?.state}removeQueries(t){const e=this.#t;Fi.batch(()=>{e.findAll(t).forEach(n=>{e.remove(n)})})}resetQueries(t,e){const n=this.#t;return Fi.batch(()=>(n.findAll(t).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,e={}){const n={revert:!0,...e},r=Fi.batch(()=>this.#t.findAll(t).map(a=>a.cancel(n)));return Promise.all(r).then(ms).catch(ms)}invalidateQueries(t,e={}){return Fi.batch(()=>(this.#t.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},r=Fi.batch(()=>this.#t.findAll(t).filter(a=>!a.isDisabled()&&!a.isStatic()).map(a=>{let s=a.fetch(void 0,n);return n.throwOnError||(s=s.catch(ms)),a.state.fetchStatus==="paused"?Promise.resolve():s}));return Promise.all(r).then(ms)}fetchQuery(t){const e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);const n=this.#t.build(this,e);return n.isStaleByTime(Um(e.staleTime,n))?n.fetch(e):Promise.resolve(n.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(ms).catch(ms)}fetchInfiniteQuery(t){return t.behavior=QB(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(ms).catch(ms)}ensureInfiniteQueryData(t){return t.behavior=QB(t.pages),this.ensureQueryData(t)}resumePausedMutations(){return z1.isOnline()?this.#e.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#t}getMutationCache(){return this.#e}getDefaultOptions(){return this.#n}setDefaultOptions(t){this.#n=t}setQueryDefaults(t,e){this.#i.set(Bp(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...this.#i.values()],n={};return e.forEach(r=>{Dv(t,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(t,e){this.#r.set(Bp(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...this.#r.values()],n={};return e.forEach(r=>{Dv(t,r.mutationKey)&&Object.assign(n,r.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=IF(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===UF&&(e.enabled=!1),e}defaultMutationOptions(t){return t?._defaulted?t:{...this.#n.mutations,...t?.mutationKey&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){this.#t.clear(),this.#e.clear()}},MY=w.createContext(void 0),tn=t=>{const e=w.useContext(MY);if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},ome=({client:t,children:e})=>(w.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),i.jsx(MY.Provider,{value:t,children:e})),EY=w.createContext(!1),jY=()=>w.useContext(EY);EY.Provider;function lme(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var cme=w.createContext(lme()),DY=()=>w.useContext(cme),RY=(t,e,n)=>{const r=n?.state.error&&typeof t.throwOnError=="function"?BF(t.throwOnError,[n.state.error,n]):t.throwOnError;(t.suspense||t.experimental_prefetchInRender||r)&&(e.isReset()||(t.retryOnMount=!1))},FY=t=>{w.useEffect(()=>{t.clearReset()},[t])},LY=({result:t,errorResetBoundary:e,throwOnError:n,query:r,suspense:a})=>t.isError&&!e.isReset()&&!t.isFetching&&r&&(a&&t.data===void 0||BF(n,[t.error,r])),OY=t=>{if(t.suspense){const n=a=>a==="static"?a:Math.max(a??1e3,1e3),r=t.staleTime;t.staleTime=typeof r=="function"?(...a)=>n(r(...a)):n(r),typeof t.gcTime=="number"&&(t.gcTime=Math.max(t.gcTime,1e3))}},IY=(t,e)=>t.isLoading&&t.isFetching&&!e,wD=(t,e)=>t?.suspense&&e.isPending,U1=(t,e,n)=>e.fetchOptimistic(t).catch(()=>{n.clearReset()});function gf({queries:t,...e},n){const r=tn(),a=jY(),s=DY(),o=w.useMemo(()=>t.map(x=>{const b=r.defaultQueryOptions(x);return b._optimisticResults=a?"isRestoring":"optimistic",b}),[t,r,a]);o.forEach(x=>{OY(x);const b=r.getQueryCache().get(x.queryHash);RY(x,s,b)}),FY(s);const[l]=w.useState(()=>new ime(r,o,e)),[c,d,u]=l.getOptimisticResult(o,e.combine),m=!a&&e.subscribed!==!1;w.useSyncExternalStore(w.useCallback(x=>m?l.subscribe(Fi.batchCalls(x)):ms,[l,m]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),w.useEffect(()=>{l.setQueries(o,e)},[o,e,l]);const f=c.some((x,b)=>wD(o[b],x))?c.flatMap((x,b)=>{const v=o[b];if(v){const _=new $F(r,v);if(wD(v,x))return U1(v,_,s);IY(x,a)&&U1(v,_,s)}return[]}):[];if(f.length>0)throw Promise.all(f);const y=c.find((x,b)=>{const v=o[b];return v&&LY({result:x,errorResetBoundary:s,throwOnError:v.throwOnError,query:r.getQueryCache().get(v.queryHash),suspense:v.suspense})});if(y?.error)throw y.error;return d(u())}function dme(t,e,n){const r=jY(),a=DY(),s=tn(),o=s.defaultQueryOptions(t);s.getDefaultOptions().queries?._experimental_beforeQuery?.(o);const l=s.getQueryCache().get(o.queryHash);o._optimisticResults=r?"isRestoring":"optimistic",OY(o),RY(o,a,l),FY(a);const c=!s.getQueryCache().get(o.queryHash),[d]=w.useState(()=>new e(s,o)),u=d.getOptimisticResult(o),m=!r&&t.subscribed!==!1;if(w.useSyncExternalStore(w.useCallback(p=>{const f=m?d.subscribe(Fi.batchCalls(p)):ms;return d.updateResult(),f},[d,m]),()=>d.getCurrentResult(),()=>d.getCurrentResult()),w.useEffect(()=>{d.setOptions(o)},[o,d]),wD(o,u))throw U1(o,d,a);if(LY({result:u,errorResetBoundary:a,throwOnError:o.throwOnError,query:l,suspense:o.suspense}))throw u.error;return s.getDefaultOptions().queries?._experimental_afterQuery?.(o,u),o.experimental_prefetchInRender&&!Up&&IY(u,r)&&(c?U1(o,d,a):l?.promise)?.catch(ms).finally(()=>{d.updateResult()}),o.notifyOnChangeProps?u:d.trackResult(u)}function Je(t,e){return dme(t,$F)}function ut(t,e){const n=tn(),[r]=w.useState(()=>new nme(n,t));w.useEffect(()=>{r.setOptions(t)},[r,t]);const a=w.useSyncExternalStore(w.useCallback(o=>r.subscribe(Fi.batchCalls(o)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),s=w.useCallback((o,l)=>{r.mutate(o,l).catch(ms)},[r]);if(a.error&&BF(r.options.throwOnError,[a.error]))throw a.error;return{...a,mutate:s,mutateAsync:a.mutate}}const ume=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),mme=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,n,r)=>r?r.toUpperCase():n.toLowerCase()),e8=t=>{const e=mme(t);return e.charAt(0).toUpperCase()+e.slice(1)},zY=(...t)=>t.filter((e,n,r)=>!!e&&e.trim()!==""&&r.indexOf(e)===n).join(" ").trim(),hme=t=>{for(const e in t)if(e.startsWith("aria-")||e==="role"||e==="title")return!0};var pme={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 fme=w.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:a="",children:s,iconNode:o,...l},c)=>w.createElement("svg",{ref:c,...pme,width:e,height:e,stroke:t,strokeWidth:r?Number(n)*24/Number(e):n,className:zY("lucide",a),...!s&&!hme(l)&&{"aria-hidden":"true"},...l},[...o.map(([d,u])=>w.createElement(d,u)),...Array.isArray(s)?s:[s]]));const it=(t,e)=>{const n=w.forwardRef(({className:r,...a},s)=>w.createElement(fme,{ref:s,iconNode:e,className:zY(`lucide-${ume(e8(t))}`,`lucide-${t}`,r),...a}));return n.displayName=e8(t),n};const gme=[["path",{d:"M18 17.5a2.5 2.5 0 1 1-4 2.03V12",key:"yd12zl"}],["path",{d:"M6 12H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2",key:"larmp2"}],["path",{d:"M6 8h12",key:"6g4wlu"}],["path",{d:"M6.6 15.572A2 2 0 1 0 10 17v-5",key:"1x1kqn"}]],bme=it("air-vent",gme);const xme=[["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"}]],Fs=it("archive",xme);const yme=[["path",{d:"m3 16 4 4 4-4",key:"1co6wj"}],["path",{d:"M7 20V4",key:"1yoxec"}],["path",{d:"M11 4h10",key:"1w87gc"}],["path",{d:"M11 8h7",key:"djye34"}],["path",{d:"M11 12h4",key:"q8tih4"}]],vme=it("arrow-down-wide-narrow",yme);const wme=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],Pb=it("arrow-down",wme);const Sme=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],UY=it("arrow-left",Sme);const _me=[["path",{d:"m16 3 4 4-4 4",key:"1x1c3m"}],["path",{d:"M20 7H4",key:"zbl0bi"}],["path",{d:"m8 21-4-4 4-4",key:"h9nckh"}],["path",{d:"M4 17h16",key:"g4d7ey"}]],SD=it("arrow-right-left",_me);const kme=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],_D=it("arrow-right",kme);const Nme=[["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"}]],VF=it("arrow-up-down",Nme);const Cme=[["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}],["path",{d:"M11 12h4",key:"q8tih4"}],["path",{d:"M11 16h7",key:"uosisv"}],["path",{d:"M11 20h10",key:"jvxblo"}]],Tme=it("arrow-up-narrow-wide",Cme);const Pme=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],Hp=it("arrow-up",Pme);const Ame=[["path",{d:"M4.5 3h15",key:"c7n0jr"}],["path",{d:"M6 3v16a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V3",key:"m1uhx7"}],["path",{d:"M6 14h12",key:"4cwo0f"}]],Mme=it("beaker",Ame);const Eme=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]],ub=it("bell",Eme);const jme=[["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"}]],Dme=it("bold",jme);const Rme=[["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}]],Fme=it("book",Rme);const Lme=[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}]],Ome=it("bookmark",Lme);const Ime=[["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"}]],ra=it("box",Ime);const zme=[["path",{d:"M16 20V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16",key:"jecpp"}],["rect",{width:"20",height:"14",x:"2",y:"6",rx:"2",key:"i6l2r4"}]],BY=it("briefcase",zme);const Ume=[["path",{d:"M12 20v-9",key:"1qisl0"}],["path",{d:"M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z",key:"uouzyp"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M21 21a4 4 0 0 0-3.81-4",key:"1b0z45"}],["path",{d:"M21 5a4 4 0 0 1-3.55 3.97",key:"5cxbf6"}],["path",{d:"M22 13h-4",key:"1jl80f"}],["path",{d:"M3 21a4 4 0 0 1 3.81-4",key:"1fjd4g"}],["path",{d:"M3 5a4 4 0 0 0 3.55 3.97",key:"1d7oge"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"m8 2 1.88 1.88",key:"fmnt4t"}],["path",{d:"M9 7.13V6a3 3 0 1 1 6 0v1.13",key:"1vgav8"}]],Ab=it("bug",Ume);const Bme=[["path",{d:"M17 19a1 1 0 0 1-1-1v-2a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2a1 1 0 0 1-1 1z",key:"trhst0"}],["path",{d:"M17 21v-2",key:"ds4u3f"}],["path",{d:"M19 14V6.5a1 1 0 0 0-7 0v11a1 1 0 0 1-7 0V10",key:"1mo9zo"}],["path",{d:"M21 21v-2",key:"eo0ou"}],["path",{d:"M3 5V3",key:"1k5hjh"}],["path",{d:"M4 10a2 2 0 0 1-2-2V6a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2a2 2 0 0 1-2 2z",key:"1dd30t"}],["path",{d:"M7 5V3",key:"1t1388"}]],Hme=it("cable",Bme);const $me=[["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",key:"1nb95v"}],["line",{x1:"8",x2:"16",y1:"6",y2:"6",key:"x4nwl0"}],["line",{x1:"16",x2:"16",y1:"14",y2:"18",key:"wjye3r"}],["path",{d:"M16 10h.01",key:"1m94wz"}],["path",{d:"M12 10h.01",key:"1nrarc"}],["path",{d:"M8 10h.01",key:"19clt8"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M8 18h.01",key:"lrp35t"}]],qme=it("calculator",$me);const Vme=[["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"}]],Gme=it("calendar-days",Vme);const Wme=[["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"}]],Xr=it("calendar",Wme);const Kme=[["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"}]],Mb=it("camera",Kme);const Yme=[["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"}]],Xme=it("chart-column",Yme);const Qme=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Vr=it("check",Qme);const Zme=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],In=it("chevron-down",Zme);const Jme=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],pa=it("chevron-right",Jme);const ehe=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],ec=it("chevron-left",ehe);const the=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],vl=it("chevron-up",the);const nhe=[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]],HY=it("chevrons-left",nhe);const rhe=[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]],$Y=it("chevrons-right",rhe);const ihe=[["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"}]],Ii=it("circle-alert",ihe);const ahe=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 12-4-4-4 4",key:"177agl"}],["path",{d:"M12 16V8",key:"1sbj14"}]],nM=it("circle-arrow-up",ahe);const she=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],fr=it("circle-check-big",she);const ohe=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Eb=it("circle-check",ohe);const lhe=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]],che=it("circle-dot",lhe);const dhe=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{x:"9",y:"9",width:"6",height:"6",rx:"1",key:"1ssd4o"}]],uhe=it("circle-stop",dhe);const mhe=[["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"}]],qi=it("circle-x",mhe);const hhe=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],B1=it("circle",hhe);const phe=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]],fhe=it("clipboard-list",phe);const ghe=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],er=it("clock",ghe);const bhe=[["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M5.782 5.782A7 7 0 0 0 9 19h8.5a4.5 4.5 0 0 0 1.307-.193",key:"yfwify"}],["path",{d:"M21.532 16.5A4.5 4.5 0 0 0 17.5 10h-1.79A7.008 7.008 0 0 0 10 5.07",key:"jlfiyv"}]],xhe=it("cloud-off",bhe);const yhe=[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]],lx=it("cloud",yhe);const vhe=[["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"}]],whe=it("code-xml",vhe);const She=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],qY=it("code",She);const _he=[["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M14 2v2",key:"6buw04"}],["path",{d:"M16 8a1 1 0 0 1 1 1v8a4 4 0 0 1-4 4H7a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1h14a4 4 0 1 1 0 8h-1",key:"pwadti"}],["path",{d:"M6 2v2",key:"colzsn"}]],khe=it("coffee",_he);const Nhe=[["circle",{cx:"8",cy:"8",r:"6",key:"3yglwk"}],["path",{d:"M18.09 10.37A6 6 0 1 1 10.34 18",key:"t5s6rm"}],["path",{d:"M7 6h1v4",key:"1obek4"}],["path",{d:"m16.71 13.88.7.71-2.82 2.82",key:"1rbuyh"}]],Che=it("coins",Nhe);const The=[["path",{d:"M11 10.27 7 3.34",key:"16pf9h"}],["path",{d:"m11 13.73-4 6.93",key:"794ttg"}],["path",{d:"M12 22v-2",key:"1osdcq"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M14 12h8",key:"4f43i9"}],["path",{d:"m17 20.66-1-1.73",key:"eq3orb"}],["path",{d:"m17 3.34-1 1.73",key:"2wel8s"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"m20.66 17-1.73-1",key:"sg0v6f"}],["path",{d:"m20.66 7-1.73 1",key:"1ow05n"}],["path",{d:"m3.34 17 1.73-1",key:"nuk764"}],["path",{d:"m3.34 7 1.73 1",key:"1ulond"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["circle",{cx:"12",cy:"12",r:"8",key:"46899m"}]],Phe=it("cog",The);const Ahe=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],Mhe=it("columns-2",Ahe);const Ehe=[["path",{d:"m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z",key:"9ktpf1"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],jhe=it("compass",Ehe);const Dhe=[["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"}]],wl=it("copy",Dhe);const Rhe=[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]],_S=it("cpu",Rhe);const Fhe=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5v14a9 3 0 0 0 18 0V5",key:"aqi0yr"}]],Lhe=it("cylinder",Fhe);const Ohe=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],Ic=it("database",Ohe);const Ihe=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M6 12c0-1.7.7-3.2 1.8-4.2",key:"oqkarx"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"M18 12c0 1.7-.7 3.2-1.8 4.2",key:"1eah9h"}]],zhe=it("disc-3",Ihe);const Uhe=[["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"}]],H1=it("dollar-sign",Uhe);const Bhe=[["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"}]],pi=it("download",Bhe);const Hhe=[["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"}]],lC=it("droplet",Hhe);const $he=[["path",{d:"M7 16.3c2.2 0 4-1.83 4-4.05 0-1.16-.57-2.26-1.71-3.19S7.29 6.75 7 5.3c-.29 1.45-1.14 2.84-2.29 3.76S3 11.1 3 12.25c0 2.22 1.8 4.05 4 4.05z",key:"1ptgy4"}],["path",{d:"M12.56 6.6A10.97 10.97 0 0 0 14 3.02c.5 2.5 2 4.9 4 6.5s3 3.5 3 5.5a6.98 6.98 0 0 1-11.91 4.97",key:"1sl1rz"}]],GF=it("droplets",$he);const qhe=[["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"}]],Bm=it("ellipsis-vertical",qhe);const Vhe=[["line",{x1:"5",x2:"19",y1:"9",y2:"9",key:"1nwqeh"}],["line",{x1:"5",x2:"19",y1:"15",y2:"15",key:"g8yjpy"}]],rM=it("equal",Vhe);const Ghe=[["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"}]],ei=it("external-link",Ghe);const Whe=[["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"}]],j0=it("eye-off",Whe);const Khe=[["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"}]],tc=it("eye",Khe);const Yhe=[["path",{d:"M10.827 16.379a6.082 6.082 0 0 1-8.618-7.002l5.412 1.45a6.082 6.082 0 0 1 7.002-8.618l-1.45 5.412a6.082 6.082 0 0 1 8.618 7.002l-5.412-1.45a6.082 6.082 0 0 1-7.002 8.618l1.45-5.412Z",key:"484a7f"}],["path",{d:"M12 12v.01",key:"u5ubse"}]],VY=it("fan",Yhe);const Xhe=[["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"}]],Cp=it("file-box",Xhe);const Qhe=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}]],$1=it("file-code",Qhe);const Zhe=[["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"}]],Jhe=it("file-exclamation-point",Zhe);const epe=[["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:"M8 13h2",key:"yr2amv"}],["path",{d:"M14 13h2",key:"un5t4a"}],["path",{d:"M8 17h2",key:"2yhykz"}],["path",{d:"M14 17h2",key:"10kma7"}]],q1=it("file-spreadsheet",epe);const tpe=[["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"}]],Es=it("file-text",tpe);const npe=[["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"}]],cC=it("file",npe);const rpe=[["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"}]],Hm=it("film",rpe);const ipe=[["path",{d:"M12 3q1 4 4 6.5t3 5.5a1 1 0 0 1-14 0 5 5 0 0 1 1-3 1 1 0 0 0 5 0c0-2-1.5-3-1.5-5q0-2 2.5-4",key:"1slcih"}]],ape=it("flame",ipe);const spe=[["path",{d:"M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z",key:"1fr9dc"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M12 10v2",key:"hh53o1"}],["path",{d:"M16 10v6",key:"1d6xys"}]],fs=it("folder-kanban",spe);const ope=[["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"}]],nc=it("folder-open",ope);const lpe=[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["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"}]],cpe=it("folder-plus",lpe);const dpe=[["path",{d:"M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"hod4my"}],["path",{d:"M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"w4yl2u"}],["path",{d:"M3 5a2 2 0 0 0 2 2h3",key:"f2jnh7"}],["path",{d:"M3 3v13a2 2 0 0 0 2 2h3",key:"k8epm1"}]],upe=it("folder-tree",dpe);const mpe=[["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"}]],GY=it("folder",mpe);const hpe=[["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"}],["rect",{width:"10",height:"8",x:"7",y:"8",rx:"1",key:"vys8me"}]],ppe=it("fullscreen",hpe);const fpe=[["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"}]],dC=it("funnel",fpe);const gpe=[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]],uC=it("gauge",gpe);const bpe=[["rect",{x:"3",y:"8",width:"18",height:"4",rx:"1",key:"bkv52"}],["path",{d:"M12 8v13",key:"1c76mn"}],["path",{d:"M19 12v7a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-7",key:"6wjy6b"}],["path",{d:"M7.5 8a2.5 2.5 0 0 1 0-5A4.8 8 0 0 1 12 8a4.8 8 0 0 1 4.5-5 2.5 2.5 0 0 1 0 5",key:"1ihvrl"}]],xpe=it("gift",bpe);const ype=[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M13 6h3a2 2 0 0 1 2 2v7",key:"1yeb86"}],["path",{d:"M11 18H8a2 2 0 0 1-2-2V9",key:"19pyzm"}]],mb=it("git-compare",ype);const vpe=[["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"}]],kD=it("github",vpe);const wpe=[["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"}]],$m=it("globe",wpe);const Spe=[["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"}]],qm=it("grip-vertical",Spe);const _pe=[["path",{d:"M3 7V5c0-1.1.9-2 2-2h2",key:"adw53z"}],["path",{d:"M17 3h2c1.1 0 2 .9 2 2v2",key:"an4l38"}],["path",{d:"M21 17v2c0 1.1-.9 2-2 2h-2",key:"144t0e"}],["path",{d:"M7 21H5c-1.1 0-2-.9-2-2v-2",key:"rtnfgi"}],["rect",{width:"7",height:"5",x:"7",y:"7",rx:"1",key:"1eyiv7"}],["rect",{width:"7",height:"5",x:"10",y:"12",rx:"1",key:"1qlmkx"}]],kpe=it("group",_pe);const Npe=[["path",{d:"M18 11V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2",key:"1fvzgz"}],["path",{d:"M14 10V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2",key:"1kc0my"}],["path",{d:"M10 10.5V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2v8",key:"10h0bg"}],["path",{d:"M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15",key:"1s1gnw"}]],WY=it("hand",Npe);const Cpe=[["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"}]],cx=it("hard-drive",Cpe);const Tpe=[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]],Ppe=it("hash",Tpe);const Ape=[["path",{d:"M3 14h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-7a9 9 0 0 1 18 0v7a2 2 0 0 1-2 2h-1a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h3",key:"1xhozi"}]],Mpe=it("headphones",Ape);const Epe=[["path",{d:"M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5",key:"mvr1a0"}]],jpe=it("heart",Epe);const Dpe=[["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"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]],Fv=it("history",Dpe);const Rpe=[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]],D0=it("house",Rpe);const Fpe=[["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"}]],ou=it("image",Fpe);const Lpe=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],js=it("info",Lpe);const Ope=[["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"}]],Ipe=it("italic",Ope);const zpe=[["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"}]],il=it("key",zpe);const Upe=[["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"}]],ND=it("keyboard",Upe);const Bpe=[["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"}]],Vi=it("layers",Bpe);const Hpe=[["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"}]],R0=it("layout-grid",Hpe);const $pe=[["path",{d:"M9 17H7A5 5 0 0 1 7 7",key:"10o201"}],["path",{d:"M15 7h2a5 5 0 0 1 4 8",key:"1d3206"}],["line",{x1:"8",x2:"12",y1:"12",y2:"12",key:"rvw6j4"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]],qpe=it("link-2-off",$pe);const Vpe=[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]],Vm=it("link-2",Vpe);const Gpe=[["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"}]],dx=it("link",Gpe);const Wpe=[["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"}]],KY=it("list-ordered",Wpe);const Kpe=[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["rect",{x:"3",y:"4",width:"6",height:"6",rx:"1",key:"cif1o7"}]],CD=it("list-todo",Kpe);const Ype=[["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"}]],mC=it("list",Ype);const Xpe=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],ct=it("loader-circle",Xpe);const Qpe=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 9.9-1",key:"1mm8w8"}]],c1=it("lock-open",Qpe);const Zpe=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],Jh=it("lock",Zpe);const Jpe=[["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"}]],t8=it("log-in",Jpe);const efe=[["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"}]],TD=it("log-out",efe);const tfe=[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7",key:"132q7q"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}]],Lv=it("mail",tfe);const nfe=[["path",{d:"M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z",key:"169xi5"}],["path",{d:"M15 5.764v15",key:"1pn4in"}],["path",{d:"M9 3.236v15",key:"1uimfh"}]],rfe=it("map",nfe);const ife=[["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"}]],hC=it("maximize-2",ife);const afe=[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3",key:"1dcmit"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3",key:"1e4gt3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3",key:"wsl5sc"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3",key:"18trek"}]],sfe=it("maximize",afe);const ofe=[["path",{d:"M6 19v-3",key:"1nvgqn"}],["path",{d:"M10 19v-3",key:"iu8nkm"}],["path",{d:"M14 19v-3",key:"kcehxu"}],["path",{d:"M18 19v-3",key:"1vh91z"}],["path",{d:"M8 11V9",key:"63erz4"}],["path",{d:"M16 11V9",key:"fru6f3"}],["path",{d:"M12 11V9",key:"ha00sb"}],["path",{d:"M2 15h20",key:"16ne18"}],["path",{d:"M2 7a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v1.1a2 2 0 0 0 0 3.837V17a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-5.1a2 2 0 0 0 0-3.837Z",key:"lhddv3"}]],lfe=it("memory-stick",ofe);const cfe=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],dfe=it("menu",cfe);const ufe=[["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"}]],WF=it("minimize-2",ufe);const mfe=[["path",{d:"M8 3v3a2 2 0 0 1-2 2H3",key:"hohbtr"}],["path",{d:"M21 8h-3a2 2 0 0 1-2-2V3",key:"5jw1f3"}],["path",{d:"M3 16h3a2 2 0 0 1 2 2v3",key:"198tvr"}],["path",{d:"M16 21v-3a2 2 0 0 1 2-2h3",key:"ph8mxp"}]],YY=it("minimize",mfe);const hfe=[["path",{d:"M5 12h14",key:"1ays0h"}]],V1=it("minus",hfe);const pfe=[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]],ffe=it("monitor",pfe);const gfe=[["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"}]],G1=it("moon",gfe);const bfe=[["path",{d:"M18 8L22 12L18 16",key:"1r0oui"}],["path",{d:"M2 12H22",key:"1m8cig"}]],xfe=it("move-right",bfe);const yfe=[["path",{d:"M9 18V5l12-2v13",key:"1jmyc2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["circle",{cx:"18",cy:"16",r:"3",key:"1hluhg"}]],PD=it("music",yfe);const vfe=[["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"}]],sa=it("package",vfe);const wfe=[["path",{d:"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",key:"e79jfc"}],["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}]],F0=it("palette",wfe);const Sfe=[["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"}]],pC=it("pause",Sfe);const _fe=[["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"}]],$p=it("pen-line",_fe);const kfe=[["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"}]],Mm=it("pen",kfe);const Nfe=[["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"}]],Wi=it("pencil",Nfe);const Cfe=[["path",{d:"M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384",key:"9njp5v"}]],Tfe=it("phone",Cfe);const Pfe=[["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"}]],co=it("play",Pfe);const Afe=[["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"}]],fl=it("plug",Afe);const Mfe=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],sr=it("plus",Mfe);const Efe=[["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"}]],fC=it("power-off",Efe);const jfe=[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]],wu=it("power",jfe);const Dfe=[["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"}]],kr=it("printer",Dfe);const Rfe=[["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"}]],XY=it("qr-code",Rfe);const Ffe=[["path",{d:"M16.247 7.761a6 6 0 0 1 0 8.478",key:"1fwjs5"}],["path",{d:"M19.075 4.933a10 10 0 0 1 0 14.134",key:"ehdyv1"}],["path",{d:"M4.925 19.067a10 10 0 0 1 0-14.134",key:"1q22gi"}],["path",{d:"M7.753 16.239a6 6 0 0 1 0-8.478",key:"r2q7qm"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]],KF=it("radio",Ffe);const Lfe=[["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"}]],_r=it("refresh-cw",Lfe);const Ofe=[["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"}]],uo=it("rotate-ccw",Ofe);const Ife=[["path",{d:"M21.3 15.3a2.4 2.4 0 0 1 0 3.4l-2.6 2.6a2.4 2.4 0 0 1-3.4 0L2.7 8.7a2.41 2.41 0 0 1 0-3.4l2.6-2.6a2.41 2.41 0 0 1 3.4 0Z",key:"icamh8"}],["path",{d:"m14.5 12.5 2-2",key:"inckbg"}],["path",{d:"m11.5 9.5 2-2",key:"fmmyf7"}],["path",{d:"m8.5 6.5 2-2",key:"vc6u1g"}],["path",{d:"m17.5 15.5 2-2",key:"wo5hmg"}]],zfe=it("ruler",Ife);const Ufe=[["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"}]],ps=it("save",Ufe);const Bfe=[["path",{d:"M12 3v18",key:"108xh3"}],["path",{d:"m19 8 3 8a5 5 0 0 1-6 0zV7",key:"zcdpyk"}],["path",{d:"M3 7h1a17 17 0 0 0 8-2 17 17 0 0 0 8 2h1",key:"1yorad"}],["path",{d:"m5 8 3 8a5 5 0 0 1-6 0zV7",key:"eua70x"}],["path",{d:"M7 21h10",key:"1b0cd5"}]],Hfe=it("scale",Bfe);const $fe=[["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"}]],W1=it("scan-search",$fe);const qfe=[["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M8.12 8.12 12 12",key:"1alkpv"}],["path",{d:"M20 4 8.12 15.88",key:"xgtan2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M14.8 14.8 20 20",key:"ptml3r"}]],Vfe=it("scissors",qfe);const Gfe=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Dr=it("search",Gfe);const Wfe=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],gC=it("send",Wfe);const Kfe=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],ep=it("server",Kfe);const Yfe=[["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"}]],lu=it("settings-2",Yfe);const Xfe=[["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"}]],bC=it("settings",Xfe);const Qfe=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]],Zfe=it("shield-alert",Qfe);const Jfe=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],AD=it("shield",Jfe);const ege=[["circle",{cx:"8",cy:"21",r:"1",key:"jimo8o"}],["circle",{cx:"19",cy:"21",r:"1",key:"13723u"}],["path",{d:"M2.05 2.05h2l2.66 12.42a2 2 0 0 0 2 1.58h9.78a2 2 0 0 0 1.95-1.57l1.65-7.43H5.12",key:"9zh506"}]],QY=it("shopping-cart",ege);const tge=[["path",{d:"M2 20h.01",key:"4haj6o"}],["path",{d:"M7 20v-4",key:"j294jx"}],["path",{d:"M12 20v-8",key:"i3yub9"}],["path",{d:"M17 20V8",key:"1tkaf5"}],["path",{d:"M22 4v16",key:"sih9yq"}]],ZY=it("signal",tge);const nge=[["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"}]],rge=it("skip-back",nge);const ige=[["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"}]],YF=it("skip-forward",ige);const age=[["path",{d:"M10 8h4",key:"1sr2af"}],["path",{d:"M12 21v-9",key:"17s77i"}],["path",{d:"M12 8V3",key:"13r4qs"}],["path",{d:"M17 16h4",key:"h1uq16"}],["path",{d:"M19 12V3",key:"o1uvq1"}],["path",{d:"M19 21v-5",key:"qua636"}],["path",{d:"M3 14h4",key:"bcjad9"}],["path",{d:"M5 10V3",key:"cb8scm"}],["path",{d:"M5 21v-7",key:"1w1uti"}]],n8=it("sliders-vertical",age);const sge=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],jb=it("sparkles",sge);const oge=[["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"}]],mo=it("square-check-big",oge);const lge=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M8 12h8",key:"1wcyev"}]],cge=it("square-minus",lge);const dge=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],Sl=it("square",dge);const uge=[["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"}]],qp=it("star",uge);const mge=[["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"}]],JY=it("sticky-note",mge);const hge=[["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"}]],r8=it("sun",hge);const pge=[["path",{d:"M15 3v18",key:"14nvp0"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M21 9H3",key:"1338ky"}],["path",{d:"M21 15H3",key:"9uk58r"}]],fge=it("table-properties",pge);const gge=[["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"}]],cu=it("tag",gge);const bge=[["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"}]],eX=it("target",bge);const xge=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],tX=it("terminal",xge);const yge=[["path",{d:"M21 5H3",key:"1fi0y6"}],["path",{d:"M17 12H7",key:"16if0g"}],["path",{d:"M19 19H5",key:"vjpgq2"}]],vge=it("text-align-center",yge);const wge=[["path",{d:"M21 5H3",key:"1fi0y6"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M21 19H7",key:"4cu937"}]],Sge=it("text-align-end",wge);const _ge=[["path",{d:"M21 5H3",key:"1fi0y6"}],["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M17 19H3",key:"z6ezky"}]],kge=it("text-align-start",_ge);const Nge=[["path",{d:"M14 4v10.54a4 4 0 1 1-4 0V4a2 2 0 0 1 4 0Z",key:"17jzev"}]],xC=it("thermometer",Nge);const Cge=[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]],qd=it("timer",Cge);const Tge=[["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"}]],Qt=it("trash-2",Tge);const Pge=[["path",{d:"M16 17h6v-6",key:"t6n2it"}],["path",{d:"m22 17-8.5-8.5-5 5L2 7",key:"x473p"}]],XF=it("trending-down",Pge);const Age=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],MD=it("trending-up",Age);const Mge=[["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"}]],En=it("triangle-alert",Mge);const Ege=[["path",{d:"M6 4v6a6 6 0 0 0 12 0V4",key:"9kb039"}],["line",{x1:"4",x2:"20",y1:"20",y2:"20",key:"nun2al"}]],jge=it("underline",Ege);const Dge=[["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"}]],Ov=it("unlink",Dge);const Rge=[["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"}]],Si=it("upload",Rge);const Fge=[["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"}]],du=it("user",Fge);const Lge=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],Sm=it("users",Lge);const Oge=[["path",{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",key:"ftymec"}],["rect",{x:"2",y:"6",width:"14",height:"12",rx:"2",key:"158x01"}]],QF=it("video",Oge);const Ige=[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]],zge=it("volume-2",Ige);const Uge=[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["line",{x1:"22",x2:"16",y1:"9",y2:"15",key:"1ewh16"}],["line",{x1:"16",x2:"22",y1:"9",y2:"15",key:"5ykzw1"}]],Bge=it("volume-x",Uge);const Hge=[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]],$ge=it("wand-sparkles",Hge);const qge=[["circle",{cx:"12",cy:"5",r:"3",key:"rqqgnr"}],["path",{d:"M6.5 8a2 2 0 0 0-1.905 1.46L2.1 18.5A2 2 0 0 0 4 21h16a2 2 0 0 0 1.925-2.54L19.4 9.5A2 2 0 0 0 17.48 8Z",key:"56o5sh"}]],nX=it("weight",qge);const Vge=[["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"}]],rh=it("wifi-off",Vge);const Gge=[["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"}]],hb=it("wifi",Gge);const Wge=[["path",{d:"M12.8 19.6A2 2 0 1 0 14 16H2",key:"148xed"}],["path",{d:"M17.5 8a2.5 2.5 0 1 1 2 4H2",key:"1u4tom"}],["path",{d:"M9.8 4.4A2 2 0 1 1 11 8H2",key:"75valh"}]],rX=it("wind",Wge);const Kge=[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]],Vp=it("wrench",Kge);const Yge=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],zt=it("x",Yge);const Xge=[["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"}]],ZF=it("zoom-in",Xge);const Qge=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],rc=it("zap",Qge);const Zge=[["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"}]],JF=it("zoom-out",Zge),ln="/api/v1";let fn=localStorage.getItem("auth_token");function Yg(t){fn=t,t?localStorage.setItem("auth_token",t):localStorage.removeItem("auth_token")}function uu(){return fn}function tp(t){if(!t)return null;const e=t.match(/filename\*=(?:UTF-8|utf-8)''(.+?)(?:;|$)/);if(e)try{return decodeURIComponent(e[1])}catch{}return t.match(/filename="?([^";\n]+)"?/)?.[1]||null}async function Re(t,e={}){const n={"Content-Type":"application/json",...e.headers};fn&&(n.Authorization=`Bearer ${fn}`);const r=await fetch(`${ln}${t}`,{...e,cache:"no-store",headers:n});if(!r.ok){const o=(await r.json().catch(()=>({}))).detail,l=typeof o=="string"?o:o?JSON.stringify(o):`HTTP ${r.status}`;throw r.status===401&&["Could not validate credentials","Token has expired","User not found or inactive","Invalid API key","API key has expired"].some(d=>l.includes(d))&&Yg(null),new Error(l)}const a=r.headers.get("content-length");if(!(r.status===204||a==="0"))return await r.json()}const be={getAuthStatus:()=>Re("/auth/status"),setupAuth:t=>Re("/auth/setup",{method:"POST",body:JSON.stringify(t)}),login:t=>Re("/auth/login",{method:"POST",body:JSON.stringify(t)}),logout:()=>Re("/auth/logout",{method:"POST"}),getCurrentUser:()=>Re("/auth/me"),disableAuth:()=>Re("/auth/disable",{method:"POST"}),testSMTP:t=>Re("/auth/smtp/test",{method:"POST",body:JSON.stringify(t)}),getSMTPSettings:()=>Re("/auth/smtp"),saveSMTPSettings:t=>Re("/auth/smtp",{method:"POST",body:JSON.stringify(t)}),enableAdvancedAuth:()=>Re("/auth/advanced-auth/enable",{method:"POST"}),disableAdvancedAuth:()=>Re("/auth/advanced-auth/disable",{method:"POST"}),getAdvancedAuthStatus:()=>Re("/auth/advanced-auth/status"),forgotPassword:t=>Re("/auth/forgot-password",{method:"POST",body:JSON.stringify(t)}),resetUserPassword:t=>Re("/auth/reset-password",{method:"POST",body:JSON.stringify(t)}),getUsers:()=>Re("/users/"),getUser:t=>Re(`/users/${t}`),createUser:t=>Re("/users/",{method:"POST",body:JSON.stringify(t)}),updateUser:(t,e)=>Re(`/users/${t}`,{method:"PATCH",body:JSON.stringify(e)}),deleteUser:(t,e=!1)=>Re(`/users/${t}?delete_items=${e}`,{method:"DELETE"}),getUserItemsCount:t=>Re(`/users/${t}/items-count`),changePassword:(t,e)=>Re("/users/me/change-password",{method:"POST",body:JSON.stringify({current_password:t,new_password:e})}),getPermissions:()=>Re("/groups/permissions"),getGroups:()=>Re("/groups/"),getGroup:t=>Re(`/groups/${t}`),createGroup:t=>Re("/groups/",{method:"POST",body:JSON.stringify(t)}),updateGroup:(t,e)=>Re(`/groups/${t}`,{method:"PATCH",body:JSON.stringify(e)}),deleteGroup:t=>Re(`/groups/${t}`,{method:"DELETE"}),addUserToGroup:(t,e)=>Re(`/groups/${t}/users/${e}`,{method:"POST"}),removeUserFromGroup:(t,e)=>Re(`/groups/${t}/users/${e}`,{method:"DELETE"}),getPrinters:()=>Re("/printers/"),getPrinter:t=>Re(`/printers/${t}`),createPrinter:t=>Re("/printers/",{method:"POST",body:JSON.stringify(t)}),updatePrinter:(t,e)=>Re(`/printers/${t}`,{method:"PATCH",body:JSON.stringify(e)}),deletePrinter:(t,e=!0)=>Re(`/printers/${t}?delete_archives=${e}`,{method:"DELETE"}),getDeveloperModeWarnings:()=>Re("/printers/developer-mode-warnings"),getAvailableFilaments:(t,e)=>{const n=new URLSearchParams({model:t});return e&&n.set("location",e),Re(`/printers/available-filaments?${n}`)},getPrinterStatus:t=>Re(`/printers/${t}/status`),refreshPrinterStatus:t=>Re(`/printers/${t}/refresh-status`,{method:"POST"}),connectPrinter:t=>Re(`/printers/${t}/connect`,{method:"POST"}),disconnectPrinter:t=>Re(`/printers/${t}/disconnect`,{method:"POST"}),testExternalCamera:(t,e,n)=>Re(`/printers/${t}/camera/external/test?url=${encodeURIComponent(e)}&camera_type=${encodeURIComponent(n)}`,{method:"POST"}),stopPrint:t=>Re(`/printers/${t}/print/stop`,{method:"POST"}),pausePrint:t=>Re(`/printers/${t}/print/pause`,{method:"POST"}),resumePrint:t=>Re(`/printers/${t}/print/resume`,{method:"POST"}),clearPlate:t=>Re(`/printers/${t}/clear-plate`,{method:"POST"}),getCurrentPrintUser:t=>Re(`/printers/${t}/current-print-user`),setChamberLight:(t,e)=>Re(`/printers/${t}/chamber-light?on=${e}`,{method:"POST"}),getPrintableObjects:t=>Re(`/printers/${t}/print/objects`),skipObjects:(t,e)=>Re(`/printers/${t}/print/skip-objects`,{method:"POST",body:JSON.stringify(e)}),clearHMSErrors:t=>Re(`/printers/${t}/hms/clear`,{method:"POST"}),refreshAmsSlot:(t,e,n)=>Re(`/printers/${t}/ams/${e}/slot/${n}/refresh`,{method:"POST"}),enableMQTTLogging:t=>Re(`/printers/${t}/logging/enable`,{method:"POST"}),disableMQTTLogging:t=>Re(`/printers/${t}/logging/disable`,{method:"POST"}),getMQTTLogs:t=>Re(`/printers/${t}/logging`),clearMQTTLogs:t=>Re(`/printers/${t}/logging`,{method:"DELETE"}),getPrinterFiles:(t,e="/")=>Re(`/printers/${t}/files?path=${encodeURIComponent(e)}`),getPrinterFileDownloadUrl:(t,e)=>`${ln}/printers/${t}/files/download?path=${encodeURIComponent(e)}`,getPrinterFileGcodeUrl:(t,e)=>`${ln}/printers/${t}/files/gcode?path=${encodeURIComponent(e)}`,getPrinterFilePlates:(t,e)=>Re(`/printers/${t}/files/plates?path=${encodeURIComponent(e)}`),getPrinterFilePlateThumbnail:(t,e,n)=>`${ln}/printers/${t}/files/plate-thumbnail/${e}?path=${encodeURIComponent(n)}`,downloadPrinterFile:async(t,e)=>{const n={};fn&&(n.Authorization=`Bearer ${fn}`);const r=await fetch(`${ln}/printers/${t}/files/download?path=${encodeURIComponent(e)}`,{headers:n});if(!r.ok){const d=await r.json().catch(()=>({}));throw new Error(d.detail||`HTTP ${r.status}`)}const a=r.headers.get("Content-Disposition"),s=tp(a)||e.split("/").pop()||"download",o=await r.blob(),l=window.URL.createObjectURL(o),c=document.createElement("a");c.href=l,c.download=s,document.body.appendChild(c),c.click(),document.body.removeChild(c),window.URL.revokeObjectURL(l)},downloadPrinterFilesAsZip:async(t,e)=>{const n={"Content-Type":"application/json"};fn&&(n.Authorization=`Bearer ${fn}`);const r=await fetch(`${ln}/printers/${t}/files/download-zip`,{method:"POST",headers:n,body:JSON.stringify({paths:e})});if(!r.ok){const a=await r.json().catch(()=>({}));throw new Error(a.detail||`HTTP ${r.status}`)}return r.blob()},deletePrinterFile:(t,e)=>Re(`/printers/${t}/files?path=${encodeURIComponent(e)}`,{method:"DELETE"}),getPrinterStorage:t=>Re(`/printers/${t}/storage`),getArchives:(t,e,n=50,r=0,a,s)=>{const o=new URLSearchParams;return t&&o.set("printer_id",String(t)),e&&o.set("project_id",String(e)),o.set("limit",String(n)),o.set("offset",String(r)),a&&o.set("date_from",a),s&&o.set("date_to",s),Re(`/archives/?${o}`)},getArchivesSlim:(t,e)=>{const n=new URLSearchParams;t&&n.set("date_from",t),e&&n.set("date_to",e);const r=n.toString();return Re(`/archives/slim${r?`?${r}`:""}`)},getArchive:t=>Re(`/archives/${t}`),searchArchives:(t,e)=>{const n=new URLSearchParams;return n.set("q",t),e?.printerId&&n.set("printer_id",String(e.printerId)),e?.projectId&&n.set("project_id",String(e.projectId)),e?.status&&n.set("status",e.status),e?.limit&&n.set("limit",String(e.limit)),e?.offset&&n.set("offset",String(e.offset)),Re(`/archives/search?${n}`)},rebuildSearchIndex:()=>Re("/archives/search/rebuild-index",{method:"POST"}),updateArchive:(t,e)=>Re(`/archives/${t}`,{method:"PATCH",body:JSON.stringify(e)}),toggleFavorite:t=>Re(`/archives/${t}/favorite`,{method:"POST"}),deleteArchive:t=>Re(`/archives/${t}`,{method:"DELETE"}),getArchiveStats:t=>{const e=new URLSearchParams;t?.dateFrom&&e.set("date_from",t.dateFrom),t?.dateTo&&e.set("date_to",t.dateTo);const n=e.toString();return Re(`/archives/stats${n?`?${n}`:""}`)},getTags:()=>Re("/archives/tags"),renameTag:(t,e)=>Re(`/archives/tags/${encodeURIComponent(t)}`,{method:"PUT",body:JSON.stringify({new_name:e})}),deleteTag:t=>Re(`/archives/tags/${encodeURIComponent(t)}`,{method:"DELETE"}),recalculateCosts:()=>Re("/archives/recalculate-costs",{method:"POST"}),getFailureAnalysis:t=>{const e=new URLSearchParams;t?.days&&e.set("days",String(t.days)),t?.dateFrom&&e.set("date_from",t.dateFrom),t?.dateTo&&e.set("date_to",t.dateTo),t?.printerId&&e.set("printer_id",String(t.printerId)),t?.projectId&&e.set("project_id",String(t.projectId));const n=e.toString();return Re(`/archives/analysis/failures${n?`?${n}`:""}`)},compareArchives:t=>Re(`/archives/compare?archive_ids=${t.join(",")}`),findSimilarArchives:(t,e=10)=>Re(`/archives/${t}/similar?limit=${e}`),exportArchives:async t=>{const e=new URLSearchParams;t?.format&&e.set("format",t.format),t?.fields&&e.set("fields",t.fields.join(",")),t?.printerId&&e.set("printer_id",String(t.printerId)),t?.projectId&&e.set("project_id",String(t.projectId)),t?.status&&e.set("status",t.status),t?.dateFrom&&e.set("date_from",t.dateFrom),t?.dateTo&&e.set("date_to",t.dateTo),t?.search&&e.set("search",t.search);const n={};fn&&(n.Authorization=`Bearer ${fn}`);const r=await fetch(`${ln}/archives/export?${e}`,{headers:n});if(!r.ok){const l=await r.json().catch(()=>({}));throw new Error(l.detail||`HTTP ${r.status}`)}const a=r.headers.get("Content-Disposition");let s=t?.format==="xlsx"?"archives_export.xlsx":"archives_export.csv";if(a){const l=a.match(/filename="?([^"]+)"?/);l&&(s=l[1])}return{blob:await r.blob(),filename:s}},exportStats:async t=>{const e=new URLSearchParams;t?.format&&e.set("format",t.format),t?.days&&e.set("days",String(t.days)),t?.printerId&&e.set("printer_id",String(t.printerId)),t?.projectId&&e.set("project_id",String(t.projectId));const n={};fn&&(n.Authorization=`Bearer ${fn}`);const r=await fetch(`${ln}/archives/stats/export?${e}`,{headers:n});if(!r.ok){const l=await r.json().catch(()=>({}));throw new Error(l.detail||`HTTP ${r.status}`)}const a=r.headers.get("Content-Disposition");let s=t?.format==="xlsx"?"stats_export.xlsx":"stats_export.csv";if(a){const l=a.match(/filename="?([^"]+)"?/);l&&(s=l[1])}return{blob:await r.blob(),filename:s}},getArchiveDuplicates:t=>Re(`/archives/${t}/duplicates`),backfillContentHashes:()=>Re("/archives/backfill-hashes",{method:"POST"}),getArchiveThumbnail:t=>`${ln}/archives/${t}/thumbnail?v=${Date.now()}`,getArchivePlateThumbnail:(t,e)=>`${ln}/archives/${t}/plate-thumbnail/${e}`,getArchiveDownload:t=>`${ln}/archives/${t}/download`,downloadArchive:async(t,e)=>{const n={};fn&&(n.Authorization=`Bearer ${fn}`);const r=await fetch(`${ln}/archives/${t}/download`,{headers:n});if(!r.ok){const d=await r.json().catch(()=>({}));throw new Error(d.detail||`HTTP ${r.status}`)}const a=r.headers.get("Content-Disposition"),s=tp(a)||e||`archive_${t}.3mf`,o=await r.blob(),l=window.URL.createObjectURL(o),c=document.createElement("a");c.href=l,c.download=s,document.body.appendChild(c),c.click(),document.body.removeChild(c),window.URL.revokeObjectURL(l)},getArchiveGcode:t=>`${ln}/archives/${t}/gcode`,getArchivePlatePreview:t=>`${ln}/archives/${t}/plate-preview`,getArchiveTimelapse:t=>`${ln}/archives/${t}/timelapse?v=${Date.now()}`,scanArchiveTimelapse:t=>Re(`/archives/${t}/timelapse/scan`,{method:"POST"}),selectArchiveTimelapse:(t,e)=>Re(`/archives/${t}/timelapse/select?filename=${encodeURIComponent(e)}`,{method:"POST"}),deleteArchiveTimelapse:t=>Re(`/archives/${t}/timelapse`,{method:"DELETE"}),uploadArchiveTimelapse:async(t,e)=>{const n=new FormData;n.append("file",e);const r={};fn&&(r.Authorization=`Bearer ${fn}`);const a=await fetch(`${ln}/archives/${t}/timelapse/upload`,{method:"POST",headers:r,body:n});if(!a.ok){const s=await a.json().catch(()=>({}));throw new Error(s.detail||`HTTP ${a.status}`)}return a.json()},getTimelapseInfo:t=>Re(`/archives/${t}/timelapse/info`),getTimelapseThumbnails:(t,e=10)=>Re(`/archives/${t}/timelapse/thumbnails?count=${e}`),processTimelapse:async(t,e,n)=>{const r=new FormData;r.append("trim_start",String(e.trimStart??0)),e.trimEnd!==void 0&&r.append("trim_end",String(e.trimEnd)),r.append("speed",String(e.speed??1)),r.append("save_mode",e.saveMode),e.outputFilename&&r.append("output_filename",e.outputFilename),n&&r.append("audio",n);const a={};fn&&(a.Authorization=`Bearer ${fn}`);const s=await fetch(`${ln}/archives/${t}/timelapse/process`,{method:"POST",headers:a,body:r});if(!s.ok){const o=await s.json().catch(()=>({}));throw new Error(o.detail||`HTTP ${s.status}`)}return s.json()},getArchivePhotoUrl:(t,e)=>`${ln}/archives/${t}/photos/${encodeURIComponent(e)}`,uploadArchivePhoto:async(t,e)=>{const n=new FormData;n.append("file",e);const r={};fn&&(r.Authorization=`Bearer ${fn}`);const a=await fetch(`${ln}/archives/${t}/photos`,{headers:r,method:"POST",body:n});if(!a.ok){const s=await a.json().catch(()=>({}));throw new Error(s.detail||`HTTP ${a.status}`)}return a.json()},deleteArchivePhoto:(t,e)=>Re(`/archives/${t}/photos/${encodeURIComponent(e)}`,{method:"DELETE"}),getSource3mfDownloadUrl:t=>`${ln}/archives/${t}/source`,downloadSource3mf:async t=>{const e={};fn&&(e.Authorization=`Bearer ${fn}`);const n=await fetch(`${ln}/archives/${t}/source`,{headers:e});if(!n.ok){const c=await n.json().catch(()=>({}));throw new Error(c.detail||`HTTP ${n.status}`)}const r=n.headers.get("Content-Disposition"),a=tp(r)||`source_${t}.3mf`,s=await n.blob(),o=window.URL.createObjectURL(s),l=document.createElement("a");l.href=o,l.download=a,document.body.appendChild(l),l.click(),document.body.removeChild(l),window.URL.revokeObjectURL(o)},getSource3mfForSlicer:(t,e)=>{const n=e.replace(/[/\\?#]/g,"_");return`${ln}/archives/${t}/source/${encodeURIComponent(n.endsWith(".3mf")?n:n+".3mf")}`},createSourceSlicerToken:t=>Re(`/archives/${t}/source-slicer-token`,{method:"POST"}),getSourceSlicerDownloadUrl:(t,e,n)=>{const r=n.replace(/[/\\?#]/g,"_");return`${ln}/archives/${t}/source-dl/${e}/${encodeURIComponent(r.endsWith(".3mf")?r:r+".3mf")}`},uploadSource3mf:async(t,e)=>{const n=new FormData;n.append("file",e);const r={};fn&&(r.Authorization=`Bearer ${fn}`);const a=await fetch(`${ln}/archives/${t}/source`,{method:"POST",headers:r,body:n});if(!a.ok){const s=await a.json().catch(()=>({}));throw new Error(s.detail||`HTTP ${a.status}`)}return a.json()},deleteSource3mf:t=>Re(`/archives/${t}/source`,{method:"DELETE"}),getF3dDownloadUrl:t=>`${ln}/archives/${t}/f3d`,downloadF3d:async t=>{const e={};fn&&(e.Authorization=`Bearer ${fn}`);const n=await fetch(`${ln}/archives/${t}/f3d`,{headers:e});if(!n.ok){const c=await n.json().catch(()=>({}));throw new Error(c.detail||`HTTP ${n.status}`)}const r=n.headers.get("Content-Disposition"),a=tp(r)||`archive_${t}.f3d`,s=await n.blob(),o=window.URL.createObjectURL(s),l=document.createElement("a");l.href=o,l.download=a,document.body.appendChild(l),l.click(),document.body.removeChild(l),window.URL.revokeObjectURL(o)},uploadF3d:async(t,e)=>{const n=new FormData;n.append("file",e);const r={};fn&&(r.Authorization=`Bearer ${fn}`);const a=await fetch(`${ln}/archives/${t}/f3d`,{method:"POST",headers:r,body:n});if(!a.ok){const s=await a.json().catch(()=>({}));throw new Error(s.detail||`HTTP ${a.status}`)}return a.json()},deleteF3d:t=>Re(`/archives/${t}/f3d`,{method:"DELETE"}),getArchiveQRCodeUrl:(t,e=200)=>`${ln}/archives/${t}/qrcode?size=${e}`,getArchiveCapabilities:t=>Re(`/archives/${t}/capabilities`),getArchiveProjectPage:t=>Re(`/archives/${t}/project-page`),updateArchiveProjectPage:(t,e)=>Re(`/archives/${t}/project-page`,{method:"PATCH",body:JSON.stringify(e)}),getArchiveProjectImageUrl:(t,e)=>`${ln}/archives/${t}/project-image/${encodeURIComponent(e)}`,getArchiveForSlicer:(t,e)=>{const n=e.replace(/[/\\?#]/g,"_");return`${ln}/archives/${t}/file/${encodeURIComponent(n.endsWith(".3mf")?n:n+".3mf")}`},createArchiveSlicerToken:t=>Re(`/archives/${t}/slicer-token`,{method:"POST"}),getArchiveSlicerDownloadUrl:(t,e,n)=>{const r=n.replace(/[/\\?#]/g,"_");return`${ln}/archives/${t}/dl/${e}/${encodeURIComponent(r.endsWith(".3mf")?r:r+".3mf")}`},getArchivePlates:t=>Re(`/archives/${t}/plates`),getArchiveFilamentRequirements:(t,e)=>Re(`/archives/${t}/filament-requirements${e!==void 0?`?plate_id=${e}`:""}`),reprintArchive:(t,e,n)=>Re(`/archives/${t}/reprint?printer_id=${e}`,{method:"POST",headers:n?{"Content-Type":"application/json"}:void 0,body:n?JSON.stringify(n):void 0}),uploadArchive:async(t,e)=>{const n=new FormData;n.append("file",t);const r=e?`${ln}/archives/upload?printer_id=${e}`:`${ln}/archives/upload`,a={};fn&&(a.Authorization=`Bearer ${fn}`);const s=await fetch(r,{method:"POST",headers:a,body:n});if(!s.ok){const o=await s.json().catch(()=>({}));throw new Error(o.detail||`HTTP ${s.status}`)}return s.json()},uploadArchivesBulk:async(t,e)=>{const n=new FormData;t.forEach(o=>n.append("files",o));const r=e?`${ln}/archives/upload-bulk?printer_id=${e}`:`${ln}/archives/upload-bulk`,a={};fn&&(a.Authorization=`Bearer ${fn}`);const s=await fetch(r,{method:"POST",headers:a,body:n});if(!s.ok){const o=await s.json().catch(()=>({}));throw new Error(o.detail||`HTTP ${s.status}`)}return s.json()},getPrintLog:t=>{const e=new URLSearchParams;return t?.search&&e.set("search",t.search),t?.printerId&&e.set("printer_id",String(t.printerId)),t?.username&&e.set("created_by_username",t.username),t?.status&&e.set("status",t.status),t?.dateFrom&&e.set("date_from",t.dateFrom),t?.dateTo&&e.set("date_to",t.dateTo),t?.limit&&e.set("limit",String(t.limit)),t?.offset!==void 0&&e.set("offset",String(t.offset)),Re(`/print-log/?${e}`)},getPrintLogThumbnail:t=>`${ln}/print-log/${t}/thumbnail`,clearPrintLog:()=>Re("/print-log/",{method:"DELETE"}),getSettings:()=>Re("/settings/"),updateSettings:t=>Re("/settings/",{method:"PUT",body:JSON.stringify(t)}),getMQTTStatus:()=>Re("/settings/mqtt/status"),resetSettings:()=>Re("/settings/reset",{method:"POST"}),exportBackup:async()=>{const t=`${ln}/settings/backup`,e={};fn&&(e.Authorization=`Bearer ${fn}`);const n=await fetch(t,{headers:e});if(!n.ok){const o=await n.text();throw new Error(o||`Backup failed with status ${n.status}`)}const r=n.headers.get("Content-Disposition");let a="bambuddy-backup.zip";if(r){const o=r.match(/filename=([^;]+)/);o&&(a=o[1].trim())}return{blob:await n.blob(),filename:a}},importBackup:async t=>{const e=new FormData;e.append("file",t);const n=`${ln}/settings/restore`,r={};return fn&&(r.Authorization=`Bearer ${fn}`),(await fetch(n,{method:"POST",headers:r,body:e})).json()},checkFfmpeg:()=>Re("/settings/check-ffmpeg"),getNetworkInterfaces:()=>Re("/settings/network-interfaces"),getCloudStatus:()=>Re("/cloud/status"),cloudLogin:(t,e,n="global")=>Re("/cloud/login",{method:"POST",body:JSON.stringify({email:t,password:e,region:n})}),cloudVerify:(t,e,n)=>Re("/cloud/verify",{method:"POST",body:JSON.stringify({email:t,code:e,tfa_key:n})}),cloudSetToken:t=>Re("/cloud/token",{method:"POST",body:JSON.stringify({access_token:t})}),cloudLogout:()=>Re("/cloud/logout",{method:"POST"}),getCloudSettings:(t="02.04.00.70")=>Re(`/cloud/settings?version=${t}`),getBuiltinFilaments:()=>Re("/cloud/builtin-filaments"),getFilamentIdMap:()=>Re("/cloud/filament-id-map"),getCloudSettingDetail:t=>Re(`/cloud/settings/${t}`),createCloudSetting:t=>Re("/cloud/settings",{method:"POST",body:JSON.stringify(t)}),updateCloudSetting:(t,e)=>Re(`/cloud/settings/${t}`,{method:"PUT",body:JSON.stringify(e)}),deleteCloudSetting:t=>Re(`/cloud/settings/${t}`,{method:"DELETE"}),getCloudDevices:()=>Re("/cloud/devices"),getCloudFields:t=>Re(`/cloud/fields/${t}`),getAllCloudFields:()=>Re("/cloud/fields"),getFilamentInfo:t=>Re("/cloud/filament-info",{method:"POST",body:JSON.stringify(t)}),getSmartPlugs:()=>Re("/smart-plugs/"),getSmartPlug:t=>Re(`/smart-plugs/${t}`),getSmartPlugByPrinter:t=>Re(`/smart-plugs/by-printer/${t}`),getScriptPlugsByPrinter:t=>Re(`/smart-plugs/by-printer/${t}/scripts`),createSmartPlug:t=>Re("/smart-plugs/",{method:"POST",body:JSON.stringify(t)}),updateSmartPlug:(t,e)=>Re(`/smart-plugs/${t}`,{method:"PATCH",body:JSON.stringify(e)}),deleteSmartPlug:t=>Re(`/smart-plugs/${t}`,{method:"DELETE"}),controlSmartPlug:(t,e)=>Re(`/smart-plugs/${t}/control`,{method:"POST",body:JSON.stringify({action:e})}),getSmartPlugStatus:t=>Re(`/smart-plugs/${t}/status`),testSmartPlugConnection:(t,e,n)=>Re("/smart-plugs/test-connection",{method:"POST",body:JSON.stringify({ip_address:t,username:e,password:n})}),startTasmotaScan:()=>Re("/smart-plugs/discover/scan",{method:"POST"}),getTasmotaScanStatus:()=>Re("/smart-plugs/discover/status"),stopTasmotaScan:()=>Re("/smart-plugs/discover/stop",{method:"POST"}),getDiscoveredTasmotaDevices:()=>Re("/smart-plugs/discover/devices"),testHAConnection:(t,e)=>Re("/smart-plugs/ha/test-connection",{method:"POST",body:JSON.stringify({url:t,token:e})}),getHAEntities:t=>{const e=t?`?search=${encodeURIComponent(t)}`:"";return Re(`/smart-plugs/ha/entities${e}`)},getHASensorEntities:()=>Re("/smart-plugs/ha/sensors"),getQueue:(t,e,n)=>{const r=new URLSearchParams;return t&&r.set("printer_id",String(t)),e&&r.set("status",e),n&&r.set("target_model",n),Re(`/queue/?${r}`)},getQueueItem:t=>Re(`/queue/${t}`),addToQueue:t=>Re("/queue/",{method:"POST",body:JSON.stringify(t)}),updateQueueItem:(t,e)=>Re(`/queue/${t}`,{method:"PATCH",body:JSON.stringify(e)}),removeFromQueue:t=>Re(`/queue/${t}`,{method:"DELETE"}),reorderQueue:t=>Re("/queue/reorder",{method:"POST",body:JSON.stringify({items:t})}),cancelQueueItem:t=>Re(`/queue/${t}/cancel`,{method:"POST"}),stopQueueItem:t=>Re(`/queue/${t}/stop`,{method:"POST"}),startQueueItem:t=>Re(`/queue/${t}/start`,{method:"POST"}),bulkUpdateQueue:t=>Re("/queue/bulk",{method:"PATCH",body:JSON.stringify(t)}),getKProfiles:(t,e="0.4")=>Re(`/printers/${t}/kprofiles/?nozzle_diameter=${e}`),setKProfile:(t,e)=>Re(`/printers/${t}/kprofiles/`,{method:"POST",body:JSON.stringify(e)}),deleteKProfile:(t,e)=>Re(`/printers/${t}/kprofiles/`,{method:"DELETE",body:JSON.stringify(e)}),setKProfilesBatch:(t,e)=>Re(`/printers/${t}/kprofiles/batch`,{method:"POST",body:JSON.stringify(e)}),getKProfileNotes:t=>Re(`/printers/${t}/kprofiles/notes`),setKProfileNote:(t,e,n)=>Re(`/printers/${t}/kprofiles/notes`,{method:"PUT",body:JSON.stringify({setting_id:e,note:n})}),deleteKProfileNote:(t,e)=>Re(`/printers/${t}/kprofiles/notes/${encodeURIComponent(e)}`,{method:"DELETE"}),getSlotPresets:t=>Re(`/printers/${t}/slot-presets`),getSlotPreset:(t,e,n)=>Re(`/printers/${t}/slot-presets/${e}/${n}`),saveSlotPreset:(t,e,n,r,a,s="cloud")=>Re(`/printers/${t}/slot-presets/${e}/${n}?preset_id=${encodeURIComponent(r)}&preset_name=${encodeURIComponent(a)}&preset_source=${encodeURIComponent(s)}`,{method:"PUT"}),deleteSlotPreset:(t,e,n)=>Re(`/printers/${t}/slot-presets/${e}/${n}`,{method:"DELETE"}),getAmsLabels:t=>Re(`/printers/${t}/ams-labels`),saveAmsLabel:(t,e,n,r="")=>Re(`/printers/${t}/ams-labels/${e}`,{method:"PUT",body:JSON.stringify({label:n,ams_serial:r})}),deleteAmsLabel:(t,e,n="")=>Re(`/printers/${t}/ams-labels/${e}?ams_serial=${encodeURIComponent(n)}`,{method:"DELETE"}),configureAmsSlot:(t,e,n,r)=>{const a=new URLSearchParams({tray_info_idx:r.tray_info_idx,tray_type:r.tray_type,tray_sub_brands:r.tray_sub_brands,tray_color:r.tray_color,nozzle_temp_min:r.nozzle_temp_min.toString(),nozzle_temp_max:r.nozzle_temp_max.toString(),cali_idx:r.cali_idx.toString(),nozzle_diameter:r.nozzle_diameter});return r.setting_id&&a.set("setting_id",r.setting_id),r.kprofile_filament_id&&a.set("kprofile_filament_id",r.kprofile_filament_id),r.kprofile_setting_id&&a.set("kprofile_setting_id",r.kprofile_setting_id),r.k_value!==void 0&&r.k_value>0&&a.set("k_value",r.k_value.toString()),Re(`/printers/${t}/slots/${e}/${n}/configure?${a}`,{method:"POST"})},resetAmsSlot:(t,e,n)=>Re(`/printers/${t}/ams/${e}/tray/${n}/reset`,{method:"POST"}),listFilaments:()=>Re("/filament-catalog/"),getFilament:t=>Re(`/filament-catalog/${t}`),getFilamentsByType:t=>Re(`/filament-catalog/by-type/${t}`),getNotificationProviders:()=>Re("/notifications/"),getNotificationProvider:t=>Re(`/notifications/${t}`),createNotificationProvider:t=>Re("/notifications/",{method:"POST",body:JSON.stringify(t)}),updateNotificationProvider:(t,e)=>Re(`/notifications/${t}`,{method:"PATCH",body:JSON.stringify(e)}),deleteNotificationProvider:t=>Re(`/notifications/${t}`,{method:"DELETE"}),testNotificationProvider:t=>Re(`/notifications/${t}/test`,{method:"POST"}),testNotificationConfig:t=>Re("/notifications/test-config",{method:"POST",body:JSON.stringify(t)}),testAllNotificationProviders:()=>Re("/notifications/test-all",{method:"POST"}),getNotificationTemplates:()=>Re("/notification-templates"),getNotificationTemplate:t=>Re(`/notification-templates/${t}`),updateNotificationTemplate:(t,e)=>Re(`/notification-templates/${t}`,{method:"PUT",body:JSON.stringify(e)}),resetNotificationTemplate:t=>Re(`/notification-templates/${t}/reset`,{method:"POST"}),getTemplateVariables:()=>Re("/notification-templates/variables"),previewTemplate:t=>Re("/notification-templates/preview",{method:"POST",body:JSON.stringify(t)}),getNotificationLogs:t=>{const e=new URLSearchParams;return t?.limit&&e.set("limit",String(t.limit)),t?.offset&&e.set("offset",String(t.offset)),t?.provider_id&&e.set("provider_id",String(t.provider_id)),t?.event_type&&e.set("event_type",t.event_type),t?.success!==void 0&&e.set("success",String(t.success)),t?.days&&e.set("days",String(t.days)),Re(`/notifications/logs?${e}`)},getNotificationLogStats:(t=7)=>Re(`/notifications/logs/stats?days=${t}`),clearNotificationLogs:(t=30)=>Re(`/notifications/logs?older_than_days=${t}`,{method:"DELETE"}),getSpoolmanStatus:()=>Re("/spoolman/status"),connectSpoolman:()=>Re("/spoolman/connect",{method:"POST"}),disconnectSpoolman:()=>Re("/spoolman/disconnect",{method:"POST"}),syncPrinterAms:t=>Re(`/spoolman/sync/${t}`,{method:"POST"}),syncAllPrintersAms:()=>Re("/spoolman/sync-all",{method:"POST"}),getSpoolmanSpools:()=>Re("/spoolman/spools"),getSpoolmanFilaments:()=>Re("/spoolman/filaments"),getUnlinkedSpools:()=>Re("/spoolman/spools/unlinked"),getLinkedSpools:()=>Re("/spoolman/spools/linked"),linkSpool:(t,e)=>Re(`/spoolman/spools/${t}/link`,{method:"POST",body:JSON.stringify({spool_tag:e.spoolTag,printer_id:e.printerId,ams_id:e.amsId,tray_id:e.trayId})}),unlinkSpool:t=>Re(`/spoolman/spools/${t}/unlink`,{method:"POST"}),getSpoolmanSettings:()=>Re("/settings/spoolman"),updateSpoolmanSettings:t=>Re("/settings/spoolman",{method:"PUT",body:JSON.stringify(t)}),getSpools:(t=!1)=>Re(`/inventory/spools?include_archived=${t}`),getSpool:t=>Re(`/inventory/spools/${t}`),createSpool:t=>Re("/inventory/spools",{method:"POST",body:JSON.stringify(t)}),bulkCreateSpools:(t,e)=>Re("/inventory/spools/bulk",{method:"POST",body:JSON.stringify({spool:t,quantity:e})}),updateSpool:(t,e)=>Re(`/inventory/spools/${t}`,{method:"PATCH",body:JSON.stringify(e)}),deleteSpool:t=>Re(`/inventory/spools/${t}`,{method:"DELETE"}),archiveSpool:t=>Re(`/inventory/spools/${t}/archive`,{method:"POST"}),restoreSpool:t=>Re(`/inventory/spools/${t}/restore`,{method:"POST"}),getSpoolKProfiles:t=>Re(`/inventory/spools/${t}/k-profiles`),saveSpoolKProfiles:(t,e)=>Re(`/inventory/spools/${t}/k-profiles`,{method:"PUT",body:JSON.stringify(e)}),getAssignments:t=>Re(`/inventory/assignments${t?`?printer_id=${t}`:""}`),assignSpool:t=>Re("/inventory/assignments",{method:"POST",body:JSON.stringify(t)}),unassignSpool:(t,e,n)=>Re(`/inventory/assignments/${t}/${e}/${n}`,{method:"DELETE"}),getSpoolCatalog:()=>Re("/inventory/catalog"),addCatalogEntry:t=>Re("/inventory/catalog",{method:"POST",body:JSON.stringify(t)}),updateCatalogEntry:(t,e)=>Re(`/inventory/catalog/${t}`,{method:"PUT",body:JSON.stringify(e)}),deleteCatalogEntry:t=>Re(`/inventory/catalog/${t}`,{method:"DELETE"}),bulkDeleteCatalogEntries:t=>Re("/inventory/catalog/bulk-delete",{method:"POST",body:JSON.stringify({ids:t})}),resetSpoolCatalog:()=>Re("/inventory/catalog/reset",{method:"POST"}),getColorCatalog:()=>Re("/inventory/colors"),addColorEntry:t=>Re("/inventory/colors",{method:"POST",body:JSON.stringify(t)}),updateColorEntry:(t,e)=>Re(`/inventory/colors/${t}`,{method:"PUT",body:JSON.stringify(e)}),deleteColorEntry:t=>Re(`/inventory/colors/${t}`,{method:"DELETE"}),bulkDeleteColorEntries:t=>Re("/inventory/colors/bulk-delete",{method:"POST",body:JSON.stringify({ids:t})}),resetColorCatalog:()=>Re("/inventory/colors/reset",{method:"POST"}),lookupColor:(t,e,n)=>Re(`/inventory/colors/lookup?manufacturer=${encodeURIComponent(t)}&color_name=${encodeURIComponent(e)}${n?`&material=${encodeURIComponent(n)}`:""}`),searchColors:(t,e)=>Re(`/inventory/colors/search?${t?`manufacturer=${encodeURIComponent(t)}`:""}${t&&e?"&":""}${e?`material=${encodeURIComponent(e)}`:""}`),linkTagToSpool:(t,e)=>Re(`/inventory/spools/${t}/link-tag`,{method:"PATCH",body:JSON.stringify(e)}),getSpoolUsageHistory:(t,e=50)=>Re(`/inventory/spools/${t}/usage?limit=${e}`),getAllUsageHistory:(t=100,e)=>Re(`/inventory/usage?limit=${t}${e?`&printer_id=${e}`:""}`),clearSpoolUsageHistory:t=>Re(`/inventory/spools/${t}/usage`,{method:"DELETE"}),syncWeightsFromAms:()=>Re("/inventory/sync-ams-weights",{method:"POST"}),getFilamentPresets:()=>Re("/cloud/filaments"),getVersion:()=>Re("/updates/version"),checkForUpdates:()=>Re("/updates/check"),applyUpdate:()=>Re("/updates/apply",{method:"POST"}),getUpdateStatus:()=>Re("/updates/status"),getMaintenanceTypes:()=>Re("/maintenance/types"),createMaintenanceType:t=>Re("/maintenance/types",{method:"POST",body:JSON.stringify(t)}),updateMaintenanceType:(t,e)=>Re(`/maintenance/types/${t}`,{method:"PATCH",body:JSON.stringify(e)}),deleteMaintenanceType:t=>Re(`/maintenance/types/${t}`,{method:"DELETE"}),restoreDefaultMaintenanceTypes:()=>Re("/maintenance/types/restore-defaults",{method:"POST"}),getMaintenanceOverview:()=>Re("/maintenance/overview"),getPrinterMaintenance:t=>Re(`/maintenance/printers/${t}`),updateMaintenanceItem:(t,e)=>Re(`/maintenance/items/${t}`,{method:"PATCH",body:JSON.stringify(e)}),performMaintenance:(t,e)=>Re(`/maintenance/items/${t}/perform`,{method:"POST",body:JSON.stringify({notes:e})}),getMaintenanceHistory:t=>Re(`/maintenance/items/${t}/history`),getMaintenanceSummary:()=>Re("/maintenance/summary"),setPrinterHours:(t,e)=>Re(`/maintenance/printers/${t}/hours?total_hours=${e}`,{method:"PATCH"}),assignMaintenanceType:(t,e)=>Re(`/maintenance/printers/${t}/assign/${e}`,{method:"POST"}),removeMaintenanceItem:t=>Re(`/maintenance/items/${t}`,{method:"DELETE"}),getCameraStreamUrl:(t,e=10)=>`${ln}/printers/${t}/camera/stream?fps=${e}`,getCameraSnapshotUrl:t=>`${ln}/printers/${t}/camera/snapshot`,testCameraConnection:t=>Re(`/printers/${t}/camera/test`),getCameraStatus:t=>Re(`/printers/${t}/camera/status`),checkPlateEmpty:(t,e)=>{const n=new URLSearchParams;return n.set("use_external",String(e?.useExternal??!1)),n.set("include_debug_image",String(e?.includeDebugImage??!1)),Re(`/printers/${t}/camera/check-plate?${n.toString()}`)},getPlateDetectionStatus:t=>Re(`/printers/${t}/camera/plate-detection/status`),calibratePlateDetection:(t,e)=>{const n=new URLSearchParams;return e?.label&&n.set("label",e.label),n.set("use_external",String(e?.useExternal??!1)),Re(`/printers/${t}/camera/plate-detection/calibrate?${n.toString()}`,{method:"POST"})},deletePlateCalibration:t=>Re(`/printers/${t}/camera/plate-detection/calibrate`,{method:"DELETE"}),getPlateReferences:t=>Re(`/printers/${t}/camera/plate-detection/references`),getPlateReferenceThumbnailUrl:(t,e)=>`${ln}/printers/${t}/camera/plate-detection/references/${e}/thumbnail`,updatePlateReferenceLabel:(t,e,n)=>{const r=new URLSearchParams;return r.set("label",n),Re(`/printers/${t}/camera/plate-detection/references/${e}?${r.toString()}`,{method:"PUT"})},deletePlateReference:(t,e)=>Re(`/printers/${t}/camera/plate-detection/references/${e}`,{method:"DELETE"}),getExternalLinks:()=>Re("/external-links/"),getExternalLink:t=>Re(`/external-links/${t}`),createExternalLink:t=>Re("/external-links/",{method:"POST",body:JSON.stringify(t)}),updateExternalLink:(t,e)=>Re(`/external-links/${t}`,{method:"PATCH",body:JSON.stringify(e)}),deleteExternalLink:t=>Re(`/external-links/${t}`,{method:"DELETE"}),reorderExternalLinks:t=>Re("/external-links/reorder",{method:"PUT",body:JSON.stringify({ids:t})}),uploadExternalLinkIcon:async(t,e)=>{const n=new FormData;n.append("file",e);const r={};fn&&(r.Authorization=`Bearer ${fn}`);const a=await fetch(`${ln}/external-links/${t}/icon`,{method:"POST",headers:r,body:n});if(!a.ok){const s=await a.json().catch(()=>({}));throw new Error(s.detail||`HTTP ${a.status}`)}return a.json()},deleteExternalLinkIcon:t=>Re(`/external-links/${t}/icon`,{method:"DELETE"}),getExternalLinkIconUrl:t=>`${ln}/external-links/${t}/icon`,getProjects:t=>{const e=new URLSearchParams;return t&&e.set("status",t),Re(`/projects/?${e}`)},getProject:t=>Re(`/projects/${t}`),createProject:t=>Re("/projects/",{method:"POST",body:JSON.stringify(t)}),updateProject:(t,e)=>Re(`/projects/${t}`,{method:"PATCH",body:JSON.stringify(e)}),deleteProject:t=>Re(`/projects/${t}`,{method:"DELETE"}),getProjectArchives:(t,e=100,n=0)=>Re(`/projects/${t}/archives?limit=${e}&offset=${n}`),addArchivesToProject:(t,e)=>Re(`/projects/${t}/add-archives`,{method:"POST",body:JSON.stringify({archive_ids:e})}),removeArchivesFromProject:(t,e)=>Re(`/projects/${t}/remove-archives`,{method:"POST",body:JSON.stringify({archive_ids:e})}),addQueueItemsToProject:(t,e)=>Re(`/projects/${t}/add-queue`,{method:"POST",body:JSON.stringify({queue_item_ids:e})}),uploadProjectAttachment:async(t,e)=>{const n=new FormData;n.append("file",e);const r={};fn&&(r.Authorization=`Bearer ${fn}`);const a=await fetch(`${ln}/projects/${t}/attachments`,{method:"POST",headers:r,body:n});if(!a.ok){const s=await a.json().catch(()=>({}));throw new Error(s.detail||`HTTP ${a.status}`)}return a.json()},getProjectAttachmentUrl:(t,e)=>`${ln}/projects/${t}/attachments/${encodeURIComponent(e)}`,deleteProjectAttachment:(t,e)=>Re(`/projects/${t}/attachments/${encodeURIComponent(e)}`,{method:"DELETE"}),getProjectBOM:t=>Re(`/projects/${t}/bom`),createBOMItem:(t,e)=>Re(`/projects/${t}/bom`,{method:"POST",body:JSON.stringify(e)}),updateBOMItem:(t,e,n)=>Re(`/projects/${t}/bom/${e}`,{method:"PATCH",body:JSON.stringify(n)}),deleteBOMItem:(t,e)=>Re(`/projects/${t}/bom/${e}`,{method:"DELETE"}),getTemplates:()=>Re("/projects/templates/"),createTemplateFromProject:t=>Re(`/projects/${t}/create-template`,{method:"POST"}),createProjectFromTemplate:(t,e)=>Re(`/projects/from-template/${t}${e?`?name=${encodeURIComponent(e)}`:""}`,{method:"POST"}),getProjectTimeline:(t,e=50)=>Re(`/projects/${t}/timeline?limit=${e}`),exportProjectJson:t=>Re(`/projects/${t}/export?format=json`),importProject:t=>Re("/projects/import",{method:"POST",body:JSON.stringify(t)}),importProjectFile:async t=>{const e=new FormData;e.append("file",t);const n={};fn&&(n.Authorization=`Bearer ${fn}`);const r=await fetch(`${ln}/projects/import/file`,{method:"POST",headers:n,body:e});if(!r.ok){const a=await r.json().catch(()=>({}));throw new Error(a.detail||`HTTP ${r.status}`)}return r.json()},exportProjectZip:async t=>{const e={};fn&&(e.Authorization=`Bearer ${fn}`);const n=await fetch(`${ln}/projects/${t}/export`,{headers:e});if(!n.ok){const o=await n.json().catch(()=>({}));throw new Error(o.detail||`HTTP ${n.status}`)}const r=n.headers.get("Content-Disposition"),a=tp(r)||`project_${t}.zip`;return{blob:await n.blob(),filename:a}},getAPIKeys:()=>Re("/api-keys/"),createAPIKey:t=>Re("/api-keys/",{method:"POST",body:JSON.stringify(t)}),updateAPIKey:(t,e)=>Re(`/api-keys/${t}`,{method:"PATCH",body:JSON.stringify(e)}),deleteAPIKey:t=>Re(`/api-keys/${t}`,{method:"DELETE"}),getAMSHistory:(t,e,n=24)=>Re(`/ams-history/${t}/${e}?hours=${n}`),getSystemInfo:()=>Re("/system/info"),getStorageUsage:t=>{const e=new URLSearchParams;t?.refresh&&e.set("refresh","true");const n=e.toString();return Re(`/system/storage-usage${n?`?${n}`:""}`)},getLibraryFolders:()=>Re("/library/folders"),createLibraryFolder:t=>Re("/library/folders",{method:"POST",body:JSON.stringify(t)}),updateLibraryFolder:(t,e)=>Re(`/library/folders/${t}`,{method:"PUT",body:JSON.stringify(e)}),deleteLibraryFolder:t=>Re(`/library/folders/${t}`,{method:"DELETE"}),getLibraryFoldersByProject:t=>Re(`/library/folders/by-project/${t}`),getLibraryFoldersByArchive:t=>Re(`/library/folders/by-archive/${t}`),getLibraryFiles:(t,e=!0)=>{const n=new URLSearchParams;return t!=null&&n.set("folder_id",String(t)),n.set("include_root",String(e)),Re(`/library/files?${n}`)},getLibraryFile:t=>Re(`/library/files/${t}`),uploadLibraryFile:async(t,e,n=!0)=>{const r=new FormData;r.append("file",t);const a=new URLSearchParams;e&&a.set("folder_id",String(e)),a.set("generate_stl_thumbnails",String(n));const s={};fn&&(s.Authorization=`Bearer ${fn}`);const o=await fetch(`${ln}/library/files?${a}`,{method:"POST",headers:s,body:r});if(!o.ok){const l=await o.json().catch(()=>({}));throw new Error(l.detail||`HTTP ${o.status}`)}return o.json()},extractZipFile:async(t,e,n=!0,r=!1,a=!0)=>{const s=new FormData;s.append("file",t);const o=new URLSearchParams;e&&o.set("folder_id",String(e)),o.set("preserve_structure",String(n)),o.set("create_folder_from_zip",String(r)),o.set("generate_stl_thumbnails",String(a));const l={};fn&&(l.Authorization=`Bearer ${fn}`);const c=await fetch(`${ln}/library/files/extract-zip?${o}`,{method:"POST",headers:l,body:s});if(!c.ok){const d=await c.json().catch(()=>({}));throw new Error(d.detail||`HTTP ${c.status}`)}return c.json()},updateLibraryFile:(t,e)=>Re(`/library/files/${t}`,{method:"PUT",body:JSON.stringify(e)}),deleteLibraryFile:t=>Re(`/library/files/${t}`,{method:"DELETE"}),getLibraryFileDownloadUrl:t=>`${ln}/library/files/${t}/download`,createLibrarySlicerToken:t=>Re(`/library/files/${t}/slicer-token`,{method:"POST"}),getLibrarySlicerDownloadUrl:(t,e,n)=>`${ln}/library/files/${t}/dl/${e}/${encodeURIComponent(n)}`,downloadLibraryFile:async(t,e)=>{const n={};fn&&(n.Authorization=`Bearer ${fn}`);const r=await fetch(`${ln}/library/files/${t}/download`,{headers:n});if(!r.ok){const d=await r.json().catch(()=>({}));throw new Error(d.detail||`HTTP ${r.status}`)}const a=r.headers.get("Content-Disposition"),s=tp(a)||e||`file_${t}`,o=await r.blob(),l=window.URL.createObjectURL(o),c=document.createElement("a");c.href=l,c.download=s,document.body.appendChild(c),c.click(),document.body.removeChild(c),window.URL.revokeObjectURL(l)},getLibraryFileThumbnailUrl:t=>`${ln}/library/files/${t}/thumbnail`,getLibraryFilePlateThumbnail:(t,e)=>`${ln}/library/files/${t}/plate-thumbnail/${e}`,getLibraryFileGcodeUrl:t=>`${ln}/library/files/${t}/gcode`,moveLibraryFiles:(t,e)=>Re("/library/files/move",{method:"POST",body:JSON.stringify({file_ids:t,folder_id:e})}),bulkDeleteLibrary:(t,e)=>Re("/library/bulk-delete",{method:"POST",body:JSON.stringify({file_ids:t,folder_ids:e})}),getLibraryStats:()=>Re("/library/stats"),batchGenerateStlThumbnails:t=>Re("/library/generate-stl-thumbnails",{method:"POST",body:JSON.stringify(t)}),addLibraryFilesToQueue:t=>Re("/library/files/add-to-queue",{method:"POST",body:JSON.stringify({file_ids:t})}),printLibraryFile:(t,e,n)=>Re(`/library/files/${t}/print?printer_id=${e}`,{method:"POST",body:n?JSON.stringify(n):void 0}),cancelBackgroundDispatchJob:t=>Re(`/background-dispatch/${t}`,{method:"DELETE"}),getLibraryFilePlates:t=>Re(`/library/files/${t}/plates`),getLibraryFileFilamentRequirements:(t,e)=>Re(`/library/files/${t}/filament-requirements${e!==void 0?`?plate_id=${e}`:""}`),getGitHubBackupConfig:()=>Re("/github-backup/config"),saveGitHubBackupConfig:t=>Re("/github-backup/config",{method:"POST",body:JSON.stringify(t)}),updateGitHubBackupConfig:t=>Re("/github-backup/config",{method:"PATCH",body:JSON.stringify(t)}),deleteGitHubBackupConfig:()=>Re("/github-backup/config",{method:"DELETE"}),testGitHubConnection:(t,e)=>Re(`/github-backup/test?repo_url=${encodeURIComponent(t)}&token=${encodeURIComponent(e)}`,{method:"POST"}),testGitHubStoredConnection:()=>Re("/github-backup/test-stored",{method:"POST"}),triggerGitHubBackup:()=>Re("/github-backup/run",{method:"POST"}),getGitHubBackupStatus:()=>Re("/github-backup/status"),getGitHubBackupLogs:(t=50)=>Re(`/github-backup/logs?limit=${t}`),clearGitHubBackupLogs:(t=10)=>Re(`/github-backup/logs?keep_last=${t}`,{method:"DELETE"}),getLocalPresets:()=>Re("/local-presets/"),getLocalPresetDetail:t=>Re(`/local-presets/${t}`),importLocalPresets:t=>fetch(`${ln}/local-presets/import`,{method:"POST",headers:fn?{Authorization:`Bearer ${fn}`}:{},body:t}).then(async e=>{if(!e.ok){const n=await e.json().catch(()=>({}));throw new Error(n.detail||`HTTP ${e.status}`)}return e.json()}),createLocalPreset:t=>Re("/local-presets/",{method:"POST",body:JSON.stringify(t)}),updateLocalPreset:(t,e)=>Re(`/local-presets/${t}`,{method:"PUT",body:JSON.stringify(e)}),deleteLocalPreset:t=>Re(`/local-presets/${t}`,{method:"DELETE"}),refreshBaseProfileCache:()=>Re("/local-presets/base-cache/refresh",{method:"POST"})},bc={getInfo:()=>Re("/discovery/info"),getStatus:()=>Re("/discovery/status"),startDiscovery:(t=10)=>Re(`/discovery/start?duration=${t}`,{method:"POST"}),stopDiscovery:()=>Re("/discovery/stop",{method:"POST"}),getDiscoveredPrinters:()=>Re("/discovery/printers"),startSubnetScan:(t,e=1)=>Re("/discovery/scan",{method:"POST",body:JSON.stringify({subnet:t,timeout:e})}),getScanStatus:()=>Re("/discovery/scan/status"),stopSubnetScan:()=>Re("/discovery/scan/stop",{method:"POST"})},Jge={getSettings:()=>Re("/settings/virtual-printer")},K1={list:()=>Re("/virtual-printers"),get:t=>Re(`/virtual-printers/${t}`),create:t=>Re("/virtual-printers",{method:"POST",body:JSON.stringify(t)}),update:(t,e)=>Re(`/virtual-printers/${t}`,{method:"PUT",body:JSON.stringify(e)}),remove:t=>Re(`/virtual-printers/${t}`,{method:"DELETE"})},Xg={list:()=>Re("/pending-uploads/"),getCount:()=>Re("/pending-uploads/count"),get:t=>Re(`/pending-uploads/${t}`),archive:(t,e)=>Re(`/pending-uploads/${t}/archive`,{method:"POST",body:JSON.stringify(e||{})}),discard:t=>Re(`/pending-uploads/${t}`,{method:"DELETE"}),archiveAll:()=>Re("/pending-uploads/archive-all",{method:"POST"}),discardAll:()=>Re("/pending-uploads/discard-all",{method:"DELETE"})},d1={checkUpdates:()=>Re("/firmware/updates"),checkPrinterUpdate:t=>Re(`/firmware/updates/${t}`),prepareUpload:t=>Re(`/firmware/updates/${t}/prepare`),startUpload:t=>Re(`/firmware/updates/${t}/upload`,{method:"POST"}),getUploadStatus:t=>Re(`/firmware/updates/${t}/upload/status`)},pb={getDebugLoggingState:()=>Re("/support/debug-logging"),setDebugLogging:t=>Re("/support/debug-logging",{method:"POST",body:JSON.stringify({enabled:t})}),downloadSupportBundle:async()=>{const t={};fn&&(t.Authorization=`Bearer ${fn}`);const e=await fetch(`${ln}/support/bundle`,{headers:t});if(!e.ok){const l=await e.json().catch(()=>({}));throw new Error(l.detail||`HTTP ${e.status}`)}const n=e.headers.get("Content-Disposition"),r=tp(n)||"bambuddy-support.zip",a=await e.blob(),s=window.URL.createObjectURL(a),o=document.createElement("a");o.href=s,o.download=r,document.body.appendChild(o),o.click(),document.body.removeChild(o),window.URL.revokeObjectURL(s)},getLogs:t=>{const e=new URLSearchParams;t?.limit&&e.set("limit",t.limit.toString()),t?.level&&e.set("level",t.level),t?.search&&e.set("search",t.search);const n=e.toString();return Re(`/support/logs${n?`?${n}`:""}`)},clearLogs:()=>Re("/support/logs",{method:"DELETE"})},gs={getDevices:()=>Re("/spoolbuddy/devices"),tare:t=>Re(`/spoolbuddy/devices/${t}/calibration/tare`,{method:"POST",body:"{}"}),getCalibration:t=>Re(`/spoolbuddy/devices/${t}/calibration`),setCalibrationFactor:(t,e,n,r)=>Re(`/spoolbuddy/devices/${t}/calibration/set-factor`,{method:"POST",body:JSON.stringify({known_weight_grams:e,raw_adc:n,tare_raw_adc:r})}),updateSpoolWeight:(t,e)=>Re("/spoolbuddy/scale/update-spool-weight",{method:"POST",body:JSON.stringify({spool_id:t,weight_grams:e})}),updateDisplay:(t,e,n)=>Re(`/spoolbuddy/devices/${t}/display`,{method:"PUT",body:JSON.stringify({brightness:e,blank_timeout:n})}),checkDaemonUpdate:(t,e)=>Re(`/spoolbuddy/devices/${t}/update-check?include_beta=${e??!1}`),writeTag:(t,e)=>Re("/spoolbuddy/nfc/write-tag",{method:"POST",body:JSON.stringify({device_id:t,spool_id:e})}),cancelWrite:t=>Re(`/spoolbuddy/devices/${t}/cancel-write`,{method:"POST",body:"{}"})},ebe={submit:t=>Re("/bug-report/submit",{method:"POST",body:JSON.stringify(t)})},iX=w.createContext(void 0);function tbe({children:t}){const[e,n]=w.useState(()=>{const N=localStorage.getItem("theme-mode"),R=localStorage.getItem("theme");return N||R||"dark"}),[r,a]=w.useState(()=>localStorage.getItem("dark-style")||"classic"),[s,o]=w.useState(()=>localStorage.getItem("dark-background")||"neutral"),[l,c]=w.useState(()=>localStorage.getItem("dark-accent")||"green"),[d,u]=w.useState(()=>localStorage.getItem("light-style")||"classic"),[m,p]=w.useState(()=>localStorage.getItem("light-background")||"neutral"),[f,y]=w.useState(()=>localStorage.getItem("light-accent")||"green");w.useEffect(()=>{be.getSettings().then(N=>{N.dark_style&&(a(N.dark_style),localStorage.setItem("dark-style",N.dark_style)),N.dark_background&&(o(N.dark_background),localStorage.setItem("dark-background",N.dark_background)),N.dark_accent&&(c(N.dark_accent),localStorage.setItem("dark-accent",N.dark_accent)),N.light_style&&(u(N.light_style),localStorage.setItem("light-style",N.light_style)),N.light_background&&(p(N.light_background),localStorage.setItem("light-background",N.light_background)),N.light_accent&&(y(N.light_accent),localStorage.setItem("light-accent",N.light_accent))}).catch(()=>{})},[]),w.useEffect(()=>{const N=document.documentElement;N.classList.remove("dark","style-classic","style-glow","style-vibrant","bg-neutral","bg-warm","bg-cool","bg-oled","bg-slate","bg-forest","accent-green","accent-teal","accent-blue","accent-orange","accent-purple","accent-red"),e==="dark"?(N.classList.add("dark"),N.classList.add(`style-${r}`),N.classList.add(`bg-${s}`),N.classList.add(`accent-${l}`)):(N.classList.add(`style-${d}`),N.classList.add(`bg-${m}`),N.classList.add(`accent-${f}`)),localStorage.setItem("theme-mode",e),localStorage.removeItem("theme")},[e,r,s,l,d,m,f]);const x=()=>n(N=>N==="dark"?"light":"dark"),b=N=>n(N),v=N=>{a(N),localStorage.setItem("dark-style",N),be.updateSettings({dark_style:N}).catch(()=>{})},_=N=>{o(N),localStorage.setItem("dark-background",N),be.updateSettings({dark_background:N}).catch(()=>{})},k=N=>{c(N),localStorage.setItem("dark-accent",N),be.updateSettings({dark_accent:N}).catch(()=>{})},P=N=>{u(N),localStorage.setItem("light-style",N),be.updateSettings({light_style:N}).catch(()=>{})},C=N=>{p(N),localStorage.setItem("light-background",N),be.updateSettings({light_background:N}).catch(()=>{})},T=N=>{y(N),localStorage.setItem("light-accent",N),be.updateSettings({light_accent:N}).catch(()=>{})};return i.jsx(iX.Provider,{value:{mode:e,darkStyle:r,darkBackground:s,darkAccent:l,lightStyle:d,lightBackground:m,lightAccent:f,toggleMode:x,setMode:b,setDarkStyle:v,setDarkBackground:_,setDarkAccent:k,setLightStyle:P,setLightBackground:C,setLightAccent:T},children:t})}function bf(){const t=w.useContext(iX);if(!t)throw new Error("useTheme must be used within ThemeProvider");return t}function Tt({children:t,className:e="",onClick:n,onContextMenu:r,...a}){return i.jsx("div",{className:`bg-bambu-dark-secondary rounded-xl border border-bambu-dark-tertiary card-shadow ${e}`,onClick:n,onContextMenu:r,...a,children:t})}function Wn({children:t,className:e=""}){return i.jsx("div",{className:`px-6 py-4 border-b border-bambu-dark-tertiary ${e}`,children:t})}function Pt({children:t,className:e=""}){return i.jsx("div",{className:`p-6 ${e}`,children:t})}function nbe(t,e,n){return[{category:"Navigation",items:t?t.slice(0,9).map((a,s)=>({keys:[String(s+1)],description:a.type==="external"?`Open ${a.label}`:`Go to ${a.labelKey?n(a.labelKey):a.label}`,isExternal:a.type==="external"})):e?e.map((a,s)=>({keys:[String(s+1)],description:`Go to ${n(a.labelKey)}`,isExternal:!1})):[{keys:["1"],description:"Go to Printers",isExternal:!1},{keys:["2"],description:"Go to Archives",isExternal:!1},{keys:["3"],description:"Go to Queue",isExternal:!1},{keys:["4"],description:"Go to Statistics",isExternal:!1},{keys:["5"],description:"Go to Cloud Profiles",isExternal:!1},{keys:["6"],description:"Go to Settings",isExternal:!1}]},{category:"Archives",items:[{keys:["/"],description:"Focus search",isExternal:!1},{keys:["U"],description:"Open upload modal",isExternal:!1},{keys:["Esc"],description:"Clear selection / blur input",isExternal:!1},{keys:["Right-click"],description:"Context menu on cards",isExternal:!1}]},{category:"K-Profiles",items:[{keys:["R"],description:"Refresh profiles",isExternal:!1},{keys:["N"],description:"New profile",isExternal:!1},{keys:["Esc"],description:"Exit selection mode",isExternal:!1}]},{category:"General",items:[{keys:["?"],description:"Show this help",isExternal:!1}]}]}function i8({children:t}){return i.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 rbe({onClose:t,navItems:e,sidebarItems:n}){const{t:r}=Mt(),a=nbe(n,e,r);return w.useEffect(()=>{const s=o=>{o.key==="Escape"&&t()};return window.addEventListener("keydown",s),()=>window.removeEventListener("keydown",s)},[t]),i.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",onClick:t,children:i.jsx(Tt,{className:"w-full max-w-md",onClick:s=>s.stopPropagation(),children:i.jsxs(Pt,{className:"p-0",children:[i.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-bambu-dark-tertiary",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(ND,{className:"w-5 h-5 text-bambu-green"}),i.jsx("h2",{className:"text-xl font-semibold text-white",children:"Keyboard Shortcuts"})]}),i.jsx("button",{onClick:t,className:"text-bambu-gray hover:text-white transition-colors",children:i.jsx(zt,{className:"w-5 h-5"})})]}),i.jsx("div",{className:"p-4 space-y-6 max-h-[60vh] overflow-y-auto",children:a.map(s=>i.jsxs("div",{children:[i.jsx("h3",{className:"text-sm font-medium text-bambu-gray mb-3",children:s.category}),i.jsx("div",{className:"space-y-2",children:s.items.map(o=>i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("span",{className:"text-white text-sm flex items-center gap-1.5",children:[o.description,o.isExternal&&i.jsx(ei,{className:"w-3 h-3 text-bambu-gray"})]}),i.jsx("div",{className:"flex gap-1",children:o.keys.map(l=>i.jsx(i8,{children:l},l))})]},o.description))})]},s.category))}),i.jsx("div",{className:"p-4 border-t border-bambu-dark-tertiary",children:i.jsxs("p",{className:"text-xs text-bambu-gray text-center",children:["Press ",i.jsx(i8,{children:"Esc"})," or click outside to close"]})})]})})})}function Fe({variant:t="primary",size:e="md",className:n="",children:r,...a}){const s="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",o={primary:"bg-bambu-green hover:bg-bambu-green-light text-white focus:ring-bambu-green",secondary:"bg-bambu-dark-tertiary hover:bg-bambu-gray-dark text-white focus:ring-bambu-gray",danger:"bg-red-600 hover:bg-red-700 text-white focus:ring-red-500",ghost:"bg-transparent hover:bg-bambu-dark-tertiary text-bambu-gray-light hover:text-white"},l={sm:"px-3 py-1.5 text-sm gap-1.5 min-h-[44px] md:min-h-0",md:"px-4 py-2 text-sm gap-2 min-h-[44px] md:min-h-0",lg:"px-6 py-3 text-base gap-2 min-h-[48px] md:min-h-0"};return i.jsx("button",{className:`${s} ${o[t]} ${l[e]} ${n}`,...a,children:r})}function Nn({title:t,message:e,confirmText:n,cancelText:r,cancelVariant:a,cardClassName:s,variant:o="default",isLoading:l=!1,loadingText:c,onConfirm:d,onCancel:u}){const{t:m}=Mt(),p=n??m("common.confirm"),f=r??m("common.cancel"),y=c??m("common.loading");w.useEffect(()=>{const v=_=>{_.key==="Escape"&&!l&&u()};return window.addEventListener("keydown",v),()=>window.removeEventListener("keydown",v)},[u,l]);const b={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"}}[o];return i.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",onClick:l?void 0:u,children:i.jsx(Tt,{className:`w-full max-w-md ${s??""}`,onClick:v=>v.stopPropagation(),children:i.jsxs(Pt,{className:"p-6",children:[i.jsxs("div",{className:"flex items-start gap-4",children:[i.jsx("div",{className:`p-2 rounded-full bg-bambu-dark ${b.icon}`,children:i.jsx(En,{className:"w-6 h-6"})}),i.jsxs("div",{className:"flex-1",children:[i.jsx("h3",{className:"text-lg font-semibold text-white mb-2",children:t}),i.jsx("p",{className:"text-bambu-gray text-sm",children:e})]})]}),i.jsxs("div",{className:"flex gap-3 mt-6",children:[i.jsx(Fe,{variant:a??"secondary",onClick:u,className:"flex-1",disabled:l,children:f}),i.jsx(Fe,{onClick:d,className:`flex-1 ${b.button}`,disabled:l,children:l?i.jsxs(i.Fragment,{children:[i.jsx(ct,{className:"w-4 h-4 mr-2 animate-spin"}),y]}):p})]})]})})})}function ibe({plug:t}){const e=tn(),[n,r]=w.useState(null),{data:a,isLoading:s}=Je({queryKey:["smart-plug-status",t.id],queryFn:()=>be.getSmartPlugStatus(t.id),refetchInterval:1e4}),o=ut({mutationFn:f=>be.controlSmartPlug(t.id,f),onSuccess:()=>{e.invalidateQueries({queryKey:["smart-plug-status",t.id]})}}),l=a?.state==="ON",c=t.plug_type==="mqtt"&&a?.energy?.power!==null&&a?.energy?.power!==void 0,d=(a?.reachable??!1)||c,u=o.isPending,m=t.plug_type==="mqtt",p=()=>{n&&(o.mutate(n),r(null))};return i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"flex items-center justify-between py-2 px-3 hover:bg-bambu-dark-tertiary rounded-lg transition-colors",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("div",{className:`p-1.5 rounded ${m?d?"bg-teal-500/20":"bg-red-500/20":d?l?"bg-bambu-green/20":"bg-bambu-dark":"bg-red-500/20"}`,children:m?i.jsx(KF,{className:`w-4 h-4 ${d?"text-teal-400":"text-red-400"}`}):i.jsx(fl,{className:`w-4 h-4 ${d?l?"text-bambu-green":"text-bambu-gray":"text-red-400"}`})}),i.jsxs("div",{children:[i.jsx("p",{className:"text-sm text-white font-medium",children:t.name}),i.jsx("div",{className:"flex items-center gap-1 text-xs",children:s?i.jsx(ct,{className:"w-3 h-3 text-bambu-gray animate-spin"}):m?d?i.jsxs(i.Fragment,{children:[i.jsx(rc,{className:"w-3 h-3 text-teal-400"}),i.jsxs("span",{className:"text-teal-400",children:[Math.round(a?.energy?.power??0),"W"]}),i.jsx("span",{className:"text-bambu-gray mx-1",children:"|"}),i.jsx(tc,{className:"w-3 h-3 text-bambu-gray"}),i.jsx("span",{className:"text-bambu-gray",children:"Monitor"})]}):i.jsxs(i.Fragment,{children:[i.jsx(rh,{className:"w-3 h-3 text-status-error"}),i.jsx("span",{className:"text-status-error",children:"Waiting"})]}):d?i.jsxs(i.Fragment,{children:[i.jsx(hb,{className:"w-3 h-3 text-status-ok"}),i.jsx("span",{className:l?"text-status-ok":"text-bambu-gray",children:a?.state||"Unknown"}),a?.energy?.power!==null&&a?.energy?.power!==void 0&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"text-bambu-gray mx-1",children:"|"}),i.jsx(rc,{className:"w-3 h-3 text-yellow-400"}),i.jsxs("span",{className:"text-yellow-400",children:[Math.round(a.energy.power),"W"]})]})]}):i.jsxs(i.Fragment,{children:[i.jsx(rh,{className:"w-3 h-3 text-status-error"}),i.jsx("span",{className:"text-status-error",children:"Offline"})]})})]})]}),!m&&i.jsxs("div",{className:"flex gap-1",children:[i.jsx("button",{onClick:()=>r("on"),disabled:!d||u,className:`p-1.5 rounded transition-colors ${l?"bg-bambu-green text-white":"bg-bambu-dark text-bambu-gray hover:text-white"} disabled:opacity-50 disabled:cursor-not-allowed`,title:"Turn On",children:u?i.jsx(ct,{className:"w-4 h-4 animate-spin"}):i.jsx(wu,{className:"w-4 h-4"})}),i.jsx("button",{onClick:()=>r("off"),disabled:!d||u,className:`p-1.5 rounded transition-colors ${!l&&d?"bg-bambu-dark-tertiary text-white":"bg-bambu-dark text-bambu-gray hover:text-white"} disabled:opacity-50 disabled:cursor-not-allowed`,title:"Turn Off",children:u?i.jsx(ct,{className:"w-4 h-4 animate-spin"}):i.jsx(fC,{className:"w-4 h-4"})})]})]}),n&&i.jsx(Nn,{title:`Turn ${n==="on"?"On":"Off"} Smart Plug`,message:`Are you sure you want to turn ${n==="on"?"on":"off"} "${t.name}"?`,confirmText:n==="on"?"Turn On":"Turn Off",variant:n==="off"?"warning":"default",onConfirm:p,onCancel:()=>r(null)})]})}function a8({onClose:t}){const{t:e}=Mt(),{data:n,isLoading:r}=Je({queryKey:["smart-plugs"],queryFn:be.getSmartPlugs}),a=n?.filter(s=>s.show_in_switchbar)||[];return i.jsxs("div",{className:"absolute bottom-full left-0 mb-2 w-72 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-xl shadow-xl z-50",onMouseLeave:t,children:[i.jsx("div",{className:"px-4 py-3 border-b border-bambu-dark-tertiary",children:i.jsxs("h3",{className:"text-sm font-semibold text-white flex items-center gap-2",children:[i.jsx(fl,{className:"w-4 h-4 text-bambu-green"}),"Smart Switches"]})}),i.jsx("div",{className:"p-2 max-h-80 overflow-y-auto",children:r?i.jsx("div",{className:"flex items-center justify-center py-8",children:i.jsx(ct,{className:"w-6 h-6 text-bambu-gray animate-spin"})}):a.length===0?i.jsxs("div",{className:"text-center py-6 px-4",children:[i.jsx(fl,{className:"w-8 h-8 text-bambu-gray mx-auto mb-2"}),i.jsx("p",{className:"text-sm text-bambu-gray",children:e("smartPlugs.noSwitchesInSwitchbar")}),i.jsx("p",{className:"text-xs text-bambu-gray mt-1",children:e("smartPlugs.enableSwitchbarHint")})]}):i.jsx("div",{className:"space-y-1",children:a.map(s=>i.jsx(ibe,{plug:s},s.id))})})]})}const aX=[{name:"globe",icon:$m},{name:"link",icon:dx},{name:"external-link",icon:ei},{name:"book",icon:Fme},{name:"file-text",icon:Es},{name:"home",icon:D0},{name:"star",icon:qp},{name:"heart",icon:jpe},{name:"bookmark",icon:Ome},{name:"shopping-cart",icon:QY},{name:"music",icon:PD},{name:"video",icon:QF},{name:"image",icon:ou},{name:"camera",icon:Mb},{name:"map",icon:rfe},{name:"compass",icon:jhe},{name:"coffee",icon:khe},{name:"gift",icon:xpe},{name:"wrench",icon:Vp},{name:"zap",icon:rc},{name:"cloud",icon:lx},{name:"database",icon:Ic},{name:"folder",icon:GY},{name:"mail",icon:Lv},{name:"phone",icon:Tfe},{name:"user",icon:du},{name:"users",icon:Sm},{name:"server",icon:ep},{name:"terminal",icon:tX},{name:"code",icon:qY}];function yC(t){return aX.find(n=>n.name===t)?.icon||dx}function abe({value:t,onChange:e}){const[n,r]=w.useState(!1),a=yC(t);return i.jsxs("div",{className:"relative",children:[i.jsxs("button",{type:"button",onClick:()=>r(!n),className:"flex items-center gap-2 px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white hover:border-bambu-gray focus:border-bambu-green focus:outline-none w-full",children:[i.jsx(a,{className:"w-5 h-5"}),i.jsx("span",{className:"text-sm text-bambu-gray flex-1 text-left",children:t})]}),n&&i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>r(!1)}),i.jsx("div",{className:"absolute z-50 mt-1 w-full max-h-64 overflow-y-auto bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg shadow-lg",children:i.jsx("div",{className:"grid grid-cols-5 gap-1 p-2",children:aX.map(({name:s,icon:o})=>i.jsx("button",{type:"button",onClick:()=>{e(s),r(!1)},className:`p-2 rounded-lg transition-colors flex items-center justify-center ${t===s?"bg-bambu-green text-white":"hover:bg-bambu-dark-tertiary text-bambu-gray hover:text-white"}`,title:s,children:i.jsx(o,{className:"w-5 h-5"})},s))})})]})]})}const s8=1144;function sbe(){const[t,e]=w.useState(()=>typeof window<"u"?window.innerWidth<s8:!1);return w.useEffect(()=>{const n=window.matchMedia(`(max-width: ${s8-1}px)`),r=a=>{e(a.matches)};return e(n.matches),n.addEventListener("change",r),()=>n.removeEventListener("change",r)},[]),t}const sX=w.createContext(void 0);function obe({children:t}){const[e,n]=w.useState(null),[r,a]=w.useState(!1),[s,o]=w.useState(!1),[l,c]=w.useState(!0),d=w.useRef(!1),u=w.useRef(!0),m=async()=>{try{const T=new URLSearchParams(window.location.search),N=T.get("token");if(N){Yg(N),T.delete("token");const A=T.toString(),D=window.location.pathname+(A?`?${A}`:"")+window.location.hash;window.history.replaceState({},"",D)}const R=await be.getAuthStatus();if(!u.current)return;if(a(R.auth_enabled),o(R.requires_setup),R.auth_enabled)if(uu())try{const D=await be.getCurrentUser();if(!u.current)return;n(D)}catch{if(Yg(null),!u.current)return;n(null)}else n(null);else n(null)}catch{if(!u.current)return;a(!1),n(null)}finally{u.current&&c(!1)}};w.useEffect(()=>(u.current=!0,m(),()=>{u.current=!1}),[]),w.useEffect(()=>{if(!l&&s&&!r){const T=window.location.pathname;T!=="/setup"&&!T.startsWith("/camera/")&&!d.current&&(d.current=!0,window.location.href="/setup")}else s||(d.current=!1)},[l,s,r]);const p=async(T,N)=>{const R=await be.login({username:T,password:N});Yg(R.access_token),await m()},f=()=>{Yg(null),n(null),be.logout().catch(()=>{}),window.location.href="/login"},y=async()=>{if(r&&uu())try{const T=await be.getCurrentUser();u.current&&n(T)}catch{Yg(null),u.current&&n(null)}},x=async()=>{await m()},b=w.useMemo(()=>new Set(e?.permissions??[]),[e?.permissions]),v=w.useMemo(()=>r?e?.is_admin??!1:!0,[r,e?.is_admin]),_=w.useCallback(T=>!r||v?!0:b.has(T),[r,v,b]),k=w.useCallback((...T)=>!r||v?!0:T.some(N=>b.has(N)),[r,v,b]),P=w.useCallback((...T)=>!r||v?!0:T.every(N=>b.has(N)),[r,v,b]),C=w.useCallback((T,N,R)=>{if(!r||v)return!0;const A=`${T}:${N}_all`,D=`${T}:${N}_own`;return b.has(A)?!0:b.has(D)?R==null?!1:R===e?.id:!1},[r,v,b,e?.id]);return i.jsx(sX.Provider,{value:{user:e,authEnabled:r,requiresSetup:s,loading:l,isAdmin:v,login:p,logout:f,refreshUser:y,refreshAuth:x,hasPermission:_,hasAnyPermission:k,hasAllPermissions:P,canModify:C},children:t})}function Rr(){const t=w.useContext(sX);if(t===void 0)throw new Error("useAuth must be used within an AuthProvider");return t}function no(t){if(!Number.isFinite(t)||t<=0)return"0 B";const e=["B","KB","MB","GB","TB"],n=1024,r=Math.floor(Math.log(t)/Math.log(n)),a=t/Math.pow(n,r);return r===0?`${a} ${e[r]}`:`${a.toFixed(1)} ${e[r]}`}const oX=w.createContext(void 0);function bn(){const t=w.useContext(oX);if(!t)throw new Error("useToast must be used within a ToastProvider");return t}const o8={success:i.jsx(fr,{className:"w-5 h-5 text-green-400"}),error:i.jsx(qi,{className:"w-5 h-5 text-red-400"}),warning:i.jsx(Ii,{className:"w-5 h-5 text-yellow-400"}),info:i.jsx(js,{className:"w-5 h-5 text-blue-400"}),loading:i.jsx(ct,{className:"w-5 h-5 text-bambu-green animate-spin"})},lbe={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",loading:"bg-bambu-green/10 border-bambu-green/30"};function cbe({children:t}){const{t:e}=Mt(),[n,r]=w.useState([]),[a,s]=w.useState(!1),[o,l]=w.useState(new Set),c=w.useRef(new Map),d="background-dispatch",u=w.useRef(null);w.useEffect(()=>{const x=c.current;return()=>{x.forEach(b=>clearTimeout(b)),x.clear()}},[]);const m=w.useCallback((x,b="success")=>{const v=Math.random().toString(36).substr(2,9);r(k=>[...k,{id:v,message:x,type:b}]);const _=setTimeout(()=>{r(k=>k.filter(P=>P.id!==v)),c.current.delete(v)},3e3);c.current.set(v,_)},[]),p=w.useCallback((x,b,v="info")=>{r(_=>_.find(P=>P.id===x)?_.map(P=>P.id===x?{...P,message:b,type:v,persistent:!0}:P):[..._,{id:x,message:b,type:v,persistent:!0}])},[]),f=w.useCallback(x=>{const b=c.current.get(x);b&&(clearTimeout(b),c.current.delete(x)),r(v=>v.filter(_=>_.id!==x))},[]),y=w.useCallback(async x=>{l(b=>{const v=new Set(b);return v.add(x),v});try{const b=await be.cancelBackgroundDispatchJob(x);m(b.status==="cancelling"?e("backgroundDispatch.toast.cancellingUpload"):e("backgroundDispatch.toast.cancelled"),"info")}catch(b){const v=b instanceof Error?b.message:e("backgroundDispatch.toast.cancelFailed");m(v,"error")}finally{l(b=>{const v=new Set(b);return v.delete(x),v})}},[m,e]);return w.useEffect(()=>{const x=(_,k,P)=>{const C=_.findIndex(N=>N.jobId===k);if(C===-1)return[..._,{jobId:k,...P}];const T=[..._];return T[C]={...T[C],...P},T},b=_=>{switch(_){case"failed":return 0;case"processing":return 1;case"dispatched":return 2;case"completed":return 3;case"cancelled":return 4}},v=_=>{const k=_.detail||{},P=k.total??0,C=k.dispatched??0,T=k.processing??0,N=k.completed??0,R=k.failed??0,A=C+T>0,D=P>0&&N+R>=P&&!A,$=k.recent_event?.status;if($==="completed"&&N>0){const U=`first-complete:${N}:${R}`;if(u.current!==U){u.current=U;const G=P-N-R,L=G>0?e("backgroundDispatch.toast.printStartedRemaining",{completed:N,remaining:G}):R>0?e("backgroundDispatch.toast.completeWithFailures",{completed:N,failed:R}):e("backgroundDispatch.toast.completeSuccess",{completed:N});r(J=>{const ue={id:d,message:L,type:R>0?"warning":"success",persistent:!0};return J.find(ge=>ge.id===d)?J.map(ge=>ge.id===d?ue:ge):[...J,ue]});const te=c.current.get(d);te&&clearTimeout(te);const re=setTimeout(()=>{r(J=>J.filter(ue=>ue.id!==d)),c.current.delete(d),u.current=null},3e3);c.current.set(d,re)}return}if(A){u.current=null,r(U=>{const L=U.find(le=>le.id===d)?.dispatchData?.jobs||[],te=(k.dispatched_jobs||[]).map(le=>({jobId:le.job_id,sourceName:le.source_name||e("backgroundDispatch.unknownFile"),printerName:le.printer_name||e("backgroundDispatch.unknownPrinter"),status:"dispatched"})),J=(k.active_jobs&&k.active_jobs.length>0?k.active_jobs:k.active_job?.job_id?[k.active_job]:[]).filter(le=>typeof le.job_id=="number").map(le=>({jobId:le.job_id,sourceName:le.source_name||e("backgroundDispatch.unknownFile"),printerName:le.printer_name||e("backgroundDispatch.unknownPrinter"),status:"processing",message:le.message,uploadBytes:le.upload_bytes,uploadTotalBytes:le.upload_total_bytes,uploadProgressPct:le.upload_progress_pct})),ue=new Set([...te,...J].map(le=>le.jobId)),me=L.filter(le=>!ue.has(le.jobId)&&["completed","failed","cancelled"].includes(le.status));let ge=[...te,...J,...me];if(k.recent_event?.job_id&&k.recent_event?.status){const le=k.recent_event.status,pe=le==="cancelled"?"cancelled":le==="cancelling"?"processing":le,Ce=k.recent_event.source_name||e("backgroundDispatch.unknownFile"),q=k.recent_event.printer_name||e("backgroundDispatch.unknownPrinter");ge=x(ge,k.recent_event.job_id,{status:pe,sourceName:Ce,printerName:q,message:k.recent_event.message})}J.forEach(le=>{ge=x(ge,le.jobId,{status:"processing",sourceName:le.sourceName,printerName:le.printerName,message:le.message,uploadBytes:le.uploadBytes,uploadTotalBytes:le.uploadTotalBytes,uploadProgressPct:le.uploadProgressPct})});const X={total:P,dispatched:C,processing:T,completed:N,failed:R,jobs:[...ge].sort((le,pe)=>{const Ce=b(le.status)-b(pe.status);return Ce!==0?Ce:le.jobId-pe.jobId})};return U.find(le=>le.id===d)?U.map(le=>le.id===d?{...le,message:e("backgroundDispatch.startingPrints"),type:"loading",persistent:!0,dispatchData:X}:le):[...U,{id:d,message:e("backgroundDispatch.startingPrints"),type:"loading",persistent:!0,dispatchData:X}]});return}if(D){const U=`${N}:${R}`;if(u.current===U)return;u.current=U;const G=R>0?e("backgroundDispatch.toast.completeWithFailures",{completed:N,failed:R}):e("backgroundDispatch.toast.completeSuccess",{completed:N});r(re=>{const J={id:d,message:G,type:R>0?"warning":"success",persistent:!0};return re.find(me=>me.id===d)?re.map(me=>me.id===d?J:me):[...re,J]});const L=c.current.get(d);L&&clearTimeout(L);const te=setTimeout(()=>{r(re=>re.filter(J=>J.id!==d)),c.current.delete(d),u.current=null},3e3);c.current.set(d,te);return}if(!A&&$&&["cancelled","failed","completed","idle"].includes($)&&(r(U=>U.filter(G=>G.id!==d)),u.current=null),k.recent_event?.status==="idle"&&!A&&(r(U=>U.filter(G=>G.id!==d)),u.current=null),A||l(new Set),k.dispatched_jobs){const U=new Set(k.dispatched_jobs.map(G=>G.job_id));l(G=>{const L=new Set;return G.forEach(te=>{U.has(te)&&L.add(te)}),L})}};return window.addEventListener("background-dispatch",v),()=>window.removeEventListener("background-dispatch",v)},[e]),i.jsxs(oX.Provider,{value:{showToast:m,showPersistentToast:p,dismissToast:f},children:[t,i.jsx("div",{className:"fixed bottom-4 right-20 z-[60] flex flex-col items-end gap-2",children:n.map(x=>i.jsx("div",{className:`rounded-lg border shadow-lg backdrop-blur-sm animate-slide-in ${lbe[x.type]} ${x.dispatchData?"w-[420px] p-3":"flex items-center gap-3 px-4 py-3"}`,children:x.dispatchData?i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"flex items-start justify-between gap-3",children:[i.jsxs("div",{className:"flex items-start gap-2",children:[o8[x.type],i.jsxs("div",{children:[i.jsx("p",{className:"text-white text-sm font-medium",children:e("backgroundDispatch.startingPrints")}),i.jsx("p",{className:"text-xs text-bambu-gray mt-0.5",children:e("backgroundDispatch.progressSummary",{complete:x.dispatchData.completed+x.dispatchData.failed,total:x.dispatchData.total,dispatched:x.dispatchData.dispatched,processing:x.dispatchData.processing})})]})]}),i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx("button",{onClick:()=>s(b=>!b),className:"text-bambu-gray hover:text-white transition-colors","aria-label":e(a?"backgroundDispatch.expandDetails":"backgroundDispatch.collapseDetails"),children:a?i.jsx(vl,{className:"w-4 h-4"}):i.jsx(In,{className:"w-4 h-4"})}),i.jsx("button",{onClick:()=>f(x.id),className:"text-bambu-gray hover:text-white transition-colors","aria-label":e("backgroundDispatch.dismissToast"),children:i.jsx(zt,{className:"w-4 h-4"})})]})]}),!a&&i.jsx("div",{className:"mt-3 space-y-2 max-h-64 overflow-y-auto pr-1",children:x.dispatchData.jobs.map(b=>{const v={dispatched:15,processing:60,completed:100,failed:100,cancelled:100},_={dispatched:"bg-bambu-gray/60",processing:"bg-bambu-green",completed:"bg-green-500",failed:"bg-red-500",cancelled:"bg-yellow-500"};return i.jsxs("div",{className:"rounded border border-white/10 bg-black/15 p-2",children:[i.jsxs("div",{className:"flex items-center justify-between gap-2",children:[i.jsx("span",{className:"text-xs text-white truncate",title:b.sourceName,children:b.sourceName}),i.jsxs("div",{className:"flex items-center gap-2",children:[(b.status==="dispatched"||b.status==="processing")&&i.jsx("button",{onClick:()=>{y(b.jobId)},disabled:o.has(b.jobId),className:"text-[11px] text-red-300 hover:text-red-200 disabled:opacity-50 disabled:cursor-not-allowed",title:e("backgroundDispatch.cancelDispatchJob"),children:o.has(b.jobId)?e("backgroundDispatch.cancelling"):e("backgroundDispatch.cancel")}),i.jsx("span",{className:"text-[11px] uppercase tracking-wide text-bambu-gray",children:e(`backgroundDispatch.status.${b.status}`)})]})]}),i.jsx("div",{className:"text-[11px] text-bambu-gray truncate",title:b.printerName,children:b.printerName}),b.message&&i.jsx("div",{className:"text-[11px] text-bambu-gray truncate",title:b.message,children:b.message}),b.status==="processing"&&typeof b.uploadBytes=="number"&&typeof b.uploadTotalBytes=="number"&&b.uploadTotalBytes>0&&i.jsxs("div",{className:"text-[11px] text-bambu-gray truncate",children:[no(b.uploadBytes)," / ",no(b.uploadTotalBytes),typeof b.uploadProgressPct=="number"?` (${b.uploadProgressPct.toFixed(1)}%)`:""]}),i.jsx("div",{className:"mt-1 h-1.5 w-full rounded bg-white/10 overflow-hidden",children:i.jsx("div",{className:`h-full ${_[b.status]} transition-all duration-300`,style:{width:`${b.status==="processing"&&typeof b.uploadProgressPct=="number"?Math.max(0,Math.min(100,b.uploadProgressPct)):v[b.status]}%`}})})]},b.jobId)})})]}):i.jsxs(i.Fragment,{children:[o8[x.type],i.jsx("span",{className:"text-white text-sm",children:x.message}),i.jsx("button",{onClick:()=>f(x.id),className:"ml-2 text-bambu-gray hover:text-white transition-colors",children:i.jsx(zt,{className:"w-4 h-4"})})]})},x.id))})]})}function dbe(t="system"){const e=t==="system"?lX():t;switch(e){case"us":return"MM/DD/YYYY";case"eu":return"DD/MM/YYYY";case"iso":return"YYYY-MM-DD";default:return e}}function ube(t="system"){switch(t){case"12h":return"HH:MM AM/PM";case"24h":return"HH:MM";default:{const n=new Date(2e3,0,1,14,30).toLocaleTimeString();return n.includes("PM")||n.includes("AM")?"HH:MM AM/PM":"HH:MM"}}}function ED(t,e="system"){const n=String(t.getDate()).padStart(2,"0"),r=String(t.getMonth()+1).padStart(2,"0"),a=t.getFullYear();switch(e){case"us":return`${r}/${n}/${a}`;case"eu":return`${n}/${r}/${a}`;case"iso":return`${a}-${r}-${n}`;default:return t.toLocaleDateString()}}function l8(t,e="system"){const n=t.getHours(),r=String(t.getMinutes()).padStart(2,"0");switch(e){case"12h":{const a=n%12||12,s=n<12?"AM":"PM";return`${a}:${r} ${s}`}case"24h":return`${String(n).padStart(2,"0")}:${r}`;default:return t.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}}function mbe(t){for(const e of["/",".","-"]){const n=t.split(e);if(n.length===3)return n}return null}function lX(){const t=new Date(2e3,11,31).toLocaleDateString();return t.startsWith("12")?"us":t.startsWith("31")?"eu":"iso"}function hbe(t,e="system"){if(!t)return null;const n=mbe(t);if(!n)return null;const r=e==="system"?lX():e;let a,s,o;switch(r){case"us":s=parseInt(n[0],10),a=parseInt(n[1],10),o=parseInt(n[2],10);break;case"eu":a=parseInt(n[0],10),s=parseInt(n[1],10),o=parseInt(n[2],10);break;case"iso":o=parseInt(n[0],10),s=parseInt(n[1],10),a=parseInt(n[2],10);break}return isNaN(a)||isNaN(s)||isNaN(o)||s<1||s>12||a<1||a>31||o<1900||o>2100?null:new Date(o,s-1,a)}function pbe(t){if(!t)return null;const n=t.trim().match(/^(\d{1,2}):(\d{2})\s*(AM|PM)?$/i);if(!n)return null;let r=parseInt(n[1],10);const a=parseInt(n[2],10),s=n[3]?.toUpperCase();return s==="PM"&&r<12&&(r+=12),s==="AM"&&r===12&&(r=0),r<0||r>23||a<0||a>59?null:{hours:r,minutes:a}}function jD(t){const e=t.getFullYear(),n=String(t.getMonth()+1).padStart(2,"0"),r=String(t.getDate()).padStart(2,"0"),a=String(t.getHours()).padStart(2,"0"),s=String(t.getMinutes()).padStart(2,"0");return`${e}-${n}-${r}T${a}:${s}`}function Iv(t,e="system"){return e==="12h"?t.hour12=!0:e==="24h"&&(t.hour12=!1),t}function Jn(t){return t?t.endsWith("Z")||/[+-]\d{2}:\d{2}$/.test(t)?new Date(t):new Date(t+"Z"):null}function Gp(t,e){const n=Jn(t);if(!n)return"";const r={year:"numeric",month:"short",day:"numeric"};return n.toLocaleDateString(void 0,e??r)}function Wp(t,e="system",n){const r=Jn(t);if(!r)return"";const s=Iv(n??{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"},e);return r.toLocaleString(void 0,s)}function cX(t,e="system",n){const a=Iv({...{hour:"2-digit",minute:"2-digit"},...n},e);return t.toLocaleTimeString([],a)}function eL(t,e="system",n){const r=new Date,a=new Date(r.getTime()+t*60*1e3),s=new Date(r);s.setHours(0,0,0,0);const o=new Date(a);o.setHours(0,0,0,0);const l=Iv({hour:"2-digit",minute:"2-digit"},e),c=a.toLocaleTimeString([],l),d=Math.floor((o.getTime()-s.getTime())/864e5);return d===0?c:d===1?`${n?.("common.tomorrow")??"Tomorrow"} ${c}`:`${a.toLocaleDateString([],{weekday:"short"})} ${c}`}function Ms(t){if(t==null||t<0)return"--";const e=Math.floor(t/3600),n=Math.floor(t%3600/60);return e>0?`${e}h ${n}m`:`${n}m`}function zv(t,e="system",n){if(!t)return n?.("time.unknown")??"-";const r=Jn(t);if(!r)return n?.("time.unknown")??"-";const a=new Date,s=r.getTime()-a.getTime(),o=s<0,l=Math.abs(s),c=Math.floor(l/6e4),d=Math.floor(l/36e5),u=Math.floor(l/864e5);return c<1?o?n?.("time.justNow")??"Just now":n?.("time.now")??"Now":d<1?o?n?.("time.minsAgo",{count:c})??`${c}m ago`:n?.("time.inMins",{count:c})??`in ${c}m`:u<1?o?n?.("time.hoursAgo",{count:d})??`${d}h ago`:n?.("time.inHours",{count:d})??`in ${d}h`:u<7?o?n?.("time.daysAgo",{count:u})??`${u}d ago`:n?.("time.inDays",{count:u})??`in ${u}d`:Wp(t,e)}function hm(t){const e=Math.floor(t/60),n=Math.floor(t%60);return`${e}:${n.toString().padStart(2,"0")}`}function fbe(t){if(t<1)return`${Math.round(t*60)}m`;const e=Math.floor(t),n=Math.round((t-e)*60);return n>0?`${e}h ${n}m`:`${e}h`}const gbe=30,iM=1920,bbe=.7;function xbe(t){return new Promise((e,n)=>{const r=new Image;r.onload=()=>{let{width:a,height:s}=r;if(a>iM||s>iM){const d=iM/Math.max(a,s);a=Math.round(a*d),s=Math.round(s*d)}const o=document.createElement("canvas");o.width=a,o.height=s;const l=o.getContext("2d");if(!l){n(new Error("No canvas context"));return}l.drawImage(r,0,0,a,s);const c=o.toDataURL("image/jpeg",bbe);e(c.replace(/^data:[^;]+;base64,/,""))},r.onerror=n,r.src=URL.createObjectURL(t)})}function ybe(){const{t}=Mt(),[e,n]=w.useState(!1),[r,a]=w.useState("form"),[s,o]=w.useState(""),[l,c]=w.useState(""),[d,u]=w.useState(null),[m,p]=w.useState(!1),[f,y]=w.useState(null),[x,b]=w.useState(null),[v,_]=w.useState(""),[k,P]=w.useState(0),C=w.useRef(null),T=w.useRef(null);w.useEffect(()=>{if(r!=="collecting")return;if(k<=0){a("submitting");return}const te=setTimeout(()=>P(re=>re-1),1e3);return()=>clearTimeout(te)},[r,k]);const N=()=>{n(!0),a("form"),o(""),c(""),u(null),y(null),b(null),_("")},R=()=>{n(!1)},A=w.useCallback(async te=>{if(te.type.startsWith("image/"))try{const re=await xbe(te);u(re)}catch{}},[]),D=w.useCallback(te=>{const re=te.clipboardData?.items;if(re){for(const J of re)if(J.type.startsWith("image/")){const ue=J.getAsFile();ue&&A(ue);break}}},[A]),$=w.useCallback(te=>{te.preventDefault(),p(!0)},[]),U=w.useCallback(te=>{te.preventDefault(),p(!1)},[]),G=w.useCallback(te=>{te.preventDefault(),p(!1);const re=te.dataTransfer.files?.[0];re&&A(re)},[A]),L=async()=>{if(s.trim()){P(gbe),a("collecting");try{const te=await ebe.submit({description:s.trim(),email:l.trim()||void 0,screenshot_base64:d||void 0,include_support_info:!0});te.success?(y(te.issue_url||null),b(te.issue_number||null),a("success")):(_(te.message),a("error"))}catch(te){_(te instanceof Error?te.message:t("bugReport.unexpectedError")),a("error")}}};return i.jsxs(i.Fragment,{children:[i.jsx("button",{onClick:N,className:"fixed bottom-4 right-4 z-40 w-12 h-12 rounded-full bg-red-500 hover:bg-red-600 text-white shadow-lg hover:shadow-xl transition-all duration-200 hover:scale-110 flex items-center justify-center",title:t("bugReport.title"),children:i.jsx(Ab,{className:"w-5 h-5"})}),e&&i.jsx("div",{id:"bug-report-modal",className:"fixed bottom-20 right-4 z-50 w-full max-w-md",onPaste:D,children:i.jsxs("div",{ref:C,className:"bg-white dark:bg-gray-800 rounded-lg shadow-2xl border border-gray-200 dark:border-gray-700 max-h-[80vh] overflow-y-auto",children:[i.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-700 sticky top-0 bg-white dark:bg-gray-800 z-10",children:[i.jsxs("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white flex items-center gap-2",children:[i.jsx(Ab,{className:"w-5 h-5 text-red-500"}),t("bugReport.title")]}),i.jsx("button",{onClick:R,className:"text-gray-400 hover:text-gray-600 dark:hover:text-gray-300",children:i.jsx(zt,{className:"w-5 h-5"})})]}),i.jsxs("div",{className:"p-4 space-y-4",children:[r==="form"&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{children:[i.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:[t("bugReport.description")," *"]}),i.jsx("textarea",{value:s,onChange:te=>o(te.target.value),placeholder:t("bugReport.descriptionPlaceholder"),rows:3,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-white placeholder-gray-400 focus:ring-2 focus:ring-blue-500 focus:border-transparent resize-vertical"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:t("bugReport.email")}),i.jsx("input",{type:"email",value:l,onChange:te=>c(te.target.value),placeholder:t("bugReport.emailPlaceholder"),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-white placeholder-gray-400 focus:ring-2 focus:ring-blue-500 focus:border-transparent"}),i.jsx("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:t("bugReport.emailPrivacy")})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:t("bugReport.screenshot")}),d?i.jsxs("div",{className:"relative",children:[i.jsx("img",{src:`data:image/jpeg;base64,${d}`,alt:t("bugReport.screenshot"),className:"w-full max-h-40 object-contain rounded-lg border border-gray-200 dark:border-gray-600"}),i.jsx("button",{onClick:()=>u(null),className:"absolute top-2 right-2 p-1 bg-red-500 hover:bg-red-600 text-white rounded-full shadow",title:t("common.delete"),children:i.jsx(Qt,{className:"w-3 h-3"})})]}):i.jsxs("button",{type:"button",onClick:()=>T.current?.click(),onDragOver:$,onDragLeave:U,onDrop:G,className:`w-full flex flex-col items-center gap-2 px-4 py-4 border-2 border-dashed rounded-lg transition-colors cursor-pointer ${m?"border-blue-500 bg-blue-50 dark:bg-blue-900/20 text-blue-500":"border-gray-300 dark:border-gray-600 text-gray-500 dark:text-gray-400 hover:border-gray-400 dark:hover:border-gray-500 hover:text-gray-600 dark:hover:text-gray-300"}`,children:[i.jsx(Si,{className:"w-5 h-5"}),i.jsx("span",{className:"text-sm",children:t("bugReport.uploadOrPaste")})]}),i.jsx("input",{ref:T,type:"file",accept:"image/*",className:"hidden",onChange:te=>{const re=te.target.files?.[0];re&&A(re),te.target.value=""}})]}),i.jsxs("details",{className:"text-xs bg-amber-50 dark:bg-amber-900/20 border border-amber-200 dark:border-amber-800 rounded-lg p-3",children:[i.jsx("summary",{className:"cursor-pointer font-medium text-amber-700 dark:text-amber-300 hover:text-amber-800 dark:hover:text-amber-200",children:t("bugReport.dataCollectedSummary")}),i.jsxs("div",{className:"mt-2 space-y-2 pl-2 border-l-2 border-amber-300 dark:border-amber-700 text-amber-800 dark:text-amber-200",children:[i.jsx("p",{className:"font-medium",children:t("bugReport.dataIncluded")}),i.jsx("p",{children:t("bugReport.dataIncludedList")}),i.jsx("p",{className:"font-medium",children:t("bugReport.dataNeverIncluded")}),i.jsx("p",{children:t("bugReport.dataNeverIncludedList")})]})]}),i.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[i.jsx("button",{onClick:R,className:"px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 rounded-lg transition-colors",children:t("common.cancel")}),i.jsx("button",{onClick:L,disabled:!s.trim(),className:"px-4 py-2 text-sm font-medium text-white bg-red-500 hover:bg-red-600 disabled:opacity-50 disabled:cursor-not-allowed rounded-lg transition-colors",children:t("bugReport.submit")})]})]}),(r==="collecting"||r==="submitting")&&i.jsxs("div",{className:"flex flex-col items-center justify-center py-8 gap-3",children:[i.jsx(ct,{className:"w-8 h-8 animate-spin text-blue-500"}),r==="collecting"?i.jsxs(i.Fragment,{children:[i.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-white",children:t("bugReport.collectingLogs")}),i.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:t("bugReport.collectingLogsHint")}),k>0&&i.jsx("p",{className:"text-lg font-mono text-blue-500",children:t("bugReport.countdownSeconds",{seconds:k})})]}):i.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:t("bugReport.submitting")})]}),r==="success"&&i.jsxs("div",{className:"flex flex-col items-center justify-center py-8 gap-3",children:[i.jsx(fr,{className:"w-12 h-12 text-green-500"}),i.jsx("p",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:t("bugReport.thankYou")}),i.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:t("bugReport.submitted")}),f&&i.jsxs("a",{href:f,target:"_blank",rel:"noopener noreferrer",className:"text-sm text-blue-500 hover:text-blue-600 underline",children:[t("bugReport.viewIssue")," #",x]}),i.jsx("button",{onClick:R,className:"mt-4 px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 rounded-lg transition-colors",children:t("common.close")})]}),r==="error"&&i.jsxs("div",{className:"flex flex-col items-center justify-center py-8 gap-3",children:[i.jsx(Ii,{className:"w-12 h-12 text-red-500"}),i.jsx("p",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:t("bugReport.submitFailed")}),i.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 text-center",children:v}),i.jsxs("div",{className:"flex gap-2 mt-4",children:[i.jsx("button",{onClick:()=>a("form"),className:"px-4 py-2 text-sm font-medium text-white bg-red-500 hover:bg-red-600 rounded-lg transition-colors",children:t("bugReport.submit")}),i.jsx("button",{onClick:R,className:"px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 rounded-lg transition-colors",children:t("common.close")})]})]})]})]})})]})}const Uv=[{id:"printers",to:"/",icon:kr,labelKey:"nav.printers"},{id:"archives",to:"/archives",icon:Fs,labelKey:"nav.archives"},{id:"queue",to:"/queue",icon:Xr,labelKey:"nav.queue"},{id:"stats",to:"/stats",icon:Xme,labelKey:"nav.stats"},{id:"profiles",to:"/profiles",icon:lx,labelKey:"nav.profiles"},{id:"maintenance",to:"/maintenance",icon:Vp,labelKey:"nav.maintenance"},{id:"projects",to:"/projects",icon:fs,labelKey:"nav.projects"},{id:"inventory",to:"/inventory",icon:zhe,labelKey:"nav.inventory"},{id:"files",to:"/files",icon:nc,labelKey:"nav.files"},{id:"settings",to:"/settings",icon:bC,labelKey:"nav.settings"}];function vbe(){const t=localStorage.getItem("sidebarOrder");if(t)try{return JSON.parse(t)}catch{return Uv.map(e=>e.id)}return Uv.map(e=>e.id)}function wbe(t){localStorage.setItem("sidebarOrder",JSON.stringify(t))}function aM(t){return t.startsWith("ext-")}function dX(){return localStorage.getItem("defaultView")||"/"}function Sbe(t){localStorage.setItem("defaultView",t)}function _be(){const t=Ml(),e=Zc(),{mode:n,toggleMode:r}=bf(),{t:a}=Mt(),s=sbe(),{user:o,authEnabled:l,logout:c,hasPermission:d}=Rr(),{showToast:u}=bn(),[m,p]=w.useState(!1),[f,y]=w.useState({currentPassword:"",newPassword:"",confirmPassword:""}),[x,b]=w.useState(!1),[v,_]=w.useState(()=>localStorage.getItem("sidebarExpanded")!=="false"),[k,P]=w.useState(!1),[C,T]=w.useState(!1),[N,R]=w.useState(!1),[A,D]=w.useState(vbe),[$,U]=w.useState(null),[G,L]=w.useState(null),te=w.useRef(!1),[re,J]=w.useState(()=>sessionStorage.getItem("dismissedUpdateVersion")),[ue,me]=w.useState(null),{data:ge}=Je({queryKey:["version"],queryFn:be.getVersion,staleTime:1/0}),{data:X}=Je({queryKey:["settings"],queryFn:be.getSettings,staleTime:300*1e3}),{data:ie}=Je({queryKey:["updateCheck"],queryFn:be.checkForUpdates,enabled:X?.check_updates!==!1,staleTime:3600*1e3,refetchInterval:3600*1e3}),{data:le}=Je({queryKey:["external-links"],queryFn:be.getExternalLinks}),{data:pe}=Je({queryKey:["smart-plugs"],queryFn:be.getSmartPlugs,staleTime:30*1e3}),Ce=pe?.some(de=>de.show_in_switchbar)??!1,{data:q}=Je({queryKey:["debugLogging"],queryFn:pb.getDebugLoggingState,staleTime:60*1e3,refetchInterval:60*1e3}),{data:Z}=Je({queryKey:["developer-mode-warnings"],queryFn:be.getDeveloperModeWarnings,staleTime:10*1e3,refetchInterval:30*1e3,refetchOnWindowFocus:!0}),{data:j}=Je({queryKey:["queue","pending"],queryFn:()=>be.getQueue(void 0,"pending"),staleTime:5*1e3,refetchInterval:5*1e3,refetchOnWindowFocus:!0}),E=j?.length??0,{data:I}=Je({queryKey:["pending-uploads","count"],queryFn:Xg.getCount,staleTime:5*1e3,refetchInterval:5*1e3,refetchOnWindowFocus:!0}),W=I?.count??0,B=w.useMemo(()=>{const de=new Set;return j?.forEach(Ae=>{Ae.printer_id&&de.add(Ae.printer_id)}),Array.from(de)},[j]),z=gf({queries:B.map(de=>({queryKey:["printerStatus",de],queryFn:()=>be.getPrinterStatus(de),staleTime:30*1e3}))}).some(de=>{const Ae=de.data;return Ae?(Ae.state==="FINISH"||Ae.state==="FAILED")&&!Ae.plate_cleared:!1}),[V,ee]=w.useState(null);w.useEffect(()=>{if(!q?.enabled||!q.enabled_at){ee(null);return}const de=Jn(q.enabled_at)?.getTime()??Date.now(),Ae=()=>{ee(Math.floor((Date.now()-de)/1e3))};Ae();const _e=setInterval(Ae,1e3);return()=>clearInterval(_e)},[q?.enabled,q?.enabled_at]);const K=w.useMemo(()=>new Map(Uv.map(de=>[de.id,de])),[]),ne=w.useMemo(()=>new Map((le||[]).map(de=>[`ext-${de.id}`,de])),[le]),se=(()=>{const de=[],Ae=new Set,_e={archives:"archives:read",queue:"queue:read",stats:"stats:read",profiles:"kprofiles:read",maintenance:"maintenance:read",projects:"projects:read",inventory:"inventory:read",files:"library:read",settings:"settings:read"},ze=Be=>l&&Be in _e&&!d(_e[Be]);for(const Be of A)ze(Be)||(K.has(Be)||ne.has(Be))&&(de.push(Be),Ae.add(Be));for(const Be of Uv)ze(Be.id)||Ae.has(Be.id)||(de.push(Be.id),Ae.add(Be.id));for(const Be of le||[]){const Ue=`ext-${Be.id}`;Ae.has(Ue)||(de.push(Ue),Ae.add(Ue))}return de})(),ce=(de,Ae)=>{U(Ae),de.dataTransfer.effectAllowed="move",de.dataTransfer.setData("text/plain",Ae)},fe=(de,Ae)=>{de.preventDefault(),de.dataTransfer.dropEffect="move",L(Ae)},oe=()=>{L(null)},O=(de,Ae)=>{if(de.preventDefault(),$===null||$===Ae){U(null),L(null);return}const _e=[...se],ze=_e.indexOf($),Be=_e.indexOf(Ae);if(ze===-1||Be===-1){U(null),L(null);return}_e.splice(ze,1),_e.splice(Be,0,$),D(_e),wbe(_e),U(null),L(null)},F=()=>{U(null),L(null)},Q=ie?.update_available&&ie.latest_version&&ie.latest_version!==re,ve=()=>{ie?.latest_version&&(sessionStorage.setItem("dismissedUpdateVersion",ie.latest_version),J(ie.latest_version))};w.useEffect(()=>{if(!te.current&&e.pathname==="/"){const de=dX();de!=="/"&&(te.current=!0,t(de,{replace:!0}))}},[e.pathname,t]),w.useEffect(()=>{localStorage.setItem("sidebarExpanded",String(v))},[v]),w.useEffect(()=>{s&&P(!1)},[e.pathname,s]),w.useEffect(()=>{const de=Ae=>{if(!d("printers:control"))return;const _e=Ae.detail;me({printer_id:_e.printer_id,printer_name:_e.printer_name,message:_e.message})};return window.addEventListener("plate-not-empty",de),()=>window.removeEventListener("plate-not-empty",de)},[d]);const he=w.useCallback(de=>{const Ae=de.target;if(!(Ae.tagName==="INPUT"||Ae.tagName==="TEXTAREA"||Ae.isContentEditable)&&!de.metaKey&&!de.ctrlKey&&!de.altKey){const _e=parseInt(de.key);if(_e>=1&&_e<=se.length&&_e<=9){const ze=se[_e-1];if(de.preventDefault(),aM(ze)){const Be=ne.get(ze);if(Be?.open_in_new_tab)window.open(Be.url,"_blank","noopener,noreferrer");else{const Ue=ze.replace("ext-","");t(`/external/${Ue}`)}}else{const Be=K.get(ze);Be&&t(Be.to)}return}switch(de.key){case"?":de.preventDefault(),T(!0);break;case"Escape":T(!1);break}}},[t,se,K,ne]);return w.useEffect(()=>(document.addEventListener("keydown",he),()=>document.removeEventListener("keydown",he)),[he]),i.jsxs("div",{className:"flex min-h-screen",children:[s&&i.jsxs("header",{className:"fixed top-0 left-0 right-0 z-40 h-14 bg-bambu-dark-secondary border-b border-bambu-dark-tertiary flex items-center px-4",children:[i.jsx("button",{onClick:()=>P(!0),className:"p-2 -ml-2 rounded-lg hover:bg-bambu-dark-tertiary transition-colors","aria-label":"Open menu",children:i.jsx(dfe,{className:"w-6 h-6 text-white"})}),i.jsx("img",{src:n==="dark"?"/img/bambuddy_logo_dark_transparent.png":"/img/bambuddy_logo_light.png",alt:"Bambuddy",className:"h-8 ml-3"})]}),s&&k&&i.jsx("div",{className:"fixed inset-0 bg-black/60 z-40 transition-opacity",onClick:()=>P(!1)}),i.jsxs("aside",{className:`bg-bambu-dark-secondary border-r border-bambu-dark-tertiary flex flex-col transition-all duration-300 ${s?`fixed inset-y-0 left-0 z-50 w-72 transform ${k?"translate-x-0":"-translate-x-full"}`:`fixed inset-y-0 left-0 z-30 ${v?"w-64":"w-16"}`}`,children:[i.jsx("div",{className:`border-b border-bambu-dark-tertiary flex items-center justify-center ${s||v?"p-4":"p-2"}`,children:i.jsx("img",{src:n==="dark"?"/img/bambuddy_logo_dark_transparent.png":"/img/bambuddy_logo_light.png",alt:"Bambuddy",className:s||v?"h-16 w-auto":"h-8 w-8 object-cover object-left"})}),i.jsx("nav",{className:"flex-1 p-2",children:i.jsx("ul",{className:"space-y-2",children:se.map(de=>{if(aM(de)){const _e=ne.get(de);if(!_e)return null;const ze=_e.custom_icon?null:yC(_e.icon);return i.jsx("li",{draggable:!0,onDragStart:Be=>ce(Be,de),onDragOver:Be=>fe(Be,de),onDragLeave:oe,onDrop:Be=>O(Be,de),onDragEnd:F,className:`relative ${$===de?"opacity-50":""} ${G===de&&$!==de?"before:absolute before:left-0 before:right-0 before:top-0 before:h-0.5 before:bg-bambu-green":""}`,children:_e.open_in_new_tab?i.jsxs("a",{href:_e.url,target:"_blank",rel:"noopener noreferrer",className:`flex items-center ${s||v?"gap-3 px-4":"justify-center px-2"} py-3 rounded-lg transition-colors group text-bambu-gray-light hover:bg-bambu-dark-tertiary hover:text-white`,title:!s&&!v?_e.name:void 0,children:[v&&!s&&i.jsx(qm,{className:"w-4 h-4 flex-shrink-0 opacity-0 group-hover:opacity-50 cursor-grab active:cursor-grabbing -ml-1"}),_e.custom_icon?i.jsx("img",{src:`/api/v1/external-links/${_e.id}/icon`,alt:"",className:"w-5 h-5 flex-shrink-0"}):ze&&i.jsx(ze,{className:"w-5 h-5 flex-shrink-0"}),(s||v)&&i.jsx("span",{children:_e.name})]}):i.jsxs(rb,{to:`/external/${_e.id}`,className:({isActive:Be})=>`flex items-center ${s||v?"gap-3 px-4":"justify-center px-2"} py-3 rounded-lg transition-colors group ${Be?"bg-bambu-green text-white":"text-bambu-gray-light hover:bg-bambu-dark-tertiary hover:text-white"}`,title:!s&&!v?_e.name:void 0,children:[v&&!s&&i.jsx(qm,{className:"w-4 h-4 flex-shrink-0 opacity-0 group-hover:opacity-50 cursor-grab active:cursor-grabbing -ml-1"}),_e.custom_icon?i.jsx("img",{src:`/api/v1/external-links/${_e.id}/icon`,alt:"",className:"w-5 h-5 flex-shrink-0"}):ze&&i.jsx(ze,{className:"w-5 h-5 flex-shrink-0"}),(s||v)&&i.jsx("span",{children:_e.name})]})},de)}else{const _e=K.get(de);if(!_e)return null;const{to:ze,icon:Be,labelKey:Ue}=_e,Ne=de==="queue"&&E>0,Ee=de==="archives"&&W>0,ke=Ne?E:Ee?W:0,Me=Ne||Ee,Ge=de==="printers"&&z;return i.jsx("li",{draggable:!0,onDragStart:xe=>ce(xe,de),onDragOver:xe=>fe(xe,de),onDragLeave:oe,onDrop:xe=>O(xe,de),onDragEnd:F,className:`relative ${$===de?"opacity-50":""} ${G===de&&$!==de?"before:absolute before:left-0 before:right-0 before:top-0 before:h-0.5 before:bg-bambu-green":""}`,children:i.jsxs(rb,{to:ze,className:({isActive:xe})=>`flex items-center ${s||v?"gap-3 px-4":"justify-center px-2"} py-3 rounded-lg transition-colors group ${xe?"bg-bambu-green text-white":"text-bambu-gray-light hover:bg-bambu-dark-tertiary hover:text-white"}`,title:!s&&!v?a(Ue):void 0,children:[v&&!s&&i.jsx(qm,{className:"w-4 h-4 flex-shrink-0 opacity-0 group-hover:opacity-50 cursor-grab active:cursor-grabbing -ml-1"}),i.jsxs("div",{className:"relative",children:[i.jsx(Be,{className:"w-5 h-5 flex-shrink-0"}),Ge&&i.jsx("span",{className:"absolute -top-0.5 -right-0.5 w-2.5 h-2.5 bg-yellow-500 rounded-full border-2 border-bambu-dark-secondary"}),Me&&i.jsx("span",{className:`absolute -top-1.5 -right-1.5 min-w-[18px] h-[18px] px-1 flex items-center justify-center text-[10px] font-bold rounded-full ${Ee?"bg-blue-500 text-white":"bg-yellow-500 text-black"}`,children:ke>99?"99+":ke})]}),(s||v)&&i.jsx("span",{children:a(Ue)})]})},de)}})})}),!s&&i.jsx("button",{onClick:()=>_(!v),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:a(v?"nav.collapseSidebar":"nav.expandSidebar"),children:v?i.jsx(ec,{className:"w-5 h-5"}):i.jsx(pa,{className:"w-5 h-5"})}),i.jsx("div",{className:"p-2 border-t border-bambu-dark-tertiary",children:s||v?i.jsxs("div",{className:"flex flex-col gap-2 px-2",children:[i.jsxs("div",{className:"flex items-center justify-center gap-1",children:[Ce&&i.jsxs("div",{className:"relative",children:[i.jsx("button",{onMouseEnter:()=>R(!0),className:`p-2 rounded-lg hover:bg-bambu-dark-tertiary transition-colors ${N?"text-bambu-green":"text-bambu-gray-light hover:text-white"}`,title:a("nav.smartSwitches",{defaultValue:"Smart Switches"}),children:i.jsx(fl,{className:"w-5 h-5"})}),N&&i.jsx(a8,{onClose:()=>R(!1)})]}),d("system:read")?i.jsx(rb,{to:"/system",className:({isActive:de})=>`p-2 rounded-lg hover:bg-bambu-dark-tertiary transition-colors ${de?"text-bambu-green":"text-bambu-gray-light hover:text-white"}`,title:a("nav.system"),children:i.jsx(js,{className:"w-5 h-5"})}):i.jsx("span",{className:"p-2 rounded-lg text-bambu-gray/50 cursor-not-allowed",title:"You do not have permission to view system information",children:i.jsx(js,{className:"w-5 h-5"})}),i.jsx("a",{href:"https://github.com/maziggy/bambuddy",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:a("nav.viewOnGithub"),children:i.jsx(kD,{className:"w-5 h-5"})}),i.jsx("button",{onClick:()=>T(!0),className:"p-2 rounded-lg hover:bg-bambu-dark-tertiary transition-colors text-bambu-gray-light hover:text-white",title:a("nav.keyboardShortcuts"),children:i.jsx(ND,{className:"w-5 h-5"})}),i.jsx("button",{onClick:r,className:"p-2 rounded-lg hover:bg-bambu-dark-tertiary transition-colors text-bambu-gray-light hover:text-white",title:a(n==="dark"?"nav.switchToLight":"nav.switchToDark"),children:n==="dark"?i.jsx(r8,{className:"w-5 h-5"}):i.jsx(G1,{className:"w-5 h-5"})}),l&&o&&i.jsxs(i.Fragment,{children:[i.jsx("button",{onClick:()=>p(!0),className:"p-2 rounded-lg hover:bg-bambu-dark-tertiary transition-colors text-bambu-gray-light hover:text-white",title:a("changePassword.title"),children:i.jsx(il,{className:"w-5 h-5"})}),i.jsx("button",{onClick:c,className:"p-2 rounded-lg hover:bg-bambu-dark-tertiary transition-colors text-bambu-gray-light hover:text-white",title:a("nav.logout",{defaultValue:"Logout"}),children:i.jsx(TD,{className:"w-5 h-5"})})]})]}),i.jsxs("div",{className:"flex items-center justify-center gap-2",children:[i.jsxs("span",{className:"text-sm text-bambu-gray",children:["v",ge?.version||"..."]}),ie?.update_available&&i.jsxs("button",{onClick:()=>t("/settings"),className:"flex items-center gap-1 text-xs text-bambu-green hover:text-bambu-green/80 transition-colors",title:a("nav.updateAvailable",{version:ie.latest_version}),children:[i.jsx(nM,{className:"w-4 h-4"}),i.jsx("span",{children:a("nav.update")})]})]})]}):i.jsxs("div",{className:"flex flex-col items-center gap-1",children:[ie?.update_available&&i.jsx("button",{onClick:()=>t("/settings"),className:"p-2 rounded-lg hover:bg-bambu-dark-tertiary transition-colors text-bambu-green hover:text-bambu-green/80",title:a("nav.updateAvailable",{version:ie.latest_version}),children:i.jsx(nM,{className:"w-5 h-5"})}),Ce&&i.jsxs("div",{className:"relative",children:[i.jsx("button",{onMouseEnter:()=>R(!0),className:`p-2 rounded-lg hover:bg-bambu-dark-tertiary transition-colors ${N?"text-bambu-green":"text-bambu-gray-light hover:text-white"}`,title:a("nav.smartSwitches",{defaultValue:"Smart Switches"}),children:i.jsx(fl,{className:"w-5 h-5"})}),N&&i.jsx(a8,{onClose:()=>R(!1)})]}),d("system:read")?i.jsx(rb,{to:"/system",className:({isActive:de})=>`p-2 rounded-lg hover:bg-bambu-dark-tertiary transition-colors ${de?"text-bambu-green":"text-bambu-gray-light hover:text-white"}`,title:a("nav.system"),children:i.jsx(js,{className:"w-5 h-5"})}):i.jsx("span",{className:"p-2 rounded-lg text-bambu-gray/50 cursor-not-allowed",title:"You do not have permission to view system information",children:i.jsx(js,{className:"w-5 h-5"})}),i.jsx("a",{href:"https://github.com/maziggy/bambuddy",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:a("nav.viewOnGithub"),children:i.jsx(kD,{className:"w-5 h-5"})}),i.jsx("button",{onClick:()=>T(!0),className:"p-2 rounded-lg hover:bg-bambu-dark-tertiary transition-colors text-bambu-gray-light hover:text-white",title:a("nav.keyboardShortcuts"),children:i.jsx(ND,{className:"w-5 h-5"})}),i.jsx("button",{onClick:r,className:"p-2 rounded-lg hover:bg-bambu-dark-tertiary transition-colors text-bambu-gray-light hover:text-white",title:a(n==="dark"?"nav.switchToLight":"nav.switchToDark"),children:n==="dark"?i.jsx(r8,{className:"w-5 h-5"}):i.jsx(G1,{className:"w-5 h-5"})}),l&&o&&i.jsxs(i.Fragment,{children:[i.jsx("button",{onClick:()=>p(!0),className:"p-2 rounded-lg hover:bg-bambu-dark-tertiary transition-colors text-bambu-gray-light hover:text-white",title:a("changePassword.title"),children:i.jsx(il,{className:"w-5 h-5"})}),i.jsx("button",{onClick:c,className:"p-2 rounded-lg hover:bg-bambu-dark-tertiary transition-colors text-bambu-gray-light hover:text-white",title:a("nav.logout",{defaultValue:"Logout"}),children:i.jsx(TD,{className:"w-5 h-5"})})]})]})})]}),i.jsxs("main",{className:`flex-1 bg-bambu-dark overflow-auto transition-all duration-300 ${s?"mt-14":v?"ml-64":"ml-16"}`,children:[q?.enabled&&i.jsx("div",{className:"bg-amber-500/20 border-b border-amber-500/30 px-4 py-2 flex items-center justify-between",children:i.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[i.jsx(Ab,{className:"w-4 h-4 text-amber-500 animate-pulse"}),i.jsxs("span",{className:"text-amber-200",children:[a("support.debugLoggingActive",{defaultValue:"Debug logging is active"}),V!==null&&i.jsxs("span",{className:"text-amber-300/70 ml-2",children:["(",Math.floor(V/60),"m ",V%60,"s)"]})]}),i.jsx("button",{onClick:()=>t("/system"),className:"text-amber-400 hover:text-amber-300 font-medium underline ml-2",children:a("support.manageLogs",{defaultValue:"Manage"})})]})}),Z&&Z.length>0&&i.jsx("div",{className:"bg-orange-500/20 border-b border-orange-500/30 px-4 py-2 flex items-center justify-between",children:i.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[i.jsx(Zfe,{className:"w-4 h-4 text-orange-500"}),i.jsx("span",{className:"text-orange-200",children:a("printers.developerModeWarning",{names:Z.map(de=>de.name).join(", "),defaultValue:`Developer LAN mode is not enabled on: ${Z.map(de=>de.name).join(", ")}. Some features may not work.`})}),i.jsx("a",{href:"https://wiki.bambulab.com/en/knowledge-sharing/enable-developer-mode",target:"_blank",rel:"noopener noreferrer",className:"text-orange-400 hover:text-orange-300 font-medium underline ml-2",children:a("printers.howToEnable",{defaultValue:"How to enable"})})]})}),Q&&i.jsxs("div",{className:"bg-bambu-green/20 border-b border-bambu-green/30 px-4 py-2 flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[i.jsx(nM,{className:"w-4 h-4 text-bambu-green"}),i.jsx("span",{children:a("nav.updateAvailableBanner",{version:ie?.latest_version,defaultValue:`Version ${ie?.latest_version} is available!`})}),i.jsx("button",{onClick:()=>t("/settings"),className:"text-bambu-green hover:text-bambu-green/80 font-medium underline",children:a("nav.viewUpdate",{defaultValue:"View update"})})]}),i.jsx("button",{onClick:ve,className:"p-1 hover:bg-bambu-dark-tertiary rounded transition-colors",title:a("common.dismiss",{defaultValue:"Dismiss"}),children:i.jsx(zt,{className:"w-4 h-4"})})]}),i.jsx(xY,{})]}),C&&i.jsx(rbe,{onClose:()=>T(!1),sidebarItems:se.map(de=>{if(aM(de)){const Ae=ne.get(de);return Ae?{type:"external",label:Ae.name}:null}else{const Ae=K.get(de);return Ae?{type:"nav",label:Ae.labelKey,labelKey:Ae.labelKey}:null}}).filter(Boolean)}),ue&&i.jsx("div",{className:"fixed inset-0 bg-black/70 flex items-center justify-center z-[100] p-4",children:i.jsx("div",{className:"bg-bambu-dark-secondary border-2 border-yellow-500 rounded-xl shadow-2xl max-w-md w-full animate-in fade-in zoom-in duration-200",children:i.jsxs("div",{className:"p-6 text-center",children:[i.jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-full bg-yellow-500/20 flex items-center justify-center",children:i.jsx("svg",{className:"w-10 h-10 text-yellow-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}),i.jsx("h2",{className:"text-xl font-bold text-yellow-400 mb-2",children:a("plateAlert.title")}),i.jsx("p",{className:"text-lg text-white mb-2",children:ue.printer_name}),i.jsx("p",{className:"text-bambu-gray mb-6",children:a("plateAlert.message")}),i.jsx("button",{onClick:()=>me(null),className:"w-full py-3 px-6 bg-yellow-500 hover:bg-yellow-600 text-black font-semibold rounded-lg transition-colors",children:a("plateAlert.understand")})]})})}),m&&i.jsx("div",{className:"fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-4",onClick:()=>{p(!1),y({currentPassword:"",newPassword:"",confirmPassword:""})},children:i.jsxs(Tt,{className:"w-full max-w-md",onClick:de=>de.stopPropagation(),children:[i.jsx(Wn,{children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(il,{className:"w-5 h-5 text-bambu-green"}),i.jsx("h2",{className:"text-lg font-semibold text-white",children:a("changePassword.title")})]}),i.jsx(Fe,{variant:"ghost",size:"sm",onClick:()=>{p(!1),y({currentPassword:"",newPassword:"",confirmPassword:""})},children:i.jsx(zt,{className:"w-5 h-5"})})]})}),i.jsxs(Pt,{children:[i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-white mb-2",children:a("changePassword.currentPassword")}),i.jsx("input",{type:"password",value:f.currentPassword,onChange:de=>y({...f,currentPassword:de.target.value}),className:"w-full px-4 py-3 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:border-bambu-green transition-colors",placeholder:a("changePassword.currentPasswordPlaceholder"),autoComplete:"current-password"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-white mb-2",children:a("changePassword.newPassword")}),i.jsx("input",{type:"password",value:f.newPassword,onChange:de=>y({...f,newPassword:de.target.value}),className:"w-full px-4 py-3 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:border-bambu-green transition-colors",placeholder:a("changePassword.newPasswordPlaceholder"),autoComplete:"new-password",minLength:6})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-white mb-2",children:a("changePassword.confirmPassword")}),i.jsx("input",{type:"password",value:f.confirmPassword,onChange:de=>y({...f,confirmPassword:de.target.value}),className:`w-full px-4 py-3 bg-bambu-dark-secondary border rounded-lg text-white placeholder-bambu-gray focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:border-bambu-green transition-colors ${f.confirmPassword&&f.newPassword!==f.confirmPassword?"border-red-500":"border-bambu-dark-tertiary"}`,placeholder:a("changePassword.confirmPasswordPlaceholder"),autoComplete:"new-password",minLength:6}),f.confirmPassword&&f.newPassword!==f.confirmPassword&&i.jsx("p",{className:"text-red-400 text-xs mt-1",children:a("changePassword.passwordsDoNotMatch")})]})]}),i.jsxs("div",{className:"mt-6 flex justify-end gap-3",children:[i.jsx(Fe,{variant:"secondary",onClick:()=>{p(!1),y({currentPassword:"",newPassword:"",confirmPassword:""})},children:a("common.cancel")}),i.jsx(Fe,{onClick:async()=>{if(f.newPassword!==f.confirmPassword){u(a("changePassword.passwordsDoNotMatch"),"error");return}if(f.newPassword.length<6){u(a("changePassword.passwordTooShort"),"error");return}b(!0);try{await be.changePassword(f.currentPassword,f.newPassword),u(a("changePassword.success"),"success"),p(!1),y({currentPassword:"",newPassword:"",confirmPassword:""})}catch(de){const Ae=de instanceof Error?de.message:a("changePassword.failed");u(Ae,"error")}finally{b(!1)}},disabled:x||!f.currentPassword||!f.newPassword||f.newPassword!==f.confirmPassword||f.newPassword.length<6,children:x?i.jsxs(i.Fragment,{children:[i.jsx(ct,{className:"w-4 h-4 animate-spin"}),a("changePassword.changing")]}):i.jsxs(i.Fragment,{children:[i.jsx(il,{className:"w-4 h-4"}),a("changePassword.title")]})})]})]})]})}),i.jsx(ybe,{})]})}const tL="181",fb={ROTATE:0,DOLLY:1,PAN:2},ib={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},kbe=0,c8=1,Nbe=2,uX=1,Cbe=2,Ld=3,ih=0,ao=1,Mc=2,Zd=0,gb=1,d8=2,u8=3,m8=4,Tbe=5,sp=100,Pbe=101,Abe=102,Mbe=103,Ebe=104,jbe=200,Dbe=201,Rbe=202,Fbe=203,DD=204,RD=205,Lbe=206,Obe=207,Ibe=208,zbe=209,Ube=210,Bbe=211,Hbe=212,$be=213,qbe=214,FD=0,LD=1,OD=2,Db=3,ID=4,zD=5,UD=6,BD=7,nL=0,Vbe=1,Gbe=2,Gm=0,Wbe=1,Kbe=2,Ybe=3,Xbe=4,Qbe=5,Zbe=6,Jbe=7,mX=300,Rb=301,Fb=302,HD=303,$D=304,vC=306,qD=1e3,Vd=1001,VD=1002,Do=1003,exe=1004,kS=1005,hl=1006,sM=1007,hp=1008,qc=1009,hX=1010,pX=1011,Bv=1012,rL=1013,Kp=1014,Gd=1015,ux=1016,iL=1017,aL=1018,Hv=1020,fX=35902,gX=35899,bX=1021,xX=1022,Xl=1023,$v=1026,qv=1027,yX=1028,sL=1029,oL=1030,lL=1031,cL=1033,u1=33776,m1=33777,h1=33778,p1=33779,GD=35840,WD=35841,KD=35842,YD=35843,XD=36196,QD=37492,ZD=37496,JD=37808,e3=37809,t3=37810,n3=37811,r3=37812,i3=37813,a3=37814,s3=37815,o3=37816,l3=37817,c3=37818,d3=37819,u3=37820,m3=37821,h3=36492,p3=36494,f3=36495,g3=36283,b3=36284,x3=36285,y3=36286,txe=3200,nxe=3201,vX=0,rxe=1,_m="",Po="srgb",Lb="srgb-linear",Y1="linear",Ur="srgb",sg=7680,h8=519,ixe=512,axe=513,sxe=514,wX=515,oxe=516,lxe=517,cxe=518,dxe=519,p8=35044,f8="300 es",Dc=2e3,X1=2001;function SX(t){for(let e=t.length-1;e>=0;--e)if(t[e]>=65535)return!0;return!1}function Q1(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}function uxe(){const t=Q1("canvas");return t.style.display="block",t}const g8={};function b8(...t){const e="THREE."+t.shift();console.log(e,...t)}function Mn(...t){const e="THREE."+t.shift();console.warn(e,...t)}function $i(...t){const e="THREE."+t.shift();console.error(e,...t)}function Vv(...t){const e=t.join(" ");e in g8||(g8[e]=!0,Mn(...t))}function mxe(t,e,n){return new Promise(function(r,a){function s(){switch(t.clientWaitSync(e,t.SYNC_FLUSH_COMMANDS_BIT,0)){case t.WAIT_FAILED:a();break;case t.TIMEOUT_EXPIRED:setTimeout(s,n);break;default:r()}}setTimeout(s,n)})}let xf=class{addEventListener(e,n){this._listeners===void 0&&(this._listeners={});const r=this._listeners;r[e]===void 0&&(r[e]=[]),r[e].indexOf(n)===-1&&r[e].push(n)}hasEventListener(e,n){const r=this._listeners;return r===void 0?!1:r[e]!==void 0&&r[e].indexOf(n)!==-1}removeEventListener(e,n){const r=this._listeners;if(r===void 0)return;const a=r[e];if(a!==void 0){const s=a.indexOf(n);s!==-1&&a.splice(s,1)}}dispatchEvent(e){const n=this._listeners;if(n===void 0)return;const r=n[e.type];if(r!==void 0){e.target=this;const a=r.slice(0);for(let s=0,o=a.length;s<o;s++)a[s].call(this,e);e.target=null}}};const is=["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"],f1=Math.PI/180,v3=180/Math.PI;function L0(){const t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,n=Math.random()*4294967295|0,r=Math.random()*4294967295|0;return(is[t&255]+is[t>>8&255]+is[t>>16&255]+is[t>>24&255]+"-"+is[e&255]+is[e>>8&255]+"-"+is[e>>16&15|64]+is[e>>24&255]+"-"+is[n&63|128]+is[n>>8&255]+"-"+is[n>>16&255]+is[n>>24&255]+is[r&255]+is[r>>8&255]+is[r>>16&255]+is[r>>24&255]).toLowerCase()}function or(t,e,n){return Math.max(e,Math.min(n,t))}function hxe(t,e){return(t%e+e)%e}function oM(t,e,n){return(1-n)*t+n*e}function xy(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 Qs(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 pxe={DEG2RAD:f1};let Kn=class _X{constructor(e=0,n=0){_X.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,r=this.y,a=e.elements;return this.x=a[0]*n+a[3]*r+a[6],this.y=a[1]*n+a[4]*r+a[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=or(this.x,e.x,n.x),this.y=or(this.y,e.y,n.y),this}clampScalar(e,n){return this.x=or(this.x,e,n),this.y=or(this.y,e,n),this}clampLength(e,n){const r=this.length();return this.divideScalar(r||1).multiplyScalar(or(r,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 r=this.dot(e)/n;return Math.acos(or(r,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const n=this.x-e.x,r=this.y-e.y;return n*n+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,n){return this.x+=(e.x-this.x)*n,this.y+=(e.y-this.y)*n,this}lerpVectors(e,n,r){return this.x=e.x+(n.x-e.x)*r,this.y=e.y+(n.y-e.y)*r,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 r=Math.cos(n),a=Math.sin(n),s=this.x-e.x,o=this.y-e.y;return this.x=s*r-o*a+e.x,this.y=s*a+o*r+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}},Yp=class{constructor(e=0,n=0,r=0,a=1){this.isQuaternion=!0,this._x=e,this._y=n,this._z=r,this._w=a}static slerpFlat(e,n,r,a,s,o,l){let c=r[a+0],d=r[a+1],u=r[a+2],m=r[a+3],p=s[o+0],f=s[o+1],y=s[o+2],x=s[o+3];if(l<=0){e[n+0]=c,e[n+1]=d,e[n+2]=u,e[n+3]=m;return}if(l>=1){e[n+0]=p,e[n+1]=f,e[n+2]=y,e[n+3]=x;return}if(m!==x||c!==p||d!==f||u!==y){let b=c*p+d*f+u*y+m*x;b<0&&(p=-p,f=-f,y=-y,x=-x,b=-b);let v=1-l;if(b<.9995){const _=Math.acos(b),k=Math.sin(_);v=Math.sin(v*_)/k,l=Math.sin(l*_)/k,c=c*v+p*l,d=d*v+f*l,u=u*v+y*l,m=m*v+x*l}else{c=c*v+p*l,d=d*v+f*l,u=u*v+y*l,m=m*v+x*l;const _=1/Math.sqrt(c*c+d*d+u*u+m*m);c*=_,d*=_,u*=_,m*=_}}e[n]=c,e[n+1]=d,e[n+2]=u,e[n+3]=m}static multiplyQuaternionsFlat(e,n,r,a,s,o){const l=r[a],c=r[a+1],d=r[a+2],u=r[a+3],m=s[o],p=s[o+1],f=s[o+2],y=s[o+3];return e[n]=l*y+u*m+c*f-d*p,e[n+1]=c*y+u*p+d*m-l*f,e[n+2]=d*y+u*f+l*p-c*m,e[n+3]=u*y-l*m-c*p-d*f,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,r,a){return this._x=e,this._y=n,this._z=r,this._w=a,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 r=e._x,a=e._y,s=e._z,o=e._order,l=Math.cos,c=Math.sin,d=l(r/2),u=l(a/2),m=l(s/2),p=c(r/2),f=c(a/2),y=c(s/2);switch(o){case"XYZ":this._x=p*u*m+d*f*y,this._y=d*f*m-p*u*y,this._z=d*u*y+p*f*m,this._w=d*u*m-p*f*y;break;case"YXZ":this._x=p*u*m+d*f*y,this._y=d*f*m-p*u*y,this._z=d*u*y-p*f*m,this._w=d*u*m+p*f*y;break;case"ZXY":this._x=p*u*m-d*f*y,this._y=d*f*m+p*u*y,this._z=d*u*y+p*f*m,this._w=d*u*m-p*f*y;break;case"ZYX":this._x=p*u*m-d*f*y,this._y=d*f*m+p*u*y,this._z=d*u*y-p*f*m,this._w=d*u*m+p*f*y;break;case"YZX":this._x=p*u*m+d*f*y,this._y=d*f*m+p*u*y,this._z=d*u*y-p*f*m,this._w=d*u*m-p*f*y;break;case"XZY":this._x=p*u*m-d*f*y,this._y=d*f*m-p*u*y,this._z=d*u*y+p*f*m,this._w=d*u*m+p*f*y;break;default:Mn("Quaternion: .setFromEuler() encountered an unknown order: "+o)}return n===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,n){const r=n/2,a=Math.sin(r);return this._x=e.x*a,this._y=e.y*a,this._z=e.z*a,this._w=Math.cos(r),this._onChangeCallback(),this}setFromRotationMatrix(e){const n=e.elements,r=n[0],a=n[4],s=n[8],o=n[1],l=n[5],c=n[9],d=n[2],u=n[6],m=n[10],p=r+l+m;if(p>0){const f=.5/Math.sqrt(p+1);this._w=.25/f,this._x=(u-c)*f,this._y=(s-d)*f,this._z=(o-a)*f}else if(r>l&&r>m){const f=2*Math.sqrt(1+r-l-m);this._w=(u-c)/f,this._x=.25*f,this._y=(a+o)/f,this._z=(s+d)/f}else if(l>m){const f=2*Math.sqrt(1+l-r-m);this._w=(s-d)/f,this._x=(a+o)/f,this._y=.25*f,this._z=(c+u)/f}else{const f=2*Math.sqrt(1+m-r-l);this._w=(o-a)/f,this._x=(s+d)/f,this._y=(c+u)/f,this._z=.25*f}return this._onChangeCallback(),this}setFromUnitVectors(e,n){let r=e.dot(n)+1;return r<1e-8?(r=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=r):(this._x=0,this._y=-e.z,this._z=e.y,this._w=r)):(this._x=e.y*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=r),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(or(this.dot(e),-1,1)))}rotateTowards(e,n){const r=this.angleTo(e);if(r===0)return this;const a=Math.min(1,n/r);return this.slerp(e,a),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 r=e._x,a=e._y,s=e._z,o=e._w,l=n._x,c=n._y,d=n._z,u=n._w;return this._x=r*u+o*l+a*d-s*c,this._y=a*u+o*c+s*l-r*d,this._z=s*u+o*d+r*c-a*l,this._w=o*u-r*l-a*c-s*d,this._onChangeCallback(),this}slerp(e,n){if(n<=0)return this;if(n>=1)return this.copy(e);let r=e._x,a=e._y,s=e._z,o=e._w,l=this.dot(e);l<0&&(r=-r,a=-a,s=-s,o=-o,l=-l);let c=1-n;if(l<.9995){const d=Math.acos(l),u=Math.sin(d);c=Math.sin(c*d)/u,n=Math.sin(n*d)/u,this._x=this._x*c+r*n,this._y=this._y*c+a*n,this._z=this._z*c+s*n,this._w=this._w*c+o*n,this._onChangeCallback()}else this._x=this._x*c+r*n,this._y=this._y*c+a*n,this._z=this._z*c+s*n,this._w=this._w*c+o*n,this.normalize();return this}slerpQuaternions(e,n,r){return this.copy(e).slerp(n,r)}random(){const e=2*Math.PI*Math.random(),n=2*Math.PI*Math.random(),r=Math.random(),a=Math.sqrt(1-r),s=Math.sqrt(r);return this.set(a*Math.sin(e),a*Math.cos(e),s*Math.sin(n),s*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}},wt=class kX{constructor(e=0,n=0,r=0){kX.prototype.isVector3=!0,this.x=e,this.y=n,this.z=r}set(e,n,r){return r===void 0&&(r=this.z),this.x=e,this.y=n,this.z=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,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(x8.setFromEuler(e))}applyAxisAngle(e,n){return this.applyQuaternion(x8.setFromAxisAngle(e,n))}applyMatrix3(e){const n=this.x,r=this.y,a=this.z,s=e.elements;return this.x=s[0]*n+s[3]*r+s[6]*a,this.y=s[1]*n+s[4]*r+s[7]*a,this.z=s[2]*n+s[5]*r+s[8]*a,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const n=this.x,r=this.y,a=this.z,s=e.elements,o=1/(s[3]*n+s[7]*r+s[11]*a+s[15]);return this.x=(s[0]*n+s[4]*r+s[8]*a+s[12])*o,this.y=(s[1]*n+s[5]*r+s[9]*a+s[13])*o,this.z=(s[2]*n+s[6]*r+s[10]*a+s[14])*o,this}applyQuaternion(e){const n=this.x,r=this.y,a=this.z,s=e.x,o=e.y,l=e.z,c=e.w,d=2*(o*a-l*r),u=2*(l*n-s*a),m=2*(s*r-o*n);return this.x=n+c*d+o*m-l*u,this.y=r+c*u+l*d-s*m,this.z=a+c*m+s*u-o*d,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const n=this.x,r=this.y,a=this.z,s=e.elements;return this.x=s[0]*n+s[4]*r+s[8]*a,this.y=s[1]*n+s[5]*r+s[9]*a,this.z=s[2]*n+s[6]*r+s[10]*a,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=or(this.x,e.x,n.x),this.y=or(this.y,e.y,n.y),this.z=or(this.z,e.z,n.z),this}clampScalar(e,n){return this.x=or(this.x,e,n),this.y=or(this.y,e,n),this.z=or(this.z,e,n),this}clampLength(e,n){const r=this.length();return this.divideScalar(r||1).multiplyScalar(or(r,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,r){return this.x=e.x+(n.x-e.x)*r,this.y=e.y+(n.y-e.y)*r,this.z=e.z+(n.z-e.z)*r,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,n){const r=e.x,a=e.y,s=e.z,o=n.x,l=n.y,c=n.z;return this.x=a*c-s*l,this.y=s*o-r*c,this.z=r*l-a*o,this}projectOnVector(e){const n=e.lengthSq();if(n===0)return this.set(0,0,0);const r=e.dot(this)/n;return this.copy(e).multiplyScalar(r)}projectOnPlane(e){return lM.copy(this).projectOnVector(e),this.sub(lM)}reflect(e){return this.sub(lM.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 r=this.dot(e)/n;return Math.acos(or(r,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const n=this.x-e.x,r=this.y-e.y,a=this.z-e.z;return n*n+r*r+a*a}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,r){const a=Math.sin(n)*e;return this.x=a*Math.sin(r),this.y=Math.cos(n)*e,this.z=a*Math.cos(r),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,n,r){return this.x=e*Math.sin(n),this.y=r,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(),r=this.setFromMatrixColumn(e,1).length(),a=this.setFromMatrixColumn(e,2).length();return this.x=n,this.y=r,this.z=a,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,r=Math.sqrt(1-n*n);return this.x=r*Math.cos(e),this.y=n,this.z=r*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}};const lM=new wt,x8=new Yp;let Qn=class NX{constructor(e,n,r,a,s,o,l,c,d){NX.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,n,r,a,s,o,l,c,d)}set(e,n,r,a,s,o,l,c,d){const u=this.elements;return u[0]=e,u[1]=a,u[2]=l,u[3]=n,u[4]=s,u[5]=c,u[6]=r,u[7]=o,u[8]=d,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const n=this.elements,r=e.elements;return n[0]=r[0],n[1]=r[1],n[2]=r[2],n[3]=r[3],n[4]=r[4],n[5]=r[5],n[6]=r[6],n[7]=r[7],n[8]=r[8],this}extractBasis(e,n,r){return e.setFromMatrix3Column(this,0),n.setFromMatrix3Column(this,1),r.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 r=e.elements,a=n.elements,s=this.elements,o=r[0],l=r[3],c=r[6],d=r[1],u=r[4],m=r[7],p=r[2],f=r[5],y=r[8],x=a[0],b=a[3],v=a[6],_=a[1],k=a[4],P=a[7],C=a[2],T=a[5],N=a[8];return s[0]=o*x+l*_+c*C,s[3]=o*b+l*k+c*T,s[6]=o*v+l*P+c*N,s[1]=d*x+u*_+m*C,s[4]=d*b+u*k+m*T,s[7]=d*v+u*P+m*N,s[2]=p*x+f*_+y*C,s[5]=p*b+f*k+y*T,s[8]=p*v+f*P+y*N,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],r=e[1],a=e[2],s=e[3],o=e[4],l=e[5],c=e[6],d=e[7],u=e[8];return n*o*u-n*l*d-r*s*u+r*l*c+a*s*d-a*o*c}invert(){const e=this.elements,n=e[0],r=e[1],a=e[2],s=e[3],o=e[4],l=e[5],c=e[6],d=e[7],u=e[8],m=u*o-l*d,p=l*c-u*s,f=d*s-o*c,y=n*m+r*p+a*f;if(y===0)return this.set(0,0,0,0,0,0,0,0,0);const x=1/y;return e[0]=m*x,e[1]=(a*d-u*r)*x,e[2]=(l*r-a*o)*x,e[3]=p*x,e[4]=(u*n-a*c)*x,e[5]=(a*s-l*n)*x,e[6]=f*x,e[7]=(r*c-d*n)*x,e[8]=(o*n-r*s)*x,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,r,a,s,o,l){const c=Math.cos(s),d=Math.sin(s);return this.set(r*c,r*d,-r*(c*o+d*l)+o+e,-a*d,a*c,-a*(-d*o+c*l)+l+n,0,0,1),this}scale(e,n){return this.premultiply(cM.makeScale(e,n)),this}rotate(e){return this.premultiply(cM.makeRotation(-e)),this}translate(e,n){return this.premultiply(cM.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),r=Math.sin(e);return this.set(n,-r,0,r,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,r=e.elements;for(let a=0;a<9;a++)if(n[a]!==r[a])return!1;return!0}fromArray(e,n=0){for(let r=0;r<9;r++)this.elements[r]=e[r+n];return this}toArray(e=[],n=0){const r=this.elements;return e[n]=r[0],e[n+1]=r[1],e[n+2]=r[2],e[n+3]=r[3],e[n+4]=r[4],e[n+5]=r[5],e[n+6]=r[6],e[n+7]=r[7],e[n+8]=r[8],e}clone(){return new this.constructor().fromArray(this.elements)}};const cM=new Qn,y8=new Qn().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),v8=new Qn().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function fxe(){const t={enabled:!0,workingColorSpace:Lb,spaces:{},convert:function(a,s,o){return this.enabled===!1||s===o||!s||!o||(this.spaces[s].transfer===Ur&&(a.r=Jd(a.r),a.g=Jd(a.g),a.b=Jd(a.b)),this.spaces[s].primaries!==this.spaces[o].primaries&&(a.applyMatrix3(this.spaces[s].toXYZ),a.applyMatrix3(this.spaces[o].fromXYZ)),this.spaces[o].transfer===Ur&&(a.r=bb(a.r),a.g=bb(a.g),a.b=bb(a.b))),a},workingToColorSpace:function(a,s){return this.convert(a,this.workingColorSpace,s)},colorSpaceToWorking:function(a,s){return this.convert(a,s,this.workingColorSpace)},getPrimaries:function(a){return this.spaces[a].primaries},getTransfer:function(a){return a===_m?Y1:this.spaces[a].transfer},getToneMappingMode:function(a){return this.spaces[a].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(a,s=this.workingColorSpace){return a.fromArray(this.spaces[s].luminanceCoefficients)},define:function(a){Object.assign(this.spaces,a)},_getMatrix:function(a,s,o){return a.copy(this.spaces[s].toXYZ).multiply(this.spaces[o].fromXYZ)},_getDrawingBufferColorSpace:function(a){return this.spaces[a].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(a=this.workingColorSpace){return this.spaces[a].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(a,s){return Vv("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),t.workingToColorSpace(a,s)},toWorkingColorSpace:function(a,s){return Vv("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),t.colorSpaceToWorking(a,s)}},e=[.64,.33,.3,.6,.15,.06],n=[.2126,.7152,.0722],r=[.3127,.329];return t.define({[Lb]:{primaries:e,whitePoint:r,transfer:Y1,toXYZ:y8,fromXYZ:v8,luminanceCoefficients:n,workingColorSpaceConfig:{unpackColorSpace:Po},outputColorSpaceConfig:{drawingBufferColorSpace:Po}},[Po]:{primaries:e,whitePoint:r,transfer:Ur,toXYZ:y8,fromXYZ:v8,luminanceCoefficients:n,outputColorSpaceConfig:{drawingBufferColorSpace:Po}}}),t}const xr=fxe();function Jd(t){return t<.04045?t*.0773993808:Math.pow(t*.9478672986+.0521327014,2.4)}function bb(t){return t<.0031308?t*12.92:1.055*Math.pow(t,.41666)-.055}let og,gxe=class{static getDataURL(e,n="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let r;if(e instanceof HTMLCanvasElement)r=e;else{og===void 0&&(og=Q1("canvas")),og.width=e.width,og.height=e.height;const a=og.getContext("2d");e instanceof ImageData?a.putImageData(e,0,0):a.drawImage(e,0,0,e.width,e.height),r=og}return r.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=Q1("canvas");n.width=e.width,n.height=e.height;const r=n.getContext("2d");r.drawImage(e,0,0,e.width,e.height);const a=r.getImageData(0,0,e.width,e.height),s=a.data;for(let o=0;o<s.length;o++)s[o]=Jd(s[o]/255)*255;return r.putImageData(a,0,0),n}else if(e.data){const n=e.data.slice(0);for(let r=0;r<n.length;r++)n instanceof Uint8Array||n instanceof Uint8ClampedArray?n[r]=Math.floor(Jd(n[r]/255)*255):n[r]=Jd(n[r]);return{data:n,width:e.width,height:e.height}}else return Mn("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}},bxe=0,dL=class{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:bxe++}),this.uuid=L0(),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 r={uuid:this.uuid,url:""},a=this.data;if(a!==null){let s;if(Array.isArray(a)){s=[];for(let o=0,l=a.length;o<l;o++)a[o].isDataTexture?s.push(dM(a[o].image)):s.push(dM(a[o]))}else s=dM(a);r.url=s}return n||(e.images[this.uuid]=r),r}};function dM(t){return typeof HTMLImageElement<"u"&&t instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&t instanceof ImageBitmap?gxe.getDataURL(t):t.data?{data:Array.from(t.data),width:t.width,height:t.height,type:t.data.constructor.name}:(Mn("Texture: Unable to serialize Texture."),{})}let xxe=0;const uM=new wt;let oc=class g1 extends xf{constructor(e=g1.DEFAULT_IMAGE,n=g1.DEFAULT_MAPPING,r=Vd,a=Vd,s=hl,o=hp,l=Xl,c=qc,d=g1.DEFAULT_ANISOTROPY,u=_m){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:xxe++}),this.uuid=L0(),this.name="",this.source=new dL(e),this.mipmaps=[],this.mapping=n,this.channel=0,this.wrapS=r,this.wrapT=a,this.magFilter=s,this.minFilter=o,this.anisotropy=d,this.format=l,this.internalFormat=null,this.type=c,this.offset=new Kn(0,0),this.repeat=new Kn(1,1),this.center=new Kn(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Qn,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=u,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(uM).x}get height(){return this.source.getSize(uM).y}get depth(){return this.source.getSize(uM).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 r=e[n];if(r===void 0){Mn(`Texture.setValues(): parameter '${n}' has value of undefined.`);continue}const a=this[n];if(a===void 0){Mn(`Texture.setValues(): property '${n}' does not exist.`);continue}a&&r&&a.isVector2&&r.isVector2||a&&r&&a.isVector3&&r.isVector3||a&&r&&a.isMatrix3&&r.isMatrix3?a.copy(r):this[n]=r}}toJSON(e){const n=e===void 0||typeof e=="string";if(!n&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const r={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&&(r.userData=this.userData),n||(e.textures[this.uuid]=r),r}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==mX)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case qD:e.x=e.x-Math.floor(e.x);break;case Vd:e.x=e.x<0?0:1;break;case VD: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 qD:e.y=e.y-Math.floor(e.y);break;case Vd:e.y=e.y<0?0:1;break;case VD: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++}};oc.DEFAULT_IMAGE=null;oc.DEFAULT_MAPPING=mX;oc.DEFAULT_ANISOTROPY=1;let na=class CX{constructor(e=0,n=0,r=0,a=1){CX.prototype.isVector4=!0,this.x=e,this.y=n,this.z=r,this.w=a}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,r,a){return this.x=e,this.y=n,this.z=r,this.w=a,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,r=this.y,a=this.z,s=this.w,o=e.elements;return this.x=o[0]*n+o[4]*r+o[8]*a+o[12]*s,this.y=o[1]*n+o[5]*r+o[9]*a+o[13]*s,this.z=o[2]*n+o[6]*r+o[10]*a+o[14]*s,this.w=o[3]*n+o[7]*r+o[11]*a+o[15]*s,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,r,a,s;const c=e.elements,d=c[0],u=c[4],m=c[8],p=c[1],f=c[5],y=c[9],x=c[2],b=c[6],v=c[10];if(Math.abs(u-p)<.01&&Math.abs(m-x)<.01&&Math.abs(y-b)<.01){if(Math.abs(u+p)<.1&&Math.abs(m+x)<.1&&Math.abs(y+b)<.1&&Math.abs(d+f+v-3)<.1)return this.set(1,0,0,0),this;n=Math.PI;const k=(d+1)/2,P=(f+1)/2,C=(v+1)/2,T=(u+p)/4,N=(m+x)/4,R=(y+b)/4;return k>P&&k>C?k<.01?(r=0,a=.707106781,s=.707106781):(r=Math.sqrt(k),a=T/r,s=N/r):P>C?P<.01?(r=.707106781,a=0,s=.707106781):(a=Math.sqrt(P),r=T/a,s=R/a):C<.01?(r=.707106781,a=.707106781,s=0):(s=Math.sqrt(C),r=N/s,a=R/s),this.set(r,a,s,n),this}let _=Math.sqrt((b-y)*(b-y)+(m-x)*(m-x)+(p-u)*(p-u));return Math.abs(_)<.001&&(_=1),this.x=(b-y)/_,this.y=(m-x)/_,this.z=(p-u)/_,this.w=Math.acos((d+f+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=or(this.x,e.x,n.x),this.y=or(this.y,e.y,n.y),this.z=or(this.z,e.z,n.z),this.w=or(this.w,e.w,n.w),this}clampScalar(e,n){return this.x=or(this.x,e,n),this.y=or(this.y,e,n),this.z=or(this.z,e,n),this.w=or(this.w,e,n),this}clampLength(e,n){const r=this.length();return this.divideScalar(r||1).multiplyScalar(or(r,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,r){return this.x=e.x+(n.x-e.x)*r,this.y=e.y+(n.y-e.y)*r,this.z=e.z+(n.z-e.z)*r,this.w=e.w+(n.w-e.w)*r,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,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}},yxe=class extends xf{constructor(e=1,n=1,r={}){super(),r=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:hl,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},r),this.isRenderTarget=!0,this.width=e,this.height=n,this.depth=r.depth,this.scissor=new na(0,0,e,n),this.scissorTest=!1,this.viewport=new na(0,0,e,n);const a={width:e,height:n,depth:r.depth},s=new oc(a);this.textures=[];const o=r.count;for(let l=0;l<o;l++)this.textures[l]=s.clone(),this.textures[l].isRenderTargetTexture=!0,this.textures[l].renderTarget=this;this._setTextureOptions(r),this.depthBuffer=r.depthBuffer,this.stencilBuffer=r.stencilBuffer,this.resolveDepthBuffer=r.resolveDepthBuffer,this.resolveStencilBuffer=r.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=r.depthTexture,this.samples=r.samples,this.multiview=r.multiview}_setTextureOptions(e={}){const n={minFilter:hl,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 r=0;r<this.textures.length;r++)this.textures[r].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,r=1){if(this.width!==e||this.height!==n||this.depth!==r){this.width=e,this.height=n,this.depth=r;for(let a=0,s=this.textures.length;a<s;a++)this.textures[a].image.width=e,this.textures[a].image.height=n,this.textures[a].image.depth=r,this.textures[a].isData3DTexture!==!0&&(this.textures[a].isArrayTexture=this.textures[a].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,r=e.textures.length;n<r;n++){this.textures[n]=e.textures[n].clone(),this.textures[n].isRenderTargetTexture=!0,this.textures[n].renderTarget=this;const a=Object.assign({},e.textures[n].image);this.textures[n].source=new dL(a)}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"})}},Xp=class extends yxe{constructor(e=1,n=1,r={}){super(e,n,r),this.isWebGLRenderTarget=!0}},TX=class extends oc{constructor(e=null,n=1,r=1,a=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:n,height:r,depth:a},this.magFilter=Do,this.minFilter=Do,this.wrapR=Vd,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}},vxe=class extends oc{constructor(e=null,n=1,r=1,a=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:n,height:r,depth:a},this.magFilter=Do,this.minFilter=Do,this.wrapR=Vd,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}},Wm=class{constructor(e=new wt(1/0,1/0,1/0),n=new wt(-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,r=e.length;n<r;n+=3)this.expandByPoint(Il.fromArray(e,n));return this}setFromBufferAttribute(e){this.makeEmpty();for(let n=0,r=e.count;n<r;n++)this.expandByPoint(Il.fromBufferAttribute(e,n));return this}setFromPoints(e){this.makeEmpty();for(let n=0,r=e.length;n<r;n++)this.expandByPoint(e[n]);return this}setFromCenterAndSize(e,n){const r=Il.copy(n).multiplyScalar(.5);return this.min.copy(e).sub(r),this.max.copy(e).add(r),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 r=e.geometry;if(r!==void 0){const s=r.getAttribute("position");if(n===!0&&s!==void 0&&e.isInstancedMesh!==!0)for(let o=0,l=s.count;o<l;o++)e.isMesh===!0?e.getVertexPosition(o,Il):Il.fromBufferAttribute(s,o),Il.applyMatrix4(e.matrixWorld),this.expandByPoint(Il);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),NS.copy(e.boundingBox)):(r.boundingBox===null&&r.computeBoundingBox(),NS.copy(r.boundingBox)),NS.applyMatrix4(e.matrixWorld),this.union(NS)}const a=e.children;for(let s=0,o=a.length;s<o;s++)this.expandByObject(a[s],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,Il),Il.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let n,r;return e.normal.x>0?(n=e.normal.x*this.min.x,r=e.normal.x*this.max.x):(n=e.normal.x*this.max.x,r=e.normal.x*this.min.x),e.normal.y>0?(n+=e.normal.y*this.min.y,r+=e.normal.y*this.max.y):(n+=e.normal.y*this.max.y,r+=e.normal.y*this.min.y),e.normal.z>0?(n+=e.normal.z*this.min.z,r+=e.normal.z*this.max.z):(n+=e.normal.z*this.max.z,r+=e.normal.z*this.min.z),n<=-e.constant&&r>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(yy),CS.subVectors(this.max,yy),lg.subVectors(e.a,yy),cg.subVectors(e.b,yy),dg.subVectors(e.c,yy),Qu.subVectors(cg,lg),Zu.subVectors(dg,cg),Uh.subVectors(lg,dg);let n=[0,-Qu.z,Qu.y,0,-Zu.z,Zu.y,0,-Uh.z,Uh.y,Qu.z,0,-Qu.x,Zu.z,0,-Zu.x,Uh.z,0,-Uh.x,-Qu.y,Qu.x,0,-Zu.y,Zu.x,0,-Uh.y,Uh.x,0];return!mM(n,lg,cg,dg,CS)||(n=[1,0,0,0,1,0,0,0,1],!mM(n,lg,cg,dg,CS))?!1:(TS.crossVectors(Qu,Zu),n=[TS.x,TS.y,TS.z],mM(n,lg,cg,dg,CS))}clampPoint(e,n){return n.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Il).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Il).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:(vd[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),vd[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),vd[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),vd[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),vd[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),vd[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),vd[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),vd[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(vd),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 vd=[new wt,new wt,new wt,new wt,new wt,new wt,new wt,new wt],Il=new wt,NS=new Wm,lg=new wt,cg=new wt,dg=new wt,Qu=new wt,Zu=new wt,Uh=new wt,yy=new wt,CS=new wt,TS=new wt,Bh=new wt;function mM(t,e,n,r,a){for(let s=0,o=t.length-3;s<=o;s+=3){Bh.fromArray(t,s);const l=a.x*Math.abs(Bh.x)+a.y*Math.abs(Bh.y)+a.z*Math.abs(Bh.z),c=e.dot(Bh),d=n.dot(Bh),u=r.dot(Bh);if(Math.max(-Math.max(c,d,u),Math.min(c,d,u))>l)return!1}return!0}const wxe=new Wm,vy=new wt,hM=new wt;let wC=class{constructor(e=new wt,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 r=this.center;n!==void 0?r.copy(n):wxe.setFromPoints(e).getCenter(r);let a=0;for(let s=0,o=e.length;s<o;s++)a=Math.max(a,r.distanceToSquared(e[s]));return this.radius=Math.sqrt(a),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 r=this.center.distanceToSquared(e);return n.copy(e),r>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;vy.subVectors(e,this.center);const n=vy.lengthSq();if(n>this.radius*this.radius){const r=Math.sqrt(n),a=(r-this.radius)*.5;this.center.addScaledVector(vy,a/r),this.radius+=a}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):(hM.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(vy.copy(e.center).add(hM)),this.expandByPoint(vy.copy(e.center).sub(hM))),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 wd=new wt,pM=new wt,PS=new wt,Ju=new wt,fM=new wt,AS=new wt,gM=new wt;let uL=class{constructor(e=new wt,n=new wt(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,wd)),this}closestPointToPoint(e,n){n.subVectors(e,this.origin);const r=n.dot(this.direction);return r<0?n.copy(this.origin):n.copy(this.origin).addScaledVector(this.direction,r)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const n=wd.subVectors(e,this.origin).dot(this.direction);return n<0?this.origin.distanceToSquared(e):(wd.copy(this.origin).addScaledVector(this.direction,n),wd.distanceToSquared(e))}distanceSqToSegment(e,n,r,a){pM.copy(e).add(n).multiplyScalar(.5),PS.copy(n).sub(e).normalize(),Ju.copy(this.origin).sub(pM);const s=e.distanceTo(n)*.5,o=-this.direction.dot(PS),l=Ju.dot(this.direction),c=-Ju.dot(PS),d=Ju.lengthSq(),u=Math.abs(1-o*o);let m,p,f,y;if(u>0)if(m=o*c-l,p=o*l-c,y=s*u,m>=0)if(p>=-y)if(p<=y){const x=1/u;m*=x,p*=x,f=m*(m+o*p+2*l)+p*(o*m+p+2*c)+d}else p=s,m=Math.max(0,-(o*p+l)),f=-m*m+p*(p+2*c)+d;else p=-s,m=Math.max(0,-(o*p+l)),f=-m*m+p*(p+2*c)+d;else p<=-y?(m=Math.max(0,-(-o*s+l)),p=m>0?-s:Math.min(Math.max(-s,-c),s),f=-m*m+p*(p+2*c)+d):p<=y?(m=0,p=Math.min(Math.max(-s,-c),s),f=p*(p+2*c)+d):(m=Math.max(0,-(o*s+l)),p=m>0?s:Math.min(Math.max(-s,-c),s),f=-m*m+p*(p+2*c)+d);else p=o>0?-s:s,m=Math.max(0,-(o*p+l)),f=-m*m+p*(p+2*c)+d;return r&&r.copy(this.origin).addScaledVector(this.direction,m),a&&a.copy(pM).addScaledVector(PS,p),f}intersectSphere(e,n){wd.subVectors(e.center,this.origin);const r=wd.dot(this.direction),a=wd.dot(wd)-r*r,s=e.radius*e.radius;if(a>s)return null;const o=Math.sqrt(s-a),l=r-o,c=r+o;return c<0?null:l<0?this.at(c,n):this.at(l,n)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const n=e.normal.dot(this.direction);if(n===0)return e.distanceToPoint(this.origin)===0?0:null;const r=-(this.origin.dot(e.normal)+e.constant)/n;return r>=0?r:null}intersectPlane(e,n){const r=this.distanceToPlane(e);return r===null?null:this.at(r,n)}intersectsPlane(e){const n=e.distanceToPoint(this.origin);return n===0||e.normal.dot(this.direction)*n<0}intersectBox(e,n){let r,a,s,o,l,c;const d=1/this.direction.x,u=1/this.direction.y,m=1/this.direction.z,p=this.origin;return d>=0?(r=(e.min.x-p.x)*d,a=(e.max.x-p.x)*d):(r=(e.max.x-p.x)*d,a=(e.min.x-p.x)*d),u>=0?(s=(e.min.y-p.y)*u,o=(e.max.y-p.y)*u):(s=(e.max.y-p.y)*u,o=(e.min.y-p.y)*u),r>o||s>a||((s>r||isNaN(r))&&(r=s),(o<a||isNaN(a))&&(a=o),m>=0?(l=(e.min.z-p.z)*m,c=(e.max.z-p.z)*m):(l=(e.max.z-p.z)*m,c=(e.min.z-p.z)*m),r>c||l>a)||((l>r||r!==r)&&(r=l),(c<a||a!==a)&&(a=c),a<0)?null:this.at(r>=0?r:a,n)}intersectsBox(e){return this.intersectBox(e,wd)!==null}intersectTriangle(e,n,r,a,s){fM.subVectors(n,e),AS.subVectors(r,e),gM.crossVectors(fM,AS);let o=this.direction.dot(gM),l;if(o>0){if(a)return null;l=1}else if(o<0)l=-1,o=-o;else return null;Ju.subVectors(this.origin,e);const c=l*this.direction.dot(AS.crossVectors(Ju,AS));if(c<0)return null;const d=l*this.direction.dot(fM.cross(Ju));if(d<0||c+d>o)return null;const u=-l*Ju.dot(gM);return u<0?null:this.at(u/o,s)}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)}},oa=class w3{constructor(e,n,r,a,s,o,l,c,d,u,m,p,f,y,x,b){w3.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,r,a,s,o,l,c,d,u,m,p,f,y,x,b)}set(e,n,r,a,s,o,l,c,d,u,m,p,f,y,x,b){const v=this.elements;return v[0]=e,v[4]=n,v[8]=r,v[12]=a,v[1]=s,v[5]=o,v[9]=l,v[13]=c,v[2]=d,v[6]=u,v[10]=m,v[14]=p,v[3]=f,v[7]=y,v[11]=x,v[15]=b,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new w3().fromArray(this.elements)}copy(e){const n=this.elements,r=e.elements;return n[0]=r[0],n[1]=r[1],n[2]=r[2],n[3]=r[3],n[4]=r[4],n[5]=r[5],n[6]=r[6],n[7]=r[7],n[8]=r[8],n[9]=r[9],n[10]=r[10],n[11]=r[11],n[12]=r[12],n[13]=r[13],n[14]=r[14],n[15]=r[15],this}copyPosition(e){const n=this.elements,r=e.elements;return n[12]=r[12],n[13]=r[13],n[14]=r[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,r){return e.setFromMatrixColumn(this,0),n.setFromMatrixColumn(this,1),r.setFromMatrixColumn(this,2),this}makeBasis(e,n,r){return this.set(e.x,n.x,r.x,0,e.y,n.y,r.y,0,e.z,n.z,r.z,0,0,0,0,1),this}extractRotation(e){const n=this.elements,r=e.elements,a=1/ug.setFromMatrixColumn(e,0).length(),s=1/ug.setFromMatrixColumn(e,1).length(),o=1/ug.setFromMatrixColumn(e,2).length();return n[0]=r[0]*a,n[1]=r[1]*a,n[2]=r[2]*a,n[3]=0,n[4]=r[4]*s,n[5]=r[5]*s,n[6]=r[6]*s,n[7]=0,n[8]=r[8]*o,n[9]=r[9]*o,n[10]=r[10]*o,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,this}makeRotationFromEuler(e){const n=this.elements,r=e.x,a=e.y,s=e.z,o=Math.cos(r),l=Math.sin(r),c=Math.cos(a),d=Math.sin(a),u=Math.cos(s),m=Math.sin(s);if(e.order==="XYZ"){const p=o*u,f=o*m,y=l*u,x=l*m;n[0]=c*u,n[4]=-c*m,n[8]=d,n[1]=f+y*d,n[5]=p-x*d,n[9]=-l*c,n[2]=x-p*d,n[6]=y+f*d,n[10]=o*c}else if(e.order==="YXZ"){const p=c*u,f=c*m,y=d*u,x=d*m;n[0]=p+x*l,n[4]=y*l-f,n[8]=o*d,n[1]=o*m,n[5]=o*u,n[9]=-l,n[2]=f*l-y,n[6]=x+p*l,n[10]=o*c}else if(e.order==="ZXY"){const p=c*u,f=c*m,y=d*u,x=d*m;n[0]=p-x*l,n[4]=-o*m,n[8]=y+f*l,n[1]=f+y*l,n[5]=o*u,n[9]=x-p*l,n[2]=-o*d,n[6]=l,n[10]=o*c}else if(e.order==="ZYX"){const p=o*u,f=o*m,y=l*u,x=l*m;n[0]=c*u,n[4]=y*d-f,n[8]=p*d+x,n[1]=c*m,n[5]=x*d+p,n[9]=f*d-y,n[2]=-d,n[6]=l*c,n[10]=o*c}else if(e.order==="YZX"){const p=o*c,f=o*d,y=l*c,x=l*d;n[0]=c*u,n[4]=x-p*m,n[8]=y*m+f,n[1]=m,n[5]=o*u,n[9]=-l*u,n[2]=-d*u,n[6]=f*m+y,n[10]=p-x*m}else if(e.order==="XZY"){const p=o*c,f=o*d,y=l*c,x=l*d;n[0]=c*u,n[4]=-m,n[8]=d*u,n[1]=p*m+x,n[5]=o*u,n[9]=f*m-y,n[2]=y*m-f,n[6]=l*u,n[10]=x*m+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(Sxe,e,_xe)}lookAt(e,n,r){const a=this.elements;return ko.subVectors(e,n),ko.lengthSq()===0&&(ko.z=1),ko.normalize(),em.crossVectors(r,ko),em.lengthSq()===0&&(Math.abs(r.z)===1?ko.x+=1e-4:ko.z+=1e-4,ko.normalize(),em.crossVectors(r,ko)),em.normalize(),MS.crossVectors(ko,em),a[0]=em.x,a[4]=MS.x,a[8]=ko.x,a[1]=em.y,a[5]=MS.y,a[9]=ko.y,a[2]=em.z,a[6]=MS.z,a[10]=ko.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,n){const r=e.elements,a=n.elements,s=this.elements,o=r[0],l=r[4],c=r[8],d=r[12],u=r[1],m=r[5],p=r[9],f=r[13],y=r[2],x=r[6],b=r[10],v=r[14],_=r[3],k=r[7],P=r[11],C=r[15],T=a[0],N=a[4],R=a[8],A=a[12],D=a[1],$=a[5],U=a[9],G=a[13],L=a[2],te=a[6],re=a[10],J=a[14],ue=a[3],me=a[7],ge=a[11],X=a[15];return s[0]=o*T+l*D+c*L+d*ue,s[4]=o*N+l*$+c*te+d*me,s[8]=o*R+l*U+c*re+d*ge,s[12]=o*A+l*G+c*J+d*X,s[1]=u*T+m*D+p*L+f*ue,s[5]=u*N+m*$+p*te+f*me,s[9]=u*R+m*U+p*re+f*ge,s[13]=u*A+m*G+p*J+f*X,s[2]=y*T+x*D+b*L+v*ue,s[6]=y*N+x*$+b*te+v*me,s[10]=y*R+x*U+b*re+v*ge,s[14]=y*A+x*G+b*J+v*X,s[3]=_*T+k*D+P*L+C*ue,s[7]=_*N+k*$+P*te+C*me,s[11]=_*R+k*U+P*re+C*ge,s[15]=_*A+k*G+P*J+C*X,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],r=e[4],a=e[8],s=e[12],o=e[1],l=e[5],c=e[9],d=e[13],u=e[2],m=e[6],p=e[10],f=e[14],y=e[3],x=e[7],b=e[11],v=e[15];return y*(+s*c*m-a*d*m-s*l*p+r*d*p+a*l*f-r*c*f)+x*(+n*c*f-n*d*p+s*o*p-a*o*f+a*d*u-s*c*u)+b*(+n*d*m-n*l*f-s*o*m+r*o*f+s*l*u-r*d*u)+v*(-a*l*u-n*c*m+n*l*p+a*o*m-r*o*p+r*c*u)}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,r){const a=this.elements;return e.isVector3?(a[12]=e.x,a[13]=e.y,a[14]=e.z):(a[12]=e,a[13]=n,a[14]=r),this}invert(){const e=this.elements,n=e[0],r=e[1],a=e[2],s=e[3],o=e[4],l=e[5],c=e[6],d=e[7],u=e[8],m=e[9],p=e[10],f=e[11],y=e[12],x=e[13],b=e[14],v=e[15],_=m*b*d-x*p*d+x*c*f-l*b*f-m*c*v+l*p*v,k=y*p*d-u*b*d-y*c*f+o*b*f+u*c*v-o*p*v,P=u*x*d-y*m*d+y*l*f-o*x*f-u*l*v+o*m*v,C=y*m*c-u*x*c-y*l*p+o*x*p+u*l*b-o*m*b,T=n*_+r*k+a*P+s*C;if(T===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const N=1/T;return e[0]=_*N,e[1]=(x*p*s-m*b*s-x*a*f+r*b*f+m*a*v-r*p*v)*N,e[2]=(l*b*s-x*c*s+x*a*d-r*b*d-l*a*v+r*c*v)*N,e[3]=(m*c*s-l*p*s-m*a*d+r*p*d+l*a*f-r*c*f)*N,e[4]=k*N,e[5]=(u*b*s-y*p*s+y*a*f-n*b*f-u*a*v+n*p*v)*N,e[6]=(y*c*s-o*b*s-y*a*d+n*b*d+o*a*v-n*c*v)*N,e[7]=(o*p*s-u*c*s+u*a*d-n*p*d-o*a*f+n*c*f)*N,e[8]=P*N,e[9]=(y*m*s-u*x*s-y*r*f+n*x*f+u*r*v-n*m*v)*N,e[10]=(o*x*s-y*l*s+y*r*d-n*x*d-o*r*v+n*l*v)*N,e[11]=(u*l*s-o*m*s-u*r*d+n*m*d+o*r*f-n*l*f)*N,e[12]=C*N,e[13]=(u*x*a-y*m*a+y*r*p-n*x*p-u*r*b+n*m*b)*N,e[14]=(y*l*a-o*x*a-y*r*c+n*x*c+o*r*b-n*l*b)*N,e[15]=(o*m*a-u*l*a+u*r*c-n*m*c-o*r*p+n*l*p)*N,this}scale(e){const n=this.elements,r=e.x,a=e.y,s=e.z;return n[0]*=r,n[4]*=a,n[8]*=s,n[1]*=r,n[5]*=a,n[9]*=s,n[2]*=r,n[6]*=a,n[10]*=s,n[3]*=r,n[7]*=a,n[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,n=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],r=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],a=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(n,r,a))}makeTranslation(e,n,r){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,r,0,0,0,1),this}makeRotationX(e){const n=Math.cos(e),r=Math.sin(e);return this.set(1,0,0,0,0,n,-r,0,0,r,n,0,0,0,0,1),this}makeRotationY(e){const n=Math.cos(e),r=Math.sin(e);return this.set(n,0,r,0,0,1,0,0,-r,0,n,0,0,0,0,1),this}makeRotationZ(e){const n=Math.cos(e),r=Math.sin(e);return this.set(n,-r,0,0,r,n,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,n){const r=Math.cos(n),a=Math.sin(n),s=1-r,o=e.x,l=e.y,c=e.z,d=s*o,u=s*l;return this.set(d*o+r,d*l-a*c,d*c+a*l,0,d*l+a*c,u*l+r,u*c-a*o,0,d*c-a*l,u*c+a*o,s*c*c+r,0,0,0,0,1),this}makeScale(e,n,r){return this.set(e,0,0,0,0,n,0,0,0,0,r,0,0,0,0,1),this}makeShear(e,n,r,a,s,o){return this.set(1,r,s,0,e,1,o,0,n,a,1,0,0,0,0,1),this}compose(e,n,r){const a=this.elements,s=n._x,o=n._y,l=n._z,c=n._w,d=s+s,u=o+o,m=l+l,p=s*d,f=s*u,y=s*m,x=o*u,b=o*m,v=l*m,_=c*d,k=c*u,P=c*m,C=r.x,T=r.y,N=r.z;return a[0]=(1-(x+v))*C,a[1]=(f+P)*C,a[2]=(y-k)*C,a[3]=0,a[4]=(f-P)*T,a[5]=(1-(p+v))*T,a[6]=(b+_)*T,a[7]=0,a[8]=(y+k)*N,a[9]=(b-_)*N,a[10]=(1-(p+x))*N,a[11]=0,a[12]=e.x,a[13]=e.y,a[14]=e.z,a[15]=1,this}decompose(e,n,r){const a=this.elements;let s=ug.set(a[0],a[1],a[2]).length();const o=ug.set(a[4],a[5],a[6]).length(),l=ug.set(a[8],a[9],a[10]).length();this.determinant()<0&&(s=-s),e.x=a[12],e.y=a[13],e.z=a[14],zl.copy(this);const d=1/s,u=1/o,m=1/l;return zl.elements[0]*=d,zl.elements[1]*=d,zl.elements[2]*=d,zl.elements[4]*=u,zl.elements[5]*=u,zl.elements[6]*=u,zl.elements[8]*=m,zl.elements[9]*=m,zl.elements[10]*=m,n.setFromRotationMatrix(zl),r.x=s,r.y=o,r.z=l,this}makePerspective(e,n,r,a,s,o,l=Dc,c=!1){const d=this.elements,u=2*s/(n-e),m=2*s/(r-a),p=(n+e)/(n-e),f=(r+a)/(r-a);let y,x;if(c)y=s/(o-s),x=o*s/(o-s);else if(l===Dc)y=-(o+s)/(o-s),x=-2*o*s/(o-s);else if(l===X1)y=-o/(o-s),x=-o*s/(o-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+l);return d[0]=u,d[4]=0,d[8]=p,d[12]=0,d[1]=0,d[5]=m,d[9]=f,d[13]=0,d[2]=0,d[6]=0,d[10]=y,d[14]=x,d[3]=0,d[7]=0,d[11]=-1,d[15]=0,this}makeOrthographic(e,n,r,a,s,o,l=Dc,c=!1){const d=this.elements,u=2/(n-e),m=2/(r-a),p=-(n+e)/(n-e),f=-(r+a)/(r-a);let y,x;if(c)y=1/(o-s),x=o/(o-s);else if(l===Dc)y=-2/(o-s),x=-(o+s)/(o-s);else if(l===X1)y=-1/(o-s),x=-s/(o-s);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+l);return d[0]=u,d[4]=0,d[8]=0,d[12]=p,d[1]=0,d[5]=m,d[9]=0,d[13]=f,d[2]=0,d[6]=0,d[10]=y,d[14]=x,d[3]=0,d[7]=0,d[11]=0,d[15]=1,this}equals(e){const n=this.elements,r=e.elements;for(let a=0;a<16;a++)if(n[a]!==r[a])return!1;return!0}fromArray(e,n=0){for(let r=0;r<16;r++)this.elements[r]=e[r+n];return this}toArray(e=[],n=0){const r=this.elements;return e[n]=r[0],e[n+1]=r[1],e[n+2]=r[2],e[n+3]=r[3],e[n+4]=r[4],e[n+5]=r[5],e[n+6]=r[6],e[n+7]=r[7],e[n+8]=r[8],e[n+9]=r[9],e[n+10]=r[10],e[n+11]=r[11],e[n+12]=r[12],e[n+13]=r[13],e[n+14]=r[14],e[n+15]=r[15],e}};const ug=new wt,zl=new oa,Sxe=new wt(0,0,0),_xe=new wt(1,1,1),em=new wt,MS=new wt,ko=new wt,w8=new oa,S8=new Yp;let ah=class PX{constructor(e=0,n=0,r=0,a=PX.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=n,this._z=r,this._order=a}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,r,a=this._order){return this._x=e,this._y=n,this._z=r,this._order=a,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,r=!0){const a=e.elements,s=a[0],o=a[4],l=a[8],c=a[1],d=a[5],u=a[9],m=a[2],p=a[6],f=a[10];switch(n){case"XYZ":this._y=Math.asin(or(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-u,f),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(p,d),this._z=0);break;case"YXZ":this._x=Math.asin(-or(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(l,f),this._z=Math.atan2(c,d)):(this._y=Math.atan2(-m,s),this._z=0);break;case"ZXY":this._x=Math.asin(or(p,-1,1)),Math.abs(p)<.9999999?(this._y=Math.atan2(-m,f),this._z=Math.atan2(-o,d)):(this._y=0,this._z=Math.atan2(c,s));break;case"ZYX":this._y=Math.asin(-or(m,-1,1)),Math.abs(m)<.9999999?(this._x=Math.atan2(p,f),this._z=Math.atan2(c,s)):(this._x=0,this._z=Math.atan2(-o,d));break;case"YZX":this._z=Math.asin(or(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(-u,d),this._y=Math.atan2(-m,s)):(this._x=0,this._y=Math.atan2(l,f));break;case"XZY":this._z=Math.asin(-or(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(p,d),this._y=Math.atan2(l,s)):(this._x=Math.atan2(-u,f),this._y=0);break;default:Mn("Euler: .setFromRotationMatrix() encountered an unknown order: "+n)}return this._order=n,r===!0&&this._onChangeCallback(),this}setFromQuaternion(e,n,r){return w8.makeRotationFromQuaternion(e),this.setFromRotationMatrix(w8,n,r)}setFromVector3(e,n=this._order){return this.set(e.x,e.y,e.z,n)}reorder(e){return S8.setFromEuler(this),this.setFromQuaternion(S8,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}};ah.DEFAULT_ORDER="XYZ";let AX=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}},kxe=0;const _8=new wt,mg=new Yp,Sd=new oa,ES=new wt,wy=new wt,Nxe=new wt,Cxe=new Yp,k8=new wt(1,0,0),N8=new wt(0,1,0),C8=new wt(0,0,1),T8={type:"added"},Txe={type:"removed"},hg={type:"childadded",child:null},bM={type:"childremoved",child:null};let Io=class b1 extends xf{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:kxe++}),this.uuid=L0(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=b1.DEFAULT_UP.clone();const e=new wt,n=new ah,r=new Yp,a=new wt(1,1,1);function s(){r.setFromEuler(n,!1)}function o(){n.setFromQuaternion(r,void 0,!1)}n._onChange(s),r._onChange(o),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:n},quaternion:{configurable:!0,enumerable:!0,value:r},scale:{configurable:!0,enumerable:!0,value:a},modelViewMatrix:{value:new oa},normalMatrix:{value:new Qn}}),this.matrix=new oa,this.matrixWorld=new oa,this.matrixAutoUpdate=b1.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=b1.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new AX,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 mg.setFromAxisAngle(e,n),this.quaternion.multiply(mg),this}rotateOnWorldAxis(e,n){return mg.setFromAxisAngle(e,n),this.quaternion.premultiply(mg),this}rotateX(e){return this.rotateOnAxis(k8,e)}rotateY(e){return this.rotateOnAxis(N8,e)}rotateZ(e){return this.rotateOnAxis(C8,e)}translateOnAxis(e,n){return _8.copy(e).applyQuaternion(this.quaternion),this.position.add(_8.multiplyScalar(n)),this}translateX(e){return this.translateOnAxis(k8,e)}translateY(e){return this.translateOnAxis(N8,e)}translateZ(e){return this.translateOnAxis(C8,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(Sd.copy(this.matrixWorld).invert())}lookAt(e,n,r){e.isVector3?ES.copy(e):ES.set(e,n,r);const a=this.parent;this.updateWorldMatrix(!0,!1),wy.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Sd.lookAt(wy,ES,this.up):Sd.lookAt(ES,wy,this.up),this.quaternion.setFromRotationMatrix(Sd),a&&(Sd.extractRotation(a.matrixWorld),mg.setFromRotationMatrix(Sd),this.quaternion.premultiply(mg.invert()))}add(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.add(arguments[n]);return this}return e===this?($i("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(T8),hg.child=e,this.dispatchEvent(hg),hg.child=null):$i("Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let r=0;r<arguments.length;r++)this.remove(arguments[r]);return this}const n=this.children.indexOf(e);return n!==-1&&(e.parent=null,this.children.splice(n,1),e.dispatchEvent(Txe),bM.child=e,this.dispatchEvent(bM),bM.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),Sd.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),Sd.multiply(e.parent.matrixWorld)),e.applyMatrix4(Sd),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(T8),hg.child=e,this.dispatchEvent(hg),hg.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 r=0,a=this.children.length;r<a;r++){const o=this.children[r].getObjectByProperty(e,n);if(o!==void 0)return o}}getObjectsByProperty(e,n,r=[]){this[e]===n&&r.push(this);const a=this.children;for(let s=0,o=a.length;s<o;s++)a[s].getObjectsByProperty(e,n,r);return r}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(wy,e,Nxe),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(wy,Cxe,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 r=0,a=n.length;r<a;r++)n[r].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const n=this.children;for(let r=0,a=n.length;r<a;r++)n[r].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 r=0,a=n.length;r<a;r++)n[r].updateMatrixWorld(e)}updateWorldMatrix(e,n){const r=this.parent;if(e===!0&&r!==null&&r.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 a=this.children;for(let s=0,o=a.length;s<o;s++)a[s].updateWorldMatrix(!1,!0)}}toJSON(e){const n=e===void 0||typeof e=="string",r={};n&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},r.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});const a={};a.uuid=this.uuid,a.type=this.type,this.name!==""&&(a.name=this.name),this.castShadow===!0&&(a.castShadow=!0),this.receiveShadow===!0&&(a.receiveShadow=!0),this.visible===!1&&(a.visible=!1),this.frustumCulled===!1&&(a.frustumCulled=!1),this.renderOrder!==0&&(a.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(a.userData=this.userData),a.layers=this.layers.mask,a.matrix=this.matrix.toArray(),a.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(a.matrixAutoUpdate=!1),this.isInstancedMesh&&(a.type="InstancedMesh",a.count=this.count,a.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(a.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(a.type="BatchedMesh",a.perObjectFrustumCulled=this.perObjectFrustumCulled,a.sortObjects=this.sortObjects,a.drawRanges=this._drawRanges,a.reservedRanges=this._reservedRanges,a.geometryInfo=this._geometryInfo.map(l=>({...l,boundingBox:l.boundingBox?l.boundingBox.toJSON():void 0,boundingSphere:l.boundingSphere?l.boundingSphere.toJSON():void 0})),a.instanceInfo=this._instanceInfo.map(l=>({...l})),a.availableInstanceIds=this._availableInstanceIds.slice(),a.availableGeometryIds=this._availableGeometryIds.slice(),a.nextIndexStart=this._nextIndexStart,a.nextVertexStart=this._nextVertexStart,a.geometryCount=this._geometryCount,a.maxInstanceCount=this._maxInstanceCount,a.maxVertexCount=this._maxVertexCount,a.maxIndexCount=this._maxIndexCount,a.geometryInitialized=this._geometryInitialized,a.matricesTexture=this._matricesTexture.toJSON(e),a.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(a.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(a.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(a.boundingBox=this.boundingBox.toJSON()));function s(l,c){return l[c.uuid]===void 0&&(l[c.uuid]=c.toJSON(e)),c.uuid}if(this.isScene)this.background&&(this.background.isColor?a.background=this.background.toJSON():this.background.isTexture&&(a.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(a.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){a.geometry=s(e.geometries,this.geometry);const l=this.geometry.parameters;if(l!==void 0&&l.shapes!==void 0){const c=l.shapes;if(Array.isArray(c))for(let d=0,u=c.length;d<u;d++){const m=c[d];s(e.shapes,m)}else s(e.shapes,c)}}if(this.isSkinnedMesh&&(a.bindMode=this.bindMode,a.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(e.skeletons,this.skeleton),a.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const l=[];for(let c=0,d=this.material.length;c<d;c++)l.push(s(e.materials,this.material[c]));a.material=l}else a.material=s(e.materials,this.material);if(this.children.length>0){a.children=[];for(let l=0;l<this.children.length;l++)a.children.push(this.children[l].toJSON(e).object)}if(this.animations.length>0){a.animations=[];for(let l=0;l<this.animations.length;l++){const c=this.animations[l];a.animations.push(s(e.animations,c))}}if(n){const l=o(e.geometries),c=o(e.materials),d=o(e.textures),u=o(e.images),m=o(e.shapes),p=o(e.skeletons),f=o(e.animations),y=o(e.nodes);l.length>0&&(r.geometries=l),c.length>0&&(r.materials=c),d.length>0&&(r.textures=d),u.length>0&&(r.images=u),m.length>0&&(r.shapes=m),p.length>0&&(r.skeletons=p),f.length>0&&(r.animations=f),y.length>0&&(r.nodes=y)}return r.object=a,r;function o(l){const c=[];for(const d in l){const u=l[d];delete u.metadata,c.push(u)}return c}}clone(e){return new this.constructor().copy(this,e)}copy(e,n=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),n===!0)for(let r=0;r<e.children.length;r++){const a=e.children[r];this.add(a.clone())}return this}};Io.DEFAULT_UP=new wt(0,1,0);Io.DEFAULT_MATRIX_AUTO_UPDATE=!0;Io.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const Ul=new wt,_d=new wt,xM=new wt,kd=new wt,pg=new wt,fg=new wt,P8=new wt,yM=new wt,vM=new wt,wM=new wt,SM=new na,_M=new na,kM=new na;let Sy=class Qg{constructor(e=new wt,n=new wt,r=new wt){this.a=e,this.b=n,this.c=r}static getNormal(e,n,r,a){a.subVectors(r,n),Ul.subVectors(e,n),a.cross(Ul);const s=a.lengthSq();return s>0?a.multiplyScalar(1/Math.sqrt(s)):a.set(0,0,0)}static getBarycoord(e,n,r,a,s){Ul.subVectors(a,n),_d.subVectors(r,n),xM.subVectors(e,n);const o=Ul.dot(Ul),l=Ul.dot(_d),c=Ul.dot(xM),d=_d.dot(_d),u=_d.dot(xM),m=o*d-l*l;if(m===0)return s.set(0,0,0),null;const p=1/m,f=(d*c-l*u)*p,y=(o*u-l*c)*p;return s.set(1-f-y,y,f)}static containsPoint(e,n,r,a){return this.getBarycoord(e,n,r,a,kd)===null?!1:kd.x>=0&&kd.y>=0&&kd.x+kd.y<=1}static getInterpolation(e,n,r,a,s,o,l,c){return this.getBarycoord(e,n,r,a,kd)===null?(c.x=0,c.y=0,"z"in c&&(c.z=0),"w"in c&&(c.w=0),null):(c.setScalar(0),c.addScaledVector(s,kd.x),c.addScaledVector(o,kd.y),c.addScaledVector(l,kd.z),c)}static getInterpolatedAttribute(e,n,r,a,s,o){return SM.setScalar(0),_M.setScalar(0),kM.setScalar(0),SM.fromBufferAttribute(e,n),_M.fromBufferAttribute(e,r),kM.fromBufferAttribute(e,a),o.setScalar(0),o.addScaledVector(SM,s.x),o.addScaledVector(_M,s.y),o.addScaledVector(kM,s.z),o}static isFrontFacing(e,n,r,a){return Ul.subVectors(r,n),_d.subVectors(e,n),Ul.cross(_d).dot(a)<0}set(e,n,r){return this.a.copy(e),this.b.copy(n),this.c.copy(r),this}setFromPointsAndIndices(e,n,r,a){return this.a.copy(e[n]),this.b.copy(e[r]),this.c.copy(e[a]),this}setFromAttributeAndIndices(e,n,r,a){return this.a.fromBufferAttribute(e,n),this.b.fromBufferAttribute(e,r),this.c.fromBufferAttribute(e,a),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 Ul.subVectors(this.c,this.b),_d.subVectors(this.a,this.b),Ul.cross(_d).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Qg.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,n){return Qg.getBarycoord(e,this.a,this.b,this.c,n)}getInterpolation(e,n,r,a,s){return Qg.getInterpolation(e,this.a,this.b,this.c,n,r,a,s)}containsPoint(e){return Qg.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Qg.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,n){const r=this.a,a=this.b,s=this.c;let o,l;pg.subVectors(a,r),fg.subVectors(s,r),yM.subVectors(e,r);const c=pg.dot(yM),d=fg.dot(yM);if(c<=0&&d<=0)return n.copy(r);vM.subVectors(e,a);const u=pg.dot(vM),m=fg.dot(vM);if(u>=0&&m<=u)return n.copy(a);const p=c*m-u*d;if(p<=0&&c>=0&&u<=0)return o=c/(c-u),n.copy(r).addScaledVector(pg,o);wM.subVectors(e,s);const f=pg.dot(wM),y=fg.dot(wM);if(y>=0&&f<=y)return n.copy(s);const x=f*d-c*y;if(x<=0&&d>=0&&y<=0)return l=d/(d-y),n.copy(r).addScaledVector(fg,l);const b=u*y-f*m;if(b<=0&&m-u>=0&&f-y>=0)return P8.subVectors(s,a),l=(m-u)/(m-u+(f-y)),n.copy(a).addScaledVector(P8,l);const v=1/(b+x+p);return o=x*v,l=p*v,n.copy(r).addScaledVector(pg,o).addScaledVector(fg,l)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}};const MX={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},tm={h:0,s:0,l:0},jS={h:0,s:0,l:0};function NM(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 Zn=class{constructor(e,n,r){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,n,r)}set(e,n,r){if(n===void 0&&r===void 0){const a=e;a&&a.isColor?this.copy(a):typeof a=="number"?this.setHex(a):typeof a=="string"&&this.setStyle(a)}else this.setRGB(e,n,r);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,n=Po){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,xr.colorSpaceToWorking(this,n),this}setRGB(e,n,r,a=xr.workingColorSpace){return this.r=e,this.g=n,this.b=r,xr.colorSpaceToWorking(this,a),this}setHSL(e,n,r,a=xr.workingColorSpace){if(e=hxe(e,1),n=or(n,0,1),r=or(r,0,1),n===0)this.r=this.g=this.b=r;else{const s=r<=.5?r*(1+n):r+n-r*n,o=2*r-s;this.r=NM(o,s,e+1/3),this.g=NM(o,s,e),this.b=NM(o,s,e-1/3)}return xr.colorSpaceToWorking(this,a),this}setStyle(e,n=Po){function r(s){s!==void 0&&parseFloat(s)<1&&Mn("Color: Alpha component of "+e+" will be ignored.")}let a;if(a=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const o=a[1],l=a[2];switch(o){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(l))return r(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,n);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(l))return r(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,n);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(l))return r(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,n);break;default:Mn("Color: Unknown color model "+e)}}else if(a=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=a[1],o=s.length;if(o===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,n);if(o===6)return this.setHex(parseInt(s,16),n);Mn("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,n);return this}setColorName(e,n=Po){const r=MX[e.toLowerCase()];return r!==void 0?this.setHex(r,n):Mn("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=Jd(e.r),this.g=Jd(e.g),this.b=Jd(e.b),this}copyLinearToSRGB(e){return this.r=bb(e.r),this.g=bb(e.g),this.b=bb(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Po){return xr.workingToColorSpace(as.copy(this),e),Math.round(or(as.r*255,0,255))*65536+Math.round(or(as.g*255,0,255))*256+Math.round(or(as.b*255,0,255))}getHexString(e=Po){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,n=xr.workingColorSpace){xr.workingToColorSpace(as.copy(this),n);const r=as.r,a=as.g,s=as.b,o=Math.max(r,a,s),l=Math.min(r,a,s);let c,d;const u=(l+o)/2;if(l===o)c=0,d=0;else{const m=o-l;switch(d=u<=.5?m/(o+l):m/(2-o-l),o){case r:c=(a-s)/m+(a<s?6:0);break;case a:c=(s-r)/m+2;break;case s:c=(r-a)/m+4;break}c/=6}return e.h=c,e.s=d,e.l=u,e}getRGB(e,n=xr.workingColorSpace){return xr.workingToColorSpace(as.copy(this),n),e.r=as.r,e.g=as.g,e.b=as.b,e}getStyle(e=Po){xr.workingToColorSpace(as.copy(this),e);const n=as.r,r=as.g,a=as.b;return e!==Po?`color(${e} ${n.toFixed(3)} ${r.toFixed(3)} ${a.toFixed(3)})`:`rgb(${Math.round(n*255)},${Math.round(r*255)},${Math.round(a*255)})`}offsetHSL(e,n,r){return this.getHSL(tm),this.setHSL(tm.h+e,tm.s+n,tm.l+r)}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,r){return this.r=e.r+(n.r-e.r)*r,this.g=e.g+(n.g-e.g)*r,this.b=e.b+(n.b-e.b)*r,this}lerpHSL(e,n){this.getHSL(tm),e.getHSL(jS);const r=oM(tm.h,jS.h,n),a=oM(tm.s,jS.s,n),s=oM(tm.l,jS.l,n);return this.setHSL(r,a,s),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const n=this.r,r=this.g,a=this.b,s=e.elements;return this.r=s[0]*n+s[3]*r+s[6]*a,this.g=s[1]*n+s[4]*r+s[7]*a,this.b=s[2]*n+s[5]*r+s[8]*a,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 as=new Zn;Zn.NAMES=MX;let Pxe=0,mx=class extends xf{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:Pxe++}),this.uuid=L0(),this.name="",this.type="Material",this.blending=gb,this.side=ih,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=DD,this.blendDst=RD,this.blendEquation=sp,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Zn(0,0,0),this.blendAlpha=0,this.depthFunc=Db,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=h8,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=sg,this.stencilZFail=sg,this.stencilZPass=sg,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 r=e[n];if(r===void 0){Mn(`Material: parameter '${n}' has value of undefined.`);continue}const a=this[n];if(a===void 0){Mn(`Material: '${n}' is not a property of THREE.${this.type}.`);continue}a&&a.isColor?a.set(r):a&&a.isVector3&&r&&r.isVector3?a.copy(r):this[n]=r}}toJSON(e){const n=e===void 0||typeof e=="string";n&&(e={textures:{},images:{}});const r={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.color&&this.color.isColor&&(r.color=this.color.getHex()),this.roughness!==void 0&&(r.roughness=this.roughness),this.metalness!==void 0&&(r.metalness=this.metalness),this.sheen!==void 0&&(r.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(r.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(r.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(r.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(r.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(r.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(r.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(r.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(r.shininess=this.shininess),this.clearcoat!==void 0&&(r.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(r.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(r.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(r.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(r.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,r.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(r.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(r.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(r.dispersion=this.dispersion),this.iridescence!==void 0&&(r.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(r.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(r.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(r.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(r.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(r.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(r.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(r.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(r.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(r.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(r.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(r.lightMap=this.lightMap.toJSON(e).uuid,r.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(r.aoMap=this.aoMap.toJSON(e).uuid,r.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(r.bumpMap=this.bumpMap.toJSON(e).uuid,r.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(r.normalMap=this.normalMap.toJSON(e).uuid,r.normalMapType=this.normalMapType,r.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(r.displacementMap=this.displacementMap.toJSON(e).uuid,r.displacementScale=this.displacementScale,r.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(r.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(r.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(r.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(r.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(r.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(r.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(r.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(r.combine=this.combine)),this.envMapRotation!==void 0&&(r.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(r.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(r.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(r.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(r.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(r.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(r.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(r.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(r.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(r.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(r.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(r.size=this.size),this.shadowSide!==null&&(r.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(r.sizeAttenuation=this.sizeAttenuation),this.blending!==gb&&(r.blending=this.blending),this.side!==ih&&(r.side=this.side),this.vertexColors===!0&&(r.vertexColors=!0),this.opacity<1&&(r.opacity=this.opacity),this.transparent===!0&&(r.transparent=!0),this.blendSrc!==DD&&(r.blendSrc=this.blendSrc),this.blendDst!==RD&&(r.blendDst=this.blendDst),this.blendEquation!==sp&&(r.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(r.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(r.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(r.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(r.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(r.blendAlpha=this.blendAlpha),this.depthFunc!==Db&&(r.depthFunc=this.depthFunc),this.depthTest===!1&&(r.depthTest=this.depthTest),this.depthWrite===!1&&(r.depthWrite=this.depthWrite),this.colorWrite===!1&&(r.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(r.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==h8&&(r.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(r.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(r.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==sg&&(r.stencilFail=this.stencilFail),this.stencilZFail!==sg&&(r.stencilZFail=this.stencilZFail),this.stencilZPass!==sg&&(r.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(r.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(r.rotation=this.rotation),this.polygonOffset===!0&&(r.polygonOffset=!0),this.polygonOffsetFactor!==0&&(r.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(r.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(r.linewidth=this.linewidth),this.dashSize!==void 0&&(r.dashSize=this.dashSize),this.gapSize!==void 0&&(r.gapSize=this.gapSize),this.scale!==void 0&&(r.scale=this.scale),this.dithering===!0&&(r.dithering=!0),this.alphaTest>0&&(r.alphaTest=this.alphaTest),this.alphaHash===!0&&(r.alphaHash=!0),this.alphaToCoverage===!0&&(r.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(r.premultipliedAlpha=!0),this.forceSinglePass===!0&&(r.forceSinglePass=!0),this.wireframe===!0&&(r.wireframe=!0),this.wireframeLinewidth>1&&(r.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(r.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(r.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(r.flatShading=!0),this.visible===!1&&(r.visible=!1),this.toneMapped===!1&&(r.toneMapped=!1),this.fog===!1&&(r.fog=!1),Object.keys(this.userData).length>0&&(r.userData=this.userData);function a(s){const o=[];for(const l in s){const c=s[l];delete c.metadata,o.push(c)}return o}if(n){const s=a(e.textures),o=a(e.images);s.length>0&&(r.textures=s),o.length>0&&(r.images=o)}return r}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.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 r=null;if(n!==null){const a=n.length;r=new Array(a);for(let s=0;s!==a;++s)r[s]=n[s].clone()}return this.clippingPlanes=r,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.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++}},mL=class extends mx{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Zn(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 ah,this.combine=nL,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 ea=new wt,DS=new Kn;let Axe=0,Ls=class{constructor(e,n,r=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:Axe++}),this.name="",this.array=e,this.itemSize=n,this.count=e!==void 0?e.length/n:0,this.normalized=r,this.usage=p8,this.updateRanges=[],this.gpuType=Gd,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,r){e*=this.itemSize,r*=n.itemSize;for(let a=0,s=this.itemSize;a<s;a++)this.array[e+a]=n.array[r+a];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let n=0,r=this.count;n<r;n++)DS.fromBufferAttribute(this,n),DS.applyMatrix3(e),this.setXY(n,DS.x,DS.y);else if(this.itemSize===3)for(let n=0,r=this.count;n<r;n++)ea.fromBufferAttribute(this,n),ea.applyMatrix3(e),this.setXYZ(n,ea.x,ea.y,ea.z);return this}applyMatrix4(e){for(let n=0,r=this.count;n<r;n++)ea.fromBufferAttribute(this,n),ea.applyMatrix4(e),this.setXYZ(n,ea.x,ea.y,ea.z);return this}applyNormalMatrix(e){for(let n=0,r=this.count;n<r;n++)ea.fromBufferAttribute(this,n),ea.applyNormalMatrix(e),this.setXYZ(n,ea.x,ea.y,ea.z);return this}transformDirection(e){for(let n=0,r=this.count;n<r;n++)ea.fromBufferAttribute(this,n),ea.transformDirection(e),this.setXYZ(n,ea.x,ea.y,ea.z);return this}set(e,n=0){return this.array.set(e,n),this}getComponent(e,n){let r=this.array[e*this.itemSize+n];return this.normalized&&(r=xy(r,this.array)),r}setComponent(e,n,r){return this.normalized&&(r=Qs(r,this.array)),this.array[e*this.itemSize+n]=r,this}getX(e){let n=this.array[e*this.itemSize];return this.normalized&&(n=xy(n,this.array)),n}setX(e,n){return this.normalized&&(n=Qs(n,this.array)),this.array[e*this.itemSize]=n,this}getY(e){let n=this.array[e*this.itemSize+1];return this.normalized&&(n=xy(n,this.array)),n}setY(e,n){return this.normalized&&(n=Qs(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=xy(n,this.array)),n}setZ(e,n){return this.normalized&&(n=Qs(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=xy(n,this.array)),n}setW(e,n){return this.normalized&&(n=Qs(n,this.array)),this.array[e*this.itemSize+3]=n,this}setXY(e,n,r){return e*=this.itemSize,this.normalized&&(n=Qs(n,this.array),r=Qs(r,this.array)),this.array[e+0]=n,this.array[e+1]=r,this}setXYZ(e,n,r,a){return e*=this.itemSize,this.normalized&&(n=Qs(n,this.array),r=Qs(r,this.array),a=Qs(a,this.array)),this.array[e+0]=n,this.array[e+1]=r,this.array[e+2]=a,this}setXYZW(e,n,r,a,s){return e*=this.itemSize,this.normalized&&(n=Qs(n,this.array),r=Qs(r,this.array),a=Qs(a,this.array),s=Qs(s,this.array)),this.array[e+0]=n,this.array[e+1]=r,this.array[e+2]=a,this.array[e+3]=s,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!==p8&&(e.usage=this.usage),e}},EX=class extends Ls{constructor(e,n,r){super(new Uint16Array(e),n,r)}},jX=class extends Ls{constructor(e,n,r){super(new Uint32Array(e),n,r)}},Ro=class extends Ls{constructor(e,n,r){super(new Float32Array(e),n,r)}},Mxe=0;const Yo=new oa,CM=new Io,gg=new wt,No=new Wm,_y=new Wm,Ta=new wt;let _l=class DX extends xf{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:Mxe++}),this.uuid=L0(),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(SX(e)?jX:EX)(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,r=0){this.groups.push({start:e,count:n,materialIndex:r})}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 r=this.attributes.normal;if(r!==void 0){const s=new Qn().getNormalMatrix(e);r.applyNormalMatrix(s),r.needsUpdate=!0}const a=this.attributes.tangent;return a!==void 0&&(a.transformDirection(e),a.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return Yo.makeRotationFromQuaternion(e),this.applyMatrix4(Yo),this}rotateX(e){return Yo.makeRotationX(e),this.applyMatrix4(Yo),this}rotateY(e){return Yo.makeRotationY(e),this.applyMatrix4(Yo),this}rotateZ(e){return Yo.makeRotationZ(e),this.applyMatrix4(Yo),this}translate(e,n,r){return Yo.makeTranslation(e,n,r),this.applyMatrix4(Yo),this}scale(e,n,r){return Yo.makeScale(e,n,r),this.applyMatrix4(Yo),this}lookAt(e){return CM.lookAt(e),CM.updateMatrix(),this.applyMatrix4(CM.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(gg).negate(),this.translate(gg.x,gg.y,gg.z),this}setFromPoints(e){const n=this.getAttribute("position");if(n===void 0){const r=[];for(let a=0,s=e.length;a<s;a++){const o=e[a];r.push(o.x,o.y,o.z||0)}this.setAttribute("position",new Ro(r,3))}else{const r=Math.min(e.length,n.count);for(let a=0;a<r;a++){const s=e[a];n.setXYZ(a,s.x,s.y,s.z||0)}e.length>n.count&&Mn("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 Wm);const e=this.attributes.position,n=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){$i("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new wt(-1/0,-1/0,-1/0),new wt(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),n)for(let r=0,a=n.length;r<a;r++){const s=n[r];No.setFromBufferAttribute(s),this.morphTargetsRelative?(Ta.addVectors(this.boundingBox.min,No.min),this.boundingBox.expandByPoint(Ta),Ta.addVectors(this.boundingBox.max,No.max),this.boundingBox.expandByPoint(Ta)):(this.boundingBox.expandByPoint(No.min),this.boundingBox.expandByPoint(No.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&$i('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 wC);const e=this.attributes.position,n=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){$i("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new wt,1/0);return}if(e){const r=this.boundingSphere.center;if(No.setFromBufferAttribute(e),n)for(let s=0,o=n.length;s<o;s++){const l=n[s];_y.setFromBufferAttribute(l),this.morphTargetsRelative?(Ta.addVectors(No.min,_y.min),No.expandByPoint(Ta),Ta.addVectors(No.max,_y.max),No.expandByPoint(Ta)):(No.expandByPoint(_y.min),No.expandByPoint(_y.max))}No.getCenter(r);let a=0;for(let s=0,o=e.count;s<o;s++)Ta.fromBufferAttribute(e,s),a=Math.max(a,r.distanceToSquared(Ta));if(n)for(let s=0,o=n.length;s<o;s++){const l=n[s],c=this.morphTargetsRelative;for(let d=0,u=l.count;d<u;d++)Ta.fromBufferAttribute(l,d),c&&(gg.fromBufferAttribute(e,d),Ta.add(gg)),a=Math.max(a,r.distanceToSquared(Ta))}this.boundingSphere.radius=Math.sqrt(a),isNaN(this.boundingSphere.radius)&&$i('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){$i("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const r=n.position,a=n.normal,s=n.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new Ls(new Float32Array(4*r.count),4));const o=this.getAttribute("tangent"),l=[],c=[];for(let R=0;R<r.count;R++)l[R]=new wt,c[R]=new wt;const d=new wt,u=new wt,m=new wt,p=new Kn,f=new Kn,y=new Kn,x=new wt,b=new wt;function v(R,A,D){d.fromBufferAttribute(r,R),u.fromBufferAttribute(r,A),m.fromBufferAttribute(r,D),p.fromBufferAttribute(s,R),f.fromBufferAttribute(s,A),y.fromBufferAttribute(s,D),u.sub(d),m.sub(d),f.sub(p),y.sub(p);const $=1/(f.x*y.y-y.x*f.y);isFinite($)&&(x.copy(u).multiplyScalar(y.y).addScaledVector(m,-f.y).multiplyScalar($),b.copy(m).multiplyScalar(f.x).addScaledVector(u,-y.x).multiplyScalar($),l[R].add(x),l[A].add(x),l[D].add(x),c[R].add(b),c[A].add(b),c[D].add(b))}let _=this.groups;_.length===0&&(_=[{start:0,count:e.count}]);for(let R=0,A=_.length;R<A;++R){const D=_[R],$=D.start,U=D.count;for(let G=$,L=$+U;G<L;G+=3)v(e.getX(G+0),e.getX(G+1),e.getX(G+2))}const k=new wt,P=new wt,C=new wt,T=new wt;function N(R){C.fromBufferAttribute(a,R),T.copy(C);const A=l[R];k.copy(A),k.sub(C.multiplyScalar(C.dot(A))).normalize(),P.crossVectors(T,A);const $=P.dot(c[R])<0?-1:1;o.setXYZW(R,k.x,k.y,k.z,$)}for(let R=0,A=_.length;R<A;++R){const D=_[R],$=D.start,U=D.count;for(let G=$,L=$+U;G<L;G+=3)N(e.getX(G+0)),N(e.getX(G+1)),N(e.getX(G+2))}}computeVertexNormals(){const e=this.index,n=this.getAttribute("position");if(n!==void 0){let r=this.getAttribute("normal");if(r===void 0)r=new Ls(new Float32Array(n.count*3),3),this.setAttribute("normal",r);else for(let p=0,f=r.count;p<f;p++)r.setXYZ(p,0,0,0);const a=new wt,s=new wt,o=new wt,l=new wt,c=new wt,d=new wt,u=new wt,m=new wt;if(e)for(let p=0,f=e.count;p<f;p+=3){const y=e.getX(p+0),x=e.getX(p+1),b=e.getX(p+2);a.fromBufferAttribute(n,y),s.fromBufferAttribute(n,x),o.fromBufferAttribute(n,b),u.subVectors(o,s),m.subVectors(a,s),u.cross(m),l.fromBufferAttribute(r,y),c.fromBufferAttribute(r,x),d.fromBufferAttribute(r,b),l.add(u),c.add(u),d.add(u),r.setXYZ(y,l.x,l.y,l.z),r.setXYZ(x,c.x,c.y,c.z),r.setXYZ(b,d.x,d.y,d.z)}else for(let p=0,f=n.count;p<f;p+=3)a.fromBufferAttribute(n,p+0),s.fromBufferAttribute(n,p+1),o.fromBufferAttribute(n,p+2),u.subVectors(o,s),m.subVectors(a,s),u.cross(m),r.setXYZ(p+0,u.x,u.y,u.z),r.setXYZ(p+1,u.x,u.y,u.z),r.setXYZ(p+2,u.x,u.y,u.z);this.normalizeNormals(),r.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let n=0,r=e.count;n<r;n++)Ta.fromBufferAttribute(e,n),Ta.normalize(),e.setXYZ(n,Ta.x,Ta.y,Ta.z)}toNonIndexed(){function e(l,c){const d=l.array,u=l.itemSize,m=l.normalized,p=new d.constructor(c.length*u);let f=0,y=0;for(let x=0,b=c.length;x<b;x++){l.isInterleavedBufferAttribute?f=c[x]*l.data.stride+l.offset:f=c[x]*u;for(let v=0;v<u;v++)p[y++]=d[f++]}return new Ls(p,u,m)}if(this.index===null)return Mn("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const n=new DX,r=this.index.array,a=this.attributes;for(const l in a){const c=a[l],d=e(c,r);n.setAttribute(l,d)}const s=this.morphAttributes;for(const l in s){const c=[],d=s[l];for(let u=0,m=d.length;u<m;u++){const p=d[u],f=e(p,r);c.push(f)}n.morphAttributes[l]=c}n.morphTargetsRelative=this.morphTargetsRelative;const o=this.groups;for(let l=0,c=o.length;l<c;l++){const d=o[l];n.addGroup(d.start,d.count,d.materialIndex)}return n}toJSON(){const e={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){const c=this.parameters;for(const d in c)c[d]!==void 0&&(e[d]=c[d]);return e}e.data={attributes:{}};const n=this.index;n!==null&&(e.data.index={type:n.array.constructor.name,array:Array.prototype.slice.call(n.array)});const r=this.attributes;for(const c in r){const d=r[c];e.data.attributes[c]=d.toJSON(e.data)}const a={};let s=!1;for(const c in this.morphAttributes){const d=this.morphAttributes[c],u=[];for(let m=0,p=d.length;m<p;m++){const f=d[m];u.push(f.toJSON(e.data))}u.length>0&&(a[c]=u,s=!0)}s&&(e.data.morphAttributes=a,e.data.morphTargetsRelative=this.morphTargetsRelative);const o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));const l=this.boundingSphere;return l!==null&&(e.data.boundingSphere=l.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const n={};this.name=e.name;const r=e.index;r!==null&&this.setIndex(r.clone());const a=e.attributes;for(const d in a){const u=a[d];this.setAttribute(d,u.clone(n))}const s=e.morphAttributes;for(const d in s){const u=[],m=s[d];for(let p=0,f=m.length;p<f;p++)u.push(m[p].clone(n));this.morphAttributes[d]=u}this.morphTargetsRelative=e.morphTargetsRelative;const o=e.groups;for(let d=0,u=o.length;d<u;d++){const m=o[d];this.addGroup(m.start,m.count,m.materialIndex)}const l=e.boundingBox;l!==null&&(this.boundingBox=l.clone());const c=e.boundingSphere;return c!==null&&(this.boundingSphere=c.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}};const A8=new oa,Hh=new uL,RS=new wC,M8=new wt,FS=new wt,LS=new wt,OS=new wt,TM=new wt,IS=new wt,E8=new wt,zS=new wt;let kl=class extends Io{constructor(e=new _l,n=new mL){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,r=Object.keys(n);if(r.length>0){const a=n[r[0]];if(a!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=a.length;s<o;s++){const l=a[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[l]=s}}}}getVertexPosition(e,n){const r=this.geometry,a=r.attributes.position,s=r.morphAttributes.position,o=r.morphTargetsRelative;n.fromBufferAttribute(a,e);const l=this.morphTargetInfluences;if(s&&l){IS.set(0,0,0);for(let c=0,d=s.length;c<d;c++){const u=l[c],m=s[c];u!==0&&(TM.fromBufferAttribute(m,e),o?IS.addScaledVector(TM,u):IS.addScaledVector(TM.sub(n),u))}n.add(IS)}return n}raycast(e,n){const r=this.geometry,a=this.material,s=this.matrixWorld;a!==void 0&&(r.boundingSphere===null&&r.computeBoundingSphere(),RS.copy(r.boundingSphere),RS.applyMatrix4(s),Hh.copy(e.ray).recast(e.near),!(RS.containsPoint(Hh.origin)===!1&&(Hh.intersectSphere(RS,M8)===null||Hh.origin.distanceToSquared(M8)>(e.far-e.near)**2))&&(A8.copy(s).invert(),Hh.copy(e.ray).applyMatrix4(A8),!(r.boundingBox!==null&&Hh.intersectsBox(r.boundingBox)===!1)&&this._computeIntersections(e,n,Hh)))}_computeIntersections(e,n,r){let a;const s=this.geometry,o=this.material,l=s.index,c=s.attributes.position,d=s.attributes.uv,u=s.attributes.uv1,m=s.attributes.normal,p=s.groups,f=s.drawRange;if(l!==null)if(Array.isArray(o))for(let y=0,x=p.length;y<x;y++){const b=p[y],v=o[b.materialIndex],_=Math.max(b.start,f.start),k=Math.min(l.count,Math.min(b.start+b.count,f.start+f.count));for(let P=_,C=k;P<C;P+=3){const T=l.getX(P),N=l.getX(P+1),R=l.getX(P+2);a=US(this,v,e,r,d,u,m,T,N,R),a&&(a.faceIndex=Math.floor(P/3),a.face.materialIndex=b.materialIndex,n.push(a))}}else{const y=Math.max(0,f.start),x=Math.min(l.count,f.start+f.count);for(let b=y,v=x;b<v;b+=3){const _=l.getX(b),k=l.getX(b+1),P=l.getX(b+2);a=US(this,o,e,r,d,u,m,_,k,P),a&&(a.faceIndex=Math.floor(b/3),n.push(a))}}else if(c!==void 0)if(Array.isArray(o))for(let y=0,x=p.length;y<x;y++){const b=p[y],v=o[b.materialIndex],_=Math.max(b.start,f.start),k=Math.min(c.count,Math.min(b.start+b.count,f.start+f.count));for(let P=_,C=k;P<C;P+=3){const T=P,N=P+1,R=P+2;a=US(this,v,e,r,d,u,m,T,N,R),a&&(a.faceIndex=Math.floor(P/3),a.face.materialIndex=b.materialIndex,n.push(a))}}else{const y=Math.max(0,f.start),x=Math.min(c.count,f.start+f.count);for(let b=y,v=x;b<v;b+=3){const _=b,k=b+1,P=b+2;a=US(this,o,e,r,d,u,m,_,k,P),a&&(a.faceIndex=Math.floor(b/3),n.push(a))}}}};function Exe(t,e,n,r,a,s,o,l){let c;if(e.side===ao?c=r.intersectTriangle(o,s,a,!0,l):c=r.intersectTriangle(a,s,o,e.side===ih,l),c===null)return null;zS.copy(l),zS.applyMatrix4(t.matrixWorld);const d=n.ray.origin.distanceTo(zS);return d<n.near||d>n.far?null:{distance:d,point:zS.clone(),object:t}}function US(t,e,n,r,a,s,o,l,c,d){t.getVertexPosition(l,FS),t.getVertexPosition(c,LS),t.getVertexPosition(d,OS);const u=Exe(t,e,n,r,FS,LS,OS,E8);if(u){const m=new wt;Sy.getBarycoord(E8,FS,LS,OS,m),a&&(u.uv=Sy.getInterpolatedAttribute(a,l,c,d,m,new Kn)),s&&(u.uv1=Sy.getInterpolatedAttribute(s,l,c,d,m,new Kn)),o&&(u.normal=Sy.getInterpolatedAttribute(o,l,c,d,m,new wt),u.normal.dot(r.direction)>0&&u.normal.multiplyScalar(-1));const p={a:l,b:c,c:d,normal:new wt,materialIndex:0};Sy.getNormal(FS,LS,OS,p.normal),u.face=p,u.barycoord=m}return u}let hL=class RX extends _l{constructor(e=1,n=1,r=1,a=1,s=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:n,depth:r,widthSegments:a,heightSegments:s,depthSegments:o};const l=this;a=Math.floor(a),s=Math.floor(s),o=Math.floor(o);const c=[],d=[],u=[],m=[];let p=0,f=0;y("z","y","x",-1,-1,r,n,e,o,s,0),y("z","y","x",1,-1,r,n,-e,o,s,1),y("x","z","y",1,1,e,r,n,a,o,2),y("x","z","y",1,-1,e,r,-n,a,o,3),y("x","y","z",1,-1,e,n,r,a,s,4),y("x","y","z",-1,-1,e,n,-r,a,s,5),this.setIndex(c),this.setAttribute("position",new Ro(d,3)),this.setAttribute("normal",new Ro(u,3)),this.setAttribute("uv",new Ro(m,2));function y(x,b,v,_,k,P,C,T,N,R,A){const D=P/N,$=C/R,U=P/2,G=C/2,L=T/2,te=N+1,re=R+1;let J=0,ue=0;const me=new wt;for(let ge=0;ge<re;ge++){const X=ge*$-G;for(let ie=0;ie<te;ie++){const le=ie*D-U;me[x]=le*_,me[b]=X*k,me[v]=L,d.push(me.x,me.y,me.z),me[x]=0,me[b]=0,me[v]=T>0?1:-1,u.push(me.x,me.y,me.z),m.push(ie/N),m.push(1-ge/R),J+=1}}for(let ge=0;ge<R;ge++)for(let X=0;X<N;X++){const ie=p+X+te*ge,le=p+X+te*(ge+1),pe=p+(X+1)+te*(ge+1),Ce=p+(X+1)+te*ge;c.push(ie,le,Ce),c.push(le,pe,Ce),ue+=6}l.addGroup(f,ue,A),f+=ue,p+=J}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new RX(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}};function Ob(t){const e={};for(const n in t){e[n]={};for(const r in t[n]){const a=t[n][r];a&&(a.isColor||a.isMatrix3||a.isMatrix4||a.isVector2||a.isVector3||a.isVector4||a.isTexture||a.isQuaternion)?a.isRenderTargetTexture?(Mn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[n][r]=null):e[n][r]=a.clone():Array.isArray(a)?e[n][r]=a.slice():e[n][r]=a}}return e}function Ts(t){const e={};for(let n=0;n<t.length;n++){const r=Ob(t[n]);for(const a in r)e[a]=r[a]}return e}function jxe(t){const e=[];for(let n=0;n<t.length;n++)e.push(t[n].clone());return e}function FX(t){const e=t.getRenderTarget();return e===null?t.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:xr.workingColorSpace}const Dxe={clone:Ob,merge:Ts};var Rxe=`void main() {
- gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
- }`,Fxe=`void main() {
- gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
- }`;let mu=class extends mx{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=Rxe,this.fragmentShader=Fxe,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=Ob(e.uniforms),this.uniformsGroups=jxe(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 a in this.uniforms){const o=this.uniforms[a].value;o&&o.isTexture?n.uniforms[a]={type:"t",value:o.toJSON(e).uuid}:o&&o.isColor?n.uniforms[a]={type:"c",value:o.getHex()}:o&&o.isVector2?n.uniforms[a]={type:"v2",value:o.toArray()}:o&&o.isVector3?n.uniforms[a]={type:"v3",value:o.toArray()}:o&&o.isVector4?n.uniforms[a]={type:"v4",value:o.toArray()}:o&&o.isMatrix3?n.uniforms[a]={type:"m3",value:o.toArray()}:o&&o.isMatrix4?n.uniforms[a]={type:"m4",value:o.toArray()}:n.uniforms[a]={value:o}}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 r={};for(const a in this.extensions)this.extensions[a]===!0&&(r[a]=!0);return Object.keys(r).length>0&&(n.extensions=r),n}},LX=class extends Io{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new oa,this.projectionMatrix=new oa,this.projectionMatrixInverse=new oa,this.coordinateSystem=Dc,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 nm=new wt,j8=new Kn,D8=new Kn;let ll=class extends LX{constructor(e=50,n=1,r=.1,a=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=r,this.far=a,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=v3*2*Math.atan(n),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(f1*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return v3*2*Math.atan(Math.tan(f1*.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,r){nm.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(nm.x,nm.y).multiplyScalar(-e/nm.z),nm.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),r.set(nm.x,nm.y).multiplyScalar(-e/nm.z)}getViewSize(e,n){return this.getViewBounds(e,j8,D8),n.subVectors(D8,j8)}setViewOffset(e,n,r,a,s,o){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=r,this.view.offsetY=a,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let n=e*Math.tan(f1*.5*this.fov)/this.zoom,r=2*n,a=this.aspect*r,s=-.5*a;const o=this.view;if(this.view!==null&&this.view.enabled){const c=o.fullWidth,d=o.fullHeight;s+=o.offsetX*a/c,n-=o.offsetY*r/d,a*=o.width/c,r*=o.height/d}const l=this.filmOffset;l!==0&&(s+=e*l/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+a,n,n-r,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 bg=-90,xg=1;let Lxe=class extends Io{constructor(e,n,r){super(),this.type="CubeCamera",this.renderTarget=r,this.coordinateSystem=null,this.activeMipmapLevel=0;const a=new ll(bg,xg,e,n);a.layers=this.layers,this.add(a);const s=new ll(bg,xg,e,n);s.layers=this.layers,this.add(s);const o=new ll(bg,xg,e,n);o.layers=this.layers,this.add(o);const l=new ll(bg,xg,e,n);l.layers=this.layers,this.add(l);const c=new ll(bg,xg,e,n);c.layers=this.layers,this.add(c);const d=new ll(bg,xg,e,n);d.layers=this.layers,this.add(d)}updateCoordinateSystem(){const e=this.coordinateSystem,n=this.children.concat(),[r,a,s,o,l,c]=n;for(const d of n)this.remove(d);if(e===Dc)r.up.set(0,1,0),r.lookAt(1,0,0),a.up.set(0,1,0),a.lookAt(-1,0,0),s.up.set(0,0,-1),s.lookAt(0,1,0),o.up.set(0,0,1),o.lookAt(0,-1,0),l.up.set(0,1,0),l.lookAt(0,0,1),c.up.set(0,1,0),c.lookAt(0,0,-1);else if(e===X1)r.up.set(0,-1,0),r.lookAt(-1,0,0),a.up.set(0,-1,0),a.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),o.up.set(0,0,-1),o.lookAt(0,-1,0),l.up.set(0,-1,0),l.lookAt(0,0,1),c.up.set(0,-1,0),c.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const d of n)this.add(d),d.updateMatrixWorld()}update(e,n){this.parent===null&&this.updateMatrixWorld();const{renderTarget:r,activeMipmapLevel:a}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[s,o,l,c,d,u]=this.children,m=e.getRenderTarget(),p=e.getActiveCubeFace(),f=e.getActiveMipmapLevel(),y=e.xr.enabled;e.xr.enabled=!1;const x=r.texture.generateMipmaps;r.texture.generateMipmaps=!1,e.setRenderTarget(r,0,a),e.render(n,s),e.setRenderTarget(r,1,a),e.render(n,o),e.setRenderTarget(r,2,a),e.render(n,l),e.setRenderTarget(r,3,a),e.render(n,c),e.setRenderTarget(r,4,a),e.render(n,d),r.texture.generateMipmaps=x,e.setRenderTarget(r,5,a),e.render(n,u),e.setRenderTarget(m,p,f),e.xr.enabled=y,r.texture.needsPMREMUpdate=!0}},OX=class extends oc{constructor(e=[],n=Rb,r,a,s,o,l,c,d,u){super(e,n,r,a,s,o,l,c,d,u),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}},Oxe=class extends Xp{constructor(e=1,n={}){super(e,e,n),this.isWebGLCubeRenderTarget=!0;const r={width:e,height:e,depth:1},a=[r,r,r,r,r,r];this.texture=new OX(a),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 r={uniforms:{tEquirect:{value:null}},vertexShader:`
- varying vec3 vWorldDirection;
- vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
- return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
- }
- void main() {
- vWorldDirection = transformDirection( position, modelMatrix );
- #include <begin_vertex>
- #include <project_vertex>
- }
- `,fragmentShader:`
- uniform sampler2D tEquirect;
- varying vec3 vWorldDirection;
- #include <common>
- void main() {
- vec3 direction = normalize( vWorldDirection );
- vec2 sampleUV = equirectUv( direction );
- gl_FragColor = texture2D( tEquirect, sampleUV );
- }
- `},a=new hL(5,5,5),s=new mu({name:"CubemapFromEquirect",uniforms:Ob(r.uniforms),vertexShader:r.vertexShader,fragmentShader:r.fragmentShader,side:ao,blending:Zd});s.uniforms.tEquirect.value=n;const o=new kl(a,s),l=n.minFilter;return n.minFilter===hp&&(n.minFilter=hl),new Lxe(1,10,this).update(e,o),n.minFilter=l,o.geometry.dispose(),o.material.dispose(),this}clear(e,n=!0,r=!0,a=!0){const s=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(n,r,a);e.setRenderTarget(s)}},ab=class extends Io{constructor(){super(),this.isGroup=!0,this.type="Group"}};const Ixe={type:"move"};let PM=class{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new ab,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 ab,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new wt,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new wt),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new ab,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new wt,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new wt),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 r of e.hand.values())this._getHandJoint(n,r)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,n,r){let a=null,s=null,o=null;const l=this._targetRay,c=this._grip,d=this._hand;if(e&&n.session.visibilityState!=="visible-blurred"){if(d&&e.hand){o=!0;for(const x of e.hand.values()){const b=n.getJointPose(x,r),v=this._getHandJoint(d,x);b!==null&&(v.matrix.fromArray(b.transform.matrix),v.matrix.decompose(v.position,v.rotation,v.scale),v.matrixWorldNeedsUpdate=!0,v.jointRadius=b.radius),v.visible=b!==null}const u=d.joints["index-finger-tip"],m=d.joints["thumb-tip"],p=u.position.distanceTo(m.position),f=.02,y=.005;d.inputState.pinching&&p>f+y?(d.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!d.inputState.pinching&&p<=f-y&&(d.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else c!==null&&e.gripSpace&&(s=n.getPose(e.gripSpace,r),s!==null&&(c.matrix.fromArray(s.transform.matrix),c.matrix.decompose(c.position,c.rotation,c.scale),c.matrixWorldNeedsUpdate=!0,s.linearVelocity?(c.hasLinearVelocity=!0,c.linearVelocity.copy(s.linearVelocity)):c.hasLinearVelocity=!1,s.angularVelocity?(c.hasAngularVelocity=!0,c.angularVelocity.copy(s.angularVelocity)):c.hasAngularVelocity=!1));l!==null&&(a=n.getPose(e.targetRaySpace,r),a===null&&s!==null&&(a=s),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,this.dispatchEvent(Ixe)))}return l!==null&&(l.visible=a!==null),c!==null&&(c.visible=s!==null),d!==null&&(d.visible=o!==null),this}_getHandJoint(e,n){if(e.joints[n.jointName]===void 0){const r=new ab;r.matrixAutoUpdate=!1,r.visible=!1,e.joints[n.jointName]=r,e.add(r)}return e.joints[n.jointName]}},zxe=class extends Io{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 ah,this.environmentIntensity=1,this.environmentRotation=new ah,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}},Uxe=class extends oc{constructor(e=null,n=1,r=1,a,s,o,l,c,d=Do,u=Do,m,p){super(null,o,l,c,d,u,a,s,m,p),this.isDataTexture=!0,this.image={data:e,width:n,height:r},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};const AM=new wt,Bxe=new wt,Hxe=new Qn;let pm=class{constructor(e=new wt(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,r,a){return this.normal.set(e,n,r),this.constant=a,this}setFromNormalAndCoplanarPoint(e,n){return this.normal.copy(e),this.constant=-n.dot(this.normal),this}setFromCoplanarPoints(e,n,r){const a=AM.subVectors(r,n).cross(Bxe.subVectors(e,n)).normalize();return this.setFromNormalAndCoplanarPoint(a,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 r=e.delta(AM),a=this.normal.dot(r);if(a===0)return this.distanceToPoint(e.start)===0?n.copy(e.start):null;const s=-(e.start.dot(this.normal)+this.constant)/a;return s<0||s>1?null:n.copy(e.start).addScaledVector(r,s)}intersectsLine(e){const n=this.distanceToPoint(e.start),r=this.distanceToPoint(e.end);return n<0&&r>0||r<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 r=n||Hxe.getNormalMatrix(e),a=this.coplanarPoint(AM).applyMatrix4(e),s=this.normal.applyMatrix3(r).normalize();return this.constant=-a.dot(s),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 $h=new wC,$xe=new Kn(.5,.5),BS=new wt;let pL=class{constructor(e=new pm,n=new pm,r=new pm,a=new pm,s=new pm,o=new pm){this.planes=[e,n,r,a,s,o]}set(e,n,r,a,s,o){const l=this.planes;return l[0].copy(e),l[1].copy(n),l[2].copy(r),l[3].copy(a),l[4].copy(s),l[5].copy(o),this}copy(e){const n=this.planes;for(let r=0;r<6;r++)n[r].copy(e.planes[r]);return this}setFromProjectionMatrix(e,n=Dc,r=!1){const a=this.planes,s=e.elements,o=s[0],l=s[1],c=s[2],d=s[3],u=s[4],m=s[5],p=s[6],f=s[7],y=s[8],x=s[9],b=s[10],v=s[11],_=s[12],k=s[13],P=s[14],C=s[15];if(a[0].setComponents(d-o,f-u,v-y,C-_).normalize(),a[1].setComponents(d+o,f+u,v+y,C+_).normalize(),a[2].setComponents(d+l,f+m,v+x,C+k).normalize(),a[3].setComponents(d-l,f-m,v-x,C-k).normalize(),r)a[4].setComponents(c,p,b,P).normalize(),a[5].setComponents(d-c,f-p,v-b,C-P).normalize();else if(a[4].setComponents(d-c,f-p,v-b,C-P).normalize(),n===Dc)a[5].setComponents(d+c,f+p,v+b,C+P).normalize();else if(n===X1)a[5].setComponents(c,p,b,P).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(),$h.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const n=e.geometry;n.boundingSphere===null&&n.computeBoundingSphere(),$h.copy(n.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere($h)}intersectsSprite(e){$h.center.set(0,0,0);const n=$xe.distanceTo(e.center);return $h.radius=.7071067811865476+n,$h.applyMatrix4(e.matrixWorld),this.intersectsSphere($h)}intersectsSphere(e){const n=this.planes,r=e.center,a=-e.radius;for(let s=0;s<6;s++)if(n[s].distanceToPoint(r)<a)return!1;return!0}intersectsBox(e){const n=this.planes;for(let r=0;r<6;r++){const a=n[r];if(BS.x=a.normal.x>0?e.max.x:e.min.x,BS.y=a.normal.y>0?e.max.y:e.min.y,BS.z=a.normal.z>0?e.max.z:e.min.z,a.distanceToPoint(BS)<0)return!1}return!0}containsPoint(e){const n=this.planes;for(let r=0;r<6;r++)if(n[r].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}},IX=class extends mx{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Zn(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 Z1=new wt,J1=new wt,R8=new oa,ky=new uL,HS=new wC,MM=new wt,F8=new wt;let qxe=class extends Io{constructor(e=new _l,n=new IX){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,r=[0];for(let a=1,s=n.count;a<s;a++)Z1.fromBufferAttribute(n,a-1),J1.fromBufferAttribute(n,a),r[a]=r[a-1],r[a]+=Z1.distanceTo(J1);e.setAttribute("lineDistance",new Ro(r,1))}else Mn("Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,n){const r=this.geometry,a=this.matrixWorld,s=e.params.Line.threshold,o=r.drawRange;if(r.boundingSphere===null&&r.computeBoundingSphere(),HS.copy(r.boundingSphere),HS.applyMatrix4(a),HS.radius+=s,e.ray.intersectsSphere(HS)===!1)return;R8.copy(a).invert(),ky.copy(e.ray).applyMatrix4(R8);const l=s/((this.scale.x+this.scale.y+this.scale.z)/3),c=l*l,d=this.isLineSegments?2:1,u=r.index,p=r.attributes.position;if(u!==null){const f=Math.max(0,o.start),y=Math.min(u.count,o.start+o.count);for(let x=f,b=y-1;x<b;x+=d){const v=u.getX(x),_=u.getX(x+1),k=$S(this,e,ky,c,v,_,x);k&&n.push(k)}if(this.isLineLoop){const x=u.getX(y-1),b=u.getX(f),v=$S(this,e,ky,c,x,b,y-1);v&&n.push(v)}}else{const f=Math.max(0,o.start),y=Math.min(p.count,o.start+o.count);for(let x=f,b=y-1;x<b;x+=d){const v=$S(this,e,ky,c,x,x+1,x);v&&n.push(v)}if(this.isLineLoop){const x=$S(this,e,ky,c,y-1,f,y-1);x&&n.push(x)}}}updateMorphTargets(){const n=this.geometry.morphAttributes,r=Object.keys(n);if(r.length>0){const a=n[r[0]];if(a!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=a.length;s<o;s++){const l=a[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[l]=s}}}}};function $S(t,e,n,r,a,s,o){const l=t.geometry.attributes.position;if(Z1.fromBufferAttribute(l,a),J1.fromBufferAttribute(l,s),n.distanceSqToSegment(Z1,J1,MM,F8)>r)return;MM.applyMatrix4(t.matrixWorld);const d=e.ray.origin.distanceTo(MM);if(!(d<e.near||d>e.far))return{distance:d,point:F8.clone().applyMatrix4(t.matrixWorld),index:o,face:null,faceIndex:null,barycoord:null,object:t}}const L8=new wt,O8=new wt;let Vxe=class extends qxe{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,r=[];for(let a=0,s=n.count;a<s;a+=2)L8.fromBufferAttribute(n,a),O8.fromBufferAttribute(n,a+1),r[a]=a===0?0:r[a-1],r[a+1]=r[a]+L8.distanceTo(O8);e.setAttribute("lineDistance",new Ro(r,1))}else Mn("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}},zX=class extends oc{constructor(e,n,r=Kp,a,s,o,l=Do,c=Do,d,u=$v,m=1){if(u!==$v&&u!==qv)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");const p={width:e,height:n,depth:m};super(p,a,s,o,l,c,u,r,d),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new dL(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 UX extends oc{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}}let fL=class BX extends _l{constructor(e=1,n=1,r=1,a=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:n,widthSegments:r,heightSegments:a};const s=e/2,o=n/2,l=Math.floor(r),c=Math.floor(a),d=l+1,u=c+1,m=e/l,p=n/c,f=[],y=[],x=[],b=[];for(let v=0;v<u;v++){const _=v*p-o;for(let k=0;k<d;k++){const P=k*m-s;y.push(P,-_,0),x.push(0,0,1),b.push(k/l),b.push(1-v/c)}}for(let v=0;v<c;v++)for(let _=0;_<l;_++){const k=_+d*v,P=_+d*(v+1),C=_+1+d*(v+1),T=_+1+d*v;f.push(k,P,T),f.push(P,C,T)}this.setIndex(f),this.setAttribute("position",new Ro(y,3)),this.setAttribute("normal",new Ro(x,3)),this.setAttribute("uv",new Ro(b,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new BX(e.width,e.height,e.widthSegments,e.heightSegments)}};class HX extends mx{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Zn(16777215),this.specular=new Zn(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Zn(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=vX,this.normalScale=new Kn(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new ah,this.combine=nL,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 Gxe=class extends mx{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=txe,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}},Wxe=class extends mx{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 I8={enabled:!1,files:{},add:function(t,e){this.enabled!==!1&&(this.files[t]=e)},get:function(t){if(this.enabled!==!1)return this.files[t]},remove:function(t){delete this.files[t]},clear:function(){this.files={}}};class Kxe{constructor(e,n,r){const a=this;let s=!1,o=0,l=0,c;const d=[];this.onStart=void 0,this.onLoad=e,this.onProgress=n,this.onError=r,this._abortController=null,this.itemStart=function(u){l++,s===!1&&a.onStart!==void 0&&a.onStart(u,o,l),s=!0},this.itemEnd=function(u){o++,a.onProgress!==void 0&&a.onProgress(u,o,l),o===l&&(s=!1,a.onLoad!==void 0&&a.onLoad())},this.itemError=function(u){a.onError!==void 0&&a.onError(u)},this.resolveURL=function(u){return c?c(u):u},this.setURLModifier=function(u){return c=u,this},this.addHandler=function(u,m){return d.push(u,m),this},this.removeHandler=function(u){const m=d.indexOf(u);return m!==-1&&d.splice(m,2),this},this.getHandler=function(u){for(let m=0,p=d.length;m<p;m+=2){const f=d[m],y=d[m+1];if(f.global&&(f.lastIndex=0),f.test(u))return y}return null},this.abort=function(){return this.abortController.abort(),this._abortController=null,this}}get abortController(){return this._abortController||(this._abortController=new AbortController),this._abortController}}const Yxe=new Kxe;class gL{constructor(e){this.manager=e!==void 0?e:Yxe,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,n){const r=this;return new Promise(function(a,s){r.load(e,a,n,s)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}abort(){return this}}gL.DEFAULT_MATERIAL_NAME="__DEFAULT";const Nd={};class Xxe extends Error{constructor(e,n){super(e),this.response=n}}class Qxe extends gL{constructor(e){super(e),this.mimeType="",this.responseType="",this._abortController=new AbortController}load(e,n,r,a){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=I8.get(`file:${e}`);if(s!==void 0)return this.manager.itemStart(e),setTimeout(()=>{n&&n(s),this.manager.itemEnd(e)},0),s;if(Nd[e]!==void 0){Nd[e].push({onLoad:n,onProgress:r,onError:a});return}Nd[e]=[],Nd[e].push({onLoad:n,onProgress:r,onError:a});const o=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin",signal:typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal}),l=this.mimeType,c=this.responseType;fetch(o).then(d=>{if(d.status===200||d.status===0){if(d.status===0&&Mn("FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||d.body===void 0||d.body.getReader===void 0)return d;const u=Nd[e],m=d.body.getReader(),p=d.headers.get("X-File-Size")||d.headers.get("Content-Length"),f=p?parseInt(p):0,y=f!==0;let x=0;const b=new ReadableStream({start(v){_();function _(){m.read().then(({done:k,value:P})=>{if(k)v.close();else{x+=P.byteLength;const C=new ProgressEvent("progress",{lengthComputable:y,loaded:x,total:f});for(let T=0,N=u.length;T<N;T++){const R=u[T];R.onProgress&&R.onProgress(C)}v.enqueue(P),_()}},k=>{v.error(k)})}}});return new Response(b)}else throw new Xxe(`fetch for "${d.url}" responded with ${d.status}: ${d.statusText}`,d)}).then(d=>{switch(c){case"arraybuffer":return d.arrayBuffer();case"blob":return d.blob();case"document":return d.text().then(u=>new DOMParser().parseFromString(u,l));case"json":return d.json();default:if(l==="")return d.text();{const m=/charset="?([^;"\s]*)"?/i.exec(l),p=m&&m[1]?m[1].toLowerCase():void 0,f=new TextDecoder(p);return d.arrayBuffer().then(y=>f.decode(y))}}}).then(d=>{I8.add(`file:${e}`,d);const u=Nd[e];delete Nd[e];for(let m=0,p=u.length;m<p;m++){const f=u[m];f.onLoad&&f.onLoad(d)}}).catch(d=>{const u=Nd[e];if(u===void 0)throw this.manager.itemError(e),d;delete Nd[e];for(let m=0,p=u.length;m<p;m++){const f=u[m];f.onError&&f.onError(d)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}let $X=class extends Io{constructor(e,n=1){super(),this.isLight=!0,this.type="Light",this.color=new Zn(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 EM=new oa,z8=new wt,U8=new wt;let Zxe=class{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Kn(512,512),this.mapType=qc,this.map=null,this.mapPass=null,this.matrix=new oa,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new pL,this._frameExtents=new Kn(1,1),this._viewportCount=1,this._viewports=[new na(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const n=this.camera,r=this.matrix;z8.setFromMatrixPosition(e.matrixWorld),n.position.copy(z8),U8.setFromMatrixPosition(e.target.matrixWorld),n.lookAt(U8),n.updateMatrixWorld(),EM.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(EM,n.coordinateSystem,n.reversedDepth),n.reversedDepth?r.set(.5,0,0,.5,0,.5,0,.5,0,0,1,0,0,0,0,1):r.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),r.multiply(EM)}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}},qX=class extends LX{constructor(e=-1,n=1,r=1,a=-1,s=.1,o=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=n,this.top=r,this.bottom=a,this.near=s,this.far=o,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,r,a,s,o){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=r,this.view.offsetY=a,this.view.width=s,this.view.height=o,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),r=(this.right+this.left)/2,a=(this.top+this.bottom)/2;let s=r-e,o=r+e,l=a+n,c=a-n;if(this.view!==null&&this.view.enabled){const d=(this.right-this.left)/this.view.fullWidth/this.zoom,u=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=d*this.view.offsetX,o=s+d*this.view.width,l-=u*this.view.offsetY,c=l-u*this.view.height}this.projectionMatrix.makeOrthographic(s,o,l,c,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const n=super.toJSON(e);return n.object.zoom=this.zoom,n.object.left=this.left,n.object.right=this.right,n.object.top=this.top,n.object.bottom=this.bottom,n.object.near=this.near,n.object.far=this.far,this.view!==null&&(n.object.view=Object.assign({},this.view)),n}};class Jxe extends Zxe{constructor(){super(new qX(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class B8 extends $X{constructor(e,n){super(e,n),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(Io.DEFAULT_UP),this.updateMatrix(),this.target=new Io,this.shadow=new Jxe}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}let eye=class extends $X{constructor(e,n){super(e,n),this.isAmbientLight=!0,this.type="AmbientLight"}},tye=class extends ll{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}},H8=class{constructor(e=1,n=0,r=0){this.radius=e,this.phi=n,this.theta=r}set(e,n,r){return this.radius=e,this.phi=n,this.theta=r,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=or(this.phi,1e-6,Math.PI-1e-6),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,n,r){return this.radius=Math.sqrt(e*e+n*n+r*r),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,r),this.phi=Math.acos(or(n/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}};class nye extends Vxe{constructor(e=10,n=10,r=4473924,a=8947848){r=new Zn(r),a=new Zn(a);const s=n/2,o=e/n,l=e/2,c=[],d=[];for(let p=0,f=0,y=-l;p<=n;p++,y+=o){c.push(-l,0,y,l,0,y),c.push(y,0,-l,y,0,l);const x=p===s?r:a;x.toArray(d,f),f+=3,x.toArray(d,f),f+=3,x.toArray(d,f),f+=3,x.toArray(d,f),f+=3}const u=new _l;u.setAttribute("position",new Ro(c,3)),u.setAttribute("color",new Ro(d,3));const m=new IX({vertexColors:!0,toneMapped:!1});super(u,m),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}class rye extends xf{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){Mn("Controls: connect() now requires an element.");return}this.domElement!==null&&this.disconnect(),this.domElement=e}disconnect(){}dispose(){}update(){}}function $8(t,e,n,r){const a=iye(r);switch(n){case bX:return t*e;case yX:return t*e/a.components*a.byteLength;case sL:return t*e/a.components*a.byteLength;case oL:return t*e*2/a.components*a.byteLength;case lL:return t*e*2/a.components*a.byteLength;case xX:return t*e*3/a.components*a.byteLength;case Xl:return t*e*4/a.components*a.byteLength;case cL:return t*e*4/a.components*a.byteLength;case u1:case m1:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*8;case h1:case p1:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case WD:case YD:return Math.max(t,16)*Math.max(e,8)/4;case GD:case KD:return Math.max(t,8)*Math.max(e,8)/2;case XD:case QD:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*8;case ZD:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case JD:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case e3:return Math.floor((t+4)/5)*Math.floor((e+3)/4)*16;case t3:return Math.floor((t+4)/5)*Math.floor((e+4)/5)*16;case n3:return Math.floor((t+5)/6)*Math.floor((e+4)/5)*16;case r3:return Math.floor((t+5)/6)*Math.floor((e+5)/6)*16;case i3:return Math.floor((t+7)/8)*Math.floor((e+4)/5)*16;case a3:return Math.floor((t+7)/8)*Math.floor((e+5)/6)*16;case s3:return Math.floor((t+7)/8)*Math.floor((e+7)/8)*16;case o3:return Math.floor((t+9)/10)*Math.floor((e+4)/5)*16;case l3:return Math.floor((t+9)/10)*Math.floor((e+5)/6)*16;case c3:return Math.floor((t+9)/10)*Math.floor((e+7)/8)*16;case d3:return Math.floor((t+9)/10)*Math.floor((e+9)/10)*16;case u3:return Math.floor((t+11)/12)*Math.floor((e+9)/10)*16;case m3:return Math.floor((t+11)/12)*Math.floor((e+11)/12)*16;case h3:case p3:case f3:return Math.ceil(t/4)*Math.ceil(e/4)*16;case g3:case b3:return Math.ceil(t/4)*Math.ceil(e/4)*8;case x3:case y3:return Math.ceil(t/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${n} format.`)}function iye(t){switch(t){case qc:case hX:return{byteLength:1,components:1};case Bv:case pX:case ux:return{byteLength:2,components:1};case iL:case aL:return{byteLength:2,components:4};case Kp:case rL:case Gd:return{byteLength:4,components:1};case fX:case gX:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${t}.`)}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:tL}}));typeof window<"u"&&(window.__THREE__?Mn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=tL);function VX(){let t=null,e=!1,n=null,r=null;function a(s,o){n(s,o),r=t.requestAnimationFrame(a)}return{start:function(){e!==!0&&n!==null&&(r=t.requestAnimationFrame(a),e=!0)},stop:function(){t.cancelAnimationFrame(r),e=!1},setAnimationLoop:function(s){n=s},setContext:function(s){t=s}}}function aye(t){const e=new WeakMap;function n(l,c){const d=l.array,u=l.usage,m=d.byteLength,p=t.createBuffer();t.bindBuffer(c,p),t.bufferData(c,d,u),l.onUploadCallback();let f;if(d instanceof Float32Array)f=t.FLOAT;else if(typeof Float16Array<"u"&&d instanceof Float16Array)f=t.HALF_FLOAT;else if(d instanceof Uint16Array)l.isFloat16BufferAttribute?f=t.HALF_FLOAT:f=t.UNSIGNED_SHORT;else if(d instanceof Int16Array)f=t.SHORT;else if(d instanceof Uint32Array)f=t.UNSIGNED_INT;else if(d instanceof Int32Array)f=t.INT;else if(d instanceof Int8Array)f=t.BYTE;else if(d instanceof Uint8Array)f=t.UNSIGNED_BYTE;else if(d instanceof Uint8ClampedArray)f=t.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+d);return{buffer:p,type:f,bytesPerElement:d.BYTES_PER_ELEMENT,version:l.version,size:m}}function r(l,c,d){const u=c.array,m=c.updateRanges;if(t.bindBuffer(d,l),m.length===0)t.bufferSubData(d,0,u);else{m.sort((f,y)=>f.start-y.start);let p=0;for(let f=1;f<m.length;f++){const y=m[p],x=m[f];x.start<=y.start+y.count+1?y.count=Math.max(y.count,x.start+x.count-y.start):(++p,m[p]=x)}m.length=p+1;for(let f=0,y=m.length;f<y;f++){const x=m[f];t.bufferSubData(d,x.start*u.BYTES_PER_ELEMENT,u,x.start,x.count)}c.clearUpdateRanges()}c.onUploadCallback()}function a(l){return l.isInterleavedBufferAttribute&&(l=l.data),e.get(l)}function s(l){l.isInterleavedBufferAttribute&&(l=l.data);const c=e.get(l);c&&(t.deleteBuffer(c.buffer),e.delete(l))}function o(l,c){if(l.isInterleavedBufferAttribute&&(l=l.data),l.isGLBufferAttribute){const u=e.get(l);(!u||u.version<l.version)&&e.set(l,{buffer:l.buffer,type:l.type,bytesPerElement:l.elementSize,version:l.version});return}const d=e.get(l);if(d===void 0)e.set(l,n(l,c));else if(d.version<l.version){if(d.size!==l.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");r(d.buffer,l,c),d.version=l.version}}return{get:a,remove:s,update:o}}var sye=`#ifdef USE_ALPHAHASH
- if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
- #endif`,oye=`#ifdef USE_ALPHAHASH
- const float ALPHA_HASH_SCALE = 0.05;
- float hash2D( vec2 value ) {
- return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );
- }
- float hash3D( vec3 value ) {
- return hash2D( vec2( hash2D( value.xy ), value.z ) );
- }
- float getAlphaHashThreshold( vec3 position ) {
- float maxDeriv = max(
- length( dFdx( position.xyz ) ),
- length( dFdy( position.xyz ) )
- );
- float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );
- vec2 pixScales = vec2(
- exp2( floor( log2( pixScale ) ) ),
- exp2( ceil( log2( pixScale ) ) )
- );
- vec2 alpha = vec2(
- hash3D( floor( pixScales.x * position.xyz ) ),
- hash3D( floor( pixScales.y * position.xyz ) )
- );
- float lerpFactor = fract( log2( pixScale ) );
- float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;
- float a = min( lerpFactor, 1.0 - lerpFactor );
- vec3 cases = vec3(
- x * x / ( 2.0 * a * ( 1.0 - a ) ),
- ( x - 0.5 * a ) / ( 1.0 - a ),
- 1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )
- );
- float threshold = ( x < ( 1.0 - a ) )
- ? ( ( x < a ) ? cases.x : cases.y )
- : cases.z;
- return clamp( threshold , 1.0e-6, 1.0 );
- }
- #endif`,lye=`#ifdef USE_ALPHAMAP
- diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
- #endif`,cye=`#ifdef USE_ALPHAMAP
- uniform sampler2D alphaMap;
- #endif`,dye=`#ifdef USE_ALPHATEST
- #ifdef ALPHA_TO_COVERAGE
- diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );
- if ( diffuseColor.a == 0.0 ) discard;
- #else
- if ( diffuseColor.a < alphaTest ) discard;
- #endif
- #endif`,uye=`#ifdef USE_ALPHATEST
- uniform float alphaTest;
- #endif`,mye=`#ifdef USE_AOMAP
- float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;
- reflectedLight.indirectDiffuse *= ambientOcclusion;
- #if defined( USE_CLEARCOAT )
- clearcoatSpecularIndirect *= ambientOcclusion;
- #endif
- #if defined( USE_SHEEN )
- sheenSpecularIndirect *= ambientOcclusion;
- #endif
- #if defined( USE_ENVMAP ) && defined( STANDARD )
- float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );
- reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
- #endif
- #endif`,hye=`#ifdef USE_AOMAP
- uniform sampler2D aoMap;
- uniform float aoMapIntensity;
- #endif`,pye=`#ifdef USE_BATCHING
- #if ! defined( GL_ANGLE_multi_draw )
- #define gl_DrawID _gl_DrawID
- uniform int _gl_DrawID;
- #endif
- uniform highp sampler2D batchingTexture;
- uniform highp usampler2D batchingIdTexture;
- mat4 getBatchingMatrix( const in float i ) {
- int size = textureSize( batchingTexture, 0 ).x;
- int j = int( i ) * 4;
- int x = j % size;
- int y = j / size;
- vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );
- vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );
- vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );
- vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );
- return mat4( v1, v2, v3, v4 );
- }
- float getIndirectIndex( const in int i ) {
- int size = textureSize( batchingIdTexture, 0 ).x;
- int x = i % size;
- int y = i / size;
- return float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );
- }
- #endif
- #ifdef USE_BATCHING_COLOR
- uniform sampler2D batchingColorTexture;
- vec3 getBatchingColor( const in float i ) {
- int size = textureSize( batchingColorTexture, 0 ).x;
- int j = int( i );
- int x = j % size;
- int y = j / size;
- return texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb;
- }
- #endif`,fye=`#ifdef USE_BATCHING
- mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );
- #endif`,gye=`vec3 transformed = vec3( position );
- #ifdef USE_ALPHAHASH
- vPosition = vec3( position );
- #endif`,bye=`vec3 objectNormal = vec3( normal );
- #ifdef USE_TANGENT
- vec3 objectTangent = vec3( tangent.xyz );
- #endif`,xye=`float G_BlinnPhong_Implicit( ) {
- return 0.25;
- }
- float D_BlinnPhong( const in float shininess, const in float dotNH ) {
- return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );
- }
- vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {
- vec3 halfDir = normalize( lightDir + viewDir );
- float dotNH = saturate( dot( normal, halfDir ) );
- float dotVH = saturate( dot( viewDir, halfDir ) );
- vec3 F = F_Schlick( specularColor, 1.0, dotVH );
- float G = G_BlinnPhong_Implicit( );
- float D = D_BlinnPhong( shininess, dotNH );
- return F * ( G * D );
- } // validated`,yye=`#ifdef USE_IRIDESCENCE
- const mat3 XYZ_TO_REC709 = mat3(
- 3.2404542, -0.9692660, 0.0556434,
- -1.5371385, 1.8760108, -0.2040259,
- -0.4985314, 0.0415560, 1.0572252
- );
- vec3 Fresnel0ToIor( vec3 fresnel0 ) {
- vec3 sqrtF0 = sqrt( fresnel0 );
- return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );
- }
- vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {
- return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );
- }
- float IorToFresnel0( float transmittedIor, float incidentIor ) {
- return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));
- }
- vec3 evalSensitivity( float OPD, vec3 shift ) {
- float phase = 2.0 * PI * OPD * 1.0e-9;
- vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );
- vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );
- vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );
- vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );
- 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 ) );
- xyz /= 1.0685e-7;
- vec3 rgb = XYZ_TO_REC709 * xyz;
- return rgb;
- }
- vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {
- vec3 I;
- float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );
- float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );
- float cosTheta2Sq = 1.0 - sinTheta2Sq;
- if ( cosTheta2Sq < 0.0 ) {
- return vec3( 1.0 );
- }
- float cosTheta2 = sqrt( cosTheta2Sq );
- float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );
- float R12 = F_Schlick( R0, 1.0, cosTheta1 );
- float T121 = 1.0 - R12;
- float phi12 = 0.0;
- if ( iridescenceIOR < outsideIOR ) phi12 = PI;
- float phi21 = PI - phi12;
- vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) ); vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );
- vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );
- vec3 phi23 = vec3( 0.0 );
- if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;
- if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;
- if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;
- float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;
- vec3 phi = vec3( phi21 ) + phi23;
- vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );
- vec3 r123 = sqrt( R123 );
- vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );
- vec3 C0 = R12 + Rs;
- I = C0;
- vec3 Cm = Rs - T121;
- for ( int m = 1; m <= 2; ++ m ) {
- Cm *= r123;
- vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );
- I += Cm * Sm;
- }
- return max( I, vec3( 0.0 ) );
- }
- #endif`,vye=`#ifdef USE_BUMPMAP
- uniform sampler2D bumpMap;
- uniform float bumpScale;
- vec2 dHdxy_fwd() {
- vec2 dSTdx = dFdx( vBumpMapUv );
- vec2 dSTdy = dFdy( vBumpMapUv );
- float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;
- float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;
- float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;
- return vec2( dBx, dBy );
- }
- vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {
- vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );
- vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );
- vec3 vN = surf_norm;
- vec3 R1 = cross( vSigmaY, vN );
- vec3 R2 = cross( vN, vSigmaX );
- float fDet = dot( vSigmaX, R1 ) * faceDirection;
- vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
- return normalize( abs( fDet ) * surf_norm - vGrad );
- }
- #endif`,wye=`#if NUM_CLIPPING_PLANES > 0
- vec4 plane;
- #ifdef ALPHA_TO_COVERAGE
- float distanceToPlane, distanceGradient;
- float clipOpacity = 1.0;
- #pragma unroll_loop_start
- for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
- plane = clippingPlanes[ i ];
- distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
- distanceGradient = fwidth( distanceToPlane ) / 2.0;
- clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
- if ( clipOpacity == 0.0 ) discard;
- }
- #pragma unroll_loop_end
- #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
- float unionClipOpacity = 1.0;
- #pragma unroll_loop_start
- for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
- plane = clippingPlanes[ i ];
- distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
- distanceGradient = fwidth( distanceToPlane ) / 2.0;
- unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
- }
- #pragma unroll_loop_end
- clipOpacity *= 1.0 - unionClipOpacity;
- #endif
- diffuseColor.a *= clipOpacity;
- if ( diffuseColor.a == 0.0 ) discard;
- #else
- #pragma unroll_loop_start
- for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
- plane = clippingPlanes[ i ];
- if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;
- }
- #pragma unroll_loop_end
- #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
- bool clipped = true;
- #pragma unroll_loop_start
- for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
- plane = clippingPlanes[ i ];
- clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;
- }
- #pragma unroll_loop_end
- if ( clipped ) discard;
- #endif
- #endif
- #endif`,Sye=`#if NUM_CLIPPING_PLANES > 0
- varying vec3 vClipPosition;
- uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
- #endif`,_ye=`#if NUM_CLIPPING_PLANES > 0
- varying vec3 vClipPosition;
- #endif`,kye=`#if NUM_CLIPPING_PLANES > 0
- vClipPosition = - mvPosition.xyz;
- #endif`,Nye=`#if defined( USE_COLOR_ALPHA )
- diffuseColor *= vColor;
- #elif defined( USE_COLOR )
- diffuseColor.rgb *= vColor;
- #endif`,Cye=`#if defined( USE_COLOR_ALPHA )
- varying vec4 vColor;
- #elif defined( USE_COLOR )
- varying vec3 vColor;
- #endif`,Tye=`#if defined( USE_COLOR_ALPHA )
- varying vec4 vColor;
- #elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
- varying vec3 vColor;
- #endif`,Pye=`#if defined( USE_COLOR_ALPHA )
- vColor = vec4( 1.0 );
- #elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
- vColor = vec3( 1.0 );
- #endif
- #ifdef USE_COLOR
- vColor *= color;
- #endif
- #ifdef USE_INSTANCING_COLOR
- vColor.xyz *= instanceColor.xyz;
- #endif
- #ifdef USE_BATCHING_COLOR
- vec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) );
- vColor.xyz *= batchingColor.xyz;
- #endif`,Aye=`#define PI 3.141592653589793
- #define PI2 6.283185307179586
- #define PI_HALF 1.5707963267948966
- #define RECIPROCAL_PI 0.3183098861837907
- #define RECIPROCAL_PI2 0.15915494309189535
- #define EPSILON 1e-6
- #ifndef saturate
- #define saturate( a ) clamp( a, 0.0, 1.0 )
- #endif
- #define whiteComplement( a ) ( 1.0 - saturate( a ) )
- float pow2( const in float x ) { return x*x; }
- vec3 pow2( const in vec3 x ) { return x*x; }
- float pow3( const in float x ) { return x*x*x; }
- float pow4( const in float x ) { float x2 = x*x; return x2*x2; }
- float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }
- float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }
- highp float rand( const in vec2 uv ) {
- const highp float a = 12.9898, b = 78.233, c = 43758.5453;
- highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );
- return fract( sin( sn ) * c );
- }
- #ifdef HIGH_PRECISION
- float precisionSafeLength( vec3 v ) { return length( v ); }
- #else
- float precisionSafeLength( vec3 v ) {
- float maxComponent = max3( abs( v ) );
- return length( v / maxComponent ) * maxComponent;
- }
- #endif
- struct IncidentLight {
- vec3 color;
- vec3 direction;
- bool visible;
- };
- struct ReflectedLight {
- vec3 directDiffuse;
- vec3 directSpecular;
- vec3 indirectDiffuse;
- vec3 indirectSpecular;
- };
- #ifdef USE_ALPHAHASH
- varying vec3 vPosition;
- #endif
- vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
- return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
- }
- vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {
- return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );
- }
- bool isPerspectiveMatrix( mat4 m ) {
- return m[ 2 ][ 3 ] == - 1.0;
- }
- vec2 equirectUv( in vec3 dir ) {
- float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;
- float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;
- return vec2( u, v );
- }
- vec3 BRDF_Lambert( const in vec3 diffuseColor ) {
- return RECIPROCAL_PI * diffuseColor;
- }
- vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {
- float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
- return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
- }
- float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
- float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
- return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
- } // validated`,Mye=`#ifdef ENVMAP_TYPE_CUBE_UV
- #define cubeUV_minMipLevel 4.0
- #define cubeUV_minTileSize 16.0
- float getFace( vec3 direction ) {
- vec3 absDirection = abs( direction );
- float face = - 1.0;
- if ( absDirection.x > absDirection.z ) {
- if ( absDirection.x > absDirection.y )
- face = direction.x > 0.0 ? 0.0 : 3.0;
- else
- face = direction.y > 0.0 ? 1.0 : 4.0;
- } else {
- if ( absDirection.z > absDirection.y )
- face = direction.z > 0.0 ? 2.0 : 5.0;
- else
- face = direction.y > 0.0 ? 1.0 : 4.0;
- }
- return face;
- }
- vec2 getUV( vec3 direction, float face ) {
- vec2 uv;
- if ( face == 0.0 ) {
- uv = vec2( direction.z, direction.y ) / abs( direction.x );
- } else if ( face == 1.0 ) {
- uv = vec2( - direction.x, - direction.z ) / abs( direction.y );
- } else if ( face == 2.0 ) {
- uv = vec2( - direction.x, direction.y ) / abs( direction.z );
- } else if ( face == 3.0 ) {
- uv = vec2( - direction.z, direction.y ) / abs( direction.x );
- } else if ( face == 4.0 ) {
- uv = vec2( - direction.x, direction.z ) / abs( direction.y );
- } else {
- uv = vec2( direction.x, direction.y ) / abs( direction.z );
- }
- return 0.5 * ( uv + 1.0 );
- }
- vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {
- float face = getFace( direction );
- float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );
- mipInt = max( mipInt, cubeUV_minMipLevel );
- float faceSize = exp2( mipInt );
- highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;
- if ( face > 2.0 ) {
- uv.y += faceSize;
- face -= 3.0;
- }
- uv.x += face * faceSize;
- uv.x += filterInt * 3.0 * cubeUV_minTileSize;
- uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );
- uv.x *= CUBEUV_TEXEL_WIDTH;
- uv.y *= CUBEUV_TEXEL_HEIGHT;
- #ifdef texture2DGradEXT
- return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;
- #else
- return texture2D( envMap, uv ).rgb;
- #endif
- }
- #define cubeUV_r0 1.0
- #define cubeUV_m0 - 2.0
- #define cubeUV_r1 0.8
- #define cubeUV_m1 - 1.0
- #define cubeUV_r4 0.4
- #define cubeUV_m4 2.0
- #define cubeUV_r5 0.305
- #define cubeUV_m5 3.0
- #define cubeUV_r6 0.21
- #define cubeUV_m6 4.0
- float roughnessToMip( float roughness ) {
- float mip = 0.0;
- if ( roughness >= cubeUV_r1 ) {
- mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;
- } else if ( roughness >= cubeUV_r4 ) {
- mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;
- } else if ( roughness >= cubeUV_r5 ) {
- mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;
- } else if ( roughness >= cubeUV_r6 ) {
- mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;
- } else {
- mip = - 2.0 * log2( 1.16 * roughness ); }
- return mip;
- }
- vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {
- float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );
- float mipF = fract( mip );
- float mipInt = floor( mip );
- vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );
- if ( mipF == 0.0 ) {
- return vec4( color0, 1.0 );
- } else {
- vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );
- return vec4( mix( color0, color1, mipF ), 1.0 );
- }
- }
- #endif`,Eye=`vec3 transformedNormal = objectNormal;
- #ifdef USE_TANGENT
- vec3 transformedTangent = objectTangent;
- #endif
- #ifdef USE_BATCHING
- mat3 bm = mat3( batchingMatrix );
- transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );
- transformedNormal = bm * transformedNormal;
- #ifdef USE_TANGENT
- transformedTangent = bm * transformedTangent;
- #endif
- #endif
- #ifdef USE_INSTANCING
- mat3 im = mat3( instanceMatrix );
- transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );
- transformedNormal = im * transformedNormal;
- #ifdef USE_TANGENT
- transformedTangent = im * transformedTangent;
- #endif
- #endif
- transformedNormal = normalMatrix * transformedNormal;
- #ifdef FLIP_SIDED
- transformedNormal = - transformedNormal;
- #endif
- #ifdef USE_TANGENT
- transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;
- #ifdef FLIP_SIDED
- transformedTangent = - transformedTangent;
- #endif
- #endif`,jye=`#ifdef USE_DISPLACEMENTMAP
- uniform sampler2D displacementMap;
- uniform float displacementScale;
- uniform float displacementBias;
- #endif`,Dye=`#ifdef USE_DISPLACEMENTMAP
- transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );
- #endif`,Rye=`#ifdef USE_EMISSIVEMAP
- vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
- #ifdef DECODE_VIDEO_TEXTURE_EMISSIVE
- emissiveColor = sRGBTransferEOTF( emissiveColor );
- #endif
- totalEmissiveRadiance *= emissiveColor.rgb;
- #endif`,Fye=`#ifdef USE_EMISSIVEMAP
- uniform sampler2D emissiveMap;
- #endif`,Lye="gl_FragColor = linearToOutputTexel( gl_FragColor );",Oye=`vec4 LinearTransferOETF( in vec4 value ) {
- return value;
- }
- vec4 sRGBTransferEOTF( in vec4 value ) {
- 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 );
- }
- vec4 sRGBTransferOETF( in vec4 value ) {
- 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 );
- }`,Iye=`#ifdef USE_ENVMAP
- #ifdef ENV_WORLDPOS
- vec3 cameraToFrag;
- if ( isOrthographic ) {
- cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
- } else {
- cameraToFrag = normalize( vWorldPosition - cameraPosition );
- }
- vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
- #ifdef ENVMAP_MODE_REFLECTION
- vec3 reflectVec = reflect( cameraToFrag, worldNormal );
- #else
- vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );
- #endif
- #else
- vec3 reflectVec = vReflect;
- #endif
- #ifdef ENVMAP_TYPE_CUBE
- vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );
- #else
- vec4 envColor = vec4( 0.0 );
- #endif
- #ifdef ENVMAP_BLENDING_MULTIPLY
- outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );
- #elif defined( ENVMAP_BLENDING_MIX )
- outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );
- #elif defined( ENVMAP_BLENDING_ADD )
- outgoingLight += envColor.xyz * specularStrength * reflectivity;
- #endif
- #endif`,zye=`#ifdef USE_ENVMAP
- uniform float envMapIntensity;
- uniform float flipEnvMap;
- uniform mat3 envMapRotation;
- #ifdef ENVMAP_TYPE_CUBE
- uniform samplerCube envMap;
- #else
- uniform sampler2D envMap;
- #endif
- #endif`,Uye=`#ifdef USE_ENVMAP
- uniform float reflectivity;
- #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
- #define ENV_WORLDPOS
- #endif
- #ifdef ENV_WORLDPOS
- varying vec3 vWorldPosition;
- uniform float refractionRatio;
- #else
- varying vec3 vReflect;
- #endif
- #endif`,Bye=`#ifdef USE_ENVMAP
- #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
- #define ENV_WORLDPOS
- #endif
- #ifdef ENV_WORLDPOS
-
- varying vec3 vWorldPosition;
- #else
- varying vec3 vReflect;
- uniform float refractionRatio;
- #endif
- #endif`,Hye=`#ifdef USE_ENVMAP
- #ifdef ENV_WORLDPOS
- vWorldPosition = worldPosition.xyz;
- #else
- vec3 cameraToVertex;
- if ( isOrthographic ) {
- cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
- } else {
- cameraToVertex = normalize( worldPosition.xyz - cameraPosition );
- }
- vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
- #ifdef ENVMAP_MODE_REFLECTION
- vReflect = reflect( cameraToVertex, worldNormal );
- #else
- vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
- #endif
- #endif
- #endif`,$ye=`#ifdef USE_FOG
- vFogDepth = - mvPosition.z;
- #endif`,qye=`#ifdef USE_FOG
- varying float vFogDepth;
- #endif`,Vye=`#ifdef USE_FOG
- #ifdef FOG_EXP2
- float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );
- #else
- float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );
- #endif
- gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
- #endif`,Gye=`#ifdef USE_FOG
- uniform vec3 fogColor;
- varying float vFogDepth;
- #ifdef FOG_EXP2
- uniform float fogDensity;
- #else
- uniform float fogNear;
- uniform float fogFar;
- #endif
- #endif`,Wye=`#ifdef USE_GRADIENTMAP
- uniform sampler2D gradientMap;
- #endif
- vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
- float dotNL = dot( normal, lightDirection );
- vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );
- #ifdef USE_GRADIENTMAP
- return vec3( texture2D( gradientMap, coord ).r );
- #else
- vec2 fw = fwidth( coord ) * 0.5;
- return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );
- #endif
- }`,Kye=`#ifdef USE_LIGHTMAP
- uniform sampler2D lightMap;
- uniform float lightMapIntensity;
- #endif`,Yye=`LambertMaterial material;
- material.diffuseColor = diffuseColor.rgb;
- material.specularStrength = specularStrength;`,Xye=`varying vec3 vViewPosition;
- struct LambertMaterial {
- vec3 diffuseColor;
- float specularStrength;
- };
- 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 ) {
- float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
- vec3 irradiance = dotNL * directLight.color;
- reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
- }
- 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 ) {
- reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
- }
- #define RE_Direct RE_Direct_Lambert
- #define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,Qye=`uniform bool receiveShadow;
- uniform vec3 ambientLightColor;
- #if defined( USE_LIGHT_PROBES )
- uniform vec3 lightProbe[ 9 ];
- #endif
- vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {
- float x = normal.x, y = normal.y, z = normal.z;
- vec3 result = shCoefficients[ 0 ] * 0.886227;
- result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;
- result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;
- result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;
- result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;
- result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;
- result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );
- result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;
- result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );
- return result;
- }
- vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {
- vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
- vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );
- return irradiance;
- }
- vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {
- vec3 irradiance = ambientLightColor;
- return irradiance;
- }
- float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {
- float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );
- if ( cutoffDistance > 0.0 ) {
- distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );
- }
- return distanceFalloff;
- }
- float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {
- return smoothstep( coneCosine, penumbraCosine, angleCosine );
- }
- #if NUM_DIR_LIGHTS > 0
- struct DirectionalLight {
- vec3 direction;
- vec3 color;
- };
- uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];
- void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {
- light.color = directionalLight.color;
- light.direction = directionalLight.direction;
- light.visible = true;
- }
- #endif
- #if NUM_POINT_LIGHTS > 0
- struct PointLight {
- vec3 position;
- vec3 color;
- float distance;
- float decay;
- };
- uniform PointLight pointLights[ NUM_POINT_LIGHTS ];
- void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {
- vec3 lVector = pointLight.position - geometryPosition;
- light.direction = normalize( lVector );
- float lightDistance = length( lVector );
- light.color = pointLight.color;
- light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );
- light.visible = ( light.color != vec3( 0.0 ) );
- }
- #endif
- #if NUM_SPOT_LIGHTS > 0
- struct SpotLight {
- vec3 position;
- vec3 direction;
- vec3 color;
- float distance;
- float decay;
- float coneCos;
- float penumbraCos;
- };
- uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];
- void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {
- vec3 lVector = spotLight.position - geometryPosition;
- light.direction = normalize( lVector );
- float angleCos = dot( light.direction, spotLight.direction );
- float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );
- if ( spotAttenuation > 0.0 ) {
- float lightDistance = length( lVector );
- light.color = spotLight.color * spotAttenuation;
- light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );
- light.visible = ( light.color != vec3( 0.0 ) );
- } else {
- light.color = vec3( 0.0 );
- light.visible = false;
- }
- }
- #endif
- #if NUM_RECT_AREA_LIGHTS > 0
- struct RectAreaLight {
- vec3 color;
- vec3 position;
- vec3 halfWidth;
- vec3 halfHeight;
- };
- uniform sampler2D ltc_1; uniform sampler2D ltc_2;
- uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];
- #endif
- #if NUM_HEMI_LIGHTS > 0
- struct HemisphereLight {
- vec3 direction;
- vec3 skyColor;
- vec3 groundColor;
- };
- uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];
- vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {
- float dotNL = dot( normal, hemiLight.direction );
- float hemiDiffuseWeight = 0.5 * dotNL + 0.5;
- vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );
- return irradiance;
- }
- #endif`,Zye=`#ifdef USE_ENVMAP
- vec3 getIBLIrradiance( const in vec3 normal ) {
- #ifdef ENVMAP_TYPE_CUBE_UV
- vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
- vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );
- return PI * envMapColor.rgb * envMapIntensity;
- #else
- return vec3( 0.0 );
- #endif
- }
- vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {
- #ifdef ENVMAP_TYPE_CUBE_UV
- vec3 reflectVec = reflect( - viewDir, normal );
- reflectVec = normalize( mix( reflectVec, normal, pow4( roughness ) ) );
- reflectVec = inverseTransformDirection( reflectVec, viewMatrix );
- vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );
- return envMapColor.rgb * envMapIntensity;
- #else
- return vec3( 0.0 );
- #endif
- }
- #ifdef USE_ANISOTROPY
- vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {
- #ifdef ENVMAP_TYPE_CUBE_UV
- vec3 bentNormal = cross( bitangent, viewDir );
- bentNormal = normalize( cross( bentNormal, bitangent ) );
- bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );
- return getIBLRadiance( viewDir, bentNormal, roughness );
- #else
- return vec3( 0.0 );
- #endif
- }
- #endif
- #endif`,Jye=`ToonMaterial material;
- material.diffuseColor = diffuseColor.rgb;`,eve=`varying vec3 vViewPosition;
- struct ToonMaterial {
- vec3 diffuseColor;
- };
- 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 ) {
- vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;
- reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
- }
- 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 ) {
- reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
- }
- #define RE_Direct RE_Direct_Toon
- #define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,tve=`BlinnPhongMaterial material;
- material.diffuseColor = diffuseColor.rgb;
- material.specularColor = specular;
- material.specularShininess = shininess;
- material.specularStrength = specularStrength;`,nve=`varying vec3 vViewPosition;
- struct BlinnPhongMaterial {
- vec3 diffuseColor;
- vec3 specularColor;
- float specularShininess;
- float specularStrength;
- };
- 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 ) {
- float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
- vec3 irradiance = dotNL * directLight.color;
- reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
- reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;
- }
- 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 ) {
- reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
- }
- #define RE_Direct RE_Direct_BlinnPhong
- #define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,rve=`PhysicalMaterial material;
- material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );
- vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );
- float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );
- material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;
- material.roughness = min( material.roughness, 1.0 );
- #ifdef IOR
- material.ior = ior;
- #ifdef USE_SPECULAR
- float specularIntensityFactor = specularIntensity;
- vec3 specularColorFactor = specularColor;
- #ifdef USE_SPECULAR_COLORMAP
- specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;
- #endif
- #ifdef USE_SPECULAR_INTENSITYMAP
- specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;
- #endif
- material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );
- #else
- float specularIntensityFactor = 1.0;
- vec3 specularColorFactor = vec3( 1.0 );
- material.specularF90 = 1.0;
- #endif
- material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );
- #else
- material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );
- material.specularF90 = 1.0;
- #endif
- #ifdef USE_CLEARCOAT
- material.clearcoat = clearcoat;
- material.clearcoatRoughness = clearcoatRoughness;
- material.clearcoatF0 = vec3( 0.04 );
- material.clearcoatF90 = 1.0;
- #ifdef USE_CLEARCOATMAP
- material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;
- #endif
- #ifdef USE_CLEARCOAT_ROUGHNESSMAP
- material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;
- #endif
- material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );
- material.clearcoatRoughness += geometryRoughness;
- material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );
- #endif
- #ifdef USE_DISPERSION
- material.dispersion = dispersion;
- #endif
- #ifdef USE_IRIDESCENCE
- material.iridescence = iridescence;
- material.iridescenceIOR = iridescenceIOR;
- #ifdef USE_IRIDESCENCEMAP
- material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;
- #endif
- #ifdef USE_IRIDESCENCE_THICKNESSMAP
- material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;
- #else
- material.iridescenceThickness = iridescenceThicknessMaximum;
- #endif
- #endif
- #ifdef USE_SHEEN
- material.sheenColor = sheenColor;
- #ifdef USE_SHEEN_COLORMAP
- material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;
- #endif
- material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );
- #ifdef USE_SHEEN_ROUGHNESSMAP
- material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;
- #endif
- #endif
- #ifdef USE_ANISOTROPY
- #ifdef USE_ANISOTROPYMAP
- mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );
- vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;
- vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;
- #else
- vec2 anisotropyV = anisotropyVector;
- #endif
- material.anisotropy = length( anisotropyV );
- if( material.anisotropy == 0.0 ) {
- anisotropyV = vec2( 1.0, 0.0 );
- } else {
- anisotropyV /= material.anisotropy;
- material.anisotropy = saturate( material.anisotropy );
- }
- material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
- material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;
- material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;
- #endif`,ive=`uniform sampler2D dfgLUT;
- struct PhysicalMaterial {
- vec3 diffuseColor;
- float roughness;
- vec3 specularColor;
- float specularF90;
- float dispersion;
- #ifdef USE_CLEARCOAT
- float clearcoat;
- float clearcoatRoughness;
- vec3 clearcoatF0;
- float clearcoatF90;
- #endif
- #ifdef USE_IRIDESCENCE
- float iridescence;
- float iridescenceIOR;
- float iridescenceThickness;
- vec3 iridescenceFresnel;
- vec3 iridescenceF0;
- #endif
- #ifdef USE_SHEEN
- vec3 sheenColor;
- float sheenRoughness;
- #endif
- #ifdef IOR
- float ior;
- #endif
- #ifdef USE_TRANSMISSION
- float transmission;
- float transmissionAlpha;
- float thickness;
- float attenuationDistance;
- vec3 attenuationColor;
- #endif
- #ifdef USE_ANISOTROPY
- float anisotropy;
- float alphaT;
- vec3 anisotropyT;
- vec3 anisotropyB;
- #endif
- };
- vec3 clearcoatSpecularDirect = vec3( 0.0 );
- vec3 clearcoatSpecularIndirect = vec3( 0.0 );
- vec3 sheenSpecularDirect = vec3( 0.0 );
- vec3 sheenSpecularIndirect = vec3(0.0 );
- vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {
- float x = clamp( 1.0 - dotVH, 0.0, 1.0 );
- float x2 = x * x;
- float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );
- return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );
- }
- float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {
- float a2 = pow2( alpha );
- float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
- float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );
- return 0.5 / max( gv + gl, EPSILON );
- }
- float D_GGX( const in float alpha, const in float dotNH ) {
- float a2 = pow2( alpha );
- float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;
- return RECIPROCAL_PI * a2 / pow2( denom );
- }
- #ifdef USE_ANISOTROPY
- 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 ) {
- float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );
- float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );
- float v = 0.5 / ( gv + gl );
- return saturate(v);
- }
- float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {
- float a2 = alphaT * alphaB;
- highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );
- highp float v2 = dot( v, v );
- float w2 = a2 / v2;
- return RECIPROCAL_PI * a2 * pow2 ( w2 );
- }
- #endif
- #ifdef USE_CLEARCOAT
- vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {
- vec3 f0 = material.clearcoatF0;
- float f90 = material.clearcoatF90;
- float roughness = material.clearcoatRoughness;
- float alpha = pow2( roughness );
- vec3 halfDir = normalize( lightDir + viewDir );
- float dotNL = saturate( dot( normal, lightDir ) );
- float dotNV = saturate( dot( normal, viewDir ) );
- float dotNH = saturate( dot( normal, halfDir ) );
- float dotVH = saturate( dot( viewDir, halfDir ) );
- vec3 F = F_Schlick( f0, f90, dotVH );
- float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
- float D = D_GGX( alpha, dotNH );
- return F * ( V * D );
- }
- #endif
- vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {
- vec3 f0 = material.specularColor;
- float f90 = material.specularF90;
- float roughness = material.roughness;
- float alpha = pow2( roughness );
- vec3 halfDir = normalize( lightDir + viewDir );
- float dotNL = saturate( dot( normal, lightDir ) );
- float dotNV = saturate( dot( normal, viewDir ) );
- float dotNH = saturate( dot( normal, halfDir ) );
- float dotVH = saturate( dot( viewDir, halfDir ) );
- vec3 F = F_Schlick( f0, f90, dotVH );
- #ifdef USE_IRIDESCENCE
- F = mix( F, material.iridescenceFresnel, material.iridescence );
- #endif
- #ifdef USE_ANISOTROPY
- float dotTL = dot( material.anisotropyT, lightDir );
- float dotTV = dot( material.anisotropyT, viewDir );
- float dotTH = dot( material.anisotropyT, halfDir );
- float dotBL = dot( material.anisotropyB, lightDir );
- float dotBV = dot( material.anisotropyB, viewDir );
- float dotBH = dot( material.anisotropyB, halfDir );
- float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );
- float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );
- #else
- float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
- float D = D_GGX( alpha, dotNH );
- #endif
- return F * ( V * D );
- }
- vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {
- const float LUT_SIZE = 64.0;
- const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;
- const float LUT_BIAS = 0.5 / LUT_SIZE;
- float dotNV = saturate( dot( N, V ) );
- vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );
- uv = uv * LUT_SCALE + LUT_BIAS;
- return uv;
- }
- float LTC_ClippedSphereFormFactor( const in vec3 f ) {
- float l = length( f );
- return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );
- }
- vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {
- float x = dot( v1, v2 );
- float y = abs( x );
- float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;
- float b = 3.4175940 + ( 4.1616724 + y ) * y;
- float v = a / b;
- float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;
- return cross( v1, v2 ) * theta_sintheta;
- }
- vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {
- vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];
- vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];
- vec3 lightNormal = cross( v1, v2 );
- if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );
- vec3 T1, T2;
- T1 = normalize( V - N * dot( V, N ) );
- T2 = - cross( N, T1 );
- mat3 mat = mInv * transpose( mat3( T1, T2, N ) );
- vec3 coords[ 4 ];
- coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );
- coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );
- coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );
- coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );
- coords[ 0 ] = normalize( coords[ 0 ] );
- coords[ 1 ] = normalize( coords[ 1 ] );
- coords[ 2 ] = normalize( coords[ 2 ] );
- coords[ 3 ] = normalize( coords[ 3 ] );
- vec3 vectorFormFactor = vec3( 0.0 );
- vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );
- vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );
- vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );
- vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );
- float result = LTC_ClippedSphereFormFactor( vectorFormFactor );
- return vec3( result );
- }
- #if defined( USE_SHEEN )
- float D_Charlie( float roughness, float dotNH ) {
- float alpha = pow2( roughness );
- float invAlpha = 1.0 / alpha;
- float cos2h = dotNH * dotNH;
- float sin2h = max( 1.0 - cos2h, 0.0078125 );
- return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );
- }
- float V_Neubelt( float dotNV, float dotNL ) {
- return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );
- }
- vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {
- vec3 halfDir = normalize( lightDir + viewDir );
- float dotNL = saturate( dot( normal, lightDir ) );
- float dotNV = saturate( dot( normal, viewDir ) );
- float dotNH = saturate( dot( normal, halfDir ) );
- float D = D_Charlie( sheenRoughness, dotNH );
- float V = V_Neubelt( dotNV, dotNL );
- return sheenColor * ( D * V );
- }
- #endif
- float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
- float dotNV = saturate( dot( normal, viewDir ) );
- float r2 = roughness * roughness;
- float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;
- float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;
- float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );
- return saturate( DG * RECIPROCAL_PI );
- }
- vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
- float dotNV = saturate( dot( normal, viewDir ) );
- vec2 uv = vec2( roughness, dotNV );
- return texture2D( dfgLUT, uv ).rg;
- }
- vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {
- vec2 fab = DFGApprox( normal, viewDir, roughness );
- return specularColor * fab.x + specularF90 * fab.y;
- }
- #ifdef USE_IRIDESCENCE
- 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 ) {
- #else
- 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 ) {
- #endif
- vec2 fab = DFGApprox( normal, viewDir, roughness );
- #ifdef USE_IRIDESCENCE
- vec3 Fr = mix( specularColor, iridescenceF0, iridescence );
- #else
- vec3 Fr = specularColor;
- #endif
- vec3 FssEss = Fr * fab.x + specularF90 * fab.y;
- float Ess = fab.x + fab.y;
- float Ems = 1.0 - Ess;
- vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );
- singleScatter += FssEss;
- multiScatter += Fms * Ems;
- }
- vec3 BRDF_GGX_Multiscatter( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {
- vec3 singleScatter = BRDF_GGX( lightDir, viewDir, normal, material );
- float dotNL = saturate( dot( normal, lightDir ) );
- float dotNV = saturate( dot( normal, viewDir ) );
- vec2 dfgV = DFGApprox( vec3(0.0, 0.0, 1.0), vec3(sqrt(1.0 - dotNV * dotNV), 0.0, dotNV), material.roughness );
- vec2 dfgL = DFGApprox( vec3(0.0, 0.0, 1.0), vec3(sqrt(1.0 - dotNL * dotNL), 0.0, dotNL), material.roughness );
- vec3 FssEss_V = material.specularColor * dfgV.x + material.specularF90 * dfgV.y;
- vec3 FssEss_L = material.specularColor * dfgL.x + material.specularF90 * dfgL.y;
- float Ess_V = dfgV.x + dfgV.y;
- float Ess_L = dfgL.x + dfgL.y;
- float Ems_V = 1.0 - Ess_V;
- float Ems_L = 1.0 - Ess_L;
- vec3 Favg = material.specularColor + ( 1.0 - material.specularColor ) * 0.047619;
- vec3 Fms = FssEss_V * FssEss_L * Favg / ( 1.0 - Ems_V * Ems_L * Favg * Favg + EPSILON );
- float compensationFactor = Ems_V * Ems_L;
- vec3 multiScatter = Fms * compensationFactor;
- return singleScatter + multiScatter;
- }
- #if NUM_RECT_AREA_LIGHTS > 0
- 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 ) {
- vec3 normal = geometryNormal;
- vec3 viewDir = geometryViewDir;
- vec3 position = geometryPosition;
- vec3 lightPos = rectAreaLight.position;
- vec3 halfWidth = rectAreaLight.halfWidth;
- vec3 halfHeight = rectAreaLight.halfHeight;
- vec3 lightColor = rectAreaLight.color;
- float roughness = material.roughness;
- vec3 rectCoords[ 4 ];
- rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;
- rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;
- rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;
- vec2 uv = LTC_Uv( normal, viewDir, roughness );
- vec4 t1 = texture2D( ltc_1, uv );
- vec4 t2 = texture2D( ltc_2, uv );
- mat3 mInv = mat3(
- vec3( t1.x, 0, t1.y ),
- vec3( 0, 1, 0 ),
- vec3( t1.z, 0, t1.w )
- );
- vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );
- reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );
- reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );
- }
- #endif
- 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 ) {
- float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
- vec3 irradiance = dotNL * directLight.color;
- #ifdef USE_CLEARCOAT
- float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );
- vec3 ccIrradiance = dotNLcc * directLight.color;
- clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );
- #endif
- #ifdef USE_SHEEN
- sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );
- #endif
- reflectedLight.directSpecular += irradiance * BRDF_GGX_Multiscatter( directLight.direction, geometryViewDir, geometryNormal, material );
- reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
- }
- 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 ) {
- reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
- }
- 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) {
- #ifdef USE_CLEARCOAT
- clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );
- #endif
- #ifdef USE_SHEEN
- sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
- #endif
- vec3 singleScattering = vec3( 0.0 );
- vec3 multiScattering = vec3( 0.0 );
- vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;
- #ifdef USE_IRIDESCENCE
- computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );
- #else
- computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );
- #endif
- vec3 totalScattering = singleScattering + multiScattering;
- vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );
- reflectedLight.indirectSpecular += radiance * singleScattering;
- reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;
- reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;
- }
- #define RE_Direct RE_Direct_Physical
- #define RE_Direct_RectArea RE_Direct_RectArea_Physical
- #define RE_IndirectDiffuse RE_IndirectDiffuse_Physical
- #define RE_IndirectSpecular RE_IndirectSpecular_Physical
- float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
- return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
- }`,ave=`
- vec3 geometryPosition = - vViewPosition;
- vec3 geometryNormal = normal;
- vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
- vec3 geometryClearcoatNormal = vec3( 0.0 );
- #ifdef USE_CLEARCOAT
- geometryClearcoatNormal = clearcoatNormal;
- #endif
- #ifdef USE_IRIDESCENCE
- float dotNVi = saturate( dot( normal, geometryViewDir ) );
- if ( material.iridescenceThickness == 0.0 ) {
- material.iridescence = 0.0;
- } else {
- material.iridescence = saturate( material.iridescence );
- }
- if ( material.iridescence > 0.0 ) {
- material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );
- material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );
- }
- #endif
- IncidentLight directLight;
- #if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )
- PointLight pointLight;
- #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0
- PointLightShadow pointLightShadow;
- #endif
- #pragma unroll_loop_start
- for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
- pointLight = pointLights[ i ];
- getPointLightInfo( pointLight, geometryPosition, directLight );
- #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )
- pointLightShadow = pointLightShadows[ i ];
- directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;
- #endif
- RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
- }
- #pragma unroll_loop_end
- #endif
- #if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )
- SpotLight spotLight;
- vec4 spotColor;
- vec3 spotLightCoord;
- bool inSpotLightMap;
- #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0
- SpotLightShadow spotLightShadow;
- #endif
- #pragma unroll_loop_start
- for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
- spotLight = spotLights[ i ];
- getSpotLightInfo( spotLight, geometryPosition, directLight );
- #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
- #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX
- #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
- #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS
- #else
- #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
- #endif
- #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )
- spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;
- inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );
- spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );
- directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;
- #endif
- #undef SPOT_LIGHT_MAP_INDEX
- #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
- spotLightShadow = spotLightShadows[ i ];
- directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
- #endif
- RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
- }
- #pragma unroll_loop_end
- #endif
- #if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )
- DirectionalLight directionalLight;
- #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0
- DirectionalLightShadow directionalLightShadow;
- #endif
- #pragma unroll_loop_start
- for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
- directionalLight = directionalLights[ i ];
- getDirectionalLightInfo( directionalLight, directLight );
- #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
- directionalLightShadow = directionalLightShadows[ i ];
- directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
- #endif
- RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
- }
- #pragma unroll_loop_end
- #endif
- #if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )
- RectAreaLight rectAreaLight;
- #pragma unroll_loop_start
- for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {
- rectAreaLight = rectAreaLights[ i ];
- RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
- }
- #pragma unroll_loop_end
- #endif
- #if defined( RE_IndirectDiffuse )
- vec3 iblIrradiance = vec3( 0.0 );
- vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );
- #if defined( USE_LIGHT_PROBES )
- irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );
- #endif
- #if ( NUM_HEMI_LIGHTS > 0 )
- #pragma unroll_loop_start
- for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
- irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );
- }
- #pragma unroll_loop_end
- #endif
- #endif
- #if defined( RE_IndirectSpecular )
- vec3 radiance = vec3( 0.0 );
- vec3 clearcoatRadiance = vec3( 0.0 );
- #endif`,sve=`#if defined( RE_IndirectDiffuse )
- #ifdef USE_LIGHTMAP
- vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
- vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
- irradiance += lightMapIrradiance;
- #endif
- #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )
- iblIrradiance += getIBLIrradiance( geometryNormal );
- #endif
- #endif
- #if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )
- #ifdef USE_ANISOTROPY
- radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );
- #else
- radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );
- #endif
- #ifdef USE_CLEARCOAT
- clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );
- #endif
- #endif`,ove=`#if defined( RE_IndirectDiffuse )
- RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
- #endif
- #if defined( RE_IndirectSpecular )
- RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
- #endif`,lve=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
- gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
- #endif`,cve=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
- uniform float logDepthBufFC;
- varying float vFragDepth;
- varying float vIsPerspective;
- #endif`,dve=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
- varying float vFragDepth;
- varying float vIsPerspective;
- #endif`,uve=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
- vFragDepth = 1.0 + gl_Position.w;
- vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
- #endif`,mve=`#ifdef USE_MAP
- vec4 sampledDiffuseColor = texture2D( map, vMapUv );
- #ifdef DECODE_VIDEO_TEXTURE
- sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );
- #endif
- diffuseColor *= sampledDiffuseColor;
- #endif`,hve=`#ifdef USE_MAP
- uniform sampler2D map;
- #endif`,pve=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
- #if defined( USE_POINTS_UV )
- vec2 uv = vUv;
- #else
- vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;
- #endif
- #endif
- #ifdef USE_MAP
- diffuseColor *= texture2D( map, uv );
- #endif
- #ifdef USE_ALPHAMAP
- diffuseColor.a *= texture2D( alphaMap, uv ).g;
- #endif`,fve=`#if defined( USE_POINTS_UV )
- varying vec2 vUv;
- #else
- #if defined( USE_MAP ) || defined( USE_ALPHAMAP )
- uniform mat3 uvTransform;
- #endif
- #endif
- #ifdef USE_MAP
- uniform sampler2D map;
- #endif
- #ifdef USE_ALPHAMAP
- uniform sampler2D alphaMap;
- #endif`,gve=`float metalnessFactor = metalness;
- #ifdef USE_METALNESSMAP
- vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
- metalnessFactor *= texelMetalness.b;
- #endif`,bve=`#ifdef USE_METALNESSMAP
- uniform sampler2D metalnessMap;
- #endif`,xve=`#ifdef USE_INSTANCING_MORPH
- float morphTargetInfluences[ MORPHTARGETS_COUNT ];
- float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;
- for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
- morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;
- }
- #endif`,yve=`#if defined( USE_MORPHCOLORS )
- vColor *= morphTargetBaseInfluence;
- for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
- #if defined( USE_COLOR_ALPHA )
- if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];
- #elif defined( USE_COLOR )
- if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];
- #endif
- }
- #endif`,vve=`#ifdef USE_MORPHNORMALS
- objectNormal *= morphTargetBaseInfluence;
- for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
- if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];
- }
- #endif`,wve=`#ifdef USE_MORPHTARGETS
- #ifndef USE_INSTANCING_MORPH
- uniform float morphTargetBaseInfluence;
- uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
- #endif
- uniform sampler2DArray morphTargetsTexture;
- uniform ivec2 morphTargetsTextureSize;
- vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {
- int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;
- int y = texelIndex / morphTargetsTextureSize.x;
- int x = texelIndex - y * morphTargetsTextureSize.x;
- ivec3 morphUV = ivec3( x, y, morphTargetIndex );
- return texelFetch( morphTargetsTexture, morphUV, 0 );
- }
- #endif`,Sve=`#ifdef USE_MORPHTARGETS
- transformed *= morphTargetBaseInfluence;
- for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
- if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];
- }
- #endif`,_ve=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
- #ifdef FLAT_SHADED
- vec3 fdx = dFdx( vViewPosition );
- vec3 fdy = dFdy( vViewPosition );
- vec3 normal = normalize( cross( fdx, fdy ) );
- #else
- vec3 normal = normalize( vNormal );
- #ifdef DOUBLE_SIDED
- normal *= faceDirection;
- #endif
- #endif
- #if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )
- #ifdef USE_TANGENT
- mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
- #else
- mat3 tbn = getTangentFrame( - vViewPosition, normal,
- #if defined( USE_NORMALMAP )
- vNormalMapUv
- #elif defined( USE_CLEARCOAT_NORMALMAP )
- vClearcoatNormalMapUv
- #else
- vUv
- #endif
- );
- #endif
- #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
- tbn[0] *= faceDirection;
- tbn[1] *= faceDirection;
- #endif
- #endif
- #ifdef USE_CLEARCOAT_NORMALMAP
- #ifdef USE_TANGENT
- mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
- #else
- mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );
- #endif
- #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
- tbn2[0] *= faceDirection;
- tbn2[1] *= faceDirection;
- #endif
- #endif
- vec3 nonPerturbedNormal = normal;`,kve=`#ifdef USE_NORMALMAP_OBJECTSPACE
- normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
- #ifdef FLIP_SIDED
- normal = - normal;
- #endif
- #ifdef DOUBLE_SIDED
- normal = normal * faceDirection;
- #endif
- normal = normalize( normalMatrix * normal );
- #elif defined( USE_NORMALMAP_TANGENTSPACE )
- vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
- mapN.xy *= normalScale;
- normal = normalize( tbn * mapN );
- #elif defined( USE_BUMPMAP )
- normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
- #endif`,Nve=`#ifndef FLAT_SHADED
- varying vec3 vNormal;
- #ifdef USE_TANGENT
- varying vec3 vTangent;
- varying vec3 vBitangent;
- #endif
- #endif`,Cve=`#ifndef FLAT_SHADED
- varying vec3 vNormal;
- #ifdef USE_TANGENT
- varying vec3 vTangent;
- varying vec3 vBitangent;
- #endif
- #endif`,Tve=`#ifndef FLAT_SHADED
- vNormal = normalize( transformedNormal );
- #ifdef USE_TANGENT
- vTangent = normalize( transformedTangent );
- vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
- #endif
- #endif`,Pve=`#ifdef USE_NORMALMAP
- uniform sampler2D normalMap;
- uniform vec2 normalScale;
- #endif
- #ifdef USE_NORMALMAP_OBJECTSPACE
- uniform mat3 normalMatrix;
- #endif
- #if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )
- mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {
- vec3 q0 = dFdx( eye_pos.xyz );
- vec3 q1 = dFdy( eye_pos.xyz );
- vec2 st0 = dFdx( uv.st );
- vec2 st1 = dFdy( uv.st );
- vec3 N = surf_norm;
- vec3 q1perp = cross( q1, N );
- vec3 q0perp = cross( N, q0 );
- vec3 T = q1perp * st0.x + q0perp * st1.x;
- vec3 B = q1perp * st0.y + q0perp * st1.y;
- float det = max( dot( T, T ), dot( B, B ) );
- float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );
- return mat3( T * scale, B * scale, N );
- }
- #endif`,Ave=`#ifdef USE_CLEARCOAT
- vec3 clearcoatNormal = nonPerturbedNormal;
- #endif`,Mve=`#ifdef USE_CLEARCOAT_NORMALMAP
- vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
- clearcoatMapN.xy *= clearcoatNormalScale;
- clearcoatNormal = normalize( tbn2 * clearcoatMapN );
- #endif`,Eve=`#ifdef USE_CLEARCOATMAP
- uniform sampler2D clearcoatMap;
- #endif
- #ifdef USE_CLEARCOAT_NORMALMAP
- uniform sampler2D clearcoatNormalMap;
- uniform vec2 clearcoatNormalScale;
- #endif
- #ifdef USE_CLEARCOAT_ROUGHNESSMAP
- uniform sampler2D clearcoatRoughnessMap;
- #endif`,jve=`#ifdef USE_IRIDESCENCEMAP
- uniform sampler2D iridescenceMap;
- #endif
- #ifdef USE_IRIDESCENCE_THICKNESSMAP
- uniform sampler2D iridescenceThicknessMap;
- #endif`,Dve=`#ifdef OPAQUE
- diffuseColor.a = 1.0;
- #endif
- #ifdef USE_TRANSMISSION
- diffuseColor.a *= material.transmissionAlpha;
- #endif
- gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,Rve=`vec3 packNormalToRGB( const in vec3 normal ) {
- return normalize( normal ) * 0.5 + 0.5;
- }
- vec3 unpackRGBToNormal( const in vec3 rgb ) {
- return 2.0 * rgb.xyz - 1.0;
- }
- const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.;
- const float Inv255 = 1. / 255.;
- const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 );
- const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g );
- const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b );
- const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a );
- vec4 packDepthToRGBA( const in float v ) {
- if( v <= 0.0 )
- return vec4( 0., 0., 0., 0. );
- if( v >= 1.0 )
- return vec4( 1., 1., 1., 1. );
- float vuf;
- float af = modf( v * PackFactors.a, vuf );
- float bf = modf( vuf * ShiftRight8, vuf );
- float gf = modf( vuf * ShiftRight8, vuf );
- return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af );
- }
- vec3 packDepthToRGB( const in float v ) {
- if( v <= 0.0 )
- return vec3( 0., 0., 0. );
- if( v >= 1.0 )
- return vec3( 1., 1., 1. );
- float vuf;
- float bf = modf( v * PackFactors.b, vuf );
- float gf = modf( vuf * ShiftRight8, vuf );
- return vec3( vuf * Inv255, gf * PackUpscale, bf );
- }
- vec2 packDepthToRG( const in float v ) {
- if( v <= 0.0 )
- return vec2( 0., 0. );
- if( v >= 1.0 )
- return vec2( 1., 1. );
- float vuf;
- float gf = modf( v * 256., vuf );
- return vec2( vuf * Inv255, gf );
- }
- float unpackRGBAToDepth( const in vec4 v ) {
- return dot( v, UnpackFactors4 );
- }
- float unpackRGBToDepth( const in vec3 v ) {
- return dot( v, UnpackFactors3 );
- }
- float unpackRGToDepth( const in vec2 v ) {
- return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g;
- }
- vec4 pack2HalfToRGBA( const in vec2 v ) {
- vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );
- return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );
- }
- vec2 unpackRGBATo2Half( const in vec4 v ) {
- return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );
- }
- float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {
- return ( viewZ + near ) / ( near - far );
- }
- float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {
- return depth * ( near - far ) - near;
- }
- float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {
- return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );
- }
- float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {
- return ( near * far ) / ( ( far - near ) * depth - far );
- }`,Fve=`#ifdef PREMULTIPLIED_ALPHA
- gl_FragColor.rgb *= gl_FragColor.a;
- #endif`,Lve=`vec4 mvPosition = vec4( transformed, 1.0 );
- #ifdef USE_BATCHING
- mvPosition = batchingMatrix * mvPosition;
- #endif
- #ifdef USE_INSTANCING
- mvPosition = instanceMatrix * mvPosition;
- #endif
- mvPosition = modelViewMatrix * mvPosition;
- gl_Position = projectionMatrix * mvPosition;`,Ove=`#ifdef DITHERING
- gl_FragColor.rgb = dithering( gl_FragColor.rgb );
- #endif`,Ive=`#ifdef DITHERING
- vec3 dithering( vec3 color ) {
- float grid_position = rand( gl_FragCoord.xy );
- vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
- dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
- return color + dither_shift_RGB;
- }
- #endif`,zve=`float roughnessFactor = roughness;
- #ifdef USE_ROUGHNESSMAP
- vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
- roughnessFactor *= texelRoughness.g;
- #endif`,Uve=`#ifdef USE_ROUGHNESSMAP
- uniform sampler2D roughnessMap;
- #endif`,Bve=`#if NUM_SPOT_LIGHT_COORDS > 0
- varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
- #endif
- #if NUM_SPOT_LIGHT_MAPS > 0
- uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];
- #endif
- #ifdef USE_SHADOWMAP
- #if NUM_DIR_LIGHT_SHADOWS > 0
- uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
- varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
- struct DirectionalLightShadow {
- float shadowIntensity;
- float shadowBias;
- float shadowNormalBias;
- float shadowRadius;
- vec2 shadowMapSize;
- };
- uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
- #endif
- #if NUM_SPOT_LIGHT_SHADOWS > 0
- uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
- struct SpotLightShadow {
- float shadowIntensity;
- float shadowBias;
- float shadowNormalBias;
- float shadowRadius;
- vec2 shadowMapSize;
- };
- uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
- #endif
- #if NUM_POINT_LIGHT_SHADOWS > 0
- uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
- varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
- struct PointLightShadow {
- float shadowIntensity;
- float shadowBias;
- float shadowNormalBias;
- float shadowRadius;
- vec2 shadowMapSize;
- float shadowCameraNear;
- float shadowCameraFar;
- };
- uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
- #endif
- float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {
- float depth = unpackRGBAToDepth( texture2D( depths, uv ) );
- #ifdef USE_REVERSED_DEPTH_BUFFER
- return step( depth, compare );
- #else
- return step( compare, depth );
- #endif
- }
- vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {
- return unpackRGBATo2Half( texture2D( shadow, uv ) );
- }
- float VSMShadow( sampler2D shadow, vec2 uv, float compare ) {
- float occlusion = 1.0;
- vec2 distribution = texture2DDistribution( shadow, uv );
- #ifdef USE_REVERSED_DEPTH_BUFFER
- float hard_shadow = step( distribution.x, compare );
- #else
- float hard_shadow = step( compare, distribution.x );
- #endif
- if ( hard_shadow != 1.0 ) {
- float distance = compare - distribution.x;
- float variance = max( 0.00000, distribution.y * distribution.y );
- 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 );
- }
- return occlusion;
- }
- float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
- float shadow = 1.0;
- shadowCoord.xyz /= shadowCoord.w;
- shadowCoord.z += shadowBias;
- bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
- bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
- if ( frustumTest ) {
- #if defined( SHADOWMAP_TYPE_PCF )
- vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
- float dx0 = - texelSize.x * shadowRadius;
- float dy0 = - texelSize.y * shadowRadius;
- float dx1 = + texelSize.x * shadowRadius;
- float dy1 = + texelSize.y * shadowRadius;
- float dx2 = dx0 / 2.0;
- float dy2 = dy0 / 2.0;
- float dx3 = dx1 / 2.0;
- float dy3 = dy1 / 2.0;
- shadow = (
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +
- texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )
- ) * ( 1.0 / 17.0 );
- #elif defined( SHADOWMAP_TYPE_PCF_SOFT )
- vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
- float dx = texelSize.x;
- float dy = texelSize.y;
- vec2 uv = shadowCoord.xy;
- vec2 f = fract( uv * shadowMapSize + 0.5 );
- uv -= f * texelSize;
- shadow = (
- texture2DCompare( shadowMap, uv, shadowCoord.z ) +
- texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +
- texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +
- texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +
- mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),
- texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),
- f.x ) +
- mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),
- texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),
- f.x ) +
- mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),
- texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),
- f.y ) +
- mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),
- texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),
- f.y ) +
- mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),
- texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),
- f.x ),
- mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),
- texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),
- f.x ),
- f.y )
- ) * ( 1.0 / 9.0 );
- #elif defined( SHADOWMAP_TYPE_VSM )
- shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );
- #else
- shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );
- #endif
- }
- return mix( 1.0, shadow, shadowIntensity );
- }
- vec2 cubeToUV( vec3 v, float texelSizeY ) {
- vec3 absV = abs( v );
- float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );
- absV *= scaleToCube;
- v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );
- vec2 planar = v.xy;
- float almostATexel = 1.5 * texelSizeY;
- float almostOne = 1.0 - almostATexel;
- if ( absV.z >= almostOne ) {
- if ( v.z > 0.0 )
- planar.x = 4.0 - v.x;
- } else if ( absV.x >= almostOne ) {
- float signX = sign( v.x );
- planar.x = v.z * signX + 2.0 * signX;
- } else if ( absV.y >= almostOne ) {
- float signY = sign( v.y );
- planar.x = v.x + 2.0 * signY + 2.0;
- planar.y = v.z * signY - 2.0;
- }
- return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );
- }
- float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
- float shadow = 1.0;
- vec3 lightToPosition = shadowCoord.xyz;
-
- float lightToPositionLength = length( lightToPosition );
- if ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) {
- float dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias;
- vec3 bd3D = normalize( lightToPosition );
- vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );
- #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )
- vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;
- shadow = (
- texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +
- texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +
- texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +
- texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +
- texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +
- texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +
- texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +
- texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +
- texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )
- ) * ( 1.0 / 9.0 );
- #else
- shadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );
- #endif
- }
- return mix( 1.0, shadow, shadowIntensity );
- }
- #endif`,Hve=`#if NUM_SPOT_LIGHT_COORDS > 0
- uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];
- varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
- #endif
- #ifdef USE_SHADOWMAP
- #if NUM_DIR_LIGHT_SHADOWS > 0
- uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];
- varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
- struct DirectionalLightShadow {
- float shadowIntensity;
- float shadowBias;
- float shadowNormalBias;
- float shadowRadius;
- vec2 shadowMapSize;
- };
- uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
- #endif
- #if NUM_SPOT_LIGHT_SHADOWS > 0
- struct SpotLightShadow {
- float shadowIntensity;
- float shadowBias;
- float shadowNormalBias;
- float shadowRadius;
- vec2 shadowMapSize;
- };
- uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
- #endif
- #if NUM_POINT_LIGHT_SHADOWS > 0
- uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];
- varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
- struct PointLightShadow {
- float shadowIntensity;
- float shadowBias;
- float shadowNormalBias;
- float shadowRadius;
- vec2 shadowMapSize;
- float shadowCameraNear;
- float shadowCameraFar;
- };
- uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
- #endif
- #endif`,$ve=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
- vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
- vec4 shadowWorldPosition;
- #endif
- #if defined( USE_SHADOWMAP )
- #if NUM_DIR_LIGHT_SHADOWS > 0
- #pragma unroll_loop_start
- for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
- shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );
- vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;
- }
- #pragma unroll_loop_end
- #endif
- #if NUM_POINT_LIGHT_SHADOWS > 0
- #pragma unroll_loop_start
- for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
- shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );
- vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;
- }
- #pragma unroll_loop_end
- #endif
- #endif
- #if NUM_SPOT_LIGHT_COORDS > 0
- #pragma unroll_loop_start
- for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {
- shadowWorldPosition = worldPosition;
- #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
- shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;
- #endif
- vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;
- }
- #pragma unroll_loop_end
- #endif`,qve=`float getShadowMask() {
- float shadow = 1.0;
- #ifdef USE_SHADOWMAP
- #if NUM_DIR_LIGHT_SHADOWS > 0
- DirectionalLightShadow directionalLight;
- #pragma unroll_loop_start
- for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
- directionalLight = directionalLightShadows[ i ];
- shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
- }
- #pragma unroll_loop_end
- #endif
- #if NUM_SPOT_LIGHT_SHADOWS > 0
- SpotLightShadow spotLight;
- #pragma unroll_loop_start
- for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {
- spotLight = spotLightShadows[ i ];
- shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
- }
- #pragma unroll_loop_end
- #endif
- #if NUM_POINT_LIGHT_SHADOWS > 0
- PointLightShadow pointLight;
- #pragma unroll_loop_start
- for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
- pointLight = pointLightShadows[ i ];
- shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;
- }
- #pragma unroll_loop_end
- #endif
- #endif
- return shadow;
- }`,Vve=`#ifdef USE_SKINNING
- mat4 boneMatX = getBoneMatrix( skinIndex.x );
- mat4 boneMatY = getBoneMatrix( skinIndex.y );
- mat4 boneMatZ = getBoneMatrix( skinIndex.z );
- mat4 boneMatW = getBoneMatrix( skinIndex.w );
- #endif`,Gve=`#ifdef USE_SKINNING
- uniform mat4 bindMatrix;
- uniform mat4 bindMatrixInverse;
- uniform highp sampler2D boneTexture;
- mat4 getBoneMatrix( const in float i ) {
- int size = textureSize( boneTexture, 0 ).x;
- int j = int( i ) * 4;
- int x = j % size;
- int y = j / size;
- vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );
- vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );
- vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );
- vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );
- return mat4( v1, v2, v3, v4 );
- }
- #endif`,Wve=`#ifdef USE_SKINNING
- vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
- vec4 skinned = vec4( 0.0 );
- skinned += boneMatX * skinVertex * skinWeight.x;
- skinned += boneMatY * skinVertex * skinWeight.y;
- skinned += boneMatZ * skinVertex * skinWeight.z;
- skinned += boneMatW * skinVertex * skinWeight.w;
- transformed = ( bindMatrixInverse * skinned ).xyz;
- #endif`,Kve=`#ifdef USE_SKINNING
- mat4 skinMatrix = mat4( 0.0 );
- skinMatrix += skinWeight.x * boneMatX;
- skinMatrix += skinWeight.y * boneMatY;
- skinMatrix += skinWeight.z * boneMatZ;
- skinMatrix += skinWeight.w * boneMatW;
- skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;
- objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;
- #ifdef USE_TANGENT
- objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
- #endif
- #endif`,Yve=`float specularStrength;
- #ifdef USE_SPECULARMAP
- vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
- specularStrength = texelSpecular.r;
- #else
- specularStrength = 1.0;
- #endif`,Xve=`#ifdef USE_SPECULARMAP
- uniform sampler2D specularMap;
- #endif`,Qve=`#if defined( TONE_MAPPING )
- gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
- #endif`,Zve=`#ifndef saturate
- #define saturate( a ) clamp( a, 0.0, 1.0 )
- #endif
- uniform float toneMappingExposure;
- vec3 LinearToneMapping( vec3 color ) {
- return saturate( toneMappingExposure * color );
- }
- vec3 ReinhardToneMapping( vec3 color ) {
- color *= toneMappingExposure;
- return saturate( color / ( vec3( 1.0 ) + color ) );
- }
- vec3 CineonToneMapping( vec3 color ) {
- color *= toneMappingExposure;
- color = max( vec3( 0.0 ), color - 0.004 );
- return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );
- }
- vec3 RRTAndODTFit( vec3 v ) {
- vec3 a = v * ( v + 0.0245786 ) - 0.000090537;
- vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;
- return a / b;
- }
- vec3 ACESFilmicToneMapping( vec3 color ) {
- const mat3 ACESInputMat = mat3(
- vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ),
- vec3( 0.04823, 0.01566, 0.83777 )
- );
- const mat3 ACESOutputMat = mat3(
- vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ),
- vec3( -0.07367, -0.00605, 1.07602 )
- );
- color *= toneMappingExposure / 0.6;
- color = ACESInputMat * color;
- color = RRTAndODTFit( color );
- color = ACESOutputMat * color;
- return saturate( color );
- }
- const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(
- vec3( 1.6605, - 0.1246, - 0.0182 ),
- vec3( - 0.5876, 1.1329, - 0.1006 ),
- vec3( - 0.0728, - 0.0083, 1.1187 )
- );
- const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(
- vec3( 0.6274, 0.0691, 0.0164 ),
- vec3( 0.3293, 0.9195, 0.0880 ),
- vec3( 0.0433, 0.0113, 0.8956 )
- );
- vec3 agxDefaultContrastApprox( vec3 x ) {
- vec3 x2 = x * x;
- vec3 x4 = x2 * x2;
- return + 15.5 * x4 * x2
- - 40.14 * x4 * x
- + 31.96 * x4
- - 6.868 * x2 * x
- + 0.4298 * x2
- + 0.1191 * x
- - 0.00232;
- }
- vec3 AgXToneMapping( vec3 color ) {
- const mat3 AgXInsetMatrix = mat3(
- vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),
- vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),
- vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )
- );
- const mat3 AgXOutsetMatrix = mat3(
- vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),
- vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),
- vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )
- );
- const float AgxMinEv = - 12.47393; const float AgxMaxEv = 4.026069;
- color *= toneMappingExposure;
- color = LINEAR_SRGB_TO_LINEAR_REC2020 * color;
- color = AgXInsetMatrix * color;
- color = max( color, 1e-10 ); color = log2( color );
- color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );
- color = clamp( color, 0.0, 1.0 );
- color = agxDefaultContrastApprox( color );
- color = AgXOutsetMatrix * color;
- color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );
- color = LINEAR_REC2020_TO_LINEAR_SRGB * color;
- color = clamp( color, 0.0, 1.0 );
- return color;
- }
- vec3 NeutralToneMapping( vec3 color ) {
- const float StartCompression = 0.8 - 0.04;
- const float Desaturation = 0.15;
- color *= toneMappingExposure;
- float x = min( color.r, min( color.g, color.b ) );
- float offset = x < 0.08 ? x - 6.25 * x * x : 0.04;
- color -= offset;
- float peak = max( color.r, max( color.g, color.b ) );
- if ( peak < StartCompression ) return color;
- float d = 1. - StartCompression;
- float newPeak = 1. - d * d / ( peak + d - StartCompression );
- color *= newPeak / peak;
- float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );
- return mix( color, vec3( newPeak ), g );
- }
- vec3 CustomToneMapping( vec3 color ) { return color; }`,Jve=`#ifdef USE_TRANSMISSION
- material.transmission = transmission;
- material.transmissionAlpha = 1.0;
- material.thickness = thickness;
- material.attenuationDistance = attenuationDistance;
- material.attenuationColor = attenuationColor;
- #ifdef USE_TRANSMISSIONMAP
- material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;
- #endif
- #ifdef USE_THICKNESSMAP
- material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;
- #endif
- vec3 pos = vWorldPosition;
- vec3 v = normalize( cameraPosition - pos );
- vec3 n = inverseTransformDirection( normal, viewMatrix );
- vec4 transmitted = getIBLVolumeRefraction(
- n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,
- pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,
- material.attenuationColor, material.attenuationDistance );
- material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );
- totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );
- #endif`,e0e=`#ifdef USE_TRANSMISSION
- uniform float transmission;
- uniform float thickness;
- uniform float attenuationDistance;
- uniform vec3 attenuationColor;
- #ifdef USE_TRANSMISSIONMAP
- uniform sampler2D transmissionMap;
- #endif
- #ifdef USE_THICKNESSMAP
- uniform sampler2D thicknessMap;
- #endif
- uniform vec2 transmissionSamplerSize;
- uniform sampler2D transmissionSamplerMap;
- uniform mat4 modelMatrix;
- uniform mat4 projectionMatrix;
- varying vec3 vWorldPosition;
- float w0( float a ) {
- return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );
- }
- float w1( float a ) {
- return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );
- }
- float w2( float a ){
- return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );
- }
- float w3( float a ) {
- return ( 1.0 / 6.0 ) * ( a * a * a );
- }
- float g0( float a ) {
- return w0( a ) + w1( a );
- }
- float g1( float a ) {
- return w2( a ) + w3( a );
- }
- float h0( float a ) {
- return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );
- }
- float h1( float a ) {
- return 1.0 + w3( a ) / ( w2( a ) + w3( a ) );
- }
- vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {
- uv = uv * texelSize.zw + 0.5;
- vec2 iuv = floor( uv );
- vec2 fuv = fract( uv );
- float g0x = g0( fuv.x );
- float g1x = g1( fuv.x );
- float h0x = h0( fuv.x );
- float h1x = h1( fuv.x );
- float h0y = h0( fuv.y );
- float h1y = h1( fuv.y );
- vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
- vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
- vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
- vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
- return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +
- g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );
- }
- vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {
- vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );
- vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );
- vec2 fLodSizeInv = 1.0 / fLodSize;
- vec2 cLodSizeInv = 1.0 / cLodSize;
- vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );
- vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );
- return mix( fSample, cSample, fract( lod ) );
- }
- vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {
- vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );
- vec3 modelScale;
- modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );
- modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );
- modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );
- return normalize( refractionVector ) * thickness * modelScale;
- }
- float applyIorToRoughness( const in float roughness, const in float ior ) {
- return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );
- }
- vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {
- float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );
- return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );
- }
- vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {
- if ( isinf( attenuationDistance ) ) {
- return vec3( 1.0 );
- } else {
- vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;
- vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance;
- }
- }
- vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,
- const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,
- const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,
- const in vec3 attenuationColor, const in float attenuationDistance ) {
- vec4 transmittedLight;
- vec3 transmittance;
- #ifdef USE_DISPERSION
- float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;
- vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );
- for ( int i = 0; i < 3; i ++ ) {
- vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );
- vec3 refractedRayExit = position + transmissionRay;
- vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
- vec2 refractionCoords = ndcPos.xy / ndcPos.w;
- refractionCoords += 1.0;
- refractionCoords /= 2.0;
- vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );
- transmittedLight[ i ] = transmissionSample[ i ];
- transmittedLight.a += transmissionSample.a;
- transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];
- }
- transmittedLight.a /= 3.0;
- #else
- vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );
- vec3 refractedRayExit = position + transmissionRay;
- vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
- vec2 refractionCoords = ndcPos.xy / ndcPos.w;
- refractionCoords += 1.0;
- refractionCoords /= 2.0;
- transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );
- transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );
- #endif
- vec3 attenuatedColor = transmittance * transmittedLight.rgb;
- vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );
- float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;
- return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );
- }
- #endif`,t0e=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
- varying vec2 vUv;
- #endif
- #ifdef USE_MAP
- varying vec2 vMapUv;
- #endif
- #ifdef USE_ALPHAMAP
- varying vec2 vAlphaMapUv;
- #endif
- #ifdef USE_LIGHTMAP
- varying vec2 vLightMapUv;
- #endif
- #ifdef USE_AOMAP
- varying vec2 vAoMapUv;
- #endif
- #ifdef USE_BUMPMAP
- varying vec2 vBumpMapUv;
- #endif
- #ifdef USE_NORMALMAP
- varying vec2 vNormalMapUv;
- #endif
- #ifdef USE_EMISSIVEMAP
- varying vec2 vEmissiveMapUv;
- #endif
- #ifdef USE_METALNESSMAP
- varying vec2 vMetalnessMapUv;
- #endif
- #ifdef USE_ROUGHNESSMAP
- varying vec2 vRoughnessMapUv;
- #endif
- #ifdef USE_ANISOTROPYMAP
- varying vec2 vAnisotropyMapUv;
- #endif
- #ifdef USE_CLEARCOATMAP
- varying vec2 vClearcoatMapUv;
- #endif
- #ifdef USE_CLEARCOAT_NORMALMAP
- varying vec2 vClearcoatNormalMapUv;
- #endif
- #ifdef USE_CLEARCOAT_ROUGHNESSMAP
- varying vec2 vClearcoatRoughnessMapUv;
- #endif
- #ifdef USE_IRIDESCENCEMAP
- varying vec2 vIridescenceMapUv;
- #endif
- #ifdef USE_IRIDESCENCE_THICKNESSMAP
- varying vec2 vIridescenceThicknessMapUv;
- #endif
- #ifdef USE_SHEEN_COLORMAP
- varying vec2 vSheenColorMapUv;
- #endif
- #ifdef USE_SHEEN_ROUGHNESSMAP
- varying vec2 vSheenRoughnessMapUv;
- #endif
- #ifdef USE_SPECULARMAP
- varying vec2 vSpecularMapUv;
- #endif
- #ifdef USE_SPECULAR_COLORMAP
- varying vec2 vSpecularColorMapUv;
- #endif
- #ifdef USE_SPECULAR_INTENSITYMAP
- varying vec2 vSpecularIntensityMapUv;
- #endif
- #ifdef USE_TRANSMISSIONMAP
- uniform mat3 transmissionMapTransform;
- varying vec2 vTransmissionMapUv;
- #endif
- #ifdef USE_THICKNESSMAP
- uniform mat3 thicknessMapTransform;
- varying vec2 vThicknessMapUv;
- #endif`,n0e=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
- varying vec2 vUv;
- #endif
- #ifdef USE_MAP
- uniform mat3 mapTransform;
- varying vec2 vMapUv;
- #endif
- #ifdef USE_ALPHAMAP
- uniform mat3 alphaMapTransform;
- varying vec2 vAlphaMapUv;
- #endif
- #ifdef USE_LIGHTMAP
- uniform mat3 lightMapTransform;
- varying vec2 vLightMapUv;
- #endif
- #ifdef USE_AOMAP
- uniform mat3 aoMapTransform;
- varying vec2 vAoMapUv;
- #endif
- #ifdef USE_BUMPMAP
- uniform mat3 bumpMapTransform;
- varying vec2 vBumpMapUv;
- #endif
- #ifdef USE_NORMALMAP
- uniform mat3 normalMapTransform;
- varying vec2 vNormalMapUv;
- #endif
- #ifdef USE_DISPLACEMENTMAP
- uniform mat3 displacementMapTransform;
- varying vec2 vDisplacementMapUv;
- #endif
- #ifdef USE_EMISSIVEMAP
- uniform mat3 emissiveMapTransform;
- varying vec2 vEmissiveMapUv;
- #endif
- #ifdef USE_METALNESSMAP
- uniform mat3 metalnessMapTransform;
- varying vec2 vMetalnessMapUv;
- #endif
- #ifdef USE_ROUGHNESSMAP
- uniform mat3 roughnessMapTransform;
- varying vec2 vRoughnessMapUv;
- #endif
- #ifdef USE_ANISOTROPYMAP
- uniform mat3 anisotropyMapTransform;
- varying vec2 vAnisotropyMapUv;
- #endif
- #ifdef USE_CLEARCOATMAP
- uniform mat3 clearcoatMapTransform;
- varying vec2 vClearcoatMapUv;
- #endif
- #ifdef USE_CLEARCOAT_NORMALMAP
- uniform mat3 clearcoatNormalMapTransform;
- varying vec2 vClearcoatNormalMapUv;
- #endif
- #ifdef USE_CLEARCOAT_ROUGHNESSMAP
- uniform mat3 clearcoatRoughnessMapTransform;
- varying vec2 vClearcoatRoughnessMapUv;
- #endif
- #ifdef USE_SHEEN_COLORMAP
- uniform mat3 sheenColorMapTransform;
- varying vec2 vSheenColorMapUv;
- #endif
- #ifdef USE_SHEEN_ROUGHNESSMAP
- uniform mat3 sheenRoughnessMapTransform;
- varying vec2 vSheenRoughnessMapUv;
- #endif
- #ifdef USE_IRIDESCENCEMAP
- uniform mat3 iridescenceMapTransform;
- varying vec2 vIridescenceMapUv;
- #endif
- #ifdef USE_IRIDESCENCE_THICKNESSMAP
- uniform mat3 iridescenceThicknessMapTransform;
- varying vec2 vIridescenceThicknessMapUv;
- #endif
- #ifdef USE_SPECULARMAP
- uniform mat3 specularMapTransform;
- varying vec2 vSpecularMapUv;
- #endif
- #ifdef USE_SPECULAR_COLORMAP
- uniform mat3 specularColorMapTransform;
- varying vec2 vSpecularColorMapUv;
- #endif
- #ifdef USE_SPECULAR_INTENSITYMAP
- uniform mat3 specularIntensityMapTransform;
- varying vec2 vSpecularIntensityMapUv;
- #endif
- #ifdef USE_TRANSMISSIONMAP
- uniform mat3 transmissionMapTransform;
- varying vec2 vTransmissionMapUv;
- #endif
- #ifdef USE_THICKNESSMAP
- uniform mat3 thicknessMapTransform;
- varying vec2 vThicknessMapUv;
- #endif`,r0e=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
- vUv = vec3( uv, 1 ).xy;
- #endif
- #ifdef USE_MAP
- vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;
- #endif
- #ifdef USE_ALPHAMAP
- vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;
- #endif
- #ifdef USE_LIGHTMAP
- vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;
- #endif
- #ifdef USE_AOMAP
- vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;
- #endif
- #ifdef USE_BUMPMAP
- vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;
- #endif
- #ifdef USE_NORMALMAP
- vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;
- #endif
- #ifdef USE_DISPLACEMENTMAP
- vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;
- #endif
- #ifdef USE_EMISSIVEMAP
- vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;
- #endif
- #ifdef USE_METALNESSMAP
- vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;
- #endif
- #ifdef USE_ROUGHNESSMAP
- vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;
- #endif
- #ifdef USE_ANISOTROPYMAP
- vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;
- #endif
- #ifdef USE_CLEARCOATMAP
- vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;
- #endif
- #ifdef USE_CLEARCOAT_NORMALMAP
- vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;
- #endif
- #ifdef USE_CLEARCOAT_ROUGHNESSMAP
- vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;
- #endif
- #ifdef USE_IRIDESCENCEMAP
- vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;
- #endif
- #ifdef USE_IRIDESCENCE_THICKNESSMAP
- vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;
- #endif
- #ifdef USE_SHEEN_COLORMAP
- vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;
- #endif
- #ifdef USE_SHEEN_ROUGHNESSMAP
- vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;
- #endif
- #ifdef USE_SPECULARMAP
- vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;
- #endif
- #ifdef USE_SPECULAR_COLORMAP
- vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;
- #endif
- #ifdef USE_SPECULAR_INTENSITYMAP
- vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;
- #endif
- #ifdef USE_TRANSMISSIONMAP
- vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;
- #endif
- #ifdef USE_THICKNESSMAP
- vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;
- #endif`,i0e=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
- vec4 worldPosition = vec4( transformed, 1.0 );
- #ifdef USE_BATCHING
- worldPosition = batchingMatrix * worldPosition;
- #endif
- #ifdef USE_INSTANCING
- worldPosition = instanceMatrix * worldPosition;
- #endif
- worldPosition = modelMatrix * worldPosition;
- #endif`;const a0e=`varying vec2 vUv;
- uniform mat3 uvTransform;
- void main() {
- vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
- gl_Position = vec4( position.xy, 1.0, 1.0 );
- }`,s0e=`uniform sampler2D t2D;
- uniform float backgroundIntensity;
- varying vec2 vUv;
- void main() {
- vec4 texColor = texture2D( t2D, vUv );
- #ifdef DECODE_VIDEO_TEXTURE
- 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 );
- #endif
- texColor.rgb *= backgroundIntensity;
- gl_FragColor = texColor;
- #include <tonemapping_fragment>
- #include <colorspace_fragment>
- }`,o0e=`varying vec3 vWorldDirection;
- #include <common>
- void main() {
- vWorldDirection = transformDirection( position, modelMatrix );
- #include <begin_vertex>
- #include <project_vertex>
- gl_Position.z = gl_Position.w;
- }`,l0e=`#ifdef ENVMAP_TYPE_CUBE
- uniform samplerCube envMap;
- #elif defined( ENVMAP_TYPE_CUBE_UV )
- uniform sampler2D envMap;
- #endif
- uniform float flipEnvMap;
- uniform float backgroundBlurriness;
- uniform float backgroundIntensity;
- uniform mat3 backgroundRotation;
- varying vec3 vWorldDirection;
- #include <cube_uv_reflection_fragment>
- void main() {
- #ifdef ENVMAP_TYPE_CUBE
- vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );
- #elif defined( ENVMAP_TYPE_CUBE_UV )
- vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );
- #else
- vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );
- #endif
- texColor.rgb *= backgroundIntensity;
- gl_FragColor = texColor;
- #include <tonemapping_fragment>
- #include <colorspace_fragment>
- }`,c0e=`varying vec3 vWorldDirection;
- #include <common>
- void main() {
- vWorldDirection = transformDirection( position, modelMatrix );
- #include <begin_vertex>
- #include <project_vertex>
- gl_Position.z = gl_Position.w;
- }`,d0e=`uniform samplerCube tCube;
- uniform float tFlip;
- uniform float opacity;
- varying vec3 vWorldDirection;
- void main() {
- vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );
- gl_FragColor = texColor;
- gl_FragColor.a *= opacity;
- #include <tonemapping_fragment>
- #include <colorspace_fragment>
- }`,u0e=`#include <common>
- #include <batching_pars_vertex>
- #include <uv_pars_vertex>
- #include <displacementmap_pars_vertex>
- #include <morphtarget_pars_vertex>
- #include <skinning_pars_vertex>
- #include <logdepthbuf_pars_vertex>
- #include <clipping_planes_pars_vertex>
- varying vec2 vHighPrecisionZW;
- void main() {
- #include <uv_vertex>
- #include <batching_vertex>
- #include <skinbase_vertex>
- #include <morphinstance_vertex>
- #ifdef USE_DISPLACEMENTMAP
- #include <beginnormal_vertex>
- #include <morphnormal_vertex>
- #include <skinnormal_vertex>
- #endif
- #include <begin_vertex>
- #include <morphtarget_vertex>
- #include <skinning_vertex>
- #include <displacementmap_vertex>
- #include <project_vertex>
- #include <logdepthbuf_vertex>
- #include <clipping_planes_vertex>
- vHighPrecisionZW = gl_Position.zw;
- }`,m0e=`#if DEPTH_PACKING == 3200
- uniform float opacity;
- #endif
- #include <common>
- #include <packing>
- #include <uv_pars_fragment>
- #include <map_pars_fragment>
- #include <alphamap_pars_fragment>
- #include <alphatest_pars_fragment>
- #include <alphahash_pars_fragment>
- #include <logdepthbuf_pars_fragment>
- #include <clipping_planes_pars_fragment>
- varying vec2 vHighPrecisionZW;
- void main() {
- vec4 diffuseColor = vec4( 1.0 );
- #include <clipping_planes_fragment>
- #if DEPTH_PACKING == 3200
- diffuseColor.a = opacity;
- #endif
- #include <map_fragment>
- #include <alphamap_fragment>
- #include <alphatest_fragment>
- #include <alphahash_fragment>
- #include <logdepthbuf_fragment>
- #ifdef USE_REVERSED_DEPTH_BUFFER
- float fragCoordZ = vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ];
- #else
- float fragCoordZ = 0.5 * vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ] + 0.5;
- #endif
- #if DEPTH_PACKING == 3200
- gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );
- #elif DEPTH_PACKING == 3201
- gl_FragColor = packDepthToRGBA( fragCoordZ );
- #elif DEPTH_PACKING == 3202
- gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );
- #elif DEPTH_PACKING == 3203
- gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );
- #endif
- }`,h0e=`#define DISTANCE
- varying vec3 vWorldPosition;
- #include <common>
- #include <batching_pars_vertex>
- #include <uv_pars_vertex>
- #include <displacementmap_pars_vertex>
- #include <morphtarget_pars_vertex>
- #include <skinning_pars_vertex>
- #include <clipping_planes_pars_vertex>
- void main() {
- #include <uv_vertex>
- #include <batching_vertex>
- #include <skinbase_vertex>
- #include <morphinstance_vertex>
- #ifdef USE_DISPLACEMENTMAP
- #include <beginnormal_vertex>
- #include <morphnormal_vertex>
- #include <skinnormal_vertex>
- #endif
- #include <begin_vertex>
- #include <morphtarget_vertex>
- #include <skinning_vertex>
- #include <displacementmap_vertex>
- #include <project_vertex>
- #include <worldpos_vertex>
- #include <clipping_planes_vertex>
- vWorldPosition = worldPosition.xyz;
- }`,p0e=`#define DISTANCE
- uniform vec3 referencePosition;
- uniform float nearDistance;
- uniform float farDistance;
- varying vec3 vWorldPosition;
- #include <common>
- #include <packing>
- #include <uv_pars_fragment>
- #include <map_pars_fragment>
- #include <alphamap_pars_fragment>
- #include <alphatest_pars_fragment>
- #include <alphahash_pars_fragment>
- #include <clipping_planes_pars_fragment>
- void main () {
- vec4 diffuseColor = vec4( 1.0 );
- #include <clipping_planes_fragment>
- #include <map_fragment>
- #include <alphamap_fragment>
- #include <alphatest_fragment>
- #include <alphahash_fragment>
- float dist = length( vWorldPosition - referencePosition );
- dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
- dist = saturate( dist );
- gl_FragColor = packDepthToRGBA( dist );
- }`,f0e=`varying vec3 vWorldDirection;
- #include <common>
- void main() {
- vWorldDirection = transformDirection( position, modelMatrix );
- #include <begin_vertex>
- #include <project_vertex>
- }`,g0e=`uniform sampler2D tEquirect;
- varying vec3 vWorldDirection;
- #include <common>
- void main() {
- vec3 direction = normalize( vWorldDirection );
- vec2 sampleUV = equirectUv( direction );
- gl_FragColor = texture2D( tEquirect, sampleUV );
- #include <tonemapping_fragment>
- #include <colorspace_fragment>
- }`,b0e=`uniform float scale;
- attribute float lineDistance;
- varying float vLineDistance;
- #include <common>
- #include <uv_pars_vertex>
- #include <color_pars_vertex>
- #include <fog_pars_vertex>
- #include <morphtarget_pars_vertex>
- #include <logdepthbuf_pars_vertex>
- #include <clipping_planes_pars_vertex>
- void main() {
- vLineDistance = scale * lineDistance;
- #include <uv_vertex>
- #include <color_vertex>
- #include <morphinstance_vertex>
- #include <morphcolor_vertex>
- #include <begin_vertex>
- #include <morphtarget_vertex>
- #include <project_vertex>
- #include <logdepthbuf_vertex>
- #include <clipping_planes_vertex>
- #include <fog_vertex>
- }`,x0e=`uniform vec3 diffuse;
- uniform float opacity;
- uniform float dashSize;
- uniform float totalSize;
- varying float vLineDistance;
- #include <common>
- #include <color_pars_fragment>
- #include <uv_pars_fragment>
- #include <map_pars_fragment>
- #include <fog_pars_fragment>
- #include <logdepthbuf_pars_fragment>
- #include <clipping_planes_pars_fragment>
- void main() {
- vec4 diffuseColor = vec4( diffuse, opacity );
- #include <clipping_planes_fragment>
- if ( mod( vLineDistance, totalSize ) > dashSize ) {
- discard;
- }
- vec3 outgoingLight = vec3( 0.0 );
- #include <logdepthbuf_fragment>
- #include <map_fragment>
- #include <color_fragment>
- outgoingLight = diffuseColor.rgb;
- #include <opaque_fragment>
- #include <tonemapping_fragment>
- #include <colorspace_fragment>
- #include <fog_fragment>
- #include <premultiplied_alpha_fragment>
- }`,y0e=`#include <common>
- #include <batching_pars_vertex>
- #include <uv_pars_vertex>
- #include <envmap_pars_vertex>
- #include <color_pars_vertex>
- #include <fog_pars_vertex>
- #include <morphtarget_pars_vertex>
- #include <skinning_pars_vertex>
- #include <logdepthbuf_pars_vertex>
- #include <clipping_planes_pars_vertex>
- void main() {
- #include <uv_vertex>
- #include <color_vertex>
- #include <morphinstance_vertex>
- #include <morphcolor_vertex>
- #include <batching_vertex>
- #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )
- #include <beginnormal_vertex>
- #include <morphnormal_vertex>
- #include <skinbase_vertex>
- #include <skinnormal_vertex>
- #include <defaultnormal_vertex>
- #endif
- #include <begin_vertex>
- #include <morphtarget_vertex>
- #include <skinning_vertex>
- #include <project_vertex>
- #include <logdepthbuf_vertex>
- #include <clipping_planes_vertex>
- #include <worldpos_vertex>
- #include <envmap_vertex>
- #include <fog_vertex>
- }`,v0e=`uniform vec3 diffuse;
- uniform float opacity;
- #ifndef FLAT_SHADED
- varying vec3 vNormal;
- #endif
- #include <common>
- #include <dithering_pars_fragment>
- #include <color_pars_fragment>
- #include <uv_pars_fragment>
- #include <map_pars_fragment>
- #include <alphamap_pars_fragment>
- #include <alphatest_pars_fragment>
- #include <alphahash_pars_fragment>
- #include <aomap_pars_fragment>
- #include <lightmap_pars_fragment>
- #include <envmap_common_pars_fragment>
- #include <envmap_pars_fragment>
- #include <fog_pars_fragment>
- #include <specularmap_pars_fragment>
- #include <logdepthbuf_pars_fragment>
- #include <clipping_planes_pars_fragment>
- void main() {
- vec4 diffuseColor = vec4( diffuse, opacity );
- #include <clipping_planes_fragment>
- #include <logdepthbuf_fragment>
- #include <map_fragment>
- #include <color_fragment>
- #include <alphamap_fragment>
- #include <alphatest_fragment>
- #include <alphahash_fragment>
- #include <specularmap_fragment>
- ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
- #ifdef USE_LIGHTMAP
- vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
- reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;
- #else
- reflectedLight.indirectDiffuse += vec3( 1.0 );
- #endif
- #include <aomap_fragment>
- reflectedLight.indirectDiffuse *= diffuseColor.rgb;
- vec3 outgoingLight = reflectedLight.indirectDiffuse;
- #include <envmap_fragment>
- #include <opaque_fragment>
- #include <tonemapping_fragment>
- #include <colorspace_fragment>
- #include <fog_fragment>
- #include <premultiplied_alpha_fragment>
- #include <dithering_fragment>
- }`,w0e=`#define LAMBERT
- varying vec3 vViewPosition;
- #include <common>
- #include <batching_pars_vertex>
- #include <uv_pars_vertex>
- #include <displacementmap_pars_vertex>
- #include <envmap_pars_vertex>
- #include <color_pars_vertex>
- #include <fog_pars_vertex>
- #include <normal_pars_vertex>
- #include <morphtarget_pars_vertex>
- #include <skinning_pars_vertex>
- #include <shadowmap_pars_vertex>
- #include <logdepthbuf_pars_vertex>
- #include <clipping_planes_pars_vertex>
- void main() {
- #include <uv_vertex>
- #include <color_vertex>
- #include <morphinstance_vertex>
- #include <morphcolor_vertex>
- #include <batching_vertex>
- #include <beginnormal_vertex>
- #include <morphnormal_vertex>
- #include <skinbase_vertex>
- #include <skinnormal_vertex>
- #include <defaultnormal_vertex>
- #include <normal_vertex>
- #include <begin_vertex>
- #include <morphtarget_vertex>
- #include <skinning_vertex>
- #include <displacementmap_vertex>
- #include <project_vertex>
- #include <logdepthbuf_vertex>
- #include <clipping_planes_vertex>
- vViewPosition = - mvPosition.xyz;
- #include <worldpos_vertex>
- #include <envmap_vertex>
- #include <shadowmap_vertex>
- #include <fog_vertex>
- }`,S0e=`#define LAMBERT
- uniform vec3 diffuse;
- uniform vec3 emissive;
- uniform float opacity;
- #include <common>
- #include <packing>
- #include <dithering_pars_fragment>
- #include <color_pars_fragment>
- #include <uv_pars_fragment>
- #include <map_pars_fragment>
- #include <alphamap_pars_fragment>
- #include <alphatest_pars_fragment>
- #include <alphahash_pars_fragment>
- #include <aomap_pars_fragment>
- #include <lightmap_pars_fragment>
- #include <emissivemap_pars_fragment>
- #include <envmap_common_pars_fragment>
- #include <envmap_pars_fragment>
- #include <fog_pars_fragment>
- #include <bsdfs>
- #include <lights_pars_begin>
- #include <normal_pars_fragment>
- #include <lights_lambert_pars_fragment>
- #include <shadowmap_pars_fragment>
- #include <bumpmap_pars_fragment>
- #include <normalmap_pars_fragment>
- #include <specularmap_pars_fragment>
- #include <logdepthbuf_pars_fragment>
- #include <clipping_planes_pars_fragment>
- void main() {
- vec4 diffuseColor = vec4( diffuse, opacity );
- #include <clipping_planes_fragment>
- ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
- vec3 totalEmissiveRadiance = emissive;
- #include <logdepthbuf_fragment>
- #include <map_fragment>
- #include <color_fragment>
- #include <alphamap_fragment>
- #include <alphatest_fragment>
- #include <alphahash_fragment>
- #include <specularmap_fragment>
- #include <normal_fragment_begin>
- #include <normal_fragment_maps>
- #include <emissivemap_fragment>
- #include <lights_lambert_fragment>
- #include <lights_fragment_begin>
- #include <lights_fragment_maps>
- #include <lights_fragment_end>
- #include <aomap_fragment>
- vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
- #include <envmap_fragment>
- #include <opaque_fragment>
- #include <tonemapping_fragment>
- #include <colorspace_fragment>
- #include <fog_fragment>
- #include <premultiplied_alpha_fragment>
- #include <dithering_fragment>
- }`,_0e=`#define MATCAP
- varying vec3 vViewPosition;
- #include <common>
- #include <batching_pars_vertex>
- #include <uv_pars_vertex>
- #include <color_pars_vertex>
- #include <displacementmap_pars_vertex>
- #include <fog_pars_vertex>
- #include <normal_pars_vertex>
- #include <morphtarget_pars_vertex>
- #include <skinning_pars_vertex>
- #include <logdepthbuf_pars_vertex>
- #include <clipping_planes_pars_vertex>
- void main() {
- #include <uv_vertex>
- #include <color_vertex>
- #include <morphinstance_vertex>
- #include <morphcolor_vertex>
- #include <batching_vertex>
- #include <beginnormal_vertex>
- #include <morphnormal_vertex>
- #include <skinbase_vertex>
- #include <skinnormal_vertex>
- #include <defaultnormal_vertex>
- #include <normal_vertex>
- #include <begin_vertex>
- #include <morphtarget_vertex>
- #include <skinning_vertex>
- #include <displacementmap_vertex>
- #include <project_vertex>
- #include <logdepthbuf_vertex>
- #include <clipping_planes_vertex>
- #include <fog_vertex>
- vViewPosition = - mvPosition.xyz;
- }`,k0e=`#define MATCAP
- uniform vec3 diffuse;
- uniform float opacity;
- uniform sampler2D matcap;
- varying vec3 vViewPosition;
- #include <common>
- #include <dithering_pars_fragment>
- #include <color_pars_fragment>
- #include <uv_pars_fragment>
- #include <map_pars_fragment>
- #include <alphamap_pars_fragment>
- #include <alphatest_pars_fragment>
- #include <alphahash_pars_fragment>
- #include <fog_pars_fragment>
- #include <normal_pars_fragment>
- #include <bumpmap_pars_fragment>
- #include <normalmap_pars_fragment>
- #include <logdepthbuf_pars_fragment>
- #include <clipping_planes_pars_fragment>
- void main() {
- vec4 diffuseColor = vec4( diffuse, opacity );
- #include <clipping_planes_fragment>
- #include <logdepthbuf_fragment>
- #include <map_fragment>
- #include <color_fragment>
- #include <alphamap_fragment>
- #include <alphatest_fragment>
- #include <alphahash_fragment>
- #include <normal_fragment_begin>
- #include <normal_fragment_maps>
- vec3 viewDir = normalize( vViewPosition );
- vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );
- vec3 y = cross( viewDir, x );
- vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;
- #ifdef USE_MATCAP
- vec4 matcapColor = texture2D( matcap, uv );
- #else
- vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );
- #endif
- vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;
- #include <opaque_fragment>
- #include <tonemapping_fragment>
- #include <colorspace_fragment>
- #include <fog_fragment>
- #include <premultiplied_alpha_fragment>
- #include <dithering_fragment>
- }`,N0e=`#define NORMAL
- #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
- varying vec3 vViewPosition;
- #endif
- #include <common>
- #include <batching_pars_vertex>
- #include <uv_pars_vertex>
- #include <displacementmap_pars_vertex>
- #include <normal_pars_vertex>
- #include <morphtarget_pars_vertex>
- #include <skinning_pars_vertex>
- #include <logdepthbuf_pars_vertex>
- #include <clipping_planes_pars_vertex>
- void main() {
- #include <uv_vertex>
- #include <batching_vertex>
- #include <beginnormal_vertex>
- #include <morphinstance_vertex>
- #include <morphnormal_vertex>
- #include <skinbase_vertex>
- #include <skinnormal_vertex>
- #include <defaultnormal_vertex>
- #include <normal_vertex>
- #include <begin_vertex>
- #include <morphtarget_vertex>
- #include <skinning_vertex>
- #include <displacementmap_vertex>
- #include <project_vertex>
- #include <logdepthbuf_vertex>
- #include <clipping_planes_vertex>
- #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
- vViewPosition = - mvPosition.xyz;
- #endif
- }`,C0e=`#define NORMAL
- uniform float opacity;
- #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
- varying vec3 vViewPosition;
- #endif
- #include <packing>
- #include <uv_pars_fragment>
- #include <normal_pars_fragment>
- #include <bumpmap_pars_fragment>
- #include <normalmap_pars_fragment>
- #include <logdepthbuf_pars_fragment>
- #include <clipping_planes_pars_fragment>
- void main() {
- vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );
- #include <clipping_planes_fragment>
- #include <logdepthbuf_fragment>
- #include <normal_fragment_begin>
- #include <normal_fragment_maps>
- gl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a );
- #ifdef OPAQUE
- gl_FragColor.a = 1.0;
- #endif
- }`,T0e=`#define PHONG
- varying vec3 vViewPosition;
- #include <common>
- #include <batching_pars_vertex>
- #include <uv_pars_vertex>
- #include <displacementmap_pars_vertex>
- #include <envmap_pars_vertex>
- #include <color_pars_vertex>
- #include <fog_pars_vertex>
- #include <normal_pars_vertex>
- #include <morphtarget_pars_vertex>
- #include <skinning_pars_vertex>
- #include <shadowmap_pars_vertex>
- #include <logdepthbuf_pars_vertex>
- #include <clipping_planes_pars_vertex>
- void main() {
- #include <uv_vertex>
- #include <color_vertex>
- #include <morphcolor_vertex>
- #include <batching_vertex>
- #include <beginnormal_vertex>
- #include <morphinstance_vertex>
- #include <morphnormal_vertex>
- #include <skinbase_vertex>
- #include <skinnormal_vertex>
- #include <defaultnormal_vertex>
- #include <normal_vertex>
- #include <begin_vertex>
- #include <morphtarget_vertex>
- #include <skinning_vertex>
- #include <displacementmap_vertex>
- #include <project_vertex>
- #include <logdepthbuf_vertex>
- #include <clipping_planes_vertex>
- vViewPosition = - mvPosition.xyz;
- #include <worldpos_vertex>
- #include <envmap_vertex>
- #include <shadowmap_vertex>
- #include <fog_vertex>
- }`,P0e=`#define PHONG
- uniform vec3 diffuse;
- uniform vec3 emissive;
- uniform vec3 specular;
- uniform float shininess;
- uniform float opacity;
- #include <common>
- #include <packing>
- #include <dithering_pars_fragment>
- #include <color_pars_fragment>
- #include <uv_pars_fragment>
- #include <map_pars_fragment>
- #include <alphamap_pars_fragment>
- #include <alphatest_pars_fragment>
- #include <alphahash_pars_fragment>
- #include <aomap_pars_fragment>
- #include <lightmap_pars_fragment>
- #include <emissivemap_pars_fragment>
- #include <envmap_common_pars_fragment>
- #include <envmap_pars_fragment>
- #include <fog_pars_fragment>
- #include <bsdfs>
- #include <lights_pars_begin>
- #include <normal_pars_fragment>
- #include <lights_phong_pars_fragment>
- #include <shadowmap_pars_fragment>
- #include <bumpmap_pars_fragment>
- #include <normalmap_pars_fragment>
- #include <specularmap_pars_fragment>
- #include <logdepthbuf_pars_fragment>
- #include <clipping_planes_pars_fragment>
- void main() {
- vec4 diffuseColor = vec4( diffuse, opacity );
- #include <clipping_planes_fragment>
- ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
- vec3 totalEmissiveRadiance = emissive;
- #include <logdepthbuf_fragment>
- #include <map_fragment>
- #include <color_fragment>
- #include <alphamap_fragment>
- #include <alphatest_fragment>
- #include <alphahash_fragment>
- #include <specularmap_fragment>
- #include <normal_fragment_begin>
- #include <normal_fragment_maps>
- #include <emissivemap_fragment>
- #include <lights_phong_fragment>
- #include <lights_fragment_begin>
- #include <lights_fragment_maps>
- #include <lights_fragment_end>
- #include <aomap_fragment>
- vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
- #include <envmap_fragment>
- #include <opaque_fragment>
- #include <tonemapping_fragment>
- #include <colorspace_fragment>
- #include <fog_fragment>
- #include <premultiplied_alpha_fragment>
- #include <dithering_fragment>
- }`,A0e=`#define STANDARD
- varying vec3 vViewPosition;
- #ifdef USE_TRANSMISSION
- varying vec3 vWorldPosition;
- #endif
- #include <common>
- #include <batching_pars_vertex>
- #include <uv_pars_vertex>
- #include <displacementmap_pars_vertex>
- #include <color_pars_vertex>
- #include <fog_pars_vertex>
- #include <normal_pars_vertex>
- #include <morphtarget_pars_vertex>
- #include <skinning_pars_vertex>
- #include <shadowmap_pars_vertex>
- #include <logdepthbuf_pars_vertex>
- #include <clipping_planes_pars_vertex>
- void main() {
- #include <uv_vertex>
- #include <color_vertex>
- #include <morphinstance_vertex>
- #include <morphcolor_vertex>
- #include <batching_vertex>
- #include <beginnormal_vertex>
- #include <morphnormal_vertex>
- #include <skinbase_vertex>
- #include <skinnormal_vertex>
- #include <defaultnormal_vertex>
- #include <normal_vertex>
- #include <begin_vertex>
- #include <morphtarget_vertex>
- #include <skinning_vertex>
- #include <displacementmap_vertex>
- #include <project_vertex>
- #include <logdepthbuf_vertex>
- #include <clipping_planes_vertex>
- vViewPosition = - mvPosition.xyz;
- #include <worldpos_vertex>
- #include <shadowmap_vertex>
- #include <fog_vertex>
- #ifdef USE_TRANSMISSION
- vWorldPosition = worldPosition.xyz;
- #endif
- }`,M0e=`#define STANDARD
- #ifdef PHYSICAL
- #define IOR
- #define USE_SPECULAR
- #endif
- uniform vec3 diffuse;
- uniform vec3 emissive;
- uniform float roughness;
- uniform float metalness;
- uniform float opacity;
- #ifdef IOR
- uniform float ior;
- #endif
- #ifdef USE_SPECULAR
- uniform float specularIntensity;
- uniform vec3 specularColor;
- #ifdef USE_SPECULAR_COLORMAP
- uniform sampler2D specularColorMap;
- #endif
- #ifdef USE_SPECULAR_INTENSITYMAP
- uniform sampler2D specularIntensityMap;
- #endif
- #endif
- #ifdef USE_CLEARCOAT
- uniform float clearcoat;
- uniform float clearcoatRoughness;
- #endif
- #ifdef USE_DISPERSION
- uniform float dispersion;
- #endif
- #ifdef USE_IRIDESCENCE
- uniform float iridescence;
- uniform float iridescenceIOR;
- uniform float iridescenceThicknessMinimum;
- uniform float iridescenceThicknessMaximum;
- #endif
- #ifdef USE_SHEEN
- uniform vec3 sheenColor;
- uniform float sheenRoughness;
- #ifdef USE_SHEEN_COLORMAP
- uniform sampler2D sheenColorMap;
- #endif
- #ifdef USE_SHEEN_ROUGHNESSMAP
- uniform sampler2D sheenRoughnessMap;
- #endif
- #endif
- #ifdef USE_ANISOTROPY
- uniform vec2 anisotropyVector;
- #ifdef USE_ANISOTROPYMAP
- uniform sampler2D anisotropyMap;
- #endif
- #endif
- varying vec3 vViewPosition;
- #include <common>
- #include <packing>
- #include <dithering_pars_fragment>
- #include <color_pars_fragment>
- #include <uv_pars_fragment>
- #include <map_pars_fragment>
- #include <alphamap_pars_fragment>
- #include <alphatest_pars_fragment>
- #include <alphahash_pars_fragment>
- #include <aomap_pars_fragment>
- #include <lightmap_pars_fragment>
- #include <emissivemap_pars_fragment>
- #include <iridescence_fragment>
- #include <cube_uv_reflection_fragment>
- #include <envmap_common_pars_fragment>
- #include <envmap_physical_pars_fragment>
- #include <fog_pars_fragment>
- #include <lights_pars_begin>
- #include <normal_pars_fragment>
- #include <lights_physical_pars_fragment>
- #include <transmission_pars_fragment>
- #include <shadowmap_pars_fragment>
- #include <bumpmap_pars_fragment>
- #include <normalmap_pars_fragment>
- #include <clearcoat_pars_fragment>
- #include <iridescence_pars_fragment>
- #include <roughnessmap_pars_fragment>
- #include <metalnessmap_pars_fragment>
- #include <logdepthbuf_pars_fragment>
- #include <clipping_planes_pars_fragment>
- void main() {
- vec4 diffuseColor = vec4( diffuse, opacity );
- #include <clipping_planes_fragment>
- ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
- vec3 totalEmissiveRadiance = emissive;
- #include <logdepthbuf_fragment>
- #include <map_fragment>
- #include <color_fragment>
- #include <alphamap_fragment>
- #include <alphatest_fragment>
- #include <alphahash_fragment>
- #include <roughnessmap_fragment>
- #include <metalnessmap_fragment>
- #include <normal_fragment_begin>
- #include <normal_fragment_maps>
- #include <clearcoat_normal_fragment_begin>
- #include <clearcoat_normal_fragment_maps>
- #include <emissivemap_fragment>
- #include <lights_physical_fragment>
- #include <lights_fragment_begin>
- #include <lights_fragment_maps>
- #include <lights_fragment_end>
- #include <aomap_fragment>
- vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;
- vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;
- #include <transmission_fragment>
- vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;
- #ifdef USE_SHEEN
- float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );
- outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;
- #endif
- #ifdef USE_CLEARCOAT
- float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );
- vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );
- outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;
- #endif
- #include <opaque_fragment>
- #include <tonemapping_fragment>
- #include <colorspace_fragment>
- #include <fog_fragment>
- #include <premultiplied_alpha_fragment>
- #include <dithering_fragment>
- }`,E0e=`#define TOON
- varying vec3 vViewPosition;
- #include <common>
- #include <batching_pars_vertex>
- #include <uv_pars_vertex>
- #include <displacementmap_pars_vertex>
- #include <color_pars_vertex>
- #include <fog_pars_vertex>
- #include <normal_pars_vertex>
- #include <morphtarget_pars_vertex>
- #include <skinning_pars_vertex>
- #include <shadowmap_pars_vertex>
- #include <logdepthbuf_pars_vertex>
- #include <clipping_planes_pars_vertex>
- void main() {
- #include <uv_vertex>
- #include <color_vertex>
- #include <morphinstance_vertex>
- #include <morphcolor_vertex>
- #include <batching_vertex>
- #include <beginnormal_vertex>
- #include <morphnormal_vertex>
- #include <skinbase_vertex>
- #include <skinnormal_vertex>
- #include <defaultnormal_vertex>
- #include <normal_vertex>
- #include <begin_vertex>
- #include <morphtarget_vertex>
- #include <skinning_vertex>
- #include <displacementmap_vertex>
- #include <project_vertex>
- #include <logdepthbuf_vertex>
- #include <clipping_planes_vertex>
- vViewPosition = - mvPosition.xyz;
- #include <worldpos_vertex>
- #include <shadowmap_vertex>
- #include <fog_vertex>
- }`,j0e=`#define TOON
- uniform vec3 diffuse;
- uniform vec3 emissive;
- uniform float opacity;
- #include <common>
- #include <packing>
- #include <dithering_pars_fragment>
- #include <color_pars_fragment>
- #include <uv_pars_fragment>
- #include <map_pars_fragment>
- #include <alphamap_pars_fragment>
- #include <alphatest_pars_fragment>
- #include <alphahash_pars_fragment>
- #include <aomap_pars_fragment>
- #include <lightmap_pars_fragment>
- #include <emissivemap_pars_fragment>
- #include <gradientmap_pars_fragment>
- #include <fog_pars_fragment>
- #include <bsdfs>
- #include <lights_pars_begin>
- #include <normal_pars_fragment>
- #include <lights_toon_pars_fragment>
- #include <shadowmap_pars_fragment>
- #include <bumpmap_pars_fragment>
- #include <normalmap_pars_fragment>
- #include <logdepthbuf_pars_fragment>
- #include <clipping_planes_pars_fragment>
- void main() {
- vec4 diffuseColor = vec4( diffuse, opacity );
- #include <clipping_planes_fragment>
- ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
- vec3 totalEmissiveRadiance = emissive;
- #include <logdepthbuf_fragment>
- #include <map_fragment>
- #include <color_fragment>
- #include <alphamap_fragment>
- #include <alphatest_fragment>
- #include <alphahash_fragment>
- #include <normal_fragment_begin>
- #include <normal_fragment_maps>
- #include <emissivemap_fragment>
- #include <lights_toon_fragment>
- #include <lights_fragment_begin>
- #include <lights_fragment_maps>
- #include <lights_fragment_end>
- #include <aomap_fragment>
- vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
- #include <opaque_fragment>
- #include <tonemapping_fragment>
- #include <colorspace_fragment>
- #include <fog_fragment>
- #include <premultiplied_alpha_fragment>
- #include <dithering_fragment>
- }`,D0e=`uniform float size;
- uniform float scale;
- #include <common>
- #include <color_pars_vertex>
- #include <fog_pars_vertex>
- #include <morphtarget_pars_vertex>
- #include <logdepthbuf_pars_vertex>
- #include <clipping_planes_pars_vertex>
- #ifdef USE_POINTS_UV
- varying vec2 vUv;
- uniform mat3 uvTransform;
- #endif
- void main() {
- #ifdef USE_POINTS_UV
- vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
- #endif
- #include <color_vertex>
- #include <morphinstance_vertex>
- #include <morphcolor_vertex>
- #include <begin_vertex>
- #include <morphtarget_vertex>
- #include <project_vertex>
- gl_PointSize = size;
- #ifdef USE_SIZEATTENUATION
- bool isPerspective = isPerspectiveMatrix( projectionMatrix );
- if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );
- #endif
- #include <logdepthbuf_vertex>
- #include <clipping_planes_vertex>
- #include <worldpos_vertex>
- #include <fog_vertex>
- }`,R0e=`uniform vec3 diffuse;
- uniform float opacity;
- #include <common>
- #include <color_pars_fragment>
- #include <map_particle_pars_fragment>
- #include <alphatest_pars_fragment>
- #include <alphahash_pars_fragment>
- #include <fog_pars_fragment>
- #include <logdepthbuf_pars_fragment>
- #include <clipping_planes_pars_fragment>
- void main() {
- vec4 diffuseColor = vec4( diffuse, opacity );
- #include <clipping_planes_fragment>
- vec3 outgoingLight = vec3( 0.0 );
- #include <logdepthbuf_fragment>
- #include <map_particle_fragment>
- #include <color_fragment>
- #include <alphatest_fragment>
- #include <alphahash_fragment>
- outgoingLight = diffuseColor.rgb;
- #include <opaque_fragment>
- #include <tonemapping_fragment>
- #include <colorspace_fragment>
- #include <fog_fragment>
- #include <premultiplied_alpha_fragment>
- }`,F0e=`#include <common>
- #include <batching_pars_vertex>
- #include <fog_pars_vertex>
- #include <morphtarget_pars_vertex>
- #include <skinning_pars_vertex>
- #include <logdepthbuf_pars_vertex>
- #include <shadowmap_pars_vertex>
- void main() {
- #include <batching_vertex>
- #include <beginnormal_vertex>
- #include <morphinstance_vertex>
- #include <morphnormal_vertex>
- #include <skinbase_vertex>
- #include <skinnormal_vertex>
- #include <defaultnormal_vertex>
- #include <begin_vertex>
- #include <morphtarget_vertex>
- #include <skinning_vertex>
- #include <project_vertex>
- #include <logdepthbuf_vertex>
- #include <worldpos_vertex>
- #include <shadowmap_vertex>
- #include <fog_vertex>
- }`,L0e=`uniform vec3 color;
- uniform float opacity;
- #include <common>
- #include <packing>
- #include <fog_pars_fragment>
- #include <bsdfs>
- #include <lights_pars_begin>
- #include <logdepthbuf_pars_fragment>
- #include <shadowmap_pars_fragment>
- #include <shadowmask_pars_fragment>
- void main() {
- #include <logdepthbuf_fragment>
- gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );
- #include <tonemapping_fragment>
- #include <colorspace_fragment>
- #include <fog_fragment>
- }`,O0e=`uniform float rotation;
- uniform vec2 center;
- #include <common>
- #include <uv_pars_vertex>
- #include <fog_pars_vertex>
- #include <logdepthbuf_pars_vertex>
- #include <clipping_planes_pars_vertex>
- void main() {
- #include <uv_vertex>
- vec4 mvPosition = modelViewMatrix[ 3 ];
- vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) );
- #ifndef USE_SIZEATTENUATION
- bool isPerspective = isPerspectiveMatrix( projectionMatrix );
- if ( isPerspective ) scale *= - mvPosition.z;
- #endif
- vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;
- vec2 rotatedPosition;
- rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
- rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
- mvPosition.xy += rotatedPosition;
- gl_Position = projectionMatrix * mvPosition;
- #include <logdepthbuf_vertex>
- #include <clipping_planes_vertex>
- #include <fog_vertex>
- }`,I0e=`uniform vec3 diffuse;
- uniform float opacity;
- #include <common>
- #include <uv_pars_fragment>
- #include <map_pars_fragment>
- #include <alphamap_pars_fragment>
- #include <alphatest_pars_fragment>
- #include <alphahash_pars_fragment>
- #include <fog_pars_fragment>
- #include <logdepthbuf_pars_fragment>
- #include <clipping_planes_pars_fragment>
- void main() {
- vec4 diffuseColor = vec4( diffuse, opacity );
- #include <clipping_planes_fragment>
- vec3 outgoingLight = vec3( 0.0 );
- #include <logdepthbuf_fragment>
- #include <map_fragment>
- #include <alphamap_fragment>
- #include <alphatest_fragment>
- #include <alphahash_fragment>
- outgoingLight = diffuseColor.rgb;
- #include <opaque_fragment>
- #include <tonemapping_fragment>
- #include <colorspace_fragment>
- #include <fog_fragment>
- }`,qn={alphahash_fragment:sye,alphahash_pars_fragment:oye,alphamap_fragment:lye,alphamap_pars_fragment:cye,alphatest_fragment:dye,alphatest_pars_fragment:uye,aomap_fragment:mye,aomap_pars_fragment:hye,batching_pars_vertex:pye,batching_vertex:fye,begin_vertex:gye,beginnormal_vertex:bye,bsdfs:xye,iridescence_fragment:yye,bumpmap_pars_fragment:vye,clipping_planes_fragment:wye,clipping_planes_pars_fragment:Sye,clipping_planes_pars_vertex:_ye,clipping_planes_vertex:kye,color_fragment:Nye,color_pars_fragment:Cye,color_pars_vertex:Tye,color_vertex:Pye,common:Aye,cube_uv_reflection_fragment:Mye,defaultnormal_vertex:Eye,displacementmap_pars_vertex:jye,displacementmap_vertex:Dye,emissivemap_fragment:Rye,emissivemap_pars_fragment:Fye,colorspace_fragment:Lye,colorspace_pars_fragment:Oye,envmap_fragment:Iye,envmap_common_pars_fragment:zye,envmap_pars_fragment:Uye,envmap_pars_vertex:Bye,envmap_physical_pars_fragment:Zye,envmap_vertex:Hye,fog_vertex:$ye,fog_pars_vertex:qye,fog_fragment:Vye,fog_pars_fragment:Gye,gradientmap_pars_fragment:Wye,lightmap_pars_fragment:Kye,lights_lambert_fragment:Yye,lights_lambert_pars_fragment:Xye,lights_pars_begin:Qye,lights_toon_fragment:Jye,lights_toon_pars_fragment:eve,lights_phong_fragment:tve,lights_phong_pars_fragment:nve,lights_physical_fragment:rve,lights_physical_pars_fragment:ive,lights_fragment_begin:ave,lights_fragment_maps:sve,lights_fragment_end:ove,logdepthbuf_fragment:lve,logdepthbuf_pars_fragment:cve,logdepthbuf_pars_vertex:dve,logdepthbuf_vertex:uve,map_fragment:mve,map_pars_fragment:hve,map_particle_fragment:pve,map_particle_pars_fragment:fve,metalnessmap_fragment:gve,metalnessmap_pars_fragment:bve,morphinstance_vertex:xve,morphcolor_vertex:yve,morphnormal_vertex:vve,morphtarget_pars_vertex:wve,morphtarget_vertex:Sve,normal_fragment_begin:_ve,normal_fragment_maps:kve,normal_pars_fragment:Nve,normal_pars_vertex:Cve,normal_vertex:Tve,normalmap_pars_fragment:Pve,clearcoat_normal_fragment_begin:Ave,clearcoat_normal_fragment_maps:Mve,clearcoat_pars_fragment:Eve,iridescence_pars_fragment:jve,opaque_fragment:Dve,packing:Rve,premultiplied_alpha_fragment:Fve,project_vertex:Lve,dithering_fragment:Ove,dithering_pars_fragment:Ive,roughnessmap_fragment:zve,roughnessmap_pars_fragment:Uve,shadowmap_pars_fragment:Bve,shadowmap_pars_vertex:Hve,shadowmap_vertex:$ve,shadowmask_pars_fragment:qve,skinbase_vertex:Vve,skinning_pars_vertex:Gve,skinning_vertex:Wve,skinnormal_vertex:Kve,specularmap_fragment:Yve,specularmap_pars_fragment:Xve,tonemapping_fragment:Qve,tonemapping_pars_fragment:Zve,transmission_fragment:Jve,transmission_pars_fragment:e0e,uv_pars_fragment:t0e,uv_pars_vertex:n0e,uv_vertex:r0e,worldpos_vertex:i0e,background_vert:a0e,background_frag:s0e,backgroundCube_vert:o0e,backgroundCube_frag:l0e,cube_vert:c0e,cube_frag:d0e,depth_vert:u0e,depth_frag:m0e,distanceRGBA_vert:h0e,distanceRGBA_frag:p0e,equirect_vert:f0e,equirect_frag:g0e,linedashed_vert:b0e,linedashed_frag:x0e,meshbasic_vert:y0e,meshbasic_frag:v0e,meshlambert_vert:w0e,meshlambert_frag:S0e,meshmatcap_vert:_0e,meshmatcap_frag:k0e,meshnormal_vert:N0e,meshnormal_frag:C0e,meshphong_vert:T0e,meshphong_frag:P0e,meshphysical_vert:A0e,meshphysical_frag:M0e,meshtoon_vert:E0e,meshtoon_frag:j0e,points_vert:D0e,points_frag:R0e,shadow_vert:F0e,shadow_frag:L0e,sprite_vert:O0e,sprite_frag:I0e},Vt={common:{diffuse:{value:new Zn(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Qn},alphaMap:{value:null},alphaMapTransform:{value:new Qn},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Qn}},envmap:{envMap:{value:null},envMapRotation:{value:new Qn},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 Qn}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Qn}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Qn},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Qn},normalScale:{value:new Kn(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Qn},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Qn}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Qn}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Qn}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Zn(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 Zn(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Qn},alphaTest:{value:0},uvTransform:{value:new Qn}},sprite:{diffuse:{value:new Zn(16777215)},opacity:{value:1},center:{value:new Kn(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Qn},alphaMap:{value:null},alphaMapTransform:{value:new Qn},alphaTest:{value:0}}},Pc={basic:{uniforms:Ts([Vt.common,Vt.specularmap,Vt.envmap,Vt.aomap,Vt.lightmap,Vt.fog]),vertexShader:qn.meshbasic_vert,fragmentShader:qn.meshbasic_frag},lambert:{uniforms:Ts([Vt.common,Vt.specularmap,Vt.envmap,Vt.aomap,Vt.lightmap,Vt.emissivemap,Vt.bumpmap,Vt.normalmap,Vt.displacementmap,Vt.fog,Vt.lights,{emissive:{value:new Zn(0)}}]),vertexShader:qn.meshlambert_vert,fragmentShader:qn.meshlambert_frag},phong:{uniforms:Ts([Vt.common,Vt.specularmap,Vt.envmap,Vt.aomap,Vt.lightmap,Vt.emissivemap,Vt.bumpmap,Vt.normalmap,Vt.displacementmap,Vt.fog,Vt.lights,{emissive:{value:new Zn(0)},specular:{value:new Zn(1118481)},shininess:{value:30}}]),vertexShader:qn.meshphong_vert,fragmentShader:qn.meshphong_frag},standard:{uniforms:Ts([Vt.common,Vt.envmap,Vt.aomap,Vt.lightmap,Vt.emissivemap,Vt.bumpmap,Vt.normalmap,Vt.displacementmap,Vt.roughnessmap,Vt.metalnessmap,Vt.fog,Vt.lights,{emissive:{value:new Zn(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:qn.meshphysical_vert,fragmentShader:qn.meshphysical_frag},toon:{uniforms:Ts([Vt.common,Vt.aomap,Vt.lightmap,Vt.emissivemap,Vt.bumpmap,Vt.normalmap,Vt.displacementmap,Vt.gradientmap,Vt.fog,Vt.lights,{emissive:{value:new Zn(0)}}]),vertexShader:qn.meshtoon_vert,fragmentShader:qn.meshtoon_frag},matcap:{uniforms:Ts([Vt.common,Vt.bumpmap,Vt.normalmap,Vt.displacementmap,Vt.fog,{matcap:{value:null}}]),vertexShader:qn.meshmatcap_vert,fragmentShader:qn.meshmatcap_frag},points:{uniforms:Ts([Vt.points,Vt.fog]),vertexShader:qn.points_vert,fragmentShader:qn.points_frag},dashed:{uniforms:Ts([Vt.common,Vt.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:qn.linedashed_vert,fragmentShader:qn.linedashed_frag},depth:{uniforms:Ts([Vt.common,Vt.displacementmap]),vertexShader:qn.depth_vert,fragmentShader:qn.depth_frag},normal:{uniforms:Ts([Vt.common,Vt.bumpmap,Vt.normalmap,Vt.displacementmap,{opacity:{value:1}}]),vertexShader:qn.meshnormal_vert,fragmentShader:qn.meshnormal_frag},sprite:{uniforms:Ts([Vt.sprite,Vt.fog]),vertexShader:qn.sprite_vert,fragmentShader:qn.sprite_frag},background:{uniforms:{uvTransform:{value:new Qn},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:qn.background_vert,fragmentShader:qn.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Qn}},vertexShader:qn.backgroundCube_vert,fragmentShader:qn.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:qn.cube_vert,fragmentShader:qn.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:qn.equirect_vert,fragmentShader:qn.equirect_frag},distanceRGBA:{uniforms:Ts([Vt.common,Vt.displacementmap,{referencePosition:{value:new wt},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:qn.distanceRGBA_vert,fragmentShader:qn.distanceRGBA_frag},shadow:{uniforms:Ts([Vt.lights,Vt.fog,{color:{value:new Zn(0)},opacity:{value:1}}]),vertexShader:qn.shadow_vert,fragmentShader:qn.shadow_frag}};Pc.physical={uniforms:Ts([Pc.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Qn},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Qn},clearcoatNormalScale:{value:new Kn(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Qn},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Qn},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Qn},sheen:{value:0},sheenColor:{value:new Zn(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Qn},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Qn},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Qn},transmissionSamplerSize:{value:new Kn},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Qn},attenuationDistance:{value:0},attenuationColor:{value:new Zn(0)},specularColor:{value:new Zn(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Qn},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Qn},anisotropyVector:{value:new Kn},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Qn}}]),vertexShader:qn.meshphysical_vert,fragmentShader:qn.meshphysical_frag};const qS={r:0,b:0,g:0},qh=new ah,z0e=new oa;function U0e(t,e,n,r,a,s,o){const l=new Zn(0);let c=s===!0?0:1,d,u,m=null,p=0,f=null;function y(k){let P=k.isScene===!0?k.background:null;return P&&P.isTexture&&(P=(k.backgroundBlurriness>0?n:e).get(P)),P}function x(k){let P=!1;const C=y(k);C===null?v(l,c):C&&C.isColor&&(v(C,1),P=!0);const T=t.xr.getEnvironmentBlendMode();T==="additive"?r.buffers.color.setClear(0,0,0,1,o):T==="alpha-blend"&&r.buffers.color.setClear(0,0,0,0,o),(t.autoClear||P)&&(r.buffers.depth.setTest(!0),r.buffers.depth.setMask(!0),r.buffers.color.setMask(!0),t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil))}function b(k,P){const C=y(P);C&&(C.isCubeTexture||C.mapping===vC)?(u===void 0&&(u=new kl(new hL(1,1,1),new mu({name:"BackgroundCubeMaterial",uniforms:Ob(Pc.backgroundCube.uniforms),vertexShader:Pc.backgroundCube.vertexShader,fragmentShader:Pc.backgroundCube.fragmentShader,side:ao,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),u.geometry.deleteAttribute("normal"),u.geometry.deleteAttribute("uv"),u.onBeforeRender=function(T,N,R){this.matrixWorld.copyPosition(R.matrixWorld)},Object.defineProperty(u.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),a.update(u)),qh.copy(P.backgroundRotation),qh.x*=-1,qh.y*=-1,qh.z*=-1,C.isCubeTexture&&C.isRenderTargetTexture===!1&&(qh.y*=-1,qh.z*=-1),u.material.uniforms.envMap.value=C,u.material.uniforms.flipEnvMap.value=C.isCubeTexture&&C.isRenderTargetTexture===!1?-1:1,u.material.uniforms.backgroundBlurriness.value=P.backgroundBlurriness,u.material.uniforms.backgroundIntensity.value=P.backgroundIntensity,u.material.uniforms.backgroundRotation.value.setFromMatrix4(z0e.makeRotationFromEuler(qh)),u.material.toneMapped=xr.getTransfer(C.colorSpace)!==Ur,(m!==C||p!==C.version||f!==t.toneMapping)&&(u.material.needsUpdate=!0,m=C,p=C.version,f=t.toneMapping),u.layers.enableAll(),k.unshift(u,u.geometry,u.material,0,0,null)):C&&C.isTexture&&(d===void 0&&(d=new kl(new fL(2,2),new mu({name:"BackgroundMaterial",uniforms:Ob(Pc.background.uniforms),vertexShader:Pc.background.vertexShader,fragmentShader:Pc.background.fragmentShader,side:ih,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),d.geometry.deleteAttribute("normal"),Object.defineProperty(d.material,"map",{get:function(){return this.uniforms.t2D.value}}),a.update(d)),d.material.uniforms.t2D.value=C,d.material.uniforms.backgroundIntensity.value=P.backgroundIntensity,d.material.toneMapped=xr.getTransfer(C.colorSpace)!==Ur,C.matrixAutoUpdate===!0&&C.updateMatrix(),d.material.uniforms.uvTransform.value.copy(C.matrix),(m!==C||p!==C.version||f!==t.toneMapping)&&(d.material.needsUpdate=!0,m=C,p=C.version,f=t.toneMapping),d.layers.enableAll(),k.unshift(d,d.geometry,d.material,0,0,null))}function v(k,P){k.getRGB(qS,FX(t)),r.buffers.color.setClear(qS.r,qS.g,qS.b,P,o)}function _(){u!==void 0&&(u.geometry.dispose(),u.material.dispose(),u=void 0),d!==void 0&&(d.geometry.dispose(),d.material.dispose(),d=void 0)}return{getClearColor:function(){return l},setClearColor:function(k,P=1){l.set(k),c=P,v(l,c)},getClearAlpha:function(){return c},setClearAlpha:function(k){c=k,v(l,c)},render:x,addToRenderList:b,dispose:_}}function B0e(t,e){const n=t.getParameter(t.MAX_VERTEX_ATTRIBS),r={},a=p(null);let s=a,o=!1;function l(D,$,U,G,L){let te=!1;const re=m(G,U,$);s!==re&&(s=re,d(s.object)),te=f(D,G,U,L),te&&y(D,G,U,L),L!==null&&e.update(L,t.ELEMENT_ARRAY_BUFFER),(te||o)&&(o=!1,P(D,$,U,G),L!==null&&t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,e.get(L).buffer))}function c(){return t.createVertexArray()}function d(D){return t.bindVertexArray(D)}function u(D){return t.deleteVertexArray(D)}function m(D,$,U){const G=U.wireframe===!0;let L=r[D.id];L===void 0&&(L={},r[D.id]=L);let te=L[$.id];te===void 0&&(te={},L[$.id]=te);let re=te[G];return re===void 0&&(re=p(c()),te[G]=re),re}function p(D){const $=[],U=[],G=[];for(let L=0;L<n;L++)$[L]=0,U[L]=0,G[L]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:$,enabledAttributes:U,attributeDivisors:G,object:D,attributes:{},index:null}}function f(D,$,U,G){const L=s.attributes,te=$.attributes;let re=0;const J=U.getAttributes();for(const ue in J)if(J[ue].location>=0){const ge=L[ue];let X=te[ue];if(X===void 0&&(ue==="instanceMatrix"&&D.instanceMatrix&&(X=D.instanceMatrix),ue==="instanceColor"&&D.instanceColor&&(X=D.instanceColor)),ge===void 0||ge.attribute!==X||X&&ge.data!==X.data)return!0;re++}return s.attributesNum!==re||s.index!==G}function y(D,$,U,G){const L={},te=$.attributes;let re=0;const J=U.getAttributes();for(const ue in J)if(J[ue].location>=0){let ge=te[ue];ge===void 0&&(ue==="instanceMatrix"&&D.instanceMatrix&&(ge=D.instanceMatrix),ue==="instanceColor"&&D.instanceColor&&(ge=D.instanceColor));const X={};X.attribute=ge,ge&&ge.data&&(X.data=ge.data),L[ue]=X,re++}s.attributes=L,s.attributesNum=re,s.index=G}function x(){const D=s.newAttributes;for(let $=0,U=D.length;$<U;$++)D[$]=0}function b(D){v(D,0)}function v(D,$){const U=s.newAttributes,G=s.enabledAttributes,L=s.attributeDivisors;U[D]=1,G[D]===0&&(t.enableVertexAttribArray(D),G[D]=1),L[D]!==$&&(t.vertexAttribDivisor(D,$),L[D]=$)}function _(){const D=s.newAttributes,$=s.enabledAttributes;for(let U=0,G=$.length;U<G;U++)$[U]!==D[U]&&(t.disableVertexAttribArray(U),$[U]=0)}function k(D,$,U,G,L,te,re){re===!0?t.vertexAttribIPointer(D,$,U,L,te):t.vertexAttribPointer(D,$,U,G,L,te)}function P(D,$,U,G){x();const L=G.attributes,te=U.getAttributes(),re=$.defaultAttributeValues;for(const J in te){const ue=te[J];if(ue.location>=0){let me=L[J];if(me===void 0&&(J==="instanceMatrix"&&D.instanceMatrix&&(me=D.instanceMatrix),J==="instanceColor"&&D.instanceColor&&(me=D.instanceColor)),me!==void 0){const ge=me.normalized,X=me.itemSize,ie=e.get(me);if(ie===void 0)continue;const le=ie.buffer,pe=ie.type,Ce=ie.bytesPerElement,q=pe===t.INT||pe===t.UNSIGNED_INT||me.gpuType===rL;if(me.isInterleavedBufferAttribute){const Z=me.data,j=Z.stride,E=me.offset;if(Z.isInstancedInterleavedBuffer){for(let I=0;I<ue.locationSize;I++)v(ue.location+I,Z.meshPerAttribute);D.isInstancedMesh!==!0&&G._maxInstanceCount===void 0&&(G._maxInstanceCount=Z.meshPerAttribute*Z.count)}else for(let I=0;I<ue.locationSize;I++)b(ue.location+I);t.bindBuffer(t.ARRAY_BUFFER,le);for(let I=0;I<ue.locationSize;I++)k(ue.location+I,X/ue.locationSize,pe,ge,j*Ce,(E+X/ue.locationSize*I)*Ce,q)}else{if(me.isInstancedBufferAttribute){for(let Z=0;Z<ue.locationSize;Z++)v(ue.location+Z,me.meshPerAttribute);D.isInstancedMesh!==!0&&G._maxInstanceCount===void 0&&(G._maxInstanceCount=me.meshPerAttribute*me.count)}else for(let Z=0;Z<ue.locationSize;Z++)b(ue.location+Z);t.bindBuffer(t.ARRAY_BUFFER,le);for(let Z=0;Z<ue.locationSize;Z++)k(ue.location+Z,X/ue.locationSize,pe,ge,X*Ce,X/ue.locationSize*Z*Ce,q)}}else if(re!==void 0){const ge=re[J];if(ge!==void 0)switch(ge.length){case 2:t.vertexAttrib2fv(ue.location,ge);break;case 3:t.vertexAttrib3fv(ue.location,ge);break;case 4:t.vertexAttrib4fv(ue.location,ge);break;default:t.vertexAttrib1fv(ue.location,ge)}}}}_()}function C(){R();for(const D in r){const $=r[D];for(const U in $){const G=$[U];for(const L in G)u(G[L].object),delete G[L];delete $[U]}delete r[D]}}function T(D){if(r[D.id]===void 0)return;const $=r[D.id];for(const U in $){const G=$[U];for(const L in G)u(G[L].object),delete G[L];delete $[U]}delete r[D.id]}function N(D){for(const $ in r){const U=r[$];if(U[D.id]===void 0)continue;const G=U[D.id];for(const L in G)u(G[L].object),delete G[L];delete U[D.id]}}function R(){A(),o=!0,s!==a&&(s=a,d(s.object))}function A(){a.geometry=null,a.program=null,a.wireframe=!1}return{setup:l,reset:R,resetDefaultState:A,dispose:C,releaseStatesOfGeometry:T,releaseStatesOfProgram:N,initAttributes:x,enableAttribute:b,disableUnusedAttributes:_}}function H0e(t,e,n){let r;function a(d){r=d}function s(d,u){t.drawArrays(r,d,u),n.update(u,r,1)}function o(d,u,m){m!==0&&(t.drawArraysInstanced(r,d,u,m),n.update(u,r,m))}function l(d,u,m){if(m===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(r,d,0,u,0,m);let f=0;for(let y=0;y<m;y++)f+=u[y];n.update(f,r,1)}function c(d,u,m,p){if(m===0)return;const f=e.get("WEBGL_multi_draw");if(f===null)for(let y=0;y<d.length;y++)o(d[y],u[y],p[y]);else{f.multiDrawArraysInstancedWEBGL(r,d,0,u,0,p,0,m);let y=0;for(let x=0;x<m;x++)y+=u[x]*p[x];n.update(y,r,1)}}this.setMode=a,this.render=s,this.renderInstances=o,this.renderMultiDraw=l,this.renderMultiDrawInstances=c}function $0e(t,e,n,r){let a;function s(){if(a!==void 0)return a;if(e.has("EXT_texture_filter_anisotropic")===!0){const N=e.get("EXT_texture_filter_anisotropic");a=t.getParameter(N.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else a=0;return a}function o(N){return!(N!==Xl&&r.convert(N)!==t.getParameter(t.IMPLEMENTATION_COLOR_READ_FORMAT))}function l(N){const R=N===ux&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(N!==qc&&r.convert(N)!==t.getParameter(t.IMPLEMENTATION_COLOR_READ_TYPE)&&N!==Gd&&!R)}function c(N){if(N==="highp"){if(t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.HIGH_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision>0)return"highp";N="mediump"}return N==="mediump"&&t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.MEDIUM_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let d=n.precision!==void 0?n.precision:"highp";const u=c(d);u!==d&&(Mn("WebGLRenderer:",d,"not supported, using",u,"instead."),d=u);const m=n.logarithmicDepthBuffer===!0,p=n.reversedDepthBuffer===!0&&e.has("EXT_clip_control"),f=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),y=t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),x=t.getParameter(t.MAX_TEXTURE_SIZE),b=t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),v=t.getParameter(t.MAX_VERTEX_ATTRIBS),_=t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),k=t.getParameter(t.MAX_VARYING_VECTORS),P=t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),C=y>0,T=t.getParameter(t.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:c,textureFormatReadable:o,textureTypeReadable:l,precision:d,logarithmicDepthBuffer:m,reversedDepthBuffer:p,maxTextures:f,maxVertexTextures:y,maxTextureSize:x,maxCubemapSize:b,maxAttributes:v,maxVertexUniforms:_,maxVaryings:k,maxFragmentUniforms:P,vertexTextures:C,maxSamples:T}}function q0e(t){const e=this;let n=null,r=0,a=!1,s=!1;const o=new pm,l=new Qn,c={value:null,needsUpdate:!1};this.uniform=c,this.numPlanes=0,this.numIntersection=0,this.init=function(m,p){const f=m.length!==0||p||r!==0||a;return a=p,r=m.length,f},this.beginShadows=function(){s=!0,u(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(m,p){n=u(m,p,0)},this.setState=function(m,p,f){const y=m.clippingPlanes,x=m.clipIntersection,b=m.clipShadows,v=t.get(m);if(!a||y===null||y.length===0||s&&!b)s?u(null):d();else{const _=s?0:r,k=_*4;let P=v.clippingState||null;c.value=P,P=u(y,p,k,f);for(let C=0;C!==k;++C)P[C]=n[C];v.clippingState=P,this.numIntersection=x?this.numPlanes:0,this.numPlanes+=_}};function d(){c.value!==n&&(c.value=n,c.needsUpdate=r>0),e.numPlanes=r,e.numIntersection=0}function u(m,p,f,y){const x=m!==null?m.length:0;let b=null;if(x!==0){if(b=c.value,y!==!0||b===null){const v=f+x*4,_=p.matrixWorldInverse;l.getNormalMatrix(_),(b===null||b.length<v)&&(b=new Float32Array(v));for(let k=0,P=f;k!==x;++k,P+=4)o.copy(m[k]).applyMatrix4(_,l),o.normal.toArray(b,P),b[P+3]=o.constant}c.value=b,c.needsUpdate=!0}return e.numPlanes=x,e.numIntersection=0,b}}function V0e(t){let e=new WeakMap;function n(o,l){return l===HD?o.mapping=Rb:l===$D&&(o.mapping=Fb),o}function r(o){if(o&&o.isTexture){const l=o.mapping;if(l===HD||l===$D)if(e.has(o)){const c=e.get(o).texture;return n(c,o.mapping)}else{const c=o.image;if(c&&c.height>0){const d=new Oxe(c.height);return d.fromEquirectangularTexture(t,o),e.set(o,d),o.addEventListener("dispose",a),n(d.texture,o.mapping)}else return null}}return o}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}return{get:r,dispose:s}}const Em=4,q8=[.125,.215,.35,.446,.526,.582],op=20,G0e=256,Ny=new qX,V8=new Zn;let jM=null,DM=0,RM=0,FM=!1;const W0e=new wt;let G8=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,r=.1,a=100,s={}){const{size:o=256,position:l=W0e}=s;jM=this._renderer.getRenderTarget(),DM=this._renderer.getActiveCubeFace(),RM=this._renderer.getActiveMipmapLevel(),FM=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(o);const c=this._allocateTargets();return c.depthBuffer=!0,this._sceneToCubeUV(e,r,a,c,l),n>0&&this._blur(c,0,0,n),this._applyPMREM(c),this._cleanup(c),c}fromEquirectangular(e,n=null){return this._fromTexture(e,n)}fromCubemap(e,n=null){return this._fromTexture(e,n)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=Y8(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=K8(),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(jM,DM,RM),this._renderer.xr.enabled=FM,e.scissorTest=!1,yg(e,0,0,e.width,e.height)}_fromTexture(e,n){e.mapping===Rb||e.mapping===Fb?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),jM=this._renderer.getRenderTarget(),DM=this._renderer.getActiveCubeFace(),RM=this._renderer.getActiveMipmapLevel(),FM=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const r=n||this._allocateTargets();return this._textureToCubeUV(e,r),this._applyPMREM(r),this._cleanup(r),r}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),n=4*this._cubeSize,r={magFilter:hl,minFilter:hl,generateMipmaps:!1,type:ux,format:Xl,colorSpace:Lb,depthBuffer:!1},a=W8(e,n,r);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==n){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=W8(e,n,r);const{_lodMax:s}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=K0e(s)),this._blurMaterial=X0e(s,e,n),this._ggxMaterial=Y0e(s,e,n)}return a}_compileMaterial(e){const n=new kl(new _l,e);this._renderer.compile(n,Ny)}_sceneToCubeUV(e,n,r,a,s){const c=new ll(90,1,n,r),d=[1,-1,1,1,1,1],u=[1,1,1,-1,-1,-1],m=this._renderer,p=m.autoClear,f=m.toneMapping;m.getClearColor(V8),m.toneMapping=Gm,m.autoClear=!1,m.state.buffers.depth.getReversed()&&(m.setRenderTarget(a),m.clearDepth(),m.setRenderTarget(null)),this._backgroundBox===null&&(this._backgroundBox=new kl(new hL,new mL({name:"PMREM.Background",side:ao,depthWrite:!1,depthTest:!1})));const x=this._backgroundBox,b=x.material;let v=!1;const _=e.background;_?_.isColor&&(b.color.copy(_),e.background=null,v=!0):(b.color.copy(V8),v=!0);for(let k=0;k<6;k++){const P=k%3;P===0?(c.up.set(0,d[k],0),c.position.set(s.x,s.y,s.z),c.lookAt(s.x+u[k],s.y,s.z)):P===1?(c.up.set(0,0,d[k]),c.position.set(s.x,s.y,s.z),c.lookAt(s.x,s.y+u[k],s.z)):(c.up.set(0,d[k],0),c.position.set(s.x,s.y,s.z),c.lookAt(s.x,s.y,s.z+u[k]));const C=this._cubeSize;yg(a,P*C,k>2?C:0,C,C),m.setRenderTarget(a),v&&m.render(x,c),m.render(e,c)}m.toneMapping=f,m.autoClear=p,e.background=_}_textureToCubeUV(e,n){const r=this._renderer,a=e.mapping===Rb||e.mapping===Fb;a?(this._cubemapMaterial===null&&(this._cubemapMaterial=Y8()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=K8());const s=a?this._cubemapMaterial:this._equirectMaterial,o=this._lodMeshes[0];o.material=s;const l=s.uniforms;l.envMap.value=e;const c=this._cubeSize;yg(n,0,0,3*c,2*c),r.setRenderTarget(n),r.render(o,Ny)}_applyPMREM(e){const n=this._renderer,r=n.autoClear;n.autoClear=!1;const a=this._lodMeshes.length;for(let s=1;s<a;s++)this._applyGGXFilter(e,s-1,s);n.autoClear=r}_applyGGXFilter(e,n,r){const a=this._renderer,s=this._pingPongRenderTarget,o=this._ggxMaterial,l=this._lodMeshes[r];l.material=o;const c=o.uniforms,d=r/(this._lodMeshes.length-1),u=n/(this._lodMeshes.length-1),m=Math.sqrt(d*d-u*u),p=.05+d*.95,f=m*p,{_lodMax:y}=this,x=this._sizeLods[r],b=3*x*(r>y-Em?r-y+Em:0),v=4*(this._cubeSize-x);c.envMap.value=e.texture,c.roughness.value=f,c.mipInt.value=y-n,yg(s,b,v,3*x,2*x),a.setRenderTarget(s),a.render(l,Ny),c.envMap.value=s.texture,c.roughness.value=0,c.mipInt.value=y-r,yg(e,b,v,3*x,2*x),a.setRenderTarget(e),a.render(l,Ny)}_blur(e,n,r,a,s){const o=this._pingPongRenderTarget;this._halfBlur(e,o,n,r,a,"latitudinal",s),this._halfBlur(o,e,r,r,a,"longitudinal",s)}_halfBlur(e,n,r,a,s,o,l){const c=this._renderer,d=this._blurMaterial;o!=="latitudinal"&&o!=="longitudinal"&&$i("blur direction must be either latitudinal or longitudinal!");const u=3,m=this._lodMeshes[a];m.material=d;const p=d.uniforms,f=this._sizeLods[r]-1,y=isFinite(s)?Math.PI/(2*f):2*Math.PI/(2*op-1),x=s/y,b=isFinite(s)?1+Math.floor(u*x):op;b>op&&Mn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${b} samples when the maximum is set to ${op}`);const v=[];let _=0;for(let N=0;N<op;++N){const R=N/x,A=Math.exp(-R*R/2);v.push(A),N===0?_+=A:N<b&&(_+=2*A)}for(let N=0;N<v.length;N++)v[N]=v[N]/_;p.envMap.value=e.texture,p.samples.value=b,p.weights.value=v,p.latitudinal.value=o==="latitudinal",l&&(p.poleAxis.value=l);const{_lodMax:k}=this;p.dTheta.value=y,p.mipInt.value=k-r;const P=this._sizeLods[a],C=3*P*(a>k-Em?a-k+Em:0),T=4*(this._cubeSize-P);yg(n,C,T,3*P,2*P),c.setRenderTarget(n),c.render(m,Ny)}};function K0e(t){const e=[],n=[],r=[];let a=t;const s=t-Em+1+q8.length;for(let o=0;o<s;o++){const l=Math.pow(2,a);e.push(l);let c=1/l;o>t-Em?c=q8[o-t+Em-1]:o===0&&(c=0),n.push(c);const d=1/(l-2),u=-d,m=1+d,p=[u,u,m,u,m,m,u,u,m,m,u,m],f=6,y=6,x=3,b=2,v=1,_=new Float32Array(x*y*f),k=new Float32Array(b*y*f),P=new Float32Array(v*y*f);for(let T=0;T<f;T++){const N=T%3*2/3-1,R=T>2?0:-1,A=[N,R,0,N+2/3,R,0,N+2/3,R+1,0,N,R,0,N+2/3,R+1,0,N,R+1,0];_.set(A,x*y*T),k.set(p,b*y*T);const D=[T,T,T,T,T,T];P.set(D,v*y*T)}const C=new _l;C.setAttribute("position",new Ls(_,x)),C.setAttribute("uv",new Ls(k,b)),C.setAttribute("faceIndex",new Ls(P,v)),r.push(new kl(C,null)),a>Em&&a--}return{lodMeshes:r,sizeLods:e,sigmas:n}}function W8(t,e,n){const r=new Xp(t,e,n);return r.texture.mapping=vC,r.texture.name="PMREM.cubeUv",r.scissorTest=!0,r}function yg(t,e,n,r,a){t.viewport.set(e,n,r,a),t.scissor.set(e,n,r,a)}function Y0e(t,e,n){return new mu({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:G0e,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:SC(),fragmentShader:`
- precision highp float;
- precision highp int;
- varying vec3 vOutputDirection;
- uniform sampler2D envMap;
- uniform float roughness;
- uniform float mipInt;
- #define ENVMAP_TYPE_CUBE_UV
- #include <cube_uv_reflection_fragment>
- #define PI 3.14159265359
- // Van der Corput radical inverse
- float radicalInverse_VdC(uint bits) {
- bits = (bits << 16u) | (bits >> 16u);
- bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u);
- bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u);
- bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u);
- bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u);
- return float(bits) * 2.3283064365386963e-10; // / 0x100000000
- }
- // Hammersley sequence
- vec2 hammersley(uint i, uint N) {
- return vec2(float(i) / float(N), radicalInverse_VdC(i));
- }
- // GGX VNDF importance sampling (Eric Heitz 2018)
- // "Sampling the GGX Distribution of Visible Normals"
- // https://jcgt.org/published/0007/04/01/
- vec3 importanceSampleGGX_VNDF(vec2 Xi, vec3 V, float roughness) {
- float alpha = roughness * roughness;
- // Section 3.2: Transform view direction to hemisphere configuration
- vec3 Vh = normalize(vec3(alpha * V.x, alpha * V.y, V.z));
- // Section 4.1: Orthonormal basis
- float lensq = Vh.x * Vh.x + Vh.y * Vh.y;
- vec3 T1 = lensq > 0.0 ? vec3(-Vh.y, Vh.x, 0.0) / sqrt(lensq) : vec3(1.0, 0.0, 0.0);
- vec3 T2 = cross(Vh, T1);
- // Section 4.2: Parameterization of projected area
- float r = sqrt(Xi.x);
- float phi = 2.0 * PI * Xi.y;
- float t1 = r * cos(phi);
- float t2 = r * sin(phi);
- float s = 0.5 * (1.0 + Vh.z);
- t2 = (1.0 - s) * sqrt(1.0 - t1 * t1) + s * t2;
- // Section 4.3: Reprojection onto hemisphere
- vec3 Nh = t1 * T1 + t2 * T2 + sqrt(max(0.0, 1.0 - t1 * t1 - t2 * t2)) * Vh;
- // Section 3.4: Transform back to ellipsoid configuration
- return normalize(vec3(alpha * Nh.x, alpha * Nh.y, max(0.0, Nh.z)));
- }
- void main() {
- vec3 N = normalize(vOutputDirection);
- vec3 V = N; // Assume view direction equals normal for pre-filtering
- vec3 prefilteredColor = vec3(0.0);
- float totalWeight = 0.0;
- // For very low roughness, just sample the environment directly
- if (roughness < 0.001) {
- gl_FragColor = vec4(bilinearCubeUV(envMap, N, mipInt), 1.0);
- return;
- }
- // Tangent space basis for VNDF sampling
- vec3 up = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0);
- vec3 tangent = normalize(cross(up, N));
- vec3 bitangent = cross(N, tangent);
- for(uint i = 0u; i < uint(GGX_SAMPLES); i++) {
- vec2 Xi = hammersley(i, uint(GGX_SAMPLES));
- // For PMREM, V = N, so in tangent space V is always (0, 0, 1)
- vec3 H_tangent = importanceSampleGGX_VNDF(Xi, vec3(0.0, 0.0, 1.0), roughness);
- // Transform H back to world space
- vec3 H = normalize(tangent * H_tangent.x + bitangent * H_tangent.y + N * H_tangent.z);
- vec3 L = normalize(2.0 * dot(V, H) * H - V);
- float NdotL = max(dot(N, L), 0.0);
- if(NdotL > 0.0) {
- // Sample environment at fixed mip level
- // VNDF importance sampling handles the distribution filtering
- vec3 sampleColor = bilinearCubeUV(envMap, L, mipInt);
- // Weight by NdotL for the split-sum approximation
- // VNDF PDF naturally accounts for the visible microfacet distribution
- prefilteredColor += sampleColor * NdotL;
- totalWeight += NdotL;
- }
- }
- if (totalWeight > 0.0) {
- prefilteredColor = prefilteredColor / totalWeight;
- }
- gl_FragColor = vec4(prefilteredColor, 1.0);
- }
- `,blending:Zd,depthTest:!1,depthWrite:!1})}function X0e(t,e,n){const r=new Float32Array(op),a=new wt(0,1,0);return new mu({name:"SphericalGaussianBlur",defines:{n:op,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${t}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:r},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:a}},vertexShader:SC(),fragmentShader:`
- precision mediump float;
- precision mediump int;
- varying vec3 vOutputDirection;
- uniform sampler2D envMap;
- uniform int samples;
- uniform float weights[ n ];
- uniform bool latitudinal;
- uniform float dTheta;
- uniform float mipInt;
- uniform vec3 poleAxis;
- #define ENVMAP_TYPE_CUBE_UV
- #include <cube_uv_reflection_fragment>
- vec3 getSample( float theta, vec3 axis ) {
- float cosTheta = cos( theta );
- // Rodrigues' axis-angle rotation
- vec3 sampleDirection = vOutputDirection * cosTheta
- + cross( axis, vOutputDirection ) * sin( theta )
- + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );
- return bilinearCubeUV( envMap, sampleDirection, mipInt );
- }
- void main() {
- vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );
- if ( all( equal( axis, vec3( 0.0 ) ) ) ) {
- axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );
- }
- axis = normalize( axis );
- gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
- gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );
- for ( int i = 1; i < n; i++ ) {
- if ( i >= samples ) {
- break;
- }
- float theta = dTheta * float( i );
- gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );
- gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );
- }
- }
- `,blending:Zd,depthTest:!1,depthWrite:!1})}function K8(){return new mu({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:SC(),fragmentShader:`
- precision mediump float;
- precision mediump int;
- varying vec3 vOutputDirection;
- uniform sampler2D envMap;
- #include <common>
- void main() {
- vec3 outputDirection = normalize( vOutputDirection );
- vec2 uv = equirectUv( outputDirection );
- gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );
- }
- `,blending:Zd,depthTest:!1,depthWrite:!1})}function Y8(){return new mu({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:SC(),fragmentShader:`
- precision mediump float;
- precision mediump int;
- uniform float flipEnvMap;
- varying vec3 vOutputDirection;
- uniform samplerCube envMap;
- void main() {
- gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );
- }
- `,blending:Zd,depthTest:!1,depthWrite:!1})}function SC(){return`
- precision mediump float;
- precision mediump int;
- attribute float faceIndex;
- varying vec3 vOutputDirection;
- // RH coordinate system; PMREM face-indexing convention
- vec3 getDirection( vec2 uv, float face ) {
- uv = 2.0 * uv - 1.0;
- vec3 direction = vec3( uv, 1.0 );
- if ( face == 0.0 ) {
- direction = direction.zyx; // ( 1, v, u ) pos x
- } else if ( face == 1.0 ) {
- direction = direction.xzy;
- direction.xz *= -1.0; // ( -u, 1, -v ) pos y
- } else if ( face == 2.0 ) {
- direction.x *= -1.0; // ( -u, v, 1 ) pos z
- } else if ( face == 3.0 ) {
- direction = direction.zyx;
- direction.xz *= -1.0; // ( -1, v, -u ) neg x
- } else if ( face == 4.0 ) {
- direction = direction.xzy;
- direction.xy *= -1.0; // ( -u, -1, v ) neg y
- } else if ( face == 5.0 ) {
- direction.z *= -1.0; // ( u, v, -1 ) neg z
- }
- return direction;
- }
- void main() {
- vOutputDirection = getDirection( uv, faceIndex );
- gl_Position = vec4( position, 1.0 );
- }
- `}function Q0e(t){let e=new WeakMap,n=null;function r(l){if(l&&l.isTexture){const c=l.mapping,d=c===HD||c===$D,u=c===Rb||c===Fb;if(d||u){let m=e.get(l);const p=m!==void 0?m.texture.pmremVersion:0;if(l.isRenderTargetTexture&&l.pmremVersion!==p)return n===null&&(n=new G8(t)),m=d?n.fromEquirectangular(l,m):n.fromCubemap(l,m),m.texture.pmremVersion=l.pmremVersion,e.set(l,m),m.texture;if(m!==void 0)return m.texture;{const f=l.image;return d&&f&&f.height>0||u&&f&&a(f)?(n===null&&(n=new G8(t)),m=d?n.fromEquirectangular(l):n.fromCubemap(l),m.texture.pmremVersion=l.pmremVersion,e.set(l,m),l.addEventListener("dispose",s),m.texture):null}}}return l}function a(l){let c=0;const d=6;for(let u=0;u<d;u++)l[u]!==void 0&&c++;return c===d}function s(l){const c=l.target;c.removeEventListener("dispose",s);const d=e.get(c);d!==void 0&&(e.delete(c),d.dispose())}function o(){e=new WeakMap,n!==null&&(n.dispose(),n=null)}return{get:r,dispose:o}}function Z0e(t){const e={};function n(r){if(e[r]!==void 0)return e[r];const a=t.getExtension(r);return e[r]=a,a}return{has:function(r){return n(r)!==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(r){const a=n(r);return a===null&&Vv("WebGLRenderer: "+r+" extension not supported."),a}}}function J0e(t,e,n,r){const a={},s=new WeakMap;function o(m){const p=m.target;p.index!==null&&e.remove(p.index);for(const y in p.attributes)e.remove(p.attributes[y]);p.removeEventListener("dispose",o),delete a[p.id];const f=s.get(p);f&&(e.remove(f),s.delete(p)),r.releaseStatesOfGeometry(p),p.isInstancedBufferGeometry===!0&&delete p._maxInstanceCount,n.memory.geometries--}function l(m,p){return a[p.id]===!0||(p.addEventListener("dispose",o),a[p.id]=!0,n.memory.geometries++),p}function c(m){const p=m.attributes;for(const f in p)e.update(p[f],t.ARRAY_BUFFER)}function d(m){const p=[],f=m.index,y=m.attributes.position;let x=0;if(f!==null){const _=f.array;x=f.version;for(let k=0,P=_.length;k<P;k+=3){const C=_[k+0],T=_[k+1],N=_[k+2];p.push(C,T,T,N,N,C)}}else if(y!==void 0){const _=y.array;x=y.version;for(let k=0,P=_.length/3-1;k<P;k+=3){const C=k+0,T=k+1,N=k+2;p.push(C,T,T,N,N,C)}}else return;const b=new(SX(p)?jX:EX)(p,1);b.version=x;const v=s.get(m);v&&e.remove(v),s.set(m,b)}function u(m){const p=s.get(m);if(p){const f=m.index;f!==null&&p.version<f.version&&d(m)}else d(m);return s.get(m)}return{get:l,update:c,getWireframeAttribute:u}}function ewe(t,e,n){let r;function a(p){r=p}let s,o;function l(p){s=p.type,o=p.bytesPerElement}function c(p,f){t.drawElements(r,f,s,p*o),n.update(f,r,1)}function d(p,f,y){y!==0&&(t.drawElementsInstanced(r,f,s,p*o,y),n.update(f,r,y))}function u(p,f,y){if(y===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(r,f,0,s,p,0,y);let b=0;for(let v=0;v<y;v++)b+=f[v];n.update(b,r,1)}function m(p,f,y,x){if(y===0)return;const b=e.get("WEBGL_multi_draw");if(b===null)for(let v=0;v<p.length;v++)d(p[v]/o,f[v],x[v]);else{b.multiDrawElementsInstancedWEBGL(r,f,0,s,p,0,x,0,y);let v=0;for(let _=0;_<y;_++)v+=f[_]*x[_];n.update(v,r,1)}}this.setMode=a,this.setIndex=l,this.render=c,this.renderInstances=d,this.renderMultiDraw=u,this.renderMultiDrawInstances=m}function twe(t){const e={geometries:0,textures:0},n={frame:0,calls:0,triangles:0,points:0,lines:0};function r(s,o,l){switch(n.calls++,o){case t.TRIANGLES:n.triangles+=l*(s/3);break;case t.LINES:n.lines+=l*(s/2);break;case t.LINE_STRIP:n.lines+=l*(s-1);break;case t.LINE_LOOP:n.lines+=l*s;break;case t.POINTS:n.points+=l*s;break;default:$i("WebGLInfo: Unknown draw mode:",o);break}}function a(){n.calls=0,n.triangles=0,n.points=0,n.lines=0}return{memory:e,render:n,programs:null,autoReset:!0,reset:a,update:r}}function nwe(t,e,n){const r=new WeakMap,a=new na;function s(o,l,c){const d=o.morphTargetInfluences,u=l.morphAttributes.position||l.morphAttributes.normal||l.morphAttributes.color,m=u!==void 0?u.length:0;let p=r.get(l);if(p===void 0||p.count!==m){let D=function(){R.dispose(),r.delete(l),l.removeEventListener("dispose",D)};var f=D;p!==void 0&&p.texture.dispose();const y=l.morphAttributes.position!==void 0,x=l.morphAttributes.normal!==void 0,b=l.morphAttributes.color!==void 0,v=l.morphAttributes.position||[],_=l.morphAttributes.normal||[],k=l.morphAttributes.color||[];let P=0;y===!0&&(P=1),x===!0&&(P=2),b===!0&&(P=3);let C=l.attributes.position.count*P,T=1;C>e.maxTextureSize&&(T=Math.ceil(C/e.maxTextureSize),C=e.maxTextureSize);const N=new Float32Array(C*T*4*m),R=new TX(N,C,T,m);R.type=Gd,R.needsUpdate=!0;const A=P*4;for(let $=0;$<m;$++){const U=v[$],G=_[$],L=k[$],te=C*T*4*$;for(let re=0;re<U.count;re++){const J=re*A;y===!0&&(a.fromBufferAttribute(U,re),N[te+J+0]=a.x,N[te+J+1]=a.y,N[te+J+2]=a.z,N[te+J+3]=0),x===!0&&(a.fromBufferAttribute(G,re),N[te+J+4]=a.x,N[te+J+5]=a.y,N[te+J+6]=a.z,N[te+J+7]=0),b===!0&&(a.fromBufferAttribute(L,re),N[te+J+8]=a.x,N[te+J+9]=a.y,N[te+J+10]=a.z,N[te+J+11]=L.itemSize===4?a.w:1)}}p={count:m,texture:R,size:new Kn(C,T)},r.set(l,p),l.addEventListener("dispose",D)}if(o.isInstancedMesh===!0&&o.morphTexture!==null)c.getUniforms().setValue(t,"morphTexture",o.morphTexture,n);else{let y=0;for(let b=0;b<d.length;b++)y+=d[b];const x=l.morphTargetsRelative?1:1-y;c.getUniforms().setValue(t,"morphTargetBaseInfluence",x),c.getUniforms().setValue(t,"morphTargetInfluences",d)}c.getUniforms().setValue(t,"morphTargetsTexture",p.texture,n),c.getUniforms().setValue(t,"morphTargetsTextureSize",p.size)}return{update:s}}function rwe(t,e,n,r){let a=new WeakMap;function s(c){const d=r.render.frame,u=c.geometry,m=e.get(c,u);if(a.get(m)!==d&&(e.update(m),a.set(m,d)),c.isInstancedMesh&&(c.hasEventListener("dispose",l)===!1&&c.addEventListener("dispose",l),a.get(c)!==d&&(n.update(c.instanceMatrix,t.ARRAY_BUFFER),c.instanceColor!==null&&n.update(c.instanceColor,t.ARRAY_BUFFER),a.set(c,d))),c.isSkinnedMesh){const p=c.skeleton;a.get(p)!==d&&(p.update(),a.set(p,d))}return m}function o(){a=new WeakMap}function l(c){const d=c.target;d.removeEventListener("dispose",l),n.remove(d.instanceMatrix),d.instanceColor!==null&&n.remove(d.instanceColor)}return{update:s,dispose:o}}const GX=new oc,X8=new zX(1,1),WX=new TX,KX=new vxe,YX=new OX,Q8=[],Z8=[],J8=new Float32Array(16),e6=new Float32Array(9),t6=new Float32Array(4);function hx(t,e,n){const r=t[0];if(r<=0||r>0)return t;const a=e*n;let s=Q8[a];if(s===void 0&&(s=new Float32Array(a),Q8[a]=s),e!==0){r.toArray(s,0);for(let o=1,l=0;o!==e;++o)l+=n,t[o].toArray(s,l)}return s}function fa(t,e){if(t.length!==e.length)return!1;for(let n=0,r=t.length;n<r;n++)if(t[n]!==e[n])return!1;return!0}function ga(t,e){for(let n=0,r=e.length;n<r;n++)t[n]=e[n]}function _C(t,e){let n=Z8[e];n===void 0&&(n=new Int32Array(e),Z8[e]=n);for(let r=0;r!==e;++r)n[r]=t.allocateTextureUnit();return n}function iwe(t,e){const n=this.cache;n[0]!==e&&(t.uniform1f(this.addr,e),n[0]=e)}function awe(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(fa(n,e))return;t.uniform2fv(this.addr,e),ga(n,e)}}function swe(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(fa(n,e))return;t.uniform3fv(this.addr,e),ga(n,e)}}function owe(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(fa(n,e))return;t.uniform4fv(this.addr,e),ga(n,e)}}function lwe(t,e){const n=this.cache,r=e.elements;if(r===void 0){if(fa(n,e))return;t.uniformMatrix2fv(this.addr,!1,e),ga(n,e)}else{if(fa(n,r))return;t6.set(r),t.uniformMatrix2fv(this.addr,!1,t6),ga(n,r)}}function cwe(t,e){const n=this.cache,r=e.elements;if(r===void 0){if(fa(n,e))return;t.uniformMatrix3fv(this.addr,!1,e),ga(n,e)}else{if(fa(n,r))return;e6.set(r),t.uniformMatrix3fv(this.addr,!1,e6),ga(n,r)}}function dwe(t,e){const n=this.cache,r=e.elements;if(r===void 0){if(fa(n,e))return;t.uniformMatrix4fv(this.addr,!1,e),ga(n,e)}else{if(fa(n,r))return;J8.set(r),t.uniformMatrix4fv(this.addr,!1,J8),ga(n,r)}}function uwe(t,e){const n=this.cache;n[0]!==e&&(t.uniform1i(this.addr,e),n[0]=e)}function mwe(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(fa(n,e))return;t.uniform2iv(this.addr,e),ga(n,e)}}function hwe(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(fa(n,e))return;t.uniform3iv(this.addr,e),ga(n,e)}}function pwe(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(fa(n,e))return;t.uniform4iv(this.addr,e),ga(n,e)}}function fwe(t,e){const n=this.cache;n[0]!==e&&(t.uniform1ui(this.addr,e),n[0]=e)}function gwe(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(fa(n,e))return;t.uniform2uiv(this.addr,e),ga(n,e)}}function bwe(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(fa(n,e))return;t.uniform3uiv(this.addr,e),ga(n,e)}}function xwe(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(fa(n,e))return;t.uniform4uiv(this.addr,e),ga(n,e)}}function ywe(t,e,n){const r=this.cache,a=n.allocateTextureUnit();r[0]!==a&&(t.uniform1i(this.addr,a),r[0]=a);let s;this.type===t.SAMPLER_2D_SHADOW?(X8.compareFunction=wX,s=X8):s=GX,n.setTexture2D(e||s,a)}function vwe(t,e,n){const r=this.cache,a=n.allocateTextureUnit();r[0]!==a&&(t.uniform1i(this.addr,a),r[0]=a),n.setTexture3D(e||KX,a)}function wwe(t,e,n){const r=this.cache,a=n.allocateTextureUnit();r[0]!==a&&(t.uniform1i(this.addr,a),r[0]=a),n.setTextureCube(e||YX,a)}function Swe(t,e,n){const r=this.cache,a=n.allocateTextureUnit();r[0]!==a&&(t.uniform1i(this.addr,a),r[0]=a),n.setTexture2DArray(e||WX,a)}function _we(t){switch(t){case 5126:return iwe;case 35664:return awe;case 35665:return swe;case 35666:return owe;case 35674:return lwe;case 35675:return cwe;case 35676:return dwe;case 5124:case 35670:return uwe;case 35667:case 35671:return mwe;case 35668:case 35672:return hwe;case 35669:case 35673:return pwe;case 5125:return fwe;case 36294:return gwe;case 36295:return bwe;case 36296:return xwe;case 35678:case 36198:case 36298:case 36306:case 35682:return ywe;case 35679:case 36299:case 36307:return vwe;case 35680:case 36300:case 36308:case 36293:return wwe;case 36289:case 36303:case 36311:case 36292:return Swe}}function kwe(t,e){t.uniform1fv(this.addr,e)}function Nwe(t,e){const n=hx(e,this.size,2);t.uniform2fv(this.addr,n)}function Cwe(t,e){const n=hx(e,this.size,3);t.uniform3fv(this.addr,n)}function Twe(t,e){const n=hx(e,this.size,4);t.uniform4fv(this.addr,n)}function Pwe(t,e){const n=hx(e,this.size,4);t.uniformMatrix2fv(this.addr,!1,n)}function Awe(t,e){const n=hx(e,this.size,9);t.uniformMatrix3fv(this.addr,!1,n)}function Mwe(t,e){const n=hx(e,this.size,16);t.uniformMatrix4fv(this.addr,!1,n)}function Ewe(t,e){t.uniform1iv(this.addr,e)}function jwe(t,e){t.uniform2iv(this.addr,e)}function Dwe(t,e){t.uniform3iv(this.addr,e)}function Rwe(t,e){t.uniform4iv(this.addr,e)}function Fwe(t,e){t.uniform1uiv(this.addr,e)}function Lwe(t,e){t.uniform2uiv(this.addr,e)}function Owe(t,e){t.uniform3uiv(this.addr,e)}function Iwe(t,e){t.uniform4uiv(this.addr,e)}function zwe(t,e,n){const r=this.cache,a=e.length,s=_C(n,a);fa(r,s)||(t.uniform1iv(this.addr,s),ga(r,s));for(let o=0;o!==a;++o)n.setTexture2D(e[o]||GX,s[o])}function Uwe(t,e,n){const r=this.cache,a=e.length,s=_C(n,a);fa(r,s)||(t.uniform1iv(this.addr,s),ga(r,s));for(let o=0;o!==a;++o)n.setTexture3D(e[o]||KX,s[o])}function Bwe(t,e,n){const r=this.cache,a=e.length,s=_C(n,a);fa(r,s)||(t.uniform1iv(this.addr,s),ga(r,s));for(let o=0;o!==a;++o)n.setTextureCube(e[o]||YX,s[o])}function Hwe(t,e,n){const r=this.cache,a=e.length,s=_C(n,a);fa(r,s)||(t.uniform1iv(this.addr,s),ga(r,s));for(let o=0;o!==a;++o)n.setTexture2DArray(e[o]||WX,s[o])}function $we(t){switch(t){case 5126:return kwe;case 35664:return Nwe;case 35665:return Cwe;case 35666:return Twe;case 35674:return Pwe;case 35675:return Awe;case 35676:return Mwe;case 5124:case 35670:return Ewe;case 35667:case 35671:return jwe;case 35668:case 35672:return Dwe;case 35669:case 35673:return Rwe;case 5125:return Fwe;case 36294:return Lwe;case 36295:return Owe;case 36296:return Iwe;case 35678:case 36198:case 36298:case 36306:case 35682:return zwe;case 35679:case 36299:case 36307:return Uwe;case 35680:case 36300:case 36308:case 36293:return Bwe;case 36289:case 36303:case 36311:case 36292:return Hwe}}let qwe=class{constructor(e,n,r){this.id=e,this.addr=r,this.cache=[],this.type=n.type,this.setValue=_we(n.type)}},Vwe=class{constructor(e,n,r){this.id=e,this.addr=r,this.cache=[],this.type=n.type,this.size=n.size,this.setValue=$we(n.type)}},Gwe=class{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,n,r){const a=this.seq;for(let s=0,o=a.length;s!==o;++s){const l=a[s];l.setValue(e,n[l.id],r)}}};const LM=/(\w+)(\])?(\[|\.)?/g;function n6(t,e){t.seq.push(e),t.map[e.id]=e}function Wwe(t,e,n){const r=t.name,a=r.length;for(LM.lastIndex=0;;){const s=LM.exec(r),o=LM.lastIndex;let l=s[1];const c=s[2]==="]",d=s[3];if(c&&(l=l|0),d===void 0||d==="["&&o+2===a){n6(n,d===void 0?new qwe(l,t,e):new Vwe(l,t,e));break}else{let m=n.map[l];m===void 0&&(m=new Gwe(l),n6(n,m)),n=m}}}let x1=class{constructor(e,n){this.seq=[],this.map={};const r=e.getProgramParameter(n,e.ACTIVE_UNIFORMS);for(let a=0;a<r;++a){const s=e.getActiveUniform(n,a),o=e.getUniformLocation(n,s.name);Wwe(s,o,this)}}setValue(e,n,r,a){const s=this.map[n];s!==void 0&&s.setValue(e,r,a)}setOptional(e,n,r){const a=n[r];a!==void 0&&this.setValue(e,r,a)}static upload(e,n,r,a){for(let s=0,o=n.length;s!==o;++s){const l=n[s],c=r[l.id];c.needsUpdate!==!1&&l.setValue(e,c.value,a)}}static seqWithValue(e,n){const r=[];for(let a=0,s=e.length;a!==s;++a){const o=e[a];o.id in n&&r.push(o)}return r}};function r6(t,e,n){const r=t.createShader(e);return t.shaderSource(r,n),t.compileShader(r),r}const Kwe=37297;let Ywe=0;function Xwe(t,e){const n=t.split(`
- `),r=[],a=Math.max(e-6,0),s=Math.min(e+6,n.length);for(let o=a;o<s;o++){const l=o+1;r.push(`${l===e?">":" "} ${l}: ${n[o]}`)}return r.join(`
- `)}const i6=new Qn;function Qwe(t){xr._getMatrix(i6,xr.workingColorSpace,t);const e=`mat3( ${i6.elements.map(n=>n.toFixed(4))} )`;switch(xr.getTransfer(t)){case Y1:return[e,"LinearTransferOETF"];case Ur:return[e,"sRGBTransferOETF"];default:return Mn("WebGLProgram: Unsupported color space: ",t),[e,"LinearTransferOETF"]}}function a6(t,e,n){const r=t.getShaderParameter(e,t.COMPILE_STATUS),s=(t.getShaderInfoLog(e)||"").trim();if(r&&s==="")return"";const o=/ERROR: 0:(\d+)/.exec(s);if(o){const l=parseInt(o[1]);return n.toUpperCase()+`
- `+s+`
- `+Xwe(t.getShaderSource(e),l)}else return s}function Zwe(t,e){const n=Qwe(e);return[`vec4 ${t}( vec4 value ) {`,` return ${n[1]}( vec4( value.rgb * ${n[0]}, value.a ) );`,"}"].join(`
- `)}function Jwe(t,e){let n;switch(e){case Wbe:n="Linear";break;case Kbe:n="Reinhard";break;case Ybe:n="Cineon";break;case Xbe:n="ACESFilmic";break;case Zbe:n="AgX";break;case Jbe:n="Neutral";break;case Qbe:n="Custom";break;default:Mn("WebGLProgram: Unsupported toneMapping:",e),n="Linear"}return"vec3 "+t+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}const VS=new wt;function eSe(){xr.getLuminanceCoefficients(VS);const t=VS.x.toFixed(4),e=VS.y.toFixed(4),n=VS.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${t}, ${e}, ${n} );`," return dot( weights, rgb );","}"].join(`
- `)}function tSe(t){return[t.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",t.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(Vy).join(`
- `)}function nSe(t){const e=[];for(const n in t){const r=t[n];r!==!1&&e.push("#define "+n+" "+r)}return e.join(`
- `)}function rSe(t,e){const n={},r=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES);for(let a=0;a<r;a++){const s=t.getActiveAttrib(e,a),o=s.name;let l=1;s.type===t.FLOAT_MAT2&&(l=2),s.type===t.FLOAT_MAT3&&(l=3),s.type===t.FLOAT_MAT4&&(l=4),n[o]={type:s.type,location:t.getAttribLocation(e,o),locationSize:l}}return n}function Vy(t){return t!==""}function s6(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 o6(t,e){return t.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const iSe=/^[ \t]*#include +<([\w\d./]+)>/gm;function S3(t){return t.replace(iSe,sSe)}const aSe=new Map;function sSe(t,e){let n=qn[e];if(n===void 0){const r=aSe.get(e);if(r!==void 0)n=qn[r],Mn('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,r);else throw new Error("Can not resolve #include <"+e+">")}return S3(n)}const oSe=/#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 l6(t){return t.replace(oSe,lSe)}function lSe(t,e,n,r){let a="";for(let s=parseInt(e);s<parseInt(n);s++)a+=r.replace(/\[\s*i\s*\]/g,"[ "+s+" ]").replace(/UNROLLED_LOOP_INDEX/g,s);return a}function c6(t){let e=`precision ${t.precision} float;
- precision ${t.precision} int;
- precision ${t.precision} sampler2D;
- precision ${t.precision} samplerCube;
- precision ${t.precision} sampler3D;
- precision ${t.precision} sampler2DArray;
- precision ${t.precision} sampler2DShadow;
- precision ${t.precision} samplerCubeShadow;
- precision ${t.precision} sampler2DArrayShadow;
- precision ${t.precision} isampler2D;
- precision ${t.precision} isampler3D;
- precision ${t.precision} isamplerCube;
- precision ${t.precision} isampler2DArray;
- precision ${t.precision} usampler2D;
- precision ${t.precision} usampler3D;
- precision ${t.precision} usamplerCube;
- precision ${t.precision} usampler2DArray;
- `;return t.precision==="highp"?e+=`
- #define HIGH_PRECISION`:t.precision==="mediump"?e+=`
- #define MEDIUM_PRECISION`:t.precision==="lowp"&&(e+=`
- #define LOW_PRECISION`),e}function cSe(t){let e="SHADOWMAP_TYPE_BASIC";return t.shadowMapType===uX?e="SHADOWMAP_TYPE_PCF":t.shadowMapType===Cbe?e="SHADOWMAP_TYPE_PCF_SOFT":t.shadowMapType===Ld&&(e="SHADOWMAP_TYPE_VSM"),e}function dSe(t){let e="ENVMAP_TYPE_CUBE";if(t.envMap)switch(t.envMapMode){case Rb:case Fb:e="ENVMAP_TYPE_CUBE";break;case vC:e="ENVMAP_TYPE_CUBE_UV";break}return e}function uSe(t){let e="ENVMAP_MODE_REFLECTION";return t.envMap&&t.envMapMode===Fb&&(e="ENVMAP_MODE_REFRACTION"),e}function mSe(t){let e="ENVMAP_BLENDING_NONE";if(t.envMap)switch(t.combine){case nL:e="ENVMAP_BLENDING_MULTIPLY";break;case Vbe:e="ENVMAP_BLENDING_MIX";break;case Gbe:e="ENVMAP_BLENDING_ADD";break}return e}function hSe(t){const e=t.envMapCubeUVHeight;if(e===null)return null;const n=Math.log2(e)-2,r=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,n),112)),texelHeight:r,maxMip:n}}function pSe(t,e,n,r){const a=t.getContext(),s=n.defines;let o=n.vertexShader,l=n.fragmentShader;const c=cSe(n),d=dSe(n),u=uSe(n),m=mSe(n),p=hSe(n),f=tSe(n),y=nSe(s),x=a.createProgram();let b,v,_=n.glslVersion?"#version "+n.glslVersion+`
- `:"";n.isRawShaderMaterial?(b=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,y].filter(Vy).join(`
- `),b.length>0&&(b+=`
- `),v=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,y].filter(Vy).join(`
- `),v.length>0&&(v+=`
- `)):(b=[c6(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 "+u:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.displacementMap?"#define USE_DISPLACEMENTMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.mapUv?"#define MAP_UV "+n.mapUv:"",n.alphaMapUv?"#define ALPHAMAP_UV "+n.alphaMapUv:"",n.lightMapUv?"#define LIGHTMAP_UV "+n.lightMapUv:"",n.aoMapUv?"#define AOMAP_UV "+n.aoMapUv:"",n.emissiveMapUv?"#define EMISSIVEMAP_UV "+n.emissiveMapUv:"",n.bumpMapUv?"#define BUMPMAP_UV "+n.bumpMapUv:"",n.normalMapUv?"#define NORMALMAP_UV "+n.normalMapUv:"",n.displacementMapUv?"#define DISPLACEMENTMAP_UV "+n.displacementMapUv:"",n.metalnessMapUv?"#define METALNESSMAP_UV "+n.metalnessMapUv:"",n.roughnessMapUv?"#define ROUGHNESSMAP_UV "+n.roughnessMapUv:"",n.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+n.anisotropyMapUv:"",n.clearcoatMapUv?"#define CLEARCOATMAP_UV "+n.clearcoatMapUv:"",n.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+n.clearcoatNormalMapUv:"",n.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+n.clearcoatRoughnessMapUv:"",n.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+n.iridescenceMapUv:"",n.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+n.iridescenceThicknessMapUv:"",n.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+n.sheenColorMapUv:"",n.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+n.sheenRoughnessMapUv:"",n.specularMapUv?"#define SPECULARMAP_UV "+n.specularMapUv:"",n.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+n.specularColorMapUv:"",n.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+n.specularIntensityMapUv:"",n.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+n.transmissionMapUv:"",n.thicknessMapUv?"#define THICKNESSMAP_UV "+n.thicknessMapUv:"",n.vertexTangents&&n.flatShading===!1?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&n.flatShading===!1?"#define USE_MORPHNORMALS":"",n.morphColors?"#define USE_MORPHCOLORS":"",n.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+n.morphTextureStride:"",n.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+n.morphTargetsCount:"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+c:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",n.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",`
- `].filter(Vy).join(`
- `),v=[c6(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 "+d:"",n.envMap?"#define "+u:"",n.envMap?"#define "+m:"",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 "+c:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",n.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",n.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",n.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",n.toneMapping!==Gm?"#define TONE_MAPPING":"",n.toneMapping!==Gm?qn.tonemapping_pars_fragment:"",n.toneMapping!==Gm?Jwe("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",qn.colorspace_pars_fragment,Zwe("linearToOutputTexel",n.outputColorSpace),eSe(),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"",`
- `].filter(Vy).join(`
- `)),o=S3(o),o=s6(o,n),o=o6(o,n),l=S3(l),l=s6(l,n),l=o6(l,n),o=l6(o),l=l6(l),n.isRawShaderMaterial!==!0&&(_=`#version 300 es
- `,b=[f,"#define attribute in","#define varying out","#define texture2D texture"].join(`
- `)+`
- `+b,v=["#define varying in",n.glslVersion===f8?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===f8?"":"#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(`
- `)+`
- `+v);const k=_+b+o,P=_+v+l,C=r6(a,a.VERTEX_SHADER,k),T=r6(a,a.FRAGMENT_SHADER,P);a.attachShader(x,C),a.attachShader(x,T),n.index0AttributeName!==void 0?a.bindAttribLocation(x,0,n.index0AttributeName):n.morphTargets===!0&&a.bindAttribLocation(x,0,"position"),a.linkProgram(x);function N($){if(t.debug.checkShaderErrors){const U=a.getProgramInfoLog(x)||"",G=a.getShaderInfoLog(C)||"",L=a.getShaderInfoLog(T)||"",te=U.trim(),re=G.trim(),J=L.trim();let ue=!0,me=!0;if(a.getProgramParameter(x,a.LINK_STATUS)===!1)if(ue=!1,typeof t.debug.onShaderError=="function")t.debug.onShaderError(a,x,C,T);else{const ge=a6(a,C,"vertex"),X=a6(a,T,"fragment");$i("THREE.WebGLProgram: Shader Error "+a.getError()+" - VALIDATE_STATUS "+a.getProgramParameter(x,a.VALIDATE_STATUS)+`
- Material Name: `+$.name+`
- Material Type: `+$.type+`
- Program Info Log: `+te+`
- `+ge+`
- `+X)}else te!==""?Mn("WebGLProgram: Program Info Log:",te):(re===""||J==="")&&(me=!1);me&&($.diagnostics={runnable:ue,programLog:te,vertexShader:{log:re,prefix:b},fragmentShader:{log:J,prefix:v}})}a.deleteShader(C),a.deleteShader(T),R=new x1(a,x),A=rSe(a,x)}let R;this.getUniforms=function(){return R===void 0&&N(this),R};let A;this.getAttributes=function(){return A===void 0&&N(this),A};let D=n.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return D===!1&&(D=a.getProgramParameter(x,Kwe)),D},this.destroy=function(){r.releaseStatesOfProgram(this),a.deleteProgram(x),this.program=void 0},this.type=n.shaderType,this.name=n.shaderName,this.id=Ywe++,this.cacheKey=e,this.usedTimes=1,this.program=x,this.vertexShader=C,this.fragmentShader=T,this}let fSe=0,gSe=class{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const n=e.vertexShader,r=e.fragmentShader,a=this._getShaderStage(n),s=this._getShaderStage(r),o=this._getShaderCacheForMaterial(e);return o.has(a)===!1&&(o.add(a),a.usedTimes++),o.has(s)===!1&&(o.add(s),s.usedTimes++),this}remove(e){const n=this.materialCache.get(e);for(const r of n)r.usedTimes--,r.usedTimes===0&&this.shaderCache.delete(r.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const n=this.materialCache;let r=n.get(e);return r===void 0&&(r=new Set,n.set(e,r)),r}_getShaderStage(e){const n=this.shaderCache;let r=n.get(e);return r===void 0&&(r=new bSe(e),n.set(e,r)),r}},bSe=class{constructor(e){this.id=fSe++,this.code=e,this.usedTimes=0}};function xSe(t,e,n,r,a,s,o){const l=new AX,c=new gSe,d=new Set,u=[],m=a.logarithmicDepthBuffer,p=a.vertexTextures;let f=a.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 x(A){return d.add(A),A===0?"uv":`uv${A}`}function b(A,D,$,U,G){const L=U.fog,te=G.geometry,re=A.isMeshStandardMaterial?U.environment:null,J=(A.isMeshStandardMaterial?n:e).get(A.envMap||re),ue=J&&J.mapping===vC?J.image.height:null,me=y[A.type];A.precision!==null&&(f=a.getMaxPrecision(A.precision),f!==A.precision&&Mn("WebGLProgram.getParameters:",A.precision,"not supported, using",f,"instead."));const ge=te.morphAttributes.position||te.morphAttributes.normal||te.morphAttributes.color,X=ge!==void 0?ge.length:0;let ie=0;te.morphAttributes.position!==void 0&&(ie=1),te.morphAttributes.normal!==void 0&&(ie=2),te.morphAttributes.color!==void 0&&(ie=3);let le,pe,Ce,q;if(me){const St=Pc[me];le=St.vertexShader,pe=St.fragmentShader}else le=A.vertexShader,pe=A.fragmentShader,c.update(A),Ce=c.getVertexShaderID(A),q=c.getFragmentShaderID(A);const Z=t.getRenderTarget(),j=t.state.buffers.depth.getReversed(),E=G.isInstancedMesh===!0,I=G.isBatchedMesh===!0,W=!!A.map,B=!!A.matcap,ae=!!J,z=!!A.aoMap,V=!!A.lightMap,ee=!!A.bumpMap,K=!!A.normalMap,ne=!!A.displacementMap,se=!!A.emissiveMap,ce=!!A.metalnessMap,fe=!!A.roughnessMap,oe=A.anisotropy>0,O=A.clearcoat>0,F=A.dispersion>0,Q=A.iridescence>0,ve=A.sheen>0,he=A.transmission>0,de=oe&&!!A.anisotropyMap,Ae=O&&!!A.clearcoatMap,_e=O&&!!A.clearcoatNormalMap,ze=O&&!!A.clearcoatRoughnessMap,Be=Q&&!!A.iridescenceMap,Ue=Q&&!!A.iridescenceThicknessMap,Ne=ve&&!!A.sheenColorMap,Ee=ve&&!!A.sheenRoughnessMap,ke=!!A.specularMap,Me=!!A.specularColorMap,Ge=!!A.specularIntensityMap,xe=he&&!!A.transmissionMap,He=he&&!!A.thicknessMap,Pe=!!A.gradientMap,Ve=!!A.alphaMap,je=A.alphaTest>0,ye=!!A.alphaHash,$e=!!A.extensions;let Ye=Gm;A.toneMapped&&(Z===null||Z.isXRRenderTarget===!0)&&(Ye=t.toneMapping);const lt={shaderID:me,shaderType:A.type,shaderName:A.name,vertexShader:le,fragmentShader:pe,defines:A.defines,customVertexShaderID:Ce,customFragmentShaderID:q,isRawShaderMaterial:A.isRawShaderMaterial===!0,glslVersion:A.glslVersion,precision:f,batching:I,batchingColor:I&&G._colorsTexture!==null,instancing:E,instancingColor:E&&G.instanceColor!==null,instancingMorph:E&&G.morphTexture!==null,supportsVertexTextures:p,outputColorSpace:Z===null?t.outputColorSpace:Z.isXRRenderTarget===!0?Z.texture.colorSpace:Lb,alphaToCoverage:!!A.alphaToCoverage,map:W,matcap:B,envMap:ae,envMapMode:ae&&J.mapping,envMapCubeUVHeight:ue,aoMap:z,lightMap:V,bumpMap:ee,normalMap:K,displacementMap:p&&ne,emissiveMap:se,normalMapObjectSpace:K&&A.normalMapType===rxe,normalMapTangentSpace:K&&A.normalMapType===vX,metalnessMap:ce,roughnessMap:fe,anisotropy:oe,anisotropyMap:de,clearcoat:O,clearcoatMap:Ae,clearcoatNormalMap:_e,clearcoatRoughnessMap:ze,dispersion:F,iridescence:Q,iridescenceMap:Be,iridescenceThicknessMap:Ue,sheen:ve,sheenColorMap:Ne,sheenRoughnessMap:Ee,specularMap:ke,specularColorMap:Me,specularIntensityMap:Ge,transmission:he,transmissionMap:xe,thicknessMap:He,gradientMap:Pe,opaque:A.transparent===!1&&A.blending===gb&&A.alphaToCoverage===!1,alphaMap:Ve,alphaTest:je,alphaHash:ye,combine:A.combine,mapUv:W&&x(A.map.channel),aoMapUv:z&&x(A.aoMap.channel),lightMapUv:V&&x(A.lightMap.channel),bumpMapUv:ee&&x(A.bumpMap.channel),normalMapUv:K&&x(A.normalMap.channel),displacementMapUv:ne&&x(A.displacementMap.channel),emissiveMapUv:se&&x(A.emissiveMap.channel),metalnessMapUv:ce&&x(A.metalnessMap.channel),roughnessMapUv:fe&&x(A.roughnessMap.channel),anisotropyMapUv:de&&x(A.anisotropyMap.channel),clearcoatMapUv:Ae&&x(A.clearcoatMap.channel),clearcoatNormalMapUv:_e&&x(A.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:ze&&x(A.clearcoatRoughnessMap.channel),iridescenceMapUv:Be&&x(A.iridescenceMap.channel),iridescenceThicknessMapUv:Ue&&x(A.iridescenceThicknessMap.channel),sheenColorMapUv:Ne&&x(A.sheenColorMap.channel),sheenRoughnessMapUv:Ee&&x(A.sheenRoughnessMap.channel),specularMapUv:ke&&x(A.specularMap.channel),specularColorMapUv:Me&&x(A.specularColorMap.channel),specularIntensityMapUv:Ge&&x(A.specularIntensityMap.channel),transmissionMapUv:xe&&x(A.transmissionMap.channel),thicknessMapUv:He&&x(A.thicknessMap.channel),alphaMapUv:Ve&&x(A.alphaMap.channel),vertexTangents:!!te.attributes.tangent&&(K||oe),vertexColors:A.vertexColors,vertexAlphas:A.vertexColors===!0&&!!te.attributes.color&&te.attributes.color.itemSize===4,pointsUvs:G.isPoints===!0&&!!te.attributes.uv&&(W||Ve),fog:!!L,useFog:A.fog===!0,fogExp2:!!L&&L.isFogExp2,flatShading:A.flatShading===!0&&A.wireframe===!1,sizeAttenuation:A.sizeAttenuation===!0,logarithmicDepthBuffer:m,reversedDepthBuffer:j,skinning:G.isSkinnedMesh===!0,morphTargets:te.morphAttributes.position!==void 0,morphNormals:te.morphAttributes.normal!==void 0,morphColors:te.morphAttributes.color!==void 0,morphTargetsCount:X,morphTextureStride:ie,numDirLights:D.directional.length,numPointLights:D.point.length,numSpotLights:D.spot.length,numSpotLightMaps:D.spotLightMap.length,numRectAreaLights:D.rectArea.length,numHemiLights:D.hemi.length,numDirLightShadows:D.directionalShadowMap.length,numPointLightShadows:D.pointShadowMap.length,numSpotLightShadows:D.spotShadowMap.length,numSpotLightShadowsWithMaps:D.numSpotLightShadowsWithMaps,numLightProbes:D.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:A.dithering,shadowMapEnabled:t.shadowMap.enabled&&$.length>0,shadowMapType:t.shadowMap.type,toneMapping:Ye,decodeVideoTexture:W&&A.map.isVideoTexture===!0&&xr.getTransfer(A.map.colorSpace)===Ur,decodeVideoTextureEmissive:se&&A.emissiveMap.isVideoTexture===!0&&xr.getTransfer(A.emissiveMap.colorSpace)===Ur,premultipliedAlpha:A.premultipliedAlpha,doubleSided:A.side===Mc,flipSided:A.side===ao,useDepthPacking:A.depthPacking>=0,depthPacking:A.depthPacking||0,index0AttributeName:A.index0AttributeName,extensionClipCullDistance:$e&&A.extensions.clipCullDistance===!0&&r.has("WEBGL_clip_cull_distance"),extensionMultiDraw:($e&&A.extensions.multiDraw===!0||I)&&r.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:r.has("KHR_parallel_shader_compile"),customProgramCacheKey:A.customProgramCacheKey()};return lt.vertexUv1s=d.has(1),lt.vertexUv2s=d.has(2),lt.vertexUv3s=d.has(3),d.clear(),lt}function v(A){const D=[];if(A.shaderID?D.push(A.shaderID):(D.push(A.customVertexShaderID),D.push(A.customFragmentShaderID)),A.defines!==void 0)for(const $ in A.defines)D.push($),D.push(A.defines[$]);return A.isRawShaderMaterial===!1&&(_(D,A),k(D,A),D.push(t.outputColorSpace)),D.push(A.customProgramCacheKey),D.join()}function _(A,D){A.push(D.precision),A.push(D.outputColorSpace),A.push(D.envMapMode),A.push(D.envMapCubeUVHeight),A.push(D.mapUv),A.push(D.alphaMapUv),A.push(D.lightMapUv),A.push(D.aoMapUv),A.push(D.bumpMapUv),A.push(D.normalMapUv),A.push(D.displacementMapUv),A.push(D.emissiveMapUv),A.push(D.metalnessMapUv),A.push(D.roughnessMapUv),A.push(D.anisotropyMapUv),A.push(D.clearcoatMapUv),A.push(D.clearcoatNormalMapUv),A.push(D.clearcoatRoughnessMapUv),A.push(D.iridescenceMapUv),A.push(D.iridescenceThicknessMapUv),A.push(D.sheenColorMapUv),A.push(D.sheenRoughnessMapUv),A.push(D.specularMapUv),A.push(D.specularColorMapUv),A.push(D.specularIntensityMapUv),A.push(D.transmissionMapUv),A.push(D.thicknessMapUv),A.push(D.combine),A.push(D.fogExp2),A.push(D.sizeAttenuation),A.push(D.morphTargetsCount),A.push(D.morphAttributeCount),A.push(D.numDirLights),A.push(D.numPointLights),A.push(D.numSpotLights),A.push(D.numSpotLightMaps),A.push(D.numHemiLights),A.push(D.numRectAreaLights),A.push(D.numDirLightShadows),A.push(D.numPointLightShadows),A.push(D.numSpotLightShadows),A.push(D.numSpotLightShadowsWithMaps),A.push(D.numLightProbes),A.push(D.shadowMapType),A.push(D.toneMapping),A.push(D.numClippingPlanes),A.push(D.numClipIntersection),A.push(D.depthPacking)}function k(A,D){l.disableAll(),D.supportsVertexTextures&&l.enable(0),D.instancing&&l.enable(1),D.instancingColor&&l.enable(2),D.instancingMorph&&l.enable(3),D.matcap&&l.enable(4),D.envMap&&l.enable(5),D.normalMapObjectSpace&&l.enable(6),D.normalMapTangentSpace&&l.enable(7),D.clearcoat&&l.enable(8),D.iridescence&&l.enable(9),D.alphaTest&&l.enable(10),D.vertexColors&&l.enable(11),D.vertexAlphas&&l.enable(12),D.vertexUv1s&&l.enable(13),D.vertexUv2s&&l.enable(14),D.vertexUv3s&&l.enable(15),D.vertexTangents&&l.enable(16),D.anisotropy&&l.enable(17),D.alphaHash&&l.enable(18),D.batching&&l.enable(19),D.dispersion&&l.enable(20),D.batchingColor&&l.enable(21),D.gradientMap&&l.enable(22),A.push(l.mask),l.disableAll(),D.fog&&l.enable(0),D.useFog&&l.enable(1),D.flatShading&&l.enable(2),D.logarithmicDepthBuffer&&l.enable(3),D.reversedDepthBuffer&&l.enable(4),D.skinning&&l.enable(5),D.morphTargets&&l.enable(6),D.morphNormals&&l.enable(7),D.morphColors&&l.enable(8),D.premultipliedAlpha&&l.enable(9),D.shadowMapEnabled&&l.enable(10),D.doubleSided&&l.enable(11),D.flipSided&&l.enable(12),D.useDepthPacking&&l.enable(13),D.dithering&&l.enable(14),D.transmission&&l.enable(15),D.sheen&&l.enable(16),D.opaque&&l.enable(17),D.pointsUvs&&l.enable(18),D.decodeVideoTexture&&l.enable(19),D.decodeVideoTextureEmissive&&l.enable(20),D.alphaToCoverage&&l.enable(21),A.push(l.mask)}function P(A){const D=y[A.type];let $;if(D){const U=Pc[D];$=Dxe.clone(U.uniforms)}else $=A.uniforms;return $}function C(A,D){let $;for(let U=0,G=u.length;U<G;U++){const L=u[U];if(L.cacheKey===D){$=L,++$.usedTimes;break}}return $===void 0&&($=new pSe(t,D,A,s),u.push($)),$}function T(A){if(--A.usedTimes===0){const D=u.indexOf(A);u[D]=u[u.length-1],u.pop(),A.destroy()}}function N(A){c.remove(A)}function R(){c.dispose()}return{getParameters:b,getProgramCacheKey:v,getUniforms:P,acquireProgram:C,releaseProgram:T,releaseShaderCache:N,programs:u,dispose:R}}function ySe(){let t=new WeakMap;function e(o){return t.has(o)}function n(o){let l=t.get(o);return l===void 0&&(l={},t.set(o,l)),l}function r(o){t.delete(o)}function a(o,l,c){t.get(o)[l]=c}function s(){t=new WeakMap}return{has:e,get:n,remove:r,update:a,dispose:s}}function vSe(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 d6(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 u6(){const t=[];let e=0;const n=[],r=[],a=[];function s(){e=0,n.length=0,r.length=0,a.length=0}function o(m,p,f,y,x,b){let v=t[e];return v===void 0?(v={id:m.id,object:m,geometry:p,material:f,groupOrder:y,renderOrder:m.renderOrder,z:x,group:b},t[e]=v):(v.id=m.id,v.object=m,v.geometry=p,v.material=f,v.groupOrder=y,v.renderOrder=m.renderOrder,v.z=x,v.group=b),e++,v}function l(m,p,f,y,x,b){const v=o(m,p,f,y,x,b);f.transmission>0?r.push(v):f.transparent===!0?a.push(v):n.push(v)}function c(m,p,f,y,x,b){const v=o(m,p,f,y,x,b);f.transmission>0?r.unshift(v):f.transparent===!0?a.unshift(v):n.unshift(v)}function d(m,p){n.length>1&&n.sort(m||vSe),r.length>1&&r.sort(p||d6),a.length>1&&a.sort(p||d6)}function u(){for(let m=e,p=t.length;m<p;m++){const f=t[m];if(f.id===null)break;f.id=null,f.object=null,f.geometry=null,f.material=null,f.group=null}}return{opaque:n,transmissive:r,transparent:a,init:s,push:l,unshift:c,finish:u,sort:d}}function wSe(){let t=new WeakMap;function e(r,a){const s=t.get(r);let o;return s===void 0?(o=new u6,t.set(r,[o])):a>=s.length?(o=new u6,s.push(o)):o=s[a],o}function n(){t=new WeakMap}return{get:e,dispose:n}}function SSe(){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 wt,color:new Zn};break;case"SpotLight":n={position:new wt,direction:new wt,color:new Zn,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new wt,color:new Zn,distance:0,decay:0};break;case"HemisphereLight":n={direction:new wt,skyColor:new Zn,groundColor:new Zn};break;case"RectAreaLight":n={color:new Zn,position:new wt,halfWidth:new wt,halfHeight:new wt};break}return t[e.id]=n,n}}}function _Se(){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 Kn};break;case"SpotLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Kn};break;case"PointLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Kn,shadowCameraNear:1,shadowCameraFar:1e3};break}return t[e.id]=n,n}}}let kSe=0;function NSe(t,e){return(e.castShadow?2:0)-(t.castShadow?2:0)+(e.map?1:0)-(t.map?1:0)}function CSe(t){const e=new SSe,n=_Se(),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 wt);const a=new wt,s=new oa,o=new oa;function l(d){let u=0,m=0,p=0;for(let A=0;A<9;A++)r.probe[A].set(0,0,0);let f=0,y=0,x=0,b=0,v=0,_=0,k=0,P=0,C=0,T=0,N=0;d.sort(NSe);for(let A=0,D=d.length;A<D;A++){const $=d[A],U=$.color,G=$.intensity,L=$.distance,te=$.shadow&&$.shadow.map?$.shadow.map.texture:null;if($.isAmbientLight)u+=U.r*G,m+=U.g*G,p+=U.b*G;else if($.isLightProbe){for(let re=0;re<9;re++)r.probe[re].addScaledVector($.sh.coefficients[re],G);N++}else if($.isDirectionalLight){const re=e.get($);if(re.color.copy($.color).multiplyScalar($.intensity),$.castShadow){const J=$.shadow,ue=n.get($);ue.shadowIntensity=J.intensity,ue.shadowBias=J.bias,ue.shadowNormalBias=J.normalBias,ue.shadowRadius=J.radius,ue.shadowMapSize=J.mapSize,r.directionalShadow[f]=ue,r.directionalShadowMap[f]=te,r.directionalShadowMatrix[f]=$.shadow.matrix,_++}r.directional[f]=re,f++}else if($.isSpotLight){const re=e.get($);re.position.setFromMatrixPosition($.matrixWorld),re.color.copy(U).multiplyScalar(G),re.distance=L,re.coneCos=Math.cos($.angle),re.penumbraCos=Math.cos($.angle*(1-$.penumbra)),re.decay=$.decay,r.spot[x]=re;const J=$.shadow;if($.map&&(r.spotLightMap[C]=$.map,C++,J.updateMatrices($),$.castShadow&&T++),r.spotLightMatrix[x]=J.matrix,$.castShadow){const ue=n.get($);ue.shadowIntensity=J.intensity,ue.shadowBias=J.bias,ue.shadowNormalBias=J.normalBias,ue.shadowRadius=J.radius,ue.shadowMapSize=J.mapSize,r.spotShadow[x]=ue,r.spotShadowMap[x]=te,P++}x++}else if($.isRectAreaLight){const re=e.get($);re.color.copy(U).multiplyScalar(G),re.halfWidth.set($.width*.5,0,0),re.halfHeight.set(0,$.height*.5,0),r.rectArea[b]=re,b++}else if($.isPointLight){const re=e.get($);if(re.color.copy($.color).multiplyScalar($.intensity),re.distance=$.distance,re.decay=$.decay,$.castShadow){const J=$.shadow,ue=n.get($);ue.shadowIntensity=J.intensity,ue.shadowBias=J.bias,ue.shadowNormalBias=J.normalBias,ue.shadowRadius=J.radius,ue.shadowMapSize=J.mapSize,ue.shadowCameraNear=J.camera.near,ue.shadowCameraFar=J.camera.far,r.pointShadow[y]=ue,r.pointShadowMap[y]=te,r.pointShadowMatrix[y]=$.shadow.matrix,k++}r.point[y]=re,y++}else if($.isHemisphereLight){const re=e.get($);re.skyColor.copy($.color).multiplyScalar(G),re.groundColor.copy($.groundColor).multiplyScalar(G),r.hemi[v]=re,v++}}b>0&&(t.has("OES_texture_float_linear")===!0?(r.rectAreaLTC1=Vt.LTC_FLOAT_1,r.rectAreaLTC2=Vt.LTC_FLOAT_2):(r.rectAreaLTC1=Vt.LTC_HALF_1,r.rectAreaLTC2=Vt.LTC_HALF_2)),r.ambient[0]=u,r.ambient[1]=m,r.ambient[2]=p;const R=r.hash;(R.directionalLength!==f||R.pointLength!==y||R.spotLength!==x||R.rectAreaLength!==b||R.hemiLength!==v||R.numDirectionalShadows!==_||R.numPointShadows!==k||R.numSpotShadows!==P||R.numSpotMaps!==C||R.numLightProbes!==N)&&(r.directional.length=f,r.spot.length=x,r.rectArea.length=b,r.point.length=y,r.hemi.length=v,r.directionalShadow.length=_,r.directionalShadowMap.length=_,r.pointShadow.length=k,r.pointShadowMap.length=k,r.spotShadow.length=P,r.spotShadowMap.length=P,r.directionalShadowMatrix.length=_,r.pointShadowMatrix.length=k,r.spotLightMatrix.length=P+C-T,r.spotLightMap.length=C,r.numSpotLightShadowsWithMaps=T,r.numLightProbes=N,R.directionalLength=f,R.pointLength=y,R.spotLength=x,R.rectAreaLength=b,R.hemiLength=v,R.numDirectionalShadows=_,R.numPointShadows=k,R.numSpotShadows=P,R.numSpotMaps=C,R.numLightProbes=N,r.version=kSe++)}function c(d,u){let m=0,p=0,f=0,y=0,x=0;const b=u.matrixWorldInverse;for(let v=0,_=d.length;v<_;v++){const k=d[v];if(k.isDirectionalLight){const P=r.directional[m];P.direction.setFromMatrixPosition(k.matrixWorld),a.setFromMatrixPosition(k.target.matrixWorld),P.direction.sub(a),P.direction.transformDirection(b),m++}else if(k.isSpotLight){const P=r.spot[f];P.position.setFromMatrixPosition(k.matrixWorld),P.position.applyMatrix4(b),P.direction.setFromMatrixPosition(k.matrixWorld),a.setFromMatrixPosition(k.target.matrixWorld),P.direction.sub(a),P.direction.transformDirection(b),f++}else if(k.isRectAreaLight){const P=r.rectArea[y];P.position.setFromMatrixPosition(k.matrixWorld),P.position.applyMatrix4(b),o.identity(),s.copy(k.matrixWorld),s.premultiply(b),o.extractRotation(s),P.halfWidth.set(k.width*.5,0,0),P.halfHeight.set(0,k.height*.5,0),P.halfWidth.applyMatrix4(o),P.halfHeight.applyMatrix4(o),y++}else if(k.isPointLight){const P=r.point[p];P.position.setFromMatrixPosition(k.matrixWorld),P.position.applyMatrix4(b),p++}else if(k.isHemisphereLight){const P=r.hemi[x];P.direction.setFromMatrixPosition(k.matrixWorld),P.direction.transformDirection(b),x++}}}return{setup:l,setupView:c,state:r}}function m6(t){const e=new CSe(t),n=[],r=[];function a(u){d.camera=u,n.length=0,r.length=0}function s(u){n.push(u)}function o(u){r.push(u)}function l(){e.setup(n)}function c(u){e.setupView(n,u)}const d={lightsArray:n,shadowsArray:r,camera:null,lights:e,transmissionRenderTarget:{}};return{init:a,state:d,setupLights:l,setupLightsView:c,pushLight:s,pushShadow:o}}function TSe(t){let e=new WeakMap;function n(a,s=0){const o=e.get(a);let l;return o===void 0?(l=new m6(t),e.set(a,[l])):s>=o.length?(l=new m6(t),o.push(l)):l=o[s],l}function r(){e=new WeakMap}return{get:n,dispose:r}}const PSe=`void main() {
- gl_Position = vec4( position, 1.0 );
- }`,ASe=`uniform sampler2D shadow_pass;
- uniform vec2 resolution;
- uniform float radius;
- #include <packing>
- void main() {
- const float samples = float( VSM_SAMPLES );
- float mean = 0.0;
- float squared_mean = 0.0;
- float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );
- float uvStart = samples <= 1.0 ? 0.0 : - 1.0;
- for ( float i = 0.0; i < samples; i ++ ) {
- float uvOffset = uvStart + i * uvStride;
- #ifdef HORIZONTAL_PASS
- vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );
- mean += distribution.x;
- squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;
- #else
- float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );
- mean += depth;
- squared_mean += depth * depth;
- #endif
- }
- mean = mean / samples;
- squared_mean = squared_mean / samples;
- float std_dev = sqrt( squared_mean - mean * mean );
- gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );
- }`;function MSe(t,e,n){let r=new pL;const a=new Kn,s=new Kn,o=new na,l=new Gxe({depthPacking:nxe}),c=new Wxe,d={},u=n.maxTextureSize,m={[ih]:ao,[ao]:ih,[Mc]:Mc},p=new mu({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Kn},radius:{value:4}},vertexShader:PSe,fragmentShader:ASe}),f=p.clone();f.defines.HORIZONTAL_PASS=1;const y=new _l;y.setAttribute("position",new Ls(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const x=new kl(y,p),b=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=uX;let v=this.type;this.render=function(T,N,R){if(b.enabled===!1||b.autoUpdate===!1&&b.needsUpdate===!1||T.length===0)return;const A=t.getRenderTarget(),D=t.getActiveCubeFace(),$=t.getActiveMipmapLevel(),U=t.state;U.setBlending(Zd),U.buffers.depth.getReversed()===!0?U.buffers.color.setClear(0,0,0,0):U.buffers.color.setClear(1,1,1,1),U.buffers.depth.setTest(!0),U.setScissorTest(!1);const G=v!==Ld&&this.type===Ld,L=v===Ld&&this.type!==Ld;for(let te=0,re=T.length;te<re;te++){const J=T[te],ue=J.shadow;if(ue===void 0){Mn("WebGLShadowMap:",J,"has no shadow.");continue}if(ue.autoUpdate===!1&&ue.needsUpdate===!1)continue;a.copy(ue.mapSize);const me=ue.getFrameExtents();if(a.multiply(me),s.copy(ue.mapSize),(a.x>u||a.y>u)&&(a.x>u&&(s.x=Math.floor(u/me.x),a.x=s.x*me.x,ue.mapSize.x=s.x),a.y>u&&(s.y=Math.floor(u/me.y),a.y=s.y*me.y,ue.mapSize.y=s.y)),ue.map===null||G===!0||L===!0){const X=this.type!==Ld?{minFilter:Do,magFilter:Do}:{};ue.map!==null&&ue.map.dispose(),ue.map=new Xp(a.x,a.y,X),ue.map.texture.name=J.name+".shadowMap",ue.camera.updateProjectionMatrix()}t.setRenderTarget(ue.map),t.clear();const ge=ue.getViewportCount();for(let X=0;X<ge;X++){const ie=ue.getViewport(X);o.set(s.x*ie.x,s.y*ie.y,s.x*ie.z,s.y*ie.w),U.viewport(o),ue.updateMatrices(J,X),r=ue.getFrustum(),P(N,R,ue.camera,J,this.type)}ue.isPointLightShadow!==!0&&this.type===Ld&&_(ue,R),ue.needsUpdate=!1}v=this.type,b.needsUpdate=!1,t.setRenderTarget(A,D,$)};function _(T,N){const R=e.update(x);p.defines.VSM_SAMPLES!==T.blurSamples&&(p.defines.VSM_SAMPLES=T.blurSamples,f.defines.VSM_SAMPLES=T.blurSamples,p.needsUpdate=!0,f.needsUpdate=!0),T.mapPass===null&&(T.mapPass=new Xp(a.x,a.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(N,null,R,p,x,null),f.uniforms.shadow_pass.value=T.mapPass.texture,f.uniforms.resolution.value=T.mapSize,f.uniforms.radius.value=T.radius,t.setRenderTarget(T.map),t.clear(),t.renderBufferDirect(N,null,R,f,x,null)}function k(T,N,R,A){let D=null;const $=R.isPointLight===!0?T.customDistanceMaterial:T.customDepthMaterial;if($!==void 0)D=$;else if(D=R.isPointLight===!0?c:l,t.localClippingEnabled&&N.clipShadows===!0&&Array.isArray(N.clippingPlanes)&&N.clippingPlanes.length!==0||N.displacementMap&&N.displacementScale!==0||N.alphaMap&&N.alphaTest>0||N.map&&N.alphaTest>0||N.alphaToCoverage===!0){const U=D.uuid,G=N.uuid;let L=d[U];L===void 0&&(L={},d[U]=L);let te=L[G];te===void 0&&(te=D.clone(),L[G]=te,N.addEventListener("dispose",C)),D=te}if(D.visible=N.visible,D.wireframe=N.wireframe,A===Ld?D.side=N.shadowSide!==null?N.shadowSide:N.side:D.side=N.shadowSide!==null?N.shadowSide:m[N.side],D.alphaMap=N.alphaMap,D.alphaTest=N.alphaToCoverage===!0?.5:N.alphaTest,D.map=N.map,D.clipShadows=N.clipShadows,D.clippingPlanes=N.clippingPlanes,D.clipIntersection=N.clipIntersection,D.displacementMap=N.displacementMap,D.displacementScale=N.displacementScale,D.displacementBias=N.displacementBias,D.wireframeLinewidth=N.wireframeLinewidth,D.linewidth=N.linewidth,R.isPointLight===!0&&D.isMeshDistanceMaterial===!0){const U=t.properties.get(D);U.light=R}return D}function P(T,N,R,A,D){if(T.visible===!1)return;if(T.layers.test(N.layers)&&(T.isMesh||T.isLine||T.isPoints)&&(T.castShadow||T.receiveShadow&&D===Ld)&&(!T.frustumCulled||r.intersectsObject(T))){T.modelViewMatrix.multiplyMatrices(R.matrixWorldInverse,T.matrixWorld);const G=e.update(T),L=T.material;if(Array.isArray(L)){const te=G.groups;for(let re=0,J=te.length;re<J;re++){const ue=te[re],me=L[ue.materialIndex];if(me&&me.visible){const ge=k(T,me,A,D);T.onBeforeShadow(t,T,N,R,G,ge,ue),t.renderBufferDirect(R,null,G,ge,T,ue),T.onAfterShadow(t,T,N,R,G,ge,ue)}}}else if(L.visible){const te=k(T,L,A,D);T.onBeforeShadow(t,T,N,R,G,te,null),t.renderBufferDirect(R,null,G,te,T,null),T.onAfterShadow(t,T,N,R,G,te,null)}}const U=T.children;for(let G=0,L=U.length;G<L;G++)P(U[G],N,R,A,D)}function C(T){T.target.removeEventListener("dispose",C);for(const R in d){const A=d[R],D=T.target.uuid;D in A&&(A[D].dispose(),delete A[D])}}}const ESe={[FD]:LD,[OD]:UD,[ID]:BD,[Db]:zD,[LD]:FD,[UD]:OD,[BD]:ID,[zD]:Db};function jSe(t,e){function n(){let xe=!1;const He=new na;let Pe=null;const Ve=new na(0,0,0,0);return{setMask:function(je){Pe!==je&&!xe&&(t.colorMask(je,je,je,je),Pe=je)},setLocked:function(je){xe=je},setClear:function(je,ye,$e,Ye,lt){lt===!0&&(je*=Ye,ye*=Ye,$e*=Ye),He.set(je,ye,$e,Ye),Ve.equals(He)===!1&&(t.clearColor(je,ye,$e,Ye),Ve.copy(He))},reset:function(){xe=!1,Pe=null,Ve.set(-1,0,0,0)}}}function r(){let xe=!1,He=!1,Pe=null,Ve=null,je=null;return{setReversed:function(ye){if(He!==ye){const $e=e.get("EXT_clip_control");ye?$e.clipControlEXT($e.LOWER_LEFT_EXT,$e.ZERO_TO_ONE_EXT):$e.clipControlEXT($e.LOWER_LEFT_EXT,$e.NEGATIVE_ONE_TO_ONE_EXT),He=ye;const Ye=je;je=null,this.setClear(Ye)}},getReversed:function(){return He},setTest:function(ye){ye?Z(t.DEPTH_TEST):j(t.DEPTH_TEST)},setMask:function(ye){Pe!==ye&&!xe&&(t.depthMask(ye),Pe=ye)},setFunc:function(ye){if(He&&(ye=ESe[ye]),Ve!==ye){switch(ye){case FD:t.depthFunc(t.NEVER);break;case LD:t.depthFunc(t.ALWAYS);break;case OD:t.depthFunc(t.LESS);break;case Db:t.depthFunc(t.LEQUAL);break;case ID:t.depthFunc(t.EQUAL);break;case zD:t.depthFunc(t.GEQUAL);break;case UD:t.depthFunc(t.GREATER);break;case BD:t.depthFunc(t.NOTEQUAL);break;default:t.depthFunc(t.LEQUAL)}Ve=ye}},setLocked:function(ye){xe=ye},setClear:function(ye){je!==ye&&(He&&(ye=1-ye),t.clearDepth(ye),je=ye)},reset:function(){xe=!1,Pe=null,Ve=null,je=null,He=!1}}}function a(){let xe=!1,He=null,Pe=null,Ve=null,je=null,ye=null,$e=null,Ye=null,lt=null;return{setTest:function(St){xe||(St?Z(t.STENCIL_TEST):j(t.STENCIL_TEST))},setMask:function(St){He!==St&&!xe&&(t.stencilMask(St),He=St)},setFunc:function(St,ot,ft){(Pe!==St||Ve!==ot||je!==ft)&&(t.stencilFunc(St,ot,ft),Pe=St,Ve=ot,je=ft)},setOp:function(St,ot,ft){(ye!==St||$e!==ot||Ye!==ft)&&(t.stencilOp(St,ot,ft),ye=St,$e=ot,Ye=ft)},setLocked:function(St){xe=St},setClear:function(St){lt!==St&&(t.clearStencil(St),lt=St)},reset:function(){xe=!1,He=null,Pe=null,Ve=null,je=null,ye=null,$e=null,Ye=null,lt=null}}}const s=new n,o=new r,l=new a,c=new WeakMap,d=new WeakMap;let u={},m={},p=new WeakMap,f=[],y=null,x=!1,b=null,v=null,_=null,k=null,P=null,C=null,T=null,N=new Zn(0,0,0),R=0,A=!1,D=null,$=null,U=null,G=null,L=null;const te=t.getParameter(t.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let re=!1,J=0;const ue=t.getParameter(t.VERSION);ue.indexOf("WebGL")!==-1?(J=parseFloat(/^WebGL (\d)/.exec(ue)[1]),re=J>=1):ue.indexOf("OpenGL ES")!==-1&&(J=parseFloat(/^OpenGL ES (\d)/.exec(ue)[1]),re=J>=2);let me=null,ge={};const X=t.getParameter(t.SCISSOR_BOX),ie=t.getParameter(t.VIEWPORT),le=new na().fromArray(X),pe=new na().fromArray(ie);function Ce(xe,He,Pe,Ve){const je=new Uint8Array(4),ye=t.createTexture();t.bindTexture(xe,ye),t.texParameteri(xe,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(xe,t.TEXTURE_MAG_FILTER,t.NEAREST);for(let $e=0;$e<Pe;$e++)xe===t.TEXTURE_3D||xe===t.TEXTURE_2D_ARRAY?t.texImage3D(He,0,t.RGBA,1,1,Ve,0,t.RGBA,t.UNSIGNED_BYTE,je):t.texImage2D(He+$e,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,je);return ye}const q={};q[t.TEXTURE_2D]=Ce(t.TEXTURE_2D,t.TEXTURE_2D,1),q[t.TEXTURE_CUBE_MAP]=Ce(t.TEXTURE_CUBE_MAP,t.TEXTURE_CUBE_MAP_POSITIVE_X,6),q[t.TEXTURE_2D_ARRAY]=Ce(t.TEXTURE_2D_ARRAY,t.TEXTURE_2D_ARRAY,1,1),q[t.TEXTURE_3D]=Ce(t.TEXTURE_3D,t.TEXTURE_3D,1,1),s.setClear(0,0,0,1),o.setClear(1),l.setClear(0),Z(t.DEPTH_TEST),o.setFunc(Db),ee(!1),K(c8),Z(t.CULL_FACE),z(Zd);function Z(xe){u[xe]!==!0&&(t.enable(xe),u[xe]=!0)}function j(xe){u[xe]!==!1&&(t.disable(xe),u[xe]=!1)}function E(xe,He){return m[xe]!==He?(t.bindFramebuffer(xe,He),m[xe]=He,xe===t.DRAW_FRAMEBUFFER&&(m[t.FRAMEBUFFER]=He),xe===t.FRAMEBUFFER&&(m[t.DRAW_FRAMEBUFFER]=He),!0):!1}function I(xe,He){let Pe=f,Ve=!1;if(xe){Pe=p.get(He),Pe===void 0&&(Pe=[],p.set(He,Pe));const je=xe.textures;if(Pe.length!==je.length||Pe[0]!==t.COLOR_ATTACHMENT0){for(let ye=0,$e=je.length;ye<$e;ye++)Pe[ye]=t.COLOR_ATTACHMENT0+ye;Pe.length=je.length,Ve=!0}}else Pe[0]!==t.BACK&&(Pe[0]=t.BACK,Ve=!0);Ve&&t.drawBuffers(Pe)}function W(xe){return y!==xe?(t.useProgram(xe),y=xe,!0):!1}const B={[sp]:t.FUNC_ADD,[Pbe]:t.FUNC_SUBTRACT,[Abe]:t.FUNC_REVERSE_SUBTRACT};B[Mbe]=t.MIN,B[Ebe]=t.MAX;const ae={[jbe]:t.ZERO,[Dbe]:t.ONE,[Rbe]:t.SRC_COLOR,[DD]:t.SRC_ALPHA,[Ube]:t.SRC_ALPHA_SATURATE,[Ibe]:t.DST_COLOR,[Lbe]:t.DST_ALPHA,[Fbe]:t.ONE_MINUS_SRC_COLOR,[RD]:t.ONE_MINUS_SRC_ALPHA,[zbe]:t.ONE_MINUS_DST_COLOR,[Obe]:t.ONE_MINUS_DST_ALPHA,[Bbe]:t.CONSTANT_COLOR,[Hbe]:t.ONE_MINUS_CONSTANT_COLOR,[$be]:t.CONSTANT_ALPHA,[qbe]:t.ONE_MINUS_CONSTANT_ALPHA};function z(xe,He,Pe,Ve,je,ye,$e,Ye,lt,St){if(xe===Zd){x===!0&&(j(t.BLEND),x=!1);return}if(x===!1&&(Z(t.BLEND),x=!0),xe!==Tbe){if(xe!==b||St!==A){if((v!==sp||P!==sp)&&(t.blendEquation(t.FUNC_ADD),v=sp,P=sp),St)switch(xe){case gb:t.blendFuncSeparate(t.ONE,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA);break;case d8:t.blendFunc(t.ONE,t.ONE);break;case u8:t.blendFuncSeparate(t.ZERO,t.ONE_MINUS_SRC_COLOR,t.ZERO,t.ONE);break;case m8:t.blendFuncSeparate(t.DST_COLOR,t.ONE_MINUS_SRC_ALPHA,t.ZERO,t.ONE);break;default:$i("WebGLState: Invalid blending: ",xe);break}else switch(xe){case gb:t.blendFuncSeparate(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA);break;case d8:t.blendFuncSeparate(t.SRC_ALPHA,t.ONE,t.ONE,t.ONE);break;case u8:$i("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case m8:$i("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:$i("WebGLState: Invalid blending: ",xe);break}_=null,k=null,C=null,T=null,N.set(0,0,0),R=0,b=xe,A=St}return}je=je||He,ye=ye||Pe,$e=$e||Ve,(He!==v||je!==P)&&(t.blendEquationSeparate(B[He],B[je]),v=He,P=je),(Pe!==_||Ve!==k||ye!==C||$e!==T)&&(t.blendFuncSeparate(ae[Pe],ae[Ve],ae[ye],ae[$e]),_=Pe,k=Ve,C=ye,T=$e),(Ye.equals(N)===!1||lt!==R)&&(t.blendColor(Ye.r,Ye.g,Ye.b,lt),N.copy(Ye),R=lt),b=xe,A=!1}function V(xe,He){xe.side===Mc?j(t.CULL_FACE):Z(t.CULL_FACE);let Pe=xe.side===ao;He&&(Pe=!Pe),ee(Pe),xe.blending===gb&&xe.transparent===!1?z(Zd):z(xe.blending,xe.blendEquation,xe.blendSrc,xe.blendDst,xe.blendEquationAlpha,xe.blendSrcAlpha,xe.blendDstAlpha,xe.blendColor,xe.blendAlpha,xe.premultipliedAlpha),o.setFunc(xe.depthFunc),o.setTest(xe.depthTest),o.setMask(xe.depthWrite),s.setMask(xe.colorWrite);const Ve=xe.stencilWrite;l.setTest(Ve),Ve&&(l.setMask(xe.stencilWriteMask),l.setFunc(xe.stencilFunc,xe.stencilRef,xe.stencilFuncMask),l.setOp(xe.stencilFail,xe.stencilZFail,xe.stencilZPass)),se(xe.polygonOffset,xe.polygonOffsetFactor,xe.polygonOffsetUnits),xe.alphaToCoverage===!0?Z(t.SAMPLE_ALPHA_TO_COVERAGE):j(t.SAMPLE_ALPHA_TO_COVERAGE)}function ee(xe){D!==xe&&(xe?t.frontFace(t.CW):t.frontFace(t.CCW),D=xe)}function K(xe){xe!==kbe?(Z(t.CULL_FACE),xe!==$&&(xe===c8?t.cullFace(t.BACK):xe===Nbe?t.cullFace(t.FRONT):t.cullFace(t.FRONT_AND_BACK))):j(t.CULL_FACE),$=xe}function ne(xe){xe!==U&&(re&&t.lineWidth(xe),U=xe)}function se(xe,He,Pe){xe?(Z(t.POLYGON_OFFSET_FILL),(G!==He||L!==Pe)&&(t.polygonOffset(He,Pe),G=He,L=Pe)):j(t.POLYGON_OFFSET_FILL)}function ce(xe){xe?Z(t.SCISSOR_TEST):j(t.SCISSOR_TEST)}function fe(xe){xe===void 0&&(xe=t.TEXTURE0+te-1),me!==xe&&(t.activeTexture(xe),me=xe)}function oe(xe,He,Pe){Pe===void 0&&(me===null?Pe=t.TEXTURE0+te-1:Pe=me);let Ve=ge[Pe];Ve===void 0&&(Ve={type:void 0,texture:void 0},ge[Pe]=Ve),(Ve.type!==xe||Ve.texture!==He)&&(me!==Pe&&(t.activeTexture(Pe),me=Pe),t.bindTexture(xe,He||q[xe]),Ve.type=xe,Ve.texture=He)}function O(){const xe=ge[me];xe!==void 0&&xe.type!==void 0&&(t.bindTexture(xe.type,null),xe.type=void 0,xe.texture=void 0)}function F(){try{t.compressedTexImage2D(...arguments)}catch(xe){xe("WebGLState:",xe)}}function Q(){try{t.compressedTexImage3D(...arguments)}catch(xe){xe("WebGLState:",xe)}}function ve(){try{t.texSubImage2D(...arguments)}catch(xe){xe("WebGLState:",xe)}}function he(){try{t.texSubImage3D(...arguments)}catch(xe){xe("WebGLState:",xe)}}function de(){try{t.compressedTexSubImage2D(...arguments)}catch(xe){xe("WebGLState:",xe)}}function Ae(){try{t.compressedTexSubImage3D(...arguments)}catch(xe){xe("WebGLState:",xe)}}function _e(){try{t.texStorage2D(...arguments)}catch(xe){xe("WebGLState:",xe)}}function ze(){try{t.texStorage3D(...arguments)}catch(xe){xe("WebGLState:",xe)}}function Be(){try{t.texImage2D(...arguments)}catch(xe){xe("WebGLState:",xe)}}function Ue(){try{t.texImage3D(...arguments)}catch(xe){xe("WebGLState:",xe)}}function Ne(xe){le.equals(xe)===!1&&(t.scissor(xe.x,xe.y,xe.z,xe.w),le.copy(xe))}function Ee(xe){pe.equals(xe)===!1&&(t.viewport(xe.x,xe.y,xe.z,xe.w),pe.copy(xe))}function ke(xe,He){let Pe=d.get(He);Pe===void 0&&(Pe=new WeakMap,d.set(He,Pe));let Ve=Pe.get(xe);Ve===void 0&&(Ve=t.getUniformBlockIndex(He,xe.name),Pe.set(xe,Ve))}function Me(xe,He){const Ve=d.get(He).get(xe);c.get(He)!==Ve&&(t.uniformBlockBinding(He,Ve,xe.__bindingPointIndex),c.set(He,Ve))}function Ge(){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),o.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),u={},me=null,ge={},m={},p=new WeakMap,f=[],y=null,x=!1,b=null,v=null,_=null,k=null,P=null,C=null,T=null,N=new Zn(0,0,0),R=0,A=!1,D=null,$=null,U=null,G=null,L=null,le.set(0,0,t.canvas.width,t.canvas.height),pe.set(0,0,t.canvas.width,t.canvas.height),s.reset(),o.reset(),l.reset()}return{buffers:{color:s,depth:o,stencil:l},enable:Z,disable:j,bindFramebuffer:E,drawBuffers:I,useProgram:W,setBlending:z,setMaterial:V,setFlipSided:ee,setCullFace:K,setLineWidth:ne,setPolygonOffset:se,setScissorTest:ce,activeTexture:fe,bindTexture:oe,unbindTexture:O,compressedTexImage2D:F,compressedTexImage3D:Q,texImage2D:Be,texImage3D:Ue,updateUBOMapping:ke,uniformBlockBinding:Me,texStorage2D:_e,texStorage3D:ze,texSubImage2D:ve,texSubImage3D:he,compressedTexSubImage2D:de,compressedTexSubImage3D:Ae,scissor:Ne,viewport:Ee,reset:Ge}}function DSe(t,e,n,r,a,s,o){const l=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,c=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),d=new Kn,u=new WeakMap;let m;const p=new WeakMap;let f=!1;try{f=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function y(O,F){return f?new OffscreenCanvas(O,F):Q1("canvas")}function x(O,F,Q){let ve=1;const he=oe(O);if((he.width>Q||he.height>Q)&&(ve=Q/Math.max(he.width,he.height)),ve<1)if(typeof HTMLImageElement<"u"&&O instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&O instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&O instanceof ImageBitmap||typeof VideoFrame<"u"&&O instanceof VideoFrame){const de=Math.floor(ve*he.width),Ae=Math.floor(ve*he.height);m===void 0&&(m=y(de,Ae));const _e=F?y(de,Ae):m;return _e.width=de,_e.height=Ae,_e.getContext("2d").drawImage(O,0,0,de,Ae),Mn("WebGLRenderer: Texture has been resized from ("+he.width+"x"+he.height+") to ("+de+"x"+Ae+")."),_e}else return"data"in O&&Mn("WebGLRenderer: Image in DataTexture is too big ("+he.width+"x"+he.height+")."),O;return O}function b(O){return O.generateMipmaps}function v(O){t.generateMipmap(O)}function _(O){return O.isWebGLCubeRenderTarget?t.TEXTURE_CUBE_MAP:O.isWebGL3DRenderTarget?t.TEXTURE_3D:O.isWebGLArrayRenderTarget||O.isCompressedArrayTexture?t.TEXTURE_2D_ARRAY:t.TEXTURE_2D}function k(O,F,Q,ve,he=!1){if(O!==null){if(t[O]!==void 0)return t[O];Mn("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+O+"'")}let de=F;if(F===t.RED&&(Q===t.FLOAT&&(de=t.R32F),Q===t.HALF_FLOAT&&(de=t.R16F),Q===t.UNSIGNED_BYTE&&(de=t.R8)),F===t.RED_INTEGER&&(Q===t.UNSIGNED_BYTE&&(de=t.R8UI),Q===t.UNSIGNED_SHORT&&(de=t.R16UI),Q===t.UNSIGNED_INT&&(de=t.R32UI),Q===t.BYTE&&(de=t.R8I),Q===t.SHORT&&(de=t.R16I),Q===t.INT&&(de=t.R32I)),F===t.RG&&(Q===t.FLOAT&&(de=t.RG32F),Q===t.HALF_FLOAT&&(de=t.RG16F),Q===t.UNSIGNED_BYTE&&(de=t.RG8)),F===t.RG_INTEGER&&(Q===t.UNSIGNED_BYTE&&(de=t.RG8UI),Q===t.UNSIGNED_SHORT&&(de=t.RG16UI),Q===t.UNSIGNED_INT&&(de=t.RG32UI),Q===t.BYTE&&(de=t.RG8I),Q===t.SHORT&&(de=t.RG16I),Q===t.INT&&(de=t.RG32I)),F===t.RGB_INTEGER&&(Q===t.UNSIGNED_BYTE&&(de=t.RGB8UI),Q===t.UNSIGNED_SHORT&&(de=t.RGB16UI),Q===t.UNSIGNED_INT&&(de=t.RGB32UI),Q===t.BYTE&&(de=t.RGB8I),Q===t.SHORT&&(de=t.RGB16I),Q===t.INT&&(de=t.RGB32I)),F===t.RGBA_INTEGER&&(Q===t.UNSIGNED_BYTE&&(de=t.RGBA8UI),Q===t.UNSIGNED_SHORT&&(de=t.RGBA16UI),Q===t.UNSIGNED_INT&&(de=t.RGBA32UI),Q===t.BYTE&&(de=t.RGBA8I),Q===t.SHORT&&(de=t.RGBA16I),Q===t.INT&&(de=t.RGBA32I)),F===t.RGB&&(Q===t.UNSIGNED_INT_5_9_9_9_REV&&(de=t.RGB9_E5),Q===t.UNSIGNED_INT_10F_11F_11F_REV&&(de=t.R11F_G11F_B10F)),F===t.RGBA){const Ae=he?Y1:xr.getTransfer(ve);Q===t.FLOAT&&(de=t.RGBA32F),Q===t.HALF_FLOAT&&(de=t.RGBA16F),Q===t.UNSIGNED_BYTE&&(de=Ae===Ur?t.SRGB8_ALPHA8:t.RGBA8),Q===t.UNSIGNED_SHORT_4_4_4_4&&(de=t.RGBA4),Q===t.UNSIGNED_SHORT_5_5_5_1&&(de=t.RGB5_A1)}return(de===t.R16F||de===t.R32F||de===t.RG16F||de===t.RG32F||de===t.RGBA16F||de===t.RGBA32F)&&e.get("EXT_color_buffer_float"),de}function P(O,F){let Q;return O?F===null||F===Kp||F===Hv?Q=t.DEPTH24_STENCIL8:F===Gd?Q=t.DEPTH32F_STENCIL8:F===Bv&&(Q=t.DEPTH24_STENCIL8,Mn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):F===null||F===Kp||F===Hv?Q=t.DEPTH_COMPONENT24:F===Gd?Q=t.DEPTH_COMPONENT32F:F===Bv&&(Q=t.DEPTH_COMPONENT16),Q}function C(O,F){return b(O)===!0||O.isFramebufferTexture&&O.minFilter!==Do&&O.minFilter!==hl?Math.log2(Math.max(F.width,F.height))+1:O.mipmaps!==void 0&&O.mipmaps.length>0?O.mipmaps.length:O.isCompressedTexture&&Array.isArray(O.image)?F.mipmaps.length:1}function T(O){const F=O.target;F.removeEventListener("dispose",T),R(F),F.isVideoTexture&&u.delete(F)}function N(O){const F=O.target;F.removeEventListener("dispose",N),D(F)}function R(O){const F=r.get(O);if(F.__webglInit===void 0)return;const Q=O.source,ve=p.get(Q);if(ve){const he=ve[F.__cacheKey];he.usedTimes--,he.usedTimes===0&&A(O),Object.keys(ve).length===0&&p.delete(Q)}r.remove(O)}function A(O){const F=r.get(O);t.deleteTexture(F.__webglTexture);const Q=O.source,ve=p.get(Q);delete ve[F.__cacheKey],o.memory.textures--}function D(O){const F=r.get(O);if(O.depthTexture&&(O.depthTexture.dispose(),r.remove(O.depthTexture)),O.isWebGLCubeRenderTarget)for(let ve=0;ve<6;ve++){if(Array.isArray(F.__webglFramebuffer[ve]))for(let he=0;he<F.__webglFramebuffer[ve].length;he++)t.deleteFramebuffer(F.__webglFramebuffer[ve][he]);else t.deleteFramebuffer(F.__webglFramebuffer[ve]);F.__webglDepthbuffer&&t.deleteRenderbuffer(F.__webglDepthbuffer[ve])}else{if(Array.isArray(F.__webglFramebuffer))for(let ve=0;ve<F.__webglFramebuffer.length;ve++)t.deleteFramebuffer(F.__webglFramebuffer[ve]);else t.deleteFramebuffer(F.__webglFramebuffer);if(F.__webglDepthbuffer&&t.deleteRenderbuffer(F.__webglDepthbuffer),F.__webglMultisampledFramebuffer&&t.deleteFramebuffer(F.__webglMultisampledFramebuffer),F.__webglColorRenderbuffer)for(let ve=0;ve<F.__webglColorRenderbuffer.length;ve++)F.__webglColorRenderbuffer[ve]&&t.deleteRenderbuffer(F.__webglColorRenderbuffer[ve]);F.__webglDepthRenderbuffer&&t.deleteRenderbuffer(F.__webglDepthRenderbuffer)}const Q=O.textures;for(let ve=0,he=Q.length;ve<he;ve++){const de=r.get(Q[ve]);de.__webglTexture&&(t.deleteTexture(de.__webglTexture),o.memory.textures--),r.remove(Q[ve])}r.remove(O)}let $=0;function U(){$=0}function G(){const O=$;return O>=a.maxTextures&&Mn("WebGLTextures: Trying to use "+O+" texture units while this GPU supports only "+a.maxTextures),$+=1,O}function L(O){const F=[];return F.push(O.wrapS),F.push(O.wrapT),F.push(O.wrapR||0),F.push(O.magFilter),F.push(O.minFilter),F.push(O.anisotropy),F.push(O.internalFormat),F.push(O.format),F.push(O.type),F.push(O.generateMipmaps),F.push(O.premultiplyAlpha),F.push(O.flipY),F.push(O.unpackAlignment),F.push(O.colorSpace),F.join()}function te(O,F){const Q=r.get(O);if(O.isVideoTexture&&ce(O),O.isRenderTargetTexture===!1&&O.isExternalTexture!==!0&&O.version>0&&Q.__version!==O.version){const ve=O.image;if(ve===null)Mn("WebGLRenderer: Texture marked for update but no image data found.");else if(ve.complete===!1)Mn("WebGLRenderer: Texture marked for update but image is incomplete");else{q(Q,O,F);return}}else O.isExternalTexture&&(Q.__webglTexture=O.sourceTexture?O.sourceTexture:null);n.bindTexture(t.TEXTURE_2D,Q.__webglTexture,t.TEXTURE0+F)}function re(O,F){const Q=r.get(O);if(O.isRenderTargetTexture===!1&&O.version>0&&Q.__version!==O.version){q(Q,O,F);return}else O.isExternalTexture&&(Q.__webglTexture=O.sourceTexture?O.sourceTexture:null);n.bindTexture(t.TEXTURE_2D_ARRAY,Q.__webglTexture,t.TEXTURE0+F)}function J(O,F){const Q=r.get(O);if(O.isRenderTargetTexture===!1&&O.version>0&&Q.__version!==O.version){q(Q,O,F);return}n.bindTexture(t.TEXTURE_3D,Q.__webglTexture,t.TEXTURE0+F)}function ue(O,F){const Q=r.get(O);if(O.version>0&&Q.__version!==O.version){Z(Q,O,F);return}n.bindTexture(t.TEXTURE_CUBE_MAP,Q.__webglTexture,t.TEXTURE0+F)}const me={[qD]:t.REPEAT,[Vd]:t.CLAMP_TO_EDGE,[VD]:t.MIRRORED_REPEAT},ge={[Do]:t.NEAREST,[exe]:t.NEAREST_MIPMAP_NEAREST,[kS]:t.NEAREST_MIPMAP_LINEAR,[hl]:t.LINEAR,[sM]:t.LINEAR_MIPMAP_NEAREST,[hp]:t.LINEAR_MIPMAP_LINEAR},X={[ixe]:t.NEVER,[dxe]:t.ALWAYS,[axe]:t.LESS,[wX]:t.LEQUAL,[sxe]:t.EQUAL,[cxe]:t.GEQUAL,[oxe]:t.GREATER,[lxe]:t.NOTEQUAL};function ie(O,F){if(F.type===Gd&&e.has("OES_texture_float_linear")===!1&&(F.magFilter===hl||F.magFilter===sM||F.magFilter===kS||F.magFilter===hp||F.minFilter===hl||F.minFilter===sM||F.minFilter===kS||F.minFilter===hp)&&Mn("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),t.texParameteri(O,t.TEXTURE_WRAP_S,me[F.wrapS]),t.texParameteri(O,t.TEXTURE_WRAP_T,me[F.wrapT]),(O===t.TEXTURE_3D||O===t.TEXTURE_2D_ARRAY)&&t.texParameteri(O,t.TEXTURE_WRAP_R,me[F.wrapR]),t.texParameteri(O,t.TEXTURE_MAG_FILTER,ge[F.magFilter]),t.texParameteri(O,t.TEXTURE_MIN_FILTER,ge[F.minFilter]),F.compareFunction&&(t.texParameteri(O,t.TEXTURE_COMPARE_MODE,t.COMPARE_REF_TO_TEXTURE),t.texParameteri(O,t.TEXTURE_COMPARE_FUNC,X[F.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(F.magFilter===Do||F.minFilter!==kS&&F.minFilter!==hp||F.type===Gd&&e.has("OES_texture_float_linear")===!1)return;if(F.anisotropy>1||r.get(F).__currentAnisotropy){const Q=e.get("EXT_texture_filter_anisotropic");t.texParameterf(O,Q.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(F.anisotropy,a.getMaxAnisotropy())),r.get(F).__currentAnisotropy=F.anisotropy}}}function le(O,F){let Q=!1;O.__webglInit===void 0&&(O.__webglInit=!0,F.addEventListener("dispose",T));const ve=F.source;let he=p.get(ve);he===void 0&&(he={},p.set(ve,he));const de=L(F);if(de!==O.__cacheKey){he[de]===void 0&&(he[de]={texture:t.createTexture(),usedTimes:0},o.memory.textures++,Q=!0),he[de].usedTimes++;const Ae=he[O.__cacheKey];Ae!==void 0&&(he[O.__cacheKey].usedTimes--,Ae.usedTimes===0&&A(F)),O.__cacheKey=de,O.__webglTexture=he[de].texture}return Q}function pe(O,F,Q){return Math.floor(Math.floor(O/Q)/F)}function Ce(O,F,Q,ve){const de=O.updateRanges;if(de.length===0)n.texSubImage2D(t.TEXTURE_2D,0,0,0,F.width,F.height,Q,ve,F.data);else{de.sort((Ue,Ne)=>Ue.start-Ne.start);let Ae=0;for(let Ue=1;Ue<de.length;Ue++){const Ne=de[Ae],Ee=de[Ue],ke=Ne.start+Ne.count,Me=pe(Ee.start,F.width,4),Ge=pe(Ne.start,F.width,4);Ee.start<=ke+1&&Me===Ge&&pe(Ee.start+Ee.count-1,F.width,4)===Me?Ne.count=Math.max(Ne.count,Ee.start+Ee.count-Ne.start):(++Ae,de[Ae]=Ee)}de.length=Ae+1;const _e=t.getParameter(t.UNPACK_ROW_LENGTH),ze=t.getParameter(t.UNPACK_SKIP_PIXELS),Be=t.getParameter(t.UNPACK_SKIP_ROWS);t.pixelStorei(t.UNPACK_ROW_LENGTH,F.width);for(let Ue=0,Ne=de.length;Ue<Ne;Ue++){const Ee=de[Ue],ke=Math.floor(Ee.start/4),Me=Math.ceil(Ee.count/4),Ge=ke%F.width,xe=Math.floor(ke/F.width),He=Me,Pe=1;t.pixelStorei(t.UNPACK_SKIP_PIXELS,Ge),t.pixelStorei(t.UNPACK_SKIP_ROWS,xe),n.texSubImage2D(t.TEXTURE_2D,0,Ge,xe,He,Pe,Q,ve,F.data)}O.clearUpdateRanges(),t.pixelStorei(t.UNPACK_ROW_LENGTH,_e),t.pixelStorei(t.UNPACK_SKIP_PIXELS,ze),t.pixelStorei(t.UNPACK_SKIP_ROWS,Be)}}function q(O,F,Q){let ve=t.TEXTURE_2D;(F.isDataArrayTexture||F.isCompressedArrayTexture)&&(ve=t.TEXTURE_2D_ARRAY),F.isData3DTexture&&(ve=t.TEXTURE_3D);const he=le(O,F),de=F.source;n.bindTexture(ve,O.__webglTexture,t.TEXTURE0+Q);const Ae=r.get(de);if(de.version!==Ae.__version||he===!0){n.activeTexture(t.TEXTURE0+Q);const _e=xr.getPrimaries(xr.workingColorSpace),ze=F.colorSpace===_m?null:xr.getPrimaries(F.colorSpace),Be=F.colorSpace===_m||_e===ze?t.NONE:t.BROWSER_DEFAULT_WEBGL;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,F.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,F.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,F.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,Be);let Ue=x(F.image,!1,a.maxTextureSize);Ue=fe(F,Ue);const Ne=s.convert(F.format,F.colorSpace),Ee=s.convert(F.type);let ke=k(F.internalFormat,Ne,Ee,F.colorSpace,F.isVideoTexture);ie(ve,F);let Me;const Ge=F.mipmaps,xe=F.isVideoTexture!==!0,He=Ae.__version===void 0||he===!0,Pe=de.dataReady,Ve=C(F,Ue);if(F.isDepthTexture)ke=P(F.format===qv,F.type),He&&(xe?n.texStorage2D(t.TEXTURE_2D,1,ke,Ue.width,Ue.height):n.texImage2D(t.TEXTURE_2D,0,ke,Ue.width,Ue.height,0,Ne,Ee,null));else if(F.isDataTexture)if(Ge.length>0){xe&&He&&n.texStorage2D(t.TEXTURE_2D,Ve,ke,Ge[0].width,Ge[0].height);for(let je=0,ye=Ge.length;je<ye;je++)Me=Ge[je],xe?Pe&&n.texSubImage2D(t.TEXTURE_2D,je,0,0,Me.width,Me.height,Ne,Ee,Me.data):n.texImage2D(t.TEXTURE_2D,je,ke,Me.width,Me.height,0,Ne,Ee,Me.data);F.generateMipmaps=!1}else xe?(He&&n.texStorage2D(t.TEXTURE_2D,Ve,ke,Ue.width,Ue.height),Pe&&Ce(F,Ue,Ne,Ee)):n.texImage2D(t.TEXTURE_2D,0,ke,Ue.width,Ue.height,0,Ne,Ee,Ue.data);else if(F.isCompressedTexture)if(F.isCompressedArrayTexture){xe&&He&&n.texStorage3D(t.TEXTURE_2D_ARRAY,Ve,ke,Ge[0].width,Ge[0].height,Ue.depth);for(let je=0,ye=Ge.length;je<ye;je++)if(Me=Ge[je],F.format!==Xl)if(Ne!==null)if(xe){if(Pe)if(F.layerUpdates.size>0){const $e=$8(Me.width,Me.height,F.format,F.type);for(const Ye of F.layerUpdates){const lt=Me.data.subarray(Ye*$e/Me.data.BYTES_PER_ELEMENT,(Ye+1)*$e/Me.data.BYTES_PER_ELEMENT);n.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,je,0,0,Ye,Me.width,Me.height,1,Ne,lt)}F.clearLayerUpdates()}else n.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,je,0,0,0,Me.width,Me.height,Ue.depth,Ne,Me.data)}else n.compressedTexImage3D(t.TEXTURE_2D_ARRAY,je,ke,Me.width,Me.height,Ue.depth,0,Me.data,0,0);else Mn("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else xe?Pe&&n.texSubImage3D(t.TEXTURE_2D_ARRAY,je,0,0,0,Me.width,Me.height,Ue.depth,Ne,Ee,Me.data):n.texImage3D(t.TEXTURE_2D_ARRAY,je,ke,Me.width,Me.height,Ue.depth,0,Ne,Ee,Me.data)}else{xe&&He&&n.texStorage2D(t.TEXTURE_2D,Ve,ke,Ge[0].width,Ge[0].height);for(let je=0,ye=Ge.length;je<ye;je++)Me=Ge[je],F.format!==Xl?Ne!==null?xe?Pe&&n.compressedTexSubImage2D(t.TEXTURE_2D,je,0,0,Me.width,Me.height,Ne,Me.data):n.compressedTexImage2D(t.TEXTURE_2D,je,ke,Me.width,Me.height,0,Me.data):Mn("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):xe?Pe&&n.texSubImage2D(t.TEXTURE_2D,je,0,0,Me.width,Me.height,Ne,Ee,Me.data):n.texImage2D(t.TEXTURE_2D,je,ke,Me.width,Me.height,0,Ne,Ee,Me.data)}else if(F.isDataArrayTexture)if(xe){if(He&&n.texStorage3D(t.TEXTURE_2D_ARRAY,Ve,ke,Ue.width,Ue.height,Ue.depth),Pe)if(F.layerUpdates.size>0){const je=$8(Ue.width,Ue.height,F.format,F.type);for(const ye of F.layerUpdates){const $e=Ue.data.subarray(ye*je/Ue.data.BYTES_PER_ELEMENT,(ye+1)*je/Ue.data.BYTES_PER_ELEMENT);n.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,ye,Ue.width,Ue.height,1,Ne,Ee,$e)}F.clearLayerUpdates()}else n.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,0,Ue.width,Ue.height,Ue.depth,Ne,Ee,Ue.data)}else n.texImage3D(t.TEXTURE_2D_ARRAY,0,ke,Ue.width,Ue.height,Ue.depth,0,Ne,Ee,Ue.data);else if(F.isData3DTexture)xe?(He&&n.texStorage3D(t.TEXTURE_3D,Ve,ke,Ue.width,Ue.height,Ue.depth),Pe&&n.texSubImage3D(t.TEXTURE_3D,0,0,0,0,Ue.width,Ue.height,Ue.depth,Ne,Ee,Ue.data)):n.texImage3D(t.TEXTURE_3D,0,ke,Ue.width,Ue.height,Ue.depth,0,Ne,Ee,Ue.data);else if(F.isFramebufferTexture){if(He)if(xe)n.texStorage2D(t.TEXTURE_2D,Ve,ke,Ue.width,Ue.height);else{let je=Ue.width,ye=Ue.height;for(let $e=0;$e<Ve;$e++)n.texImage2D(t.TEXTURE_2D,$e,ke,je,ye,0,Ne,Ee,null),je>>=1,ye>>=1}}else if(Ge.length>0){if(xe&&He){const je=oe(Ge[0]);n.texStorage2D(t.TEXTURE_2D,Ve,ke,je.width,je.height)}for(let je=0,ye=Ge.length;je<ye;je++)Me=Ge[je],xe?Pe&&n.texSubImage2D(t.TEXTURE_2D,je,0,0,Ne,Ee,Me):n.texImage2D(t.TEXTURE_2D,je,ke,Ne,Ee,Me);F.generateMipmaps=!1}else if(xe){if(He){const je=oe(Ue);n.texStorage2D(t.TEXTURE_2D,Ve,ke,je.width,je.height)}Pe&&n.texSubImage2D(t.TEXTURE_2D,0,0,0,Ne,Ee,Ue)}else n.texImage2D(t.TEXTURE_2D,0,ke,Ne,Ee,Ue);b(F)&&v(ve),Ae.__version=de.version,F.onUpdate&&F.onUpdate(F)}O.__version=F.version}function Z(O,F,Q){if(F.image.length!==6)return;const ve=le(O,F),he=F.source;n.bindTexture(t.TEXTURE_CUBE_MAP,O.__webglTexture,t.TEXTURE0+Q);const de=r.get(he);if(he.version!==de.__version||ve===!0){n.activeTexture(t.TEXTURE0+Q);const Ae=xr.getPrimaries(xr.workingColorSpace),_e=F.colorSpace===_m?null:xr.getPrimaries(F.colorSpace),ze=F.colorSpace===_m||Ae===_e?t.NONE:t.BROWSER_DEFAULT_WEBGL;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,F.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,F.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,F.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,ze);const Be=F.isCompressedTexture||F.image[0].isCompressedTexture,Ue=F.image[0]&&F.image[0].isDataTexture,Ne=[];for(let ye=0;ye<6;ye++)!Be&&!Ue?Ne[ye]=x(F.image[ye],!0,a.maxCubemapSize):Ne[ye]=Ue?F.image[ye].image:F.image[ye],Ne[ye]=fe(F,Ne[ye]);const Ee=Ne[0],ke=s.convert(F.format,F.colorSpace),Me=s.convert(F.type),Ge=k(F.internalFormat,ke,Me,F.colorSpace),xe=F.isVideoTexture!==!0,He=de.__version===void 0||ve===!0,Pe=he.dataReady;let Ve=C(F,Ee);ie(t.TEXTURE_CUBE_MAP,F);let je;if(Be){xe&&He&&n.texStorage2D(t.TEXTURE_CUBE_MAP,Ve,Ge,Ee.width,Ee.height);for(let ye=0;ye<6;ye++){je=Ne[ye].mipmaps;for(let $e=0;$e<je.length;$e++){const Ye=je[$e];F.format!==Xl?ke!==null?xe?Pe&&n.compressedTexSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ye,$e,0,0,Ye.width,Ye.height,ke,Ye.data):n.compressedTexImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ye,$e,Ge,Ye.width,Ye.height,0,Ye.data):Mn("WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):xe?Pe&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ye,$e,0,0,Ye.width,Ye.height,ke,Me,Ye.data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ye,$e,Ge,Ye.width,Ye.height,0,ke,Me,Ye.data)}}}else{if(je=F.mipmaps,xe&&He){je.length>0&&Ve++;const ye=oe(Ne[0]);n.texStorage2D(t.TEXTURE_CUBE_MAP,Ve,Ge,ye.width,ye.height)}for(let ye=0;ye<6;ye++)if(Ue){xe?Pe&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ye,0,0,0,Ne[ye].width,Ne[ye].height,ke,Me,Ne[ye].data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ye,0,Ge,Ne[ye].width,Ne[ye].height,0,ke,Me,Ne[ye].data);for(let $e=0;$e<je.length;$e++){const lt=je[$e].image[ye].image;xe?Pe&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ye,$e+1,0,0,lt.width,lt.height,ke,Me,lt.data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ye,$e+1,Ge,lt.width,lt.height,0,ke,Me,lt.data)}}else{xe?Pe&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ye,0,0,0,ke,Me,Ne[ye]):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ye,0,Ge,ke,Me,Ne[ye]);for(let $e=0;$e<je.length;$e++){const Ye=je[$e];xe?Pe&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ye,$e+1,0,0,ke,Me,Ye.image[ye]):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ye,$e+1,Ge,ke,Me,Ye.image[ye])}}}b(F)&&v(t.TEXTURE_CUBE_MAP),de.__version=he.version,F.onUpdate&&F.onUpdate(F)}O.__version=F.version}function j(O,F,Q,ve,he,de){const Ae=s.convert(Q.format,Q.colorSpace),_e=s.convert(Q.type),ze=k(Q.internalFormat,Ae,_e,Q.colorSpace),Be=r.get(F),Ue=r.get(Q);if(Ue.__renderTarget=F,!Be.__hasExternalTextures){const Ne=Math.max(1,F.width>>de),Ee=Math.max(1,F.height>>de);he===t.TEXTURE_3D||he===t.TEXTURE_2D_ARRAY?n.texImage3D(he,de,ze,Ne,Ee,F.depth,0,Ae,_e,null):n.texImage2D(he,de,ze,Ne,Ee,0,Ae,_e,null)}n.bindFramebuffer(t.FRAMEBUFFER,O),se(F)?l.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,ve,he,Ue.__webglTexture,0,ne(F)):(he===t.TEXTURE_2D||he>=t.TEXTURE_CUBE_MAP_POSITIVE_X&&he<=t.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&t.framebufferTexture2D(t.FRAMEBUFFER,ve,he,Ue.__webglTexture,de),n.bindFramebuffer(t.FRAMEBUFFER,null)}function E(O,F,Q){if(t.bindRenderbuffer(t.RENDERBUFFER,O),F.depthBuffer){const ve=F.depthTexture,he=ve&&ve.isDepthTexture?ve.type:null,de=P(F.stencilBuffer,he),Ae=F.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,_e=ne(F);se(F)?l.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,_e,de,F.width,F.height):Q?t.renderbufferStorageMultisample(t.RENDERBUFFER,_e,de,F.width,F.height):t.renderbufferStorage(t.RENDERBUFFER,de,F.width,F.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,Ae,t.RENDERBUFFER,O)}else{const ve=F.textures;for(let he=0;he<ve.length;he++){const de=ve[he],Ae=s.convert(de.format,de.colorSpace),_e=s.convert(de.type),ze=k(de.internalFormat,Ae,_e,de.colorSpace),Be=ne(F);Q&&se(F)===!1?t.renderbufferStorageMultisample(t.RENDERBUFFER,Be,ze,F.width,F.height):se(F)?l.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,Be,ze,F.width,F.height):t.renderbufferStorage(t.RENDERBUFFER,ze,F.width,F.height)}}t.bindRenderbuffer(t.RENDERBUFFER,null)}function I(O,F){if(F&&F.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(n.bindFramebuffer(t.FRAMEBUFFER,O),!(F.depthTexture&&F.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");const ve=r.get(F.depthTexture);ve.__renderTarget=F,(!ve.__webglTexture||F.depthTexture.image.width!==F.width||F.depthTexture.image.height!==F.height)&&(F.depthTexture.image.width=F.width,F.depthTexture.image.height=F.height,F.depthTexture.needsUpdate=!0),te(F.depthTexture,0);const he=ve.__webglTexture,de=ne(F);if(F.depthTexture.format===$v)se(F)?l.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.TEXTURE_2D,he,0,de):t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.TEXTURE_2D,he,0);else if(F.depthTexture.format===qv)se(F)?l.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.TEXTURE_2D,he,0,de):t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.TEXTURE_2D,he,0);else throw new Error("Unknown depthTexture format")}function W(O){const F=r.get(O),Q=O.isWebGLCubeRenderTarget===!0;if(F.__boundDepthTexture!==O.depthTexture){const ve=O.depthTexture;if(F.__depthDisposeCallback&&F.__depthDisposeCallback(),ve){const he=()=>{delete F.__boundDepthTexture,delete F.__depthDisposeCallback,ve.removeEventListener("dispose",he)};ve.addEventListener("dispose",he),F.__depthDisposeCallback=he}F.__boundDepthTexture=ve}if(O.depthTexture&&!F.__autoAllocateDepthBuffer){if(Q)throw new Error("target.depthTexture not supported in Cube render targets");const ve=O.texture.mipmaps;ve&&ve.length>0?I(F.__webglFramebuffer[0],O):I(F.__webglFramebuffer,O)}else if(Q){F.__webglDepthbuffer=[];for(let ve=0;ve<6;ve++)if(n.bindFramebuffer(t.FRAMEBUFFER,F.__webglFramebuffer[ve]),F.__webglDepthbuffer[ve]===void 0)F.__webglDepthbuffer[ve]=t.createRenderbuffer(),E(F.__webglDepthbuffer[ve],O,!1);else{const he=O.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,de=F.__webglDepthbuffer[ve];t.bindRenderbuffer(t.RENDERBUFFER,de),t.framebufferRenderbuffer(t.FRAMEBUFFER,he,t.RENDERBUFFER,de)}}else{const ve=O.texture.mipmaps;if(ve&&ve.length>0?n.bindFramebuffer(t.FRAMEBUFFER,F.__webglFramebuffer[0]):n.bindFramebuffer(t.FRAMEBUFFER,F.__webglFramebuffer),F.__webglDepthbuffer===void 0)F.__webglDepthbuffer=t.createRenderbuffer(),E(F.__webglDepthbuffer,O,!1);else{const he=O.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,de=F.__webglDepthbuffer;t.bindRenderbuffer(t.RENDERBUFFER,de),t.framebufferRenderbuffer(t.FRAMEBUFFER,he,t.RENDERBUFFER,de)}}n.bindFramebuffer(t.FRAMEBUFFER,null)}function B(O,F,Q){const ve=r.get(O);F!==void 0&&j(ve.__webglFramebuffer,O,O.texture,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,0),Q!==void 0&&W(O)}function ae(O){const F=O.texture,Q=r.get(O),ve=r.get(F);O.addEventListener("dispose",N);const he=O.textures,de=O.isWebGLCubeRenderTarget===!0,Ae=he.length>1;if(Ae||(ve.__webglTexture===void 0&&(ve.__webglTexture=t.createTexture()),ve.__version=F.version,o.memory.textures++),de){Q.__webglFramebuffer=[];for(let _e=0;_e<6;_e++)if(F.mipmaps&&F.mipmaps.length>0){Q.__webglFramebuffer[_e]=[];for(let ze=0;ze<F.mipmaps.length;ze++)Q.__webglFramebuffer[_e][ze]=t.createFramebuffer()}else Q.__webglFramebuffer[_e]=t.createFramebuffer()}else{if(F.mipmaps&&F.mipmaps.length>0){Q.__webglFramebuffer=[];for(let _e=0;_e<F.mipmaps.length;_e++)Q.__webglFramebuffer[_e]=t.createFramebuffer()}else Q.__webglFramebuffer=t.createFramebuffer();if(Ae)for(let _e=0,ze=he.length;_e<ze;_e++){const Be=r.get(he[_e]);Be.__webglTexture===void 0&&(Be.__webglTexture=t.createTexture(),o.memory.textures++)}if(O.samples>0&&se(O)===!1){Q.__webglMultisampledFramebuffer=t.createFramebuffer(),Q.__webglColorRenderbuffer=[],n.bindFramebuffer(t.FRAMEBUFFER,Q.__webglMultisampledFramebuffer);for(let _e=0;_e<he.length;_e++){const ze=he[_e];Q.__webglColorRenderbuffer[_e]=t.createRenderbuffer(),t.bindRenderbuffer(t.RENDERBUFFER,Q.__webglColorRenderbuffer[_e]);const Be=s.convert(ze.format,ze.colorSpace),Ue=s.convert(ze.type),Ne=k(ze.internalFormat,Be,Ue,ze.colorSpace,O.isXRRenderTarget===!0),Ee=ne(O);t.renderbufferStorageMultisample(t.RENDERBUFFER,Ee,Ne,O.width,O.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+_e,t.RENDERBUFFER,Q.__webglColorRenderbuffer[_e])}t.bindRenderbuffer(t.RENDERBUFFER,null),O.depthBuffer&&(Q.__webglDepthRenderbuffer=t.createRenderbuffer(),E(Q.__webglDepthRenderbuffer,O,!0)),n.bindFramebuffer(t.FRAMEBUFFER,null)}}if(de){n.bindTexture(t.TEXTURE_CUBE_MAP,ve.__webglTexture),ie(t.TEXTURE_CUBE_MAP,F);for(let _e=0;_e<6;_e++)if(F.mipmaps&&F.mipmaps.length>0)for(let ze=0;ze<F.mipmaps.length;ze++)j(Q.__webglFramebuffer[_e][ze],O,F,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+_e,ze);else j(Q.__webglFramebuffer[_e],O,F,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+_e,0);b(F)&&v(t.TEXTURE_CUBE_MAP),n.unbindTexture()}else if(Ae){for(let _e=0,ze=he.length;_e<ze;_e++){const Be=he[_e],Ue=r.get(Be);let Ne=t.TEXTURE_2D;(O.isWebGL3DRenderTarget||O.isWebGLArrayRenderTarget)&&(Ne=O.isWebGL3DRenderTarget?t.TEXTURE_3D:t.TEXTURE_2D_ARRAY),n.bindTexture(Ne,Ue.__webglTexture),ie(Ne,Be),j(Q.__webglFramebuffer,O,Be,t.COLOR_ATTACHMENT0+_e,Ne,0),b(Be)&&v(Ne)}n.unbindTexture()}else{let _e=t.TEXTURE_2D;if((O.isWebGL3DRenderTarget||O.isWebGLArrayRenderTarget)&&(_e=O.isWebGL3DRenderTarget?t.TEXTURE_3D:t.TEXTURE_2D_ARRAY),n.bindTexture(_e,ve.__webglTexture),ie(_e,F),F.mipmaps&&F.mipmaps.length>0)for(let ze=0;ze<F.mipmaps.length;ze++)j(Q.__webglFramebuffer[ze],O,F,t.COLOR_ATTACHMENT0,_e,ze);else j(Q.__webglFramebuffer,O,F,t.COLOR_ATTACHMENT0,_e,0);b(F)&&v(_e),n.unbindTexture()}O.depthBuffer&&W(O)}function z(O){const F=O.textures;for(let Q=0,ve=F.length;Q<ve;Q++){const he=F[Q];if(b(he)){const de=_(O),Ae=r.get(he).__webglTexture;n.bindTexture(de,Ae),v(de),n.unbindTexture()}}}const V=[],ee=[];function K(O){if(O.samples>0){if(se(O)===!1){const F=O.textures,Q=O.width,ve=O.height;let he=t.COLOR_BUFFER_BIT;const de=O.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,Ae=r.get(O),_e=F.length>1;if(_e)for(let Be=0;Be<F.length;Be++)n.bindFramebuffer(t.FRAMEBUFFER,Ae.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+Be,t.RENDERBUFFER,null),n.bindFramebuffer(t.FRAMEBUFFER,Ae.__webglFramebuffer),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+Be,t.TEXTURE_2D,null,0);n.bindFramebuffer(t.READ_FRAMEBUFFER,Ae.__webglMultisampledFramebuffer);const ze=O.texture.mipmaps;ze&&ze.length>0?n.bindFramebuffer(t.DRAW_FRAMEBUFFER,Ae.__webglFramebuffer[0]):n.bindFramebuffer(t.DRAW_FRAMEBUFFER,Ae.__webglFramebuffer);for(let Be=0;Be<F.length;Be++){if(O.resolveDepthBuffer&&(O.depthBuffer&&(he|=t.DEPTH_BUFFER_BIT),O.stencilBuffer&&O.resolveStencilBuffer&&(he|=t.STENCIL_BUFFER_BIT)),_e){t.framebufferRenderbuffer(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.RENDERBUFFER,Ae.__webglColorRenderbuffer[Be]);const Ue=r.get(F[Be]).__webglTexture;t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,Ue,0)}t.blitFramebuffer(0,0,Q,ve,0,0,Q,ve,he,t.NEAREST),c===!0&&(V.length=0,ee.length=0,V.push(t.COLOR_ATTACHMENT0+Be),O.depthBuffer&&O.resolveDepthBuffer===!1&&(V.push(de),ee.push(de),t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,ee)),t.invalidateFramebuffer(t.READ_FRAMEBUFFER,V))}if(n.bindFramebuffer(t.READ_FRAMEBUFFER,null),n.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),_e)for(let Be=0;Be<F.length;Be++){n.bindFramebuffer(t.FRAMEBUFFER,Ae.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+Be,t.RENDERBUFFER,Ae.__webglColorRenderbuffer[Be]);const Ue=r.get(F[Be]).__webglTexture;n.bindFramebuffer(t.FRAMEBUFFER,Ae.__webglFramebuffer),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+Be,t.TEXTURE_2D,Ue,0)}n.bindFramebuffer(t.DRAW_FRAMEBUFFER,Ae.__webglMultisampledFramebuffer)}else if(O.depthBuffer&&O.resolveDepthBuffer===!1&&c){const F=O.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,[F])}}}function ne(O){return Math.min(a.maxSamples,O.samples)}function se(O){const F=r.get(O);return O.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&F.__useRenderToTexture!==!1}function ce(O){const F=o.render.frame;u.get(O)!==F&&(u.set(O,F),O.update())}function fe(O,F){const Q=O.colorSpace,ve=O.format,he=O.type;return O.isCompressedTexture===!0||O.isVideoTexture===!0||Q!==Lb&&Q!==_m&&(xr.getTransfer(Q)===Ur?(ve!==Xl||he!==qc)&&Mn("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):$i("WebGLTextures: Unsupported texture color space:",Q)),F}function oe(O){return typeof HTMLImageElement<"u"&&O instanceof HTMLImageElement?(d.width=O.naturalWidth||O.width,d.height=O.naturalHeight||O.height):typeof VideoFrame<"u"&&O instanceof VideoFrame?(d.width=O.displayWidth,d.height=O.displayHeight):(d.width=O.width,d.height=O.height),d}this.allocateTextureUnit=G,this.resetTextureUnits=U,this.setTexture2D=te,this.setTexture2DArray=re,this.setTexture3D=J,this.setTextureCube=ue,this.rebindTextures=B,this.setupRenderTarget=ae,this.updateRenderTargetMipmap=z,this.updateMultisampleRenderTarget=K,this.setupDepthRenderbuffer=W,this.setupFrameBufferTexture=j,this.useMultisampledRTT=se}function RSe(t,e){function n(r,a=_m){let s;const o=xr.getTransfer(a);if(r===qc)return t.UNSIGNED_BYTE;if(r===iL)return t.UNSIGNED_SHORT_4_4_4_4;if(r===aL)return t.UNSIGNED_SHORT_5_5_5_1;if(r===fX)return t.UNSIGNED_INT_5_9_9_9_REV;if(r===gX)return t.UNSIGNED_INT_10F_11F_11F_REV;if(r===hX)return t.BYTE;if(r===pX)return t.SHORT;if(r===Bv)return t.UNSIGNED_SHORT;if(r===rL)return t.INT;if(r===Kp)return t.UNSIGNED_INT;if(r===Gd)return t.FLOAT;if(r===ux)return t.HALF_FLOAT;if(r===bX)return t.ALPHA;if(r===xX)return t.RGB;if(r===Xl)return t.RGBA;if(r===$v)return t.DEPTH_COMPONENT;if(r===qv)return t.DEPTH_STENCIL;if(r===yX)return t.RED;if(r===sL)return t.RED_INTEGER;if(r===oL)return t.RG;if(r===lL)return t.RG_INTEGER;if(r===cL)return t.RGBA_INTEGER;if(r===u1||r===m1||r===h1||r===p1)if(o===Ur)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(r===u1)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(r===m1)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(r===h1)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(r===p1)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(r===u1)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(r===m1)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(r===h1)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(r===p1)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(r===GD||r===WD||r===KD||r===YD)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(r===GD)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(r===WD)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(r===KD)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(r===YD)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(r===XD||r===QD||r===ZD)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(r===XD||r===QD)return o===Ur?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(r===ZD)return o===Ur?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(r===JD||r===e3||r===t3||r===n3||r===r3||r===i3||r===a3||r===s3||r===o3||r===l3||r===c3||r===d3||r===u3||r===m3)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(r===JD)return o===Ur?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(r===e3)return o===Ur?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(r===t3)return o===Ur?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(r===n3)return o===Ur?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(r===r3)return o===Ur?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(r===i3)return o===Ur?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(r===a3)return o===Ur?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(r===s3)return o===Ur?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(r===o3)return o===Ur?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(r===l3)return o===Ur?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(r===c3)return o===Ur?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(r===d3)return o===Ur?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(r===u3)return o===Ur?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(r===m3)return o===Ur?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(r===h3||r===p3||r===f3)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(r===h3)return o===Ur?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(r===p3)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(r===f3)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(r===g3||r===b3||r===x3||r===y3)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(r===g3)return s.COMPRESSED_RED_RGTC1_EXT;if(r===b3)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(r===x3)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(r===y3)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return r===Hv?t.UNSIGNED_INT_24_8:t[r]!==void 0?t[r]:null}return{convert:n}}const FSe=`
- void main() {
- gl_Position = vec4( position, 1.0 );
- }`,LSe=`
- uniform sampler2DArray depthColor;
- uniform float depthWidth;
- uniform float depthHeight;
- void main() {
- vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );
- if ( coord.x >= 1.0 ) {
- gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;
- } else {
- gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;
- }
- }`;class OSe{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,n){if(this.texture===null){const r=new UX(e.texture);(e.depthNear!==n.depthNear||e.depthFar!==n.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=r}}getMesh(e){if(this.texture!==null&&this.mesh===null){const n=e.cameras[0].viewport,r=new mu({vertexShader:FSe,fragmentShader:LSe,uniforms:{depthColor:{value:this.texture},depthWidth:{value:n.z},depthHeight:{value:n.w}}});this.mesh=new kl(new fL(20,20),r)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}let ISe=class extends xf{constructor(e,n){super();const r=this;let a=null,s=1,o=null,l="local-floor",c=1,d=null,u=null,m=null,p=null,f=null,y=null;const x=typeof XRWebGLBinding<"u",b=new OSe,v={},_=n.getContextAttributes();let k=null,P=null;const C=[],T=[],N=new Kn;let R=null;const A=new ll;A.viewport=new na;const D=new ll;D.viewport=new na;const $=[A,D],U=new tye;let G=null,L=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(q){let Z=C[q];return Z===void 0&&(Z=new PM,C[q]=Z),Z.getTargetRaySpace()},this.getControllerGrip=function(q){let Z=C[q];return Z===void 0&&(Z=new PM,C[q]=Z),Z.getGripSpace()},this.getHand=function(q){let Z=C[q];return Z===void 0&&(Z=new PM,C[q]=Z),Z.getHandSpace()};function te(q){const Z=T.indexOf(q.inputSource);if(Z===-1)return;const j=C[Z];j!==void 0&&(j.update(q.inputSource,q.frame,d||o),j.dispatchEvent({type:q.type,data:q.inputSource}))}function re(){a.removeEventListener("select",te),a.removeEventListener("selectstart",te),a.removeEventListener("selectend",te),a.removeEventListener("squeeze",te),a.removeEventListener("squeezestart",te),a.removeEventListener("squeezeend",te),a.removeEventListener("end",re),a.removeEventListener("inputsourceschange",J);for(let q=0;q<C.length;q++){const Z=T[q];Z!==null&&(T[q]=null,C[q].disconnect(Z))}G=null,L=null,b.reset();for(const q in v)delete v[q];e.setRenderTarget(k),f=null,p=null,m=null,a=null,P=null,Ce.stop(),r.isPresenting=!1,e.setPixelRatio(R),e.setSize(N.width,N.height,!1),r.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(q){s=q,r.isPresenting===!0&&Mn("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(q){l=q,r.isPresenting===!0&&Mn("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return d||o},this.setReferenceSpace=function(q){d=q},this.getBaseLayer=function(){return p!==null?p:f},this.getBinding=function(){return m===null&&x&&(m=new XRWebGLBinding(a,n)),m},this.getFrame=function(){return y},this.getSession=function(){return a},this.setSession=async function(q){if(a=q,a!==null){if(k=e.getRenderTarget(),a.addEventListener("select",te),a.addEventListener("selectstart",te),a.addEventListener("selectend",te),a.addEventListener("squeeze",te),a.addEventListener("squeezestart",te),a.addEventListener("squeezeend",te),a.addEventListener("end",re),a.addEventListener("inputsourceschange",J),_.xrCompatible!==!0&&await n.makeXRCompatible(),R=e.getPixelRatio(),e.getSize(N),x&&"createProjectionLayer"in XRWebGLBinding.prototype){let j=null,E=null,I=null;_.depth&&(I=_.stencil?n.DEPTH24_STENCIL8:n.DEPTH_COMPONENT24,j=_.stencil?qv:$v,E=_.stencil?Hv:Kp);const W={colorFormat:n.RGBA8,depthFormat:I,scaleFactor:s};m=this.getBinding(),p=m.createProjectionLayer(W),a.updateRenderState({layers:[p]}),e.setPixelRatio(1),e.setSize(p.textureWidth,p.textureHeight,!1),P=new Xp(p.textureWidth,p.textureHeight,{format:Xl,type:qc,depthTexture:new zX(p.textureWidth,p.textureHeight,E,void 0,void 0,void 0,void 0,void 0,void 0,j),stencilBuffer:_.stencil,colorSpace:e.outputColorSpace,samples:_.antialias?4:0,resolveDepthBuffer:p.ignoreDepthValues===!1,resolveStencilBuffer:p.ignoreDepthValues===!1})}else{const j={antialias:_.antialias,alpha:!0,depth:_.depth,stencil:_.stencil,framebufferScaleFactor:s};f=new XRWebGLLayer(a,n,j),a.updateRenderState({baseLayer:f}),e.setPixelRatio(1),e.setSize(f.framebufferWidth,f.framebufferHeight,!1),P=new Xp(f.framebufferWidth,f.framebufferHeight,{format:Xl,type:qc,colorSpace:e.outputColorSpace,stencilBuffer:_.stencil,resolveDepthBuffer:f.ignoreDepthValues===!1,resolveStencilBuffer:f.ignoreDepthValues===!1})}P.isXRRenderTarget=!0,this.setFoveation(c),d=null,o=await a.requestReferenceSpace(l),Ce.setContext(a),Ce.start(),r.isPresenting=!0,r.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(a!==null)return a.environmentBlendMode},this.getDepthTexture=function(){return b.getDepthTexture()};function J(q){for(let Z=0;Z<q.removed.length;Z++){const j=q.removed[Z],E=T.indexOf(j);E>=0&&(T[E]=null,C[E].disconnect(j))}for(let Z=0;Z<q.added.length;Z++){const j=q.added[Z];let E=T.indexOf(j);if(E===-1){for(let W=0;W<C.length;W++)if(W>=T.length){T.push(j),E=W;break}else if(T[W]===null){T[W]=j,E=W;break}if(E===-1)break}const I=C[E];I&&I.connect(j)}}const ue=new wt,me=new wt;function ge(q,Z,j){ue.setFromMatrixPosition(Z.matrixWorld),me.setFromMatrixPosition(j.matrixWorld);const E=ue.distanceTo(me),I=Z.projectionMatrix.elements,W=j.projectionMatrix.elements,B=I[14]/(I[10]-1),ae=I[14]/(I[10]+1),z=(I[9]+1)/I[5],V=(I[9]-1)/I[5],ee=(I[8]-1)/I[0],K=(W[8]+1)/W[0],ne=B*ee,se=B*K,ce=E/(-ee+K),fe=ce*-ee;if(Z.matrixWorld.decompose(q.position,q.quaternion,q.scale),q.translateX(fe),q.translateZ(ce),q.matrixWorld.compose(q.position,q.quaternion,q.scale),q.matrixWorldInverse.copy(q.matrixWorld).invert(),I[10]===-1)q.projectionMatrix.copy(Z.projectionMatrix),q.projectionMatrixInverse.copy(Z.projectionMatrixInverse);else{const oe=B+ce,O=ae+ce,F=ne-fe,Q=se+(E-fe),ve=z*ae/O*oe,he=V*ae/O*oe;q.projectionMatrix.makePerspective(F,Q,ve,he,oe,O),q.projectionMatrixInverse.copy(q.projectionMatrix).invert()}}function X(q,Z){Z===null?q.matrixWorld.copy(q.matrix):q.matrixWorld.multiplyMatrices(Z.matrixWorld,q.matrix),q.matrixWorldInverse.copy(q.matrixWorld).invert()}this.updateCamera=function(q){if(a===null)return;let Z=q.near,j=q.far;b.texture!==null&&(b.depthNear>0&&(Z=b.depthNear),b.depthFar>0&&(j=b.depthFar)),U.near=D.near=A.near=Z,U.far=D.far=A.far=j,(G!==U.near||L!==U.far)&&(a.updateRenderState({depthNear:U.near,depthFar:U.far}),G=U.near,L=U.far),U.layers.mask=q.layers.mask|6,A.layers.mask=U.layers.mask&3,D.layers.mask=U.layers.mask&5;const E=q.parent,I=U.cameras;X(U,E);for(let W=0;W<I.length;W++)X(I[W],E);I.length===2?ge(U,A,D):U.projectionMatrix.copy(A.projectionMatrix),ie(q,U,E)};function ie(q,Z,j){j===null?q.matrix.copy(Z.matrixWorld):(q.matrix.copy(j.matrixWorld),q.matrix.invert(),q.matrix.multiply(Z.matrixWorld)),q.matrix.decompose(q.position,q.quaternion,q.scale),q.updateMatrixWorld(!0),q.projectionMatrix.copy(Z.projectionMatrix),q.projectionMatrixInverse.copy(Z.projectionMatrixInverse),q.isPerspectiveCamera&&(q.fov=v3*2*Math.atan(1/q.projectionMatrix.elements[5]),q.zoom=1)}this.getCamera=function(){return U},this.getFoveation=function(){if(!(p===null&&f===null))return c},this.setFoveation=function(q){c=q,p!==null&&(p.fixedFoveation=q),f!==null&&f.fixedFoveation!==void 0&&(f.fixedFoveation=q)},this.hasDepthSensing=function(){return b.texture!==null},this.getDepthSensingMesh=function(){return b.getMesh(U)},this.getCameraTexture=function(q){return v[q]};let le=null;function pe(q,Z){if(u=Z.getViewerPose(d||o),y=Z,u!==null){const j=u.views;f!==null&&(e.setRenderTargetFramebuffer(P,f.framebuffer),e.setRenderTarget(P));let E=!1;j.length!==U.cameras.length&&(U.cameras.length=0,E=!0);for(let ae=0;ae<j.length;ae++){const z=j[ae];let V=null;if(f!==null)V=f.getViewport(z);else{const K=m.getViewSubImage(p,z);V=K.viewport,ae===0&&(e.setRenderTargetTextures(P,K.colorTexture,K.depthStencilTexture),e.setRenderTarget(P))}let ee=$[ae];ee===void 0&&(ee=new ll,ee.layers.enable(ae),ee.viewport=new na,$[ae]=ee),ee.matrix.fromArray(z.transform.matrix),ee.matrix.decompose(ee.position,ee.quaternion,ee.scale),ee.projectionMatrix.fromArray(z.projectionMatrix),ee.projectionMatrixInverse.copy(ee.projectionMatrix).invert(),ee.viewport.set(V.x,V.y,V.width,V.height),ae===0&&(U.matrix.copy(ee.matrix),U.matrix.decompose(U.position,U.quaternion,U.scale)),E===!0&&U.cameras.push(ee)}const I=a.enabledFeatures;if(I&&I.includes("depth-sensing")&&a.depthUsage=="gpu-optimized"&&x){m=r.getBinding();const ae=m.getDepthInformation(j[0]);ae&&ae.isValid&&ae.texture&&b.init(ae,a.renderState)}if(I&&I.includes("camera-access")&&x){e.state.unbindTexture(),m=r.getBinding();for(let ae=0;ae<j.length;ae++){const z=j[ae].camera;if(z){let V=v[z];V||(V=new UX,v[z]=V);const ee=m.getCameraImage(z);V.sourceTexture=ee}}}}for(let j=0;j<C.length;j++){const E=T[j],I=C[j];E!==null&&I!==void 0&&I.update(E,Z,d||o)}le&&le(q,Z),Z.detectedPlanes&&r.dispatchEvent({type:"planesdetected",data:Z}),y=null}const Ce=new VX;Ce.setAnimationLoop(pe),this.setAnimationLoop=function(q){le=q},this.dispose=function(){}}};const Vh=new ah,zSe=new oa;function USe(t,e){function n(b,v){b.matrixAutoUpdate===!0&&b.updateMatrix(),v.value.copy(b.matrix)}function r(b,v){v.color.getRGB(b.fogColor.value,FX(t)),v.isFog?(b.fogNear.value=v.near,b.fogFar.value=v.far):v.isFogExp2&&(b.fogDensity.value=v.density)}function a(b,v,_,k,P){v.isMeshBasicMaterial||v.isMeshLambertMaterial?s(b,v):v.isMeshToonMaterial?(s(b,v),m(b,v)):v.isMeshPhongMaterial?(s(b,v),u(b,v)):v.isMeshStandardMaterial?(s(b,v),p(b,v),v.isMeshPhysicalMaterial&&f(b,v,P)):v.isMeshMatcapMaterial?(s(b,v),y(b,v)):v.isMeshDepthMaterial?s(b,v):v.isMeshDistanceMaterial?(s(b,v),x(b,v)):v.isMeshNormalMaterial?s(b,v):v.isLineBasicMaterial?(o(b,v),v.isLineDashedMaterial&&l(b,v)):v.isPointsMaterial?c(b,v,_,k):v.isSpriteMaterial?d(b,v):v.isShadowMaterial?(b.color.value.copy(v.color),b.opacity.value=v.opacity):v.isShaderMaterial&&(v.uniformsNeedUpdate=!1)}function s(b,v){b.opacity.value=v.opacity,v.color&&b.diffuse.value.copy(v.color),v.emissive&&b.emissive.value.copy(v.emissive).multiplyScalar(v.emissiveIntensity),v.map&&(b.map.value=v.map,n(v.map,b.mapTransform)),v.alphaMap&&(b.alphaMap.value=v.alphaMap,n(v.alphaMap,b.alphaMapTransform)),v.bumpMap&&(b.bumpMap.value=v.bumpMap,n(v.bumpMap,b.bumpMapTransform),b.bumpScale.value=v.bumpScale,v.side===ao&&(b.bumpScale.value*=-1)),v.normalMap&&(b.normalMap.value=v.normalMap,n(v.normalMap,b.normalMapTransform),b.normalScale.value.copy(v.normalScale),v.side===ao&&b.normalScale.value.negate()),v.displacementMap&&(b.displacementMap.value=v.displacementMap,n(v.displacementMap,b.displacementMapTransform),b.displacementScale.value=v.displacementScale,b.displacementBias.value=v.displacementBias),v.emissiveMap&&(b.emissiveMap.value=v.emissiveMap,n(v.emissiveMap,b.emissiveMapTransform)),v.specularMap&&(b.specularMap.value=v.specularMap,n(v.specularMap,b.specularMapTransform)),v.alphaTest>0&&(b.alphaTest.value=v.alphaTest);const _=e.get(v),k=_.envMap,P=_.envMapRotation;k&&(b.envMap.value=k,Vh.copy(P),Vh.x*=-1,Vh.y*=-1,Vh.z*=-1,k.isCubeTexture&&k.isRenderTargetTexture===!1&&(Vh.y*=-1,Vh.z*=-1),b.envMapRotation.value.setFromMatrix4(zSe.makeRotationFromEuler(Vh)),b.flipEnvMap.value=k.isCubeTexture&&k.isRenderTargetTexture===!1?-1:1,b.reflectivity.value=v.reflectivity,b.ior.value=v.ior,b.refractionRatio.value=v.refractionRatio),v.lightMap&&(b.lightMap.value=v.lightMap,b.lightMapIntensity.value=v.lightMapIntensity,n(v.lightMap,b.lightMapTransform)),v.aoMap&&(b.aoMap.value=v.aoMap,b.aoMapIntensity.value=v.aoMapIntensity,n(v.aoMap,b.aoMapTransform))}function o(b,v){b.diffuse.value.copy(v.color),b.opacity.value=v.opacity,v.map&&(b.map.value=v.map,n(v.map,b.mapTransform))}function l(b,v){b.dashSize.value=v.dashSize,b.totalSize.value=v.dashSize+v.gapSize,b.scale.value=v.scale}function c(b,v,_,k){b.diffuse.value.copy(v.color),b.opacity.value=v.opacity,b.size.value=v.size*_,b.scale.value=k*.5,v.map&&(b.map.value=v.map,n(v.map,b.uvTransform)),v.alphaMap&&(b.alphaMap.value=v.alphaMap,n(v.alphaMap,b.alphaMapTransform)),v.alphaTest>0&&(b.alphaTest.value=v.alphaTest)}function d(b,v){b.diffuse.value.copy(v.color),b.opacity.value=v.opacity,b.rotation.value=v.rotation,v.map&&(b.map.value=v.map,n(v.map,b.mapTransform)),v.alphaMap&&(b.alphaMap.value=v.alphaMap,n(v.alphaMap,b.alphaMapTransform)),v.alphaTest>0&&(b.alphaTest.value=v.alphaTest)}function u(b,v){b.specular.value.copy(v.specular),b.shininess.value=Math.max(v.shininess,1e-4)}function m(b,v){v.gradientMap&&(b.gradientMap.value=v.gradientMap)}function p(b,v){b.metalness.value=v.metalness,v.metalnessMap&&(b.metalnessMap.value=v.metalnessMap,n(v.metalnessMap,b.metalnessMapTransform)),b.roughness.value=v.roughness,v.roughnessMap&&(b.roughnessMap.value=v.roughnessMap,n(v.roughnessMap,b.roughnessMapTransform)),v.envMap&&(b.envMapIntensity.value=v.envMapIntensity)}function f(b,v,_){b.ior.value=v.ior,v.sheen>0&&(b.sheenColor.value.copy(v.sheenColor).multiplyScalar(v.sheen),b.sheenRoughness.value=v.sheenRoughness,v.sheenColorMap&&(b.sheenColorMap.value=v.sheenColorMap,n(v.sheenColorMap,b.sheenColorMapTransform)),v.sheenRoughnessMap&&(b.sheenRoughnessMap.value=v.sheenRoughnessMap,n(v.sheenRoughnessMap,b.sheenRoughnessMapTransform))),v.clearcoat>0&&(b.clearcoat.value=v.clearcoat,b.clearcoatRoughness.value=v.clearcoatRoughness,v.clearcoatMap&&(b.clearcoatMap.value=v.clearcoatMap,n(v.clearcoatMap,b.clearcoatMapTransform)),v.clearcoatRoughnessMap&&(b.clearcoatRoughnessMap.value=v.clearcoatRoughnessMap,n(v.clearcoatRoughnessMap,b.clearcoatRoughnessMapTransform)),v.clearcoatNormalMap&&(b.clearcoatNormalMap.value=v.clearcoatNormalMap,n(v.clearcoatNormalMap,b.clearcoatNormalMapTransform),b.clearcoatNormalScale.value.copy(v.clearcoatNormalScale),v.side===ao&&b.clearcoatNormalScale.value.negate())),v.dispersion>0&&(b.dispersion.value=v.dispersion),v.iridescence>0&&(b.iridescence.value=v.iridescence,b.iridescenceIOR.value=v.iridescenceIOR,b.iridescenceThicknessMinimum.value=v.iridescenceThicknessRange[0],b.iridescenceThicknessMaximum.value=v.iridescenceThicknessRange[1],v.iridescenceMap&&(b.iridescenceMap.value=v.iridescenceMap,n(v.iridescenceMap,b.iridescenceMapTransform)),v.iridescenceThicknessMap&&(b.iridescenceThicknessMap.value=v.iridescenceThicknessMap,n(v.iridescenceThicknessMap,b.iridescenceThicknessMapTransform))),v.transmission>0&&(b.transmission.value=v.transmission,b.transmissionSamplerMap.value=_.texture,b.transmissionSamplerSize.value.set(_.width,_.height),v.transmissionMap&&(b.transmissionMap.value=v.transmissionMap,n(v.transmissionMap,b.transmissionMapTransform)),b.thickness.value=v.thickness,v.thicknessMap&&(b.thicknessMap.value=v.thicknessMap,n(v.thicknessMap,b.thicknessMapTransform)),b.attenuationDistance.value=v.attenuationDistance,b.attenuationColor.value.copy(v.attenuationColor)),v.anisotropy>0&&(b.anisotropyVector.value.set(v.anisotropy*Math.cos(v.anisotropyRotation),v.anisotropy*Math.sin(v.anisotropyRotation)),v.anisotropyMap&&(b.anisotropyMap.value=v.anisotropyMap,n(v.anisotropyMap,b.anisotropyMapTransform))),b.specularIntensity.value=v.specularIntensity,b.specularColor.value.copy(v.specularColor),v.specularColorMap&&(b.specularColorMap.value=v.specularColorMap,n(v.specularColorMap,b.specularColorMapTransform)),v.specularIntensityMap&&(b.specularIntensityMap.value=v.specularIntensityMap,n(v.specularIntensityMap,b.specularIntensityMapTransform))}function y(b,v){v.matcap&&(b.matcap.value=v.matcap)}function x(b,v){const _=e.get(v).light;b.referencePosition.value.setFromMatrixPosition(_.matrixWorld),b.nearDistance.value=_.shadow.camera.near,b.farDistance.value=_.shadow.camera.far}return{refreshFogUniforms:r,refreshMaterialUniforms:a}}function BSe(t,e,n,r){let a={},s={},o=[];const l=t.getParameter(t.MAX_UNIFORM_BUFFER_BINDINGS);function c(_,k){const P=k.program;r.uniformBlockBinding(_,P)}function d(_,k){let P=a[_.id];P===void 0&&(y(_),P=u(_),a[_.id]=P,_.addEventListener("dispose",b));const C=k.program;r.updateUBOMapping(_,C);const T=e.render.frame;s[_.id]!==T&&(p(_),s[_.id]=T)}function u(_){const k=m();_.__bindingPointIndex=k;const P=t.createBuffer(),C=_.__size,T=_.usage;return t.bindBuffer(t.UNIFORM_BUFFER,P),t.bufferData(t.UNIFORM_BUFFER,C,T),t.bindBuffer(t.UNIFORM_BUFFER,null),t.bindBufferBase(t.UNIFORM_BUFFER,k,P),P}function m(){for(let _=0;_<l;_++)if(o.indexOf(_)===-1)return o.push(_),_;return $i("WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function p(_){const k=a[_.id],P=_.uniforms,C=_.__cache;t.bindBuffer(t.UNIFORM_BUFFER,k);for(let T=0,N=P.length;T<N;T++){const R=Array.isArray(P[T])?P[T]:[P[T]];for(let A=0,D=R.length;A<D;A++){const $=R[A];if(f($,T,A,C)===!0){const U=$.__offset,G=Array.isArray($.value)?$.value:[$.value];let L=0;for(let te=0;te<G.length;te++){const re=G[te],J=x(re);typeof re=="number"||typeof re=="boolean"?($.__data[0]=re,t.bufferSubData(t.UNIFORM_BUFFER,U+L,$.__data)):re.isMatrix3?($.__data[0]=re.elements[0],$.__data[1]=re.elements[1],$.__data[2]=re.elements[2],$.__data[3]=0,$.__data[4]=re.elements[3],$.__data[5]=re.elements[4],$.__data[6]=re.elements[5],$.__data[7]=0,$.__data[8]=re.elements[6],$.__data[9]=re.elements[7],$.__data[10]=re.elements[8],$.__data[11]=0):(re.toArray($.__data,L),L+=J.storage/Float32Array.BYTES_PER_ELEMENT)}t.bufferSubData(t.UNIFORM_BUFFER,U,$.__data)}}}t.bindBuffer(t.UNIFORM_BUFFER,null)}function f(_,k,P,C){const T=_.value,N=k+"_"+P;if(C[N]===void 0)return typeof T=="number"||typeof T=="boolean"?C[N]=T:C[N]=T.clone(),!0;{const R=C[N];if(typeof T=="number"||typeof T=="boolean"){if(R!==T)return C[N]=T,!0}else if(R.equals(T)===!1)return R.copy(T),!0}return!1}function y(_){const k=_.uniforms;let P=0;const C=16;for(let N=0,R=k.length;N<R;N++){const A=Array.isArray(k[N])?k[N]:[k[N]];for(let D=0,$=A.length;D<$;D++){const U=A[D],G=Array.isArray(U.value)?U.value:[U.value];for(let L=0,te=G.length;L<te;L++){const re=G[L],J=x(re),ue=P%C,me=ue%J.boundary,ge=ue+me;P+=me,ge!==0&&C-ge<J.storage&&(P+=C-ge),U.__data=new Float32Array(J.storage/Float32Array.BYTES_PER_ELEMENT),U.__offset=P,P+=J.storage}}}const T=P%C;return T>0&&(P+=C-T),_.__size=P,_.__cache={},this}function x(_){const k={boundary:0,storage:0};return typeof _=="number"||typeof _=="boolean"?(k.boundary=4,k.storage=4):_.isVector2?(k.boundary=8,k.storage=8):_.isVector3||_.isColor?(k.boundary=16,k.storage=12):_.isVector4?(k.boundary=16,k.storage=16):_.isMatrix3?(k.boundary=48,k.storage=48):_.isMatrix4?(k.boundary=64,k.storage=64):_.isTexture?Mn("WebGLRenderer: Texture samplers can not be part of an uniforms group."):Mn("WebGLRenderer: Unsupported uniform value type.",_),k}function b(_){const k=_.target;k.removeEventListener("dispose",b);const P=o.indexOf(k.__bindingPointIndex);o.splice(P,1),t.deleteBuffer(a[k.id]),delete a[k.id],delete s[k.id]}function v(){for(const _ in a)t.deleteBuffer(a[_]);o=[],a={},s={}}return{bind:c,update:d,dispose:v}}const HSe=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 Cd=null;function $Se(){return Cd===null&&(Cd=new Uxe(HSe,32,32,oL,ux),Cd.minFilter=hl,Cd.magFilter=hl,Cd.wrapS=Vd,Cd.wrapT=Vd,Cd.generateMipmaps=!1,Cd.needsUpdate=!0),Cd}let qSe=class{constructor(e={}){const{canvas:n=uxe(),context:r=null,depth:a=!0,stencil:s=!1,alpha:o=!1,antialias:l=!1,premultipliedAlpha:c=!0,preserveDrawingBuffer:d=!1,powerPreference:u="default",failIfMajorPerformanceCaveat:m=!1,reversedDepthBuffer:p=!1}=e;this.isWebGLRenderer=!0;let f;if(r!==null){if(typeof WebGLRenderingContext<"u"&&r instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");f=r.getContextAttributes().alpha}else f=o;const y=new Set([cL,lL,sL]),x=new Set([qc,Kp,Bv,Hv,iL,aL]),b=new Uint32Array(4),v=new Int32Array(4);let _=null,k=null;const P=[],C=[];this.domElement=n,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=Gm,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const T=this;let N=!1;this._outputColorSpace=Po;let R=0,A=0,D=null,$=-1,U=null;const G=new na,L=new na;let te=null;const re=new Zn(0);let J=0,ue=n.width,me=n.height,ge=1,X=null,ie=null;const le=new na(0,0,ue,me),pe=new na(0,0,ue,me);let Ce=!1;const q=new pL;let Z=!1,j=!1;const E=new oa,I=new wt,W=new na,B={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let ae=!1;function z(){return D===null?ge:1}let V=r;function ee(Te,We){return n.getContext(Te,We)}try{const Te={alpha:!0,depth:a,stencil:s,antialias:l,premultipliedAlpha:c,preserveDrawingBuffer:d,powerPreference:u,failIfMajorPerformanceCaveat:m};if("setAttribute"in n&&n.setAttribute("data-engine",`three.js r${tL}`),n.addEventListener("webglcontextlost",je,!1),n.addEventListener("webglcontextrestored",ye,!1),n.addEventListener("webglcontextcreationerror",$e,!1),V===null){const We="webgl2";if(V=ee(We,Te),V===null)throw ee(We)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(Te){throw Te("WebGLRenderer: "+Te.message),Te}let K,ne,se,ce,fe,oe,O,F,Q,ve,he,de,Ae,_e,ze,Be,Ue,Ne,Ee,ke,Me,Ge,xe,He;function Pe(){K=new Z0e(V),K.init(),Ge=new RSe(V,K),ne=new $0e(V,K,e,Ge),se=new jSe(V,K),ne.reversedDepthBuffer&&p&&se.buffers.depth.setReversed(!0),ce=new twe(V),fe=new ySe,oe=new DSe(V,K,se,fe,ne,Ge,ce),O=new V0e(T),F=new Q0e(T),Q=new aye(V),xe=new B0e(V,Q),ve=new J0e(V,Q,ce,xe),he=new rwe(V,ve,Q,ce),Ee=new nwe(V,ne,oe),Be=new q0e(fe),de=new xSe(T,O,F,K,ne,xe,Be),Ae=new USe(T,fe),_e=new wSe,ze=new TSe(K),Ne=new U0e(T,O,F,se,he,f,c),Ue=new MSe(T,he,ne),He=new BSe(V,ce,ne,se),ke=new H0e(V,K,ce),Me=new ewe(V,K,ce),ce.programs=de.programs,T.capabilities=ne,T.extensions=K,T.properties=fe,T.renderLists=_e,T.shadowMap=Ue,T.state=se,T.info=ce}Pe();const Ve=new ISe(T,V);this.xr=Ve,this.getContext=function(){return V},this.getContextAttributes=function(){return V.getContextAttributes()},this.forceContextLoss=function(){const Te=K.get("WEBGL_lose_context");Te&&Te.loseContext()},this.forceContextRestore=function(){const Te=K.get("WEBGL_lose_context");Te&&Te.restoreContext()},this.getPixelRatio=function(){return ge},this.setPixelRatio=function(Te){Te!==void 0&&(ge=Te,this.setSize(ue,me,!1))},this.getSize=function(Te){return Te.set(ue,me)},this.setSize=function(Te,We,et=!0){if(Ve.isPresenting){Mn("WebGLRenderer: Can't change size while VR device is presenting.");return}ue=Te,me=We,n.width=Math.floor(Te*ge),n.height=Math.floor(We*ge),et===!0&&(n.style.width=Te+"px",n.style.height=We+"px"),this.setViewport(0,0,Te,We)},this.getDrawingBufferSize=function(Te){return Te.set(ue*ge,me*ge).floor()},this.setDrawingBufferSize=function(Te,We,et){ue=Te,me=We,ge=et,n.width=Math.floor(Te*et),n.height=Math.floor(We*et),this.setViewport(0,0,Te,We)},this.getCurrentViewport=function(Te){return Te.copy(G)},this.getViewport=function(Te){return Te.copy(le)},this.setViewport=function(Te,We,et,Ze){Te.isVector4?le.set(Te.x,Te.y,Te.z,Te.w):le.set(Te,We,et,Ze),se.viewport(G.copy(le).multiplyScalar(ge).round())},this.getScissor=function(Te){return Te.copy(pe)},this.setScissor=function(Te,We,et,Ze){Te.isVector4?pe.set(Te.x,Te.y,Te.z,Te.w):pe.set(Te,We,et,Ze),se.scissor(L.copy(pe).multiplyScalar(ge).round())},this.getScissorTest=function(){return Ce},this.setScissorTest=function(Te){se.setScissorTest(Ce=Te)},this.setOpaqueSort=function(Te){X=Te},this.setTransparentSort=function(Te){ie=Te},this.getClearColor=function(Te){return Te.copy(Ne.getClearColor())},this.setClearColor=function(){Ne.setClearColor(...arguments)},this.getClearAlpha=function(){return Ne.getClearAlpha()},this.setClearAlpha=function(){Ne.setClearAlpha(...arguments)},this.clear=function(Te=!0,We=!0,et=!0){let Ze=0;if(Te){let Le=!1;if(D!==null){const mt=D.texture.format;Le=y.has(mt)}if(Le){const mt=D.texture.type,st=x.has(mt),tt=Ne.getClearColor(),Nt=Ne.getClearAlpha(),Rt=tt.r,jt=tt.g,Ft=tt.b;st?(b[0]=Rt,b[1]=jt,b[2]=Ft,b[3]=Nt,V.clearBufferuiv(V.COLOR,0,b)):(v[0]=Rt,v[1]=jt,v[2]=Ft,v[3]=Nt,V.clearBufferiv(V.COLOR,0,v))}else Ze|=V.COLOR_BUFFER_BIT}We&&(Ze|=V.DEPTH_BUFFER_BIT),et&&(Ze|=V.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),V.clear(Ze)},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",je,!1),n.removeEventListener("webglcontextrestored",ye,!1),n.removeEventListener("webglcontextcreationerror",$e,!1),Ne.dispose(),_e.dispose(),ze.dispose(),fe.dispose(),O.dispose(),F.dispose(),he.dispose(),xe.dispose(),He.dispose(),de.dispose(),Ve.dispose(),Ve.removeEventListener("sessionstart",ht),Ve.removeEventListener("sessionend",yt),Bt.stop()};function je(Te){Te.preventDefault(),b8("WebGLRenderer: Context Lost."),N=!0}function ye(){b8("WebGLRenderer: Context Restored."),N=!1;const Te=ce.autoReset,We=Ue.enabled,et=Ue.autoUpdate,Ze=Ue.needsUpdate,Le=Ue.type;Pe(),ce.autoReset=Te,Ue.enabled=We,Ue.autoUpdate=et,Ue.needsUpdate=Ze,Ue.type=Le}function $e(Te){$i("WebGLRenderer: A WebGL context could not be created. Reason: ",Te.statusMessage)}function Ye(Te){const We=Te.target;We.removeEventListener("dispose",Ye),lt(We)}function lt(Te){St(Te),fe.remove(Te)}function St(Te){const We=fe.get(Te).programs;We!==void 0&&(We.forEach(function(et){de.releaseProgram(et)}),Te.isShaderMaterial&&de.releaseShaderCache(Te))}this.renderBufferDirect=function(Te,We,et,Ze,Le,mt){We===null&&(We=B);const st=Le.isMesh&&Le.matrixWorld.determinant()<0,tt=Ie(Te,We,et,Ze,Le);se.setMaterial(Ze,st);let Nt=et.index,Rt=1;if(Ze.wireframe===!0){if(Nt=ve.getWireframeAttribute(et),Nt===void 0)return;Rt=2}const jt=et.drawRange,Ft=et.attributes.position;let mn=jt.start*Rt,rn=(jt.start+jt.count)*Rt;mt!==null&&(mn=Math.max(mn,mt.start*Rt),rn=Math.min(rn,(mt.start+mt.count)*Rt)),Nt!==null?(mn=Math.max(mn,0),rn=Math.min(rn,Nt.count)):Ft!=null&&(mn=Math.max(mn,0),rn=Math.min(rn,Ft.count));const vn=rn-mn;if(vn<0||vn===1/0)return;xe.setup(Le,Ze,tt,et,Nt);let Dn,Bn=ke;if(Nt!==null&&(Dn=Q.get(Nt),Bn=Me,Bn.setIndex(Dn)),Le.isMesh)Ze.wireframe===!0?(se.setLineWidth(Ze.wireframeLinewidth*z()),Bn.setMode(V.LINES)):Bn.setMode(V.TRIANGLES);else if(Le.isLine){let en=Ze.linewidth;en===void 0&&(en=1),se.setLineWidth(en*z()),Le.isLineSegments?Bn.setMode(V.LINES):Le.isLineLoop?Bn.setMode(V.LINE_LOOP):Bn.setMode(V.LINE_STRIP)}else Le.isPoints?Bn.setMode(V.POINTS):Le.isSprite&&Bn.setMode(V.TRIANGLES);if(Le.isBatchedMesh)if(Le._multiDrawInstances!==null)Vv("WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection."),Bn.renderMultiDrawInstances(Le._multiDrawStarts,Le._multiDrawCounts,Le._multiDrawCount,Le._multiDrawInstances);else if(K.get("WEBGL_multi_draw"))Bn.renderMultiDraw(Le._multiDrawStarts,Le._multiDrawCounts,Le._multiDrawCount);else{const en=Le._multiDrawStarts,kn=Le._multiDrawCounts,_n=Le._multiDrawCount,vr=Nt?Q.get(Nt).bytesPerElement:1,wn=fe.get(Ze).currentProgram.getUniforms();for(let lr=0;lr<_n;lr++)wn.setValue(V,"_gl_DrawID",lr),Bn.render(en[lr]/vr,kn[lr])}else if(Le.isInstancedMesh)Bn.renderInstances(mn,vn,Le.count);else if(et.isInstancedBufferGeometry){const en=et._maxInstanceCount!==void 0?et._maxInstanceCount:1/0,kn=Math.min(et.instanceCount,en);Bn.renderInstances(mn,vn,kn)}else Bn.render(mn,vn)};function ot(Te,We,et){Te.transparent===!0&&Te.side===Mc&&Te.forceSinglePass===!1?(Te.side=ao,Te.needsUpdate=!0,on(Te,We,et),Te.side=ih,Te.needsUpdate=!0,on(Te,We,et),Te.side=Mc):on(Te,We,et)}this.compile=function(Te,We,et=null){et===null&&(et=Te),k=ze.get(et),k.init(We),C.push(k),et.traverseVisible(function(Le){Le.isLight&&Le.layers.test(We.layers)&&(k.pushLight(Le),Le.castShadow&&k.pushShadow(Le))}),Te!==et&&Te.traverseVisible(function(Le){Le.isLight&&Le.layers.test(We.layers)&&(k.pushLight(Le),Le.castShadow&&k.pushShadow(Le))}),k.setupLights();const Ze=new Set;return Te.traverse(function(Le){if(!(Le.isMesh||Le.isPoints||Le.isLine||Le.isSprite))return;const mt=Le.material;if(mt)if(Array.isArray(mt))for(let st=0;st<mt.length;st++){const tt=mt[st];ot(tt,et,Le),Ze.add(tt)}else ot(mt,et,Le),Ze.add(mt)}),k=C.pop(),Ze},this.compileAsync=function(Te,We,et=null){const Ze=this.compile(Te,We,et);return new Promise(Le=>{function mt(){if(Ze.forEach(function(st){fe.get(st).currentProgram.isReady()&&Ze.delete(st)}),Ze.size===0){Le(Te);return}setTimeout(mt,10)}K.get("KHR_parallel_shader_compile")!==null?mt():setTimeout(mt,10)})};let ft=null;function qe(Te){ft&&ft(Te)}function ht(){Bt.stop()}function yt(){Bt.start()}const Bt=new VX;Bt.setAnimationLoop(qe),typeof self<"u"&&Bt.setContext(self),this.setAnimationLoop=function(Te){ft=Te,Ve.setAnimationLoop(Te),Te===null?Bt.stop():Bt.start()},Ve.addEventListener("sessionstart",ht),Ve.addEventListener("sessionend",yt),this.render=function(Te,We){if(We!==void 0&&We.isCamera!==!0){$i("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(N===!0)return;if(Te.matrixWorldAutoUpdate===!0&&Te.updateMatrixWorld(),We.parent===null&&We.matrixWorldAutoUpdate===!0&&We.updateMatrixWorld(),Ve.enabled===!0&&Ve.isPresenting===!0&&(Ve.cameraAutoUpdate===!0&&Ve.updateCamera(We),We=Ve.getCamera()),Te.isScene===!0&&Te.onBeforeRender(T,Te,We,D),k=ze.get(Te,C.length),k.init(We),C.push(k),E.multiplyMatrices(We.projectionMatrix,We.matrixWorldInverse),q.setFromProjectionMatrix(E,Dc,We.reversedDepth),j=this.localClippingEnabled,Z=Be.init(this.clippingPlanes,j),_=_e.get(Te,P.length),_.init(),P.push(_),Ve.enabled===!0&&Ve.isPresenting===!0){const mt=T.xr.getDepthSensingMesh();mt!==null&&Yt(mt,We,-1/0,T.sortObjects)}Yt(Te,We,0,T.sortObjects),_.finish(),T.sortObjects===!0&&_.sort(X,ie),ae=Ve.enabled===!1||Ve.isPresenting===!1||Ve.hasDepthSensing()===!1,ae&&Ne.addToRenderList(_,Te),this.info.render.frame++,Z===!0&&Be.beginShadows();const et=k.state.shadowsArray;Ue.render(et,Te,We),Z===!0&&Be.endShadows(),this.info.autoReset===!0&&this.info.reset();const Ze=_.opaque,Le=_.transmissive;if(k.setupLights(),We.isArrayCamera){const mt=We.cameras;if(Le.length>0)for(let st=0,tt=mt.length;st<tt;st++){const Nt=mt[st];Xt(Ze,Le,Te,Nt)}ae&&Ne.render(Te);for(let st=0,tt=mt.length;st<tt;st++){const Nt=mt[st];xn(_,Te,Nt,Nt.viewport)}}else Le.length>0&&Xt(Ze,Le,Te,We),ae&&Ne.render(Te),xn(_,Te,We);D!==null&&A===0&&(oe.updateMultisampleRenderTarget(D),oe.updateRenderTargetMipmap(D)),Te.isScene===!0&&Te.onAfterRender(T,Te,We),xe.resetDefaultState(),$=-1,U=null,C.pop(),C.length>0?(k=C[C.length-1],Z===!0&&Be.setGlobalState(T.clippingPlanes,k.state.camera)):k=null,P.pop(),P.length>0?_=P[P.length-1]:_=null};function Yt(Te,We,et,Ze){if(Te.visible===!1)return;if(Te.layers.test(We.layers)){if(Te.isGroup)et=Te.renderOrder;else if(Te.isLOD)Te.autoUpdate===!0&&Te.update(We);else if(Te.isLight)k.pushLight(Te),Te.castShadow&&k.pushShadow(Te);else if(Te.isSprite){if(!Te.frustumCulled||q.intersectsSprite(Te)){Ze&&W.setFromMatrixPosition(Te.matrixWorld).applyMatrix4(E);const st=he.update(Te),tt=Te.material;tt.visible&&_.push(Te,st,tt,et,W.z,null)}}else if((Te.isMesh||Te.isLine||Te.isPoints)&&(!Te.frustumCulled||q.intersectsObject(Te))){const st=he.update(Te),tt=Te.material;if(Ze&&(Te.boundingSphere!==void 0?(Te.boundingSphere===null&&Te.computeBoundingSphere(),W.copy(Te.boundingSphere.center)):(st.boundingSphere===null&&st.computeBoundingSphere(),W.copy(st.boundingSphere.center)),W.applyMatrix4(Te.matrixWorld).applyMatrix4(E)),Array.isArray(tt)){const Nt=st.groups;for(let Rt=0,jt=Nt.length;Rt<jt;Rt++){const Ft=Nt[Rt],mn=tt[Ft.materialIndex];mn&&mn.visible&&_.push(Te,st,mn,et,W.z,Ft)}}else tt.visible&&_.push(Te,st,tt,et,W.z,null)}}const mt=Te.children;for(let st=0,tt=mt.length;st<tt;st++)Yt(mt[st],We,et,Ze)}function xn(Te,We,et,Ze){const{opaque:Le,transmissive:mt,transparent:st}=Te;k.setupLightsView(et),Z===!0&&Be.setGlobalState(T.clippingPlanes,et),Ze&&se.viewport(G.copy(Ze)),Le.length>0&&$t(Le,We,et),mt.length>0&&$t(mt,We,et),st.length>0&&$t(st,We,et),se.buffers.depth.setTest(!0),se.buffers.depth.setMask(!0),se.buffers.color.setMask(!0),se.setPolygonOffset(!1)}function Xt(Te,We,et,Ze){if((et.isScene===!0?et.overrideMaterial:null)!==null)return;k.state.transmissionRenderTarget[Ze.id]===void 0&&(k.state.transmissionRenderTarget[Ze.id]=new Xp(1,1,{generateMipmaps:!0,type:K.has("EXT_color_buffer_half_float")||K.has("EXT_color_buffer_float")?ux:qc,minFilter:hp,samples:4,stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:xr.workingColorSpace}));const mt=k.state.transmissionRenderTarget[Ze.id],st=Ze.viewport||G;mt.setSize(st.z*T.transmissionResolutionScale,st.w*T.transmissionResolutionScale);const tt=T.getRenderTarget(),Nt=T.getActiveCubeFace(),Rt=T.getActiveMipmapLevel();T.setRenderTarget(mt),T.getClearColor(re),J=T.getClearAlpha(),J<1&&T.setClearColor(16777215,.5),T.clear(),ae&&Ne.render(et);const jt=T.toneMapping;T.toneMapping=Gm;const Ft=Ze.viewport;if(Ze.viewport!==void 0&&(Ze.viewport=void 0),k.setupLightsView(Ze),Z===!0&&Be.setGlobalState(T.clippingPlanes,Ze),$t(Te,et,Ze),oe.updateMultisampleRenderTarget(mt),oe.updateRenderTargetMipmap(mt),K.has("WEBGL_multisampled_render_to_texture")===!1){let mn=!1;for(let rn=0,vn=We.length;rn<vn;rn++){const Dn=We[rn],{object:Bn,geometry:en,material:kn,group:_n}=Dn;if(kn.side===Mc&&Bn.layers.test(Ze.layers)){const vr=kn.side;kn.side=ao,kn.needsUpdate=!0,nn(Bn,et,Ze,en,kn,_n),kn.side=vr,kn.needsUpdate=!0,mn=!0}}mn===!0&&(oe.updateMultisampleRenderTarget(mt),oe.updateRenderTargetMipmap(mt))}T.setRenderTarget(tt,Nt,Rt),T.setClearColor(re,J),Ft!==void 0&&(Ze.viewport=Ft),T.toneMapping=jt}function $t(Te,We,et){const Ze=We.isScene===!0?We.overrideMaterial:null;for(let Le=0,mt=Te.length;Le<mt;Le++){const st=Te[Le],{object:tt,geometry:Nt,group:Rt}=st;let jt=st.material;jt.allowOverride===!0&&Ze!==null&&(jt=Ze),tt.layers.test(et.layers)&&nn(tt,We,et,Nt,jt,Rt)}}function nn(Te,We,et,Ze,Le,mt){Te.onBeforeRender(T,We,et,Ze,Le,mt),Te.modelViewMatrix.multiplyMatrices(et.matrixWorldInverse,Te.matrixWorld),Te.normalMatrix.getNormalMatrix(Te.modelViewMatrix),Le.onBeforeRender(T,We,et,Ze,Te,mt),Le.transparent===!0&&Le.side===Mc&&Le.forceSinglePass===!1?(Le.side=ao,Le.needsUpdate=!0,T.renderBufferDirect(et,We,Ze,Le,Te,mt),Le.side=ih,Le.needsUpdate=!0,T.renderBufferDirect(et,We,Ze,Le,Te,mt),Le.side=Mc):T.renderBufferDirect(et,We,Ze,Le,Te,mt),Te.onAfterRender(T,We,et,Ze,Le,mt)}function on(Te,We,et){We.isScene!==!0&&(We=B);const Ze=fe.get(Te),Le=k.state.lights,mt=k.state.shadowsArray,st=Le.state.version,tt=de.getParameters(Te,Le.state,mt,We,et),Nt=de.getProgramCacheKey(tt);let Rt=Ze.programs;Ze.environment=Te.isMeshStandardMaterial?We.environment:null,Ze.fog=We.fog,Ze.envMap=(Te.isMeshStandardMaterial?F:O).get(Te.envMap||Ze.environment),Ze.envMapRotation=Ze.environment!==null&&Te.envMap===null?We.environmentRotation:Te.envMapRotation,Rt===void 0&&(Te.addEventListener("dispose",Ye),Rt=new Map,Ze.programs=Rt);let jt=Rt.get(Nt);if(jt!==void 0){if(Ze.currentProgram===jt&&Ze.lightsStateVersion===st)return pn(Te,tt),jt}else tt.uniforms=de.getUniforms(Te),Te.onBeforeCompile(tt,T),jt=de.acquireProgram(tt,Nt),Rt.set(Nt,jt),Ze.uniforms=tt.uniforms;const Ft=Ze.uniforms;return(!Te.isShaderMaterial&&!Te.isRawShaderMaterial||Te.clipping===!0)&&(Ft.clippingPlanes=Be.uniform),pn(Te,tt),Ze.needsLights=Xe(Te),Ze.lightsStateVersion=st,Ze.needsLights&&(Ft.ambientLightColor.value=Le.state.ambient,Ft.lightProbe.value=Le.state.probe,Ft.directionalLights.value=Le.state.directional,Ft.directionalLightShadows.value=Le.state.directionalShadow,Ft.spotLights.value=Le.state.spot,Ft.spotLightShadows.value=Le.state.spotShadow,Ft.rectAreaLights.value=Le.state.rectArea,Ft.ltc_1.value=Le.state.rectAreaLTC1,Ft.ltc_2.value=Le.state.rectAreaLTC2,Ft.pointLights.value=Le.state.point,Ft.pointLightShadows.value=Le.state.pointShadow,Ft.hemisphereLights.value=Le.state.hemi,Ft.directionalShadowMap.value=Le.state.directionalShadowMap,Ft.directionalShadowMatrix.value=Le.state.directionalShadowMatrix,Ft.spotShadowMap.value=Le.state.spotShadowMap,Ft.spotLightMatrix.value=Le.state.spotLightMatrix,Ft.spotLightMap.value=Le.state.spotLightMap,Ft.pointShadowMap.value=Le.state.pointShadowMap,Ft.pointShadowMatrix.value=Le.state.pointShadowMatrix),Ze.currentProgram=jt,Ze.uniformsList=null,jt}function cn(Te){if(Te.uniformsList===null){const We=Te.currentProgram.getUniforms();Te.uniformsList=x1.seqWithValue(We.seq,Te.uniforms)}return Te.uniformsList}function pn(Te,We){const et=fe.get(Te);et.outputColorSpace=We.outputColorSpace,et.batching=We.batching,et.batchingColor=We.batchingColor,et.instancing=We.instancing,et.instancingColor=We.instancingColor,et.instancingMorph=We.instancingMorph,et.skinning=We.skinning,et.morphTargets=We.morphTargets,et.morphNormals=We.morphNormals,et.morphColors=We.morphColors,et.morphTargetsCount=We.morphTargetsCount,et.numClippingPlanes=We.numClippingPlanes,et.numIntersection=We.numClipIntersection,et.vertexAlphas=We.vertexAlphas,et.vertexTangents=We.vertexTangents,et.toneMapping=We.toneMapping}function Ie(Te,We,et,Ze,Le){We.isScene!==!0&&(We=B),oe.resetTextureUnits();const mt=We.fog,st=Ze.isMeshStandardMaterial?We.environment:null,tt=D===null?T.outputColorSpace:D.isXRRenderTarget===!0?D.texture.colorSpace:Lb,Nt=(Ze.isMeshStandardMaterial?F:O).get(Ze.envMap||st),Rt=Ze.vertexColors===!0&&!!et.attributes.color&&et.attributes.color.itemSize===4,jt=!!et.attributes.tangent&&(!!Ze.normalMap||Ze.anisotropy>0),Ft=!!et.morphAttributes.position,mn=!!et.morphAttributes.normal,rn=!!et.morphAttributes.color;let vn=Gm;Ze.toneMapped&&(D===null||D.isXRRenderTarget===!0)&&(vn=T.toneMapping);const Dn=et.morphAttributes.position||et.morphAttributes.normal||et.morphAttributes.color,Bn=Dn!==void 0?Dn.length:0,en=fe.get(Ze),kn=k.state.lights;if(Z===!0&&(j===!0||Te!==U)){const bi=Te===U&&Ze.id===$;Be.setState(Ze,Te,bi)}let _n=!1;Ze.version===en.__version?(en.needsLights&&en.lightsStateVersion!==kn.state.version||en.outputColorSpace!==tt||Le.isBatchedMesh&&en.batching===!1||!Le.isBatchedMesh&&en.batching===!0||Le.isBatchedMesh&&en.batchingColor===!0&&Le.colorTexture===null||Le.isBatchedMesh&&en.batchingColor===!1&&Le.colorTexture!==null||Le.isInstancedMesh&&en.instancing===!1||!Le.isInstancedMesh&&en.instancing===!0||Le.isSkinnedMesh&&en.skinning===!1||!Le.isSkinnedMesh&&en.skinning===!0||Le.isInstancedMesh&&en.instancingColor===!0&&Le.instanceColor===null||Le.isInstancedMesh&&en.instancingColor===!1&&Le.instanceColor!==null||Le.isInstancedMesh&&en.instancingMorph===!0&&Le.morphTexture===null||Le.isInstancedMesh&&en.instancingMorph===!1&&Le.morphTexture!==null||en.envMap!==Nt||Ze.fog===!0&&en.fog!==mt||en.numClippingPlanes!==void 0&&(en.numClippingPlanes!==Be.numPlanes||en.numIntersection!==Be.numIntersection)||en.vertexAlphas!==Rt||en.vertexTangents!==jt||en.morphTargets!==Ft||en.morphNormals!==mn||en.morphColors!==rn||en.toneMapping!==vn||en.morphTargetsCount!==Bn)&&(_n=!0):(_n=!0,en.__version=Ze.version);let vr=en.currentProgram;_n===!0&&(vr=on(Ze,We,Le));let wn=!1,lr=!1,ci=!1;const zn=vr.getUniforms(),gi=en.uniforms;if(se.useProgram(vr.program)&&(wn=!0,lr=!0,ci=!0),Ze.id!==$&&($=Ze.id,lr=!0),wn||U!==Te){se.buffers.depth.getReversed()&&Te.reversedDepth!==!0&&(Te._reversedDepth=!0,Te.updateProjectionMatrix()),zn.setValue(V,"projectionMatrix",Te.projectionMatrix),zn.setValue(V,"viewMatrix",Te.matrixWorldInverse);const ni=zn.map.cameraPosition;ni!==void 0&&ni.setValue(V,I.setFromMatrixPosition(Te.matrixWorld)),ne.logarithmicDepthBuffer&&zn.setValue(V,"logDepthBufFC",2/(Math.log(Te.far+1)/Math.LN2)),(Ze.isMeshPhongMaterial||Ze.isMeshToonMaterial||Ze.isMeshLambertMaterial||Ze.isMeshBasicMaterial||Ze.isMeshStandardMaterial||Ze.isShaderMaterial)&&zn.setValue(V,"isOrthographic",Te.isOrthographicCamera===!0),U!==Te&&(U=Te,lr=!0,ci=!0)}if(Le.isSkinnedMesh){zn.setOptional(V,Le,"bindMatrix"),zn.setOptional(V,Le,"bindMatrixInverse");const bi=Le.skeleton;bi&&(bi.boneTexture===null&&bi.computeBoneTexture(),zn.setValue(V,"boneTexture",bi.boneTexture,oe))}Le.isBatchedMesh&&(zn.setOptional(V,Le,"batchingTexture"),zn.setValue(V,"batchingTexture",Le._matricesTexture,oe),zn.setOptional(V,Le,"batchingIdTexture"),zn.setValue(V,"batchingIdTexture",Le._indirectTexture,oe),zn.setOptional(V,Le,"batchingColorTexture"),Le._colorsTexture!==null&&zn.setValue(V,"batchingColorTexture",Le._colorsTexture,oe));const tr=et.morphAttributes;if((tr.position!==void 0||tr.normal!==void 0||tr.color!==void 0)&&Ee.update(Le,et,vr),(lr||en.receiveShadow!==Le.receiveShadow)&&(en.receiveShadow=Le.receiveShadow,zn.setValue(V,"receiveShadow",Le.receiveShadow)),Ze.isMeshGouraudMaterial&&Ze.envMap!==null&&(gi.envMap.value=Nt,gi.flipEnvMap.value=Nt.isCubeTexture&&Nt.isRenderTargetTexture===!1?-1:1),Ze.isMeshStandardMaterial&&Ze.envMap===null&&We.environment!==null&&(gi.envMapIntensity.value=We.environmentIntensity),gi.dfgLUT!==void 0&&(gi.dfgLUT.value=$Se()),lr&&(zn.setValue(V,"toneMappingExposure",T.toneMappingExposure),en.needsLights&&De(gi,ci),mt&&Ze.fog===!0&&Ae.refreshFogUniforms(gi,mt),Ae.refreshMaterialUniforms(gi,Ze,ge,me,k.state.transmissionRenderTarget[Te.id]),x1.upload(V,cn(en),gi,oe)),Ze.isShaderMaterial&&Ze.uniformsNeedUpdate===!0&&(x1.upload(V,cn(en),gi,oe),Ze.uniformsNeedUpdate=!1),Ze.isSpriteMaterial&&zn.setValue(V,"center",Le.center),zn.setValue(V,"modelViewMatrix",Le.modelViewMatrix),zn.setValue(V,"normalMatrix",Le.normalMatrix),zn.setValue(V,"modelMatrix",Le.matrixWorld),Ze.isShaderMaterial||Ze.isRawShaderMaterial){const bi=Ze.uniformsGroups;for(let ni=0,Fr=bi.length;ni<Fr;ni++){const xi=bi[ni];He.update(xi,vr),He.bind(xi,vr)}}return vr}function De(Te,We){Te.ambientLightColor.needsUpdate=We,Te.lightProbe.needsUpdate=We,Te.directionalLights.needsUpdate=We,Te.directionalLightShadows.needsUpdate=We,Te.pointLights.needsUpdate=We,Te.pointLightShadows.needsUpdate=We,Te.spotLights.needsUpdate=We,Te.spotLightShadows.needsUpdate=We,Te.rectAreaLights.needsUpdate=We,Te.hemisphereLights.needsUpdate=We}function Xe(Te){return Te.isMeshLambertMaterial||Te.isMeshToonMaterial||Te.isMeshPhongMaterial||Te.isMeshStandardMaterial||Te.isShadowMaterial||Te.isShaderMaterial&&Te.lights===!0}this.getActiveCubeFace=function(){return R},this.getActiveMipmapLevel=function(){return A},this.getRenderTarget=function(){return D},this.setRenderTargetTextures=function(Te,We,et){const Ze=fe.get(Te);Ze.__autoAllocateDepthBuffer=Te.resolveDepthBuffer===!1,Ze.__autoAllocateDepthBuffer===!1&&(Ze.__useRenderToTexture=!1),fe.get(Te.texture).__webglTexture=We,fe.get(Te.depthTexture).__webglTexture=Ze.__autoAllocateDepthBuffer?void 0:et,Ze.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(Te,We){const et=fe.get(Te);et.__webglFramebuffer=We,et.__useDefaultFramebuffer=We===void 0};const at=V.createFramebuffer();this.setRenderTarget=function(Te,We=0,et=0){D=Te,R=We,A=et;let Ze=!0,Le=null,mt=!1,st=!1;if(Te){const Nt=fe.get(Te);if(Nt.__useDefaultFramebuffer!==void 0)se.bindFramebuffer(V.FRAMEBUFFER,null),Ze=!1;else if(Nt.__webglFramebuffer===void 0)oe.setupRenderTarget(Te);else if(Nt.__hasExternalTextures)oe.rebindTextures(Te,fe.get(Te.texture).__webglTexture,fe.get(Te.depthTexture).__webglTexture);else if(Te.depthBuffer){const Ft=Te.depthTexture;if(Nt.__boundDepthTexture!==Ft){if(Ft!==null&&fe.has(Ft)&&(Te.width!==Ft.image.width||Te.height!==Ft.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");oe.setupDepthRenderbuffer(Te)}}const Rt=Te.texture;(Rt.isData3DTexture||Rt.isDataArrayTexture||Rt.isCompressedArrayTexture)&&(st=!0);const jt=fe.get(Te).__webglFramebuffer;Te.isWebGLCubeRenderTarget?(Array.isArray(jt[We])?Le=jt[We][et]:Le=jt[We],mt=!0):Te.samples>0&&oe.useMultisampledRTT(Te)===!1?Le=fe.get(Te).__webglMultisampledFramebuffer:Array.isArray(jt)?Le=jt[et]:Le=jt,G.copy(Te.viewport),L.copy(Te.scissor),te=Te.scissorTest}else G.copy(le).multiplyScalar(ge).floor(),L.copy(pe).multiplyScalar(ge).floor(),te=Ce;if(et!==0&&(Le=at),se.bindFramebuffer(V.FRAMEBUFFER,Le)&&Ze&&se.drawBuffers(Te,Le),se.viewport(G),se.scissor(L),se.setScissorTest(te),mt){const Nt=fe.get(Te.texture);V.framebufferTexture2D(V.FRAMEBUFFER,V.COLOR_ATTACHMENT0,V.TEXTURE_CUBE_MAP_POSITIVE_X+We,Nt.__webglTexture,et)}else if(st){const Nt=We;for(let Rt=0;Rt<Te.textures.length;Rt++){const jt=fe.get(Te.textures[Rt]);V.framebufferTextureLayer(V.FRAMEBUFFER,V.COLOR_ATTACHMENT0+Rt,jt.__webglTexture,et,Nt)}}else if(Te!==null&&et!==0){const Nt=fe.get(Te.texture);V.framebufferTexture2D(V.FRAMEBUFFER,V.COLOR_ATTACHMENT0,V.TEXTURE_2D,Nt.__webglTexture,et)}$=-1},this.readRenderTargetPixels=function(Te,We,et,Ze,Le,mt,st,tt=0){if(!(Te&&Te.isWebGLRenderTarget)){$i("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Nt=fe.get(Te).__webglFramebuffer;if(Te.isWebGLCubeRenderTarget&&st!==void 0&&(Nt=Nt[st]),Nt){se.bindFramebuffer(V.FRAMEBUFFER,Nt);try{const Rt=Te.textures[tt],jt=Rt.format,Ft=Rt.type;if(!ne.textureFormatReadable(jt)){$i("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!ne.textureTypeReadable(Ft)){$i("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}We>=0&&We<=Te.width-Ze&&et>=0&&et<=Te.height-Le&&(Te.textures.length>1&&V.readBuffer(V.COLOR_ATTACHMENT0+tt),V.readPixels(We,et,Ze,Le,Ge.convert(jt),Ge.convert(Ft),mt))}finally{const Rt=D!==null?fe.get(D).__webglFramebuffer:null;se.bindFramebuffer(V.FRAMEBUFFER,Rt)}}},this.readRenderTargetPixelsAsync=async function(Te,We,et,Ze,Le,mt,st,tt=0){if(!(Te&&Te.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let Nt=fe.get(Te).__webglFramebuffer;if(Te.isWebGLCubeRenderTarget&&st!==void 0&&(Nt=Nt[st]),Nt)if(We>=0&&We<=Te.width-Ze&&et>=0&&et<=Te.height-Le){se.bindFramebuffer(V.FRAMEBUFFER,Nt);const Rt=Te.textures[tt],jt=Rt.format,Ft=Rt.type;if(!ne.textureFormatReadable(jt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!ne.textureTypeReadable(Ft))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const mn=V.createBuffer();V.bindBuffer(V.PIXEL_PACK_BUFFER,mn),V.bufferData(V.PIXEL_PACK_BUFFER,mt.byteLength,V.STREAM_READ),Te.textures.length>1&&V.readBuffer(V.COLOR_ATTACHMENT0+tt),V.readPixels(We,et,Ze,Le,Ge.convert(jt),Ge.convert(Ft),0);const rn=D!==null?fe.get(D).__webglFramebuffer:null;se.bindFramebuffer(V.FRAMEBUFFER,rn);const vn=V.fenceSync(V.SYNC_GPU_COMMANDS_COMPLETE,0);return V.flush(),await mxe(V,vn,4),V.bindBuffer(V.PIXEL_PACK_BUFFER,mn),V.getBufferSubData(V.PIXEL_PACK_BUFFER,0,mt),V.deleteBuffer(mn),V.deleteSync(vn),mt}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(Te,We=null,et=0){const Ze=Math.pow(2,-et),Le=Math.floor(Te.image.width*Ze),mt=Math.floor(Te.image.height*Ze),st=We!==null?We.x:0,tt=We!==null?We.y:0;oe.setTexture2D(Te,0),V.copyTexSubImage2D(V.TEXTURE_2D,et,0,0,st,tt,Le,mt),se.unbindTexture()};const Ke=V.createFramebuffer(),It=V.createFramebuffer();this.copyTextureToTexture=function(Te,We,et=null,Ze=null,Le=0,mt=null){mt===null&&(Le!==0?(Vv("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."),mt=Le,Le=0):mt=0);let st,tt,Nt,Rt,jt,Ft,mn,rn,vn;const Dn=Te.isCompressedTexture?Te.mipmaps[mt]:Te.image;if(et!==null)st=et.max.x-et.min.x,tt=et.max.y-et.min.y,Nt=et.isBox3?et.max.z-et.min.z:1,Rt=et.min.x,jt=et.min.y,Ft=et.isBox3?et.min.z:0;else{const tr=Math.pow(2,-Le);st=Math.floor(Dn.width*tr),tt=Math.floor(Dn.height*tr),Te.isDataArrayTexture?Nt=Dn.depth:Te.isData3DTexture?Nt=Math.floor(Dn.depth*tr):Nt=1,Rt=0,jt=0,Ft=0}Ze!==null?(mn=Ze.x,rn=Ze.y,vn=Ze.z):(mn=0,rn=0,vn=0);const Bn=Ge.convert(We.format),en=Ge.convert(We.type);let kn;We.isData3DTexture?(oe.setTexture3D(We,0),kn=V.TEXTURE_3D):We.isDataArrayTexture||We.isCompressedArrayTexture?(oe.setTexture2DArray(We,0),kn=V.TEXTURE_2D_ARRAY):(oe.setTexture2D(We,0),kn=V.TEXTURE_2D),V.pixelStorei(V.UNPACK_FLIP_Y_WEBGL,We.flipY),V.pixelStorei(V.UNPACK_PREMULTIPLY_ALPHA_WEBGL,We.premultiplyAlpha),V.pixelStorei(V.UNPACK_ALIGNMENT,We.unpackAlignment);const _n=V.getParameter(V.UNPACK_ROW_LENGTH),vr=V.getParameter(V.UNPACK_IMAGE_HEIGHT),wn=V.getParameter(V.UNPACK_SKIP_PIXELS),lr=V.getParameter(V.UNPACK_SKIP_ROWS),ci=V.getParameter(V.UNPACK_SKIP_IMAGES);V.pixelStorei(V.UNPACK_ROW_LENGTH,Dn.width),V.pixelStorei(V.UNPACK_IMAGE_HEIGHT,Dn.height),V.pixelStorei(V.UNPACK_SKIP_PIXELS,Rt),V.pixelStorei(V.UNPACK_SKIP_ROWS,jt),V.pixelStorei(V.UNPACK_SKIP_IMAGES,Ft);const zn=Te.isDataArrayTexture||Te.isData3DTexture,gi=We.isDataArrayTexture||We.isData3DTexture;if(Te.isDepthTexture){const tr=fe.get(Te),bi=fe.get(We),ni=fe.get(tr.__renderTarget),Fr=fe.get(bi.__renderTarget);se.bindFramebuffer(V.READ_FRAMEBUFFER,ni.__webglFramebuffer),se.bindFramebuffer(V.DRAW_FRAMEBUFFER,Fr.__webglFramebuffer);for(let xi=0;xi<Nt;xi++)zn&&(V.framebufferTextureLayer(V.READ_FRAMEBUFFER,V.COLOR_ATTACHMENT0,fe.get(Te).__webglTexture,Le,Ft+xi),V.framebufferTextureLayer(V.DRAW_FRAMEBUFFER,V.COLOR_ATTACHMENT0,fe.get(We).__webglTexture,mt,vn+xi)),V.blitFramebuffer(Rt,jt,st,tt,mn,rn,st,tt,V.DEPTH_BUFFER_BIT,V.NEAREST);se.bindFramebuffer(V.READ_FRAMEBUFFER,null),se.bindFramebuffer(V.DRAW_FRAMEBUFFER,null)}else if(Le!==0||Te.isRenderTargetTexture||fe.has(Te)){const tr=fe.get(Te),bi=fe.get(We);se.bindFramebuffer(V.READ_FRAMEBUFFER,Ke),se.bindFramebuffer(V.DRAW_FRAMEBUFFER,It);for(let ni=0;ni<Nt;ni++)zn?V.framebufferTextureLayer(V.READ_FRAMEBUFFER,V.COLOR_ATTACHMENT0,tr.__webglTexture,Le,Ft+ni):V.framebufferTexture2D(V.READ_FRAMEBUFFER,V.COLOR_ATTACHMENT0,V.TEXTURE_2D,tr.__webglTexture,Le),gi?V.framebufferTextureLayer(V.DRAW_FRAMEBUFFER,V.COLOR_ATTACHMENT0,bi.__webglTexture,mt,vn+ni):V.framebufferTexture2D(V.DRAW_FRAMEBUFFER,V.COLOR_ATTACHMENT0,V.TEXTURE_2D,bi.__webglTexture,mt),Le!==0?V.blitFramebuffer(Rt,jt,st,tt,mn,rn,st,tt,V.COLOR_BUFFER_BIT,V.NEAREST):gi?V.copyTexSubImage3D(kn,mt,mn,rn,vn+ni,Rt,jt,st,tt):V.copyTexSubImage2D(kn,mt,mn,rn,Rt,jt,st,tt);se.bindFramebuffer(V.READ_FRAMEBUFFER,null),se.bindFramebuffer(V.DRAW_FRAMEBUFFER,null)}else gi?Te.isDataTexture||Te.isData3DTexture?V.texSubImage3D(kn,mt,mn,rn,vn,st,tt,Nt,Bn,en,Dn.data):We.isCompressedArrayTexture?V.compressedTexSubImage3D(kn,mt,mn,rn,vn,st,tt,Nt,Bn,Dn.data):V.texSubImage3D(kn,mt,mn,rn,vn,st,tt,Nt,Bn,en,Dn):Te.isDataTexture?V.texSubImage2D(V.TEXTURE_2D,mt,mn,rn,st,tt,Bn,en,Dn.data):Te.isCompressedTexture?V.compressedTexSubImage2D(V.TEXTURE_2D,mt,mn,rn,Dn.width,Dn.height,Bn,Dn.data):V.texSubImage2D(V.TEXTURE_2D,mt,mn,rn,st,tt,Bn,en,Dn);V.pixelStorei(V.UNPACK_ROW_LENGTH,_n),V.pixelStorei(V.UNPACK_IMAGE_HEIGHT,vr),V.pixelStorei(V.UNPACK_SKIP_PIXELS,wn),V.pixelStorei(V.UNPACK_SKIP_ROWS,lr),V.pixelStorei(V.UNPACK_SKIP_IMAGES,ci),mt===0&&We.generateMipmaps&&V.generateMipmap(kn),se.unbindTexture()},this.initRenderTarget=function(Te){fe.get(Te).__webglFramebuffer===void 0&&oe.setupRenderTarget(Te)},this.initTexture=function(Te){Te.isCubeTexture?oe.setTextureCube(Te,0):Te.isData3DTexture?oe.setTexture3D(Te,0):Te.isDataArrayTexture||Te.isCompressedArrayTexture?oe.setTexture2DArray(Te,0):oe.setTexture2D(Te,0),se.unbindTexture()},this.resetState=function(){R=0,A=0,D=null,se.reset(),xe.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Dc}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const n=this.getContext();n.drawingBufferColorSpace=xr._getDrawingBufferColorSpace(e),n.unpackColorSpace=xr._getUnpackColorSpace()}};const h6={type:"change"},bL={type:"start"},XX={type:"end"},GS=new uL,p6=new pm,VSe=Math.cos(70*pxe.DEG2RAD),ua=new wt,Zs=2*Math.PI,$r={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},OM=1e-6;class GSe extends rye{constructor(e,n=null){super(e,n),this.state=$r.NONE,this.target=new wt,this.cursor=new wt,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:fb.ROTATE,MIDDLE:fb.DOLLY,RIGHT:fb.PAN},this.touches={ONE:ib.ROTATE,TWO:ib.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this._lastPosition=new wt,this._lastQuaternion=new Yp,this._lastTargetPosition=new wt,this._quat=new Yp().setFromUnitVectors(e.up,new wt(0,1,0)),this._quatInverse=this._quat.clone().invert(),this._spherical=new H8,this._sphericalDelta=new H8,this._scale=1,this._panOffset=new wt,this._rotateStart=new Kn,this._rotateEnd=new Kn,this._rotateDelta=new Kn,this._panStart=new Kn,this._panEnd=new Kn,this._panDelta=new Kn,this._dollyStart=new Kn,this._dollyEnd=new Kn,this._dollyDelta=new Kn,this._dollyDirection=new wt,this._mouse=new Kn,this._performCursorZoom=!1,this._pointers=[],this._pointerPositions={},this._controlActive=!1,this._onPointerMove=KSe.bind(this),this._onPointerDown=WSe.bind(this),this._onPointerUp=YSe.bind(this),this._onContextMenu=n_e.bind(this),this._onMouseWheel=ZSe.bind(this),this._onKeyDown=JSe.bind(this),this._onTouchStart=e_e.bind(this),this._onTouchMove=t_e.bind(this),this._onMouseDown=XSe.bind(this),this._onMouseMove=QSe.bind(this),this._interceptControlDown=r_e.bind(this),this._interceptControlUp=i_e.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(h6),this.update(),this.state=$r.NONE}update(e=null){const n=this.object.position;ua.copy(n).sub(this.target),ua.applyQuaternion(this._quat),this._spherical.setFromVector3(ua),this.autoRotate&&this.state===$r.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 r=this.minAzimuthAngle,a=this.maxAzimuthAngle;isFinite(r)&&isFinite(a)&&(r<-Math.PI?r+=Zs:r>Math.PI&&(r-=Zs),a<-Math.PI?a+=Zs:a>Math.PI&&(a-=Zs),r<=a?this._spherical.theta=Math.max(r,Math.min(a,this._spherical.theta)):this._spherical.theta=this._spherical.theta>(r+a)/2?Math.max(r,this._spherical.theta):Math.min(a,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 s=!1;if(this.zoomToCursor&&this._performCursorZoom||this.object.isOrthographicCamera)this._spherical.radius=this._clampDistance(this._spherical.radius);else{const o=this._spherical.radius;this._spherical.radius=this._clampDistance(this._spherical.radius*this._scale),s=o!=this._spherical.radius}if(ua.setFromSpherical(this._spherical),ua.applyQuaternion(this._quatInverse),n.copy(this.target).add(ua),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 o=null;if(this.object.isPerspectiveCamera){const l=ua.length();o=this._clampDistance(l*this._scale);const c=l-o;this.object.position.addScaledVector(this._dollyDirection,c),this.object.updateMatrixWorld(),s=!!c}else if(this.object.isOrthographicCamera){const l=new wt(this._mouse.x,this._mouse.y,0);l.unproject(this.object);const c=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),this.object.updateProjectionMatrix(),s=c!==this.object.zoom;const d=new wt(this._mouse.x,this._mouse.y,0);d.unproject(this.object),this.object.position.sub(d).add(l),this.object.updateMatrixWorld(),o=ua.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),this.zoomToCursor=!1;o!==null&&(this.screenSpacePanning?this.target.set(0,0,-1).transformDirection(this.object.matrix).multiplyScalar(o).add(this.object.position):(GS.origin.copy(this.object.position),GS.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(GS.direction))<VSe?this.object.lookAt(this.target):(p6.setFromNormalAndCoplanarPoint(this.object.up,this.target),GS.intersectPlane(p6,this.target))))}else if(this.object.isOrthographicCamera){const o=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),o!==this.object.zoom&&(this.object.updateProjectionMatrix(),s=!0)}return this._scale=1,this._performCursorZoom=!1,s||this._lastPosition.distanceToSquared(this.object.position)>OM||8*(1-this._lastQuaternion.dot(this.object.quaternion))>OM||this._lastTargetPosition.distanceToSquared(this.target)>OM?(this.dispatchEvent(h6),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0):!1}_getAutoRotationAngle(e){return e!==null?Zs/60*this.autoRotateSpeed*e:Zs/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){ua.setFromMatrixColumn(n,0),ua.multiplyScalar(-e),this._panOffset.add(ua)}_panUp(e,n){this.screenSpacePanning===!0?ua.setFromMatrixColumn(n,1):(ua.setFromMatrixColumn(n,0),ua.crossVectors(this.object.up,ua)),ua.multiplyScalar(e),this._panOffset.add(ua)}_pan(e,n){const r=this.domElement;if(this.object.isPerspectiveCamera){const a=this.object.position;ua.copy(a).sub(this.target);let s=ua.length();s*=Math.tan(this.object.fov/2*Math.PI/180),this._panLeft(2*e*s/r.clientHeight,this.object.matrix),this._panUp(2*n*s/r.clientHeight,this.object.matrix)}else this.object.isOrthographicCamera?(this._panLeft(e*(this.object.right-this.object.left)/this.object.zoom/r.clientWidth,this.object.matrix),this._panUp(n*(this.object.top-this.object.bottom)/this.object.zoom/r.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 r=this.domElement.getBoundingClientRect(),a=e-r.left,s=n-r.top,o=r.width,l=r.height;this._mouse.x=a/o*2-1,this._mouse.y=-(s/l)*2+1,this._dollyDirection.set(this._mouse.x,this._mouse.y,1).unproject(this.object).sub(this.object.position).normalize()}_clampDistance(e){return Math.max(this.minDistance,Math.min(this.maxDistance,e))}_handleMouseDownRotate(e){this._rotateStart.set(e.clientX,e.clientY)}_handleMouseDownDolly(e){this._updateZoomParameters(e.clientX,e.clientX),this._dollyStart.set(e.clientX,e.clientY)}_handleMouseDownPan(e){this._panStart.set(e.clientX,e.clientY)}_handleMouseMoveRotate(e){this._rotateEnd.set(e.clientX,e.clientY),this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const n=this.domElement;this._rotateLeft(Zs*this._rotateDelta.x/n.clientHeight),this._rotateUp(Zs*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(Zs*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(-Zs*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(Zs*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(-Zs*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),r=.5*(e.pageX+n.x),a=.5*(e.pageY+n.y);this._rotateStart.set(r,a)}}_handleTouchStartPan(e){if(this._pointers.length===1)this._panStart.set(e.pageX,e.pageY);else{const n=this._getSecondPointerPosition(e),r=.5*(e.pageX+n.x),a=.5*(e.pageY+n.y);this._panStart.set(r,a)}}_handleTouchStartDolly(e){const n=this._getSecondPointerPosition(e),r=e.pageX-n.x,a=e.pageY-n.y,s=Math.sqrt(r*r+a*a);this._dollyStart.set(0,s)}_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 r=this._getSecondPointerPosition(e),a=.5*(e.pageX+r.x),s=.5*(e.pageY+r.y);this._rotateEnd.set(a,s)}this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const n=this.domElement;this._rotateLeft(Zs*this._rotateDelta.x/n.clientHeight),this._rotateUp(Zs*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),r=.5*(e.pageX+n.x),a=.5*(e.pageY+n.y);this._panEnd.set(r,a)}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),r=e.pageX-n.x,a=e.pageY-n.y,s=Math.sqrt(r*r+a*a);this._dollyEnd.set(0,s),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 o=(e.pageX+n.x)*.5,l=(e.pageY+n.y)*.5;this._updateZoomParameters(o,l)}_handleTouchMoveDollyPan(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enablePan&&this._handleTouchMovePan(e)}_handleTouchMoveDollyRotate(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enableRotate&&this._handleTouchMoveRotate(e)}_addPointer(e){this._pointers.push(e.pointerId)}_removePointer(e){delete this._pointerPositions[e.pointerId];for(let n=0;n<this._pointers.length;n++)if(this._pointers[n]==e.pointerId){this._pointers.splice(n,1);return}}_isTrackingPointer(e){for(let n=0;n<this._pointers.length;n++)if(this._pointers[n]==e.pointerId)return!0;return!1}_trackPointer(e){let n=this._pointerPositions[e.pointerId];n===void 0&&(n=new Kn,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,r={clientX:e.clientX,clientY:e.clientY,deltaY:e.deltaY};switch(n){case 1:r.deltaY*=16;break;case 2:r.deltaY*=100;break}return e.ctrlKey&&!this._controlActive&&(r.deltaY*=10),r}}function WSe(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 KSe(t){this.enabled!==!1&&(t.pointerType==="touch"?this._onTouchMove(t):this._onMouseMove(t))}function YSe(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(XX),this.state=$r.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 XSe(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 fb.DOLLY:if(this.enableZoom===!1)return;this._handleMouseDownDolly(t),this.state=$r.DOLLY;break;case fb.ROTATE:if(t.ctrlKey||t.metaKey||t.shiftKey){if(this.enablePan===!1)return;this._handleMouseDownPan(t),this.state=$r.PAN}else{if(this.enableRotate===!1)return;this._handleMouseDownRotate(t),this.state=$r.ROTATE}break;case fb.PAN:if(t.ctrlKey||t.metaKey||t.shiftKey){if(this.enableRotate===!1)return;this._handleMouseDownRotate(t),this.state=$r.ROTATE}else{if(this.enablePan===!1)return;this._handleMouseDownPan(t),this.state=$r.PAN}break;default:this.state=$r.NONE}this.state!==$r.NONE&&this.dispatchEvent(bL)}function QSe(t){switch(this.state){case $r.ROTATE:if(this.enableRotate===!1)return;this._handleMouseMoveRotate(t);break;case $r.DOLLY:if(this.enableZoom===!1)return;this._handleMouseMoveDolly(t);break;case $r.PAN:if(this.enablePan===!1)return;this._handleMouseMovePan(t);break}}function ZSe(t){this.enabled===!1||this.enableZoom===!1||this.state!==$r.NONE||(t.preventDefault(),this.dispatchEvent(bL),this._handleMouseWheel(this._customWheelEvent(t)),this.dispatchEvent(XX))}function JSe(t){this.enabled!==!1&&this._handleKeyDown(t)}function e_e(t){switch(this._trackPointer(t),this._pointers.length){case 1:switch(this.touches.ONE){case ib.ROTATE:if(this.enableRotate===!1)return;this._handleTouchStartRotate(t),this.state=$r.TOUCH_ROTATE;break;case ib.PAN:if(this.enablePan===!1)return;this._handleTouchStartPan(t),this.state=$r.TOUCH_PAN;break;default:this.state=$r.NONE}break;case 2:switch(this.touches.TWO){case ib.DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchStartDollyPan(t),this.state=$r.TOUCH_DOLLY_PAN;break;case ib.DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchStartDollyRotate(t),this.state=$r.TOUCH_DOLLY_ROTATE;break;default:this.state=$r.NONE}break;default:this.state=$r.NONE}this.state!==$r.NONE&&this.dispatchEvent(bL)}function t_e(t){switch(this._trackPointer(t),this.state){case $r.TOUCH_ROTATE:if(this.enableRotate===!1)return;this._handleTouchMoveRotate(t),this.update();break;case $r.TOUCH_PAN:if(this.enablePan===!1)return;this._handleTouchMovePan(t),this.update();break;case $r.TOUCH_DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchMoveDollyPan(t),this.update();break;case $r.TOUCH_DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchMoveDollyRotate(t),this.update();break;default:this.state=$r.NONE}}function n_e(t){this.enabled!==!1&&t.preventDefault()}function r_e(t){t.key==="Control"&&(this._controlActive=!0,this.domElement.getRootNode().addEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}function i_e(t){t.key==="Control"&&(this._controlActive=!1,this.domElement.getRootNode().removeEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}function a_e(t,e=!1){const n=t[0].index!==null,r=new Set(Object.keys(t[0].attributes)),a=new Set(Object.keys(t[0].morphAttributes)),s={},o={},l=t[0].morphTargetsRelative,c=new _l;let d=0;for(let u=0;u<t.length;++u){const m=t[u];let p=0;if(n!==(m.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(const f in m.attributes){if(!r.has(f))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+'. All geometries must have compatible attributes; make sure "'+f+'" attribute exists among all geometries, or in none of them.'),null;s[f]===void 0&&(s[f]=[]),s[f].push(m.attributes[f]),p++}if(p!==r.size)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". Make sure all geometries have the same number of attributes."),null;if(l!==m.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(const f in m.morphAttributes){if(!a.has(f))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". .morphAttributes must be consistent throughout all geometries."),null;o[f]===void 0&&(o[f]=[]),o[f].push(m.morphAttributes[f])}if(e){let f;if(n)f=m.index.count;else if(m.attributes.position!==void 0)f=m.attributes.position.count;else return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". The geometry must have either an index or a position attribute"),null;c.addGroup(d,f,u),d+=f}}if(n){let u=0;const m=[];for(let p=0;p<t.length;++p){const f=t[p].index;for(let y=0;y<f.count;++y)m.push(f.getX(y)+u);u+=t[p].attributes.position.count}c.setIndex(m)}for(const u in s){const m=f6(s[u]);if(!m)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+u+" attribute."),null;c.setAttribute(u,m)}for(const u in o){const m=o[u][0].length;if(m===0)break;c.morphAttributes=c.morphAttributes||{},c.morphAttributes[u]=[];for(let p=0;p<m;++p){const f=[];for(let x=0;x<o[u].length;++x)f.push(o[u][x][p]);const y=f6(f);if(!y)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+u+" morphAttribute."),null;c.morphAttributes[u].push(y)}}return c}function f6(t){let e,n,r,a=-1,s=0;for(let d=0;d<t.length;++d){const u=t[d];if(e===void 0&&(e=u.array.constructor),e!==u.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=u.itemSize),n!==u.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(r===void 0&&(r=u.normalized),r!==u.normalized)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;if(a===-1&&(a=u.gpuType),a!==u.gpuType)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes."),null;s+=u.count*n}const o=new e(s),l=new Ls(o,n,r);let c=0;for(let d=0;d<t.length;++d){const u=t[d];if(u.isInterleavedBufferAttribute){const m=c/n;for(let p=0,f=u.count;p<f;p++)for(let y=0;y<n;y++){const x=u.getComponent(p,y);l.setComponent(p+m,y,x)}}else o.set(u.array,c);c+=u.count*n}return a!==void 0&&(l.gpuType=a),l}class s_e extends gL{constructor(e){super(e)}load(e,n,r,a){const s=this,o=new Qxe(this.manager);o.setPath(this.path),o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(l){try{n(s.parse(l))}catch(c){a?a(c):console.error(c),s.manager.itemError(e)}},r,a)}parse(e){function n(d){const u=new DataView(d),m=32/8*3+32/8*3*3+16/8,p=u.getUint32(80,!0);if(80+32/8+p*m===u.byteLength)return!0;const y=[115,111,108,105,100];for(let x=0;x<5;x++)if(r(y,u,x))return!1;return!0}function r(d,u,m){for(let p=0,f=d.length;p<f;p++)if(d[p]!==u.getUint8(m+p))return!1;return!0}function a(d){const u=new DataView(d),m=u.getUint32(80,!0);let p,f,y,x=!1,b,v,_,k,P;for(let $=0;$<70;$++)u.getUint32($,!1)==1129270351&&u.getUint8($+4)==82&&u.getUint8($+5)==61&&(x=!0,b=new Float32Array(m*3*3),v=u.getUint8($+6)/255,_=u.getUint8($+7)/255,k=u.getUint8($+8)/255,P=u.getUint8($+9)/255);const C=84,T=50,N=new _l,R=new Float32Array(m*3*3),A=new Float32Array(m*3*3),D=new Zn;for(let $=0;$<m;$++){const U=C+$*T,G=u.getFloat32(U,!0),L=u.getFloat32(U+4,!0),te=u.getFloat32(U+8,!0);if(x){const re=u.getUint16(U+48,!0);(re&32768)===0?(p=(re&31)/31,f=(re>>5&31)/31,y=(re>>10&31)/31):(p=v,f=_,y=k)}for(let re=1;re<=3;re++){const J=U+re*12,ue=$*3*3+(re-1)*3;R[ue]=u.getFloat32(J,!0),R[ue+1]=u.getFloat32(J+4,!0),R[ue+2]=u.getFloat32(J+8,!0),A[ue]=G,A[ue+1]=L,A[ue+2]=te,x&&(D.setRGB(p,f,y,Po),b[ue]=D.r,b[ue+1]=D.g,b[ue+2]=D.b)}}return N.setAttribute("position",new Ls(R,3)),N.setAttribute("normal",new Ls(A,3)),x&&(N.setAttribute("color",new Ls(b,3)),N.hasColors=!0,N.alpha=P),N}function s(d){const u=new _l,m=/solid([\s\S]*?)endsolid/g,p=/facet([\s\S]*?)endfacet/g,f=/solid\s(.+)/;let y=0;const x=/[\s]+([+-]?(?:\d*)(?:\.\d*)?(?:[eE][+-]?\d+)?)/.source,b=new RegExp("vertex"+x+x+x,"g"),v=new RegExp("normal"+x+x+x,"g"),_=[],k=[],P=[],C=new wt;let T,N=0,R=0,A=0;for(;(T=m.exec(d))!==null;){R=A;const D=T[0],$=(T=f.exec(D))!==null?T[1]:"";for(P.push($);(T=p.exec(D))!==null;){let L=0,te=0;const re=T[0];for(;(T=v.exec(re))!==null;)C.x=parseFloat(T[1]),C.y=parseFloat(T[2]),C.z=parseFloat(T[3]),te++;for(;(T=b.exec(re))!==null;)_.push(parseFloat(T[1]),parseFloat(T[2]),parseFloat(T[3])),k.push(C.x,C.y,C.z),L++,A++;te!==1&&console.error("THREE.STLLoader: Something isn't right with the normal of face number "+y),L!==3&&console.error("THREE.STLLoader: Something isn't right with the vertices of face number "+y),y++}const U=R,G=A-R;u.userData.groupNames=P,u.addGroup(U,G,N),N++}return u.setAttribute("position",new Ro(_,3)),u.setAttribute("normal",new Ro(k,3)),u}function o(d){return typeof d!="string"?new TextDecoder().decode(d):d}function l(d){if(typeof d=="string"){const u=new Uint8Array(d.length);for(let m=0;m<d.length;m++)u[m]=d.charCodeAt(m)&255;return u.buffer||u}else return d}const c=l(e);return n(c)?a(c):s(o(e))}}function WS(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 IM={exports:{}};var g6;function o_e(){return g6||(g6=1,(function(t,e){(function(n){t.exports=n()})(function(){return(function n(r,a,s){function o(d,u){if(!a[d]){if(!r[d]){var m=typeof WS=="function"&&WS;if(!u&&m)return m(d,!0);if(l)return l(d,!0);var p=new Error("Cannot find module '"+d+"'");throw p.code="MODULE_NOT_FOUND",p}var f=a[d]={exports:{}};r[d][0].call(f.exports,function(y){var x=r[d][1][y];return o(x||y)},f,f.exports,n,r,a,s)}return a[d].exports}for(var l=typeof WS=="function"&&WS,c=0;c<s.length;c++)o(s[c]);return o})({1:[function(n,r,a){var s=n("./utils"),o=n("./support"),l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";a.encode=function(c){for(var d,u,m,p,f,y,x,b=[],v=0,_=c.length,k=_,P=s.getTypeOf(c)!=="string";v<c.length;)k=_-v,m=P?(d=c[v++],u=v<_?c[v++]:0,v<_?c[v++]:0):(d=c.charCodeAt(v++),u=v<_?c.charCodeAt(v++):0,v<_?c.charCodeAt(v++):0),p=d>>2,f=(3&d)<<4|u>>4,y=1<k?(15&u)<<2|m>>6:64,x=2<k?63&m:64,b.push(l.charAt(p)+l.charAt(f)+l.charAt(y)+l.charAt(x));return b.join("")},a.decode=function(c){var d,u,m,p,f,y,x=0,b=0,v="data:";if(c.substr(0,v.length)===v)throw new Error("Invalid base64 input, it looks like a data url.");var _,k=3*(c=c.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(c.charAt(c.length-1)===l.charAt(64)&&k--,c.charAt(c.length-2)===l.charAt(64)&&k--,k%1!=0)throw new Error("Invalid base64 input, bad content length.");for(_=o.uint8array?new Uint8Array(0|k):new Array(0|k);x<c.length;)d=l.indexOf(c.charAt(x++))<<2|(p=l.indexOf(c.charAt(x++)))>>4,u=(15&p)<<4|(f=l.indexOf(c.charAt(x++)))>>2,m=(3&f)<<6|(y=l.indexOf(c.charAt(x++))),_[b++]=d,f!==64&&(_[b++]=u),y!==64&&(_[b++]=m);return _}},{"./support":30,"./utils":32}],2:[function(n,r,a){var s=n("./external"),o=n("./stream/DataWorker"),l=n("./stream/Crc32Probe"),c=n("./stream/DataLengthProbe");function d(u,m,p,f,y){this.compressedSize=u,this.uncompressedSize=m,this.crc32=p,this.compression=f,this.compressedContent=y}d.prototype={getContentWorker:function(){var u=new o(s.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new c("data_length")),m=this;return u.on("end",function(){if(this.streamInfo.data_length!==m.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),u},getCompressedWorker:function(){return new o(s.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},d.createWorkerFrom=function(u,m,p){return u.pipe(new l).pipe(new c("uncompressedSize")).pipe(m.compressWorker(p)).pipe(new c("compressedSize")).withStreamInfo("compression",m)},r.exports=d},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(n,r,a){var s=n("./stream/GenericWorker");a.STORE={magic:"\0\0",compressWorker:function(){return new s("STORE compression")},uncompressWorker:function(){return new s("STORE decompression")}},a.DEFLATE=n("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(n,r,a){var s=n("./utils"),o=(function(){for(var l,c=[],d=0;d<256;d++){l=d;for(var u=0;u<8;u++)l=1&l?3988292384^l>>>1:l>>>1;c[d]=l}return c})();r.exports=function(l,c){return l!==void 0&&l.length?s.getTypeOf(l)!=="string"?(function(d,u,m,p){var f=o,y=p+m;d^=-1;for(var x=p;x<y;x++)d=d>>>8^f[255&(d^u[x])];return-1^d})(0|c,l,l.length,0):(function(d,u,m,p){var f=o,y=p+m;d^=-1;for(var x=p;x<y;x++)d=d>>>8^f[255&(d^u.charCodeAt(x))];return-1^d})(0|c,l,l.length,0):0}},{"./utils":32}],5:[function(n,r,a){a.base64=!1,a.binary=!1,a.dir=!1,a.createFolders=!0,a.date=null,a.compression=null,a.compressionOptions=null,a.comment=null,a.unixPermissions=null,a.dosPermissions=null},{}],6:[function(n,r,a){var s=null;s=typeof Promise<"u"?Promise:n("lie"),r.exports={Promise:s}},{lie:37}],7:[function(n,r,a){var s=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",o=n("pako"),l=n("./utils"),c=n("./stream/GenericWorker"),d=s?"uint8array":"array";function u(m,p){c.call(this,"FlateWorker/"+m),this._pako=null,this._pakoAction=m,this._pakoOptions=p,this.meta={}}a.magic="\b\0",l.inherits(u,c),u.prototype.processChunk=function(m){this.meta=m.meta,this._pako===null&&this._createPako(),this._pako.push(l.transformTo(d,m.data),!1)},u.prototype.flush=function(){c.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},u.prototype.cleanUp=function(){c.prototype.cleanUp.call(this),this._pako=null},u.prototype._createPako=function(){this._pako=new o[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var m=this;this._pako.onData=function(p){m.push({data:p,meta:m.meta})}},a.compressWorker=function(m){return new u("Deflate",m)},a.uncompressWorker=function(){return new u("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(n,r,a){function s(f,y){var x,b="";for(x=0;x<y;x++)b+=String.fromCharCode(255&f),f>>>=8;return b}function o(f,y,x,b,v,_){var k,P,C=f.file,T=f.compression,N=_!==d.utf8encode,R=l.transformTo("string",_(C.name)),A=l.transformTo("string",d.utf8encode(C.name)),D=C.comment,$=l.transformTo("string",_(D)),U=l.transformTo("string",d.utf8encode(D)),G=A.length!==C.name.length,L=U.length!==D.length,te="",re="",J="",ue=C.dir,me=C.date,ge={crc32:0,compressedSize:0,uncompressedSize:0};y&&!x||(ge.crc32=f.crc32,ge.compressedSize=f.compressedSize,ge.uncompressedSize=f.uncompressedSize);var X=0;y&&(X|=8),N||!G&&!L||(X|=2048);var ie=0,le=0;ue&&(ie|=16),v==="UNIX"?(le=798,ie|=(function(Ce,q){var Z=Ce;return Ce||(Z=q?16893:33204),(65535&Z)<<16})(C.unixPermissions,ue)):(le=20,ie|=(function(Ce){return 63&(Ce||0)})(C.dosPermissions)),k=me.getUTCHours(),k<<=6,k|=me.getUTCMinutes(),k<<=5,k|=me.getUTCSeconds()/2,P=me.getUTCFullYear()-1980,P<<=4,P|=me.getUTCMonth()+1,P<<=5,P|=me.getUTCDate(),G&&(re=s(1,1)+s(u(R),4)+A,te+="up"+s(re.length,2)+re),L&&(J=s(1,1)+s(u($),4)+U,te+="uc"+s(J.length,2)+J);var pe="";return pe+=`
- \0`,pe+=s(X,2),pe+=T.magic,pe+=s(k,2),pe+=s(P,2),pe+=s(ge.crc32,4),pe+=s(ge.compressedSize,4),pe+=s(ge.uncompressedSize,4),pe+=s(R.length,2),pe+=s(te.length,2),{fileRecord:m.LOCAL_FILE_HEADER+pe+R+te,dirRecord:m.CENTRAL_FILE_HEADER+s(le,2)+pe+s($.length,2)+"\0\0\0\0"+s(ie,4)+s(b,4)+R+te+$}}var l=n("../utils"),c=n("../stream/GenericWorker"),d=n("../utf8"),u=n("../crc32"),m=n("../signature");function p(f,y,x,b){c.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=y,this.zipPlatform=x,this.encodeFileName=b,this.streamFiles=f,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}l.inherits(p,c),p.prototype.push=function(f){var y=f.meta.percent||0,x=this.entriesCount,b=this._sources.length;this.accumulate?this.contentBuffer.push(f):(this.bytesWritten+=f.data.length,c.prototype.push.call(this,{data:f.data,meta:{currentFile:this.currentFile,percent:x?(y+100*(x-b-1))/x:100}}))},p.prototype.openedSource=function(f){this.currentSourceOffset=this.bytesWritten,this.currentFile=f.file.name;var y=this.streamFiles&&!f.file.dir;if(y){var x=o(f,y,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:x.fileRecord,meta:{percent:0}})}else this.accumulate=!0},p.prototype.closedSource=function(f){this.accumulate=!1;var y=this.streamFiles&&!f.file.dir,x=o(f,y,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(x.dirRecord),y)this.push({data:(function(b){return m.DATA_DESCRIPTOR+s(b.crc32,4)+s(b.compressedSize,4)+s(b.uncompressedSize,4)})(f),meta:{percent:100}});else for(this.push({data:x.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},p.prototype.flush=function(){for(var f=this.bytesWritten,y=0;y<this.dirRecords.length;y++)this.push({data:this.dirRecords[y],meta:{percent:100}});var x=this.bytesWritten-f,b=(function(v,_,k,P,C){var T=l.transformTo("string",C(P));return m.CENTRAL_DIRECTORY_END+"\0\0\0\0"+s(v,2)+s(v,2)+s(_,4)+s(k,4)+s(T.length,2)+T})(this.dirRecords.length,x,f,this.zipComment,this.encodeFileName);this.push({data:b,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(f){this._sources.push(f);var y=this;return f.on("data",function(x){y.processChunk(x)}),f.on("end",function(){y.closedSource(y.previous.streamInfo),y._sources.length?y.prepareNextSource():y.end()}),f.on("error",function(x){y.error(x)}),this},p.prototype.resume=function(){return!!c.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},p.prototype.error=function(f){var y=this._sources;if(!c.prototype.error.call(this,f))return!1;for(var x=0;x<y.length;x++)try{y[x].error(f)}catch{}return!0},p.prototype.lock=function(){c.prototype.lock.call(this);for(var f=this._sources,y=0;y<f.length;y++)f[y].lock()},r.exports=p},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(n,r,a){var s=n("../compressions"),o=n("./ZipFileWorker");a.generateWorker=function(l,c,d){var u=new o(c.streamFiles,d,c.platform,c.encodeFileName),m=0;try{l.forEach(function(p,f){m++;var y=(function(_,k){var P=_||k,C=s[P];if(!C)throw new Error(P+" is not a valid compression method !");return C})(f.options.compression,c.compression),x=f.options.compressionOptions||c.compressionOptions||{},b=f.dir,v=f.date;f._compressWorker(y,x).withStreamInfo("file",{name:p,dir:b,date:v,comment:f.comment||"",unixPermissions:f.unixPermissions,dosPermissions:f.dosPermissions}).pipe(u)}),u.entriesCount=m}catch(p){u.error(p)}return u}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(n,r,a){function s(){if(!(this instanceof s))return new s;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 o=new s;for(var l in this)typeof this[l]!="function"&&(o[l]=this[l]);return o}}(s.prototype=n("./object")).loadAsync=n("./load"),s.support=n("./support"),s.defaults=n("./defaults"),s.version="3.10.1",s.loadAsync=function(o,l){return new s().loadAsync(o,l)},s.external=n("./external"),r.exports=s},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(n,r,a){var s=n("./utils"),o=n("./external"),l=n("./utf8"),c=n("./zipEntries"),d=n("./stream/Crc32Probe"),u=n("./nodejsUtils");function m(p){return new o.Promise(function(f,y){var x=p.decompressed.getContentWorker().pipe(new d);x.on("error",function(b){y(b)}).on("end",function(){x.streamInfo.crc32!==p.decompressed.crc32?y(new Error("Corrupted zip : CRC32 mismatch")):f()}).resume()})}r.exports=function(p,f){var y=this;return f=s.extend(f||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:l.utf8decode}),u.isNode&&u.isStream(p)?o.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):s.prepareContent("the loaded zip file",p,!0,f.optimizedBinaryString,f.base64).then(function(x){var b=new c(f);return b.load(x),b}).then(function(x){var b=[o.Promise.resolve(x)],v=x.files;if(f.checkCRC32)for(var _=0;_<v.length;_++)b.push(m(v[_]));return o.Promise.all(b)}).then(function(x){for(var b=x.shift(),v=b.files,_=0;_<v.length;_++){var k=v[_],P=k.fileNameStr,C=s.resolve(k.fileNameStr);y.file(C,k.decompressed,{binary:!0,optimizedBinaryString:!0,date:k.date,dir:k.dir,comment:k.fileCommentStr.length?k.fileCommentStr:null,unixPermissions:k.unixPermissions,dosPermissions:k.dosPermissions,createFolders:f.createFolders}),k.dir||(y.file(C).unsafeOriginalName=P)}return b.zipComment.length&&(y.comment=b.zipComment),y})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(n,r,a){var s=n("../utils"),o=n("../stream/GenericWorker");function l(c,d){o.call(this,"Nodejs stream input adapter for "+c),this._upstreamEnded=!1,this._bindStream(d)}s.inherits(l,o),l.prototype._bindStream=function(c){var d=this;(this._stream=c).pause(),c.on("data",function(u){d.push({data:u,meta:{percent:0}})}).on("error",function(u){d.isPaused?this.generatedError=u:d.error(u)}).on("end",function(){d.isPaused?d._upstreamEnded=!0:d.end()})},l.prototype.pause=function(){return!!o.prototype.pause.call(this)&&(this._stream.pause(),!0)},l.prototype.resume=function(){return!!o.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},r.exports=l},{"../stream/GenericWorker":28,"../utils":32}],13:[function(n,r,a){var s=n("readable-stream").Readable;function o(l,c,d){s.call(this,c),this._helper=l;var u=this;l.on("data",function(m,p){u.push(m)||u._helper.pause(),d&&d(p)}).on("error",function(m){u.emit("error",m)}).on("end",function(){u.push(null)})}n("../utils").inherits(o,s),o.prototype._read=function(){this._helper.resume()},r.exports=o},{"../utils":32,"readable-stream":16}],14:[function(n,r,a){r.exports={isNode:typeof Buffer<"u",newBufferFrom:function(s,o){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(s,o);if(typeof s=="number")throw new Error('The "data" argument must not be a number');return new Buffer(s,o)},allocBuffer:function(s){if(Buffer.alloc)return Buffer.alloc(s);var o=new Buffer(s);return o.fill(0),o},isBuffer:function(s){return Buffer.isBuffer(s)},isStream:function(s){return s&&typeof s.on=="function"&&typeof s.pause=="function"&&typeof s.resume=="function"}}},{}],15:[function(n,r,a){function s(C,T,N){var R,A=l.getTypeOf(T),D=l.extend(N||{},u);D.date=D.date||new Date,D.compression!==null&&(D.compression=D.compression.toUpperCase()),typeof D.unixPermissions=="string"&&(D.unixPermissions=parseInt(D.unixPermissions,8)),D.unixPermissions&&16384&D.unixPermissions&&(D.dir=!0),D.dosPermissions&&16&D.dosPermissions&&(D.dir=!0),D.dir&&(C=v(C)),D.createFolders&&(R=b(C))&&_.call(this,R,!0);var $=A==="string"&&D.binary===!1&&D.base64===!1;N&&N.binary!==void 0||(D.binary=!$),(T instanceof m&&T.uncompressedSize===0||D.dir||!T||T.length===0)&&(D.base64=!1,D.binary=!0,T="",D.compression="STORE",A="string");var U=null;U=T instanceof m||T instanceof c?T:y.isNode&&y.isStream(T)?new x(C,T):l.prepareContent(C,T,D.binary,D.optimizedBinaryString,D.base64);var G=new p(C,U,D);this.files[C]=G}var o=n("./utf8"),l=n("./utils"),c=n("./stream/GenericWorker"),d=n("./stream/StreamHelper"),u=n("./defaults"),m=n("./compressedObject"),p=n("./zipObject"),f=n("./generate"),y=n("./nodejsUtils"),x=n("./nodejs/NodejsStreamInputAdapter"),b=function(C){C.slice(-1)==="/"&&(C=C.substring(0,C.length-1));var T=C.lastIndexOf("/");return 0<T?C.substring(0,T):""},v=function(C){return C.slice(-1)!=="/"&&(C+="/"),C},_=function(C,T){return T=T!==void 0?T:u.createFolders,C=v(C),this.files[C]||s.call(this,C,null,{dir:!0,createFolders:T}),this.files[C]};function k(C){return Object.prototype.toString.call(C)==="[object RegExp]"}var P={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(C){var T,N,R;for(T in this.files)R=this.files[T],(N=T.slice(this.root.length,T.length))&&T.slice(0,this.root.length)===this.root&&C(N,R)},filter:function(C){var T=[];return this.forEach(function(N,R){C(N,R)&&T.push(R)}),T},file:function(C,T,N){if(arguments.length!==1)return C=this.root+C,s.call(this,C,T,N),this;if(k(C)){var R=C;return this.filter(function(D,$){return!$.dir&&R.test(D)})}var A=this.files[this.root+C];return A&&!A.dir?A:null},folder:function(C){if(!C)return this;if(k(C))return this.filter(function(A,D){return D.dir&&C.test(A)});var T=this.root+C,N=_.call(this,T),R=this.clone();return R.root=N.name,R},remove:function(C){C=this.root+C;var T=this.files[C];if(T||(C.slice(-1)!=="/"&&(C+="/"),T=this.files[C]),T&&!T.dir)delete this.files[C];else for(var N=this.filter(function(A,D){return D.name.slice(0,C.length)===C}),R=0;R<N.length;R++)delete this.files[N[R].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(C){var T,N={};try{if((N=l.extend(C||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:o.utf8encode})).type=N.type.toLowerCase(),N.compression=N.compression.toUpperCase(),N.type==="binarystring"&&(N.type="string"),!N.type)throw new Error("No output type specified.");l.checkSupport(N.type),N.platform!=="darwin"&&N.platform!=="freebsd"&&N.platform!=="linux"&&N.platform!=="sunos"||(N.platform="UNIX"),N.platform==="win32"&&(N.platform="DOS");var R=N.comment||this.comment||"";T=f.generateWorker(this,N,R)}catch(A){(T=new c("error")).error(A)}return new d(T,N.type||"string",N.mimeType)},generateAsync:function(C,T){return this.generateInternalStream(C).accumulate(T)},generateNodeStream:function(C,T){return(C=C||{}).type||(C.type="nodebuffer"),this.generateInternalStream(C).toNodejsStream(T)}};r.exports=P},{"./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,r,a){r.exports=n("stream")},{stream:void 0}],17:[function(n,r,a){var s=n("./DataReader");function o(l){s.call(this,l);for(var c=0;c<this.data.length;c++)l[c]=255&l[c]}n("../utils").inherits(o,s),o.prototype.byteAt=function(l){return this.data[this.zero+l]},o.prototype.lastIndexOfSignature=function(l){for(var c=l.charCodeAt(0),d=l.charCodeAt(1),u=l.charCodeAt(2),m=l.charCodeAt(3),p=this.length-4;0<=p;--p)if(this.data[p]===c&&this.data[p+1]===d&&this.data[p+2]===u&&this.data[p+3]===m)return p-this.zero;return-1},o.prototype.readAndCheckSignature=function(l){var c=l.charCodeAt(0),d=l.charCodeAt(1),u=l.charCodeAt(2),m=l.charCodeAt(3),p=this.readData(4);return c===p[0]&&d===p[1]&&u===p[2]&&m===p[3]},o.prototype.readData=function(l){if(this.checkOffset(l),l===0)return[];var c=this.data.slice(this.zero+this.index,this.zero+this.index+l);return this.index+=l,c},r.exports=o},{"../utils":32,"./DataReader":18}],18:[function(n,r,a){var s=n("../utils");function o(l){this.data=l,this.length=l.length,this.index=0,this.zero=0}o.prototype={checkOffset:function(l){this.checkIndex(this.index+l)},checkIndex:function(l){if(this.length<this.zero+l||l<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+l+"). Corrupted zip ?")},setIndex:function(l){this.checkIndex(l),this.index=l},skip:function(l){this.setIndex(this.index+l)},byteAt:function(){},readInt:function(l){var c,d=0;for(this.checkOffset(l),c=this.index+l-1;c>=this.index;c--)d=(d<<8)+this.byteAt(c);return this.index+=l,d},readString:function(l){return s.transformTo("string",this.readData(l))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var l=this.readInt(4);return new Date(Date.UTC(1980+(l>>25&127),(l>>21&15)-1,l>>16&31,l>>11&31,l>>5&63,(31&l)<<1))}},r.exports=o},{"../utils":32}],19:[function(n,r,a){var s=n("./Uint8ArrayReader");function o(l){s.call(this,l)}n("../utils").inherits(o,s),o.prototype.readData=function(l){this.checkOffset(l);var c=this.data.slice(this.zero+this.index,this.zero+this.index+l);return this.index+=l,c},r.exports=o},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(n,r,a){var s=n("./DataReader");function o(l){s.call(this,l)}n("../utils").inherits(o,s),o.prototype.byteAt=function(l){return this.data.charCodeAt(this.zero+l)},o.prototype.lastIndexOfSignature=function(l){return this.data.lastIndexOf(l)-this.zero},o.prototype.readAndCheckSignature=function(l){return l===this.readData(4)},o.prototype.readData=function(l){this.checkOffset(l);var c=this.data.slice(this.zero+this.index,this.zero+this.index+l);return this.index+=l,c},r.exports=o},{"../utils":32,"./DataReader":18}],21:[function(n,r,a){var s=n("./ArrayReader");function o(l){s.call(this,l)}n("../utils").inherits(o,s),o.prototype.readData=function(l){if(this.checkOffset(l),l===0)return new Uint8Array(0);var c=this.data.subarray(this.zero+this.index,this.zero+this.index+l);return this.index+=l,c},r.exports=o},{"../utils":32,"./ArrayReader":17}],22:[function(n,r,a){var s=n("../utils"),o=n("../support"),l=n("./ArrayReader"),c=n("./StringReader"),d=n("./NodeBufferReader"),u=n("./Uint8ArrayReader");r.exports=function(m){var p=s.getTypeOf(m);return s.checkSupport(p),p!=="string"||o.uint8array?p==="nodebuffer"?new d(m):o.uint8array?new u(s.transformTo("uint8array",m)):new l(s.transformTo("array",m)):new c(m)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(n,r,a){a.LOCAL_FILE_HEADER="PK",a.CENTRAL_FILE_HEADER="PK",a.CENTRAL_DIRECTORY_END="PK",a.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",a.ZIP64_CENTRAL_DIRECTORY_END="PK",a.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(n,r,a){var s=n("./GenericWorker"),o=n("../utils");function l(c){s.call(this,"ConvertWorker to "+c),this.destType=c}o.inherits(l,s),l.prototype.processChunk=function(c){this.push({data:o.transformTo(this.destType,c.data),meta:c.meta})},r.exports=l},{"../utils":32,"./GenericWorker":28}],25:[function(n,r,a){var s=n("./GenericWorker"),o=n("../crc32");function l(){s.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}n("../utils").inherits(l,s),l.prototype.processChunk=function(c){this.streamInfo.crc32=o(c.data,this.streamInfo.crc32||0),this.push(c)},r.exports=l},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(n,r,a){var s=n("../utils"),o=n("./GenericWorker");function l(c){o.call(this,"DataLengthProbe for "+c),this.propName=c,this.withStreamInfo(c,0)}s.inherits(l,o),l.prototype.processChunk=function(c){if(c){var d=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=d+c.data.length}o.prototype.processChunk.call(this,c)},r.exports=l},{"../utils":32,"./GenericWorker":28}],27:[function(n,r,a){var s=n("../utils"),o=n("./GenericWorker");function l(c){o.call(this,"DataWorker");var d=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,c.then(function(u){d.dataIsReady=!0,d.data=u,d.max=u&&u.length||0,d.type=s.getTypeOf(u),d.isPaused||d._tickAndRepeat()},function(u){d.error(u)})}s.inherits(l,o),l.prototype.cleanUp=function(){o.prototype.cleanUp.call(this),this.data=null},l.prototype.resume=function(){return!!o.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,s.delay(this._tickAndRepeat,[],this)),!0)},l.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(s.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},l.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var c=null,d=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":c=this.data.substring(this.index,d);break;case"uint8array":c=this.data.subarray(this.index,d);break;case"array":case"nodebuffer":c=this.data.slice(this.index,d)}return this.index=d,this.push({data:c,meta:{percent:this.max?this.index/this.max*100:0}})},r.exports=l},{"../utils":32,"./GenericWorker":28}],28:[function(n,r,a){function s(o){this.name=o||"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}s.prototype={push:function(o){this.emit("data",o)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(o){this.emit("error",o)}return!0},error:function(o){return!this.isFinished&&(this.isPaused?this.generatedError=o:(this.isFinished=!0,this.emit("error",o),this.previous&&this.previous.error(o),this.cleanUp()),!0)},on:function(o,l){return this._listeners[o].push(l),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(o,l){if(this._listeners[o])for(var c=0;c<this._listeners[o].length;c++)this._listeners[o][c].call(this,l)},pipe:function(o){return o.registerPrevious(this)},registerPrevious:function(o){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=o.streamInfo,this.mergeStreamInfo(),this.previous=o;var l=this;return o.on("data",function(c){l.processChunk(c)}),o.on("end",function(){l.end()}),o.on("error",function(c){l.error(c)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var o=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),o=!0),this.previous&&this.previous.resume(),!o},flush:function(){},processChunk:function(o){this.push(o)},withStreamInfo:function(o,l){return this.extraStreamInfo[o]=l,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var o in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,o)&&(this.streamInfo[o]=this.extraStreamInfo[o])},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 o="Worker "+this.name;return this.previous?this.previous+" -> "+o:o}},r.exports=s},{}],29:[function(n,r,a){var s=n("../utils"),o=n("./ConvertWorker"),l=n("./GenericWorker"),c=n("../base64"),d=n("../support"),u=n("../external"),m=null;if(d.nodestream)try{m=n("../nodejs/NodejsStreamOutputAdapter")}catch{}function p(y,x){return new u.Promise(function(b,v){var _=[],k=y._internalType,P=y._outputType,C=y._mimeType;y.on("data",function(T,N){_.push(T),x&&x(N)}).on("error",function(T){_=[],v(T)}).on("end",function(){try{var T=(function(N,R,A){switch(N){case"blob":return s.newBlob(s.transformTo("arraybuffer",R),A);case"base64":return c.encode(R);default:return s.transformTo(N,R)}})(P,(function(N,R){var A,D=0,$=null,U=0;for(A=0;A<R.length;A++)U+=R[A].length;switch(N){case"string":return R.join("");case"array":return Array.prototype.concat.apply([],R);case"uint8array":for($=new Uint8Array(U),A=0;A<R.length;A++)$.set(R[A],D),D+=R[A].length;return $;case"nodebuffer":return Buffer.concat(R);default:throw new Error("concat : unsupported type '"+N+"'")}})(k,_),C);b(T)}catch(N){v(N)}_=[]}).resume()})}function f(y,x,b){var v=x;switch(x){case"blob":case"arraybuffer":v="uint8array";break;case"base64":v="string"}try{this._internalType=v,this._outputType=x,this._mimeType=b,s.checkSupport(v),this._worker=y.pipe(new o(v)),y.lock()}catch(_){this._worker=new l("error"),this._worker.error(_)}}f.prototype={accumulate:function(y){return p(this,y)},on:function(y,x){var b=this;return y==="data"?this._worker.on(y,function(v){x.call(b,v.data,v.meta)}):this._worker.on(y,function(){s.delay(x,arguments,b)}),this},resume:function(){return s.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(y){if(s.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new m(this,{objectMode:this._outputType!=="nodebuffer"},y)}},r.exports=f},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(n,r,a){if(a.base64=!0,a.array=!0,a.string=!0,a.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",a.nodebuffer=typeof Buffer<"u",a.uint8array=typeof Uint8Array<"u",typeof ArrayBuffer>"u")a.blob=!1;else{var s=new ArrayBuffer(0);try{a.blob=new Blob([s],{type:"application/zip"}).size===0}catch{try{var o=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);o.append(s),a.blob=o.getBlob("application/zip").size===0}catch{a.blob=!1}}}try{a.nodestream=!!n("readable-stream").Readable}catch{a.nodestream=!1}},{"readable-stream":16}],31:[function(n,r,a){for(var s=n("./utils"),o=n("./support"),l=n("./nodejsUtils"),c=n("./stream/GenericWorker"),d=new Array(256),u=0;u<256;u++)d[u]=252<=u?6:248<=u?5:240<=u?4:224<=u?3:192<=u?2:1;d[254]=d[254]=1;function m(){c.call(this,"utf-8 decode"),this.leftOver=null}function p(){c.call(this,"utf-8 encode")}a.utf8encode=function(f){return o.nodebuffer?l.newBufferFrom(f,"utf-8"):(function(y){var x,b,v,_,k,P=y.length,C=0;for(_=0;_<P;_++)(64512&(b=y.charCodeAt(_)))==55296&&_+1<P&&(64512&(v=y.charCodeAt(_+1)))==56320&&(b=65536+(b-55296<<10)+(v-56320),_++),C+=b<128?1:b<2048?2:b<65536?3:4;for(x=o.uint8array?new Uint8Array(C):new Array(C),_=k=0;k<C;_++)(64512&(b=y.charCodeAt(_)))==55296&&_+1<P&&(64512&(v=y.charCodeAt(_+1)))==56320&&(b=65536+(b-55296<<10)+(v-56320),_++),b<128?x[k++]=b:(b<2048?x[k++]=192|b>>>6:(b<65536?x[k++]=224|b>>>12:(x[k++]=240|b>>>18,x[k++]=128|b>>>12&63),x[k++]=128|b>>>6&63),x[k++]=128|63&b);return x})(f)},a.utf8decode=function(f){return o.nodebuffer?s.transformTo("nodebuffer",f).toString("utf-8"):(function(y){var x,b,v,_,k=y.length,P=new Array(2*k);for(x=b=0;x<k;)if((v=y[x++])<128)P[b++]=v;else if(4<(_=d[v]))P[b++]=65533,x+=_-1;else{for(v&=_===2?31:_===3?15:7;1<_&&x<k;)v=v<<6|63&y[x++],_--;1<_?P[b++]=65533:v<65536?P[b++]=v:(v-=65536,P[b++]=55296|v>>10&1023,P[b++]=56320|1023&v)}return P.length!==b&&(P.subarray?P=P.subarray(0,b):P.length=b),s.applyFromCharCode(P)})(f=s.transformTo(o.uint8array?"uint8array":"array",f))},s.inherits(m,c),m.prototype.processChunk=function(f){var y=s.transformTo(o.uint8array?"uint8array":"array",f.data);if(this.leftOver&&this.leftOver.length){if(o.uint8array){var x=y;(y=new Uint8Array(x.length+this.leftOver.length)).set(this.leftOver,0),y.set(x,this.leftOver.length)}else y=this.leftOver.concat(y);this.leftOver=null}var b=(function(_,k){var P;for((k=k||_.length)>_.length&&(k=_.length),P=k-1;0<=P&&(192&_[P])==128;)P--;return P<0||P===0?k:P+d[_[P]]>k?P:k})(y),v=y;b!==y.length&&(o.uint8array?(v=y.subarray(0,b),this.leftOver=y.subarray(b,y.length)):(v=y.slice(0,b),this.leftOver=y.slice(b,y.length))),this.push({data:a.utf8decode(v),meta:f.meta})},m.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:a.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},a.Utf8DecodeWorker=m,s.inherits(p,c),p.prototype.processChunk=function(f){this.push({data:a.utf8encode(f.data),meta:f.meta})},a.Utf8EncodeWorker=p},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(n,r,a){var s=n("./support"),o=n("./base64"),l=n("./nodejsUtils"),c=n("./external");function d(x){return x}function u(x,b){for(var v=0;v<x.length;++v)b[v]=255&x.charCodeAt(v);return b}n("setimmediate"),a.newBlob=function(x,b){a.checkSupport("blob");try{return new Blob([x],{type:b})}catch{try{var v=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return v.append(x),v.getBlob(b)}catch{throw new Error("Bug : can't construct the Blob.")}}};var m={stringifyByChunk:function(x,b,v){var _=[],k=0,P=x.length;if(P<=v)return String.fromCharCode.apply(null,x);for(;k<P;)b==="array"||b==="nodebuffer"?_.push(String.fromCharCode.apply(null,x.slice(k,Math.min(k+v,P)))):_.push(String.fromCharCode.apply(null,x.subarray(k,Math.min(k+v,P)))),k+=v;return _.join("")},stringifyByChar:function(x){for(var b="",v=0;v<x.length;v++)b+=String.fromCharCode(x[v]);return b},applyCanBeUsed:{uint8array:(function(){try{return s.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch{return!1}})(),nodebuffer:(function(){try{return s.nodebuffer&&String.fromCharCode.apply(null,l.allocBuffer(1)).length===1}catch{return!1}})()}};function p(x){var b=65536,v=a.getTypeOf(x),_=!0;if(v==="uint8array"?_=m.applyCanBeUsed.uint8array:v==="nodebuffer"&&(_=m.applyCanBeUsed.nodebuffer),_)for(;1<b;)try{return m.stringifyByChunk(x,v,b)}catch{b=Math.floor(b/2)}return m.stringifyByChar(x)}function f(x,b){for(var v=0;v<x.length;v++)b[v]=x[v];return b}a.applyFromCharCode=p;var y={};y.string={string:d,array:function(x){return u(x,new Array(x.length))},arraybuffer:function(x){return y.string.uint8array(x).buffer},uint8array:function(x){return u(x,new Uint8Array(x.length))},nodebuffer:function(x){return u(x,l.allocBuffer(x.length))}},y.array={string:p,array:d,arraybuffer:function(x){return new Uint8Array(x).buffer},uint8array:function(x){return new Uint8Array(x)},nodebuffer:function(x){return l.newBufferFrom(x)}},y.arraybuffer={string:function(x){return p(new Uint8Array(x))},array:function(x){return f(new Uint8Array(x),new Array(x.byteLength))},arraybuffer:d,uint8array:function(x){return new Uint8Array(x)},nodebuffer:function(x){return l.newBufferFrom(new Uint8Array(x))}},y.uint8array={string:p,array:function(x){return f(x,new Array(x.length))},arraybuffer:function(x){return x.buffer},uint8array:d,nodebuffer:function(x){return l.newBufferFrom(x)}},y.nodebuffer={string:p,array:function(x){return f(x,new Array(x.length))},arraybuffer:function(x){return y.nodebuffer.uint8array(x).buffer},uint8array:function(x){return f(x,new Uint8Array(x.length))},nodebuffer:d},a.transformTo=function(x,b){if(b=b||"",!x)return b;a.checkSupport(x);var v=a.getTypeOf(b);return y[v][x](b)},a.resolve=function(x){for(var b=x.split("/"),v=[],_=0;_<b.length;_++){var k=b[_];k==="."||k===""&&_!==0&&_!==b.length-1||(k===".."?v.pop():v.push(k))}return v.join("/")},a.getTypeOf=function(x){return typeof x=="string"?"string":Object.prototype.toString.call(x)==="[object Array]"?"array":s.nodebuffer&&l.isBuffer(x)?"nodebuffer":s.uint8array&&x instanceof Uint8Array?"uint8array":s.arraybuffer&&x instanceof ArrayBuffer?"arraybuffer":void 0},a.checkSupport=function(x){if(!s[x.toLowerCase()])throw new Error(x+" is not supported by this platform")},a.MAX_VALUE_16BITS=65535,a.MAX_VALUE_32BITS=-1,a.pretty=function(x){var b,v,_="";for(v=0;v<(x||"").length;v++)_+="\\x"+((b=x.charCodeAt(v))<16?"0":"")+b.toString(16).toUpperCase();return _},a.delay=function(x,b,v){setImmediate(function(){x.apply(v||null,b||[])})},a.inherits=function(x,b){function v(){}v.prototype=b.prototype,x.prototype=new v},a.extend=function(){var x,b,v={};for(x=0;x<arguments.length;x++)for(b in arguments[x])Object.prototype.hasOwnProperty.call(arguments[x],b)&&v[b]===void 0&&(v[b]=arguments[x][b]);return v},a.prepareContent=function(x,b,v,_,k){return c.Promise.resolve(b).then(function(P){return s.blob&&(P instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(P))!==-1)&&typeof FileReader<"u"?new c.Promise(function(C,T){var N=new FileReader;N.onload=function(R){C(R.target.result)},N.onerror=function(R){T(R.target.error)},N.readAsArrayBuffer(P)}):P}).then(function(P){var C=a.getTypeOf(P);return C?(C==="arraybuffer"?P=a.transformTo("uint8array",P):C==="string"&&(k?P=o.decode(P):v&&_!==!0&&(P=(function(T){return u(T,s.uint8array?new Uint8Array(T.length):new Array(T.length))})(P))),P):c.Promise.reject(new Error("Can't read the data of '"+x+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(n,r,a){var s=n("./reader/readerFor"),o=n("./utils"),l=n("./signature"),c=n("./zipEntry"),d=n("./support");function u(m){this.files=[],this.loadOptions=m}u.prototype={checkSignature:function(m){if(!this.reader.readAndCheckSignature(m)){this.reader.index-=4;var p=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+o.pretty(p)+", expected "+o.pretty(m)+")")}},isSignature:function(m,p){var f=this.reader.index;this.reader.setIndex(m);var y=this.reader.readString(4)===p;return this.reader.setIndex(f),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 m=this.reader.readData(this.zipCommentLength),p=d.uint8array?"uint8array":"array",f=o.transformTo(p,m);this.zipComment=this.loadOptions.decodeFileName(f)},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 m,p,f,y=this.zip64EndOfCentralSize-44;0<y;)m=this.reader.readInt(2),p=this.reader.readInt(4),f=this.reader.readData(p),this.zip64ExtensibleData[m]={id:m,length:p,value:f}},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 m,p;for(m=0;m<this.files.length;m++)p=this.files[m],this.reader.setIndex(p.localHeaderOffset),this.checkSignature(l.LOCAL_FILE_HEADER),p.readLocalPart(this.reader),p.handleUTF8(),p.processAttributes()},readCentralDir:function(){var m;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(l.CENTRAL_FILE_HEADER);)(m=new c({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(m);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 m=this.reader.lastIndexOfSignature(l.CENTRAL_DIRECTORY_END);if(m<0)throw this.isSignature(0,l.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(m);var p=m;if(this.checkSignature(l.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===o.MAX_VALUE_16BITS||this.diskWithCentralDirStart===o.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===o.MAX_VALUE_16BITS||this.centralDirRecords===o.MAX_VALUE_16BITS||this.centralDirSize===o.MAX_VALUE_32BITS||this.centralDirOffset===o.MAX_VALUE_32BITS){if(this.zip64=!0,(m=this.reader.lastIndexOfSignature(l.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(m),this.checkSignature(l.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,l.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(l.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(l.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var f=this.centralDirOffset+this.centralDirSize;this.zip64&&(f+=20,f+=12+this.zip64EndOfCentralSize);var y=p-f;if(0<y)this.isSignature(p,l.CENTRAL_FILE_HEADER)||(this.reader.zero=y);else if(y<0)throw new Error("Corrupted zip: missing "+Math.abs(y)+" bytes.")},prepareReader:function(m){this.reader=s(m)},load:function(m){this.prepareReader(m),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},r.exports=u},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(n,r,a){var s=n("./reader/readerFor"),o=n("./utils"),l=n("./compressedObject"),c=n("./crc32"),d=n("./utf8"),u=n("./compressions"),m=n("./support");function p(f,y){this.options=f,this.loadOptions=y}p.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(f){var y,x;if(f.skip(22),this.fileNameLength=f.readInt(2),x=f.readInt(2),this.fileName=f.readData(this.fileNameLength),f.skip(x),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(b){for(var v in u)if(Object.prototype.hasOwnProperty.call(u,v)&&u[v].magic===b)return u[v];return null})(this.compressionMethod))===null)throw new Error("Corrupted zip : compression "+o.pretty(this.compressionMethod)+" unknown (inner file : "+o.transformTo("string",this.fileName)+")");this.decompressed=new l(this.compressedSize,this.uncompressedSize,this.crc32,y,f.readData(this.compressedSize))},readCentralPart:function(f){this.versionMadeBy=f.readInt(2),f.skip(2),this.bitFlag=f.readInt(2),this.compressionMethod=f.readString(2),this.date=f.readDate(),this.crc32=f.readInt(4),this.compressedSize=f.readInt(4),this.uncompressedSize=f.readInt(4);var y=f.readInt(2);if(this.extraFieldsLength=f.readInt(2),this.fileCommentLength=f.readInt(2),this.diskNumberStart=f.readInt(2),this.internalFileAttributes=f.readInt(2),this.externalFileAttributes=f.readInt(4),this.localHeaderOffset=f.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");f.skip(y),this.readExtraFields(f),this.parseZIP64ExtraField(f),this.fileComment=f.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var f=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),f==0&&(this.dosPermissions=63&this.externalFileAttributes),f==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var f=s(this.extraFields[1].value);this.uncompressedSize===o.MAX_VALUE_32BITS&&(this.uncompressedSize=f.readInt(8)),this.compressedSize===o.MAX_VALUE_32BITS&&(this.compressedSize=f.readInt(8)),this.localHeaderOffset===o.MAX_VALUE_32BITS&&(this.localHeaderOffset=f.readInt(8)),this.diskNumberStart===o.MAX_VALUE_32BITS&&(this.diskNumberStart=f.readInt(4))}},readExtraFields:function(f){var y,x,b,v=f.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});f.index+4<v;)y=f.readInt(2),x=f.readInt(2),b=f.readData(x),this.extraFields[y]={id:y,length:x,value:b};f.setIndex(v)},handleUTF8:function(){var f=m.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=d.utf8decode(this.fileName),this.fileCommentStr=d.utf8decode(this.fileComment);else{var y=this.findExtraFieldUnicodePath();if(y!==null)this.fileNameStr=y;else{var x=o.transformTo(f,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(x)}var b=this.findExtraFieldUnicodeComment();if(b!==null)this.fileCommentStr=b;else{var v=o.transformTo(f,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(v)}}},findExtraFieldUnicodePath:function(){var f=this.extraFields[28789];if(f){var y=s(f.value);return y.readInt(1)!==1||c(this.fileName)!==y.readInt(4)?null:d.utf8decode(y.readData(f.length-5))}return null},findExtraFieldUnicodeComment:function(){var f=this.extraFields[25461];if(f){var y=s(f.value);return y.readInt(1)!==1||c(this.fileComment)!==y.readInt(4)?null:d.utf8decode(y.readData(f.length-5))}return null}},r.exports=p},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(n,r,a){function s(y,x,b){this.name=y,this.dir=b.dir,this.date=b.date,this.comment=b.comment,this.unixPermissions=b.unixPermissions,this.dosPermissions=b.dosPermissions,this._data=x,this._dataBinary=b.binary,this.options={compression:b.compression,compressionOptions:b.compressionOptions}}var o=n("./stream/StreamHelper"),l=n("./stream/DataWorker"),c=n("./utf8"),d=n("./compressedObject"),u=n("./stream/GenericWorker");s.prototype={internalStream:function(y){var x=null,b="string";try{if(!y)throw new Error("No output type specified.");var v=(b=y.toLowerCase())==="string"||b==="text";b!=="binarystring"&&b!=="text"||(b="string"),x=this._decompressWorker();var _=!this._dataBinary;_&&!v&&(x=x.pipe(new c.Utf8EncodeWorker)),!_&&v&&(x=x.pipe(new c.Utf8DecodeWorker))}catch(k){(x=new u("error")).error(k)}return new o(x,b,"")},async:function(y,x){return this.internalStream(y).accumulate(x)},nodeStream:function(y,x){return this.internalStream(y||"nodebuffer").toNodejsStream(x)},_compressWorker:function(y,x){if(this._data instanceof d&&this._data.compression.magic===y.magic)return this._data.getCompressedWorker();var b=this._decompressWorker();return this._dataBinary||(b=b.pipe(new c.Utf8EncodeWorker)),d.createWorkerFrom(b,y,x)},_decompressWorker:function(){return this._data instanceof d?this._data.getContentWorker():this._data instanceof u?this._data:new l(this._data)}};for(var m=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],p=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},f=0;f<m.length;f++)s.prototype[m[f]]=p;r.exports=s},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(n,r,a){(function(s){var o,l,c=s.MutationObserver||s.WebKitMutationObserver;if(c){var d=0,u=new c(y),m=s.document.createTextNode("");u.observe(m,{characterData:!0}),o=function(){m.data=d=++d%2}}else if(s.setImmediate||s.MessageChannel===void 0)o="document"in s&&"onreadystatechange"in s.document.createElement("script")?function(){var x=s.document.createElement("script");x.onreadystatechange=function(){y(),x.onreadystatechange=null,x.parentNode.removeChild(x),x=null},s.document.documentElement.appendChild(x)}:function(){setTimeout(y,0)};else{var p=new s.MessageChannel;p.port1.onmessage=y,o=function(){p.port2.postMessage(0)}}var f=[];function y(){var x,b;l=!0;for(var v=f.length;v;){for(b=f,f=[],x=-1;++x<v;)b[x]();v=f.length}l=!1}r.exports=function(x){f.push(x)!==1||l||o()}}).call(this,typeof yS<"u"?yS:typeof self<"u"?self:typeof window<"u"?window:{})},{}],37:[function(n,r,a){var s=n("immediate");function o(){}var l={},c=["REJECTED"],d=["FULFILLED"],u=["PENDING"];function m(v){if(typeof v!="function")throw new TypeError("resolver must be a function");this.state=u,this.queue=[],this.outcome=void 0,v!==o&&x(this,v)}function p(v,_,k){this.promise=v,typeof _=="function"&&(this.onFulfilled=_,this.callFulfilled=this.otherCallFulfilled),typeof k=="function"&&(this.onRejected=k,this.callRejected=this.otherCallRejected)}function f(v,_,k){s(function(){var P;try{P=_(k)}catch(C){return l.reject(v,C)}P===v?l.reject(v,new TypeError("Cannot resolve promise with itself")):l.resolve(v,P)})}function y(v){var _=v&&v.then;if(v&&(typeof v=="object"||typeof v=="function")&&typeof _=="function")return function(){_.apply(v,arguments)}}function x(v,_){var k=!1;function P(N){k||(k=!0,l.reject(v,N))}function C(N){k||(k=!0,l.resolve(v,N))}var T=b(function(){_(C,P)});T.status==="error"&&P(T.value)}function b(v,_){var k={};try{k.value=v(_),k.status="success"}catch(P){k.status="error",k.value=P}return k}(r.exports=m).prototype.finally=function(v){if(typeof v!="function")return this;var _=this.constructor;return this.then(function(k){return _.resolve(v()).then(function(){return k})},function(k){return _.resolve(v()).then(function(){throw k})})},m.prototype.catch=function(v){return this.then(null,v)},m.prototype.then=function(v,_){if(typeof v!="function"&&this.state===d||typeof _!="function"&&this.state===c)return this;var k=new this.constructor(o);return this.state!==u?f(k,this.state===d?v:_,this.outcome):this.queue.push(new p(k,v,_)),k},p.prototype.callFulfilled=function(v){l.resolve(this.promise,v)},p.prototype.otherCallFulfilled=function(v){f(this.promise,this.onFulfilled,v)},p.prototype.callRejected=function(v){l.reject(this.promise,v)},p.prototype.otherCallRejected=function(v){f(this.promise,this.onRejected,v)},l.resolve=function(v,_){var k=b(y,_);if(k.status==="error")return l.reject(v,k.value);var P=k.value;if(P)x(v,P);else{v.state=d,v.outcome=_;for(var C=-1,T=v.queue.length;++C<T;)v.queue[C].callFulfilled(_)}return v},l.reject=function(v,_){v.state=c,v.outcome=_;for(var k=-1,P=v.queue.length;++k<P;)v.queue[k].callRejected(_);return v},m.resolve=function(v){return v instanceof this?v:l.resolve(new this(o),v)},m.reject=function(v){var _=new this(o);return l.reject(_,v)},m.all=function(v){var _=this;if(Object.prototype.toString.call(v)!=="[object Array]")return this.reject(new TypeError("must be an array"));var k=v.length,P=!1;if(!k)return this.resolve([]);for(var C=new Array(k),T=0,N=-1,R=new this(o);++N<k;)A(v[N],N);return R;function A(D,$){_.resolve(D).then(function(U){C[$]=U,++T!==k||P||(P=!0,l.resolve(R,C))},function(U){P||(P=!0,l.reject(R,U))})}},m.race=function(v){var _=this;if(Object.prototype.toString.call(v)!=="[object Array]")return this.reject(new TypeError("must be an array"));var k=v.length,P=!1;if(!k)return this.resolve([]);for(var C=-1,T=new this(o);++C<k;)N=v[C],_.resolve(N).then(function(R){P||(P=!0,l.resolve(T,R))},function(R){P||(P=!0,l.reject(T,R))});var N;return T}},{immediate:36}],38:[function(n,r,a){var s={};(0,n("./lib/utils/common").assign)(s,n("./lib/deflate"),n("./lib/inflate"),n("./lib/zlib/constants")),r.exports=s},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(n,r,a){var s=n("./zlib/deflate"),o=n("./utils/common"),l=n("./utils/strings"),c=n("./zlib/messages"),d=n("./zlib/zstream"),u=Object.prototype.toString,m=0,p=-1,f=0,y=8;function x(v){if(!(this instanceof x))return new x(v);this.options=o.assign({level:p,method:y,chunkSize:16384,windowBits:15,memLevel:8,strategy:f,to:""},v||{});var _=this.options;_.raw&&0<_.windowBits?_.windowBits=-_.windowBits:_.gzip&&0<_.windowBits&&_.windowBits<16&&(_.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new d,this.strm.avail_out=0;var k=s.deflateInit2(this.strm,_.level,_.method,_.windowBits,_.memLevel,_.strategy);if(k!==m)throw new Error(c[k]);if(_.header&&s.deflateSetHeader(this.strm,_.header),_.dictionary){var P;if(P=typeof _.dictionary=="string"?l.string2buf(_.dictionary):u.call(_.dictionary)==="[object ArrayBuffer]"?new Uint8Array(_.dictionary):_.dictionary,(k=s.deflateSetDictionary(this.strm,P))!==m)throw new Error(c[k]);this._dict_set=!0}}function b(v,_){var k=new x(_);if(k.push(v,!0),k.err)throw k.msg||c[k.err];return k.result}x.prototype.push=function(v,_){var k,P,C=this.strm,T=this.options.chunkSize;if(this.ended)return!1;P=_===~~_?_:_===!0?4:0,typeof v=="string"?C.input=l.string2buf(v):u.call(v)==="[object ArrayBuffer]"?C.input=new Uint8Array(v):C.input=v,C.next_in=0,C.avail_in=C.input.length;do{if(C.avail_out===0&&(C.output=new o.Buf8(T),C.next_out=0,C.avail_out=T),(k=s.deflate(C,P))!==1&&k!==m)return this.onEnd(k),!(this.ended=!0);C.avail_out!==0&&(C.avail_in!==0||P!==4&&P!==2)||(this.options.to==="string"?this.onData(l.buf2binstring(o.shrinkBuf(C.output,C.next_out))):this.onData(o.shrinkBuf(C.output,C.next_out)))}while((0<C.avail_in||C.avail_out===0)&&k!==1);return P===4?(k=s.deflateEnd(this.strm),this.onEnd(k),this.ended=!0,k===m):P!==2||(this.onEnd(m),!(C.avail_out=0))},x.prototype.onData=function(v){this.chunks.push(v)},x.prototype.onEnd=function(v){v===m&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=o.flattenChunks(this.chunks)),this.chunks=[],this.err=v,this.msg=this.strm.msg},a.Deflate=x,a.deflate=b,a.deflateRaw=function(v,_){return(_=_||{}).raw=!0,b(v,_)},a.gzip=function(v,_){return(_=_||{}).gzip=!0,b(v,_)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(n,r,a){var s=n("./zlib/inflate"),o=n("./utils/common"),l=n("./utils/strings"),c=n("./zlib/constants"),d=n("./zlib/messages"),u=n("./zlib/zstream"),m=n("./zlib/gzheader"),p=Object.prototype.toString;function f(x){if(!(this instanceof f))return new f(x);this.options=o.assign({chunkSize:16384,windowBits:0,to:""},x||{});var b=this.options;b.raw&&0<=b.windowBits&&b.windowBits<16&&(b.windowBits=-b.windowBits,b.windowBits===0&&(b.windowBits=-15)),!(0<=b.windowBits&&b.windowBits<16)||x&&x.windowBits||(b.windowBits+=32),15<b.windowBits&&b.windowBits<48&&(15&b.windowBits)==0&&(b.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new u,this.strm.avail_out=0;var v=s.inflateInit2(this.strm,b.windowBits);if(v!==c.Z_OK)throw new Error(d[v]);this.header=new m,s.inflateGetHeader(this.strm,this.header)}function y(x,b){var v=new f(b);if(v.push(x,!0),v.err)throw v.msg||d[v.err];return v.result}f.prototype.push=function(x,b){var v,_,k,P,C,T,N=this.strm,R=this.options.chunkSize,A=this.options.dictionary,D=!1;if(this.ended)return!1;_=b===~~b?b:b===!0?c.Z_FINISH:c.Z_NO_FLUSH,typeof x=="string"?N.input=l.binstring2buf(x):p.call(x)==="[object ArrayBuffer]"?N.input=new Uint8Array(x):N.input=x,N.next_in=0,N.avail_in=N.input.length;do{if(N.avail_out===0&&(N.output=new o.Buf8(R),N.next_out=0,N.avail_out=R),(v=s.inflate(N,c.Z_NO_FLUSH))===c.Z_NEED_DICT&&A&&(T=typeof A=="string"?l.string2buf(A):p.call(A)==="[object ArrayBuffer]"?new Uint8Array(A):A,v=s.inflateSetDictionary(this.strm,T)),v===c.Z_BUF_ERROR&&D===!0&&(v=c.Z_OK,D=!1),v!==c.Z_STREAM_END&&v!==c.Z_OK)return this.onEnd(v),!(this.ended=!0);N.next_out&&(N.avail_out!==0&&v!==c.Z_STREAM_END&&(N.avail_in!==0||_!==c.Z_FINISH&&_!==c.Z_SYNC_FLUSH)||(this.options.to==="string"?(k=l.utf8border(N.output,N.next_out),P=N.next_out-k,C=l.buf2string(N.output,k),N.next_out=P,N.avail_out=R-P,P&&o.arraySet(N.output,N.output,k,P,0),this.onData(C)):this.onData(o.shrinkBuf(N.output,N.next_out)))),N.avail_in===0&&N.avail_out===0&&(D=!0)}while((0<N.avail_in||N.avail_out===0)&&v!==c.Z_STREAM_END);return v===c.Z_STREAM_END&&(_=c.Z_FINISH),_===c.Z_FINISH?(v=s.inflateEnd(this.strm),this.onEnd(v),this.ended=!0,v===c.Z_OK):_!==c.Z_SYNC_FLUSH||(this.onEnd(c.Z_OK),!(N.avail_out=0))},f.prototype.onData=function(x){this.chunks.push(x)},f.prototype.onEnd=function(x){x===c.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=o.flattenChunks(this.chunks)),this.chunks=[],this.err=x,this.msg=this.strm.msg},a.Inflate=f,a.inflate=y,a.inflateRaw=function(x,b){return(b=b||{}).raw=!0,y(x,b)},a.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,r,a){var s=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";a.assign=function(c){for(var d=Array.prototype.slice.call(arguments,1);d.length;){var u=d.shift();if(u){if(typeof u!="object")throw new TypeError(u+"must be non-object");for(var m in u)u.hasOwnProperty(m)&&(c[m]=u[m])}}return c},a.shrinkBuf=function(c,d){return c.length===d?c:c.subarray?c.subarray(0,d):(c.length=d,c)};var o={arraySet:function(c,d,u,m,p){if(d.subarray&&c.subarray)c.set(d.subarray(u,u+m),p);else for(var f=0;f<m;f++)c[p+f]=d[u+f]},flattenChunks:function(c){var d,u,m,p,f,y;for(d=m=0,u=c.length;d<u;d++)m+=c[d].length;for(y=new Uint8Array(m),d=p=0,u=c.length;d<u;d++)f=c[d],y.set(f,p),p+=f.length;return y}},l={arraySet:function(c,d,u,m,p){for(var f=0;f<m;f++)c[p+f]=d[u+f]},flattenChunks:function(c){return[].concat.apply([],c)}};a.setTyped=function(c){c?(a.Buf8=Uint8Array,a.Buf16=Uint16Array,a.Buf32=Int32Array,a.assign(a,o)):(a.Buf8=Array,a.Buf16=Array,a.Buf32=Array,a.assign(a,l))},a.setTyped(s)},{}],42:[function(n,r,a){var s=n("./common"),o=!0,l=!0;try{String.fromCharCode.apply(null,[0])}catch{o=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{l=!1}for(var c=new s.Buf8(256),d=0;d<256;d++)c[d]=252<=d?6:248<=d?5:240<=d?4:224<=d?3:192<=d?2:1;function u(m,p){if(p<65537&&(m.subarray&&l||!m.subarray&&o))return String.fromCharCode.apply(null,s.shrinkBuf(m,p));for(var f="",y=0;y<p;y++)f+=String.fromCharCode(m[y]);return f}c[254]=c[254]=1,a.string2buf=function(m){var p,f,y,x,b,v=m.length,_=0;for(x=0;x<v;x++)(64512&(f=m.charCodeAt(x)))==55296&&x+1<v&&(64512&(y=m.charCodeAt(x+1)))==56320&&(f=65536+(f-55296<<10)+(y-56320),x++),_+=f<128?1:f<2048?2:f<65536?3:4;for(p=new s.Buf8(_),x=b=0;b<_;x++)(64512&(f=m.charCodeAt(x)))==55296&&x+1<v&&(64512&(y=m.charCodeAt(x+1)))==56320&&(f=65536+(f-55296<<10)+(y-56320),x++),f<128?p[b++]=f:(f<2048?p[b++]=192|f>>>6:(f<65536?p[b++]=224|f>>>12:(p[b++]=240|f>>>18,p[b++]=128|f>>>12&63),p[b++]=128|f>>>6&63),p[b++]=128|63&f);return p},a.buf2binstring=function(m){return u(m,m.length)},a.binstring2buf=function(m){for(var p=new s.Buf8(m.length),f=0,y=p.length;f<y;f++)p[f]=m.charCodeAt(f);return p},a.buf2string=function(m,p){var f,y,x,b,v=p||m.length,_=new Array(2*v);for(f=y=0;f<v;)if((x=m[f++])<128)_[y++]=x;else if(4<(b=c[x]))_[y++]=65533,f+=b-1;else{for(x&=b===2?31:b===3?15:7;1<b&&f<v;)x=x<<6|63&m[f++],b--;1<b?_[y++]=65533:x<65536?_[y++]=x:(x-=65536,_[y++]=55296|x>>10&1023,_[y++]=56320|1023&x)}return u(_,y)},a.utf8border=function(m,p){var f;for((p=p||m.length)>m.length&&(p=m.length),f=p-1;0<=f&&(192&m[f])==128;)f--;return f<0||f===0?p:f+c[m[f]]>p?f:p}},{"./common":41}],43:[function(n,r,a){r.exports=function(s,o,l,c){for(var d=65535&s|0,u=s>>>16&65535|0,m=0;l!==0;){for(l-=m=2e3<l?2e3:l;u=u+(d=d+o[c++]|0)|0,--m;);d%=65521,u%=65521}return d|u<<16|0}},{}],44:[function(n,r,a){r.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,r,a){var 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})();r.exports=function(o,l,c,d){var u=s,m=d+c;o^=-1;for(var p=d;p<m;p++)o=o>>>8^u[255&(o^l[p])];return-1^o}},{}],46:[function(n,r,a){var s,o=n("../utils/common"),l=n("./trees"),c=n("./adler32"),d=n("./crc32"),u=n("./messages"),m=0,p=4,f=0,y=-2,x=-1,b=4,v=2,_=8,k=9,P=286,C=30,T=19,N=2*P+1,R=15,A=3,D=258,$=D+A+1,U=42,G=113,L=1,te=2,re=3,J=4;function ue(z,V){return z.msg=u[V],V}function me(z){return(z<<1)-(4<z?9:0)}function ge(z){for(var V=z.length;0<=--V;)z[V]=0}function X(z){var V=z.state,ee=V.pending;ee>z.avail_out&&(ee=z.avail_out),ee!==0&&(o.arraySet(z.output,V.pending_buf,V.pending_out,ee,z.next_out),z.next_out+=ee,V.pending_out+=ee,z.total_out+=ee,z.avail_out-=ee,V.pending-=ee,V.pending===0&&(V.pending_out=0))}function ie(z,V){l._tr_flush_block(z,0<=z.block_start?z.block_start:-1,z.strstart-z.block_start,V),z.block_start=z.strstart,X(z.strm)}function le(z,V){z.pending_buf[z.pending++]=V}function pe(z,V){z.pending_buf[z.pending++]=V>>>8&255,z.pending_buf[z.pending++]=255&V}function Ce(z,V){var ee,K,ne=z.max_chain_length,se=z.strstart,ce=z.prev_length,fe=z.nice_match,oe=z.strstart>z.w_size-$?z.strstart-(z.w_size-$):0,O=z.window,F=z.w_mask,Q=z.prev,ve=z.strstart+D,he=O[se+ce-1],de=O[se+ce];z.prev_length>=z.good_match&&(ne>>=2),fe>z.lookahead&&(fe=z.lookahead);do if(O[(ee=V)+ce]===de&&O[ee+ce-1]===he&&O[ee]===O[se]&&O[++ee]===O[se+1]){se+=2,ee++;do;while(O[++se]===O[++ee]&&O[++se]===O[++ee]&&O[++se]===O[++ee]&&O[++se]===O[++ee]&&O[++se]===O[++ee]&&O[++se]===O[++ee]&&O[++se]===O[++ee]&&O[++se]===O[++ee]&&se<ve);if(K=D-(ve-se),se=ve-D,ce<K){if(z.match_start=V,fe<=(ce=K))break;he=O[se+ce-1],de=O[se+ce]}}while((V=Q[V&F])>oe&&--ne!=0);return ce<=z.lookahead?ce:z.lookahead}function q(z){var V,ee,K,ne,se,ce,fe,oe,O,F,Q=z.w_size;do{if(ne=z.window_size-z.lookahead-z.strstart,z.strstart>=Q+(Q-$)){for(o.arraySet(z.window,z.window,Q,Q,0),z.match_start-=Q,z.strstart-=Q,z.block_start-=Q,V=ee=z.hash_size;K=z.head[--V],z.head[V]=Q<=K?K-Q:0,--ee;);for(V=ee=Q;K=z.prev[--V],z.prev[V]=Q<=K?K-Q:0,--ee;);ne+=Q}if(z.strm.avail_in===0)break;if(ce=z.strm,fe=z.window,oe=z.strstart+z.lookahead,O=ne,F=void 0,F=ce.avail_in,O<F&&(F=O),ee=F===0?0:(ce.avail_in-=F,o.arraySet(fe,ce.input,ce.next_in,F,oe),ce.state.wrap===1?ce.adler=c(ce.adler,fe,F,oe):ce.state.wrap===2&&(ce.adler=d(ce.adler,fe,F,oe)),ce.next_in+=F,ce.total_in+=F,F),z.lookahead+=ee,z.lookahead+z.insert>=A)for(se=z.strstart-z.insert,z.ins_h=z.window[se],z.ins_h=(z.ins_h<<z.hash_shift^z.window[se+1])&z.hash_mask;z.insert&&(z.ins_h=(z.ins_h<<z.hash_shift^z.window[se+A-1])&z.hash_mask,z.prev[se&z.w_mask]=z.head[z.ins_h],z.head[z.ins_h]=se,se++,z.insert--,!(z.lookahead+z.insert<A)););}while(z.lookahead<$&&z.strm.avail_in!==0)}function Z(z,V){for(var ee,K;;){if(z.lookahead<$){if(q(z),z.lookahead<$&&V===m)return L;if(z.lookahead===0)break}if(ee=0,z.lookahead>=A&&(z.ins_h=(z.ins_h<<z.hash_shift^z.window[z.strstart+A-1])&z.hash_mask,ee=z.prev[z.strstart&z.w_mask]=z.head[z.ins_h],z.head[z.ins_h]=z.strstart),ee!==0&&z.strstart-ee<=z.w_size-$&&(z.match_length=Ce(z,ee)),z.match_length>=A)if(K=l._tr_tally(z,z.strstart-z.match_start,z.match_length-A),z.lookahead-=z.match_length,z.match_length<=z.max_lazy_match&&z.lookahead>=A){for(z.match_length--;z.strstart++,z.ins_h=(z.ins_h<<z.hash_shift^z.window[z.strstart+A-1])&z.hash_mask,ee=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 K=l._tr_tally(z,0,z.window[z.strstart]),z.lookahead--,z.strstart++;if(K&&(ie(z,!1),z.strm.avail_out===0))return L}return z.insert=z.strstart<A-1?z.strstart:A-1,V===p?(ie(z,!0),z.strm.avail_out===0?re:J):z.last_lit&&(ie(z,!1),z.strm.avail_out===0)?L:te}function j(z,V){for(var ee,K,ne;;){if(z.lookahead<$){if(q(z),z.lookahead<$&&V===m)return L;if(z.lookahead===0)break}if(ee=0,z.lookahead>=A&&(z.ins_h=(z.ins_h<<z.hash_shift^z.window[z.strstart+A-1])&z.hash_mask,ee=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=A-1,ee!==0&&z.prev_length<z.max_lazy_match&&z.strstart-ee<=z.w_size-$&&(z.match_length=Ce(z,ee),z.match_length<=5&&(z.strategy===1||z.match_length===A&&4096<z.strstart-z.match_start)&&(z.match_length=A-1)),z.prev_length>=A&&z.match_length<=z.prev_length){for(ne=z.strstart+z.lookahead-A,K=l._tr_tally(z,z.strstart-1-z.prev_match,z.prev_length-A),z.lookahead-=z.prev_length-1,z.prev_length-=2;++z.strstart<=ne&&(z.ins_h=(z.ins_h<<z.hash_shift^z.window[z.strstart+A-1])&z.hash_mask,ee=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=A-1,z.strstart++,K&&(ie(z,!1),z.strm.avail_out===0))return L}else if(z.match_available){if((K=l._tr_tally(z,0,z.window[z.strstart-1]))&&ie(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&&(K=l._tr_tally(z,0,z.window[z.strstart-1]),z.match_available=0),z.insert=z.strstart<A-1?z.strstart:A-1,V===p?(ie(z,!0),z.strm.avail_out===0?re:J):z.last_lit&&(ie(z,!1),z.strm.avail_out===0)?L:te}function E(z,V,ee,K,ne){this.good_length=z,this.max_lazy=V,this.nice_length=ee,this.max_chain=K,this.func=ne}function I(){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=_,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 o.Buf16(2*N),this.dyn_dtree=new o.Buf16(2*(2*C+1)),this.bl_tree=new o.Buf16(2*(2*T+1)),ge(this.dyn_ltree),ge(this.dyn_dtree),ge(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new o.Buf16(R+1),this.heap=new o.Buf16(2*P+1),ge(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new o.Buf16(2*P+1),ge(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 W(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?U:G,z.adler=V.wrap===2?0:1,V.last_flush=m,l._tr_init(V),f):ue(z,y)}function B(z){var V=W(z);return V===f&&(function(ee){ee.window_size=2*ee.w_size,ge(ee.head),ee.max_lazy_match=s[ee.level].max_lazy,ee.good_match=s[ee.level].good_length,ee.nice_match=s[ee.level].nice_length,ee.max_chain_length=s[ee.level].max_chain,ee.strstart=0,ee.block_start=0,ee.lookahead=0,ee.insert=0,ee.match_length=ee.prev_length=A-1,ee.match_available=0,ee.ins_h=0})(z.state),V}function ae(z,V,ee,K,ne,se){if(!z)return y;var ce=1;if(V===x&&(V=6),K<0?(ce=0,K=-K):15<K&&(ce=2,K-=16),ne<1||k<ne||ee!==_||K<8||15<K||V<0||9<V||se<0||b<se)return ue(z,y);K===8&&(K=9);var fe=new I;return(z.state=fe).strm=z,fe.wrap=ce,fe.gzhead=null,fe.w_bits=K,fe.w_size=1<<fe.w_bits,fe.w_mask=fe.w_size-1,fe.hash_bits=ne+7,fe.hash_size=1<<fe.hash_bits,fe.hash_mask=fe.hash_size-1,fe.hash_shift=~~((fe.hash_bits+A-1)/A),fe.window=new o.Buf8(2*fe.w_size),fe.head=new o.Buf16(fe.hash_size),fe.prev=new o.Buf16(fe.w_size),fe.lit_bufsize=1<<ne+6,fe.pending_buf_size=4*fe.lit_bufsize,fe.pending_buf=new o.Buf8(fe.pending_buf_size),fe.d_buf=1*fe.lit_bufsize,fe.l_buf=3*fe.lit_bufsize,fe.level=V,fe.strategy=se,fe.method=ee,B(z)}s=[new E(0,0,0,0,function(z,V){var ee=65535;for(ee>z.pending_buf_size-5&&(ee=z.pending_buf_size-5);;){if(z.lookahead<=1){if(q(z),z.lookahead===0&&V===m)return L;if(z.lookahead===0)break}z.strstart+=z.lookahead,z.lookahead=0;var K=z.block_start+ee;if((z.strstart===0||z.strstart>=K)&&(z.lookahead=z.strstart-K,z.strstart=K,ie(z,!1),z.strm.avail_out===0)||z.strstart-z.block_start>=z.w_size-$&&(ie(z,!1),z.strm.avail_out===0))return L}return z.insert=0,V===p?(ie(z,!0),z.strm.avail_out===0?re:J):(z.strstart>z.block_start&&(ie(z,!1),z.strm.avail_out),L)}),new E(4,4,8,4,Z),new E(4,5,16,8,Z),new E(4,6,32,32,Z),new E(4,4,16,16,j),new E(8,16,32,32,j),new E(8,16,128,128,j),new E(8,32,128,256,j),new E(32,128,258,1024,j),new E(32,258,258,4096,j)],a.deflateInit=function(z,V){return ae(z,V,_,15,8,0)},a.deflateInit2=ae,a.deflateReset=B,a.deflateResetKeep=W,a.deflateSetHeader=function(z,V){return z&&z.state?z.state.wrap!==2?y:(z.state.gzhead=V,f):y},a.deflate=function(z,V){var ee,K,ne,se;if(!z||!z.state||5<V||V<0)return z?ue(z,y):y;if(K=z.state,!z.output||!z.input&&z.avail_in!==0||K.status===666&&V!==p)return ue(z,z.avail_out===0?-5:y);if(K.strm=z,ee=K.last_flush,K.last_flush=V,K.status===U)if(K.wrap===2)z.adler=0,le(K,31),le(K,139),le(K,8),K.gzhead?(le(K,(K.gzhead.text?1:0)+(K.gzhead.hcrc?2:0)+(K.gzhead.extra?4:0)+(K.gzhead.name?8:0)+(K.gzhead.comment?16:0)),le(K,255&K.gzhead.time),le(K,K.gzhead.time>>8&255),le(K,K.gzhead.time>>16&255),le(K,K.gzhead.time>>24&255),le(K,K.level===9?2:2<=K.strategy||K.level<2?4:0),le(K,255&K.gzhead.os),K.gzhead.extra&&K.gzhead.extra.length&&(le(K,255&K.gzhead.extra.length),le(K,K.gzhead.extra.length>>8&255)),K.gzhead.hcrc&&(z.adler=d(z.adler,K.pending_buf,K.pending,0)),K.gzindex=0,K.status=69):(le(K,0),le(K,0),le(K,0),le(K,0),le(K,0),le(K,K.level===9?2:2<=K.strategy||K.level<2?4:0),le(K,3),K.status=G);else{var ce=_+(K.w_bits-8<<4)<<8;ce|=(2<=K.strategy||K.level<2?0:K.level<6?1:K.level===6?2:3)<<6,K.strstart!==0&&(ce|=32),ce+=31-ce%31,K.status=G,pe(K,ce),K.strstart!==0&&(pe(K,z.adler>>>16),pe(K,65535&z.adler)),z.adler=1}if(K.status===69)if(K.gzhead.extra){for(ne=K.pending;K.gzindex<(65535&K.gzhead.extra.length)&&(K.pending!==K.pending_buf_size||(K.gzhead.hcrc&&K.pending>ne&&(z.adler=d(z.adler,K.pending_buf,K.pending-ne,ne)),X(z),ne=K.pending,K.pending!==K.pending_buf_size));)le(K,255&K.gzhead.extra[K.gzindex]),K.gzindex++;K.gzhead.hcrc&&K.pending>ne&&(z.adler=d(z.adler,K.pending_buf,K.pending-ne,ne)),K.gzindex===K.gzhead.extra.length&&(K.gzindex=0,K.status=73)}else K.status=73;if(K.status===73)if(K.gzhead.name){ne=K.pending;do{if(K.pending===K.pending_buf_size&&(K.gzhead.hcrc&&K.pending>ne&&(z.adler=d(z.adler,K.pending_buf,K.pending-ne,ne)),X(z),ne=K.pending,K.pending===K.pending_buf_size)){se=1;break}se=K.gzindex<K.gzhead.name.length?255&K.gzhead.name.charCodeAt(K.gzindex++):0,le(K,se)}while(se!==0);K.gzhead.hcrc&&K.pending>ne&&(z.adler=d(z.adler,K.pending_buf,K.pending-ne,ne)),se===0&&(K.gzindex=0,K.status=91)}else K.status=91;if(K.status===91)if(K.gzhead.comment){ne=K.pending;do{if(K.pending===K.pending_buf_size&&(K.gzhead.hcrc&&K.pending>ne&&(z.adler=d(z.adler,K.pending_buf,K.pending-ne,ne)),X(z),ne=K.pending,K.pending===K.pending_buf_size)){se=1;break}se=K.gzindex<K.gzhead.comment.length?255&K.gzhead.comment.charCodeAt(K.gzindex++):0,le(K,se)}while(se!==0);K.gzhead.hcrc&&K.pending>ne&&(z.adler=d(z.adler,K.pending_buf,K.pending-ne,ne)),se===0&&(K.status=103)}else K.status=103;if(K.status===103&&(K.gzhead.hcrc?(K.pending+2>K.pending_buf_size&&X(z),K.pending+2<=K.pending_buf_size&&(le(K,255&z.adler),le(K,z.adler>>8&255),z.adler=0,K.status=G)):K.status=G),K.pending!==0){if(X(z),z.avail_out===0)return K.last_flush=-1,f}else if(z.avail_in===0&&me(V)<=me(ee)&&V!==p)return ue(z,-5);if(K.status===666&&z.avail_in!==0)return ue(z,-5);if(z.avail_in!==0||K.lookahead!==0||V!==m&&K.status!==666){var fe=K.strategy===2?(function(oe,O){for(var F;;){if(oe.lookahead===0&&(q(oe),oe.lookahead===0)){if(O===m)return L;break}if(oe.match_length=0,F=l._tr_tally(oe,0,oe.window[oe.strstart]),oe.lookahead--,oe.strstart++,F&&(ie(oe,!1),oe.strm.avail_out===0))return L}return oe.insert=0,O===p?(ie(oe,!0),oe.strm.avail_out===0?re:J):oe.last_lit&&(ie(oe,!1),oe.strm.avail_out===0)?L:te})(K,V):K.strategy===3?(function(oe,O){for(var F,Q,ve,he,de=oe.window;;){if(oe.lookahead<=D){if(q(oe),oe.lookahead<=D&&O===m)return L;if(oe.lookahead===0)break}if(oe.match_length=0,oe.lookahead>=A&&0<oe.strstart&&(Q=de[ve=oe.strstart-1])===de[++ve]&&Q===de[++ve]&&Q===de[++ve]){he=oe.strstart+D;do;while(Q===de[++ve]&&Q===de[++ve]&&Q===de[++ve]&&Q===de[++ve]&&Q===de[++ve]&&Q===de[++ve]&&Q===de[++ve]&&Q===de[++ve]&&ve<he);oe.match_length=D-(he-ve),oe.match_length>oe.lookahead&&(oe.match_length=oe.lookahead)}if(oe.match_length>=A?(F=l._tr_tally(oe,1,oe.match_length-A),oe.lookahead-=oe.match_length,oe.strstart+=oe.match_length,oe.match_length=0):(F=l._tr_tally(oe,0,oe.window[oe.strstart]),oe.lookahead--,oe.strstart++),F&&(ie(oe,!1),oe.strm.avail_out===0))return L}return oe.insert=0,O===p?(ie(oe,!0),oe.strm.avail_out===0?re:J):oe.last_lit&&(ie(oe,!1),oe.strm.avail_out===0)?L:te})(K,V):s[K.level].func(K,V);if(fe!==re&&fe!==J||(K.status=666),fe===L||fe===re)return z.avail_out===0&&(K.last_flush=-1),f;if(fe===te&&(V===1?l._tr_align(K):V!==5&&(l._tr_stored_block(K,0,0,!1),V===3&&(ge(K.head),K.lookahead===0&&(K.strstart=0,K.block_start=0,K.insert=0))),X(z),z.avail_out===0))return K.last_flush=-1,f}return V!==p?f:K.wrap<=0?1:(K.wrap===2?(le(K,255&z.adler),le(K,z.adler>>8&255),le(K,z.adler>>16&255),le(K,z.adler>>24&255),le(K,255&z.total_in),le(K,z.total_in>>8&255),le(K,z.total_in>>16&255),le(K,z.total_in>>24&255)):(pe(K,z.adler>>>16),pe(K,65535&z.adler)),X(z),0<K.wrap&&(K.wrap=-K.wrap),K.pending!==0?f:1)},a.deflateEnd=function(z){var V;return z&&z.state?(V=z.state.status)!==U&&V!==69&&V!==73&&V!==91&&V!==103&&V!==G&&V!==666?ue(z,y):(z.state=null,V===G?ue(z,-3):f):y},a.deflateSetDictionary=function(z,V){var ee,K,ne,se,ce,fe,oe,O,F=V.length;if(!z||!z.state||(se=(ee=z.state).wrap)===2||se===1&&ee.status!==U||ee.lookahead)return y;for(se===1&&(z.adler=c(z.adler,V,F,0)),ee.wrap=0,F>=ee.w_size&&(se===0&&(ge(ee.head),ee.strstart=0,ee.block_start=0,ee.insert=0),O=new o.Buf8(ee.w_size),o.arraySet(O,V,F-ee.w_size,ee.w_size,0),V=O,F=ee.w_size),ce=z.avail_in,fe=z.next_in,oe=z.input,z.avail_in=F,z.next_in=0,z.input=V,q(ee);ee.lookahead>=A;){for(K=ee.strstart,ne=ee.lookahead-(A-1);ee.ins_h=(ee.ins_h<<ee.hash_shift^ee.window[K+A-1])&ee.hash_mask,ee.prev[K&ee.w_mask]=ee.head[ee.ins_h],ee.head[ee.ins_h]=K,K++,--ne;);ee.strstart=K,ee.lookahead=A-1,q(ee)}return ee.strstart+=ee.lookahead,ee.block_start=ee.strstart,ee.insert=ee.lookahead,ee.lookahead=0,ee.match_length=ee.prev_length=A-1,ee.match_available=0,z.next_in=fe,z.input=oe,z.avail_in=ce,ee.wrap=se,f},a.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(n,r,a){r.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,r,a){r.exports=function(s,o){var l,c,d,u,m,p,f,y,x,b,v,_,k,P,C,T,N,R,A,D,$,U,G,L,te;l=s.state,c=s.next_in,L=s.input,d=c+(s.avail_in-5),u=s.next_out,te=s.output,m=u-(o-s.avail_out),p=u+(s.avail_out-257),f=l.dmax,y=l.wsize,x=l.whave,b=l.wnext,v=l.window,_=l.hold,k=l.bits,P=l.lencode,C=l.distcode,T=(1<<l.lenbits)-1,N=(1<<l.distbits)-1;e:do{k<15&&(_+=L[c++]<<k,k+=8,_+=L[c++]<<k,k+=8),R=P[_&T];t:for(;;){if(_>>>=A=R>>>24,k-=A,(A=R>>>16&255)===0)te[u++]=65535&R;else{if(!(16&A)){if((64&A)==0){R=P[(65535&R)+(_&(1<<A)-1)];continue t}if(32&A){l.mode=12;break e}s.msg="invalid literal/length code",l.mode=30;break e}D=65535&R,(A&=15)&&(k<A&&(_+=L[c++]<<k,k+=8),D+=_&(1<<A)-1,_>>>=A,k-=A),k<15&&(_+=L[c++]<<k,k+=8,_+=L[c++]<<k,k+=8),R=C[_&N];n:for(;;){if(_>>>=A=R>>>24,k-=A,!(16&(A=R>>>16&255))){if((64&A)==0){R=C[(65535&R)+(_&(1<<A)-1)];continue n}s.msg="invalid distance code",l.mode=30;break e}if($=65535&R,k<(A&=15)&&(_+=L[c++]<<k,(k+=8)<A&&(_+=L[c++]<<k,k+=8)),f<($+=_&(1<<A)-1)){s.msg="invalid distance too far back",l.mode=30;break e}if(_>>>=A,k-=A,(A=u-m)<$){if(x<(A=$-A)&&l.sane){s.msg="invalid distance too far back",l.mode=30;break e}if(G=v,(U=0)===b){if(U+=y-A,A<D){for(D-=A;te[u++]=v[U++],--A;);U=u-$,G=te}}else if(b<A){if(U+=y+b-A,(A-=b)<D){for(D-=A;te[u++]=v[U++],--A;);if(U=0,b<D){for(D-=A=b;te[u++]=v[U++],--A;);U=u-$,G=te}}}else if(U+=b-A,A<D){for(D-=A;te[u++]=v[U++],--A;);U=u-$,G=te}for(;2<D;)te[u++]=G[U++],te[u++]=G[U++],te[u++]=G[U++],D-=3;D&&(te[u++]=G[U++],1<D&&(te[u++]=G[U++]))}else{for(U=u-$;te[u++]=te[U++],te[u++]=te[U++],te[u++]=te[U++],2<(D-=3););D&&(te[u++]=te[U++],1<D&&(te[u++]=te[U++]))}break}}break}}while(c<d&&u<p);c-=D=k>>3,_&=(1<<(k-=D<<3))-1,s.next_in=c,s.next_out=u,s.avail_in=c<d?d-c+5:5-(c-d),s.avail_out=u<p?p-u+257:257-(u-p),l.hold=_,l.bits=k}},{}],49:[function(n,r,a){var s=n("../utils/common"),o=n("./adler32"),l=n("./crc32"),c=n("./inffast"),d=n("./inftrees"),u=1,m=2,p=0,f=-2,y=1,x=852,b=592;function v(U){return(U>>>24&255)+(U>>>8&65280)+((65280&U)<<8)+((255&U)<<24)}function _(){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 s.Buf16(320),this.work=new s.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function k(U){var G;return U&&U.state?(G=U.state,U.total_in=U.total_out=G.total=0,U.msg="",G.wrap&&(U.adler=1&G.wrap),G.mode=y,G.last=0,G.havedict=0,G.dmax=32768,G.head=null,G.hold=0,G.bits=0,G.lencode=G.lendyn=new s.Buf32(x),G.distcode=G.distdyn=new s.Buf32(b),G.sane=1,G.back=-1,p):f}function P(U){var G;return U&&U.state?((G=U.state).wsize=0,G.whave=0,G.wnext=0,k(U)):f}function C(U,G){var L,te;return U&&U.state?(te=U.state,G<0?(L=0,G=-G):(L=1+(G>>4),G<48&&(G&=15)),G&&(G<8||15<G)?f:(te.window!==null&&te.wbits!==G&&(te.window=null),te.wrap=L,te.wbits=G,P(U))):f}function T(U,G){var L,te;return U?(te=new _,(U.state=te).window=null,(L=C(U,G))!==p&&(U.state=null),L):f}var N,R,A=!0;function D(U){if(A){var G;for(N=new s.Buf32(512),R=new s.Buf32(32),G=0;G<144;)U.lens[G++]=8;for(;G<256;)U.lens[G++]=9;for(;G<280;)U.lens[G++]=7;for(;G<288;)U.lens[G++]=8;for(d(u,U.lens,0,288,N,0,U.work,{bits:9}),G=0;G<32;)U.lens[G++]=5;d(m,U.lens,0,32,R,0,U.work,{bits:5}),A=!1}U.lencode=N,U.lenbits=9,U.distcode=R,U.distbits=5}function $(U,G,L,te){var re,J=U.state;return J.window===null&&(J.wsize=1<<J.wbits,J.wnext=0,J.whave=0,J.window=new s.Buf8(J.wsize)),te>=J.wsize?(s.arraySet(J.window,G,L-J.wsize,J.wsize,0),J.wnext=0,J.whave=J.wsize):(te<(re=J.wsize-J.wnext)&&(re=te),s.arraySet(J.window,G,L-te,re,J.wnext),(te-=re)?(s.arraySet(J.window,G,L-te,te,0),J.wnext=te,J.whave=J.wsize):(J.wnext+=re,J.wnext===J.wsize&&(J.wnext=0),J.whave<J.wsize&&(J.whave+=re))),0}a.inflateReset=P,a.inflateReset2=C,a.inflateResetKeep=k,a.inflateInit=function(U){return T(U,15)},a.inflateInit2=T,a.inflate=function(U,G){var L,te,re,J,ue,me,ge,X,ie,le,pe,Ce,q,Z,j,E,I,W,B,ae,z,V,ee,K,ne=0,se=new s.Buf8(4),ce=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!U||!U.state||!U.output||!U.input&&U.avail_in!==0)return f;(L=U.state).mode===12&&(L.mode=13),ue=U.next_out,re=U.output,ge=U.avail_out,J=U.next_in,te=U.input,me=U.avail_in,X=L.hold,ie=L.bits,le=me,pe=ge,V=p;e:for(;;)switch(L.mode){case y:if(L.wrap===0){L.mode=13;break}for(;ie<16;){if(me===0)break e;me--,X+=te[J++]<<ie,ie+=8}if(2&L.wrap&&X===35615){se[L.check=0]=255&X,se[1]=X>>>8&255,L.check=l(L.check,se,2,0),ie=X=0,L.mode=2;break}if(L.flags=0,L.head&&(L.head.done=!1),!(1&L.wrap)||(((255&X)<<8)+(X>>8))%31){U.msg="incorrect header check",L.mode=30;break}if((15&X)!=8){U.msg="unknown compression method",L.mode=30;break}if(ie-=4,z=8+(15&(X>>>=4)),L.wbits===0)L.wbits=z;else if(z>L.wbits){U.msg="invalid window size",L.mode=30;break}L.dmax=1<<z,U.adler=L.check=1,L.mode=512&X?10:12,ie=X=0;break;case 2:for(;ie<16;){if(me===0)break e;me--,X+=te[J++]<<ie,ie+=8}if(L.flags=X,(255&L.flags)!=8){U.msg="unknown compression method",L.mode=30;break}if(57344&L.flags){U.msg="unknown header flags set",L.mode=30;break}L.head&&(L.head.text=X>>8&1),512&L.flags&&(se[0]=255&X,se[1]=X>>>8&255,L.check=l(L.check,se,2,0)),ie=X=0,L.mode=3;case 3:for(;ie<32;){if(me===0)break e;me--,X+=te[J++]<<ie,ie+=8}L.head&&(L.head.time=X),512&L.flags&&(se[0]=255&X,se[1]=X>>>8&255,se[2]=X>>>16&255,se[3]=X>>>24&255,L.check=l(L.check,se,4,0)),ie=X=0,L.mode=4;case 4:for(;ie<16;){if(me===0)break e;me--,X+=te[J++]<<ie,ie+=8}L.head&&(L.head.xflags=255&X,L.head.os=X>>8),512&L.flags&&(se[0]=255&X,se[1]=X>>>8&255,L.check=l(L.check,se,2,0)),ie=X=0,L.mode=5;case 5:if(1024&L.flags){for(;ie<16;){if(me===0)break e;me--,X+=te[J++]<<ie,ie+=8}L.length=X,L.head&&(L.head.extra_len=X),512&L.flags&&(se[0]=255&X,se[1]=X>>>8&255,L.check=l(L.check,se,2,0)),ie=X=0}else L.head&&(L.head.extra=null);L.mode=6;case 6:if(1024&L.flags&&(me<(Ce=L.length)&&(Ce=me),Ce&&(L.head&&(z=L.head.extra_len-L.length,L.head.extra||(L.head.extra=new Array(L.head.extra_len)),s.arraySet(L.head.extra,te,J,Ce,z)),512&L.flags&&(L.check=l(L.check,te,Ce,J)),me-=Ce,J+=Ce,L.length-=Ce),L.length))break e;L.length=0,L.mode=7;case 7:if(2048&L.flags){if(me===0)break e;for(Ce=0;z=te[J+Ce++],L.head&&z&&L.length<65536&&(L.head.name+=String.fromCharCode(z)),z&&Ce<me;);if(512&L.flags&&(L.check=l(L.check,te,Ce,J)),me-=Ce,J+=Ce,z)break e}else L.head&&(L.head.name=null);L.length=0,L.mode=8;case 8:if(4096&L.flags){if(me===0)break e;for(Ce=0;z=te[J+Ce++],L.head&&z&&L.length<65536&&(L.head.comment+=String.fromCharCode(z)),z&&Ce<me;);if(512&L.flags&&(L.check=l(L.check,te,Ce,J)),me-=Ce,J+=Ce,z)break e}else L.head&&(L.head.comment=null);L.mode=9;case 9:if(512&L.flags){for(;ie<16;){if(me===0)break e;me--,X+=te[J++]<<ie,ie+=8}if(X!==(65535&L.check)){U.msg="header crc mismatch",L.mode=30;break}ie=X=0}L.head&&(L.head.hcrc=L.flags>>9&1,L.head.done=!0),U.adler=L.check=0,L.mode=12;break;case 10:for(;ie<32;){if(me===0)break e;me--,X+=te[J++]<<ie,ie+=8}U.adler=L.check=v(X),ie=X=0,L.mode=11;case 11:if(L.havedict===0)return U.next_out=ue,U.avail_out=ge,U.next_in=J,U.avail_in=me,L.hold=X,L.bits=ie,2;U.adler=L.check=1,L.mode=12;case 12:if(G===5||G===6)break e;case 13:if(L.last){X>>>=7&ie,ie-=7&ie,L.mode=27;break}for(;ie<3;){if(me===0)break e;me--,X+=te[J++]<<ie,ie+=8}switch(L.last=1&X,ie-=1,3&(X>>>=1)){case 0:L.mode=14;break;case 1:if(D(L),L.mode=20,G!==6)break;X>>>=2,ie-=2;break e;case 2:L.mode=17;break;case 3:U.msg="invalid block type",L.mode=30}X>>>=2,ie-=2;break;case 14:for(X>>>=7&ie,ie-=7&ie;ie<32;){if(me===0)break e;me--,X+=te[J++]<<ie,ie+=8}if((65535&X)!=(X>>>16^65535)){U.msg="invalid stored block lengths",L.mode=30;break}if(L.length=65535&X,ie=X=0,L.mode=15,G===6)break e;case 15:L.mode=16;case 16:if(Ce=L.length){if(me<Ce&&(Ce=me),ge<Ce&&(Ce=ge),Ce===0)break e;s.arraySet(re,te,J,Ce,ue),me-=Ce,J+=Ce,ge-=Ce,ue+=Ce,L.length-=Ce;break}L.mode=12;break;case 17:for(;ie<14;){if(me===0)break e;me--,X+=te[J++]<<ie,ie+=8}if(L.nlen=257+(31&X),X>>>=5,ie-=5,L.ndist=1+(31&X),X>>>=5,ie-=5,L.ncode=4+(15&X),X>>>=4,ie-=4,286<L.nlen||30<L.ndist){U.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(;ie<3;){if(me===0)break e;me--,X+=te[J++]<<ie,ie+=8}L.lens[ce[L.have++]]=7&X,X>>>=3,ie-=3}for(;L.have<19;)L.lens[ce[L.have++]]=0;if(L.lencode=L.lendyn,L.lenbits=7,ee={bits:L.lenbits},V=d(0,L.lens,0,19,L.lencode,0,L.work,ee),L.lenbits=ee.bits,V){U.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(;E=(ne=L.lencode[X&(1<<L.lenbits)-1])>>>16&255,I=65535&ne,!((j=ne>>>24)<=ie);){if(me===0)break e;me--,X+=te[J++]<<ie,ie+=8}if(I<16)X>>>=j,ie-=j,L.lens[L.have++]=I;else{if(I===16){for(K=j+2;ie<K;){if(me===0)break e;me--,X+=te[J++]<<ie,ie+=8}if(X>>>=j,ie-=j,L.have===0){U.msg="invalid bit length repeat",L.mode=30;break}z=L.lens[L.have-1],Ce=3+(3&X),X>>>=2,ie-=2}else if(I===17){for(K=j+3;ie<K;){if(me===0)break e;me--,X+=te[J++]<<ie,ie+=8}ie-=j,z=0,Ce=3+(7&(X>>>=j)),X>>>=3,ie-=3}else{for(K=j+7;ie<K;){if(me===0)break e;me--,X+=te[J++]<<ie,ie+=8}ie-=j,z=0,Ce=11+(127&(X>>>=j)),X>>>=7,ie-=7}if(L.have+Ce>L.nlen+L.ndist){U.msg="invalid bit length repeat",L.mode=30;break}for(;Ce--;)L.lens[L.have++]=z}}if(L.mode===30)break;if(L.lens[256]===0){U.msg="invalid code -- missing end-of-block",L.mode=30;break}if(L.lenbits=9,ee={bits:L.lenbits},V=d(u,L.lens,0,L.nlen,L.lencode,0,L.work,ee),L.lenbits=ee.bits,V){U.msg="invalid literal/lengths set",L.mode=30;break}if(L.distbits=6,L.distcode=L.distdyn,ee={bits:L.distbits},V=d(m,L.lens,L.nlen,L.ndist,L.distcode,0,L.work,ee),L.distbits=ee.bits,V){U.msg="invalid distances set",L.mode=30;break}if(L.mode=20,G===6)break e;case 20:L.mode=21;case 21:if(6<=me&&258<=ge){U.next_out=ue,U.avail_out=ge,U.next_in=J,U.avail_in=me,L.hold=X,L.bits=ie,c(U,pe),ue=U.next_out,re=U.output,ge=U.avail_out,J=U.next_in,te=U.input,me=U.avail_in,X=L.hold,ie=L.bits,L.mode===12&&(L.back=-1);break}for(L.back=0;E=(ne=L.lencode[X&(1<<L.lenbits)-1])>>>16&255,I=65535&ne,!((j=ne>>>24)<=ie);){if(me===0)break e;me--,X+=te[J++]<<ie,ie+=8}if(E&&(240&E)==0){for(W=j,B=E,ae=I;E=(ne=L.lencode[ae+((X&(1<<W+B)-1)>>W)])>>>16&255,I=65535&ne,!(W+(j=ne>>>24)<=ie);){if(me===0)break e;me--,X+=te[J++]<<ie,ie+=8}X>>>=W,ie-=W,L.back+=W}if(X>>>=j,ie-=j,L.back+=j,L.length=I,E===0){L.mode=26;break}if(32&E){L.back=-1,L.mode=12;break}if(64&E){U.msg="invalid literal/length code",L.mode=30;break}L.extra=15&E,L.mode=22;case 22:if(L.extra){for(K=L.extra;ie<K;){if(me===0)break e;me--,X+=te[J++]<<ie,ie+=8}L.length+=X&(1<<L.extra)-1,X>>>=L.extra,ie-=L.extra,L.back+=L.extra}L.was=L.length,L.mode=23;case 23:for(;E=(ne=L.distcode[X&(1<<L.distbits)-1])>>>16&255,I=65535&ne,!((j=ne>>>24)<=ie);){if(me===0)break e;me--,X+=te[J++]<<ie,ie+=8}if((240&E)==0){for(W=j,B=E,ae=I;E=(ne=L.distcode[ae+((X&(1<<W+B)-1)>>W)])>>>16&255,I=65535&ne,!(W+(j=ne>>>24)<=ie);){if(me===0)break e;me--,X+=te[J++]<<ie,ie+=8}X>>>=W,ie-=W,L.back+=W}if(X>>>=j,ie-=j,L.back+=j,64&E){U.msg="invalid distance code",L.mode=30;break}L.offset=I,L.extra=15&E,L.mode=24;case 24:if(L.extra){for(K=L.extra;ie<K;){if(me===0)break e;me--,X+=te[J++]<<ie,ie+=8}L.offset+=X&(1<<L.extra)-1,X>>>=L.extra,ie-=L.extra,L.back+=L.extra}if(L.offset>L.dmax){U.msg="invalid distance too far back",L.mode=30;break}L.mode=25;case 25:if(ge===0)break e;if(Ce=pe-ge,L.offset>Ce){if((Ce=L.offset-Ce)>L.whave&&L.sane){U.msg="invalid distance too far back",L.mode=30;break}q=Ce>L.wnext?(Ce-=L.wnext,L.wsize-Ce):L.wnext-Ce,Ce>L.length&&(Ce=L.length),Z=L.window}else Z=re,q=ue-L.offset,Ce=L.length;for(ge<Ce&&(Ce=ge),ge-=Ce,L.length-=Ce;re[ue++]=Z[q++],--Ce;);L.length===0&&(L.mode=21);break;case 26:if(ge===0)break e;re[ue++]=L.length,ge--,L.mode=21;break;case 27:if(L.wrap){for(;ie<32;){if(me===0)break e;me--,X|=te[J++]<<ie,ie+=8}if(pe-=ge,U.total_out+=pe,L.total+=pe,pe&&(U.adler=L.check=L.flags?l(L.check,re,pe,ue-pe):o(L.check,re,pe,ue-pe)),pe=ge,(L.flags?X:v(X))!==L.check){U.msg="incorrect data check",L.mode=30;break}ie=X=0}L.mode=28;case 28:if(L.wrap&&L.flags){for(;ie<32;){if(me===0)break e;me--,X+=te[J++]<<ie,ie+=8}if(X!==(4294967295&L.total)){U.msg="incorrect length check",L.mode=30;break}ie=X=0}L.mode=29;case 29:V=1;break e;case 30:V=-3;break e;case 31:return-4;default:return f}return U.next_out=ue,U.avail_out=ge,U.next_in=J,U.avail_in=me,L.hold=X,L.bits=ie,(L.wsize||pe!==U.avail_out&&L.mode<30&&(L.mode<27||G!==4))&&$(U,U.output,U.next_out,pe-U.avail_out)?(L.mode=31,-4):(le-=U.avail_in,pe-=U.avail_out,U.total_in+=le,U.total_out+=pe,L.total+=pe,L.wrap&&pe&&(U.adler=L.check=L.flags?l(L.check,re,pe,U.next_out-pe):o(L.check,re,pe,U.next_out-pe)),U.data_type=L.bits+(L.last?64:0)+(L.mode===12?128:0)+(L.mode===20||L.mode===15?256:0),(le==0&&pe===0||G===4)&&V===p&&(V=-5),V)},a.inflateEnd=function(U){if(!U||!U.state)return f;var G=U.state;return G.window&&(G.window=null),U.state=null,p},a.inflateGetHeader=function(U,G){var L;return U&&U.state?(2&(L=U.state).wrap)==0?f:((L.head=G).done=!1,p):f},a.inflateSetDictionary=function(U,G){var L,te=G.length;return U&&U.state?(L=U.state).wrap!==0&&L.mode!==11?f:L.mode===11&&o(1,G,te,0)!==L.check?-3:$(U,G,te,te)?(L.mode=31,-4):(L.havedict=1,p):f},a.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(n,r,a){var s=n("../utils/common"),o=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],l=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],c=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],d=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];r.exports=function(u,m,p,f,y,x,b,v){var _,k,P,C,T,N,R,A,D,$=v.bits,U=0,G=0,L=0,te=0,re=0,J=0,ue=0,me=0,ge=0,X=0,ie=null,le=0,pe=new s.Buf16(16),Ce=new s.Buf16(16),q=null,Z=0;for(U=0;U<=15;U++)pe[U]=0;for(G=0;G<f;G++)pe[m[p+G]]++;for(re=$,te=15;1<=te&&pe[te]===0;te--);if(te<re&&(re=te),te===0)return y[x++]=20971520,y[x++]=20971520,v.bits=1,0;for(L=1;L<te&&pe[L]===0;L++);for(re<L&&(re=L),U=me=1;U<=15;U++)if(me<<=1,(me-=pe[U])<0)return-1;if(0<me&&(u===0||te!==1))return-1;for(Ce[1]=0,U=1;U<15;U++)Ce[U+1]=Ce[U]+pe[U];for(G=0;G<f;G++)m[p+G]!==0&&(b[Ce[m[p+G]]++]=G);if(N=u===0?(ie=q=b,19):u===1?(ie=o,le-=257,q=l,Z-=257,256):(ie=c,q=d,-1),U=L,T=x,ue=G=X=0,P=-1,C=(ge=1<<(J=re))-1,u===1&&852<ge||u===2&&592<ge)return 1;for(;;){for(R=U-ue,D=b[G]<N?(A=0,b[G]):b[G]>N?(A=q[Z+b[G]],ie[le+b[G]]):(A=96,0),_=1<<U-ue,L=k=1<<J;y[T+(X>>ue)+(k-=_)]=R<<24|A<<16|D|0,k!==0;);for(_=1<<U-1;X&_;)_>>=1;if(_!==0?(X&=_-1,X+=_):X=0,G++,--pe[U]==0){if(U===te)break;U=m[p+b[G]]}if(re<U&&(X&C)!==P){for(ue===0&&(ue=re),T+=L,me=1<<(J=U-ue);J+ue<te&&!((me-=pe[J+ue])<=0);)J++,me<<=1;if(ge+=1<<J,u===1&&852<ge||u===2&&592<ge)return 1;y[P=X&C]=re<<24|J<<16|T-x|0}}return X!==0&&(y[T+X]=U-ue<<24|64<<16|0),v.bits=re,0}},{"../utils/common":41}],51:[function(n,r,a){r.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,r,a){var s=n("../utils/common"),o=0,l=1;function c(ne){for(var se=ne.length;0<=--se;)ne[se]=0}var d=0,u=29,m=256,p=m+1+u,f=30,y=19,x=2*p+1,b=15,v=16,_=7,k=256,P=16,C=17,T=18,N=[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],R=[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],A=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],D=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],$=new Array(2*(p+2));c($);var U=new Array(2*f);c(U);var G=new Array(512);c(G);var L=new Array(256);c(L);var te=new Array(u);c(te);var re,J,ue,me=new Array(f);function ge(ne,se,ce,fe,oe){this.static_tree=ne,this.extra_bits=se,this.extra_base=ce,this.elems=fe,this.max_length=oe,this.has_stree=ne&&ne.length}function X(ne,se){this.dyn_tree=ne,this.max_code=0,this.stat_desc=se}function ie(ne){return ne<256?G[ne]:G[256+(ne>>>7)]}function le(ne,se){ne.pending_buf[ne.pending++]=255&se,ne.pending_buf[ne.pending++]=se>>>8&255}function pe(ne,se,ce){ne.bi_valid>v-ce?(ne.bi_buf|=se<<ne.bi_valid&65535,le(ne,ne.bi_buf),ne.bi_buf=se>>v-ne.bi_valid,ne.bi_valid+=ce-v):(ne.bi_buf|=se<<ne.bi_valid&65535,ne.bi_valid+=ce)}function Ce(ne,se,ce){pe(ne,ce[2*se],ce[2*se+1])}function q(ne,se){for(var ce=0;ce|=1&ne,ne>>>=1,ce<<=1,0<--se;);return ce>>>1}function Z(ne,se,ce){var fe,oe,O=new Array(b+1),F=0;for(fe=1;fe<=b;fe++)O[fe]=F=F+ce[fe-1]<<1;for(oe=0;oe<=se;oe++){var Q=ne[2*oe+1];Q!==0&&(ne[2*oe]=q(O[Q]++,Q))}}function j(ne){var se;for(se=0;se<p;se++)ne.dyn_ltree[2*se]=0;for(se=0;se<f;se++)ne.dyn_dtree[2*se]=0;for(se=0;se<y;se++)ne.bl_tree[2*se]=0;ne.dyn_ltree[2*k]=1,ne.opt_len=ne.static_len=0,ne.last_lit=ne.matches=0}function E(ne){8<ne.bi_valid?le(ne,ne.bi_buf):0<ne.bi_valid&&(ne.pending_buf[ne.pending++]=ne.bi_buf),ne.bi_buf=0,ne.bi_valid=0}function I(ne,se,ce,fe){var oe=2*se,O=2*ce;return ne[oe]<ne[O]||ne[oe]===ne[O]&&fe[se]<=fe[ce]}function W(ne,se,ce){for(var fe=ne.heap[ce],oe=ce<<1;oe<=ne.heap_len&&(oe<ne.heap_len&&I(se,ne.heap[oe+1],ne.heap[oe],ne.depth)&&oe++,!I(se,fe,ne.heap[oe],ne.depth));)ne.heap[ce]=ne.heap[oe],ce=oe,oe<<=1;ne.heap[ce]=fe}function B(ne,se,ce){var fe,oe,O,F,Q=0;if(ne.last_lit!==0)for(;fe=ne.pending_buf[ne.d_buf+2*Q]<<8|ne.pending_buf[ne.d_buf+2*Q+1],oe=ne.pending_buf[ne.l_buf+Q],Q++,fe===0?Ce(ne,oe,se):(Ce(ne,(O=L[oe])+m+1,se),(F=N[O])!==0&&pe(ne,oe-=te[O],F),Ce(ne,O=ie(--fe),ce),(F=R[O])!==0&&pe(ne,fe-=me[O],F)),Q<ne.last_lit;);Ce(ne,k,se)}function ae(ne,se){var ce,fe,oe,O=se.dyn_tree,F=se.stat_desc.static_tree,Q=se.stat_desc.has_stree,ve=se.stat_desc.elems,he=-1;for(ne.heap_len=0,ne.heap_max=x,ce=0;ce<ve;ce++)O[2*ce]!==0?(ne.heap[++ne.heap_len]=he=ce,ne.depth[ce]=0):O[2*ce+1]=0;for(;ne.heap_len<2;)O[2*(oe=ne.heap[++ne.heap_len]=he<2?++he:0)]=1,ne.depth[oe]=0,ne.opt_len--,Q&&(ne.static_len-=F[2*oe+1]);for(se.max_code=he,ce=ne.heap_len>>1;1<=ce;ce--)W(ne,O,ce);for(oe=ve;ce=ne.heap[1],ne.heap[1]=ne.heap[ne.heap_len--],W(ne,O,1),fe=ne.heap[1],ne.heap[--ne.heap_max]=ce,ne.heap[--ne.heap_max]=fe,O[2*oe]=O[2*ce]+O[2*fe],ne.depth[oe]=(ne.depth[ce]>=ne.depth[fe]?ne.depth[ce]:ne.depth[fe])+1,O[2*ce+1]=O[2*fe+1]=oe,ne.heap[1]=oe++,W(ne,O,1),2<=ne.heap_len;);ne.heap[--ne.heap_max]=ne.heap[1],(function(de,Ae){var _e,ze,Be,Ue,Ne,Ee,ke=Ae.dyn_tree,Me=Ae.max_code,Ge=Ae.stat_desc.static_tree,xe=Ae.stat_desc.has_stree,He=Ae.stat_desc.extra_bits,Pe=Ae.stat_desc.extra_base,Ve=Ae.stat_desc.max_length,je=0;for(Ue=0;Ue<=b;Ue++)de.bl_count[Ue]=0;for(ke[2*de.heap[de.heap_max]+1]=0,_e=de.heap_max+1;_e<x;_e++)Ve<(Ue=ke[2*ke[2*(ze=de.heap[_e])+1]+1]+1)&&(Ue=Ve,je++),ke[2*ze+1]=Ue,Me<ze||(de.bl_count[Ue]++,Ne=0,Pe<=ze&&(Ne=He[ze-Pe]),Ee=ke[2*ze],de.opt_len+=Ee*(Ue+Ne),xe&&(de.static_len+=Ee*(Ge[2*ze+1]+Ne)));if(je!==0){do{for(Ue=Ve-1;de.bl_count[Ue]===0;)Ue--;de.bl_count[Ue]--,de.bl_count[Ue+1]+=2,de.bl_count[Ve]--,je-=2}while(0<je);for(Ue=Ve;Ue!==0;Ue--)for(ze=de.bl_count[Ue];ze!==0;)Me<(Be=de.heap[--_e])||(ke[2*Be+1]!==Ue&&(de.opt_len+=(Ue-ke[2*Be+1])*ke[2*Be],ke[2*Be+1]=Ue),ze--)}})(ne,se),Z(O,he,ne.bl_count)}function z(ne,se,ce){var fe,oe,O=-1,F=se[1],Q=0,ve=7,he=4;for(F===0&&(ve=138,he=3),se[2*(ce+1)+1]=65535,fe=0;fe<=ce;fe++)oe=F,F=se[2*(fe+1)+1],++Q<ve&&oe===F||(Q<he?ne.bl_tree[2*oe]+=Q:oe!==0?(oe!==O&&ne.bl_tree[2*oe]++,ne.bl_tree[2*P]++):Q<=10?ne.bl_tree[2*C]++:ne.bl_tree[2*T]++,O=oe,he=(Q=0)===F?(ve=138,3):oe===F?(ve=6,3):(ve=7,4))}function V(ne,se,ce){var fe,oe,O=-1,F=se[1],Q=0,ve=7,he=4;for(F===0&&(ve=138,he=3),fe=0;fe<=ce;fe++)if(oe=F,F=se[2*(fe+1)+1],!(++Q<ve&&oe===F)){if(Q<he)for(;Ce(ne,oe,ne.bl_tree),--Q!=0;);else oe!==0?(oe!==O&&(Ce(ne,oe,ne.bl_tree),Q--),Ce(ne,P,ne.bl_tree),pe(ne,Q-3,2)):Q<=10?(Ce(ne,C,ne.bl_tree),pe(ne,Q-3,3)):(Ce(ne,T,ne.bl_tree),pe(ne,Q-11,7));O=oe,he=(Q=0)===F?(ve=138,3):oe===F?(ve=6,3):(ve=7,4)}}c(me);var ee=!1;function K(ne,se,ce,fe){pe(ne,(d<<1)+(fe?1:0),3),(function(oe,O,F,Q){E(oe),le(oe,F),le(oe,~F),s.arraySet(oe.pending_buf,oe.window,O,F,oe.pending),oe.pending+=F})(ne,se,ce)}a._tr_init=function(ne){ee||((function(){var se,ce,fe,oe,O,F=new Array(b+1);for(oe=fe=0;oe<u-1;oe++)for(te[oe]=fe,se=0;se<1<<N[oe];se++)L[fe++]=oe;for(L[fe-1]=oe,oe=O=0;oe<16;oe++)for(me[oe]=O,se=0;se<1<<R[oe];se++)G[O++]=oe;for(O>>=7;oe<f;oe++)for(me[oe]=O<<7,se=0;se<1<<R[oe]-7;se++)G[256+O++]=oe;for(ce=0;ce<=b;ce++)F[ce]=0;for(se=0;se<=143;)$[2*se+1]=8,se++,F[8]++;for(;se<=255;)$[2*se+1]=9,se++,F[9]++;for(;se<=279;)$[2*se+1]=7,se++,F[7]++;for(;se<=287;)$[2*se+1]=8,se++,F[8]++;for(Z($,p+1,F),se=0;se<f;se++)U[2*se+1]=5,U[2*se]=q(se,5);re=new ge($,N,m+1,p,b),J=new ge(U,R,0,f,b),ue=new ge(new Array(0),A,0,y,_)})(),ee=!0),ne.l_desc=new X(ne.dyn_ltree,re),ne.d_desc=new X(ne.dyn_dtree,J),ne.bl_desc=new X(ne.bl_tree,ue),ne.bi_buf=0,ne.bi_valid=0,j(ne)},a._tr_stored_block=K,a._tr_flush_block=function(ne,se,ce,fe){var oe,O,F=0;0<ne.level?(ne.strm.data_type===2&&(ne.strm.data_type=(function(Q){var ve,he=4093624447;for(ve=0;ve<=31;ve++,he>>>=1)if(1&he&&Q.dyn_ltree[2*ve]!==0)return o;if(Q.dyn_ltree[18]!==0||Q.dyn_ltree[20]!==0||Q.dyn_ltree[26]!==0)return l;for(ve=32;ve<m;ve++)if(Q.dyn_ltree[2*ve]!==0)return l;return o})(ne)),ae(ne,ne.l_desc),ae(ne,ne.d_desc),F=(function(Q){var ve;for(z(Q,Q.dyn_ltree,Q.l_desc.max_code),z(Q,Q.dyn_dtree,Q.d_desc.max_code),ae(Q,Q.bl_desc),ve=y-1;3<=ve&&Q.bl_tree[2*D[ve]+1]===0;ve--);return Q.opt_len+=3*(ve+1)+5+5+4,ve})(ne),oe=ne.opt_len+3+7>>>3,(O=ne.static_len+3+7>>>3)<=oe&&(oe=O)):oe=O=ce+5,ce+4<=oe&&se!==-1?K(ne,se,ce,fe):ne.strategy===4||O===oe?(pe(ne,2+(fe?1:0),3),B(ne,$,U)):(pe(ne,4+(fe?1:0),3),(function(Q,ve,he,de){var Ae;for(pe(Q,ve-257,5),pe(Q,he-1,5),pe(Q,de-4,4),Ae=0;Ae<de;Ae++)pe(Q,Q.bl_tree[2*D[Ae]+1],3);V(Q,Q.dyn_ltree,ve-1),V(Q,Q.dyn_dtree,he-1)})(ne,ne.l_desc.max_code+1,ne.d_desc.max_code+1,F+1),B(ne,ne.dyn_ltree,ne.dyn_dtree)),j(ne),fe&&E(ne)},a._tr_tally=function(ne,se,ce){return ne.pending_buf[ne.d_buf+2*ne.last_lit]=se>>>8&255,ne.pending_buf[ne.d_buf+2*ne.last_lit+1]=255&se,ne.pending_buf[ne.l_buf+ne.last_lit]=255&ce,ne.last_lit++,se===0?ne.dyn_ltree[2*ce]++:(ne.matches++,se--,ne.dyn_ltree[2*(L[ce]+m+1)]++,ne.dyn_dtree[2*ie(se)]++),ne.last_lit===ne.lit_bufsize-1},a._tr_align=function(ne){pe(ne,2,3),Ce(ne,k,$),(function(se){se.bi_valid===16?(le(se,se.bi_buf),se.bi_buf=0,se.bi_valid=0):8<=se.bi_valid&&(se.pending_buf[se.pending++]=255&se.bi_buf,se.bi_buf>>=8,se.bi_valid-=8)})(ne)}},{"../utils/common":41}],53:[function(n,r,a){r.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,r,a){(function(s){(function(o,l){if(!o.setImmediate){var c,d,u,m,p=1,f={},y=!1,x=o.document,b=Object.getPrototypeOf&&Object.getPrototypeOf(o);b=b&&b.setTimeout?b:o,c={}.toString.call(o.process)==="[object process]"?function(P){process.nextTick(function(){_(P)})}:(function(){if(o.postMessage&&!o.importScripts){var P=!0,C=o.onmessage;return o.onmessage=function(){P=!1},o.postMessage("","*"),o.onmessage=C,P}})()?(m="setImmediate$"+Math.random()+"$",o.addEventListener?o.addEventListener("message",k,!1):o.attachEvent("onmessage",k),function(P){o.postMessage(m+P,"*")}):o.MessageChannel?((u=new MessageChannel).port1.onmessage=function(P){_(P.data)},function(P){u.port2.postMessage(P)}):x&&"onreadystatechange"in x.createElement("script")?(d=x.documentElement,function(P){var C=x.createElement("script");C.onreadystatechange=function(){_(P),C.onreadystatechange=null,d.removeChild(C),C=null},d.appendChild(C)}):function(P){setTimeout(_,0,P)},b.setImmediate=function(P){typeof P!="function"&&(P=new Function(""+P));for(var C=new Array(arguments.length-1),T=0;T<C.length;T++)C[T]=arguments[T+1];var N={callback:P,args:C};return f[p]=N,c(p),p++},b.clearImmediate=v}function v(P){delete f[P]}function _(P){if(y)setTimeout(_,0,P);else{var C=f[P];if(C){y=!0;try{(function(T){var N=T.callback,R=T.args;switch(R.length){case 0:N();break;case 1:N(R[0]);break;case 2:N(R[0],R[1]);break;case 3:N(R[0],R[1],R[2]);break;default:N.apply(l,R)}})(C)}finally{v(P),y=!1}}}}function k(P){P.source===o&&typeof P.data=="string"&&P.data.indexOf(m)===0&&_(+P.data.slice(m.length))}})(typeof self>"u"?s===void 0?this:s:self)}).call(this,typeof yS<"u"?yS:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(IM)),IM.exports}var l_e=o_e();const c_e=Pl(l_e);function d_e(t){const e=new oa;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 b6=d_e;async function x6(t,e=0){const n=[],r=t.getElementsByTagName("mesh");for(let a=0;a<r.length;a++){const s=r[a],o=[],l=[],c=s.getElementsByTagName("vertex");for(let u=0;u<c.length;u++){const m=c[u];o.push(parseFloat(m.getAttribute("x")||"0"),parseFloat(m.getAttribute("y")||"0"),parseFloat(m.getAttribute("z")||"0"))}const d=s.getElementsByTagName("triangle");for(let u=0;u<d.length;u++){const m=d[u];l.push(parseInt(m.getAttribute("v1")||"0"),parseInt(m.getAttribute("v2")||"0"),parseInt(m.getAttribute("v3")||"0"))}o.length>0&&l.length>0&&n.push({vertices:o,triangles:l,extruder:e})}return n}function y6(t){const e=Array.from(t.attributes).find(r=>{const a=r.name.toLowerCase();return a==="plate_id"||a==="plater_id"||a==="plateid"||a==="platerid"||a.endsWith(":plate_id")||a.endsWith(":plater_id")});if(!e?.value)return null;const n=Number.parseInt(e.value,10);return Number.isFinite(n)?n:null}async function u_e(t){let e;try{e=await c_e.loadAsync(t)}catch{throw new Error("Unsupported file format")}const n=new Map,r=[],a=new Map,s=new Map,o=new DOMParser;async function l(k){const P=k.startsWith("/")?k.slice(1):k,C=e.files[P];if(!C)return null;const T=await C.async("string");return o.parseFromString(T,"application/xml")}const c=new Map,d=new Map,u=new Map,m=new Map,p=e.files["Metadata/model_settings.config"];if(p)try{const k=await p.async("string"),P=o.parseFromString(k,"application/xml"),C=P.getElementsByTagName("object");for(let N=0;N<C.length;N++){const R=C[N],A=R.getAttribute("id");if(!A)continue;const D=Array.from(R.children).filter(L=>L.tagName==="metadata"&&L.getAttribute("key")==="extruder");if(D.length>0){const L=D[0].getAttribute("value");L&&c.set(A,Math.max(0,parseInt(L,10)-1))}const U=Array.from(R.children).find(L=>L.tagName==="metadata"&&L.getAttribute("key")==="name")?.getAttribute("value");U&&u.set(A,U);const G=R.getElementsByTagName("part");for(let L=0;L<G.length;L++){const te=G[L],re=te.getAttribute("id");if(!re)continue;const J=Array.from(te.children).filter(ue=>ue.tagName==="metadata"&&ue.getAttribute("key")==="extruder");if(J.length>0){const ue=J[0].getAttribute("value");ue&&d.set(`${A}:${re}`,Math.max(0,parseInt(ue,10)-1))}}}const T=P.getElementsByTagName("plate");for(let N=0;N<T.length;N++){const R=T[N];let A=null;const D=R.getElementsByTagName("metadata");let $=0,U=0;for(let L=0;L<D.length;L++){const te=D[L],re=te.getAttribute("key");if(re==="plater_id"||re==="plate_id"){const J=te.getAttribute("value");if(J){const ue=Number.parseInt(J,10);Number.isFinite(ue)&&(A=ue)}}else if(re==="pos_x"){const J=te.getAttribute("value"),ue=J?Number.parseFloat(J):Number.NaN;Number.isFinite(ue)&&($=ue)}else if(re==="pos_y"){const J=te.getAttribute("value"),ue=J?Number.parseFloat(J):Number.NaN;Number.isFinite(ue)&&(U=ue)}}if(A==null)continue;($!==0||U!==0)&&s.set(A,{offsetX:$,offsetY:U});const G=R.getElementsByTagName("model_instance");for(let L=0;L<G.length;L++){const re=G[L].getElementsByTagName("metadata");for(let J=0;J<re.length;J++){const ue=re[J];if(ue.getAttribute("key")==="object_id"){const me=ue.getAttribute("value");me&&m.set(me,A)}}}}}catch{}const f=new Map,y=Object.keys(e.files).filter(k=>k.startsWith("Metadata/plate_")&&k.endsWith(".json"));for(const k of y){const P=k.match(/^Metadata\/plate_(\d+)\.json$/);if(!P)continue;const C=Number.parseInt(P[1],10);if(Number.isFinite(C))try{const T=await e.files[k].async("string"),N=JSON.parse(T),R=N.bbox_objects??[];for(const A of R)A?.name&&f.set(A.name,C);if(Array.isArray(N.bbox_all)&&N.bbox_all.length>=4){const[A,D,$,U]=N.bbox_all;[A,D,$,U].every(G=>Number.isFinite(G))&&a.set(C,{minX:A,minY:D,maxX:$,maxY:U})}}catch{}}const x=Object.keys(e.files).find(k=>k==="3D/3dmodel.model"||k.endsWith("/3dmodel.model"));if(!x){const k=Object.keys(e.files).find(P=>P.endsWith(".model"));if(k){const P=await l(k);if(P){const C=await x6(P,0);C.length>0&&n.set("1",{id:"1",meshes:C,defaultExtruder:0})}}return{objects:n,buildItems:r,plateBounds:a,plateOffsets:s}}const b=await l(x);if(!b)return{objects:n,buildItems:r,plateBounds:a,plateOffsets:s};const v=b.getElementsByTagName("object");for(let k=0;k<v.length;k++){const P=v[k],C=P.getAttribute("id");if(!C)continue;const T=y6(P)??m.get(C)??null;let N=c.get(C)??-1;if(N<0){const $=P.getAttribute("p:extruder")||P.getAttributeNS("http://schemas.microsoft.com/3dmanufacturing/production/2015/06","extruder")||"1";N=Math.max(0,parseInt($,10)-1)}const R=[],A=P.getElementsByTagName("mesh");for(let $=0;$<A.length;$++){const U=A[$],G=[],L=[],te=U.getElementsByTagName("vertex");for(let J=0;J<te.length;J++){const ue=te[J];G.push(parseFloat(ue.getAttribute("x")||"0"),parseFloat(ue.getAttribute("y")||"0"),parseFloat(ue.getAttribute("z")||"0"))}const re=U.getElementsByTagName("triangle");for(let J=0;J<re.length;J++){const ue=re[J];L.push(parseInt(ue.getAttribute("v1")||"0"),parseInt(ue.getAttribute("v2")||"0"),parseInt(ue.getAttribute("v3")||"0"))}G.length>0&&L.length>0&&R.push({vertices:G,triangles:L,extruder:N})}const D=P.getElementsByTagName("component");for(let $=0;$<D.length;$++){const U=D[$],G=U.getAttribute("p:path")||U.getAttributeNS("http://schemas.microsoft.com/3dmanufacturing/production/2015/06","path"),L=U.getAttribute("objectid");if(G){const te=await l(G);if(te){const re=L?`${C}:${L}`:null,J=re?d.get(re)??N:N,ue=await x6(te,J),me=U.getAttribute("transform"),ge=b6(me);for(const X of ue)if(me){const ie=[];for(let le=0;le<X.vertices.length;le+=3){const pe=new wt(X.vertices[le],X.vertices[le+1],X.vertices[le+2]);pe.applyMatrix4(ge),ie.push(pe.x,pe.y,pe.z)}R.push({vertices:ie,triangles:X.triangles,extruder:X.extruder})}else R.push(X)}}}R.length>0&&n.set(C,{id:C,meshes:R,defaultExtruder:N,plateId:T})}const _=b.getElementsByTagName("build");if(_.length>0){const k=_[0].getElementsByTagName("item");for(let P=0;P<k.length;P++){const C=k[P],T=C.getAttribute("objectid");if(!T)continue;const N=b6(C.getAttribute("transform")),R=y6(C),A=n.get(T)?.plateId??null,D=u.get(T),$=D?f.get(D)??null:null;r.push({objectId:T,transform:N,plateId:R??A??$??null})}}return{objects:n,buildItems:r,plateBounds:a,plateOffsets:s}}function v6(t){const e=new _l,n=new Float32Array(t.vertices.length);for(let r=0;r<t.vertices.length;r+=3)n[r]=t.vertices[r],n[r+1]=t.vertices[r+2],n[r+2]=t.vertices[r+1];return e.setAttribute("position",new Ls(n,3)),e.setIndex(t.triangles),e.computeVertexNormals(),e}function m_e(t){t.traverse(e=>{if(e instanceof kl)if(e.geometry.dispose(),Array.isArray(e.material))for(const n of e.material)n.dispose();else e.material.dispose()})}function h_e(t,e,n){const{objects:r,buildItems:a}=t,s=new ab,o=m=>{const f=n?.[m]||"#00ae42",y=new Zn(f);return new HX({color:y,shininess:30,flatShading:!1})},l=new Map,c=a.some(m=>m.plateId!=null),d=e==null||!c?a:a.filter(m=>m.plateId===e),u=d.length>0?d:a;if(u.length>0)for(const m of u){const p=r.get(m.objectId);if(p)for(const f of p.meshes){const y=m.extruder??f.extruder,x=[];for(let v=0;v<f.vertices.length;v+=3){const _=new wt(f.vertices[v],f.vertices[v+1],f.vertices[v+2]);_.applyMatrix4(m.transform),x.push(_.x,_.y,_.z)}const b=v6({vertices:x,triangles:f.triangles});l.has(y)||l.set(y,[]),l.get(y).push(b)}}else for(const m of r.values())for(const p of m.meshes){const f=p.extruder,y=v6(p);l.has(f)||l.set(f,[]),l.get(f).push(y)}for(const[m,p]of l){if(p.length===0)continue;const f=p.length===1?p[0]:a_e(p,!1);if(f){const y=o(m),x=new kl(f,y);s.add(x)}if(p.length>1)for(const y of p)y.dispose()}return s}function QX({url:t,fileType:e,buildVolume:n={x:256,y:256,z:256},filamentColors:r,selectedPlateId:a=null,className:s=""}){const{t:o}=Mt(),l=w.useRef(null),c=w.useRef(null),d=w.useRef(null),u=w.useRef(null),m=w.useRef(null),p=w.useRef(null),f=w.useRef(null),y=w.useRef(null),[x,b]=w.useState(!0),[v,_]=w.useState(null),[k,P]=w.useState(null),[C,T]=w.useState(null);w.useEffect(()=>{if(!l.current)return;const A=l.current,D=A.clientWidth,$=A.clientHeight,U=new zxe;U.background=new Zn(1710618),d.current=U;const G=new ll(45,D/$,.1,1e4);G.position.set(150,150,150),u.current=G;const L=new qSe({antialias:!0});L.setSize(D,$),L.setPixelRatio(window.devicePixelRatio),A.appendChild(L.domElement),c.current=L;const te=new GSe(G,L.domElement);te.enableDamping=!0,te.dampingFactor=.05,m.current=te;const re=new eye(16777215,.6);U.add(re);const J=new B8(16777215,.8);J.position.set(100,100,100),U.add(J);const ue=new B8(16777215,.4);ue.position.set(-100,50,-100),U.add(ue);const me=Math.max(n.x,n.y),ge=Math.ceil(me/16),X=new nye(me,ge,4473924,3355443);U.add(X),y.current=X;const ie=new fL(n.x,n.y),le=new mL({color:44610,transparent:!0,opacity:.15,side:Mc}),pe=new kl(ie,le);pe.rotation.x=-Math.PI/2,pe.position.y=-.5,U.add(pe),f.current=pe;let Ce;const q=()=>{Ce=requestAnimationFrame(q),te.update(),L.render(U,G)};q(),b(!0),_(null),P(null),T(null);const Z=(e||t.split("?")[0].split(".").pop()||"").toLowerCase(),j={},E=uu();E&&(j.Authorization=`Bearer ${E}`),Z==="stl"?fetch(t,{headers:j}).then(B=>{if(!B.ok)throw new Error(o("modelViewer.errors.failedToLoad"));return B.arrayBuffer()}).then(B=>{const z=new s_e().parse(B);z.computeVertexNormals(),z.rotateX(-Math.PI/2),T(z)}).catch(B=>{_(B.message),b(!1)}):Z==="3mf"?fetch(t,{headers:j}).then(B=>{if(!B.ok)throw new Error(o("modelViewer.errors.failedToLoad"));return B.arrayBuffer()}).then(u_e).then(B=>{if(B.objects.size===0)throw new Error(o("modelViewer.errors.noMeshes"));P(B)}).catch(B=>{_(B.message),b(!1)}):(_(o("modelViewer.errors.unsupportedFormat")),b(!1));const I=()=>{if(!A)return;const B=A.clientWidth,ae=A.clientHeight;B===0||ae===0||(G.aspect=B/ae,G.updateProjectionMatrix(),L.setSize(B,ae))};window.addEventListener("resize",I);const W=new ResizeObserver(()=>{I()});return W.observe(A),()=>{window.removeEventListener("resize",I),W.disconnect(),cancelAnimationFrame(Ce),te.dispose(),L.dispose(),A.removeChild(L.domElement),p.current=null,f.current=null,y.current=null}},[t,n,e,o]),w.useEffect(()=>{if(!d.current||!u.current||!m.current||!k&&!C)return;p.current&&(d.current.remove(p.current),m_e(p.current));const A=!!C,D=A?(()=>{const Z=r?.[0]||"#00ae42",j=new HX({color:new Zn(Z),shininess:30}),E=new kl(C,j),I=new ab;return I.add(E),I})():h_e(k,a??null,r);p.current=D,d.current.add(D);const $=new Wm().setFromObject(D),U=$.getCenter(new wt);D.position.y=-$.min.y;const G=!A&&a!=null&&k.buildItems.length>0?k.plateBounds.get(a):void 0,L=!A&&a!=null?k.plateOffsets.get(a):void 0,te=A||k.buildItems.length===0||a!=null&&!G&&!L,re=te?-U.x:0,J=te?-U.z:0;let ue=0,me=0;if(!A&&a!=null&&k.buildItems.length>0&&G){const Z=new Wm().setFromObject(D);ue=Z.min.x-G.minX,me=Z.min.z-G.minY}const ge=n.x/2,X=n.y/2;!A&&a!=null&&k.buildItems.length>0&&G?(D.position.x=re-ue,D.position.z=J-me):!A&&a!=null&&L?(D.position.x=re+(ge-L.offsetX),D.position.z=J+(X-L.offsetY)):te?(D.position.x=re+ge,D.position.z=J+X):(D.position.x=re,D.position.z=J),f.current&&(f.current.position.x=ge,f.current.position.z=X),y.current&&(y.current.position.x=ge,y.current.position.z=X);const ie=new Wm().setFromObject(D),le=ie.getCenter(new wt),pe=ie.getSize(new wt),q=Math.max(pe.x,pe.y,pe.z)*1.8;u.current.position.set(le.x+q*.7,le.y+q*.5,le.z+q*.7),m.current.target.copy(le),m.current.update(),b(!1)},[k,C,a,r,n]);const N=()=>{u.current&&m.current&&(u.current.position.set(150,150,150),m.current.target.set(0,50,0),m.current.update())},R=A=>{u.current&&u.current.position.multiplyScalar(A)};return i.jsxs("div",{className:`relative ${s}`,children:[i.jsx("div",{ref:l,className:"w-full h-full min-h-[400px]"}),x&&i.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-bambu-dark/80",children:i.jsx(ct,{className:"w-8 h-8 text-bambu-green animate-spin"})}),v&&i.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-bambu-dark/80",children:i.jsx("p",{className:"text-red-400",children:v})}),!x&&!v&&i.jsxs("div",{className:"absolute bottom-4 right-4 flex gap-2",children:[i.jsx(Fe,{variant:"secondary",size:"sm",onClick:()=>R(.8),children:i.jsx(ZF,{className:"w-4 h-4"})}),i.jsx(Fe,{variant:"secondary",size:"sm",onClick:()=>R(1.25),children:i.jsx(JF,{className:"w-4 h-4"})}),i.jsx(Fe,{variant:"secondary",size:"sm",onClick:N,children:i.jsx(uo,{className:"w-4 h-4"})})]})]})}const kC="159",vg={ROTATE:0,DOLLY:1,PAN:2},wg={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},p_e=0,w6=1,f_e=2,ZX=1,g_e=2,Od=3,sh=0,so=1,Bd=2,Km=0,xb=1,S6=2,_6=3,k6=4,b_e=5,lp=100,x_e=101,y_e=102,N6=103,C6=104,v_e=200,w_e=201,S_e=202,__e=203,_3=204,k3=205,k_e=206,N_e=207,C_e=208,T_e=209,P_e=210,A_e=211,M_e=212,E_e=213,j_e=214,D_e=0,R_e=1,F_e=2,ek=3,L_e=4,O_e=5,I_e=6,z_e=7,xL=0,U_e=1,B_e=2,Ym=0,H_e=1,$_e=2,q_e=3,V_e=4,G_e=5,JX=300,Ib=301,zb=302,N3=303,C3=304,NC=306,T3=1e3,Vl=1001,P3=1002,Xa=1003,T6=1004,zM=1005,cl=1006,W_e=1007,Gv=1008,Xm=1009,K_e=1010,Y_e=1011,yL=1012,eQ=1013,jm=1014,Wd=1015,Wv=1016,tQ=1017,nQ=1018,Tp=1020,X_e=1021,dl=1023,Q_e=1024,Z_e=1025,Pp=1026,Ub=1027,J_e=1028,rQ=1029,e1e=1030,iQ=1031,aQ=1033,UM=33776,BM=33777,HM=33778,$M=33779,P6=35840,A6=35841,M6=35842,E6=35843,sQ=36196,j6=37492,D6=37496,R6=37808,F6=37809,L6=37810,O6=37811,I6=37812,z6=37813,U6=37814,B6=37815,H6=37816,$6=37817,q6=37818,V6=37819,G6=37820,W6=37821,qM=36492,K6=36494,Y6=36495,t1e=36283,X6=36284,Q6=36285,Z6=36286,oQ=3e3,Ap=3001,n1e=3200,r1e=3201,lQ=0,i1e=1,ul="",Qa="srgb",hu="srgb-linear",vL="display-p3",CC="display-p3-linear",tk="linear",si="srgb",nk="rec709",rk="p3",Sg=7680,J6=519,a1e=512,s1e=513,o1e=514,cQ=515,l1e=516,c1e=517,d1e=518,u1e=519,A3=35044,eH="300 es",M3=1035,Rc=2e3,Kv=2001;class yf{addEventListener(e,n){this._listeners===void 0&&(this._listeners={});const r=this._listeners;r[e]===void 0&&(r[e]=[]),r[e].indexOf(n)===-1&&r[e].push(n)}hasEventListener(e,n){if(this._listeners===void 0)return!1;const r=this._listeners;return r[e]!==void 0&&r[e].indexOf(n)!==-1}removeEventListener(e,n){if(this._listeners===void 0)return;const a=this._listeners[e];if(a!==void 0){const s=a.indexOf(n);s!==-1&&a.splice(s,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const r=this._listeners[e.type];if(r!==void 0){e.target=this;const a=r.slice(0);for(let s=0,o=a.length;s<o;s++)a[s].call(this,e);e.target=null}}}const ss=["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 tH=1234567;const ov=Math.PI/180,Yv=180/Math.PI;function eu(){const t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,n=Math.random()*4294967295|0,r=Math.random()*4294967295|0;return(ss[t&255]+ss[t>>8&255]+ss[t>>16&255]+ss[t>>24&255]+"-"+ss[e&255]+ss[e>>8&255]+"-"+ss[e>>16&15|64]+ss[e>>24&255]+"-"+ss[n&63|128]+ss[n>>8&255]+"-"+ss[n>>16&255]+ss[n>>24&255]+ss[r&255]+ss[r>>8&255]+ss[r>>16&255]+ss[r>>24&255]).toLowerCase()}function Za(t,e,n){return Math.max(e,Math.min(n,t))}function wL(t,e){return(t%e+e)%e}function m1e(t,e,n,r,a){return r+(t-e)*(a-r)/(n-e)}function h1e(t,e,n){return t!==e?(n-t)/(e-t):0}function lv(t,e,n){return(1-n)*t+n*e}function p1e(t,e,n,r){return lv(t,e,1-Math.exp(-n*r))}function f1e(t,e=1){return e-Math.abs(wL(t,e*2)-e)}function g1e(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e),t*t*(3-2*t))}function b1e(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e),t*t*t*(t*(t*6-15)+10))}function x1e(t,e){return t+Math.floor(Math.random()*(e-t+1))}function y1e(t,e){return t+Math.random()*(e-t)}function v1e(t){return t*(.5-Math.random())}function w1e(t){t!==void 0&&(tH=t);let e=tH+=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 S1e(t){return t*ov}function _1e(t){return t*Yv}function E3(t){return(t&t-1)===0&&t!==0}function k1e(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))}function ik(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}function N1e(t,e,n,r,a){const s=Math.cos,o=Math.sin,l=s(n/2),c=o(n/2),d=s((e+r)/2),u=o((e+r)/2),m=s((e-r)/2),p=o((e-r)/2),f=s((r-e)/2),y=o((r-e)/2);switch(a){case"XYX":t.set(l*u,c*m,c*p,l*d);break;case"YZY":t.set(c*p,l*u,c*m,l*d);break;case"ZXZ":t.set(c*m,c*p,l*u,l*d);break;case"XZX":t.set(l*u,c*y,c*f,l*d);break;case"YXY":t.set(c*f,l*u,c*y,l*d);break;case"ZYZ":t.set(c*y,c*f,l*u,l*d);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+a)}}function Ec(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 Br(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 dQ={DEG2RAD:ov,RAD2DEG:Yv,generateUUID:eu,clamp:Za,euclideanModulo:wL,mapLinear:m1e,inverseLerp:h1e,lerp:lv,damp:p1e,pingpong:f1e,smoothstep:g1e,smootherstep:b1e,randInt:x1e,randFloat:y1e,randFloatSpread:v1e,seededRandom:w1e,degToRad:S1e,radToDeg:_1e,isPowerOfTwo:E3,ceilPowerOfTwo:k1e,floorPowerOfTwo:ik,setQuaternionFromProperEuler:N1e,normalize:Br,denormalize:Ec};class Fn{constructor(e=0,n=0){Fn.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,r=this.y,a=e.elements;return this.x=a[0]*n+a[3]*r+a[6],this.y=a[1]*n+a[4]*r+a[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 r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(n,r)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=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 r=this.dot(e)/n;return Math.acos(Za(r,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const n=this.x-e.x,r=this.y-e.y;return n*n+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,n){return this.x+=(e.x-this.x)*n,this.y+=(e.y-this.y)*n,this}lerpVectors(e,n,r){return this.x=e.x+(n.x-e.x)*r,this.y=e.y+(n.y-e.y)*r,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 r=Math.cos(n),a=Math.sin(n),s=this.x-e.x,o=this.y-e.y;return this.x=s*r-o*a+e.x,this.y=s*a+o*r+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class rr{constructor(e,n,r,a,s,o,l,c,d){rr.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,n,r,a,s,o,l,c,d)}set(e,n,r,a,s,o,l,c,d){const u=this.elements;return u[0]=e,u[1]=a,u[2]=l,u[3]=n,u[4]=s,u[5]=c,u[6]=r,u[7]=o,u[8]=d,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const n=this.elements,r=e.elements;return n[0]=r[0],n[1]=r[1],n[2]=r[2],n[3]=r[3],n[4]=r[4],n[5]=r[5],n[6]=r[6],n[7]=r[7],n[8]=r[8],this}extractBasis(e,n,r){return e.setFromMatrix3Column(this,0),n.setFromMatrix3Column(this,1),r.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 r=e.elements,a=n.elements,s=this.elements,o=r[0],l=r[3],c=r[6],d=r[1],u=r[4],m=r[7],p=r[2],f=r[5],y=r[8],x=a[0],b=a[3],v=a[6],_=a[1],k=a[4],P=a[7],C=a[2],T=a[5],N=a[8];return s[0]=o*x+l*_+c*C,s[3]=o*b+l*k+c*T,s[6]=o*v+l*P+c*N,s[1]=d*x+u*_+m*C,s[4]=d*b+u*k+m*T,s[7]=d*v+u*P+m*N,s[2]=p*x+f*_+y*C,s[5]=p*b+f*k+y*T,s[8]=p*v+f*P+y*N,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],r=e[1],a=e[2],s=e[3],o=e[4],l=e[5],c=e[6],d=e[7],u=e[8];return n*o*u-n*l*d-r*s*u+r*l*c+a*s*d-a*o*c}invert(){const e=this.elements,n=e[0],r=e[1],a=e[2],s=e[3],o=e[4],l=e[5],c=e[6],d=e[7],u=e[8],m=u*o-l*d,p=l*c-u*s,f=d*s-o*c,y=n*m+r*p+a*f;if(y===0)return this.set(0,0,0,0,0,0,0,0,0);const x=1/y;return e[0]=m*x,e[1]=(a*d-u*r)*x,e[2]=(l*r-a*o)*x,e[3]=p*x,e[4]=(u*n-a*c)*x,e[5]=(a*s-l*n)*x,e[6]=f*x,e[7]=(r*c-d*n)*x,e[8]=(o*n-r*s)*x,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,r,a,s,o,l){const c=Math.cos(s),d=Math.sin(s);return this.set(r*c,r*d,-r*(c*o+d*l)+o+e,-a*d,a*c,-a*(-d*o+c*l)+l+n,0,0,1),this}scale(e,n){return this.premultiply(VM.makeScale(e,n)),this}rotate(e){return this.premultiply(VM.makeRotation(-e)),this}translate(e,n){return this.premultiply(VM.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),r=Math.sin(e);return this.set(n,-r,0,r,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,r=e.elements;for(let a=0;a<9;a++)if(n[a]!==r[a])return!1;return!0}fromArray(e,n=0){for(let r=0;r<9;r++)this.elements[r]=e[r+n];return this}toArray(e=[],n=0){const r=this.elements;return e[n]=r[0],e[n+1]=r[1],e[n+2]=r[2],e[n+3]=r[3],e[n+4]=r[4],e[n+5]=r[5],e[n+6]=r[6],e[n+7]=r[7],e[n+8]=r[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const VM=new rr;function uQ(t){for(let e=t.length-1;e>=0;--e)if(t[e]>=65535)return!0;return!1}function ak(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}function C1e(){const t=ak("canvas");return t.style.display="block",t}const nH={};function cv(t){t in nH||(nH[t]=!0,console.warn(t))}const rH=new rr().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),iH=new rr().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),KS={[hu]:{transfer:tk,primaries:nk,toReference:t=>t,fromReference:t=>t},[Qa]:{transfer:si,primaries:nk,toReference:t=>t.convertSRGBToLinear(),fromReference:t=>t.convertLinearToSRGB()},[CC]:{transfer:tk,primaries:rk,toReference:t=>t.applyMatrix3(iH),fromReference:t=>t.applyMatrix3(rH)},[vL]:{transfer:si,primaries:rk,toReference:t=>t.convertSRGBToLinear().applyMatrix3(iH),fromReference:t=>t.applyMatrix3(rH).convertLinearToSRGB()}},T1e=new Set([hu,CC]),Hr={enabled:!0,_workingColorSpace:hu,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(!T1e.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 r=KS[e].toReference,a=KS[n].fromReference;return a(r(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 KS[t].primaries},getTransfer:function(t){return t===ul?tk:KS[t].transfer}};function yb(t){return t<.04045?t*.0773993808:Math.pow(t*.9478672986+.0521327014,2.4)}function GM(t){return t<.0031308?t*12.92:1.055*Math.pow(t,.41666)-.055}let _g;class mQ{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{_g===void 0&&(_g=ak("canvas")),_g.width=e.width,_g.height=e.height;const r=_g.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),n=_g}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=ak("canvas");n.width=e.width,n.height=e.height;const r=n.getContext("2d");r.drawImage(e,0,0,e.width,e.height);const a=r.getImageData(0,0,e.width,e.height),s=a.data;for(let o=0;o<s.length;o++)s[o]=yb(s[o]/255)*255;return r.putImageData(a,0,0),n}else if(e.data){const n=e.data.slice(0);for(let r=0;r<n.length;r++)n instanceof Uint8Array||n instanceof Uint8ClampedArray?n[r]=Math.floor(yb(n[r]/255)*255):n[r]=yb(n[r]);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 P1e=0;class hQ{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:P1e++}),this.uuid=eu(),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 r={uuid:this.uuid,url:""},a=this.data;if(a!==null){let s;if(Array.isArray(a)){s=[];for(let o=0,l=a.length;o<l;o++)a[o].isDataTexture?s.push(WM(a[o].image)):s.push(WM(a[o]))}else s=WM(a);r.url=s}return n||(e.images[this.uuid]=r),r}}function WM(t){return typeof HTMLImageElement<"u"&&t instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&t instanceof ImageBitmap?mQ.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 A1e=0;class oo extends yf{constructor(e=oo.DEFAULT_IMAGE,n=oo.DEFAULT_MAPPING,r=Vl,a=Vl,s=cl,o=Gv,l=dl,c=Xm,d=oo.DEFAULT_ANISOTROPY,u=ul){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:A1e++}),this.uuid=eu(),this.name="",this.source=new hQ(e),this.mipmaps=[],this.mapping=n,this.channel=0,this.wrapS=r,this.wrapT=a,this.magFilter=s,this.minFilter=o,this.anisotropy=d,this.format=l,this.internalFormat=null,this.type=c,this.offset=new Fn(0,0),this.repeat=new Fn(1,1),this.center=new Fn(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new rr,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,typeof u=="string"?this.colorSpace=u:(cv("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace=u===Ap?Qa:ul),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 r={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&&(r.userData=this.userData),n||(e.textures[this.uuid]=r),r}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==JX)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case T3:e.x=e.x-Math.floor(e.x);break;case Vl:e.x=e.x<0?0:1;break;case P3: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 T3:e.y=e.y-Math.floor(e.y);break;case Vl:e.y=e.y<0?0:1;break;case P3: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 cv("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace===Qa?Ap:oQ}set encoding(e){cv("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace=e===Ap?Qa:ul}}oo.DEFAULT_IMAGE=null;oo.DEFAULT_MAPPING=JX;oo.DEFAULT_ANISOTROPY=1;class qr{constructor(e=0,n=0,r=0,a=1){qr.prototype.isVector4=!0,this.x=e,this.y=n,this.z=r,this.w=a}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,r,a){return this.x=e,this.y=n,this.z=r,this.w=a,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,r=this.y,a=this.z,s=this.w,o=e.elements;return this.x=o[0]*n+o[4]*r+o[8]*a+o[12]*s,this.y=o[1]*n+o[5]*r+o[9]*a+o[13]*s,this.z=o[2]*n+o[6]*r+o[10]*a+o[14]*s,this.w=o[3]*n+o[7]*r+o[11]*a+o[15]*s,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,r,a,s;const c=e.elements,d=c[0],u=c[4],m=c[8],p=c[1],f=c[5],y=c[9],x=c[2],b=c[6],v=c[10];if(Math.abs(u-p)<.01&&Math.abs(m-x)<.01&&Math.abs(y-b)<.01){if(Math.abs(u+p)<.1&&Math.abs(m+x)<.1&&Math.abs(y+b)<.1&&Math.abs(d+f+v-3)<.1)return this.set(1,0,0,0),this;n=Math.PI;const k=(d+1)/2,P=(f+1)/2,C=(v+1)/2,T=(u+p)/4,N=(m+x)/4,R=(y+b)/4;return k>P&&k>C?k<.01?(r=0,a=.707106781,s=.707106781):(r=Math.sqrt(k),a=T/r,s=N/r):P>C?P<.01?(r=.707106781,a=0,s=.707106781):(a=Math.sqrt(P),r=T/a,s=R/a):C<.01?(r=.707106781,a=.707106781,s=0):(s=Math.sqrt(C),r=N/s,a=R/s),this.set(r,a,s,n),this}let _=Math.sqrt((b-y)*(b-y)+(m-x)*(m-x)+(p-u)*(p-u));return Math.abs(_)<.001&&(_=1),this.x=(b-y)/_,this.y=(m-x)/_,this.z=(p-u)/_,this.w=Math.acos((d+f+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 r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(n,r)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=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,r){return this.x=e.x+(n.x-e.x)*r,this.y=e.y+(n.y-e.y)*r,this.z=e.z+(n.z-e.z)*r,this.w=e.w+(n.w-e.w)*r,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,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 M1e extends yf{constructor(e=1,n=1,r={}){super(),this.isRenderTarget=!0,this.width=e,this.height=n,this.depth=1,this.scissor=new qr(0,0,e,n),this.scissorTest=!1,this.viewport=new qr(0,0,e,n);const a={width:e,height:n,depth:1};r.encoding!==void 0&&(cv("THREE.WebGLRenderTarget: option.encoding has been replaced by option.colorSpace."),r.colorSpace=r.encoding===Ap?Qa:ul),r=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:cl,depthBuffer:!0,stencilBuffer:!1,depthTexture:null,samples:0},r),this.texture=new oo(a,r.mapping,r.wrapS,r.wrapT,r.magFilter,r.minFilter,r.format,r.type,r.anisotropy,r.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.flipY=!1,this.texture.generateMipmaps=r.generateMipmaps,this.texture.internalFormat=r.internalFormat,this.depthBuffer=r.depthBuffer,this.stencilBuffer=r.stencilBuffer,this.depthTexture=r.depthTexture,this.samples=r.samples}setSize(e,n,r=1){(this.width!==e||this.height!==n||this.depth!==r)&&(this.width=e,this.height=n,this.depth=r,this.texture.image.width=e,this.texture.image.height=n,this.texture.image.depth=r,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 hQ(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 Qp extends M1e{constructor(e=1,n=1,r={}){super(e,n,r),this.isWebGLRenderTarget=!0}}class pQ extends oo{constructor(e=null,n=1,r=1,a=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:n,height:r,depth:a},this.magFilter=Xa,this.minFilter=Xa,this.wrapR=Vl,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class E1e extends oo{constructor(e=null,n=1,r=1,a=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:n,height:r,depth:a},this.magFilter=Xa,this.minFilter=Xa,this.wrapR=Vl,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Zp{constructor(e=0,n=0,r=0,a=1){this.isQuaternion=!0,this._x=e,this._y=n,this._z=r,this._w=a}static slerpFlat(e,n,r,a,s,o,l){let c=r[a+0],d=r[a+1],u=r[a+2],m=r[a+3];const p=s[o+0],f=s[o+1],y=s[o+2],x=s[o+3];if(l===0){e[n+0]=c,e[n+1]=d,e[n+2]=u,e[n+3]=m;return}if(l===1){e[n+0]=p,e[n+1]=f,e[n+2]=y,e[n+3]=x;return}if(m!==x||c!==p||d!==f||u!==y){let b=1-l;const v=c*p+d*f+u*y+m*x,_=v>=0?1:-1,k=1-v*v;if(k>Number.EPSILON){const C=Math.sqrt(k),T=Math.atan2(C,v*_);b=Math.sin(b*T)/C,l=Math.sin(l*T)/C}const P=l*_;if(c=c*b+p*P,d=d*b+f*P,u=u*b+y*P,m=m*b+x*P,b===1-l){const C=1/Math.sqrt(c*c+d*d+u*u+m*m);c*=C,d*=C,u*=C,m*=C}}e[n]=c,e[n+1]=d,e[n+2]=u,e[n+3]=m}static multiplyQuaternionsFlat(e,n,r,a,s,o){const l=r[a],c=r[a+1],d=r[a+2],u=r[a+3],m=s[o],p=s[o+1],f=s[o+2],y=s[o+3];return e[n]=l*y+u*m+c*f-d*p,e[n+1]=c*y+u*p+d*m-l*f,e[n+2]=d*y+u*f+l*p-c*m,e[n+3]=u*y-l*m-c*p-d*f,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,r,a){return this._x=e,this._y=n,this._z=r,this._w=a,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 r=e._x,a=e._y,s=e._z,o=e._order,l=Math.cos,c=Math.sin,d=l(r/2),u=l(a/2),m=l(s/2),p=c(r/2),f=c(a/2),y=c(s/2);switch(o){case"XYZ":this._x=p*u*m+d*f*y,this._y=d*f*m-p*u*y,this._z=d*u*y+p*f*m,this._w=d*u*m-p*f*y;break;case"YXZ":this._x=p*u*m+d*f*y,this._y=d*f*m-p*u*y,this._z=d*u*y-p*f*m,this._w=d*u*m+p*f*y;break;case"ZXY":this._x=p*u*m-d*f*y,this._y=d*f*m+p*u*y,this._z=d*u*y+p*f*m,this._w=d*u*m-p*f*y;break;case"ZYX":this._x=p*u*m-d*f*y,this._y=d*f*m+p*u*y,this._z=d*u*y-p*f*m,this._w=d*u*m+p*f*y;break;case"YZX":this._x=p*u*m+d*f*y,this._y=d*f*m+p*u*y,this._z=d*u*y-p*f*m,this._w=d*u*m-p*f*y;break;case"XZY":this._x=p*u*m-d*f*y,this._y=d*f*m-p*u*y,this._z=d*u*y+p*f*m,this._w=d*u*m+p*f*y;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return n!==!1&&this._onChangeCallback(),this}setFromAxisAngle(e,n){const r=n/2,a=Math.sin(r);return this._x=e.x*a,this._y=e.y*a,this._z=e.z*a,this._w=Math.cos(r),this._onChangeCallback(),this}setFromRotationMatrix(e){const n=e.elements,r=n[0],a=n[4],s=n[8],o=n[1],l=n[5],c=n[9],d=n[2],u=n[6],m=n[10],p=r+l+m;if(p>0){const f=.5/Math.sqrt(p+1);this._w=.25/f,this._x=(u-c)*f,this._y=(s-d)*f,this._z=(o-a)*f}else if(r>l&&r>m){const f=2*Math.sqrt(1+r-l-m);this._w=(u-c)/f,this._x=.25*f,this._y=(a+o)/f,this._z=(s+d)/f}else if(l>m){const f=2*Math.sqrt(1+l-r-m);this._w=(s-d)/f,this._x=(a+o)/f,this._y=.25*f,this._z=(c+u)/f}else{const f=2*Math.sqrt(1+m-r-l);this._w=(o-a)/f,this._x=(s+d)/f,this._y=(c+u)/f,this._z=.25*f}return this._onChangeCallback(),this}setFromUnitVectors(e,n){let r=e.dot(n)+1;return r<Number.EPSILON?(r=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=r):(this._x=0,this._y=-e.z,this._z=e.y,this._w=r)):(this._x=e.y*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=r),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(Za(this.dot(e),-1,1)))}rotateTowards(e,n){const r=this.angleTo(e);if(r===0)return this;const a=Math.min(1,n/r);return this.slerp(e,a),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 r=e._x,a=e._y,s=e._z,o=e._w,l=n._x,c=n._y,d=n._z,u=n._w;return this._x=r*u+o*l+a*d-s*c,this._y=a*u+o*c+s*l-r*d,this._z=s*u+o*d+r*c-a*l,this._w=o*u-r*l-a*c-s*d,this._onChangeCallback(),this}slerp(e,n){if(n===0)return this;if(n===1)return this.copy(e);const r=this._x,a=this._y,s=this._z,o=this._w;let l=o*e._w+r*e._x+a*e._y+s*e._z;if(l<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,l=-l):this.copy(e),l>=1)return this._w=o,this._x=r,this._y=a,this._z=s,this;const c=1-l*l;if(c<=Number.EPSILON){const f=1-n;return this._w=f*o+n*this._w,this._x=f*r+n*this._x,this._y=f*a+n*this._y,this._z=f*s+n*this._z,this.normalize(),this._onChangeCallback(),this}const d=Math.sqrt(c),u=Math.atan2(d,l),m=Math.sin((1-n)*u)/d,p=Math.sin(n*u)/d;return this._w=o*m+this._w*p,this._x=r*m+this._x*p,this._y=a*m+this._y*p,this._z=s*m+this._z*p,this._onChangeCallback(),this}slerpQuaternions(e,n,r){return this.copy(e).slerp(n,r)}random(){const e=Math.random(),n=Math.sqrt(1-e),r=Math.sqrt(e),a=2*Math.PI*Math.random(),s=2*Math.PI*Math.random();return this.set(n*Math.cos(a),r*Math.sin(s),r*Math.cos(s),n*Math.sin(a))}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 rt{constructor(e=0,n=0,r=0){rt.prototype.isVector3=!0,this.x=e,this.y=n,this.z=r}set(e,n,r){return r===void 0&&(r=this.z),this.x=e,this.y=n,this.z=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,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(aH.setFromEuler(e))}applyAxisAngle(e,n){return this.applyQuaternion(aH.setFromAxisAngle(e,n))}applyMatrix3(e){const n=this.x,r=this.y,a=this.z,s=e.elements;return this.x=s[0]*n+s[3]*r+s[6]*a,this.y=s[1]*n+s[4]*r+s[7]*a,this.z=s[2]*n+s[5]*r+s[8]*a,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const n=this.x,r=this.y,a=this.z,s=e.elements,o=1/(s[3]*n+s[7]*r+s[11]*a+s[15]);return this.x=(s[0]*n+s[4]*r+s[8]*a+s[12])*o,this.y=(s[1]*n+s[5]*r+s[9]*a+s[13])*o,this.z=(s[2]*n+s[6]*r+s[10]*a+s[14])*o,this}applyQuaternion(e){const n=this.x,r=this.y,a=this.z,s=e.x,o=e.y,l=e.z,c=e.w,d=2*(o*a-l*r),u=2*(l*n-s*a),m=2*(s*r-o*n);return this.x=n+c*d+o*m-l*u,this.y=r+c*u+l*d-s*m,this.z=a+c*m+s*u-o*d,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const n=this.x,r=this.y,a=this.z,s=e.elements;return this.x=s[0]*n+s[4]*r+s[8]*a,this.y=s[1]*n+s[5]*r+s[9]*a,this.z=s[2]*n+s[6]*r+s[10]*a,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 r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(n,r)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=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,r){return this.x=e.x+(n.x-e.x)*r,this.y=e.y+(n.y-e.y)*r,this.z=e.z+(n.z-e.z)*r,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,n){const r=e.x,a=e.y,s=e.z,o=n.x,l=n.y,c=n.z;return this.x=a*c-s*l,this.y=s*o-r*c,this.z=r*l-a*o,this}projectOnVector(e){const n=e.lengthSq();if(n===0)return this.set(0,0,0);const r=e.dot(this)/n;return this.copy(e).multiplyScalar(r)}projectOnPlane(e){return KM.copy(this).projectOnVector(e),this.sub(KM)}reflect(e){return this.sub(KM.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 r=this.dot(e)/n;return Math.acos(Za(r,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const n=this.x-e.x,r=this.y-e.y,a=this.z-e.z;return n*n+r*r+a*a}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,r){const a=Math.sin(n)*e;return this.x=a*Math.sin(r),this.y=Math.cos(n)*e,this.z=a*Math.cos(r),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,n,r){return this.x=e*Math.sin(n),this.y=r,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(),r=this.setFromMatrixColumn(e,1).length(),a=this.setFromMatrixColumn(e,2).length();return this.x=n,this.y=r,this.z=a,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,r=Math.sqrt(1-e**2);return this.x=r*Math.cos(n),this.y=r*Math.sin(n),this.z=e,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const KM=new rt,aH=new Zp;class gl{constructor(e=new rt(1/0,1/0,1/0),n=new rt(-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,r=e.length;n<r;n+=3)this.expandByPoint(Bl.fromArray(e,n));return this}setFromBufferAttribute(e){this.makeEmpty();for(let n=0,r=e.count;n<r;n++)this.expandByPoint(Bl.fromBufferAttribute(e,n));return this}setFromPoints(e){this.makeEmpty();for(let n=0,r=e.length;n<r;n++)this.expandByPoint(e[n]);return this}setFromCenterAndSize(e,n){const r=Bl.copy(n).multiplyScalar(.5);return this.min.copy(e).sub(r),this.max.copy(e).add(r),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 r=e.geometry;if(r!==void 0){const s=r.getAttribute("position");if(n===!0&&s!==void 0&&e.isInstancedMesh!==!0)for(let o=0,l=s.count;o<l;o++)e.isMesh===!0?e.getVertexPosition(o,Bl):Bl.fromBufferAttribute(s,o),Bl.applyMatrix4(e.matrixWorld),this.expandByPoint(Bl);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),YS.copy(e.boundingBox)):(r.boundingBox===null&&r.computeBoundingBox(),YS.copy(r.boundingBox)),YS.applyMatrix4(e.matrixWorld),this.union(YS)}const a=e.children;for(let s=0,o=a.length;s<o;s++)this.expandByObject(a[s],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,Bl),Bl.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let n,r;return e.normal.x>0?(n=e.normal.x*this.min.x,r=e.normal.x*this.max.x):(n=e.normal.x*this.max.x,r=e.normal.x*this.min.x),e.normal.y>0?(n+=e.normal.y*this.min.y,r+=e.normal.y*this.max.y):(n+=e.normal.y*this.max.y,r+=e.normal.y*this.min.y),e.normal.z>0?(n+=e.normal.z*this.min.z,r+=e.normal.z*this.max.z):(n+=e.normal.z*this.max.z,r+=e.normal.z*this.min.z),n<=-e.constant&&r>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Cy),XS.subVectors(this.max,Cy),kg.subVectors(e.a,Cy),Ng.subVectors(e.b,Cy),Cg.subVectors(e.c,Cy),rm.subVectors(Ng,kg),im.subVectors(Cg,Ng),Gh.subVectors(kg,Cg);let n=[0,-rm.z,rm.y,0,-im.z,im.y,0,-Gh.z,Gh.y,rm.z,0,-rm.x,im.z,0,-im.x,Gh.z,0,-Gh.x,-rm.y,rm.x,0,-im.y,im.x,0,-Gh.y,Gh.x,0];return!YM(n,kg,Ng,Cg,XS)||(n=[1,0,0,0,1,0,0,0,1],!YM(n,kg,Ng,Cg,XS))?!1:(QS.crossVectors(rm,im),n=[QS.x,QS.y,QS.z],YM(n,kg,Ng,Cg,XS))}clampPoint(e,n){return n.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Bl).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Bl).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:(Td[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Td[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Td[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Td[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Td[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Td[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Td[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Td[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Td),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 Td=[new rt,new rt,new rt,new rt,new rt,new rt,new rt,new rt],Bl=new rt,YS=new gl,kg=new rt,Ng=new rt,Cg=new rt,rm=new rt,im=new rt,Gh=new rt,Cy=new rt,XS=new rt,QS=new rt,Wh=new rt;function YM(t,e,n,r,a){for(let s=0,o=t.length-3;s<=o;s+=3){Wh.fromArray(t,s);const l=a.x*Math.abs(Wh.x)+a.y*Math.abs(Wh.y)+a.z*Math.abs(Wh.z),c=e.dot(Wh),d=n.dot(Wh),u=r.dot(Wh);if(Math.max(-Math.max(c,d,u),Math.min(c,d,u))>l)return!1}return!0}const j1e=new gl,Ty=new rt,XM=new rt;class zc{constructor(e=new rt,n=-1){this.center=e,this.radius=n}set(e,n){return this.center.copy(e),this.radius=n,this}setFromPoints(e,n){const r=this.center;n!==void 0?r.copy(n):j1e.setFromPoints(e).getCenter(r);let a=0;for(let s=0,o=e.length;s<o;s++)a=Math.max(a,r.distanceToSquared(e[s]));return this.radius=Math.sqrt(a),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 r=this.center.distanceToSquared(e);return n.copy(e),r>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;Ty.subVectors(e,this.center);const n=Ty.lengthSq();if(n>this.radius*this.radius){const r=Math.sqrt(n),a=(r-this.radius)*.5;this.center.addScaledVector(Ty,a/r),this.radius+=a}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):(XM.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Ty.copy(e.center).add(XM)),this.expandByPoint(Ty.copy(e.center).sub(XM))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const Pd=new rt,QM=new rt,ZS=new rt,am=new rt,ZM=new rt,JS=new rt,JM=new rt;class SL{constructor(e=new rt,n=new rt(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,Pd)),this}closestPointToPoint(e,n){n.subVectors(e,this.origin);const r=n.dot(this.direction);return r<0?n.copy(this.origin):n.copy(this.origin).addScaledVector(this.direction,r)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const n=Pd.subVectors(e,this.origin).dot(this.direction);return n<0?this.origin.distanceToSquared(e):(Pd.copy(this.origin).addScaledVector(this.direction,n),Pd.distanceToSquared(e))}distanceSqToSegment(e,n,r,a){QM.copy(e).add(n).multiplyScalar(.5),ZS.copy(n).sub(e).normalize(),am.copy(this.origin).sub(QM);const s=e.distanceTo(n)*.5,o=-this.direction.dot(ZS),l=am.dot(this.direction),c=-am.dot(ZS),d=am.lengthSq(),u=Math.abs(1-o*o);let m,p,f,y;if(u>0)if(m=o*c-l,p=o*l-c,y=s*u,m>=0)if(p>=-y)if(p<=y){const x=1/u;m*=x,p*=x,f=m*(m+o*p+2*l)+p*(o*m+p+2*c)+d}else p=s,m=Math.max(0,-(o*p+l)),f=-m*m+p*(p+2*c)+d;else p=-s,m=Math.max(0,-(o*p+l)),f=-m*m+p*(p+2*c)+d;else p<=-y?(m=Math.max(0,-(-o*s+l)),p=m>0?-s:Math.min(Math.max(-s,-c),s),f=-m*m+p*(p+2*c)+d):p<=y?(m=0,p=Math.min(Math.max(-s,-c),s),f=p*(p+2*c)+d):(m=Math.max(0,-(o*s+l)),p=m>0?s:Math.min(Math.max(-s,-c),s),f=-m*m+p*(p+2*c)+d);else p=o>0?-s:s,m=Math.max(0,-(o*p+l)),f=-m*m+p*(p+2*c)+d;return r&&r.copy(this.origin).addScaledVector(this.direction,m),a&&a.copy(QM).addScaledVector(ZS,p),f}intersectSphere(e,n){Pd.subVectors(e.center,this.origin);const r=Pd.dot(this.direction),a=Pd.dot(Pd)-r*r,s=e.radius*e.radius;if(a>s)return null;const o=Math.sqrt(s-a),l=r-o,c=r+o;return c<0?null:l<0?this.at(c,n):this.at(l,n)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const n=e.normal.dot(this.direction);if(n===0)return e.distanceToPoint(this.origin)===0?0:null;const r=-(this.origin.dot(e.normal)+e.constant)/n;return r>=0?r:null}intersectPlane(e,n){const r=this.distanceToPlane(e);return r===null?null:this.at(r,n)}intersectsPlane(e){const n=e.distanceToPoint(this.origin);return n===0||e.normal.dot(this.direction)*n<0}intersectBox(e,n){let r,a,s,o,l,c;const d=1/this.direction.x,u=1/this.direction.y,m=1/this.direction.z,p=this.origin;return d>=0?(r=(e.min.x-p.x)*d,a=(e.max.x-p.x)*d):(r=(e.max.x-p.x)*d,a=(e.min.x-p.x)*d),u>=0?(s=(e.min.y-p.y)*u,o=(e.max.y-p.y)*u):(s=(e.max.y-p.y)*u,o=(e.min.y-p.y)*u),r>o||s>a||((s>r||isNaN(r))&&(r=s),(o<a||isNaN(a))&&(a=o),m>=0?(l=(e.min.z-p.z)*m,c=(e.max.z-p.z)*m):(l=(e.max.z-p.z)*m,c=(e.min.z-p.z)*m),r>c||l>a)||((l>r||r!==r)&&(r=l),(c<a||a!==a)&&(a=c),a<0)?null:this.at(r>=0?r:a,n)}intersectsBox(e){return this.intersectBox(e,Pd)!==null}intersectTriangle(e,n,r,a,s){ZM.subVectors(n,e),JS.subVectors(r,e),JM.crossVectors(ZM,JS);let o=this.direction.dot(JM),l;if(o>0){if(a)return null;l=1}else if(o<0)l=-1,o=-o;else return null;am.subVectors(this.origin,e);const c=l*this.direction.dot(JS.crossVectors(am,JS));if(c<0)return null;const d=l*this.direction.dot(ZM.cross(am));if(d<0||c+d>o)return null;const u=-l*am.dot(JM);return u<0?null:this.at(u/o,s)}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 ti{constructor(e,n,r,a,s,o,l,c,d,u,m,p,f,y,x,b){ti.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,r,a,s,o,l,c,d,u,m,p,f,y,x,b)}set(e,n,r,a,s,o,l,c,d,u,m,p,f,y,x,b){const v=this.elements;return v[0]=e,v[4]=n,v[8]=r,v[12]=a,v[1]=s,v[5]=o,v[9]=l,v[13]=c,v[2]=d,v[6]=u,v[10]=m,v[14]=p,v[3]=f,v[7]=y,v[11]=x,v[15]=b,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new ti().fromArray(this.elements)}copy(e){const n=this.elements,r=e.elements;return n[0]=r[0],n[1]=r[1],n[2]=r[2],n[3]=r[3],n[4]=r[4],n[5]=r[5],n[6]=r[6],n[7]=r[7],n[8]=r[8],n[9]=r[9],n[10]=r[10],n[11]=r[11],n[12]=r[12],n[13]=r[13],n[14]=r[14],n[15]=r[15],this}copyPosition(e){const n=this.elements,r=e.elements;return n[12]=r[12],n[13]=r[13],n[14]=r[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,r){return e.setFromMatrixColumn(this,0),n.setFromMatrixColumn(this,1),r.setFromMatrixColumn(this,2),this}makeBasis(e,n,r){return this.set(e.x,n.x,r.x,0,e.y,n.y,r.y,0,e.z,n.z,r.z,0,0,0,0,1),this}extractRotation(e){const n=this.elements,r=e.elements,a=1/Tg.setFromMatrixColumn(e,0).length(),s=1/Tg.setFromMatrixColumn(e,1).length(),o=1/Tg.setFromMatrixColumn(e,2).length();return n[0]=r[0]*a,n[1]=r[1]*a,n[2]=r[2]*a,n[3]=0,n[4]=r[4]*s,n[5]=r[5]*s,n[6]=r[6]*s,n[7]=0,n[8]=r[8]*o,n[9]=r[9]*o,n[10]=r[10]*o,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,this}makeRotationFromEuler(e){const n=this.elements,r=e.x,a=e.y,s=e.z,o=Math.cos(r),l=Math.sin(r),c=Math.cos(a),d=Math.sin(a),u=Math.cos(s),m=Math.sin(s);if(e.order==="XYZ"){const p=o*u,f=o*m,y=l*u,x=l*m;n[0]=c*u,n[4]=-c*m,n[8]=d,n[1]=f+y*d,n[5]=p-x*d,n[9]=-l*c,n[2]=x-p*d,n[6]=y+f*d,n[10]=o*c}else if(e.order==="YXZ"){const p=c*u,f=c*m,y=d*u,x=d*m;n[0]=p+x*l,n[4]=y*l-f,n[8]=o*d,n[1]=o*m,n[5]=o*u,n[9]=-l,n[2]=f*l-y,n[6]=x+p*l,n[10]=o*c}else if(e.order==="ZXY"){const p=c*u,f=c*m,y=d*u,x=d*m;n[0]=p-x*l,n[4]=-o*m,n[8]=y+f*l,n[1]=f+y*l,n[5]=o*u,n[9]=x-p*l,n[2]=-o*d,n[6]=l,n[10]=o*c}else if(e.order==="ZYX"){const p=o*u,f=o*m,y=l*u,x=l*m;n[0]=c*u,n[4]=y*d-f,n[8]=p*d+x,n[1]=c*m,n[5]=x*d+p,n[9]=f*d-y,n[2]=-d,n[6]=l*c,n[10]=o*c}else if(e.order==="YZX"){const p=o*c,f=o*d,y=l*c,x=l*d;n[0]=c*u,n[4]=x-p*m,n[8]=y*m+f,n[1]=m,n[5]=o*u,n[9]=-l*u,n[2]=-d*u,n[6]=f*m+y,n[10]=p-x*m}else if(e.order==="XZY"){const p=o*c,f=o*d,y=l*c,x=l*d;n[0]=c*u,n[4]=-m,n[8]=d*u,n[1]=p*m+x,n[5]=o*u,n[9]=f*m-y,n[2]=y*m-f,n[6]=l*u,n[10]=x*m+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(D1e,e,R1e)}lookAt(e,n,r){const a=this.elements;return Co.subVectors(e,n),Co.lengthSq()===0&&(Co.z=1),Co.normalize(),sm.crossVectors(r,Co),sm.lengthSq()===0&&(Math.abs(r.z)===1?Co.x+=1e-4:Co.z+=1e-4,Co.normalize(),sm.crossVectors(r,Co)),sm.normalize(),e_.crossVectors(Co,sm),a[0]=sm.x,a[4]=e_.x,a[8]=Co.x,a[1]=sm.y,a[5]=e_.y,a[9]=Co.y,a[2]=sm.z,a[6]=e_.z,a[10]=Co.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,n){const r=e.elements,a=n.elements,s=this.elements,o=r[0],l=r[4],c=r[8],d=r[12],u=r[1],m=r[5],p=r[9],f=r[13],y=r[2],x=r[6],b=r[10],v=r[14],_=r[3],k=r[7],P=r[11],C=r[15],T=a[0],N=a[4],R=a[8],A=a[12],D=a[1],$=a[5],U=a[9],G=a[13],L=a[2],te=a[6],re=a[10],J=a[14],ue=a[3],me=a[7],ge=a[11],X=a[15];return s[0]=o*T+l*D+c*L+d*ue,s[4]=o*N+l*$+c*te+d*me,s[8]=o*R+l*U+c*re+d*ge,s[12]=o*A+l*G+c*J+d*X,s[1]=u*T+m*D+p*L+f*ue,s[5]=u*N+m*$+p*te+f*me,s[9]=u*R+m*U+p*re+f*ge,s[13]=u*A+m*G+p*J+f*X,s[2]=y*T+x*D+b*L+v*ue,s[6]=y*N+x*$+b*te+v*me,s[10]=y*R+x*U+b*re+v*ge,s[14]=y*A+x*G+b*J+v*X,s[3]=_*T+k*D+P*L+C*ue,s[7]=_*N+k*$+P*te+C*me,s[11]=_*R+k*U+P*re+C*ge,s[15]=_*A+k*G+P*J+C*X,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],r=e[4],a=e[8],s=e[12],o=e[1],l=e[5],c=e[9],d=e[13],u=e[2],m=e[6],p=e[10],f=e[14],y=e[3],x=e[7],b=e[11],v=e[15];return y*(+s*c*m-a*d*m-s*l*p+r*d*p+a*l*f-r*c*f)+x*(+n*c*f-n*d*p+s*o*p-a*o*f+a*d*u-s*c*u)+b*(+n*d*m-n*l*f-s*o*m+r*o*f+s*l*u-r*d*u)+v*(-a*l*u-n*c*m+n*l*p+a*o*m-r*o*p+r*c*u)}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,r){const a=this.elements;return e.isVector3?(a[12]=e.x,a[13]=e.y,a[14]=e.z):(a[12]=e,a[13]=n,a[14]=r),this}invert(){const e=this.elements,n=e[0],r=e[1],a=e[2],s=e[3],o=e[4],l=e[5],c=e[6],d=e[7],u=e[8],m=e[9],p=e[10],f=e[11],y=e[12],x=e[13],b=e[14],v=e[15],_=m*b*d-x*p*d+x*c*f-l*b*f-m*c*v+l*p*v,k=y*p*d-u*b*d-y*c*f+o*b*f+u*c*v-o*p*v,P=u*x*d-y*m*d+y*l*f-o*x*f-u*l*v+o*m*v,C=y*m*c-u*x*c-y*l*p+o*x*p+u*l*b-o*m*b,T=n*_+r*k+a*P+s*C;if(T===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const N=1/T;return e[0]=_*N,e[1]=(x*p*s-m*b*s-x*a*f+r*b*f+m*a*v-r*p*v)*N,e[2]=(l*b*s-x*c*s+x*a*d-r*b*d-l*a*v+r*c*v)*N,e[3]=(m*c*s-l*p*s-m*a*d+r*p*d+l*a*f-r*c*f)*N,e[4]=k*N,e[5]=(u*b*s-y*p*s+y*a*f-n*b*f-u*a*v+n*p*v)*N,e[6]=(y*c*s-o*b*s-y*a*d+n*b*d+o*a*v-n*c*v)*N,e[7]=(o*p*s-u*c*s+u*a*d-n*p*d-o*a*f+n*c*f)*N,e[8]=P*N,e[9]=(y*m*s-u*x*s-y*r*f+n*x*f+u*r*v-n*m*v)*N,e[10]=(o*x*s-y*l*s+y*r*d-n*x*d-o*r*v+n*l*v)*N,e[11]=(u*l*s-o*m*s-u*r*d+n*m*d+o*r*f-n*l*f)*N,e[12]=C*N,e[13]=(u*x*a-y*m*a+y*r*p-n*x*p-u*r*b+n*m*b)*N,e[14]=(y*l*a-o*x*a-y*r*c+n*x*c+o*r*b-n*l*b)*N,e[15]=(o*m*a-u*l*a+u*r*c-n*m*c-o*r*p+n*l*p)*N,this}scale(e){const n=this.elements,r=e.x,a=e.y,s=e.z;return n[0]*=r,n[4]*=a,n[8]*=s,n[1]*=r,n[5]*=a,n[9]*=s,n[2]*=r,n[6]*=a,n[10]*=s,n[3]*=r,n[7]*=a,n[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,n=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],r=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],a=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(n,r,a))}makeTranslation(e,n,r){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,r,0,0,0,1),this}makeRotationX(e){const n=Math.cos(e),r=Math.sin(e);return this.set(1,0,0,0,0,n,-r,0,0,r,n,0,0,0,0,1),this}makeRotationY(e){const n=Math.cos(e),r=Math.sin(e);return this.set(n,0,r,0,0,1,0,0,-r,0,n,0,0,0,0,1),this}makeRotationZ(e){const n=Math.cos(e),r=Math.sin(e);return this.set(n,-r,0,0,r,n,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,n){const r=Math.cos(n),a=Math.sin(n),s=1-r,o=e.x,l=e.y,c=e.z,d=s*o,u=s*l;return this.set(d*o+r,d*l-a*c,d*c+a*l,0,d*l+a*c,u*l+r,u*c-a*o,0,d*c-a*l,u*c+a*o,s*c*c+r,0,0,0,0,1),this}makeScale(e,n,r){return this.set(e,0,0,0,0,n,0,0,0,0,r,0,0,0,0,1),this}makeShear(e,n,r,a,s,o){return this.set(1,r,s,0,e,1,o,0,n,a,1,0,0,0,0,1),this}compose(e,n,r){const a=this.elements,s=n._x,o=n._y,l=n._z,c=n._w,d=s+s,u=o+o,m=l+l,p=s*d,f=s*u,y=s*m,x=o*u,b=o*m,v=l*m,_=c*d,k=c*u,P=c*m,C=r.x,T=r.y,N=r.z;return a[0]=(1-(x+v))*C,a[1]=(f+P)*C,a[2]=(y-k)*C,a[3]=0,a[4]=(f-P)*T,a[5]=(1-(p+v))*T,a[6]=(b+_)*T,a[7]=0,a[8]=(y+k)*N,a[9]=(b-_)*N,a[10]=(1-(p+x))*N,a[11]=0,a[12]=e.x,a[13]=e.y,a[14]=e.z,a[15]=1,this}decompose(e,n,r){const a=this.elements;let s=Tg.set(a[0],a[1],a[2]).length();const o=Tg.set(a[4],a[5],a[6]).length(),l=Tg.set(a[8],a[9],a[10]).length();this.determinant()<0&&(s=-s),e.x=a[12],e.y=a[13],e.z=a[14],Hl.copy(this);const d=1/s,u=1/o,m=1/l;return Hl.elements[0]*=d,Hl.elements[1]*=d,Hl.elements[2]*=d,Hl.elements[4]*=u,Hl.elements[5]*=u,Hl.elements[6]*=u,Hl.elements[8]*=m,Hl.elements[9]*=m,Hl.elements[10]*=m,n.setFromRotationMatrix(Hl),r.x=s,r.y=o,r.z=l,this}makePerspective(e,n,r,a,s,o,l=Rc){const c=this.elements,d=2*s/(n-e),u=2*s/(r-a),m=(n+e)/(n-e),p=(r+a)/(r-a);let f,y;if(l===Rc)f=-(o+s)/(o-s),y=-2*o*s/(o-s);else if(l===Kv)f=-o/(o-s),y=-o*s/(o-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+l);return c[0]=d,c[4]=0,c[8]=m,c[12]=0,c[1]=0,c[5]=u,c[9]=p,c[13]=0,c[2]=0,c[6]=0,c[10]=f,c[14]=y,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(e,n,r,a,s,o,l=Rc){const c=this.elements,d=1/(n-e),u=1/(r-a),m=1/(o-s),p=(n+e)*d,f=(r+a)*u;let y,x;if(l===Rc)y=(o+s)*m,x=-2*m;else if(l===Kv)y=s*m,x=-1*m;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+l);return c[0]=2*d,c[4]=0,c[8]=0,c[12]=-p,c[1]=0,c[5]=2*u,c[9]=0,c[13]=-f,c[2]=0,c[6]=0,c[10]=x,c[14]=-y,c[3]=0,c[7]=0,c[11]=0,c[15]=1,this}equals(e){const n=this.elements,r=e.elements;for(let a=0;a<16;a++)if(n[a]!==r[a])return!1;return!0}fromArray(e,n=0){for(let r=0;r<16;r++)this.elements[r]=e[r+n];return this}toArray(e=[],n=0){const r=this.elements;return e[n]=r[0],e[n+1]=r[1],e[n+2]=r[2],e[n+3]=r[3],e[n+4]=r[4],e[n+5]=r[5],e[n+6]=r[6],e[n+7]=r[7],e[n+8]=r[8],e[n+9]=r[9],e[n+10]=r[10],e[n+11]=r[11],e[n+12]=r[12],e[n+13]=r[13],e[n+14]=r[14],e[n+15]=r[15],e}}const Tg=new rt,Hl=new ti,D1e=new rt(0,0,0),R1e=new rt(1,1,1),sm=new rt,e_=new rt,Co=new rt,sH=new ti,oH=new Zp;class O0{constructor(e=0,n=0,r=0,a=O0.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=n,this._z=r,this._order=a}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,r,a=this._order){return this._x=e,this._y=n,this._z=r,this._order=a,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,r=!0){const a=e.elements,s=a[0],o=a[4],l=a[8],c=a[1],d=a[5],u=a[9],m=a[2],p=a[6],f=a[10];switch(n){case"XYZ":this._y=Math.asin(Za(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-u,f),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(p,d),this._z=0);break;case"YXZ":this._x=Math.asin(-Za(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(l,f),this._z=Math.atan2(c,d)):(this._y=Math.atan2(-m,s),this._z=0);break;case"ZXY":this._x=Math.asin(Za(p,-1,1)),Math.abs(p)<.9999999?(this._y=Math.atan2(-m,f),this._z=Math.atan2(-o,d)):(this._y=0,this._z=Math.atan2(c,s));break;case"ZYX":this._y=Math.asin(-Za(m,-1,1)),Math.abs(m)<.9999999?(this._x=Math.atan2(p,f),this._z=Math.atan2(c,s)):(this._x=0,this._z=Math.atan2(-o,d));break;case"YZX":this._z=Math.asin(Za(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(-u,d),this._y=Math.atan2(-m,s)):(this._x=0,this._y=Math.atan2(l,f));break;case"XZY":this._z=Math.asin(-Za(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(p,d),this._y=Math.atan2(l,s)):(this._x=Math.atan2(-u,f),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+n)}return this._order=n,r===!0&&this._onChangeCallback(),this}setFromQuaternion(e,n,r){return sH.makeRotationFromQuaternion(e),this.setFromRotationMatrix(sH,n,r)}setFromVector3(e,n=this._order){return this.set(e.x,e.y,e.z,n)}reorder(e){return oH.setFromEuler(this),this.setFromQuaternion(oH,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}}O0.DEFAULT_ORDER="XYZ";class fQ{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 F1e=0;const lH=new rt,Pg=new Zp,Ad=new ti,t_=new rt,Py=new rt,L1e=new rt,O1e=new Zp,cH=new rt(1,0,0),dH=new rt(0,1,0),uH=new rt(0,0,1),I1e={type:"added"},z1e={type:"removed"};class Os extends yf{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:F1e++}),this.uuid=eu(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Os.DEFAULT_UP.clone();const e=new rt,n=new O0,r=new Zp,a=new rt(1,1,1);function s(){r.setFromEuler(n,!1)}function o(){n.setFromQuaternion(r,void 0,!1)}n._onChange(s),r._onChange(o),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:n},quaternion:{configurable:!0,enumerable:!0,value:r},scale:{configurable:!0,enumerable:!0,value:a},modelViewMatrix:{value:new ti},normalMatrix:{value:new rr}}),this.matrix=new ti,this.matrixWorld=new ti,this.matrixAutoUpdate=Os.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=Os.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new fQ,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 Pg.setFromAxisAngle(e,n),this.quaternion.multiply(Pg),this}rotateOnWorldAxis(e,n){return Pg.setFromAxisAngle(e,n),this.quaternion.premultiply(Pg),this}rotateX(e){return this.rotateOnAxis(cH,e)}rotateY(e){return this.rotateOnAxis(dH,e)}rotateZ(e){return this.rotateOnAxis(uH,e)}translateOnAxis(e,n){return lH.copy(e).applyQuaternion(this.quaternion),this.position.add(lH.multiplyScalar(n)),this}translateX(e){return this.translateOnAxis(cH,e)}translateY(e){return this.translateOnAxis(dH,e)}translateZ(e){return this.translateOnAxis(uH,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(Ad.copy(this.matrixWorld).invert())}lookAt(e,n,r){e.isVector3?t_.copy(e):t_.set(e,n,r);const a=this.parent;this.updateWorldMatrix(!0,!1),Py.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Ad.lookAt(Py,t_,this.up):Ad.lookAt(t_,Py,this.up),this.quaternion.setFromRotationMatrix(Ad),a&&(Ad.extractRotation(a.matrixWorld),Pg.setFromRotationMatrix(Ad),this.quaternion.premultiply(Pg.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(I1e)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let r=0;r<arguments.length;r++)this.remove(arguments[r]);return this}const n=this.children.indexOf(e);return n!==-1&&(e.parent=null,this.children.splice(n,1),e.dispatchEvent(z1e)),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),Ad.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),Ad.multiply(e.parent.matrixWorld)),e.applyMatrix4(Ad),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 r=0,a=this.children.length;r<a;r++){const o=this.children[r].getObjectByProperty(e,n);if(o!==void 0)return o}}getObjectsByProperty(e,n,r=[]){this[e]===n&&r.push(this);const a=this.children;for(let s=0,o=a.length;s<o;s++)a[s].getObjectsByProperty(e,n,r);return r}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Py,e,L1e),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Py,O1e,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 r=0,a=n.length;r<a;r++)n[r].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const n=this.children;for(let r=0,a=n.length;r<a;r++)n[r].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 r=0,a=n.length;r<a;r++){const s=n[r];(s.matrixWorldAutoUpdate===!0||e===!0)&&s.updateMatrixWorld(e)}}updateWorldMatrix(e,n){const r=this.parent;if(e===!0&&r!==null&&r.matrixWorldAutoUpdate===!0&&r.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),n===!0){const a=this.children;for(let s=0,o=a.length;s<o;s++){const l=a[s];l.matrixWorldAutoUpdate===!0&&l.updateWorldMatrix(!1,!0)}}}toJSON(e){const n=e===void 0||typeof e=="string",r={};n&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},r.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});const a={};a.uuid=this.uuid,a.type=this.type,this.name!==""&&(a.name=this.name),this.castShadow===!0&&(a.castShadow=!0),this.receiveShadow===!0&&(a.receiveShadow=!0),this.visible===!1&&(a.visible=!1),this.frustumCulled===!1&&(a.frustumCulled=!1),this.renderOrder!==0&&(a.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(a.userData=this.userData),a.layers=this.layers.mask,a.matrix=this.matrix.toArray(),a.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(a.matrixAutoUpdate=!1),this.isInstancedMesh&&(a.type="InstancedMesh",a.count=this.count,a.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(a.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(a.type="BatchedMesh",a.perObjectFrustumCulled=this.perObjectFrustumCulled,a.sortObjects=this.sortObjects,a.drawRanges=this._drawRanges,a.reservedRanges=this._reservedRanges,a.visibility=this._visibility,a.active=this._active,a.bounds=this._bounds.map(l=>({boxInitialized:l.boxInitialized,boxMin:l.box.min.toArray(),boxMax:l.box.max.toArray(),sphereInitialized:l.sphereInitialized,sphereRadius:l.sphere.radius,sphereCenter:l.sphere.center.toArray()})),a.maxGeometryCount=this._maxGeometryCount,a.maxVertexCount=this._maxVertexCount,a.maxIndexCount=this._maxIndexCount,a.geometryInitialized=this._geometryInitialized,a.geometryCount=this._geometryCount,a.matricesTexture=this._matricesTexture.toJSON(e),this.boundingSphere!==null&&(a.boundingSphere={center:a.boundingSphere.center.toArray(),radius:a.boundingSphere.radius}),this.boundingBox!==null&&(a.boundingBox={min:a.boundingBox.min.toArray(),max:a.boundingBox.max.toArray()}));function s(l,c){return l[c.uuid]===void 0&&(l[c.uuid]=c.toJSON(e)),c.uuid}if(this.isScene)this.background&&(this.background.isColor?a.background=this.background.toJSON():this.background.isTexture&&(a.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(a.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){a.geometry=s(e.geometries,this.geometry);const l=this.geometry.parameters;if(l!==void 0&&l.shapes!==void 0){const c=l.shapes;if(Array.isArray(c))for(let d=0,u=c.length;d<u;d++){const m=c[d];s(e.shapes,m)}else s(e.shapes,c)}}if(this.isSkinnedMesh&&(a.bindMode=this.bindMode,a.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(e.skeletons,this.skeleton),a.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const l=[];for(let c=0,d=this.material.length;c<d;c++)l.push(s(e.materials,this.material[c]));a.material=l}else a.material=s(e.materials,this.material);if(this.children.length>0){a.children=[];for(let l=0;l<this.children.length;l++)a.children.push(this.children[l].toJSON(e).object)}if(this.animations.length>0){a.animations=[];for(let l=0;l<this.animations.length;l++){const c=this.animations[l];a.animations.push(s(e.animations,c))}}if(n){const l=o(e.geometries),c=o(e.materials),d=o(e.textures),u=o(e.images),m=o(e.shapes),p=o(e.skeletons),f=o(e.animations),y=o(e.nodes);l.length>0&&(r.geometries=l),c.length>0&&(r.materials=c),d.length>0&&(r.textures=d),u.length>0&&(r.images=u),m.length>0&&(r.shapes=m),p.length>0&&(r.skeletons=p),f.length>0&&(r.animations=f),y.length>0&&(r.nodes=y)}return r.object=a,r;function o(l){const c=[];for(const d in l){const u=l[d];delete u.metadata,c.push(u)}return c}}clone(e){return new this.constructor().copy(this,e)}copy(e,n=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),n===!0)for(let r=0;r<e.children.length;r++){const a=e.children[r];this.add(a.clone())}return this}}Os.DEFAULT_UP=new rt(0,1,0);Os.DEFAULT_MATRIX_AUTO_UPDATE=!0;Os.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const $l=new rt,Md=new rt,e2=new rt,Ed=new rt,Ag=new rt,Mg=new rt,mH=new rt,t2=new rt,n2=new rt,r2=new rt;let n_=!1;class ql{constructor(e=new rt,n=new rt,r=new rt){this.a=e,this.b=n,this.c=r}static getNormal(e,n,r,a){a.subVectors(r,n),$l.subVectors(e,n),a.cross($l);const s=a.lengthSq();return s>0?a.multiplyScalar(1/Math.sqrt(s)):a.set(0,0,0)}static getBarycoord(e,n,r,a,s){$l.subVectors(a,n),Md.subVectors(r,n),e2.subVectors(e,n);const o=$l.dot($l),l=$l.dot(Md),c=$l.dot(e2),d=Md.dot(Md),u=Md.dot(e2),m=o*d-l*l;if(m===0)return s.set(-2,-1,-1);const p=1/m,f=(d*c-l*u)*p,y=(o*u-l*c)*p;return s.set(1-f-y,y,f)}static containsPoint(e,n,r,a){return this.getBarycoord(e,n,r,a,Ed),Ed.x>=0&&Ed.y>=0&&Ed.x+Ed.y<=1}static getUV(e,n,r,a,s,o,l,c){return n_===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),n_=!0),this.getInterpolation(e,n,r,a,s,o,l,c)}static getInterpolation(e,n,r,a,s,o,l,c){return this.getBarycoord(e,n,r,a,Ed),c.setScalar(0),c.addScaledVector(s,Ed.x),c.addScaledVector(o,Ed.y),c.addScaledVector(l,Ed.z),c}static isFrontFacing(e,n,r,a){return $l.subVectors(r,n),Md.subVectors(e,n),$l.cross(Md).dot(a)<0}set(e,n,r){return this.a.copy(e),this.b.copy(n),this.c.copy(r),this}setFromPointsAndIndices(e,n,r,a){return this.a.copy(e[n]),this.b.copy(e[r]),this.c.copy(e[a]),this}setFromAttributeAndIndices(e,n,r,a){return this.a.fromBufferAttribute(e,n),this.b.fromBufferAttribute(e,r),this.c.fromBufferAttribute(e,a),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 $l.subVectors(this.c,this.b),Md.subVectors(this.a,this.b),$l.cross(Md).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return ql.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,n){return ql.getBarycoord(e,this.a,this.b,this.c,n)}getUV(e,n,r,a,s){return n_===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),n_=!0),ql.getInterpolation(e,this.a,this.b,this.c,n,r,a,s)}getInterpolation(e,n,r,a,s){return ql.getInterpolation(e,this.a,this.b,this.c,n,r,a,s)}containsPoint(e){return ql.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return ql.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,n){const r=this.a,a=this.b,s=this.c;let o,l;Ag.subVectors(a,r),Mg.subVectors(s,r),t2.subVectors(e,r);const c=Ag.dot(t2),d=Mg.dot(t2);if(c<=0&&d<=0)return n.copy(r);n2.subVectors(e,a);const u=Ag.dot(n2),m=Mg.dot(n2);if(u>=0&&m<=u)return n.copy(a);const p=c*m-u*d;if(p<=0&&c>=0&&u<=0)return o=c/(c-u),n.copy(r).addScaledVector(Ag,o);r2.subVectors(e,s);const f=Ag.dot(r2),y=Mg.dot(r2);if(y>=0&&f<=y)return n.copy(s);const x=f*d-c*y;if(x<=0&&d>=0&&y<=0)return l=d/(d-y),n.copy(r).addScaledVector(Mg,l);const b=u*y-f*m;if(b<=0&&m-u>=0&&f-y>=0)return mH.subVectors(s,a),l=(m-u)/(m-u+(f-y)),n.copy(a).addScaledVector(mH,l);const v=1/(b+x+p);return o=x*v,l=p*v,n.copy(r).addScaledVector(Ag,o).addScaledVector(Mg,l)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const gQ={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},om={h:0,s:0,l:0},r_={h:0,s:0,l:0};function i2(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 yn=class{constructor(e,n,r){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,n,r)}set(e,n,r){if(n===void 0&&r===void 0){const a=e;a&&a.isColor?this.copy(a):typeof a=="number"?this.setHex(a):typeof a=="string"&&this.setStyle(a)}else this.setRGB(e,n,r);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,n=Qa){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Hr.toWorkingColorSpace(this,n),this}setRGB(e,n,r,a=Hr.workingColorSpace){return this.r=e,this.g=n,this.b=r,Hr.toWorkingColorSpace(this,a),this}setHSL(e,n,r,a=Hr.workingColorSpace){if(e=wL(e,1),n=Za(n,0,1),r=Za(r,0,1),n===0)this.r=this.g=this.b=r;else{const s=r<=.5?r*(1+n):r+n-r*n,o=2*r-s;this.r=i2(o,s,e+1/3),this.g=i2(o,s,e),this.b=i2(o,s,e-1/3)}return Hr.toWorkingColorSpace(this,a),this}setStyle(e,n=Qa){function r(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let a;if(a=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const o=a[1],l=a[2];switch(o){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(l))return r(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,n);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(l))return r(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,n);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(l))return r(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,n);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(a=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=a[1],o=s.length;if(o===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,n);if(o===6)return this.setHex(parseInt(s,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=Qa){const r=gQ[e.toLowerCase()];return r!==void 0?this.setHex(r,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=yb(e.r),this.g=yb(e.g),this.b=yb(e.b),this}copyLinearToSRGB(e){return this.r=GM(e.r),this.g=GM(e.g),this.b=GM(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Qa){return Hr.fromWorkingColorSpace(ls.copy(this),e),Math.round(Za(ls.r*255,0,255))*65536+Math.round(Za(ls.g*255,0,255))*256+Math.round(Za(ls.b*255,0,255))}getHexString(e=Qa){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,n=Hr.workingColorSpace){Hr.fromWorkingColorSpace(ls.copy(this),n);const r=ls.r,a=ls.g,s=ls.b,o=Math.max(r,a,s),l=Math.min(r,a,s);let c,d;const u=(l+o)/2;if(l===o)c=0,d=0;else{const m=o-l;switch(d=u<=.5?m/(o+l):m/(2-o-l),o){case r:c=(a-s)/m+(a<s?6:0);break;case a:c=(s-r)/m+2;break;case s:c=(r-a)/m+4;break}c/=6}return e.h=c,e.s=d,e.l=u,e}getRGB(e,n=Hr.workingColorSpace){return Hr.fromWorkingColorSpace(ls.copy(this),n),e.r=ls.r,e.g=ls.g,e.b=ls.b,e}getStyle(e=Qa){Hr.fromWorkingColorSpace(ls.copy(this),e);const n=ls.r,r=ls.g,a=ls.b;return e!==Qa?`color(${e} ${n.toFixed(3)} ${r.toFixed(3)} ${a.toFixed(3)})`:`rgb(${Math.round(n*255)},${Math.round(r*255)},${Math.round(a*255)})`}offsetHSL(e,n,r){return this.getHSL(om),this.setHSL(om.h+e,om.s+n,om.l+r)}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,r){return this.r=e.r+(n.r-e.r)*r,this.g=e.g+(n.g-e.g)*r,this.b=e.b+(n.b-e.b)*r,this}lerpHSL(e,n){this.getHSL(om),e.getHSL(r_);const r=lv(om.h,r_.h,n),a=lv(om.s,r_.s,n),s=lv(om.l,r_.l,n);return this.setHSL(r,a,s),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const n=this.r,r=this.g,a=this.b,s=e.elements;return this.r=s[0]*n+s[3]*r+s[6]*a,this.g=s[1]*n+s[4]*r+s[7]*a,this.b=s[2]*n+s[5]*r+s[8]*a,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 ls=new yn;yn.NAMES=gQ;let U1e=0;class px extends yf{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:U1e++}),this.uuid=eu(),this.name="",this.type="Material",this.blending=xb,this.side=sh,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=_3,this.blendDst=k3,this.blendEquation=lp,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new yn(0,0,0),this.blendAlpha=0,this.depthFunc=ek,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=J6,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Sg,this.stencilZFail=Sg,this.stencilZPass=Sg,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 r=e[n];if(r===void 0){console.warn(`THREE.Material: parameter '${n}' has value of undefined.`);continue}const a=this[n];if(a===void 0){console.warn(`THREE.Material: '${n}' is not a property of THREE.${this.type}.`);continue}a&&a.isColor?a.set(r):a&&a.isVector3&&r&&r.isVector3?a.copy(r):this[n]=r}}toJSON(e){const n=e===void 0||typeof e=="string";n&&(e={textures:{},images:{}});const r={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.color&&this.color.isColor&&(r.color=this.color.getHex()),this.roughness!==void 0&&(r.roughness=this.roughness),this.metalness!==void 0&&(r.metalness=this.metalness),this.sheen!==void 0&&(r.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(r.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(r.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(r.emissive=this.emissive.getHex()),this.emissiveIntensity&&this.emissiveIntensity!==1&&(r.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(r.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(r.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(r.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(r.shininess=this.shininess),this.clearcoat!==void 0&&(r.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(r.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(r.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(r.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(r.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,r.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.iridescence!==void 0&&(r.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(r.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(r.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(r.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(r.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(r.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(r.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(r.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(r.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(r.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(r.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(r.lightMap=this.lightMap.toJSON(e).uuid,r.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(r.aoMap=this.aoMap.toJSON(e).uuid,r.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(r.bumpMap=this.bumpMap.toJSON(e).uuid,r.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(r.normalMap=this.normalMap.toJSON(e).uuid,r.normalMapType=this.normalMapType,r.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(r.displacementMap=this.displacementMap.toJSON(e).uuid,r.displacementScale=this.displacementScale,r.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(r.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(r.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(r.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(r.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(r.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(r.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(r.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(r.combine=this.combine)),this.envMapIntensity!==void 0&&(r.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(r.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(r.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(r.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(r.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(r.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(r.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(r.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(r.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(r.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(r.size=this.size),this.shadowSide!==null&&(r.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(r.sizeAttenuation=this.sizeAttenuation),this.blending!==xb&&(r.blending=this.blending),this.side!==sh&&(r.side=this.side),this.vertexColors===!0&&(r.vertexColors=!0),this.opacity<1&&(r.opacity=this.opacity),this.transparent===!0&&(r.transparent=!0),this.blendSrc!==_3&&(r.blendSrc=this.blendSrc),this.blendDst!==k3&&(r.blendDst=this.blendDst),this.blendEquation!==lp&&(r.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(r.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(r.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(r.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(r.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(r.blendAlpha=this.blendAlpha),this.depthFunc!==ek&&(r.depthFunc=this.depthFunc),this.depthTest===!1&&(r.depthTest=this.depthTest),this.depthWrite===!1&&(r.depthWrite=this.depthWrite),this.colorWrite===!1&&(r.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(r.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==J6&&(r.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(r.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(r.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Sg&&(r.stencilFail=this.stencilFail),this.stencilZFail!==Sg&&(r.stencilZFail=this.stencilZFail),this.stencilZPass!==Sg&&(r.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(r.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(r.rotation=this.rotation),this.polygonOffset===!0&&(r.polygonOffset=!0),this.polygonOffsetFactor!==0&&(r.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(r.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(r.linewidth=this.linewidth),this.dashSize!==void 0&&(r.dashSize=this.dashSize),this.gapSize!==void 0&&(r.gapSize=this.gapSize),this.scale!==void 0&&(r.scale=this.scale),this.dithering===!0&&(r.dithering=!0),this.alphaTest>0&&(r.alphaTest=this.alphaTest),this.alphaHash===!0&&(r.alphaHash=!0),this.alphaToCoverage===!0&&(r.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(r.premultipliedAlpha=!0),this.forceSinglePass===!0&&(r.forceSinglePass=!0),this.wireframe===!0&&(r.wireframe=!0),this.wireframeLinewidth>1&&(r.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(r.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(r.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(r.flatShading=!0),this.visible===!1&&(r.visible=!1),this.toneMapped===!1&&(r.toneMapped=!1),this.fog===!1&&(r.fog=!1),Object.keys(this.userData).length>0&&(r.userData=this.userData);function a(s){const o=[];for(const l in s){const c=s[l];delete c.metadata,o.push(c)}return o}if(n){const s=a(e.textures),o=a(e.images);s.length>0&&(r.textures=s),o.length>0&&(r.images=o)}return r}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.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 r=null;if(n!==null){const a=n.length;r=new Array(a);for(let s=0;s!==a;++s)r[s]=n[s].clone()}return this.clippingPlanes=r,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.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 bQ extends px{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new yn(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=xL,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 ta=new rt,i_=new Fn;class Fo{constructor(e,n,r=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=n,this.count=e!==void 0?e.length/n:0,this.normalized=r,this.usage=A3,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.gpuType=Wd,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,r){e*=this.itemSize,r*=n.itemSize;for(let a=0,s=this.itemSize;a<s;a++)this.array[e+a]=n.array[r+a];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let n=0,r=this.count;n<r;n++)i_.fromBufferAttribute(this,n),i_.applyMatrix3(e),this.setXY(n,i_.x,i_.y);else if(this.itemSize===3)for(let n=0,r=this.count;n<r;n++)ta.fromBufferAttribute(this,n),ta.applyMatrix3(e),this.setXYZ(n,ta.x,ta.y,ta.z);return this}applyMatrix4(e){for(let n=0,r=this.count;n<r;n++)ta.fromBufferAttribute(this,n),ta.applyMatrix4(e),this.setXYZ(n,ta.x,ta.y,ta.z);return this}applyNormalMatrix(e){for(let n=0,r=this.count;n<r;n++)ta.fromBufferAttribute(this,n),ta.applyNormalMatrix(e),this.setXYZ(n,ta.x,ta.y,ta.z);return this}transformDirection(e){for(let n=0,r=this.count;n<r;n++)ta.fromBufferAttribute(this,n),ta.transformDirection(e),this.setXYZ(n,ta.x,ta.y,ta.z);return this}set(e,n=0){return this.array.set(e,n),this}getComponent(e,n){let r=this.array[e*this.itemSize+n];return this.normalized&&(r=Ec(r,this.array)),r}setComponent(e,n,r){return this.normalized&&(r=Br(r,this.array)),this.array[e*this.itemSize+n]=r,this}getX(e){let n=this.array[e*this.itemSize];return this.normalized&&(n=Ec(n,this.array)),n}setX(e,n){return this.normalized&&(n=Br(n,this.array)),this.array[e*this.itemSize]=n,this}getY(e){let n=this.array[e*this.itemSize+1];return this.normalized&&(n=Ec(n,this.array)),n}setY(e,n){return this.normalized&&(n=Br(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=Ec(n,this.array)),n}setZ(e,n){return this.normalized&&(n=Br(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=Ec(n,this.array)),n}setW(e,n){return this.normalized&&(n=Br(n,this.array)),this.array[e*this.itemSize+3]=n,this}setXY(e,n,r){return e*=this.itemSize,this.normalized&&(n=Br(n,this.array),r=Br(r,this.array)),this.array[e+0]=n,this.array[e+1]=r,this}setXYZ(e,n,r,a){return e*=this.itemSize,this.normalized&&(n=Br(n,this.array),r=Br(r,this.array),a=Br(a,this.array)),this.array[e+0]=n,this.array[e+1]=r,this.array[e+2]=a,this}setXYZW(e,n,r,a,s){return e*=this.itemSize,this.normalized&&(n=Br(n,this.array),r=Br(r,this.array),a=Br(a,this.array),s=Br(s,this.array)),this.array[e+0]=n,this.array[e+1]=r,this.array[e+2]=a,this.array[e+3]=s,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!==A3&&(e.usage=this.usage),e}}class xQ extends Fo{constructor(e,n,r){super(new Uint16Array(e),n,r)}}class yQ extends Fo{constructor(e,n,r){super(new Uint32Array(e),n,r)}}class Gi extends Fo{constructor(e,n,r){super(new Float32Array(e),n,r)}}let B1e=0;const Xo=new ti,a2=new Os,Eg=new rt,To=new gl,Ay=new gl,Pa=new rt;class ys extends yf{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:B1e++}),this.uuid=eu(),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(uQ(e)?yQ:xQ)(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,r=0){this.groups.push({start:e,count:n,materialIndex:r})}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 r=this.attributes.normal;if(r!==void 0){const s=new rr().getNormalMatrix(e);r.applyNormalMatrix(s),r.needsUpdate=!0}const a=this.attributes.tangent;return a!==void 0&&(a.transformDirection(e),a.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return Xo.makeRotationFromQuaternion(e),this.applyMatrix4(Xo),this}rotateX(e){return Xo.makeRotationX(e),this.applyMatrix4(Xo),this}rotateY(e){return Xo.makeRotationY(e),this.applyMatrix4(Xo),this}rotateZ(e){return Xo.makeRotationZ(e),this.applyMatrix4(Xo),this}translate(e,n,r){return Xo.makeTranslation(e,n,r),this.applyMatrix4(Xo),this}scale(e,n,r){return Xo.makeScale(e,n,r),this.applyMatrix4(Xo),this}lookAt(e){return a2.lookAt(e),a2.updateMatrix(),this.applyMatrix4(a2.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Eg).negate(),this.translate(Eg.x,Eg.y,Eg.z),this}setFromPoints(e){const n=[];for(let r=0,a=e.length;r<a;r++){const s=e[r];n.push(s.x,s.y,s.z||0)}return this.setAttribute("position",new Gi(n,3)),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new gl);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 rt(-1/0,-1/0,-1/0),new rt(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),n)for(let r=0,a=n.length;r<a;r++){const s=n[r];To.setFromBufferAttribute(s),this.morphTargetsRelative?(Pa.addVectors(this.boundingBox.min,To.min),this.boundingBox.expandByPoint(Pa),Pa.addVectors(this.boundingBox.max,To.max),this.boundingBox.expandByPoint(Pa)):(this.boundingBox.expandByPoint(To.min),this.boundingBox.expandByPoint(To.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 zc);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 rt,1/0);return}if(e){const r=this.boundingSphere.center;if(To.setFromBufferAttribute(e),n)for(let s=0,o=n.length;s<o;s++){const l=n[s];Ay.setFromBufferAttribute(l),this.morphTargetsRelative?(Pa.addVectors(To.min,Ay.min),To.expandByPoint(Pa),Pa.addVectors(To.max,Ay.max),To.expandByPoint(Pa)):(To.expandByPoint(Ay.min),To.expandByPoint(Ay.max))}To.getCenter(r);let a=0;for(let s=0,o=e.count;s<o;s++)Pa.fromBufferAttribute(e,s),a=Math.max(a,r.distanceToSquared(Pa));if(n)for(let s=0,o=n.length;s<o;s++){const l=n[s],c=this.morphTargetsRelative;for(let d=0,u=l.count;d<u;d++)Pa.fromBufferAttribute(l,d),c&&(Eg.fromBufferAttribute(e,d),Pa.add(Eg)),a=Math.max(a,r.distanceToSquared(Pa))}this.boundingSphere.radius=Math.sqrt(a),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 r=e.array,a=n.position.array,s=n.normal.array,o=n.uv.array,l=a.length/3;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new Fo(new Float32Array(4*l),4));const c=this.getAttribute("tangent").array,d=[],u=[];for(let D=0;D<l;D++)d[D]=new rt,u[D]=new rt;const m=new rt,p=new rt,f=new rt,y=new Fn,x=new Fn,b=new Fn,v=new rt,_=new rt;function k(D,$,U){m.fromArray(a,D*3),p.fromArray(a,$*3),f.fromArray(a,U*3),y.fromArray(o,D*2),x.fromArray(o,$*2),b.fromArray(o,U*2),p.sub(m),f.sub(m),x.sub(y),b.sub(y);const G=1/(x.x*b.y-b.x*x.y);isFinite(G)&&(v.copy(p).multiplyScalar(b.y).addScaledVector(f,-x.y).multiplyScalar(G),_.copy(f).multiplyScalar(x.x).addScaledVector(p,-b.x).multiplyScalar(G),d[D].add(v),d[$].add(v),d[U].add(v),u[D].add(_),u[$].add(_),u[U].add(_))}let P=this.groups;P.length===0&&(P=[{start:0,count:r.length}]);for(let D=0,$=P.length;D<$;++D){const U=P[D],G=U.start,L=U.count;for(let te=G,re=G+L;te<re;te+=3)k(r[te+0],r[te+1],r[te+2])}const C=new rt,T=new rt,N=new rt,R=new rt;function A(D){N.fromArray(s,D*3),R.copy(N);const $=d[D];C.copy($),C.sub(N.multiplyScalar(N.dot($))).normalize(),T.crossVectors(R,$);const G=T.dot(u[D])<0?-1:1;c[D*4]=C.x,c[D*4+1]=C.y,c[D*4+2]=C.z,c[D*4+3]=G}for(let D=0,$=P.length;D<$;++D){const U=P[D],G=U.start,L=U.count;for(let te=G,re=G+L;te<re;te+=3)A(r[te+0]),A(r[te+1]),A(r[te+2])}}computeVertexNormals(){const e=this.index,n=this.getAttribute("position");if(n!==void 0){let r=this.getAttribute("normal");if(r===void 0)r=new Fo(new Float32Array(n.count*3),3),this.setAttribute("normal",r);else for(let p=0,f=r.count;p<f;p++)r.setXYZ(p,0,0,0);const a=new rt,s=new rt,o=new rt,l=new rt,c=new rt,d=new rt,u=new rt,m=new rt;if(e)for(let p=0,f=e.count;p<f;p+=3){const y=e.getX(p+0),x=e.getX(p+1),b=e.getX(p+2);a.fromBufferAttribute(n,y),s.fromBufferAttribute(n,x),o.fromBufferAttribute(n,b),u.subVectors(o,s),m.subVectors(a,s),u.cross(m),l.fromBufferAttribute(r,y),c.fromBufferAttribute(r,x),d.fromBufferAttribute(r,b),l.add(u),c.add(u),d.add(u),r.setXYZ(y,l.x,l.y,l.z),r.setXYZ(x,c.x,c.y,c.z),r.setXYZ(b,d.x,d.y,d.z)}else for(let p=0,f=n.count;p<f;p+=3)a.fromBufferAttribute(n,p+0),s.fromBufferAttribute(n,p+1),o.fromBufferAttribute(n,p+2),u.subVectors(o,s),m.subVectors(a,s),u.cross(m),r.setXYZ(p+0,u.x,u.y,u.z),r.setXYZ(p+1,u.x,u.y,u.z),r.setXYZ(p+2,u.x,u.y,u.z);this.normalizeNormals(),r.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let n=0,r=e.count;n<r;n++)Pa.fromBufferAttribute(e,n),Pa.normalize(),e.setXYZ(n,Pa.x,Pa.y,Pa.z)}toNonIndexed(){function e(l,c){const d=l.array,u=l.itemSize,m=l.normalized,p=new d.constructor(c.length*u);let f=0,y=0;for(let x=0,b=c.length;x<b;x++){l.isInterleavedBufferAttribute?f=c[x]*l.data.stride+l.offset:f=c[x]*u;for(let v=0;v<u;v++)p[y++]=d[f++]}return new Fo(p,u,m)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const n=new ys,r=this.index.array,a=this.attributes;for(const l in a){const c=a[l],d=e(c,r);n.setAttribute(l,d)}const s=this.morphAttributes;for(const l in s){const c=[],d=s[l];for(let u=0,m=d.length;u<m;u++){const p=d[u],f=e(p,r);c.push(f)}n.morphAttributes[l]=c}n.morphTargetsRelative=this.morphTargetsRelative;const o=this.groups;for(let l=0,c=o.length;l<c;l++){const d=o[l];n.addGroup(d.start,d.count,d.materialIndex)}return n}toJSON(){const e={metadata:{version:4.6,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){const c=this.parameters;for(const d in c)c[d]!==void 0&&(e[d]=c[d]);return e}e.data={attributes:{}};const n=this.index;n!==null&&(e.data.index={type:n.array.constructor.name,array:Array.prototype.slice.call(n.array)});const r=this.attributes;for(const c in r){const d=r[c];e.data.attributes[c]=d.toJSON(e.data)}const a={};let s=!1;for(const c in this.morphAttributes){const d=this.morphAttributes[c],u=[];for(let m=0,p=d.length;m<p;m++){const f=d[m];u.push(f.toJSON(e.data))}u.length>0&&(a[c]=u,s=!0)}s&&(e.data.morphAttributes=a,e.data.morphTargetsRelative=this.morphTargetsRelative);const o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));const l=this.boundingSphere;return l!==null&&(e.data.boundingSphere={center:l.center.toArray(),radius:l.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const n={};this.name=e.name;const r=e.index;r!==null&&this.setIndex(r.clone(n));const a=e.attributes;for(const d in a){const u=a[d];this.setAttribute(d,u.clone(n))}const s=e.morphAttributes;for(const d in s){const u=[],m=s[d];for(let p=0,f=m.length;p<f;p++)u.push(m[p].clone(n));this.morphAttributes[d]=u}this.morphTargetsRelative=e.morphTargetsRelative;const o=e.groups;for(let d=0,u=o.length;d<u;d++){const m=o[d];this.addGroup(m.start,m.count,m.materialIndex)}const l=e.boundingBox;l!==null&&(this.boundingBox=l.clone());const c=e.boundingSphere;return c!==null&&(this.boundingSphere=c.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const hH=new ti,Kh=new SL,a_=new zc,pH=new rt,jg=new rt,Dg=new rt,Rg=new rt,s2=new rt,s_=new rt,o_=new Fn,l_=new Fn,c_=new Fn,fH=new rt,gH=new rt,bH=new rt,d_=new rt,u_=new rt;class Ql extends Os{constructor(e=new ys,n=new bQ){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,r=Object.keys(n);if(r.length>0){const a=n[r[0]];if(a!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=a.length;s<o;s++){const l=a[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[l]=s}}}}getVertexPosition(e,n){const r=this.geometry,a=r.attributes.position,s=r.morphAttributes.position,o=r.morphTargetsRelative;n.fromBufferAttribute(a,e);const l=this.morphTargetInfluences;if(s&&l){s_.set(0,0,0);for(let c=0,d=s.length;c<d;c++){const u=l[c],m=s[c];u!==0&&(s2.fromBufferAttribute(m,e),o?s_.addScaledVector(s2,u):s_.addScaledVector(s2.sub(n),u))}n.add(s_)}return n}raycast(e,n){const r=this.geometry,a=this.material,s=this.matrixWorld;a!==void 0&&(r.boundingSphere===null&&r.computeBoundingSphere(),a_.copy(r.boundingSphere),a_.applyMatrix4(s),Kh.copy(e.ray).recast(e.near),!(a_.containsPoint(Kh.origin)===!1&&(Kh.intersectSphere(a_,pH)===null||Kh.origin.distanceToSquared(pH)>(e.far-e.near)**2))&&(hH.copy(s).invert(),Kh.copy(e.ray).applyMatrix4(hH),!(r.boundingBox!==null&&Kh.intersectsBox(r.boundingBox)===!1)&&this._computeIntersections(e,n,Kh)))}_computeIntersections(e,n,r){let a;const s=this.geometry,o=this.material,l=s.index,c=s.attributes.position,d=s.attributes.uv,u=s.attributes.uv1,m=s.attributes.normal,p=s.groups,f=s.drawRange;if(l!==null)if(Array.isArray(o))for(let y=0,x=p.length;y<x;y++){const b=p[y],v=o[b.materialIndex],_=Math.max(b.start,f.start),k=Math.min(l.count,Math.min(b.start+b.count,f.start+f.count));for(let P=_,C=k;P<C;P+=3){const T=l.getX(P),N=l.getX(P+1),R=l.getX(P+2);a=m_(this,v,e,r,d,u,m,T,N,R),a&&(a.faceIndex=Math.floor(P/3),a.face.materialIndex=b.materialIndex,n.push(a))}}else{const y=Math.max(0,f.start),x=Math.min(l.count,f.start+f.count);for(let b=y,v=x;b<v;b+=3){const _=l.getX(b),k=l.getX(b+1),P=l.getX(b+2);a=m_(this,o,e,r,d,u,m,_,k,P),a&&(a.faceIndex=Math.floor(b/3),n.push(a))}}else if(c!==void 0)if(Array.isArray(o))for(let y=0,x=p.length;y<x;y++){const b=p[y],v=o[b.materialIndex],_=Math.max(b.start,f.start),k=Math.min(c.count,Math.min(b.start+b.count,f.start+f.count));for(let P=_,C=k;P<C;P+=3){const T=P,N=P+1,R=P+2;a=m_(this,v,e,r,d,u,m,T,N,R),a&&(a.faceIndex=Math.floor(P/3),a.face.materialIndex=b.materialIndex,n.push(a))}}else{const y=Math.max(0,f.start),x=Math.min(c.count,f.start+f.count);for(let b=y,v=x;b<v;b+=3){const _=b,k=b+1,P=b+2;a=m_(this,o,e,r,d,u,m,_,k,P),a&&(a.faceIndex=Math.floor(b/3),n.push(a))}}}}function H1e(t,e,n,r,a,s,o,l){let c;if(e.side===so?c=r.intersectTriangle(o,s,a,!0,l):c=r.intersectTriangle(a,s,o,e.side===sh,l),c===null)return null;u_.copy(l),u_.applyMatrix4(t.matrixWorld);const d=n.ray.origin.distanceTo(u_);return d<n.near||d>n.far?null:{distance:d,point:u_.clone(),object:t}}function m_(t,e,n,r,a,s,o,l,c,d){t.getVertexPosition(l,jg),t.getVertexPosition(c,Dg),t.getVertexPosition(d,Rg);const u=H1e(t,e,n,r,jg,Dg,Rg,d_);if(u){a&&(o_.fromBufferAttribute(a,l),l_.fromBufferAttribute(a,c),c_.fromBufferAttribute(a,d),u.uv=ql.getInterpolation(d_,jg,Dg,Rg,o_,l_,c_,new Fn)),s&&(o_.fromBufferAttribute(s,l),l_.fromBufferAttribute(s,c),c_.fromBufferAttribute(s,d),u.uv1=ql.getInterpolation(d_,jg,Dg,Rg,o_,l_,c_,new Fn),u.uv2=u.uv1),o&&(fH.fromBufferAttribute(o,l),gH.fromBufferAttribute(o,c),bH.fromBufferAttribute(o,d),u.normal=ql.getInterpolation(d_,jg,Dg,Rg,fH,gH,bH,new rt),u.normal.dot(r.direction)>0&&u.normal.multiplyScalar(-1));const m={a:l,b:c,c:d,normal:new rt,materialIndex:0};ql.getNormal(jg,Dg,Rg,m.normal),u.face=m}return u}class I0 extends ys{constructor(e=1,n=1,r=1,a=1,s=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:n,depth:r,widthSegments:a,heightSegments:s,depthSegments:o};const l=this;a=Math.floor(a),s=Math.floor(s),o=Math.floor(o);const c=[],d=[],u=[],m=[];let p=0,f=0;y("z","y","x",-1,-1,r,n,e,o,s,0),y("z","y","x",1,-1,r,n,-e,o,s,1),y("x","z","y",1,1,e,r,n,a,o,2),y("x","z","y",1,-1,e,r,-n,a,o,3),y("x","y","z",1,-1,e,n,r,a,s,4),y("x","y","z",-1,-1,e,n,-r,a,s,5),this.setIndex(c),this.setAttribute("position",new Gi(d,3)),this.setAttribute("normal",new Gi(u,3)),this.setAttribute("uv",new Gi(m,2));function y(x,b,v,_,k,P,C,T,N,R,A){const D=P/N,$=C/R,U=P/2,G=C/2,L=T/2,te=N+1,re=R+1;let J=0,ue=0;const me=new rt;for(let ge=0;ge<re;ge++){const X=ge*$-G;for(let ie=0;ie<te;ie++){const le=ie*D-U;me[x]=le*_,me[b]=X*k,me[v]=L,d.push(me.x,me.y,me.z),me[x]=0,me[b]=0,me[v]=T>0?1:-1,u.push(me.x,me.y,me.z),m.push(ie/N),m.push(1-ge/R),J+=1}}for(let ge=0;ge<R;ge++)for(let X=0;X<N;X++){const ie=p+X+te*ge,le=p+X+te*(ge+1),pe=p+(X+1)+te*(ge+1),Ce=p+(X+1)+te*ge;c.push(ie,le,Ce),c.push(le,pe,Ce),ue+=6}l.addGroup(f,ue,A),f+=ue,p+=J}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new I0(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function Bb(t){const e={};for(const n in t){e[n]={};for(const r in t[n]){const a=t[n][r];a&&(a.isColor||a.isMatrix3||a.isMatrix4||a.isVector2||a.isVector3||a.isVector4||a.isTexture||a.isQuaternion)?a.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[n][r]=null):e[n][r]=a.clone():Array.isArray(a)?e[n][r]=a.slice():e[n][r]=a}}return e}function Ps(t){const e={};for(let n=0;n<t.length;n++){const r=Bb(t[n]);for(const a in r)e[a]=r[a]}return e}function $1e(t){const e=[];for(let n=0;n<t.length;n++)e.push(t[n].clone());return e}function vQ(t){return t.getRenderTarget()===null?t.outputColorSpace:Hr.workingColorSpace}const _L={clone:Bb,merge:Ps};var q1e=`void main() {
- gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
- }`,V1e=`void main() {
- gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
- }`;class oh extends px{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=q1e,this.fragmentShader=V1e,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=Bb(e.uniforms),this.uniformsGroups=$1e(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 a in this.uniforms){const o=this.uniforms[a].value;o&&o.isTexture?n.uniforms[a]={type:"t",value:o.toJSON(e).uuid}:o&&o.isColor?n.uniforms[a]={type:"c",value:o.getHex()}:o&&o.isVector2?n.uniforms[a]={type:"v2",value:o.toArray()}:o&&o.isVector3?n.uniforms[a]={type:"v3",value:o.toArray()}:o&&o.isVector4?n.uniforms[a]={type:"v4",value:o.toArray()}:o&&o.isMatrix3?n.uniforms[a]={type:"m3",value:o.toArray()}:o&&o.isMatrix4?n.uniforms[a]={type:"m4",value:o.toArray()}:n.uniforms[a]={value:o}}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 r={};for(const a in this.extensions)this.extensions[a]===!0&&(r[a]=!0);return Object.keys(r).length>0&&(n.extensions=r),n}}class wQ extends Os{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new ti,this.projectionMatrix=new ti,this.projectionMatrixInverse=new ti,this.coordinateSystem=Rc}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 Ao extends wQ{constructor(e=50,n=1,r=.1,a=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=r,this.far=a,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=Yv*2*Math.atan(n),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(ov*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Yv*2*Math.atan(Math.tan(ov*.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,r,a,s,o){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=r,this.view.offsetY=a,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let n=e*Math.tan(ov*.5*this.fov)/this.zoom,r=2*n,a=this.aspect*r,s=-.5*a;const o=this.view;if(this.view!==null&&this.view.enabled){const c=o.fullWidth,d=o.fullHeight;s+=o.offsetX*a/c,n-=o.offsetY*r/d,a*=o.width/c,r*=o.height/d}const l=this.filmOffset;l!==0&&(s+=e*l/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+a,n,n-r,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 Fg=-90,Lg=1;class G1e extends Os{constructor(e,n,r){super(),this.type="CubeCamera",this.renderTarget=r,this.coordinateSystem=null,this.activeMipmapLevel=0;const a=new Ao(Fg,Lg,e,n);a.layers=this.layers,this.add(a);const s=new Ao(Fg,Lg,e,n);s.layers=this.layers,this.add(s);const o=new Ao(Fg,Lg,e,n);o.layers=this.layers,this.add(o);const l=new Ao(Fg,Lg,e,n);l.layers=this.layers,this.add(l);const c=new Ao(Fg,Lg,e,n);c.layers=this.layers,this.add(c);const d=new Ao(Fg,Lg,e,n);d.layers=this.layers,this.add(d)}updateCoordinateSystem(){const e=this.coordinateSystem,n=this.children.concat(),[r,a,s,o,l,c]=n;for(const d of n)this.remove(d);if(e===Rc)r.up.set(0,1,0),r.lookAt(1,0,0),a.up.set(0,1,0),a.lookAt(-1,0,0),s.up.set(0,0,-1),s.lookAt(0,1,0),o.up.set(0,0,1),o.lookAt(0,-1,0),l.up.set(0,1,0),l.lookAt(0,0,1),c.up.set(0,1,0),c.lookAt(0,0,-1);else if(e===Kv)r.up.set(0,-1,0),r.lookAt(-1,0,0),a.up.set(0,-1,0),a.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),o.up.set(0,0,-1),o.lookAt(0,-1,0),l.up.set(0,-1,0),l.lookAt(0,0,1),c.up.set(0,-1,0),c.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const d of n)this.add(d),d.updateMatrixWorld()}update(e,n){this.parent===null&&this.updateMatrixWorld();const{renderTarget:r,activeMipmapLevel:a}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[s,o,l,c,d,u]=this.children,m=e.getRenderTarget(),p=e.getActiveCubeFace(),f=e.getActiveMipmapLevel(),y=e.xr.enabled;e.xr.enabled=!1;const x=r.texture.generateMipmaps;r.texture.generateMipmaps=!1,e.setRenderTarget(r,0,a),e.render(n,s),e.setRenderTarget(r,1,a),e.render(n,o),e.setRenderTarget(r,2,a),e.render(n,l),e.setRenderTarget(r,3,a),e.render(n,c),e.setRenderTarget(r,4,a),e.render(n,d),r.texture.generateMipmaps=x,e.setRenderTarget(r,5,a),e.render(n,u),e.setRenderTarget(m,p,f),e.xr.enabled=y,r.texture.needsPMREMUpdate=!0}}class SQ extends oo{constructor(e,n,r,a,s,o,l,c,d,u){e=e!==void 0?e:[],n=n!==void 0?n:Ib,super(e,n,r,a,s,o,l,c,d,u),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class W1e extends Qp{constructor(e=1,n={}){super(e,e,n),this.isWebGLCubeRenderTarget=!0;const r={width:e,height:e,depth:1},a=[r,r,r,r,r,r];n.encoding!==void 0&&(cv("THREE.WebGLCubeRenderTarget: option.encoding has been replaced by option.colorSpace."),n.colorSpace=n.encoding===Ap?Qa:ul),this.texture=new SQ(a,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:cl}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 r={uniforms:{tEquirect:{value:null}},vertexShader:`
- varying vec3 vWorldDirection;
- vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
- return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
- }
- void main() {
- vWorldDirection = transformDirection( position, modelMatrix );
- #include <begin_vertex>
- #include <project_vertex>
- }
- `,fragmentShader:`
- uniform sampler2D tEquirect;
- varying vec3 vWorldDirection;
- #include <common>
- void main() {
- vec3 direction = normalize( vWorldDirection );
- vec2 sampleUV = equirectUv( direction );
- gl_FragColor = texture2D( tEquirect, sampleUV );
- }
- `},a=new I0(5,5,5),s=new oh({name:"CubemapFromEquirect",uniforms:Bb(r.uniforms),vertexShader:r.vertexShader,fragmentShader:r.fragmentShader,side:so,blending:Km});s.uniforms.tEquirect.value=n;const o=new Ql(a,s),l=n.minFilter;return n.minFilter===Gv&&(n.minFilter=cl),new G1e(1,10,this).update(e,o),n.minFilter=l,o.geometry.dispose(),o.material.dispose(),this}clear(e,n,r,a){const s=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(n,r,a);e.setRenderTarget(s)}}const o2=new rt,K1e=new rt,Y1e=new rr;class fm{constructor(e=new rt(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,r,a){return this.normal.set(e,n,r),this.constant=a,this}setFromNormalAndCoplanarPoint(e,n){return this.normal.copy(e),this.constant=-n.dot(this.normal),this}setFromCoplanarPoints(e,n,r){const a=o2.subVectors(r,n).cross(K1e.subVectors(e,n)).normalize();return this.setFromNormalAndCoplanarPoint(a,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 r=e.delta(o2),a=this.normal.dot(r);if(a===0)return this.distanceToPoint(e.start)===0?n.copy(e.start):null;const s=-(e.start.dot(this.normal)+this.constant)/a;return s<0||s>1?null:n.copy(e.start).addScaledVector(r,s)}intersectsLine(e){const n=this.distanceToPoint(e.start),r=this.distanceToPoint(e.end);return n<0&&r>0||r<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 r=n||Y1e.getNormalMatrix(e),a=this.coplanarPoint(o2).applyMatrix4(e),s=this.normal.applyMatrix3(r).normalize();return this.constant=-a.dot(s),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 Yh=new zc,h_=new rt;class TC{constructor(e=new fm,n=new fm,r=new fm,a=new fm,s=new fm,o=new fm){this.planes=[e,n,r,a,s,o]}set(e,n,r,a,s,o){const l=this.planes;return l[0].copy(e),l[1].copy(n),l[2].copy(r),l[3].copy(a),l[4].copy(s),l[5].copy(o),this}copy(e){const n=this.planes;for(let r=0;r<6;r++)n[r].copy(e.planes[r]);return this}setFromProjectionMatrix(e,n=Rc){const r=this.planes,a=e.elements,s=a[0],o=a[1],l=a[2],c=a[3],d=a[4],u=a[5],m=a[6],p=a[7],f=a[8],y=a[9],x=a[10],b=a[11],v=a[12],_=a[13],k=a[14],P=a[15];if(r[0].setComponents(c-s,p-d,b-f,P-v).normalize(),r[1].setComponents(c+s,p+d,b+f,P+v).normalize(),r[2].setComponents(c+o,p+u,b+y,P+_).normalize(),r[3].setComponents(c-o,p-u,b-y,P-_).normalize(),r[4].setComponents(c-l,p-m,b-x,P-k).normalize(),n===Rc)r[5].setComponents(c+l,p+m,b+x,P+k).normalize();else if(n===Kv)r[5].setComponents(l,m,x,k).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(),Yh.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const n=e.geometry;n.boundingSphere===null&&n.computeBoundingSphere(),Yh.copy(n.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Yh)}intersectsSprite(e){return Yh.center.set(0,0,0),Yh.radius=.7071067811865476,Yh.applyMatrix4(e.matrixWorld),this.intersectsSphere(Yh)}intersectsSphere(e){const n=this.planes,r=e.center,a=-e.radius;for(let s=0;s<6;s++)if(n[s].distanceToPoint(r)<a)return!1;return!0}intersectsBox(e){const n=this.planes;for(let r=0;r<6;r++){const a=n[r];if(h_.x=a.normal.x>0?e.max.x:e.min.x,h_.y=a.normal.y>0?e.max.y:e.min.y,h_.z=a.normal.z>0?e.max.z:e.min.z,a.distanceToPoint(h_)<0)return!1}return!0}containsPoint(e){const n=this.planes;for(let r=0;r<6;r++)if(n[r].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}function _Q(){let t=null,e=!1,n=null,r=null;function a(s,o){n(s,o),r=t.requestAnimationFrame(a)}return{start:function(){e!==!0&&n!==null&&(r=t.requestAnimationFrame(a),e=!0)},stop:function(){t.cancelAnimationFrame(r),e=!1},setAnimationLoop:function(s){n=s},setContext:function(s){t=s}}}function X1e(t,e){const n=e.isWebGL2,r=new WeakMap;function a(d,u){const m=d.array,p=d.usage,f=m.byteLength,y=t.createBuffer();t.bindBuffer(u,y),t.bufferData(u,m,p),d.onUploadCallback();let x;if(m instanceof Float32Array)x=t.FLOAT;else if(m instanceof Uint16Array)if(d.isFloat16BufferAttribute)if(n)x=t.HALF_FLOAT;else throw new Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.");else x=t.UNSIGNED_SHORT;else if(m instanceof Int16Array)x=t.SHORT;else if(m instanceof Uint32Array)x=t.UNSIGNED_INT;else if(m instanceof Int32Array)x=t.INT;else if(m instanceof Int8Array)x=t.BYTE;else if(m instanceof Uint8Array)x=t.UNSIGNED_BYTE;else if(m instanceof Uint8ClampedArray)x=t.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+m);return{buffer:y,type:x,bytesPerElement:m.BYTES_PER_ELEMENT,version:d.version,size:f}}function s(d,u,m){const p=u.array,f=u._updateRange,y=u.updateRanges;if(t.bindBuffer(m,d),f.count===-1&&y.length===0&&t.bufferSubData(m,0,p),y.length!==0){for(let x=0,b=y.length;x<b;x++){const v=y[x];n?t.bufferSubData(m,v.start*p.BYTES_PER_ELEMENT,p,v.start,v.count):t.bufferSubData(m,v.start*p.BYTES_PER_ELEMENT,p.subarray(v.start,v.start+v.count))}u.clearUpdateRanges()}f.count!==-1&&(n?t.bufferSubData(m,f.offset*p.BYTES_PER_ELEMENT,p,f.offset,f.count):t.bufferSubData(m,f.offset*p.BYTES_PER_ELEMENT,p.subarray(f.offset,f.offset+f.count)),f.count=-1),u.onUploadCallback()}function o(d){return d.isInterleavedBufferAttribute&&(d=d.data),r.get(d)}function l(d){d.isInterleavedBufferAttribute&&(d=d.data);const u=r.get(d);u&&(t.deleteBuffer(u.buffer),r.delete(d))}function c(d,u){if(d.isGLBufferAttribute){const p=r.get(d);(!p||p.version<d.version)&&r.set(d,{buffer:d.buffer,type:d.type,bytesPerElement:d.elementSize,version:d.version});return}d.isInterleavedBufferAttribute&&(d=d.data);const m=r.get(d);if(m===void 0)r.set(d,a(d,u));else if(m.version<d.version){if(m.size!==d.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");s(m.buffer,d,u),m.version=d.version}}return{get:o,remove:l,update:c}}class kL extends ys{constructor(e=1,n=1,r=1,a=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:n,widthSegments:r,heightSegments:a};const s=e/2,o=n/2,l=Math.floor(r),c=Math.floor(a),d=l+1,u=c+1,m=e/l,p=n/c,f=[],y=[],x=[],b=[];for(let v=0;v<u;v++){const _=v*p-o;for(let k=0;k<d;k++){const P=k*m-s;y.push(P,-_,0),x.push(0,0,1),b.push(k/l),b.push(1-v/c)}}for(let v=0;v<c;v++)for(let _=0;_<l;_++){const k=_+d*v,P=_+d*(v+1),C=_+1+d*(v+1),T=_+1+d*v;f.push(k,P,T),f.push(P,C,T)}this.setIndex(f),this.setAttribute("position",new Gi(y,3)),this.setAttribute("normal",new Gi(x,3)),this.setAttribute("uv",new Gi(b,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new kL(e.width,e.height,e.widthSegments,e.heightSegments)}}var Q1e=`#ifdef USE_ALPHAHASH
- if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
- #endif`,Z1e=`#ifdef USE_ALPHAHASH
- const float ALPHA_HASH_SCALE = 0.05;
- float hash2D( vec2 value ) {
- return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );
- }
- float hash3D( vec3 value ) {
- return hash2D( vec2( hash2D( value.xy ), value.z ) );
- }
- float getAlphaHashThreshold( vec3 position ) {
- float maxDeriv = max(
- length( dFdx( position.xyz ) ),
- length( dFdy( position.xyz ) )
- );
- float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );
- vec2 pixScales = vec2(
- exp2( floor( log2( pixScale ) ) ),
- exp2( ceil( log2( pixScale ) ) )
- );
- vec2 alpha = vec2(
- hash3D( floor( pixScales.x * position.xyz ) ),
- hash3D( floor( pixScales.y * position.xyz ) )
- );
- float lerpFactor = fract( log2( pixScale ) );
- float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;
- float a = min( lerpFactor, 1.0 - lerpFactor );
- vec3 cases = vec3(
- x * x / ( 2.0 * a * ( 1.0 - a ) ),
- ( x - 0.5 * a ) / ( 1.0 - a ),
- 1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )
- );
- float threshold = ( x < ( 1.0 - a ) )
- ? ( ( x < a ) ? cases.x : cases.y )
- : cases.z;
- return clamp( threshold , 1.0e-6, 1.0 );
- }
- #endif`,J1e=`#ifdef USE_ALPHAMAP
- diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
- #endif`,eke=`#ifdef USE_ALPHAMAP
- uniform sampler2D alphaMap;
- #endif`,tke=`#ifdef USE_ALPHATEST
- if ( diffuseColor.a < alphaTest ) discard;
- #endif`,nke=`#ifdef USE_ALPHATEST
- uniform float alphaTest;
- #endif`,rke=`#ifdef USE_AOMAP
- float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;
- reflectedLight.indirectDiffuse *= ambientOcclusion;
- #if defined( USE_CLEARCOAT )
- clearcoatSpecularIndirect *= ambientOcclusion;
- #endif
- #if defined( USE_SHEEN )
- sheenSpecularIndirect *= ambientOcclusion;
- #endif
- #if defined( USE_ENVMAP ) && defined( STANDARD )
- float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );
- reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
- #endif
- #endif`,ike=`#ifdef USE_AOMAP
- uniform sampler2D aoMap;
- uniform float aoMapIntensity;
- #endif`,ake=`#ifdef USE_BATCHING
- attribute float batchId;
- uniform highp sampler2D batchingTexture;
- mat4 getBatchingMatrix( const in float i ) {
- int size = textureSize( batchingTexture, 0 ).x;
- int j = int( i ) * 4;
- int x = j % size;
- int y = j / size;
- vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );
- vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );
- vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );
- vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );
- return mat4( v1, v2, v3, v4 );
- }
- #endif`,ske=`#ifdef USE_BATCHING
- mat4 batchingMatrix = getBatchingMatrix( batchId );
- #endif`,oke=`vec3 transformed = vec3( position );
- #ifdef USE_ALPHAHASH
- vPosition = vec3( position );
- #endif`,lke=`vec3 objectNormal = vec3( normal );
- #ifdef USE_TANGENT
- vec3 objectTangent = vec3( tangent.xyz );
- #endif`,cke=`float G_BlinnPhong_Implicit( ) {
- return 0.25;
- }
- float D_BlinnPhong( const in float shininess, const in float dotNH ) {
- return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );
- }
- vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {
- vec3 halfDir = normalize( lightDir + viewDir );
- float dotNH = saturate( dot( normal, halfDir ) );
- float dotVH = saturate( dot( viewDir, halfDir ) );
- vec3 F = F_Schlick( specularColor, 1.0, dotVH );
- float G = G_BlinnPhong_Implicit( );
- float D = D_BlinnPhong( shininess, dotNH );
- return F * ( G * D );
- } // validated`,dke=`#ifdef USE_IRIDESCENCE
- const mat3 XYZ_TO_REC709 = mat3(
- 3.2404542, -0.9692660, 0.0556434,
- -1.5371385, 1.8760108, -0.2040259,
- -0.4985314, 0.0415560, 1.0572252
- );
- vec3 Fresnel0ToIor( vec3 fresnel0 ) {
- vec3 sqrtF0 = sqrt( fresnel0 );
- return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );
- }
- vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {
- return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );
- }
- float IorToFresnel0( float transmittedIor, float incidentIor ) {
- return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));
- }
- vec3 evalSensitivity( float OPD, vec3 shift ) {
- float phase = 2.0 * PI * OPD * 1.0e-9;
- vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );
- vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );
- vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );
- vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );
- 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 ) );
- xyz /= 1.0685e-7;
- vec3 rgb = XYZ_TO_REC709 * xyz;
- return rgb;
- }
- vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {
- vec3 I;
- float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );
- float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );
- float cosTheta2Sq = 1.0 - sinTheta2Sq;
- if ( cosTheta2Sq < 0.0 ) {
- return vec3( 1.0 );
- }
- float cosTheta2 = sqrt( cosTheta2Sq );
- float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );
- float R12 = F_Schlick( R0, 1.0, cosTheta1 );
- float T121 = 1.0 - R12;
- float phi12 = 0.0;
- if ( iridescenceIOR < outsideIOR ) phi12 = PI;
- float phi21 = PI - phi12;
- vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) ); vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );
- vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );
- vec3 phi23 = vec3( 0.0 );
- if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;
- if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;
- if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;
- float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;
- vec3 phi = vec3( phi21 ) + phi23;
- vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );
- vec3 r123 = sqrt( R123 );
- vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );
- vec3 C0 = R12 + Rs;
- I = C0;
- vec3 Cm = Rs - T121;
- for ( int m = 1; m <= 2; ++ m ) {
- Cm *= r123;
- vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );
- I += Cm * Sm;
- }
- return max( I, vec3( 0.0 ) );
- }
- #endif`,uke=`#ifdef USE_BUMPMAP
- uniform sampler2D bumpMap;
- uniform float bumpScale;
- vec2 dHdxy_fwd() {
- vec2 dSTdx = dFdx( vBumpMapUv );
- vec2 dSTdy = dFdy( vBumpMapUv );
- float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;
- float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;
- float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;
- return vec2( dBx, dBy );
- }
- vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {
- vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );
- vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );
- vec3 vN = surf_norm;
- vec3 R1 = cross( vSigmaY, vN );
- vec3 R2 = cross( vN, vSigmaX );
- float fDet = dot( vSigmaX, R1 ) * faceDirection;
- vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
- return normalize( abs( fDet ) * surf_norm - vGrad );
- }
- #endif`,mke=`#if NUM_CLIPPING_PLANES > 0
- vec4 plane;
- #pragma unroll_loop_start
- for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
- plane = clippingPlanes[ i ];
- if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;
- }
- #pragma unroll_loop_end
- #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
- bool clipped = true;
- #pragma unroll_loop_start
- for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
- plane = clippingPlanes[ i ];
- clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;
- }
- #pragma unroll_loop_end
- if ( clipped ) discard;
- #endif
- #endif`,hke=`#if NUM_CLIPPING_PLANES > 0
- varying vec3 vClipPosition;
- uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
- #endif`,pke=`#if NUM_CLIPPING_PLANES > 0
- varying vec3 vClipPosition;
- #endif`,fke=`#if NUM_CLIPPING_PLANES > 0
- vClipPosition = - mvPosition.xyz;
- #endif`,gke=`#if defined( USE_COLOR_ALPHA )
- diffuseColor *= vColor;
- #elif defined( USE_COLOR )
- diffuseColor.rgb *= vColor;
- #endif`,bke=`#if defined( USE_COLOR_ALPHA )
- varying vec4 vColor;
- #elif defined( USE_COLOR )
- varying vec3 vColor;
- #endif`,xke=`#if defined( USE_COLOR_ALPHA )
- varying vec4 vColor;
- #elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )
- varying vec3 vColor;
- #endif`,yke=`#if defined( USE_COLOR_ALPHA )
- vColor = vec4( 1.0 );
- #elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )
- vColor = vec3( 1.0 );
- #endif
- #ifdef USE_COLOR
- vColor *= color;
- #endif
- #ifdef USE_INSTANCING_COLOR
- vColor.xyz *= instanceColor.xyz;
- #endif`,vke=`#define PI 3.141592653589793
- #define PI2 6.283185307179586
- #define PI_HALF 1.5707963267948966
- #define RECIPROCAL_PI 0.3183098861837907
- #define RECIPROCAL_PI2 0.15915494309189535
- #define EPSILON 1e-6
- #ifndef saturate
- #define saturate( a ) clamp( a, 0.0, 1.0 )
- #endif
- #define whiteComplement( a ) ( 1.0 - saturate( a ) )
- float pow2( const in float x ) { return x*x; }
- vec3 pow2( const in vec3 x ) { return x*x; }
- float pow3( const in float x ) { return x*x*x; }
- float pow4( const in float x ) { float x2 = x*x; return x2*x2; }
- float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }
- float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }
- highp float rand( const in vec2 uv ) {
- const highp float a = 12.9898, b = 78.233, c = 43758.5453;
- highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );
- return fract( sin( sn ) * c );
- }
- #ifdef HIGH_PRECISION
- float precisionSafeLength( vec3 v ) { return length( v ); }
- #else
- float precisionSafeLength( vec3 v ) {
- float maxComponent = max3( abs( v ) );
- return length( v / maxComponent ) * maxComponent;
- }
- #endif
- struct IncidentLight {
- vec3 color;
- vec3 direction;
- bool visible;
- };
- struct ReflectedLight {
- vec3 directDiffuse;
- vec3 directSpecular;
- vec3 indirectDiffuse;
- vec3 indirectSpecular;
- };
- #ifdef USE_ALPHAHASH
- varying vec3 vPosition;
- #endif
- vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
- return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
- }
- vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {
- return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );
- }
- mat3 transposeMat3( const in mat3 m ) {
- mat3 tmp;
- tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );
- tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );
- tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );
- return tmp;
- }
- float luminance( const in vec3 rgb ) {
- const vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 );
- return dot( weights, rgb );
- }
- bool isPerspectiveMatrix( mat4 m ) {
- return m[ 2 ][ 3 ] == - 1.0;
- }
- vec2 equirectUv( in vec3 dir ) {
- float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;
- float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;
- return vec2( u, v );
- }
- vec3 BRDF_Lambert( const in vec3 diffuseColor ) {
- return RECIPROCAL_PI * diffuseColor;
- }
- vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {
- float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
- return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
- }
- float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
- float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
- return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
- } // validated`,wke=`#ifdef ENVMAP_TYPE_CUBE_UV
- #define cubeUV_minMipLevel 4.0
- #define cubeUV_minTileSize 16.0
- float getFace( vec3 direction ) {
- vec3 absDirection = abs( direction );
- float face = - 1.0;
- if ( absDirection.x > absDirection.z ) {
- if ( absDirection.x > absDirection.y )
- face = direction.x > 0.0 ? 0.0 : 3.0;
- else
- face = direction.y > 0.0 ? 1.0 : 4.0;
- } else {
- if ( absDirection.z > absDirection.y )
- face = direction.z > 0.0 ? 2.0 : 5.0;
- else
- face = direction.y > 0.0 ? 1.0 : 4.0;
- }
- return face;
- }
- vec2 getUV( vec3 direction, float face ) {
- vec2 uv;
- if ( face == 0.0 ) {
- uv = vec2( direction.z, direction.y ) / abs( direction.x );
- } else if ( face == 1.0 ) {
- uv = vec2( - direction.x, - direction.z ) / abs( direction.y );
- } else if ( face == 2.0 ) {
- uv = vec2( - direction.x, direction.y ) / abs( direction.z );
- } else if ( face == 3.0 ) {
- uv = vec2( - direction.z, direction.y ) / abs( direction.x );
- } else if ( face == 4.0 ) {
- uv = vec2( - direction.x, direction.z ) / abs( direction.y );
- } else {
- uv = vec2( direction.x, direction.y ) / abs( direction.z );
- }
- return 0.5 * ( uv + 1.0 );
- }
- vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {
- float face = getFace( direction );
- float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );
- mipInt = max( mipInt, cubeUV_minMipLevel );
- float faceSize = exp2( mipInt );
- highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;
- if ( face > 2.0 ) {
- uv.y += faceSize;
- face -= 3.0;
- }
- uv.x += face * faceSize;
- uv.x += filterInt * 3.0 * cubeUV_minTileSize;
- uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );
- uv.x *= CUBEUV_TEXEL_WIDTH;
- uv.y *= CUBEUV_TEXEL_HEIGHT;
- #ifdef texture2DGradEXT
- return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;
- #else
- return texture2D( envMap, uv ).rgb;
- #endif
- }
- #define cubeUV_r0 1.0
- #define cubeUV_v0 0.339
- #define cubeUV_m0 - 2.0
- #define cubeUV_r1 0.8
- #define cubeUV_v1 0.276
- #define cubeUV_m1 - 1.0
- #define cubeUV_r4 0.4
- #define cubeUV_v4 0.046
- #define cubeUV_m4 2.0
- #define cubeUV_r5 0.305
- #define cubeUV_v5 0.016
- #define cubeUV_m5 3.0
- #define cubeUV_r6 0.21
- #define cubeUV_v6 0.0038
- #define cubeUV_m6 4.0
- float roughnessToMip( float roughness ) {
- float mip = 0.0;
- if ( roughness >= cubeUV_r1 ) {
- mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;
- } else if ( roughness >= cubeUV_r4 ) {
- mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;
- } else if ( roughness >= cubeUV_r5 ) {
- mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;
- } else if ( roughness >= cubeUV_r6 ) {
- mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;
- } else {
- mip = - 2.0 * log2( 1.16 * roughness ); }
- return mip;
- }
- vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {
- float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );
- float mipF = fract( mip );
- float mipInt = floor( mip );
- vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );
- if ( mipF == 0.0 ) {
- return vec4( color0, 1.0 );
- } else {
- vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );
- return vec4( mix( color0, color1, mipF ), 1.0 );
- }
- }
- #endif`,Ske=`vec3 transformedNormal = objectNormal;
- #ifdef USE_TANGENT
- vec3 transformedTangent = objectTangent;
- #endif
- #ifdef USE_BATCHING
- mat3 bm = mat3( batchingMatrix );
- transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );
- transformedNormal = bm * transformedNormal;
- #ifdef USE_TANGENT
- transformedTangent = bm * transformedTangent;
- #endif
- #endif
- #ifdef USE_INSTANCING
- mat3 im = mat3( instanceMatrix );
- transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );
- transformedNormal = im * transformedNormal;
- #ifdef USE_TANGENT
- transformedTangent = im * transformedTangent;
- #endif
- #endif
- transformedNormal = normalMatrix * transformedNormal;
- #ifdef FLIP_SIDED
- transformedNormal = - transformedNormal;
- #endif
- #ifdef USE_TANGENT
- transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;
- #ifdef FLIP_SIDED
- transformedTangent = - transformedTangent;
- #endif
- #endif`,_ke=`#ifdef USE_DISPLACEMENTMAP
- uniform sampler2D displacementMap;
- uniform float displacementScale;
- uniform float displacementBias;
- #endif`,kke=`#ifdef USE_DISPLACEMENTMAP
- transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );
- #endif`,Nke=`#ifdef USE_EMISSIVEMAP
- vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
- totalEmissiveRadiance *= emissiveColor.rgb;
- #endif`,Cke=`#ifdef USE_EMISSIVEMAP
- uniform sampler2D emissiveMap;
- #endif`,Tke="gl_FragColor = linearToOutputTexel( gl_FragColor );",Pke=`
- const mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = mat3(
- vec3( 0.8224621, 0.177538, 0.0 ),
- vec3( 0.0331941, 0.9668058, 0.0 ),
- vec3( 0.0170827, 0.0723974, 0.9105199 )
- );
- const mat3 LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = mat3(
- vec3( 1.2249401, - 0.2249404, 0.0 ),
- vec3( - 0.0420569, 1.0420571, 0.0 ),
- vec3( - 0.0196376, - 0.0786361, 1.0982735 )
- );
- vec4 LinearSRGBToLinearDisplayP3( in vec4 value ) {
- return vec4( value.rgb * LINEAR_SRGB_TO_LINEAR_DISPLAY_P3, value.a );
- }
- vec4 LinearDisplayP3ToLinearSRGB( in vec4 value ) {
- return vec4( value.rgb * LINEAR_DISPLAY_P3_TO_LINEAR_SRGB, value.a );
- }
- vec4 LinearTransferOETF( in vec4 value ) {
- return value;
- }
- vec4 sRGBTransferOETF( in vec4 value ) {
- 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 );
- }
- vec4 LinearToLinear( in vec4 value ) {
- return value;
- }
- vec4 LinearTosRGB( in vec4 value ) {
- return sRGBTransferOETF( value );
- }`,Ake=`#ifdef USE_ENVMAP
- #ifdef ENV_WORLDPOS
- vec3 cameraToFrag;
- if ( isOrthographic ) {
- cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
- } else {
- cameraToFrag = normalize( vWorldPosition - cameraPosition );
- }
- vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
- #ifdef ENVMAP_MODE_REFLECTION
- vec3 reflectVec = reflect( cameraToFrag, worldNormal );
- #else
- vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );
- #endif
- #else
- vec3 reflectVec = vReflect;
- #endif
- #ifdef ENVMAP_TYPE_CUBE
- vec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );
- #else
- vec4 envColor = vec4( 0.0 );
- #endif
- #ifdef ENVMAP_BLENDING_MULTIPLY
- outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );
- #elif defined( ENVMAP_BLENDING_MIX )
- outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );
- #elif defined( ENVMAP_BLENDING_ADD )
- outgoingLight += envColor.xyz * specularStrength * reflectivity;
- #endif
- #endif`,Mke=`#ifdef USE_ENVMAP
- uniform float envMapIntensity;
- uniform float flipEnvMap;
- #ifdef ENVMAP_TYPE_CUBE
- uniform samplerCube envMap;
- #else
- uniform sampler2D envMap;
- #endif
-
- #endif`,Eke=`#ifdef USE_ENVMAP
- uniform float reflectivity;
- #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
- #define ENV_WORLDPOS
- #endif
- #ifdef ENV_WORLDPOS
- varying vec3 vWorldPosition;
- uniform float refractionRatio;
- #else
- varying vec3 vReflect;
- #endif
- #endif`,jke=`#ifdef USE_ENVMAP
- #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
- #define ENV_WORLDPOS
- #endif
- #ifdef ENV_WORLDPOS
-
- varying vec3 vWorldPosition;
- #else
- varying vec3 vReflect;
- uniform float refractionRatio;
- #endif
- #endif`,Dke=`#ifdef USE_ENVMAP
- #ifdef ENV_WORLDPOS
- vWorldPosition = worldPosition.xyz;
- #else
- vec3 cameraToVertex;
- if ( isOrthographic ) {
- cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
- } else {
- cameraToVertex = normalize( worldPosition.xyz - cameraPosition );
- }
- vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
- #ifdef ENVMAP_MODE_REFLECTION
- vReflect = reflect( cameraToVertex, worldNormal );
- #else
- vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
- #endif
- #endif
- #endif`,Rke=`#ifdef USE_FOG
- vFogDepth = - mvPosition.z;
- #endif`,Fke=`#ifdef USE_FOG
- varying float vFogDepth;
- #endif`,Lke=`#ifdef USE_FOG
- #ifdef FOG_EXP2
- float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );
- #else
- float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );
- #endif
- gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
- #endif`,Oke=`#ifdef USE_FOG
- uniform vec3 fogColor;
- varying float vFogDepth;
- #ifdef FOG_EXP2
- uniform float fogDensity;
- #else
- uniform float fogNear;
- uniform float fogFar;
- #endif
- #endif`,Ike=`#ifdef USE_GRADIENTMAP
- uniform sampler2D gradientMap;
- #endif
- vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
- float dotNL = dot( normal, lightDirection );
- vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );
- #ifdef USE_GRADIENTMAP
- return vec3( texture2D( gradientMap, coord ).r );
- #else
- vec2 fw = fwidth( coord ) * 0.5;
- return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );
- #endif
- }`,zke=`#ifdef USE_LIGHTMAP
- vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
- vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
- reflectedLight.indirectDiffuse += lightMapIrradiance;
- #endif`,Uke=`#ifdef USE_LIGHTMAP
- uniform sampler2D lightMap;
- uniform float lightMapIntensity;
- #endif`,Bke=`LambertMaterial material;
- material.diffuseColor = diffuseColor.rgb;
- material.specularStrength = specularStrength;`,Hke=`varying vec3 vViewPosition;
- struct LambertMaterial {
- vec3 diffuseColor;
- float specularStrength;
- };
- 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 ) {
- float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
- vec3 irradiance = dotNL * directLight.color;
- reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
- }
- 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 ) {
- reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
- }
- #define RE_Direct RE_Direct_Lambert
- #define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,$ke=`uniform bool receiveShadow;
- uniform vec3 ambientLightColor;
- #if defined( USE_LIGHT_PROBES )
- uniform vec3 lightProbe[ 9 ];
- #endif
- vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {
- float x = normal.x, y = normal.y, z = normal.z;
- vec3 result = shCoefficients[ 0 ] * 0.886227;
- result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;
- result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;
- result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;
- result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;
- result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;
- result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );
- result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;
- result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );
- return result;
- }
- vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {
- vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
- vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );
- return irradiance;
- }
- vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {
- vec3 irradiance = ambientLightColor;
- return irradiance;
- }
- float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {
- #if defined ( LEGACY_LIGHTS )
- if ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {
- return pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );
- }
- return 1.0;
- #else
- float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );
- if ( cutoffDistance > 0.0 ) {
- distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );
- }
- return distanceFalloff;
- #endif
- }
- float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {
- return smoothstep( coneCosine, penumbraCosine, angleCosine );
- }
- #if NUM_DIR_LIGHTS > 0
- struct DirectionalLight {
- vec3 direction;
- vec3 color;
- };
- uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];
- void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {
- light.color = directionalLight.color;
- light.direction = directionalLight.direction;
- light.visible = true;
- }
- #endif
- #if NUM_POINT_LIGHTS > 0
- struct PointLight {
- vec3 position;
- vec3 color;
- float distance;
- float decay;
- };
- uniform PointLight pointLights[ NUM_POINT_LIGHTS ];
- void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {
- vec3 lVector = pointLight.position - geometryPosition;
- light.direction = normalize( lVector );
- float lightDistance = length( lVector );
- light.color = pointLight.color;
- light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );
- light.visible = ( light.color != vec3( 0.0 ) );
- }
- #endif
- #if NUM_SPOT_LIGHTS > 0
- struct SpotLight {
- vec3 position;
- vec3 direction;
- vec3 color;
- float distance;
- float decay;
- float coneCos;
- float penumbraCos;
- };
- uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];
- void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {
- vec3 lVector = spotLight.position - geometryPosition;
- light.direction = normalize( lVector );
- float angleCos = dot( light.direction, spotLight.direction );
- float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );
- if ( spotAttenuation > 0.0 ) {
- float lightDistance = length( lVector );
- light.color = spotLight.color * spotAttenuation;
- light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );
- light.visible = ( light.color != vec3( 0.0 ) );
- } else {
- light.color = vec3( 0.0 );
- light.visible = false;
- }
- }
- #endif
- #if NUM_RECT_AREA_LIGHTS > 0
- struct RectAreaLight {
- vec3 color;
- vec3 position;
- vec3 halfWidth;
- vec3 halfHeight;
- };
- uniform sampler2D ltc_1; uniform sampler2D ltc_2;
- uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];
- #endif
- #if NUM_HEMI_LIGHTS > 0
- struct HemisphereLight {
- vec3 direction;
- vec3 skyColor;
- vec3 groundColor;
- };
- uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];
- vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {
- float dotNL = dot( normal, hemiLight.direction );
- float hemiDiffuseWeight = 0.5 * dotNL + 0.5;
- vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );
- return irradiance;
- }
- #endif`,qke=`#ifdef USE_ENVMAP
- vec3 getIBLIrradiance( const in vec3 normal ) {
- #ifdef ENVMAP_TYPE_CUBE_UV
- vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
- vec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );
- return PI * envMapColor.rgb * envMapIntensity;
- #else
- return vec3( 0.0 );
- #endif
- }
- vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {
- #ifdef ENVMAP_TYPE_CUBE_UV
- vec3 reflectVec = reflect( - viewDir, normal );
- reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );
- reflectVec = inverseTransformDirection( reflectVec, viewMatrix );
- vec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );
- return envMapColor.rgb * envMapIntensity;
- #else
- return vec3( 0.0 );
- #endif
- }
- #ifdef USE_ANISOTROPY
- vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {
- #ifdef ENVMAP_TYPE_CUBE_UV
- vec3 bentNormal = cross( bitangent, viewDir );
- bentNormal = normalize( cross( bentNormal, bitangent ) );
- bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );
- return getIBLRadiance( viewDir, bentNormal, roughness );
- #else
- return vec3( 0.0 );
- #endif
- }
- #endif
- #endif`,Vke=`ToonMaterial material;
- material.diffuseColor = diffuseColor.rgb;`,Gke=`varying vec3 vViewPosition;
- struct ToonMaterial {
- vec3 diffuseColor;
- };
- 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 ) {
- vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;
- reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
- }
- 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 ) {
- reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
- }
- #define RE_Direct RE_Direct_Toon
- #define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,Wke=`BlinnPhongMaterial material;
- material.diffuseColor = diffuseColor.rgb;
- material.specularColor = specular;
- material.specularShininess = shininess;
- material.specularStrength = specularStrength;`,Kke=`varying vec3 vViewPosition;
- struct BlinnPhongMaterial {
- vec3 diffuseColor;
- vec3 specularColor;
- float specularShininess;
- float specularStrength;
- };
- 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 ) {
- float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
- vec3 irradiance = dotNL * directLight.color;
- reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
- reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;
- }
- 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 ) {
- reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
- }
- #define RE_Direct RE_Direct_BlinnPhong
- #define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,Yke=`PhysicalMaterial material;
- material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );
- vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );
- float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );
- material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;
- material.roughness = min( material.roughness, 1.0 );
- #ifdef IOR
- material.ior = ior;
- #ifdef USE_SPECULAR
- float specularIntensityFactor = specularIntensity;
- vec3 specularColorFactor = specularColor;
- #ifdef USE_SPECULAR_COLORMAP
- specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;
- #endif
- #ifdef USE_SPECULAR_INTENSITYMAP
- specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;
- #endif
- material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );
- #else
- float specularIntensityFactor = 1.0;
- vec3 specularColorFactor = vec3( 1.0 );
- material.specularF90 = 1.0;
- #endif
- material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );
- #else
- material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );
- material.specularF90 = 1.0;
- #endif
- #ifdef USE_CLEARCOAT
- material.clearcoat = clearcoat;
- material.clearcoatRoughness = clearcoatRoughness;
- material.clearcoatF0 = vec3( 0.04 );
- material.clearcoatF90 = 1.0;
- #ifdef USE_CLEARCOATMAP
- material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;
- #endif
- #ifdef USE_CLEARCOAT_ROUGHNESSMAP
- material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;
- #endif
- material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );
- material.clearcoatRoughness += geometryRoughness;
- material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );
- #endif
- #ifdef USE_IRIDESCENCE
- material.iridescence = iridescence;
- material.iridescenceIOR = iridescenceIOR;
- #ifdef USE_IRIDESCENCEMAP
- material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;
- #endif
- #ifdef USE_IRIDESCENCE_THICKNESSMAP
- material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;
- #else
- material.iridescenceThickness = iridescenceThicknessMaximum;
- #endif
- #endif
- #ifdef USE_SHEEN
- material.sheenColor = sheenColor;
- #ifdef USE_SHEEN_COLORMAP
- material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;
- #endif
- material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );
- #ifdef USE_SHEEN_ROUGHNESSMAP
- material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;
- #endif
- #endif
- #ifdef USE_ANISOTROPY
- #ifdef USE_ANISOTROPYMAP
- mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );
- vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;
- vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;
- #else
- vec2 anisotropyV = anisotropyVector;
- #endif
- material.anisotropy = length( anisotropyV );
- if( material.anisotropy == 0.0 ) {
- anisotropyV = vec2( 1.0, 0.0 );
- } else {
- anisotropyV /= material.anisotropy;
- material.anisotropy = saturate( material.anisotropy );
- }
- material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
- material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;
- material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;
- #endif`,Xke=`struct PhysicalMaterial {
- vec3 diffuseColor;
- float roughness;
- vec3 specularColor;
- float specularF90;
- #ifdef USE_CLEARCOAT
- float clearcoat;
- float clearcoatRoughness;
- vec3 clearcoatF0;
- float clearcoatF90;
- #endif
- #ifdef USE_IRIDESCENCE
- float iridescence;
- float iridescenceIOR;
- float iridescenceThickness;
- vec3 iridescenceFresnel;
- vec3 iridescenceF0;
- #endif
- #ifdef USE_SHEEN
- vec3 sheenColor;
- float sheenRoughness;
- #endif
- #ifdef IOR
- float ior;
- #endif
- #ifdef USE_TRANSMISSION
- float transmission;
- float transmissionAlpha;
- float thickness;
- float attenuationDistance;
- vec3 attenuationColor;
- #endif
- #ifdef USE_ANISOTROPY
- float anisotropy;
- float alphaT;
- vec3 anisotropyT;
- vec3 anisotropyB;
- #endif
- };
- vec3 clearcoatSpecularDirect = vec3( 0.0 );
- vec3 clearcoatSpecularIndirect = vec3( 0.0 );
- vec3 sheenSpecularDirect = vec3( 0.0 );
- vec3 sheenSpecularIndirect = vec3(0.0 );
- vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {
- float x = clamp( 1.0 - dotVH, 0.0, 1.0 );
- float x2 = x * x;
- float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );
- return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );
- }
- float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {
- float a2 = pow2( alpha );
- float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
- float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );
- return 0.5 / max( gv + gl, EPSILON );
- }
- float D_GGX( const in float alpha, const in float dotNH ) {
- float a2 = pow2( alpha );
- float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;
- return RECIPROCAL_PI * a2 / pow2( denom );
- }
- #ifdef USE_ANISOTROPY
- 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 ) {
- float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );
- float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );
- float v = 0.5 / ( gv + gl );
- return saturate(v);
- }
- float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {
- float a2 = alphaT * alphaB;
- highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );
- highp float v2 = dot( v, v );
- float w2 = a2 / v2;
- return RECIPROCAL_PI * a2 * pow2 ( w2 );
- }
- #endif
- #ifdef USE_CLEARCOAT
- vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {
- vec3 f0 = material.clearcoatF0;
- float f90 = material.clearcoatF90;
- float roughness = material.clearcoatRoughness;
- float alpha = pow2( roughness );
- vec3 halfDir = normalize( lightDir + viewDir );
- float dotNL = saturate( dot( normal, lightDir ) );
- float dotNV = saturate( dot( normal, viewDir ) );
- float dotNH = saturate( dot( normal, halfDir ) );
- float dotVH = saturate( dot( viewDir, halfDir ) );
- vec3 F = F_Schlick( f0, f90, dotVH );
- float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
- float D = D_GGX( alpha, dotNH );
- return F * ( V * D );
- }
- #endif
- vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {
- vec3 f0 = material.specularColor;
- float f90 = material.specularF90;
- float roughness = material.roughness;
- float alpha = pow2( roughness );
- vec3 halfDir = normalize( lightDir + viewDir );
- float dotNL = saturate( dot( normal, lightDir ) );
- float dotNV = saturate( dot( normal, viewDir ) );
- float dotNH = saturate( dot( normal, halfDir ) );
- float dotVH = saturate( dot( viewDir, halfDir ) );
- vec3 F = F_Schlick( f0, f90, dotVH );
- #ifdef USE_IRIDESCENCE
- F = mix( F, material.iridescenceFresnel, material.iridescence );
- #endif
- #ifdef USE_ANISOTROPY
- float dotTL = dot( material.anisotropyT, lightDir );
- float dotTV = dot( material.anisotropyT, viewDir );
- float dotTH = dot( material.anisotropyT, halfDir );
- float dotBL = dot( material.anisotropyB, lightDir );
- float dotBV = dot( material.anisotropyB, viewDir );
- float dotBH = dot( material.anisotropyB, halfDir );
- float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );
- float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );
- #else
- float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
- float D = D_GGX( alpha, dotNH );
- #endif
- return F * ( V * D );
- }
- vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {
- const float LUT_SIZE = 64.0;
- const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;
- const float LUT_BIAS = 0.5 / LUT_SIZE;
- float dotNV = saturate( dot( N, V ) );
- vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );
- uv = uv * LUT_SCALE + LUT_BIAS;
- return uv;
- }
- float LTC_ClippedSphereFormFactor( const in vec3 f ) {
- float l = length( f );
- return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );
- }
- vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {
- float x = dot( v1, v2 );
- float y = abs( x );
- float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;
- float b = 3.4175940 + ( 4.1616724 + y ) * y;
- float v = a / b;
- float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;
- return cross( v1, v2 ) * theta_sintheta;
- }
- vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {
- vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];
- vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];
- vec3 lightNormal = cross( v1, v2 );
- if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );
- vec3 T1, T2;
- T1 = normalize( V - N * dot( V, N ) );
- T2 = - cross( N, T1 );
- mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );
- vec3 coords[ 4 ];
- coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );
- coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );
- coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );
- coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );
- coords[ 0 ] = normalize( coords[ 0 ] );
- coords[ 1 ] = normalize( coords[ 1 ] );
- coords[ 2 ] = normalize( coords[ 2 ] );
- coords[ 3 ] = normalize( coords[ 3 ] );
- vec3 vectorFormFactor = vec3( 0.0 );
- vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );
- vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );
- vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );
- vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );
- float result = LTC_ClippedSphereFormFactor( vectorFormFactor );
- return vec3( result );
- }
- #if defined( USE_SHEEN )
- float D_Charlie( float roughness, float dotNH ) {
- float alpha = pow2( roughness );
- float invAlpha = 1.0 / alpha;
- float cos2h = dotNH * dotNH;
- float sin2h = max( 1.0 - cos2h, 0.0078125 );
- return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );
- }
- float V_Neubelt( float dotNV, float dotNL ) {
- return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );
- }
- vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {
- vec3 halfDir = normalize( lightDir + viewDir );
- float dotNL = saturate( dot( normal, lightDir ) );
- float dotNV = saturate( dot( normal, viewDir ) );
- float dotNH = saturate( dot( normal, halfDir ) );
- float D = D_Charlie( sheenRoughness, dotNH );
- float V = V_Neubelt( dotNV, dotNL );
- return sheenColor * ( D * V );
- }
- #endif
- float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
- float dotNV = saturate( dot( normal, viewDir ) );
- float r2 = roughness * roughness;
- float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;
- float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;
- float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );
- return saturate( DG * RECIPROCAL_PI );
- }
- vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
- float dotNV = saturate( dot( normal, viewDir ) );
- const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );
- const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );
- vec4 r = roughness * c0 + c1;
- float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;
- vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;
- return fab;
- }
- vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {
- vec2 fab = DFGApprox( normal, viewDir, roughness );
- return specularColor * fab.x + specularF90 * fab.y;
- }
- #ifdef USE_IRIDESCENCE
- 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 ) {
- #else
- 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 ) {
- #endif
- vec2 fab = DFGApprox( normal, viewDir, roughness );
- #ifdef USE_IRIDESCENCE
- vec3 Fr = mix( specularColor, iridescenceF0, iridescence );
- #else
- vec3 Fr = specularColor;
- #endif
- vec3 FssEss = Fr * fab.x + specularF90 * fab.y;
- float Ess = fab.x + fab.y;
- float Ems = 1.0 - Ess;
- vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );
- singleScatter += FssEss;
- multiScatter += Fms * Ems;
- }
- #if NUM_RECT_AREA_LIGHTS > 0
- 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 ) {
- vec3 normal = geometryNormal;
- vec3 viewDir = geometryViewDir;
- vec3 position = geometryPosition;
- vec3 lightPos = rectAreaLight.position;
- vec3 halfWidth = rectAreaLight.halfWidth;
- vec3 halfHeight = rectAreaLight.halfHeight;
- vec3 lightColor = rectAreaLight.color;
- float roughness = material.roughness;
- vec3 rectCoords[ 4 ];
- rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;
- rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;
- rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;
- vec2 uv = LTC_Uv( normal, viewDir, roughness );
- vec4 t1 = texture2D( ltc_1, uv );
- vec4 t2 = texture2D( ltc_2, uv );
- mat3 mInv = mat3(
- vec3( t1.x, 0, t1.y ),
- vec3( 0, 1, 0 ),
- vec3( t1.z, 0, t1.w )
- );
- vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );
- reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );
- reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );
- }
- #endif
- 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 ) {
- float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
- vec3 irradiance = dotNL * directLight.color;
- #ifdef USE_CLEARCOAT
- float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );
- vec3 ccIrradiance = dotNLcc * directLight.color;
- clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );
- #endif
- #ifdef USE_SHEEN
- sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );
- #endif
- reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );
- reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
- }
- 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 ) {
- reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
- }
- 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) {
- #ifdef USE_CLEARCOAT
- clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );
- #endif
- #ifdef USE_SHEEN
- sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
- #endif
- vec3 singleScattering = vec3( 0.0 );
- vec3 multiScattering = vec3( 0.0 );
- vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;
- #ifdef USE_IRIDESCENCE
- computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );
- #else
- computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );
- #endif
- vec3 totalScattering = singleScattering + multiScattering;
- vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );
- reflectedLight.indirectSpecular += radiance * singleScattering;
- reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;
- reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;
- }
- #define RE_Direct RE_Direct_Physical
- #define RE_Direct_RectArea RE_Direct_RectArea_Physical
- #define RE_IndirectDiffuse RE_IndirectDiffuse_Physical
- #define RE_IndirectSpecular RE_IndirectSpecular_Physical
- float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
- return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
- }`,Qke=`
- vec3 geometryPosition = - vViewPosition;
- vec3 geometryNormal = normal;
- vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
- vec3 geometryClearcoatNormal = vec3( 0.0 );
- #ifdef USE_CLEARCOAT
- geometryClearcoatNormal = clearcoatNormal;
- #endif
- #ifdef USE_IRIDESCENCE
- float dotNVi = saturate( dot( normal, geometryViewDir ) );
- if ( material.iridescenceThickness == 0.0 ) {
- material.iridescence = 0.0;
- } else {
- material.iridescence = saturate( material.iridescence );
- }
- if ( material.iridescence > 0.0 ) {
- material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );
- material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );
- }
- #endif
- IncidentLight directLight;
- #if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )
- PointLight pointLight;
- #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0
- PointLightShadow pointLightShadow;
- #endif
- #pragma unroll_loop_start
- for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
- pointLight = pointLights[ i ];
- getPointLightInfo( pointLight, geometryPosition, directLight );
- #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )
- pointLightShadow = pointLightShadows[ i ];
- directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;
- #endif
- RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
- }
- #pragma unroll_loop_end
- #endif
- #if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )
- SpotLight spotLight;
- vec4 spotColor;
- vec3 spotLightCoord;
- bool inSpotLightMap;
- #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0
- SpotLightShadow spotLightShadow;
- #endif
- #pragma unroll_loop_start
- for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
- spotLight = spotLights[ i ];
- getSpotLightInfo( spotLight, geometryPosition, directLight );
- #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
- #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX
- #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
- #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS
- #else
- #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
- #endif
- #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )
- spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;
- inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );
- spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );
- directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;
- #endif
- #undef SPOT_LIGHT_MAP_INDEX
- #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
- spotLightShadow = spotLightShadows[ i ];
- directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
- #endif
- RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
- }
- #pragma unroll_loop_end
- #endif
- #if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )
- DirectionalLight directionalLight;
- #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0
- DirectionalLightShadow directionalLightShadow;
- #endif
- #pragma unroll_loop_start
- for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
- directionalLight = directionalLights[ i ];
- getDirectionalLightInfo( directionalLight, directLight );
- #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
- directionalLightShadow = directionalLightShadows[ i ];
- directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
- #endif
- RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
- }
- #pragma unroll_loop_end
- #endif
- #if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )
- RectAreaLight rectAreaLight;
- #pragma unroll_loop_start
- for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {
- rectAreaLight = rectAreaLights[ i ];
- RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
- }
- #pragma unroll_loop_end
- #endif
- #if defined( RE_IndirectDiffuse )
- vec3 iblIrradiance = vec3( 0.0 );
- vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );
- #if defined( USE_LIGHT_PROBES )
- irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );
- #endif
- #if ( NUM_HEMI_LIGHTS > 0 )
- #pragma unroll_loop_start
- for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
- irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );
- }
- #pragma unroll_loop_end
- #endif
- #endif
- #if defined( RE_IndirectSpecular )
- vec3 radiance = vec3( 0.0 );
- vec3 clearcoatRadiance = vec3( 0.0 );
- #endif`,Zke=`#if defined( RE_IndirectDiffuse )
- #ifdef USE_LIGHTMAP
- vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
- vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
- irradiance += lightMapIrradiance;
- #endif
- #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )
- iblIrradiance += getIBLIrradiance( geometryNormal );
- #endif
- #endif
- #if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )
- #ifdef USE_ANISOTROPY
- radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );
- #else
- radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );
- #endif
- #ifdef USE_CLEARCOAT
- clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );
- #endif
- #endif`,Jke=`#if defined( RE_IndirectDiffuse )
- RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
- #endif
- #if defined( RE_IndirectSpecular )
- RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
- #endif`,eNe=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )
- gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
- #endif`,tNe=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )
- uniform float logDepthBufFC;
- varying float vFragDepth;
- varying float vIsPerspective;
- #endif`,nNe=`#ifdef USE_LOGDEPTHBUF
- #ifdef USE_LOGDEPTHBUF_EXT
- varying float vFragDepth;
- varying float vIsPerspective;
- #else
- uniform float logDepthBufFC;
- #endif
- #endif`,rNe=`#ifdef USE_LOGDEPTHBUF
- #ifdef USE_LOGDEPTHBUF_EXT
- vFragDepth = 1.0 + gl_Position.w;
- vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
- #else
- if ( isPerspectiveMatrix( projectionMatrix ) ) {
- gl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;
- gl_Position.z *= gl_Position.w;
- }
- #endif
- #endif`,iNe=`#ifdef USE_MAP
- vec4 sampledDiffuseColor = texture2D( map, vMapUv );
- #ifdef DECODE_VIDEO_TEXTURE
- 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 );
-
- #endif
- diffuseColor *= sampledDiffuseColor;
- #endif`,aNe=`#ifdef USE_MAP
- uniform sampler2D map;
- #endif`,sNe=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
- #if defined( USE_POINTS_UV )
- vec2 uv = vUv;
- #else
- vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;
- #endif
- #endif
- #ifdef USE_MAP
- diffuseColor *= texture2D( map, uv );
- #endif
- #ifdef USE_ALPHAMAP
- diffuseColor.a *= texture2D( alphaMap, uv ).g;
- #endif`,oNe=`#if defined( USE_POINTS_UV )
- varying vec2 vUv;
- #else
- #if defined( USE_MAP ) || defined( USE_ALPHAMAP )
- uniform mat3 uvTransform;
- #endif
- #endif
- #ifdef USE_MAP
- uniform sampler2D map;
- #endif
- #ifdef USE_ALPHAMAP
- uniform sampler2D alphaMap;
- #endif`,lNe=`float metalnessFactor = metalness;
- #ifdef USE_METALNESSMAP
- vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
- metalnessFactor *= texelMetalness.b;
- #endif`,cNe=`#ifdef USE_METALNESSMAP
- uniform sampler2D metalnessMap;
- #endif`,dNe=`#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE )
- vColor *= morphTargetBaseInfluence;
- for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
- #if defined( USE_COLOR_ALPHA )
- if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];
- #elif defined( USE_COLOR )
- if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];
- #endif
- }
- #endif`,uNe=`#ifdef USE_MORPHNORMALS
- objectNormal *= morphTargetBaseInfluence;
- #ifdef MORPHTARGETS_TEXTURE
- for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
- if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];
- }
- #else
- objectNormal += morphNormal0 * morphTargetInfluences[ 0 ];
- objectNormal += morphNormal1 * morphTargetInfluences[ 1 ];
- objectNormal += morphNormal2 * morphTargetInfluences[ 2 ];
- objectNormal += morphNormal3 * morphTargetInfluences[ 3 ];
- #endif
- #endif`,mNe=`#ifdef USE_MORPHTARGETS
- uniform float morphTargetBaseInfluence;
- #ifdef MORPHTARGETS_TEXTURE
- uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
- uniform sampler2DArray morphTargetsTexture;
- uniform ivec2 morphTargetsTextureSize;
- vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {
- int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;
- int y = texelIndex / morphTargetsTextureSize.x;
- int x = texelIndex - y * morphTargetsTextureSize.x;
- ivec3 morphUV = ivec3( x, y, morphTargetIndex );
- return texelFetch( morphTargetsTexture, morphUV, 0 );
- }
- #else
- #ifndef USE_MORPHNORMALS
- uniform float morphTargetInfluences[ 8 ];
- #else
- uniform float morphTargetInfluences[ 4 ];
- #endif
- #endif
- #endif`,hNe=`#ifdef USE_MORPHTARGETS
- transformed *= morphTargetBaseInfluence;
- #ifdef MORPHTARGETS_TEXTURE
- for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
- if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];
- }
- #else
- transformed += morphTarget0 * morphTargetInfluences[ 0 ];
- transformed += morphTarget1 * morphTargetInfluences[ 1 ];
- transformed += morphTarget2 * morphTargetInfluences[ 2 ];
- transformed += morphTarget3 * morphTargetInfluences[ 3 ];
- #ifndef USE_MORPHNORMALS
- transformed += morphTarget4 * morphTargetInfluences[ 4 ];
- transformed += morphTarget5 * morphTargetInfluences[ 5 ];
- transformed += morphTarget6 * morphTargetInfluences[ 6 ];
- transformed += morphTarget7 * morphTargetInfluences[ 7 ];
- #endif
- #endif
- #endif`,pNe=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
- #ifdef FLAT_SHADED
- vec3 fdx = dFdx( vViewPosition );
- vec3 fdy = dFdy( vViewPosition );
- vec3 normal = normalize( cross( fdx, fdy ) );
- #else
- vec3 normal = normalize( vNormal );
- #ifdef DOUBLE_SIDED
- normal *= faceDirection;
- #endif
- #endif
- #if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )
- #ifdef USE_TANGENT
- mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
- #else
- mat3 tbn = getTangentFrame( - vViewPosition, normal,
- #if defined( USE_NORMALMAP )
- vNormalMapUv
- #elif defined( USE_CLEARCOAT_NORMALMAP )
- vClearcoatNormalMapUv
- #else
- vUv
- #endif
- );
- #endif
- #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
- tbn[0] *= faceDirection;
- tbn[1] *= faceDirection;
- #endif
- #endif
- #ifdef USE_CLEARCOAT_NORMALMAP
- #ifdef USE_TANGENT
- mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
- #else
- mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );
- #endif
- #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
- tbn2[0] *= faceDirection;
- tbn2[1] *= faceDirection;
- #endif
- #endif
- vec3 nonPerturbedNormal = normal;`,fNe=`#ifdef USE_NORMALMAP_OBJECTSPACE
- normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
- #ifdef FLIP_SIDED
- normal = - normal;
- #endif
- #ifdef DOUBLE_SIDED
- normal = normal * faceDirection;
- #endif
- normal = normalize( normalMatrix * normal );
- #elif defined( USE_NORMALMAP_TANGENTSPACE )
- vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
- mapN.xy *= normalScale;
- normal = normalize( tbn * mapN );
- #elif defined( USE_BUMPMAP )
- normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
- #endif`,gNe=`#ifndef FLAT_SHADED
- varying vec3 vNormal;
- #ifdef USE_TANGENT
- varying vec3 vTangent;
- varying vec3 vBitangent;
- #endif
- #endif`,bNe=`#ifndef FLAT_SHADED
- varying vec3 vNormal;
- #ifdef USE_TANGENT
- varying vec3 vTangent;
- varying vec3 vBitangent;
- #endif
- #endif`,xNe=`#ifndef FLAT_SHADED
- vNormal = normalize( transformedNormal );
- #ifdef USE_TANGENT
- vTangent = normalize( transformedTangent );
- vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
- #endif
- #endif`,yNe=`#ifdef USE_NORMALMAP
- uniform sampler2D normalMap;
- uniform vec2 normalScale;
- #endif
- #ifdef USE_NORMALMAP_OBJECTSPACE
- uniform mat3 normalMatrix;
- #endif
- #if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )
- mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {
- vec3 q0 = dFdx( eye_pos.xyz );
- vec3 q1 = dFdy( eye_pos.xyz );
- vec2 st0 = dFdx( uv.st );
- vec2 st1 = dFdy( uv.st );
- vec3 N = surf_norm;
- vec3 q1perp = cross( q1, N );
- vec3 q0perp = cross( N, q0 );
- vec3 T = q1perp * st0.x + q0perp * st1.x;
- vec3 B = q1perp * st0.y + q0perp * st1.y;
- float det = max( dot( T, T ), dot( B, B ) );
- float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );
- return mat3( T * scale, B * scale, N );
- }
- #endif`,vNe=`#ifdef USE_CLEARCOAT
- vec3 clearcoatNormal = nonPerturbedNormal;
- #endif`,wNe=`#ifdef USE_CLEARCOAT_NORMALMAP
- vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
- clearcoatMapN.xy *= clearcoatNormalScale;
- clearcoatNormal = normalize( tbn2 * clearcoatMapN );
- #endif`,SNe=`#ifdef USE_CLEARCOATMAP
- uniform sampler2D clearcoatMap;
- #endif
- #ifdef USE_CLEARCOAT_NORMALMAP
- uniform sampler2D clearcoatNormalMap;
- uniform vec2 clearcoatNormalScale;
- #endif
- #ifdef USE_CLEARCOAT_ROUGHNESSMAP
- uniform sampler2D clearcoatRoughnessMap;
- #endif`,_Ne=`#ifdef USE_IRIDESCENCEMAP
- uniform sampler2D iridescenceMap;
- #endif
- #ifdef USE_IRIDESCENCE_THICKNESSMAP
- uniform sampler2D iridescenceThicknessMap;
- #endif`,kNe=`#ifdef OPAQUE
- diffuseColor.a = 1.0;
- #endif
- #ifdef USE_TRANSMISSION
- diffuseColor.a *= material.transmissionAlpha;
- #endif
- gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,NNe=`vec3 packNormalToRGB( const in vec3 normal ) {
- return normalize( normal ) * 0.5 + 0.5;
- }
- vec3 unpackRGBToNormal( const in vec3 rgb ) {
- return 2.0 * rgb.xyz - 1.0;
- }
- const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;
- const vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );
- const vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );
- const float ShiftRight8 = 1. / 256.;
- vec4 packDepthToRGBA( const in float v ) {
- vec4 r = vec4( fract( v * PackFactors ), v );
- r.yzw -= r.xyz * ShiftRight8; return r * PackUpscale;
- }
- float unpackRGBAToDepth( const in vec4 v ) {
- return dot( v, UnpackFactors );
- }
- vec2 packDepthToRG( in highp float v ) {
- return packDepthToRGBA( v ).yx;
- }
- float unpackRGToDepth( const in highp vec2 v ) {
- return unpackRGBAToDepth( vec4( v.xy, 0.0, 0.0 ) );
- }
- vec4 pack2HalfToRGBA( vec2 v ) {
- vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );
- return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );
- }
- vec2 unpackRGBATo2Half( vec4 v ) {
- return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );
- }
- float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {
- return ( viewZ + near ) / ( near - far );
- }
- float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {
- return depth * ( near - far ) - near;
- }
- float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {
- return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );
- }
- float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {
- return ( near * far ) / ( ( far - near ) * depth - far );
- }`,CNe=`#ifdef PREMULTIPLIED_ALPHA
- gl_FragColor.rgb *= gl_FragColor.a;
- #endif`,TNe=`vec4 mvPosition = vec4( transformed, 1.0 );
- #ifdef USE_BATCHING
- mvPosition = batchingMatrix * mvPosition;
- #endif
- #ifdef USE_INSTANCING
- mvPosition = instanceMatrix * mvPosition;
- #endif
- mvPosition = modelViewMatrix * mvPosition;
- gl_Position = projectionMatrix * mvPosition;`,PNe=`#ifdef DITHERING
- gl_FragColor.rgb = dithering( gl_FragColor.rgb );
- #endif`,ANe=`#ifdef DITHERING
- vec3 dithering( vec3 color ) {
- float grid_position = rand( gl_FragCoord.xy );
- vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
- dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
- return color + dither_shift_RGB;
- }
- #endif`,MNe=`float roughnessFactor = roughness;
- #ifdef USE_ROUGHNESSMAP
- vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
- roughnessFactor *= texelRoughness.g;
- #endif`,ENe=`#ifdef USE_ROUGHNESSMAP
- uniform sampler2D roughnessMap;
- #endif`,jNe=`#if NUM_SPOT_LIGHT_COORDS > 0
- varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
- #endif
- #if NUM_SPOT_LIGHT_MAPS > 0
- uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];
- #endif
- #ifdef USE_SHADOWMAP
- #if NUM_DIR_LIGHT_SHADOWS > 0
- uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
- varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
- struct DirectionalLightShadow {
- float shadowBias;
- float shadowNormalBias;
- float shadowRadius;
- vec2 shadowMapSize;
- };
- uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
- #endif
- #if NUM_SPOT_LIGHT_SHADOWS > 0
- uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
- struct SpotLightShadow {
- float shadowBias;
- float shadowNormalBias;
- float shadowRadius;
- vec2 shadowMapSize;
- };
- uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
- #endif
- #if NUM_POINT_LIGHT_SHADOWS > 0
- uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
- varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
- struct PointLightShadow {
- float shadowBias;
- float shadowNormalBias;
- float shadowRadius;
- vec2 shadowMapSize;
- float shadowCameraNear;
- float shadowCameraFar;
- };
- uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
- #endif
- float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {
- return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );
- }
- vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {
- return unpackRGBATo2Half( texture2D( shadow, uv ) );
- }
- float VSMShadow (sampler2D shadow, vec2 uv, float compare ){
- float occlusion = 1.0;
- vec2 distribution = texture2DDistribution( shadow, uv );
- float hard_shadow = step( compare , distribution.x );
- if (hard_shadow != 1.0 ) {
- float distance = compare - distribution.x ;
- float variance = max( 0.00000, distribution.y * distribution.y );
- 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 );
- }
- return occlusion;
- }
- float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
- float shadow = 1.0;
- shadowCoord.xyz /= shadowCoord.w;
- shadowCoord.z += shadowBias;
- bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
- bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
- if ( frustumTest ) {
- #if defined( SHADOWMAP_TYPE_PCF )
- vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
- float dx0 = - texelSize.x * shadowRadius;
- float dy0 = - texelSize.y * shadowRadius;
- float dx1 = + texelSize.x * shadowRadius;
- float dy1 = + texelSize.y * shadowRadius;
- float dx2 = dx0 / 2.0;
- float dy2 = dy0 / 2.0;
- float dx3 = dx1 / 2.0;
- float dy3 = dy1 / 2.0;
- shadow = (
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +
- texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )
- ) * ( 1.0 / 17.0 );
- #elif defined( SHADOWMAP_TYPE_PCF_SOFT )
- vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
- float dx = texelSize.x;
- float dy = texelSize.y;
- vec2 uv = shadowCoord.xy;
- vec2 f = fract( uv * shadowMapSize + 0.5 );
- uv -= f * texelSize;
- shadow = (
- texture2DCompare( shadowMap, uv, shadowCoord.z ) +
- texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +
- texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +
- texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +
- mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),
- texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),
- f.x ) +
- mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),
- texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),
- f.x ) +
- mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),
- texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),
- f.y ) +
- mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),
- texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),
- f.y ) +
- mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),
- texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),
- f.x ),
- mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),
- texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),
- f.x ),
- f.y )
- ) * ( 1.0 / 9.0 );
- #elif defined( SHADOWMAP_TYPE_VSM )
- shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );
- #else
- shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );
- #endif
- }
- return shadow;
- }
- vec2 cubeToUV( vec3 v, float texelSizeY ) {
- vec3 absV = abs( v );
- float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );
- absV *= scaleToCube;
- v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );
- vec2 planar = v.xy;
- float almostATexel = 1.5 * texelSizeY;
- float almostOne = 1.0 - almostATexel;
- if ( absV.z >= almostOne ) {
- if ( v.z > 0.0 )
- planar.x = 4.0 - v.x;
- } else if ( absV.x >= almostOne ) {
- float signX = sign( v.x );
- planar.x = v.z * signX + 2.0 * signX;
- } else if ( absV.y >= almostOne ) {
- float signY = sign( v.y );
- planar.x = v.x + 2.0 * signY + 2.0;
- planar.y = v.z * signY - 2.0;
- }
- return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );
- }
- float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
- vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );
- vec3 lightToPosition = shadowCoord.xyz;
- float dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias;
- vec3 bd3D = normalize( lightToPosition );
- #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )
- vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;
- return (
- texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +
- texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +
- texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +
- texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +
- texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +
- texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +
- texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +
- texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +
- texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )
- ) * ( 1.0 / 9.0 );
- #else
- return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );
- #endif
- }
- #endif`,DNe=`#if NUM_SPOT_LIGHT_COORDS > 0
- uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];
- varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
- #endif
- #ifdef USE_SHADOWMAP
- #if NUM_DIR_LIGHT_SHADOWS > 0
- uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];
- varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
- struct DirectionalLightShadow {
- float shadowBias;
- float shadowNormalBias;
- float shadowRadius;
- vec2 shadowMapSize;
- };
- uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
- #endif
- #if NUM_SPOT_LIGHT_SHADOWS > 0
- struct SpotLightShadow {
- float shadowBias;
- float shadowNormalBias;
- float shadowRadius;
- vec2 shadowMapSize;
- };
- uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
- #endif
- #if NUM_POINT_LIGHT_SHADOWS > 0
- uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];
- varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
- struct PointLightShadow {
- float shadowBias;
- float shadowNormalBias;
- float shadowRadius;
- vec2 shadowMapSize;
- float shadowCameraNear;
- float shadowCameraFar;
- };
- uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
- #endif
- #endif`,RNe=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
- vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
- vec4 shadowWorldPosition;
- #endif
- #if defined( USE_SHADOWMAP )
- #if NUM_DIR_LIGHT_SHADOWS > 0
- #pragma unroll_loop_start
- for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
- shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );
- vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;
- }
- #pragma unroll_loop_end
- #endif
- #if NUM_POINT_LIGHT_SHADOWS > 0
- #pragma unroll_loop_start
- for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
- shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );
- vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;
- }
- #pragma unroll_loop_end
- #endif
- #endif
- #if NUM_SPOT_LIGHT_COORDS > 0
- #pragma unroll_loop_start
- for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {
- shadowWorldPosition = worldPosition;
- #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
- shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;
- #endif
- vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;
- }
- #pragma unroll_loop_end
- #endif`,FNe=`float getShadowMask() {
- float shadow = 1.0;
- #ifdef USE_SHADOWMAP
- #if NUM_DIR_LIGHT_SHADOWS > 0
- DirectionalLightShadow directionalLight;
- #pragma unroll_loop_start
- for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
- directionalLight = directionalLightShadows[ i ];
- shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
- }
- #pragma unroll_loop_end
- #endif
- #if NUM_SPOT_LIGHT_SHADOWS > 0
- SpotLightShadow spotLight;
- #pragma unroll_loop_start
- for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {
- spotLight = spotLightShadows[ i ];
- shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
- }
- #pragma unroll_loop_end
- #endif
- #if NUM_POINT_LIGHT_SHADOWS > 0
- PointLightShadow pointLight;
- #pragma unroll_loop_start
- for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
- pointLight = pointLightShadows[ i ];
- shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;
- }
- #pragma unroll_loop_end
- #endif
- #endif
- return shadow;
- }`,LNe=`#ifdef USE_SKINNING
- mat4 boneMatX = getBoneMatrix( skinIndex.x );
- mat4 boneMatY = getBoneMatrix( skinIndex.y );
- mat4 boneMatZ = getBoneMatrix( skinIndex.z );
- mat4 boneMatW = getBoneMatrix( skinIndex.w );
- #endif`,ONe=`#ifdef USE_SKINNING
- uniform mat4 bindMatrix;
- uniform mat4 bindMatrixInverse;
- uniform highp sampler2D boneTexture;
- mat4 getBoneMatrix( const in float i ) {
- int size = textureSize( boneTexture, 0 ).x;
- int j = int( i ) * 4;
- int x = j % size;
- int y = j / size;
- vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );
- vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );
- vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );
- vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );
- return mat4( v1, v2, v3, v4 );
- }
- #endif`,INe=`#ifdef USE_SKINNING
- vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
- vec4 skinned = vec4( 0.0 );
- skinned += boneMatX * skinVertex * skinWeight.x;
- skinned += boneMatY * skinVertex * skinWeight.y;
- skinned += boneMatZ * skinVertex * skinWeight.z;
- skinned += boneMatW * skinVertex * skinWeight.w;
- transformed = ( bindMatrixInverse * skinned ).xyz;
- #endif`,zNe=`#ifdef USE_SKINNING
- mat4 skinMatrix = mat4( 0.0 );
- skinMatrix += skinWeight.x * boneMatX;
- skinMatrix += skinWeight.y * boneMatY;
- skinMatrix += skinWeight.z * boneMatZ;
- skinMatrix += skinWeight.w * boneMatW;
- skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;
- objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;
- #ifdef USE_TANGENT
- objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
- #endif
- #endif`,UNe=`float specularStrength;
- #ifdef USE_SPECULARMAP
- vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
- specularStrength = texelSpecular.r;
- #else
- specularStrength = 1.0;
- #endif`,BNe=`#ifdef USE_SPECULARMAP
- uniform sampler2D specularMap;
- #endif`,HNe=`#if defined( TONE_MAPPING )
- gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
- #endif`,$Ne=`#ifndef saturate
- #define saturate( a ) clamp( a, 0.0, 1.0 )
- #endif
- uniform float toneMappingExposure;
- vec3 LinearToneMapping( vec3 color ) {
- return saturate( toneMappingExposure * color );
- }
- vec3 ReinhardToneMapping( vec3 color ) {
- color *= toneMappingExposure;
- return saturate( color / ( vec3( 1.0 ) + color ) );
- }
- vec3 OptimizedCineonToneMapping( vec3 color ) {
- color *= toneMappingExposure;
- color = max( vec3( 0.0 ), color - 0.004 );
- return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );
- }
- vec3 RRTAndODTFit( vec3 v ) {
- vec3 a = v * ( v + 0.0245786 ) - 0.000090537;
- vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;
- return a / b;
- }
- vec3 ACESFilmicToneMapping( vec3 color ) {
- const mat3 ACESInputMat = mat3(
- vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ),
- vec3( 0.04823, 0.01566, 0.83777 )
- );
- const mat3 ACESOutputMat = mat3(
- vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ),
- vec3( -0.07367, -0.00605, 1.07602 )
- );
- color *= toneMappingExposure / 0.6;
- color = ACESInputMat * color;
- color = RRTAndODTFit( color );
- color = ACESOutputMat * color;
- return saturate( color );
- }
- vec3 CustomToneMapping( vec3 color ) { return color; }`,qNe=`#ifdef USE_TRANSMISSION
- material.transmission = transmission;
- material.transmissionAlpha = 1.0;
- material.thickness = thickness;
- material.attenuationDistance = attenuationDistance;
- material.attenuationColor = attenuationColor;
- #ifdef USE_TRANSMISSIONMAP
- material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;
- #endif
- #ifdef USE_THICKNESSMAP
- material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;
- #endif
- vec3 pos = vWorldPosition;
- vec3 v = normalize( cameraPosition - pos );
- vec3 n = inverseTransformDirection( normal, viewMatrix );
- vec4 transmitted = getIBLVolumeRefraction(
- n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,
- pos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickness,
- material.attenuationColor, material.attenuationDistance );
- material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );
- totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );
- #endif`,VNe=`#ifdef USE_TRANSMISSION
- uniform float transmission;
- uniform float thickness;
- uniform float attenuationDistance;
- uniform vec3 attenuationColor;
- #ifdef USE_TRANSMISSIONMAP
- uniform sampler2D transmissionMap;
- #endif
- #ifdef USE_THICKNESSMAP
- uniform sampler2D thicknessMap;
- #endif
- uniform vec2 transmissionSamplerSize;
- uniform sampler2D transmissionSamplerMap;
- uniform mat4 modelMatrix;
- uniform mat4 projectionMatrix;
- varying vec3 vWorldPosition;
- float w0( float a ) {
- return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );
- }
- float w1( float a ) {
- return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );
- }
- float w2( float a ){
- return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );
- }
- float w3( float a ) {
- return ( 1.0 / 6.0 ) * ( a * a * a );
- }
- float g0( float a ) {
- return w0( a ) + w1( a );
- }
- float g1( float a ) {
- return w2( a ) + w3( a );
- }
- float h0( float a ) {
- return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );
- }
- float h1( float a ) {
- return 1.0 + w3( a ) / ( w2( a ) + w3( a ) );
- }
- vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {
- uv = uv * texelSize.zw + 0.5;
- vec2 iuv = floor( uv );
- vec2 fuv = fract( uv );
- float g0x = g0( fuv.x );
- float g1x = g1( fuv.x );
- float h0x = h0( fuv.x );
- float h1x = h1( fuv.x );
- float h0y = h0( fuv.y );
- float h1y = h1( fuv.y );
- vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
- vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
- vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
- vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
- return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +
- g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );
- }
- vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {
- vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );
- vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );
- vec2 fLodSizeInv = 1.0 / fLodSize;
- vec2 cLodSizeInv = 1.0 / cLodSize;
- vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );
- vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );
- return mix( fSample, cSample, fract( lod ) );
- }
- vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {
- vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );
- vec3 modelScale;
- modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );
- modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );
- modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );
- return normalize( refractionVector ) * thickness * modelScale;
- }
- float applyIorToRoughness( const in float roughness, const in float ior ) {
- return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );
- }
- vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {
- float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );
- return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );
- }
- vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {
- if ( isinf( attenuationDistance ) ) {
- return vec3( 1.0 );
- } else {
- vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;
- vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance;
- }
- }
- vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,
- const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,
- const in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness,
- const in vec3 attenuationColor, const in float attenuationDistance ) {
- vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );
- vec3 refractedRayExit = position + transmissionRay;
- vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
- vec2 refractionCoords = ndcPos.xy / ndcPos.w;
- refractionCoords += 1.0;
- refractionCoords /= 2.0;
- vec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );
- vec3 transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );
- vec3 attenuatedColor = transmittance * transmittedLight.rgb;
- vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );
- float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;
- return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );
- }
- #endif`,GNe=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
- varying vec2 vUv;
- #endif
- #ifdef USE_MAP
- varying vec2 vMapUv;
- #endif
- #ifdef USE_ALPHAMAP
- varying vec2 vAlphaMapUv;
- #endif
- #ifdef USE_LIGHTMAP
- varying vec2 vLightMapUv;
- #endif
- #ifdef USE_AOMAP
- varying vec2 vAoMapUv;
- #endif
- #ifdef USE_BUMPMAP
- varying vec2 vBumpMapUv;
- #endif
- #ifdef USE_NORMALMAP
- varying vec2 vNormalMapUv;
- #endif
- #ifdef USE_EMISSIVEMAP
- varying vec2 vEmissiveMapUv;
- #endif
- #ifdef USE_METALNESSMAP
- varying vec2 vMetalnessMapUv;
- #endif
- #ifdef USE_ROUGHNESSMAP
- varying vec2 vRoughnessMapUv;
- #endif
- #ifdef USE_ANISOTROPYMAP
- varying vec2 vAnisotropyMapUv;
- #endif
- #ifdef USE_CLEARCOATMAP
- varying vec2 vClearcoatMapUv;
- #endif
- #ifdef USE_CLEARCOAT_NORMALMAP
- varying vec2 vClearcoatNormalMapUv;
- #endif
- #ifdef USE_CLEARCOAT_ROUGHNESSMAP
- varying vec2 vClearcoatRoughnessMapUv;
- #endif
- #ifdef USE_IRIDESCENCEMAP
- varying vec2 vIridescenceMapUv;
- #endif
- #ifdef USE_IRIDESCENCE_THICKNESSMAP
- varying vec2 vIridescenceThicknessMapUv;
- #endif
- #ifdef USE_SHEEN_COLORMAP
- varying vec2 vSheenColorMapUv;
- #endif
- #ifdef USE_SHEEN_ROUGHNESSMAP
- varying vec2 vSheenRoughnessMapUv;
- #endif
- #ifdef USE_SPECULARMAP
- varying vec2 vSpecularMapUv;
- #endif
- #ifdef USE_SPECULAR_COLORMAP
- varying vec2 vSpecularColorMapUv;
- #endif
- #ifdef USE_SPECULAR_INTENSITYMAP
- varying vec2 vSpecularIntensityMapUv;
- #endif
- #ifdef USE_TRANSMISSIONMAP
- uniform mat3 transmissionMapTransform;
- varying vec2 vTransmissionMapUv;
- #endif
- #ifdef USE_THICKNESSMAP
- uniform mat3 thicknessMapTransform;
- varying vec2 vThicknessMapUv;
- #endif`,WNe=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
- varying vec2 vUv;
- #endif
- #ifdef USE_MAP
- uniform mat3 mapTransform;
- varying vec2 vMapUv;
- #endif
- #ifdef USE_ALPHAMAP
- uniform mat3 alphaMapTransform;
- varying vec2 vAlphaMapUv;
- #endif
- #ifdef USE_LIGHTMAP
- uniform mat3 lightMapTransform;
- varying vec2 vLightMapUv;
- #endif
- #ifdef USE_AOMAP
- uniform mat3 aoMapTransform;
- varying vec2 vAoMapUv;
- #endif
- #ifdef USE_BUMPMAP
- uniform mat3 bumpMapTransform;
- varying vec2 vBumpMapUv;
- #endif
- #ifdef USE_NORMALMAP
- uniform mat3 normalMapTransform;
- varying vec2 vNormalMapUv;
- #endif
- #ifdef USE_DISPLACEMENTMAP
- uniform mat3 displacementMapTransform;
- varying vec2 vDisplacementMapUv;
- #endif
- #ifdef USE_EMISSIVEMAP
- uniform mat3 emissiveMapTransform;
- varying vec2 vEmissiveMapUv;
- #endif
- #ifdef USE_METALNESSMAP
- uniform mat3 metalnessMapTransform;
- varying vec2 vMetalnessMapUv;
- #endif
- #ifdef USE_ROUGHNESSMAP
- uniform mat3 roughnessMapTransform;
- varying vec2 vRoughnessMapUv;
- #endif
- #ifdef USE_ANISOTROPYMAP
- uniform mat3 anisotropyMapTransform;
- varying vec2 vAnisotropyMapUv;
- #endif
- #ifdef USE_CLEARCOATMAP
- uniform mat3 clearcoatMapTransform;
- varying vec2 vClearcoatMapUv;
- #endif
- #ifdef USE_CLEARCOAT_NORMALMAP
- uniform mat3 clearcoatNormalMapTransform;
- varying vec2 vClearcoatNormalMapUv;
- #endif
- #ifdef USE_CLEARCOAT_ROUGHNESSMAP
- uniform mat3 clearcoatRoughnessMapTransform;
- varying vec2 vClearcoatRoughnessMapUv;
- #endif
- #ifdef USE_SHEEN_COLORMAP
- uniform mat3 sheenColorMapTransform;
- varying vec2 vSheenColorMapUv;
- #endif
- #ifdef USE_SHEEN_ROUGHNESSMAP
- uniform mat3 sheenRoughnessMapTransform;
- varying vec2 vSheenRoughnessMapUv;
- #endif
- #ifdef USE_IRIDESCENCEMAP
- uniform mat3 iridescenceMapTransform;
- varying vec2 vIridescenceMapUv;
- #endif
- #ifdef USE_IRIDESCENCE_THICKNESSMAP
- uniform mat3 iridescenceThicknessMapTransform;
- varying vec2 vIridescenceThicknessMapUv;
- #endif
- #ifdef USE_SPECULARMAP
- uniform mat3 specularMapTransform;
- varying vec2 vSpecularMapUv;
- #endif
- #ifdef USE_SPECULAR_COLORMAP
- uniform mat3 specularColorMapTransform;
- varying vec2 vSpecularColorMapUv;
- #endif
- #ifdef USE_SPECULAR_INTENSITYMAP
- uniform mat3 specularIntensityMapTransform;
- varying vec2 vSpecularIntensityMapUv;
- #endif
- #ifdef USE_TRANSMISSIONMAP
- uniform mat3 transmissionMapTransform;
- varying vec2 vTransmissionMapUv;
- #endif
- #ifdef USE_THICKNESSMAP
- uniform mat3 thicknessMapTransform;
- varying vec2 vThicknessMapUv;
- #endif`,KNe=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
- vUv = vec3( uv, 1 ).xy;
- #endif
- #ifdef USE_MAP
- vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;
- #endif
- #ifdef USE_ALPHAMAP
- vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;
- #endif
- #ifdef USE_LIGHTMAP
- vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;
- #endif
- #ifdef USE_AOMAP
- vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;
- #endif
- #ifdef USE_BUMPMAP
- vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;
- #endif
- #ifdef USE_NORMALMAP
- vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;
- #endif
- #ifdef USE_DISPLACEMENTMAP
- vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;
- #endif
- #ifdef USE_EMISSIVEMAP
- vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;
- #endif
- #ifdef USE_METALNESSMAP
- vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;
- #endif
- #ifdef USE_ROUGHNESSMAP
- vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;
- #endif
- #ifdef USE_ANISOTROPYMAP
- vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;
- #endif
- #ifdef USE_CLEARCOATMAP
- vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;
- #endif
- #ifdef USE_CLEARCOAT_NORMALMAP
- vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;
- #endif
- #ifdef USE_CLEARCOAT_ROUGHNESSMAP
- vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;
- #endif
- #ifdef USE_IRIDESCENCEMAP
- vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;
- #endif
- #ifdef USE_IRIDESCENCE_THICKNESSMAP
- vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;
- #endif
- #ifdef USE_SHEEN_COLORMAP
- vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;
- #endif
- #ifdef USE_SHEEN_ROUGHNESSMAP
- vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;
- #endif
- #ifdef USE_SPECULARMAP
- vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;
- #endif
- #ifdef USE_SPECULAR_COLORMAP
- vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;
- #endif
- #ifdef USE_SPECULAR_INTENSITYMAP
- vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;
- #endif
- #ifdef USE_TRANSMISSIONMAP
- vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;
- #endif
- #ifdef USE_THICKNESSMAP
- vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;
- #endif`,YNe=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
- vec4 worldPosition = vec4( transformed, 1.0 );
- #ifdef USE_BATCHING
- worldPosition = batchingMatrix * worldPosition;
- #endif
- #ifdef USE_INSTANCING
- worldPosition = instanceMatrix * worldPosition;
- #endif
- worldPosition = modelMatrix * worldPosition;
- #endif`;const XNe=`varying vec2 vUv;
- uniform mat3 uvTransform;
- void main() {
- vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
- gl_Position = vec4( position.xy, 1.0, 1.0 );
- }`,QNe=`uniform sampler2D t2D;
- uniform float backgroundIntensity;
- varying vec2 vUv;
- void main() {
- vec4 texColor = texture2D( t2D, vUv );
- #ifdef DECODE_VIDEO_TEXTURE
- 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 );
- #endif
- texColor.rgb *= backgroundIntensity;
- gl_FragColor = texColor;
- #include <tonemapping_fragment>
- #include <colorspace_fragment>
- }`,ZNe=`varying vec3 vWorldDirection;
- #include <common>
- void main() {
- vWorldDirection = transformDirection( position, modelMatrix );
- #include <begin_vertex>
- #include <project_vertex>
- gl_Position.z = gl_Position.w;
- }`,JNe=`#ifdef ENVMAP_TYPE_CUBE
- uniform samplerCube envMap;
- #elif defined( ENVMAP_TYPE_CUBE_UV )
- uniform sampler2D envMap;
- #endif
- uniform float flipEnvMap;
- uniform float backgroundBlurriness;
- uniform float backgroundIntensity;
- varying vec3 vWorldDirection;
- #include <cube_uv_reflection_fragment>
- void main() {
- #ifdef ENVMAP_TYPE_CUBE
- vec4 texColor = textureCube( envMap, vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );
- #elif defined( ENVMAP_TYPE_CUBE_UV )
- vec4 texColor = textureCubeUV( envMap, vWorldDirection, backgroundBlurriness );
- #else
- vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );
- #endif
- texColor.rgb *= backgroundIntensity;
- gl_FragColor = texColor;
- #include <tonemapping_fragment>
- #include <colorspace_fragment>
- }`,eCe=`varying vec3 vWorldDirection;
- #include <common>
- void main() {
- vWorldDirection = transformDirection( position, modelMatrix );
- #include <begin_vertex>
- #include <project_vertex>
- gl_Position.z = gl_Position.w;
- }`,tCe=`uniform samplerCube tCube;
- uniform float tFlip;
- uniform float opacity;
- varying vec3 vWorldDirection;
- void main() {
- vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );
- gl_FragColor = texColor;
- gl_FragColor.a *= opacity;
- #include <tonemapping_fragment>
- #include <colorspace_fragment>
- }`,nCe=`#include <common>
- #include <batching_pars_vertex>
- #include <uv_pars_vertex>
- #include <displacementmap_pars_vertex>
- #include <morphtarget_pars_vertex>
- #include <skinning_pars_vertex>
- #include <logdepthbuf_pars_vertex>
- #include <clipping_planes_pars_vertex>
- varying vec2 vHighPrecisionZW;
- void main() {
- #include <uv_vertex>
- #include <batching_vertex>
- #include <skinbase_vertex>
- #ifdef USE_DISPLACEMENTMAP
- #include <beginnormal_vertex>
- #include <morphnormal_vertex>
- #include <skinnormal_vertex>
- #endif
- #include <begin_vertex>
- #include <morphtarget_vertex>
- #include <skinning_vertex>
- #include <displacementmap_vertex>
- #include <project_vertex>
- #include <logdepthbuf_vertex>
- #include <clipping_planes_vertex>
- vHighPrecisionZW = gl_Position.zw;
- }`,rCe=`#if DEPTH_PACKING == 3200
- uniform float opacity;
- #endif
- #include <common>
- #include <packing>
- #include <uv_pars_fragment>
- #include <map_pars_fragment>
- #include <alphamap_pars_fragment>
- #include <alphatest_pars_fragment>
- #include <alphahash_pars_fragment>
- #include <logdepthbuf_pars_fragment>
- #include <clipping_planes_pars_fragment>
- varying vec2 vHighPrecisionZW;
- void main() {
- #include <clipping_planes_fragment>
- vec4 diffuseColor = vec4( 1.0 );
- #if DEPTH_PACKING == 3200
- diffuseColor.a = opacity;
- #endif
- #include <map_fragment>
- #include <alphamap_fragment>
- #include <alphatest_fragment>
- #include <alphahash_fragment>
- #include <logdepthbuf_fragment>
- float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;
- #if DEPTH_PACKING == 3200
- gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );
- #elif DEPTH_PACKING == 3201
- gl_FragColor = packDepthToRGBA( fragCoordZ );
- #endif
- }`,iCe=`#define DISTANCE
- varying vec3 vWorldPosition;
- #include <common>
- #include <batching_pars_vertex>
- #include <uv_pars_vertex>
- #include <displacementmap_pars_vertex>
- #include <morphtarget_pars_vertex>
- #include <skinning_pars_vertex>
- #include <clipping_planes_pars_vertex>
- void main() {
- #include <uv_vertex>
- #include <batching_vertex>
- #include <skinbase_vertex>
- #ifdef USE_DISPLACEMENTMAP
- #include <beginnormal_vertex>
- #include <morphnormal_vertex>
- #include <skinnormal_vertex>
- #endif
- #include <begin_vertex>
- #include <morphtarget_vertex>
- #include <skinning_vertex>
- #include <displacementmap_vertex>
- #include <project_vertex>
- #include <worldpos_vertex>
- #include <clipping_planes_vertex>
- vWorldPosition = worldPosition.xyz;
- }`,aCe=`#define DISTANCE
- uniform vec3 referencePosition;
- uniform float nearDistance;
- uniform float farDistance;
- varying vec3 vWorldPosition;
- #include <common>
- #include <packing>
- #include <uv_pars_fragment>
- #include <map_pars_fragment>
- #include <alphamap_pars_fragment>
- #include <alphatest_pars_fragment>
- #include <alphahash_pars_fragment>
- #include <clipping_planes_pars_fragment>
- void main () {
- #include <clipping_planes_fragment>
- vec4 diffuseColor = vec4( 1.0 );
- #include <map_fragment>
- #include <alphamap_fragment>
- #include <alphatest_fragment>
- #include <alphahash_fragment>
- float dist = length( vWorldPosition - referencePosition );
- dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
- dist = saturate( dist );
- gl_FragColor = packDepthToRGBA( dist );
- }`,sCe=`varying vec3 vWorldDirection;
- #include <common>
- void main() {
- vWorldDirection = transformDirection( position, modelMatrix );
- #include <begin_vertex>
- #include <project_vertex>
- }`,oCe=`uniform sampler2D tEquirect;
- varying vec3 vWorldDirection;
- #include <common>
- void main() {
- vec3 direction = normalize( vWorldDirection );
- vec2 sampleUV = equirectUv( direction );
- gl_FragColor = texture2D( tEquirect, sampleUV );
- #include <tonemapping_fragment>
- #include <colorspace_fragment>
- }`,lCe=`uniform float scale;
- attribute float lineDistance;
- varying float vLineDistance;
- #include <common>
- #include <uv_pars_vertex>
- #include <color_pars_vertex>
- #include <fog_pars_vertex>
- #include <morphtarget_pars_vertex>
- #include <logdepthbuf_pars_vertex>
- #include <clipping_planes_pars_vertex>
- void main() {
- vLineDistance = scale * lineDistance;
- #include <uv_vertex>
- #include <color_vertex>
- #include <morphcolor_vertex>
- #include <begin_vertex>
- #include <morphtarget_vertex>
- #include <project_vertex>
- #include <logdepthbuf_vertex>
- #include <clipping_planes_vertex>
- #include <fog_vertex>
- }`,cCe=`uniform vec3 diffuse;
- uniform float opacity;
- uniform float dashSize;
- uniform float totalSize;
- varying float vLineDistance;
- #include <common>
- #include <color_pars_fragment>
- #include <uv_pars_fragment>
- #include <map_pars_fragment>
- #include <fog_pars_fragment>
- #include <logdepthbuf_pars_fragment>
- #include <clipping_planes_pars_fragment>
- void main() {
- #include <clipping_planes_fragment>
- if ( mod( vLineDistance, totalSize ) > dashSize ) {
- discard;
- }
- vec3 outgoingLight = vec3( 0.0 );
- vec4 diffuseColor = vec4( diffuse, opacity );
- #include <logdepthbuf_fragment>
- #include <map_fragment>
- #include <color_fragment>
- outgoingLight = diffuseColor.rgb;
- #include <opaque_fragment>
- #include <tonemapping_fragment>
- #include <colorspace_fragment>
- #include <fog_fragment>
- #include <premultiplied_alpha_fragment>
- }`,dCe=`#include <common>
- #include <batching_pars_vertex>
- #include <uv_pars_vertex>
- #include <envmap_pars_vertex>
- #include <color_pars_vertex>
- #include <fog_pars_vertex>
- #include <morphtarget_pars_vertex>
- #include <skinning_pars_vertex>
- #include <logdepthbuf_pars_vertex>
- #include <clipping_planes_pars_vertex>
- void main() {
- #include <uv_vertex>
- #include <color_vertex>
- #include <morphcolor_vertex>
- #include <batching_vertex>
- #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )
- #include <beginnormal_vertex>
- #include <morphnormal_vertex>
- #include <skinbase_vertex>
- #include <skinnormal_vertex>
- #include <defaultnormal_vertex>
- #endif
- #include <begin_vertex>
- #include <morphtarget_vertex>
- #include <skinning_vertex>
- #include <project_vertex>
- #include <logdepthbuf_vertex>
- #include <clipping_planes_vertex>
- #include <worldpos_vertex>
- #include <envmap_vertex>
- #include <fog_vertex>
- }`,uCe=`uniform vec3 diffuse;
- uniform float opacity;
- #ifndef FLAT_SHADED
- varying vec3 vNormal;
- #endif
- #include <common>
- #include <dithering_pars_fragment>
- #include <color_pars_fragment>
- #include <uv_pars_fragment>
- #include <map_pars_fragment>
- #include <alphamap_pars_fragment>
- #include <alphatest_pars_fragment>
- #include <alphahash_pars_fragment>
- #include <aomap_pars_fragment>
- #include <lightmap_pars_fragment>
- #include <envmap_common_pars_fragment>
- #include <envmap_pars_fragment>
- #include <fog_pars_fragment>
- #include <specularmap_pars_fragment>
- #include <logdepthbuf_pars_fragment>
- #include <clipping_planes_pars_fragment>
- void main() {
- #include <clipping_planes_fragment>
- vec4 diffuseColor = vec4( diffuse, opacity );
- #include <logdepthbuf_fragment>
- #include <map_fragment>
- #include <color_fragment>
- #include <alphamap_fragment>
- #include <alphatest_fragment>
- #include <alphahash_fragment>
- #include <specularmap_fragment>
- ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
- #ifdef USE_LIGHTMAP
- vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
- reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;
- #else
- reflectedLight.indirectDiffuse += vec3( 1.0 );
- #endif
- #include <aomap_fragment>
- reflectedLight.indirectDiffuse *= diffuseColor.rgb;
- vec3 outgoingLight = reflectedLight.indirectDiffuse;
- #include <envmap_fragment>
- #include <opaque_fragment>
- #include <tonemapping_fragment>
- #include <colorspace_fragment>
- #include <fog_fragment>
- #include <premultiplied_alpha_fragment>
- #include <dithering_fragment>
- }`,mCe=`#define LAMBERT
- varying vec3 vViewPosition;
- #include <common>
- #include <batching_pars_vertex>
- #include <uv_pars_vertex>
- #include <displacementmap_pars_vertex>
- #include <envmap_pars_vertex>
- #include <color_pars_vertex>
- #include <fog_pars_vertex>
- #include <normal_pars_vertex>
- #include <morphtarget_pars_vertex>
- #include <skinning_pars_vertex>
- #include <shadowmap_pars_vertex>
- #include <logdepthbuf_pars_vertex>
- #include <clipping_planes_pars_vertex>
- void main() {
- #include <uv_vertex>
- #include <color_vertex>
- #include <morphcolor_vertex>
- #include <batching_vertex>
- #include <beginnormal_vertex>
- #include <morphnormal_vertex>
- #include <skinbase_vertex>
- #include <skinnormal_vertex>
- #include <defaultnormal_vertex>
- #include <normal_vertex>
- #include <begin_vertex>
- #include <morphtarget_vertex>
- #include <skinning_vertex>
- #include <displacementmap_vertex>
- #include <project_vertex>
- #include <logdepthbuf_vertex>
- #include <clipping_planes_vertex>
- vViewPosition = - mvPosition.xyz;
- #include <worldpos_vertex>
- #include <envmap_vertex>
- #include <shadowmap_vertex>
- #include <fog_vertex>
- }`,hCe=`#define LAMBERT
- uniform vec3 diffuse;
- uniform vec3 emissive;
- uniform float opacity;
- #include <common>
- #include <packing>
- #include <dithering_pars_fragment>
- #include <color_pars_fragment>
- #include <uv_pars_fragment>
- #include <map_pars_fragment>
- #include <alphamap_pars_fragment>
- #include <alphatest_pars_fragment>
- #include <alphahash_pars_fragment>
- #include <aomap_pars_fragment>
- #include <lightmap_pars_fragment>
- #include <emissivemap_pars_fragment>
- #include <envmap_common_pars_fragment>
- #include <envmap_pars_fragment>
- #include <fog_pars_fragment>
- #include <bsdfs>
- #include <lights_pars_begin>
- #include <normal_pars_fragment>
- #include <lights_lambert_pars_fragment>
- #include <shadowmap_pars_fragment>
- #include <bumpmap_pars_fragment>
- #include <normalmap_pars_fragment>
- #include <specularmap_pars_fragment>
- #include <logdepthbuf_pars_fragment>
- #include <clipping_planes_pars_fragment>
- void main() {
- #include <clipping_planes_fragment>
- vec4 diffuseColor = vec4( diffuse, opacity );
- ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
- vec3 totalEmissiveRadiance = emissive;
- #include <logdepthbuf_fragment>
- #include <map_fragment>
- #include <color_fragment>
- #include <alphamap_fragment>
- #include <alphatest_fragment>
- #include <alphahash_fragment>
- #include <specularmap_fragment>
- #include <normal_fragment_begin>
- #include <normal_fragment_maps>
- #include <emissivemap_fragment>
- #include <lights_lambert_fragment>
- #include <lights_fragment_begin>
- #include <lights_fragment_maps>
- #include <lights_fragment_end>
- #include <aomap_fragment>
- vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
- #include <envmap_fragment>
- #include <opaque_fragment>
- #include <tonemapping_fragment>
- #include <colorspace_fragment>
- #include <fog_fragment>
- #include <premultiplied_alpha_fragment>
- #include <dithering_fragment>
- }`,pCe=`#define MATCAP
- varying vec3 vViewPosition;
- #include <common>
- #include <batching_pars_vertex>
- #include <uv_pars_vertex>
- #include <color_pars_vertex>
- #include <displacementmap_pars_vertex>
- #include <fog_pars_vertex>
- #include <normal_pars_vertex>
- #include <morphtarget_pars_vertex>
- #include <skinning_pars_vertex>
- #include <logdepthbuf_pars_vertex>
- #include <clipping_planes_pars_vertex>
- void main() {
- #include <uv_vertex>
- #include <color_vertex>
- #include <morphcolor_vertex>
- #include <batching_vertex>
- #include <beginnormal_vertex>
- #include <morphnormal_vertex>
- #include <skinbase_vertex>
- #include <skinnormal_vertex>
- #include <defaultnormal_vertex>
- #include <normal_vertex>
- #include <begin_vertex>
- #include <morphtarget_vertex>
- #include <skinning_vertex>
- #include <displacementmap_vertex>
- #include <project_vertex>
- #include <logdepthbuf_vertex>
- #include <clipping_planes_vertex>
- #include <fog_vertex>
- vViewPosition = - mvPosition.xyz;
- }`,fCe=`#define MATCAP
- uniform vec3 diffuse;
- uniform float opacity;
- uniform sampler2D matcap;
- varying vec3 vViewPosition;
- #include <common>
- #include <dithering_pars_fragment>
- #include <color_pars_fragment>
- #include <uv_pars_fragment>
- #include <map_pars_fragment>
- #include <alphamap_pars_fragment>
- #include <alphatest_pars_fragment>
- #include <alphahash_pars_fragment>
- #include <fog_pars_fragment>
- #include <normal_pars_fragment>
- #include <bumpmap_pars_fragment>
- #include <normalmap_pars_fragment>
- #include <logdepthbuf_pars_fragment>
- #include <clipping_planes_pars_fragment>
- void main() {
- #include <clipping_planes_fragment>
- vec4 diffuseColor = vec4( diffuse, opacity );
- #include <logdepthbuf_fragment>
- #include <map_fragment>
- #include <color_fragment>
- #include <alphamap_fragment>
- #include <alphatest_fragment>
- #include <alphahash_fragment>
- #include <normal_fragment_begin>
- #include <normal_fragment_maps>
- vec3 viewDir = normalize( vViewPosition );
- vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );
- vec3 y = cross( viewDir, x );
- vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;
- #ifdef USE_MATCAP
- vec4 matcapColor = texture2D( matcap, uv );
- #else
- vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );
- #endif
- vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;
- #include <opaque_fragment>
- #include <tonemapping_fragment>
- #include <colorspace_fragment>
- #include <fog_fragment>
- #include <premultiplied_alpha_fragment>
- #include <dithering_fragment>
- }`,gCe=`#define NORMAL
- #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
- varying vec3 vViewPosition;
- #endif
- #include <common>
- #include <batching_pars_vertex>
- #include <uv_pars_vertex>
- #include <displacementmap_pars_vertex>
- #include <normal_pars_vertex>
- #include <morphtarget_pars_vertex>
- #include <skinning_pars_vertex>
- #include <logdepthbuf_pars_vertex>
- #include <clipping_planes_pars_vertex>
- void main() {
- #include <uv_vertex>
- #include <batching_vertex>
- #include <beginnormal_vertex>
- #include <morphnormal_vertex>
- #include <skinbase_vertex>
- #include <skinnormal_vertex>
- #include <defaultnormal_vertex>
- #include <normal_vertex>
- #include <begin_vertex>
- #include <morphtarget_vertex>
- #include <skinning_vertex>
- #include <displacementmap_vertex>
- #include <project_vertex>
- #include <logdepthbuf_vertex>
- #include <clipping_planes_vertex>
- #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
- vViewPosition = - mvPosition.xyz;
- #endif
- }`,bCe=`#define NORMAL
- uniform float opacity;
- #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
- varying vec3 vViewPosition;
- #endif
- #include <packing>
- #include <uv_pars_fragment>
- #include <normal_pars_fragment>
- #include <bumpmap_pars_fragment>
- #include <normalmap_pars_fragment>
- #include <logdepthbuf_pars_fragment>
- #include <clipping_planes_pars_fragment>
- void main() {
- #include <clipping_planes_fragment>
- #include <logdepthbuf_fragment>
- #include <normal_fragment_begin>
- #include <normal_fragment_maps>
- gl_FragColor = vec4( packNormalToRGB( normal ), opacity );
- #ifdef OPAQUE
- gl_FragColor.a = 1.0;
- #endif
- }`,xCe=`#define PHONG
- varying vec3 vViewPosition;
- #include <common>
- #include <batching_pars_vertex>
- #include <uv_pars_vertex>
- #include <displacementmap_pars_vertex>
- #include <envmap_pars_vertex>
- #include <color_pars_vertex>
- #include <fog_pars_vertex>
- #include <normal_pars_vertex>
- #include <morphtarget_pars_vertex>
- #include <skinning_pars_vertex>
- #include <shadowmap_pars_vertex>
- #include <logdepthbuf_pars_vertex>
- #include <clipping_planes_pars_vertex>
- void main() {
- #include <uv_vertex>
- #include <color_vertex>
- #include <morphcolor_vertex>
- #include <batching_vertex>
- #include <beginnormal_vertex>
- #include <morphnormal_vertex>
- #include <skinbase_vertex>
- #include <skinnormal_vertex>
- #include <defaultnormal_vertex>
- #include <normal_vertex>
- #include <begin_vertex>
- #include <morphtarget_vertex>
- #include <skinning_vertex>
- #include <displacementmap_vertex>
- #include <project_vertex>
- #include <logdepthbuf_vertex>
- #include <clipping_planes_vertex>
- vViewPosition = - mvPosition.xyz;
- #include <worldpos_vertex>
- #include <envmap_vertex>
- #include <shadowmap_vertex>
- #include <fog_vertex>
- }`,yCe=`#define PHONG
- uniform vec3 diffuse;
- uniform vec3 emissive;
- uniform vec3 specular;
- uniform float shininess;
- uniform float opacity;
- #include <common>
- #include <packing>
- #include <dithering_pars_fragment>
- #include <color_pars_fragment>
- #include <uv_pars_fragment>
- #include <map_pars_fragment>
- #include <alphamap_pars_fragment>
- #include <alphatest_pars_fragment>
- #include <alphahash_pars_fragment>
- #include <aomap_pars_fragment>
- #include <lightmap_pars_fragment>
- #include <emissivemap_pars_fragment>
- #include <envmap_common_pars_fragment>
- #include <envmap_pars_fragment>
- #include <fog_pars_fragment>
- #include <bsdfs>
- #include <lights_pars_begin>
- #include <normal_pars_fragment>
- #include <lights_phong_pars_fragment>
- #include <shadowmap_pars_fragment>
- #include <bumpmap_pars_fragment>
- #include <normalmap_pars_fragment>
- #include <specularmap_pars_fragment>
- #include <logdepthbuf_pars_fragment>
- #include <clipping_planes_pars_fragment>
- void main() {
- #include <clipping_planes_fragment>
- vec4 diffuseColor = vec4( diffuse, opacity );
- ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
- vec3 totalEmissiveRadiance = emissive;
- #include <logdepthbuf_fragment>
- #include <map_fragment>
- #include <color_fragment>
- #include <alphamap_fragment>
- #include <alphatest_fragment>
- #include <alphahash_fragment>
- #include <specularmap_fragment>
- #include <normal_fragment_begin>
- #include <normal_fragment_maps>
- #include <emissivemap_fragment>
- #include <lights_phong_fragment>
- #include <lights_fragment_begin>
- #include <lights_fragment_maps>
- #include <lights_fragment_end>
- #include <aomap_fragment>
- vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
- #include <envmap_fragment>
- #include <opaque_fragment>
- #include <tonemapping_fragment>
- #include <colorspace_fragment>
- #include <fog_fragment>
- #include <premultiplied_alpha_fragment>
- #include <dithering_fragment>
- }`,vCe=`#define STANDARD
- varying vec3 vViewPosition;
- #ifdef USE_TRANSMISSION
- varying vec3 vWorldPosition;
- #endif
- #include <common>
- #include <batching_pars_vertex>
- #include <uv_pars_vertex>
- #include <displacementmap_pars_vertex>
- #include <color_pars_vertex>
- #include <fog_pars_vertex>
- #include <normal_pars_vertex>
- #include <morphtarget_pars_vertex>
- #include <skinning_pars_vertex>
- #include <shadowmap_pars_vertex>
- #include <logdepthbuf_pars_vertex>
- #include <clipping_planes_pars_vertex>
- void main() {
- #include <uv_vertex>
- #include <color_vertex>
- #include <morphcolor_vertex>
- #include <batching_vertex>
- #include <beginnormal_vertex>
- #include <morphnormal_vertex>
- #include <skinbase_vertex>
- #include <skinnormal_vertex>
- #include <defaultnormal_vertex>
- #include <normal_vertex>
- #include <begin_vertex>
- #include <morphtarget_vertex>
- #include <skinning_vertex>
- #include <displacementmap_vertex>
- #include <project_vertex>
- #include <logdepthbuf_vertex>
- #include <clipping_planes_vertex>
- vViewPosition = - mvPosition.xyz;
- #include <worldpos_vertex>
- #include <shadowmap_vertex>
- #include <fog_vertex>
- #ifdef USE_TRANSMISSION
- vWorldPosition = worldPosition.xyz;
- #endif
- }`,wCe=`#define STANDARD
- #ifdef PHYSICAL
- #define IOR
- #define USE_SPECULAR
- #endif
- uniform vec3 diffuse;
- uniform vec3 emissive;
- uniform float roughness;
- uniform float metalness;
- uniform float opacity;
- #ifdef IOR
- uniform float ior;
- #endif
- #ifdef USE_SPECULAR
- uniform float specularIntensity;
- uniform vec3 specularColor;
- #ifdef USE_SPECULAR_COLORMAP
- uniform sampler2D specularColorMap;
- #endif
- #ifdef USE_SPECULAR_INTENSITYMAP
- uniform sampler2D specularIntensityMap;
- #endif
- #endif
- #ifdef USE_CLEARCOAT
- uniform float clearcoat;
- uniform float clearcoatRoughness;
- #endif
- #ifdef USE_IRIDESCENCE
- uniform float iridescence;
- uniform float iridescenceIOR;
- uniform float iridescenceThicknessMinimum;
- uniform float iridescenceThicknessMaximum;
- #endif
- #ifdef USE_SHEEN
- uniform vec3 sheenColor;
- uniform float sheenRoughness;
- #ifdef USE_SHEEN_COLORMAP
- uniform sampler2D sheenColorMap;
- #endif
- #ifdef USE_SHEEN_ROUGHNESSMAP
- uniform sampler2D sheenRoughnessMap;
- #endif
- #endif
- #ifdef USE_ANISOTROPY
- uniform vec2 anisotropyVector;
- #ifdef USE_ANISOTROPYMAP
- uniform sampler2D anisotropyMap;
- #endif
- #endif
- varying vec3 vViewPosition;
- #include <common>
- #include <packing>
- #include <dithering_pars_fragment>
- #include <color_pars_fragment>
- #include <uv_pars_fragment>
- #include <map_pars_fragment>
- #include <alphamap_pars_fragment>
- #include <alphatest_pars_fragment>
- #include <alphahash_pars_fragment>
- #include <aomap_pars_fragment>
- #include <lightmap_pars_fragment>
- #include <emissivemap_pars_fragment>
- #include <iridescence_fragment>
- #include <cube_uv_reflection_fragment>
- #include <envmap_common_pars_fragment>
- #include <envmap_physical_pars_fragment>
- #include <fog_pars_fragment>
- #include <lights_pars_begin>
- #include <normal_pars_fragment>
- #include <lights_physical_pars_fragment>
- #include <transmission_pars_fragment>
- #include <shadowmap_pars_fragment>
- #include <bumpmap_pars_fragment>
- #include <normalmap_pars_fragment>
- #include <clearcoat_pars_fragment>
- #include <iridescence_pars_fragment>
- #include <roughnessmap_pars_fragment>
- #include <metalnessmap_pars_fragment>
- #include <logdepthbuf_pars_fragment>
- #include <clipping_planes_pars_fragment>
- void main() {
- #include <clipping_planes_fragment>
- vec4 diffuseColor = vec4( diffuse, opacity );
- ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
- vec3 totalEmissiveRadiance = emissive;
- #include <logdepthbuf_fragment>
- #include <map_fragment>
- #include <color_fragment>
- #include <alphamap_fragment>
- #include <alphatest_fragment>
- #include <alphahash_fragment>
- #include <roughnessmap_fragment>
- #include <metalnessmap_fragment>
- #include <normal_fragment_begin>
- #include <normal_fragment_maps>
- #include <clearcoat_normal_fragment_begin>
- #include <clearcoat_normal_fragment_maps>
- #include <emissivemap_fragment>
- #include <lights_physical_fragment>
- #include <lights_fragment_begin>
- #include <lights_fragment_maps>
- #include <lights_fragment_end>
- #include <aomap_fragment>
- vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;
- vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;
- #include <transmission_fragment>
- vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;
- #ifdef USE_SHEEN
- float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );
- outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;
- #endif
- #ifdef USE_CLEARCOAT
- float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );
- vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );
- outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;
- #endif
- #include <opaque_fragment>
- #include <tonemapping_fragment>
- #include <colorspace_fragment>
- #include <fog_fragment>
- #include <premultiplied_alpha_fragment>
- #include <dithering_fragment>
- }`,SCe=`#define TOON
- varying vec3 vViewPosition;
- #include <common>
- #include <batching_pars_vertex>
- #include <uv_pars_vertex>
- #include <displacementmap_pars_vertex>
- #include <color_pars_vertex>
- #include <fog_pars_vertex>
- #include <normal_pars_vertex>
- #include <morphtarget_pars_vertex>
- #include <skinning_pars_vertex>
- #include <shadowmap_pars_vertex>
- #include <logdepthbuf_pars_vertex>
- #include <clipping_planes_pars_vertex>
- void main() {
- #include <uv_vertex>
- #include <color_vertex>
- #include <morphcolor_vertex>
- #include <batching_vertex>
- #include <beginnormal_vertex>
- #include <morphnormal_vertex>
- #include <skinbase_vertex>
- #include <skinnormal_vertex>
- #include <defaultnormal_vertex>
- #include <normal_vertex>
- #include <begin_vertex>
- #include <morphtarget_vertex>
- #include <skinning_vertex>
- #include <displacementmap_vertex>
- #include <project_vertex>
- #include <logdepthbuf_vertex>
- #include <clipping_planes_vertex>
- vViewPosition = - mvPosition.xyz;
- #include <worldpos_vertex>
- #include <shadowmap_vertex>
- #include <fog_vertex>
- }`,_Ce=`#define TOON
- uniform vec3 diffuse;
- uniform vec3 emissive;
- uniform float opacity;
- #include <common>
- #include <packing>
- #include <dithering_pars_fragment>
- #include <color_pars_fragment>
- #include <uv_pars_fragment>
- #include <map_pars_fragment>
- #include <alphamap_pars_fragment>
- #include <alphatest_pars_fragment>
- #include <alphahash_pars_fragment>
- #include <aomap_pars_fragment>
- #include <lightmap_pars_fragment>
- #include <emissivemap_pars_fragment>
- #include <gradientmap_pars_fragment>
- #include <fog_pars_fragment>
- #include <bsdfs>
- #include <lights_pars_begin>
- #include <normal_pars_fragment>
- #include <lights_toon_pars_fragment>
- #include <shadowmap_pars_fragment>
- #include <bumpmap_pars_fragment>
- #include <normalmap_pars_fragment>
- #include <logdepthbuf_pars_fragment>
- #include <clipping_planes_pars_fragment>
- void main() {
- #include <clipping_planes_fragment>
- vec4 diffuseColor = vec4( diffuse, opacity );
- ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
- vec3 totalEmissiveRadiance = emissive;
- #include <logdepthbuf_fragment>
- #include <map_fragment>
- #include <color_fragment>
- #include <alphamap_fragment>
- #include <alphatest_fragment>
- #include <alphahash_fragment>
- #include <normal_fragment_begin>
- #include <normal_fragment_maps>
- #include <emissivemap_fragment>
- #include <lights_toon_fragment>
- #include <lights_fragment_begin>
- #include <lights_fragment_maps>
- #include <lights_fragment_end>
- #include <aomap_fragment>
- vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
- #include <opaque_fragment>
- #include <tonemapping_fragment>
- #include <colorspace_fragment>
- #include <fog_fragment>
- #include <premultiplied_alpha_fragment>
- #include <dithering_fragment>
- }`,kCe=`uniform float size;
- uniform float scale;
- #include <common>
- #include <color_pars_vertex>
- #include <fog_pars_vertex>
- #include <morphtarget_pars_vertex>
- #include <logdepthbuf_pars_vertex>
- #include <clipping_planes_pars_vertex>
- #ifdef USE_POINTS_UV
- varying vec2 vUv;
- uniform mat3 uvTransform;
- #endif
- void main() {
- #ifdef USE_POINTS_UV
- vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
- #endif
- #include <color_vertex>
- #include <morphcolor_vertex>
- #include <begin_vertex>
- #include <morphtarget_vertex>
- #include <project_vertex>
- gl_PointSize = size;
- #ifdef USE_SIZEATTENUATION
- bool isPerspective = isPerspectiveMatrix( projectionMatrix );
- if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );
- #endif
- #include <logdepthbuf_vertex>
- #include <clipping_planes_vertex>
- #include <worldpos_vertex>
- #include <fog_vertex>
- }`,NCe=`uniform vec3 diffuse;
- uniform float opacity;
- #include <common>
- #include <color_pars_fragment>
- #include <map_particle_pars_fragment>
- #include <alphatest_pars_fragment>
- #include <alphahash_pars_fragment>
- #include <fog_pars_fragment>
- #include <logdepthbuf_pars_fragment>
- #include <clipping_planes_pars_fragment>
- void main() {
- #include <clipping_planes_fragment>
- vec3 outgoingLight = vec3( 0.0 );
- vec4 diffuseColor = vec4( diffuse, opacity );
- #include <logdepthbuf_fragment>
- #include <map_particle_fragment>
- #include <color_fragment>
- #include <alphatest_fragment>
- #include <alphahash_fragment>
- outgoingLight = diffuseColor.rgb;
- #include <opaque_fragment>
- #include <tonemapping_fragment>
- #include <colorspace_fragment>
- #include <fog_fragment>
- #include <premultiplied_alpha_fragment>
- }`,CCe=`#include <common>
- #include <batching_pars_vertex>
- #include <fog_pars_vertex>
- #include <morphtarget_pars_vertex>
- #include <skinning_pars_vertex>
- #include <logdepthbuf_pars_vertex>
- #include <shadowmap_pars_vertex>
- void main() {
- #include <batching_vertex>
- #include <beginnormal_vertex>
- #include <morphnormal_vertex>
- #include <skinbase_vertex>
- #include <skinnormal_vertex>
- #include <defaultnormal_vertex>
- #include <begin_vertex>
- #include <morphtarget_vertex>
- #include <skinning_vertex>
- #include <project_vertex>
- #include <logdepthbuf_vertex>
- #include <worldpos_vertex>
- #include <shadowmap_vertex>
- #include <fog_vertex>
- }`,TCe=`uniform vec3 color;
- uniform float opacity;
- #include <common>
- #include <packing>
- #include <fog_pars_fragment>
- #include <bsdfs>
- #include <lights_pars_begin>
- #include <logdepthbuf_pars_fragment>
- #include <shadowmap_pars_fragment>
- #include <shadowmask_pars_fragment>
- void main() {
- #include <logdepthbuf_fragment>
- gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );
- #include <tonemapping_fragment>
- #include <colorspace_fragment>
- #include <fog_fragment>
- }`,PCe=`uniform float rotation;
- uniform vec2 center;
- #include <common>
- #include <uv_pars_vertex>
- #include <fog_pars_vertex>
- #include <logdepthbuf_pars_vertex>
- #include <clipping_planes_pars_vertex>
- void main() {
- #include <uv_vertex>
- vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );
- vec2 scale;
- scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );
- scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );
- #ifndef USE_SIZEATTENUATION
- bool isPerspective = isPerspectiveMatrix( projectionMatrix );
- if ( isPerspective ) scale *= - mvPosition.z;
- #endif
- vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;
- vec2 rotatedPosition;
- rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
- rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
- mvPosition.xy += rotatedPosition;
- gl_Position = projectionMatrix * mvPosition;
- #include <logdepthbuf_vertex>
- #include <clipping_planes_vertex>
- #include <fog_vertex>
- }`,ACe=`uniform vec3 diffuse;
- uniform float opacity;
- #include <common>
- #include <uv_pars_fragment>
- #include <map_pars_fragment>
- #include <alphamap_pars_fragment>
- #include <alphatest_pars_fragment>
- #include <alphahash_pars_fragment>
- #include <fog_pars_fragment>
- #include <logdepthbuf_pars_fragment>
- #include <clipping_planes_pars_fragment>
- void main() {
- #include <clipping_planes_fragment>
- vec3 outgoingLight = vec3( 0.0 );
- vec4 diffuseColor = vec4( diffuse, opacity );
- #include <logdepthbuf_fragment>
- #include <map_fragment>
- #include <alphamap_fragment>
- #include <alphatest_fragment>
- #include <alphahash_fragment>
- outgoingLight = diffuseColor.rgb;
- #include <opaque_fragment>
- #include <tonemapping_fragment>
- #include <colorspace_fragment>
- #include <fog_fragment>
- }`,Vn={alphahash_fragment:Q1e,alphahash_pars_fragment:Z1e,alphamap_fragment:J1e,alphamap_pars_fragment:eke,alphatest_fragment:tke,alphatest_pars_fragment:nke,aomap_fragment:rke,aomap_pars_fragment:ike,batching_pars_vertex:ake,batching_vertex:ske,begin_vertex:oke,beginnormal_vertex:lke,bsdfs:cke,iridescence_fragment:dke,bumpmap_pars_fragment:uke,clipping_planes_fragment:mke,clipping_planes_pars_fragment:hke,clipping_planes_pars_vertex:pke,clipping_planes_vertex:fke,color_fragment:gke,color_pars_fragment:bke,color_pars_vertex:xke,color_vertex:yke,common:vke,cube_uv_reflection_fragment:wke,defaultnormal_vertex:Ske,displacementmap_pars_vertex:_ke,displacementmap_vertex:kke,emissivemap_fragment:Nke,emissivemap_pars_fragment:Cke,colorspace_fragment:Tke,colorspace_pars_fragment:Pke,envmap_fragment:Ake,envmap_common_pars_fragment:Mke,envmap_pars_fragment:Eke,envmap_pars_vertex:jke,envmap_physical_pars_fragment:qke,envmap_vertex:Dke,fog_vertex:Rke,fog_pars_vertex:Fke,fog_fragment:Lke,fog_pars_fragment:Oke,gradientmap_pars_fragment:Ike,lightmap_fragment:zke,lightmap_pars_fragment:Uke,lights_lambert_fragment:Bke,lights_lambert_pars_fragment:Hke,lights_pars_begin:$ke,lights_toon_fragment:Vke,lights_toon_pars_fragment:Gke,lights_phong_fragment:Wke,lights_phong_pars_fragment:Kke,lights_physical_fragment:Yke,lights_physical_pars_fragment:Xke,lights_fragment_begin:Qke,lights_fragment_maps:Zke,lights_fragment_end:Jke,logdepthbuf_fragment:eNe,logdepthbuf_pars_fragment:tNe,logdepthbuf_pars_vertex:nNe,logdepthbuf_vertex:rNe,map_fragment:iNe,map_pars_fragment:aNe,map_particle_fragment:sNe,map_particle_pars_fragment:oNe,metalnessmap_fragment:lNe,metalnessmap_pars_fragment:cNe,morphcolor_vertex:dNe,morphnormal_vertex:uNe,morphtarget_pars_vertex:mNe,morphtarget_vertex:hNe,normal_fragment_begin:pNe,normal_fragment_maps:fNe,normal_pars_fragment:gNe,normal_pars_vertex:bNe,normal_vertex:xNe,normalmap_pars_fragment:yNe,clearcoat_normal_fragment_begin:vNe,clearcoat_normal_fragment_maps:wNe,clearcoat_pars_fragment:SNe,iridescence_pars_fragment:_Ne,opaque_fragment:kNe,packing:NNe,premultiplied_alpha_fragment:CNe,project_vertex:TNe,dithering_fragment:PNe,dithering_pars_fragment:ANe,roughnessmap_fragment:MNe,roughnessmap_pars_fragment:ENe,shadowmap_pars_fragment:jNe,shadowmap_pars_vertex:DNe,shadowmap_vertex:RNe,shadowmask_pars_fragment:FNe,skinbase_vertex:LNe,skinning_pars_vertex:ONe,skinning_vertex:INe,skinnormal_vertex:zNe,specularmap_fragment:UNe,specularmap_pars_fragment:BNe,tonemapping_fragment:HNe,tonemapping_pars_fragment:$Ne,transmission_fragment:qNe,transmission_pars_fragment:VNe,uv_pars_fragment:GNe,uv_pars_vertex:WNe,uv_vertex:KNe,worldpos_vertex:YNe,background_vert:XNe,background_frag:QNe,backgroundCube_vert:ZNe,backgroundCube_frag:JNe,cube_vert:eCe,cube_frag:tCe,depth_vert:nCe,depth_frag:rCe,distanceRGBA_vert:iCe,distanceRGBA_frag:aCe,equirect_vert:sCe,equirect_frag:oCe,linedashed_vert:lCe,linedashed_frag:cCe,meshbasic_vert:dCe,meshbasic_frag:uCe,meshlambert_vert:mCe,meshlambert_frag:hCe,meshmatcap_vert:pCe,meshmatcap_frag:fCe,meshnormal_vert:gCe,meshnormal_frag:bCe,meshphong_vert:xCe,meshphong_frag:yCe,meshphysical_vert:vCe,meshphysical_frag:wCe,meshtoon_vert:SCe,meshtoon_frag:_Ce,points_vert:kCe,points_frag:NCe,shadow_vert:CCe,shadow_frag:TCe,sprite_vert:PCe,sprite_frag:ACe},qt={common:{diffuse:{value:new yn(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new rr},alphaMap:{value:null},alphaMapTransform:{value:new rr},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new rr}},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 rr}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new rr}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new rr},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new rr},normalScale:{value:new Fn(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new rr},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new rr}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new rr}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new rr}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new yn(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 yn(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new rr},alphaTest:{value:0},uvTransform:{value:new rr}},sprite:{diffuse:{value:new yn(16777215)},opacity:{value:1},center:{value:new Fn(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new rr},alphaMap:{value:null},alphaMapTransform:{value:new rr},alphaTest:{value:0}}},eo={basic:{uniforms:Ps([qt.common,qt.specularmap,qt.envmap,qt.aomap,qt.lightmap,qt.fog]),vertexShader:Vn.meshbasic_vert,fragmentShader:Vn.meshbasic_frag},lambert:{uniforms:Ps([qt.common,qt.specularmap,qt.envmap,qt.aomap,qt.lightmap,qt.emissivemap,qt.bumpmap,qt.normalmap,qt.displacementmap,qt.fog,qt.lights,{emissive:{value:new yn(0)}}]),vertexShader:Vn.meshlambert_vert,fragmentShader:Vn.meshlambert_frag},phong:{uniforms:Ps([qt.common,qt.specularmap,qt.envmap,qt.aomap,qt.lightmap,qt.emissivemap,qt.bumpmap,qt.normalmap,qt.displacementmap,qt.fog,qt.lights,{emissive:{value:new yn(0)},specular:{value:new yn(1118481)},shininess:{value:30}}]),vertexShader:Vn.meshphong_vert,fragmentShader:Vn.meshphong_frag},standard:{uniforms:Ps([qt.common,qt.envmap,qt.aomap,qt.lightmap,qt.emissivemap,qt.bumpmap,qt.normalmap,qt.displacementmap,qt.roughnessmap,qt.metalnessmap,qt.fog,qt.lights,{emissive:{value:new yn(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Vn.meshphysical_vert,fragmentShader:Vn.meshphysical_frag},toon:{uniforms:Ps([qt.common,qt.aomap,qt.lightmap,qt.emissivemap,qt.bumpmap,qt.normalmap,qt.displacementmap,qt.gradientmap,qt.fog,qt.lights,{emissive:{value:new yn(0)}}]),vertexShader:Vn.meshtoon_vert,fragmentShader:Vn.meshtoon_frag},matcap:{uniforms:Ps([qt.common,qt.bumpmap,qt.normalmap,qt.displacementmap,qt.fog,{matcap:{value:null}}]),vertexShader:Vn.meshmatcap_vert,fragmentShader:Vn.meshmatcap_frag},points:{uniforms:Ps([qt.points,qt.fog]),vertexShader:Vn.points_vert,fragmentShader:Vn.points_frag},dashed:{uniforms:Ps([qt.common,qt.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Vn.linedashed_vert,fragmentShader:Vn.linedashed_frag},depth:{uniforms:Ps([qt.common,qt.displacementmap]),vertexShader:Vn.depth_vert,fragmentShader:Vn.depth_frag},normal:{uniforms:Ps([qt.common,qt.bumpmap,qt.normalmap,qt.displacementmap,{opacity:{value:1}}]),vertexShader:Vn.meshnormal_vert,fragmentShader:Vn.meshnormal_frag},sprite:{uniforms:Ps([qt.sprite,qt.fog]),vertexShader:Vn.sprite_vert,fragmentShader:Vn.sprite_frag},background:{uniforms:{uvTransform:{value:new rr},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Vn.background_vert,fragmentShader:Vn.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1}},vertexShader:Vn.backgroundCube_vert,fragmentShader:Vn.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Vn.cube_vert,fragmentShader:Vn.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Vn.equirect_vert,fragmentShader:Vn.equirect_frag},distanceRGBA:{uniforms:Ps([qt.common,qt.displacementmap,{referencePosition:{value:new rt},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Vn.distanceRGBA_vert,fragmentShader:Vn.distanceRGBA_frag},shadow:{uniforms:Ps([qt.lights,qt.fog,{color:{value:new yn(0)},opacity:{value:1}}]),vertexShader:Vn.shadow_vert,fragmentShader:Vn.shadow_frag}};eo.physical={uniforms:Ps([eo.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new rr},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new rr},clearcoatNormalScale:{value:new Fn(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new rr},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new rr},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new rr},sheen:{value:0},sheenColor:{value:new yn(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new rr},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new rr},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new rr},transmissionSamplerSize:{value:new Fn},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new rr},attenuationDistance:{value:0},attenuationColor:{value:new yn(0)},specularColor:{value:new yn(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new rr},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new rr},anisotropyVector:{value:new Fn},anisotropyMap:{value:null},anisotropyMapTransform:{value:new rr}}]),vertexShader:Vn.meshphysical_vert,fragmentShader:Vn.meshphysical_frag};const p_={r:0,b:0,g:0};function MCe(t,e,n,r,a,s,o){const l=new yn(0);let c=s===!0?0:1,d,u,m=null,p=0,f=null;function y(b,v){let _=!1,k=v.isScene===!0?v.background:null;k&&k.isTexture&&(k=(v.backgroundBlurriness>0?n:e).get(k)),k===null?x(l,c):k&&k.isColor&&(x(k,1),_=!0);const P=t.xr.getEnvironmentBlendMode();P==="additive"?r.buffers.color.setClear(0,0,0,1,o):P==="alpha-blend"&&r.buffers.color.setClear(0,0,0,0,o),(t.autoClear||_)&&t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil),k&&(k.isCubeTexture||k.mapping===NC)?(u===void 0&&(u=new Ql(new I0(1,1,1),new oh({name:"BackgroundCubeMaterial",uniforms:Bb(eo.backgroundCube.uniforms),vertexShader:eo.backgroundCube.vertexShader,fragmentShader:eo.backgroundCube.fragmentShader,side:so,depthTest:!1,depthWrite:!1,fog:!1})),u.geometry.deleteAttribute("normal"),u.geometry.deleteAttribute("uv"),u.onBeforeRender=function(C,T,N){this.matrixWorld.copyPosition(N.matrixWorld)},Object.defineProperty(u.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),a.update(u)),u.material.uniforms.envMap.value=k,u.material.uniforms.flipEnvMap.value=k.isCubeTexture&&k.isRenderTargetTexture===!1?-1:1,u.material.uniforms.backgroundBlurriness.value=v.backgroundBlurriness,u.material.uniforms.backgroundIntensity.value=v.backgroundIntensity,u.material.toneMapped=Hr.getTransfer(k.colorSpace)!==si,(m!==k||p!==k.version||f!==t.toneMapping)&&(u.material.needsUpdate=!0,m=k,p=k.version,f=t.toneMapping),u.layers.enableAll(),b.unshift(u,u.geometry,u.material,0,0,null)):k&&k.isTexture&&(d===void 0&&(d=new Ql(new kL(2,2),new oh({name:"BackgroundMaterial",uniforms:Bb(eo.background.uniforms),vertexShader:eo.background.vertexShader,fragmentShader:eo.background.fragmentShader,side:sh,depthTest:!1,depthWrite:!1,fog:!1})),d.geometry.deleteAttribute("normal"),Object.defineProperty(d.material,"map",{get:function(){return this.uniforms.t2D.value}}),a.update(d)),d.material.uniforms.t2D.value=k,d.material.uniforms.backgroundIntensity.value=v.backgroundIntensity,d.material.toneMapped=Hr.getTransfer(k.colorSpace)!==si,k.matrixAutoUpdate===!0&&k.updateMatrix(),d.material.uniforms.uvTransform.value.copy(k.matrix),(m!==k||p!==k.version||f!==t.toneMapping)&&(d.material.needsUpdate=!0,m=k,p=k.version,f=t.toneMapping),d.layers.enableAll(),b.unshift(d,d.geometry,d.material,0,0,null))}function x(b,v){b.getRGB(p_,vQ(t)),r.buffers.color.setClear(p_.r,p_.g,p_.b,v,o)}return{getClearColor:function(){return l},setClearColor:function(b,v=1){l.set(b),c=v,x(l,c)},getClearAlpha:function(){return c},setClearAlpha:function(b){c=b,x(l,c)},render:y}}function ECe(t,e,n,r){const a=t.getParameter(t.MAX_VERTEX_ATTRIBS),s=r.isWebGL2?null:e.get("OES_vertex_array_object"),o=r.isWebGL2||s!==null,l={},c=b(null);let d=c,u=!1;function m(L,te,re,J,ue){let me=!1;if(o){const ge=x(J,re,te);d!==ge&&(d=ge,f(d.object)),me=v(L,J,re,ue),me&&_(L,J,re,ue)}else{const ge=te.wireframe===!0;(d.geometry!==J.id||d.program!==re.id||d.wireframe!==ge)&&(d.geometry=J.id,d.program=re.id,d.wireframe=ge,me=!0)}ue!==null&&n.update(ue,t.ELEMENT_ARRAY_BUFFER),(me||u)&&(u=!1,R(L,te,re,J),ue!==null&&t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,n.get(ue).buffer))}function p(){return r.isWebGL2?t.createVertexArray():s.createVertexArrayOES()}function f(L){return r.isWebGL2?t.bindVertexArray(L):s.bindVertexArrayOES(L)}function y(L){return r.isWebGL2?t.deleteVertexArray(L):s.deleteVertexArrayOES(L)}function x(L,te,re){const J=re.wireframe===!0;let ue=l[L.id];ue===void 0&&(ue={},l[L.id]=ue);let me=ue[te.id];me===void 0&&(me={},ue[te.id]=me);let ge=me[J];return ge===void 0&&(ge=b(p()),me[J]=ge),ge}function b(L){const te=[],re=[],J=[];for(let ue=0;ue<a;ue++)te[ue]=0,re[ue]=0,J[ue]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:te,enabledAttributes:re,attributeDivisors:J,object:L,attributes:{},index:null}}function v(L,te,re,J){const ue=d.attributes,me=te.attributes;let ge=0;const X=re.getAttributes();for(const ie in X)if(X[ie].location>=0){const pe=ue[ie];let Ce=me[ie];if(Ce===void 0&&(ie==="instanceMatrix"&&L.instanceMatrix&&(Ce=L.instanceMatrix),ie==="instanceColor"&&L.instanceColor&&(Ce=L.instanceColor)),pe===void 0||pe.attribute!==Ce||Ce&&pe.data!==Ce.data)return!0;ge++}return d.attributesNum!==ge||d.index!==J}function _(L,te,re,J){const ue={},me=te.attributes;let ge=0;const X=re.getAttributes();for(const ie in X)if(X[ie].location>=0){let pe=me[ie];pe===void 0&&(ie==="instanceMatrix"&&L.instanceMatrix&&(pe=L.instanceMatrix),ie==="instanceColor"&&L.instanceColor&&(pe=L.instanceColor));const Ce={};Ce.attribute=pe,pe&&pe.data&&(Ce.data=pe.data),ue[ie]=Ce,ge++}d.attributes=ue,d.attributesNum=ge,d.index=J}function k(){const L=d.newAttributes;for(let te=0,re=L.length;te<re;te++)L[te]=0}function P(L){C(L,0)}function C(L,te){const re=d.newAttributes,J=d.enabledAttributes,ue=d.attributeDivisors;re[L]=1,J[L]===0&&(t.enableVertexAttribArray(L),J[L]=1),ue[L]!==te&&((r.isWebGL2?t:e.get("ANGLE_instanced_arrays"))[r.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](L,te),ue[L]=te)}function T(){const L=d.newAttributes,te=d.enabledAttributes;for(let re=0,J=te.length;re<J;re++)te[re]!==L[re]&&(t.disableVertexAttribArray(re),te[re]=0)}function N(L,te,re,J,ue,me,ge){ge===!0?t.vertexAttribIPointer(L,te,re,ue,me):t.vertexAttribPointer(L,te,re,J,ue,me)}function R(L,te,re,J){if(r.isWebGL2===!1&&(L.isInstancedMesh||J.isInstancedBufferGeometry)&&e.get("ANGLE_instanced_arrays")===null)return;k();const ue=J.attributes,me=re.getAttributes(),ge=te.defaultAttributeValues;for(const X in me){const ie=me[X];if(ie.location>=0){let le=ue[X];if(le===void 0&&(X==="instanceMatrix"&&L.instanceMatrix&&(le=L.instanceMatrix),X==="instanceColor"&&L.instanceColor&&(le=L.instanceColor)),le!==void 0){const pe=le.normalized,Ce=le.itemSize,q=n.get(le);if(q===void 0)continue;const Z=q.buffer,j=q.type,E=q.bytesPerElement,I=r.isWebGL2===!0&&(j===t.INT||j===t.UNSIGNED_INT||le.gpuType===eQ);if(le.isInterleavedBufferAttribute){const W=le.data,B=W.stride,ae=le.offset;if(W.isInstancedInterleavedBuffer){for(let z=0;z<ie.locationSize;z++)C(ie.location+z,W.meshPerAttribute);L.isInstancedMesh!==!0&&J._maxInstanceCount===void 0&&(J._maxInstanceCount=W.meshPerAttribute*W.count)}else for(let z=0;z<ie.locationSize;z++)P(ie.location+z);t.bindBuffer(t.ARRAY_BUFFER,Z);for(let z=0;z<ie.locationSize;z++)N(ie.location+z,Ce/ie.locationSize,j,pe,B*E,(ae+Ce/ie.locationSize*z)*E,I)}else{if(le.isInstancedBufferAttribute){for(let W=0;W<ie.locationSize;W++)C(ie.location+W,le.meshPerAttribute);L.isInstancedMesh!==!0&&J._maxInstanceCount===void 0&&(J._maxInstanceCount=le.meshPerAttribute*le.count)}else for(let W=0;W<ie.locationSize;W++)P(ie.location+W);t.bindBuffer(t.ARRAY_BUFFER,Z);for(let W=0;W<ie.locationSize;W++)N(ie.location+W,Ce/ie.locationSize,j,pe,Ce*E,Ce/ie.locationSize*W*E,I)}}else if(ge!==void 0){const pe=ge[X];if(pe!==void 0)switch(pe.length){case 2:t.vertexAttrib2fv(ie.location,pe);break;case 3:t.vertexAttrib3fv(ie.location,pe);break;case 4:t.vertexAttrib4fv(ie.location,pe);break;default:t.vertexAttrib1fv(ie.location,pe)}}}}T()}function A(){U();for(const L in l){const te=l[L];for(const re in te){const J=te[re];for(const ue in J)y(J[ue].object),delete J[ue];delete te[re]}delete l[L]}}function D(L){if(l[L.id]===void 0)return;const te=l[L.id];for(const re in te){const J=te[re];for(const ue in J)y(J[ue].object),delete J[ue];delete te[re]}delete l[L.id]}function $(L){for(const te in l){const re=l[te];if(re[L.id]===void 0)continue;const J=re[L.id];for(const ue in J)y(J[ue].object),delete J[ue];delete re[L.id]}}function U(){G(),u=!0,d!==c&&(d=c,f(d.object))}function G(){c.geometry=null,c.program=null,c.wireframe=!1}return{setup:m,reset:U,resetDefaultState:G,dispose:A,releaseStatesOfGeometry:D,releaseStatesOfProgram:$,initAttributes:k,enableAttribute:P,disableUnusedAttributes:T}}function jCe(t,e,n,r){const a=r.isWebGL2;let s;function o(u){s=u}function l(u,m){t.drawArrays(s,u,m),n.update(m,s,1)}function c(u,m,p){if(p===0)return;let f,y;if(a)f=t,y="drawArraysInstanced";else if(f=e.get("ANGLE_instanced_arrays"),y="drawArraysInstancedANGLE",f===null){console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}f[y](s,u,m,p),n.update(m,s,p)}function d(u,m,p){if(p===0)return;const f=e.get("WEBGL_multi_draw");if(f===null)for(let y=0;y<p;y++)this.render(u[y],m[y]);else{f.multiDrawArraysWEBGL(s,u,0,m,0,p);let y=0;for(let x=0;x<p;x++)y+=m[x];n.update(y,s,1)}}this.setMode=o,this.render=l,this.renderInstances=c,this.renderMultiDraw=d}function DCe(t,e,n){let r;function a(){if(r!==void 0)return r;if(e.has("EXT_texture_filter_anisotropic")===!0){const N=e.get("EXT_texture_filter_anisotropic");r=t.getParameter(N.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r}function s(N){if(N==="highp"){if(t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.HIGH_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision>0)return"highp";N="mediump"}return N==="mediump"&&t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.MEDIUM_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}const o=typeof WebGL2RenderingContext<"u"&&t.constructor.name==="WebGL2RenderingContext";let l=n.precision!==void 0?n.precision:"highp";const c=s(l);c!==l&&(console.warn("THREE.WebGLRenderer:",l,"not supported, using",c,"instead."),l=c);const d=o||e.has("WEBGL_draw_buffers"),u=n.logarithmicDepthBuffer===!0,m=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),p=t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),f=t.getParameter(t.MAX_TEXTURE_SIZE),y=t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),x=t.getParameter(t.MAX_VERTEX_ATTRIBS),b=t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),v=t.getParameter(t.MAX_VARYING_VECTORS),_=t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),k=p>0,P=o||e.has("OES_texture_float"),C=k&&P,T=o?t.getParameter(t.MAX_SAMPLES):0;return{isWebGL2:o,drawBuffers:d,getMaxAnisotropy:a,getMaxPrecision:s,precision:l,logarithmicDepthBuffer:u,maxTextures:m,maxVertexTextures:p,maxTextureSize:f,maxCubemapSize:y,maxAttributes:x,maxVertexUniforms:b,maxVaryings:v,maxFragmentUniforms:_,vertexTextures:k,floatFragmentTextures:P,floatVertexTextures:C,maxSamples:T}}function RCe(t){const e=this;let n=null,r=0,a=!1,s=!1;const o=new fm,l=new rr,c={value:null,needsUpdate:!1};this.uniform=c,this.numPlanes=0,this.numIntersection=0,this.init=function(m,p){const f=m.length!==0||p||r!==0||a;return a=p,r=m.length,f},this.beginShadows=function(){s=!0,u(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(m,p){n=u(m,p,0)},this.setState=function(m,p,f){const y=m.clippingPlanes,x=m.clipIntersection,b=m.clipShadows,v=t.get(m);if(!a||y===null||y.length===0||s&&!b)s?u(null):d();else{const _=s?0:r,k=_*4;let P=v.clippingState||null;c.value=P,P=u(y,p,k,f);for(let C=0;C!==k;++C)P[C]=n[C];v.clippingState=P,this.numIntersection=x?this.numPlanes:0,this.numPlanes+=_}};function d(){c.value!==n&&(c.value=n,c.needsUpdate=r>0),e.numPlanes=r,e.numIntersection=0}function u(m,p,f,y){const x=m!==null?m.length:0;let b=null;if(x!==0){if(b=c.value,y!==!0||b===null){const v=f+x*4,_=p.matrixWorldInverse;l.getNormalMatrix(_),(b===null||b.length<v)&&(b=new Float32Array(v));for(let k=0,P=f;k!==x;++k,P+=4)o.copy(m[k]).applyMatrix4(_,l),o.normal.toArray(b,P),b[P+3]=o.constant}c.value=b,c.needsUpdate=!0}return e.numPlanes=x,e.numIntersection=0,b}}function FCe(t){let e=new WeakMap;function n(o,l){return l===N3?o.mapping=Ib:l===C3&&(o.mapping=zb),o}function r(o){if(o&&o.isTexture){const l=o.mapping;if(l===N3||l===C3)if(e.has(o)){const c=e.get(o).texture;return n(c,o.mapping)}else{const c=o.image;if(c&&c.height>0){const d=new W1e(c.height/2);return d.fromEquirectangularTexture(t,o),e.set(o,d),o.addEventListener("dispose",a),n(d.texture,o.mapping)}else return null}}return o}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}return{get:r,dispose:s}}class LCe extends wQ{constructor(e=-1,n=1,r=1,a=-1,s=.1,o=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=n,this.top=r,this.bottom=a,this.near=s,this.far=o,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,r,a,s,o){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=r,this.view.offsetY=a,this.view.width=s,this.view.height=o,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),r=(this.right+this.left)/2,a=(this.top+this.bottom)/2;let s=r-e,o=r+e,l=a+n,c=a-n;if(this.view!==null&&this.view.enabled){const d=(this.right-this.left)/this.view.fullWidth/this.zoom,u=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=d*this.view.offsetX,o=s+d*this.view.width,l-=u*this.view.offsetY,c=l-u*this.view.height}this.projectionMatrix.makeOrthographic(s,o,l,c,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const n=super.toJSON(e);return n.object.zoom=this.zoom,n.object.left=this.left,n.object.right=this.right,n.object.top=this.top,n.object.bottom=this.bottom,n.object.near=this.near,n.object.far=this.far,this.view!==null&&(n.object.view=Object.assign({},this.view)),n}}const sb=4,xH=[.125,.215,.35,.446,.526,.582],cp=20,l2=new LCe,yH=new yn;let c2=null,d2=0,u2=0;const np=(1+Math.sqrt(5))/2,Og=1/np,vH=[new rt(1,1,1),new rt(-1,1,1),new rt(1,1,-1),new rt(-1,1,-1),new rt(0,np,Og),new rt(0,np,-Og),new rt(Og,0,np),new rt(-Og,0,np),new rt(np,Og,0),new rt(-np,Og,0)];class wH{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,r=.1,a=100){c2=this._renderer.getRenderTarget(),d2=this._renderer.getActiveCubeFace(),u2=this._renderer.getActiveMipmapLevel(),this._setSize(256);const s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(e,r,a,s),n>0&&this._blur(s,0,0,n),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(e,n=null){return this._fromTexture(e,n)}fromCubemap(e,n=null){return this._fromTexture(e,n)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=kH(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=_H(),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(c2,d2,u2),e.scissorTest=!1,f_(e,0,0,e.width,e.height)}_fromTexture(e,n){e.mapping===Ib||e.mapping===zb?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),c2=this._renderer.getRenderTarget(),d2=this._renderer.getActiveCubeFace(),u2=this._renderer.getActiveMipmapLevel();const r=n||this._allocateTargets();return this._textureToCubeUV(e,r),this._applyPMREM(r),this._cleanup(r),r}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),n=4*this._cubeSize,r={magFilter:cl,minFilter:cl,generateMipmaps:!1,type:Wv,format:dl,colorSpace:hu,depthBuffer:!1},a=SH(e,n,r);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==n){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=SH(e,n,r);const{_lodMax:s}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=OCe(s)),this._blurMaterial=ICe(s,e,n)}return a}_compileMaterial(e){const n=new Ql(this._lodPlanes[0],e);this._renderer.compile(n,l2)}_sceneToCubeUV(e,n,r,a){const l=new Ao(90,1,n,r),c=[1,-1,1,1,1,1],d=[1,1,1,-1,-1,-1],u=this._renderer,m=u.autoClear,p=u.toneMapping;u.getClearColor(yH),u.toneMapping=Ym,u.autoClear=!1;const f=new bQ({name:"PMREM.Background",side:so,depthWrite:!1,depthTest:!1}),y=new Ql(new I0,f);let x=!1;const b=e.background;b?b.isColor&&(f.color.copy(b),e.background=null,x=!0):(f.color.copy(yH),x=!0);for(let v=0;v<6;v++){const _=v%3;_===0?(l.up.set(0,c[v],0),l.lookAt(d[v],0,0)):_===1?(l.up.set(0,0,c[v]),l.lookAt(0,d[v],0)):(l.up.set(0,c[v],0),l.lookAt(0,0,d[v]));const k=this._cubeSize;f_(a,_*k,v>2?k:0,k,k),u.setRenderTarget(a),x&&u.render(y,l),u.render(e,l)}y.geometry.dispose(),y.material.dispose(),u.toneMapping=p,u.autoClear=m,e.background=b}_textureToCubeUV(e,n){const r=this._renderer,a=e.mapping===Ib||e.mapping===zb;a?(this._cubemapMaterial===null&&(this._cubemapMaterial=kH()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=_H());const s=a?this._cubemapMaterial:this._equirectMaterial,o=new Ql(this._lodPlanes[0],s),l=s.uniforms;l.envMap.value=e;const c=this._cubeSize;f_(n,0,0,3*c,2*c),r.setRenderTarget(n),r.render(o,l2)}_applyPMREM(e){const n=this._renderer,r=n.autoClear;n.autoClear=!1;for(let a=1;a<this._lodPlanes.length;a++){const s=Math.sqrt(this._sigmas[a]*this._sigmas[a]-this._sigmas[a-1]*this._sigmas[a-1]),o=vH[(a-1)%vH.length];this._blur(e,a-1,a,s,o)}n.autoClear=r}_blur(e,n,r,a,s){const o=this._pingPongRenderTarget;this._halfBlur(e,o,n,r,a,"latitudinal",s),this._halfBlur(o,e,r,r,a,"longitudinal",s)}_halfBlur(e,n,r,a,s,o,l){const c=this._renderer,d=this._blurMaterial;o!=="latitudinal"&&o!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");const u=3,m=new Ql(this._lodPlanes[a],d),p=d.uniforms,f=this._sizeLods[r]-1,y=isFinite(s)?Math.PI/(2*f):2*Math.PI/(2*cp-1),x=s/y,b=isFinite(s)?1+Math.floor(u*x):cp;b>cp&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${b} samples when the maximum is set to ${cp}`);const v=[];let _=0;for(let N=0;N<cp;++N){const R=N/x,A=Math.exp(-R*R/2);v.push(A),N===0?_+=A:N<b&&(_+=2*A)}for(let N=0;N<v.length;N++)v[N]=v[N]/_;p.envMap.value=e.texture,p.samples.value=b,p.weights.value=v,p.latitudinal.value=o==="latitudinal",l&&(p.poleAxis.value=l);const{_lodMax:k}=this;p.dTheta.value=y,p.mipInt.value=k-r;const P=this._sizeLods[a],C=3*P*(a>k-sb?a-k+sb:0),T=4*(this._cubeSize-P);f_(n,C,T,3*P,2*P),c.setRenderTarget(n),c.render(m,l2)}}function OCe(t){const e=[],n=[],r=[];let a=t;const s=t-sb+1+xH.length;for(let o=0;o<s;o++){const l=Math.pow(2,a);n.push(l);let c=1/l;o>t-sb?c=xH[o-t+sb-1]:o===0&&(c=0),r.push(c);const d=1/(l-2),u=-d,m=1+d,p=[u,u,m,u,m,m,u,u,m,m,u,m],f=6,y=6,x=3,b=2,v=1,_=new Float32Array(x*y*f),k=new Float32Array(b*y*f),P=new Float32Array(v*y*f);for(let T=0;T<f;T++){const N=T%3*2/3-1,R=T>2?0:-1,A=[N,R,0,N+2/3,R,0,N+2/3,R+1,0,N,R,0,N+2/3,R+1,0,N,R+1,0];_.set(A,x*y*T),k.set(p,b*y*T);const D=[T,T,T,T,T,T];P.set(D,v*y*T)}const C=new ys;C.setAttribute("position",new Fo(_,x)),C.setAttribute("uv",new Fo(k,b)),C.setAttribute("faceIndex",new Fo(P,v)),e.push(C),a>sb&&a--}return{lodPlanes:e,sizeLods:n,sigmas:r}}function SH(t,e,n){const r=new Qp(t,e,n);return r.texture.mapping=NC,r.texture.name="PMREM.cubeUv",r.scissorTest=!0,r}function f_(t,e,n,r,a){t.viewport.set(e,n,r,a),t.scissor.set(e,n,r,a)}function ICe(t,e,n){const r=new Float32Array(cp),a=new rt(0,1,0);return new oh({name:"SphericalGaussianBlur",defines:{n:cp,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${t}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:r},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:a}},vertexShader:NL(),fragmentShader:`
- precision mediump float;
- precision mediump int;
- varying vec3 vOutputDirection;
- uniform sampler2D envMap;
- uniform int samples;
- uniform float weights[ n ];
- uniform bool latitudinal;
- uniform float dTheta;
- uniform float mipInt;
- uniform vec3 poleAxis;
- #define ENVMAP_TYPE_CUBE_UV
- #include <cube_uv_reflection_fragment>
- vec3 getSample( float theta, vec3 axis ) {
- float cosTheta = cos( theta );
- // Rodrigues' axis-angle rotation
- vec3 sampleDirection = vOutputDirection * cosTheta
- + cross( axis, vOutputDirection ) * sin( theta )
- + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );
- return bilinearCubeUV( envMap, sampleDirection, mipInt );
- }
- void main() {
- vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );
- if ( all( equal( axis, vec3( 0.0 ) ) ) ) {
- axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );
- }
- axis = normalize( axis );
- gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
- gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );
- for ( int i = 1; i < n; i++ ) {
- if ( i >= samples ) {
- break;
- }
- float theta = dTheta * float( i );
- gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );
- gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );
- }
- }
- `,blending:Km,depthTest:!1,depthWrite:!1})}function _H(){return new oh({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:NL(),fragmentShader:`
- precision mediump float;
- precision mediump int;
- varying vec3 vOutputDirection;
- uniform sampler2D envMap;
- #include <common>
- void main() {
- vec3 outputDirection = normalize( vOutputDirection );
- vec2 uv = equirectUv( outputDirection );
- gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );
- }
- `,blending:Km,depthTest:!1,depthWrite:!1})}function kH(){return new oh({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:NL(),fragmentShader:`
- precision mediump float;
- precision mediump int;
- uniform float flipEnvMap;
- varying vec3 vOutputDirection;
- uniform samplerCube envMap;
- void main() {
- gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );
- }
- `,blending:Km,depthTest:!1,depthWrite:!1})}function NL(){return`
- precision mediump float;
- precision mediump int;
- attribute float faceIndex;
- varying vec3 vOutputDirection;
- // RH coordinate system; PMREM face-indexing convention
- vec3 getDirection( vec2 uv, float face ) {
- uv = 2.0 * uv - 1.0;
- vec3 direction = vec3( uv, 1.0 );
- if ( face == 0.0 ) {
- direction = direction.zyx; // ( 1, v, u ) pos x
- } else if ( face == 1.0 ) {
- direction = direction.xzy;
- direction.xz *= -1.0; // ( -u, 1, -v ) pos y
- } else if ( face == 2.0 ) {
- direction.x *= -1.0; // ( -u, v, 1 ) pos z
- } else if ( face == 3.0 ) {
- direction = direction.zyx;
- direction.xz *= -1.0; // ( -1, v, -u ) neg x
- } else if ( face == 4.0 ) {
- direction = direction.xzy;
- direction.xy *= -1.0; // ( -u, -1, v ) neg y
- } else if ( face == 5.0 ) {
- direction.z *= -1.0; // ( u, v, -1 ) neg z
- }
- return direction;
- }
- void main() {
- vOutputDirection = getDirection( uv, faceIndex );
- gl_Position = vec4( position, 1.0 );
- }
- `}function zCe(t){let e=new WeakMap,n=null;function r(l){if(l&&l.isTexture){const c=l.mapping,d=c===N3||c===C3,u=c===Ib||c===zb;if(d||u)if(l.isRenderTargetTexture&&l.needsPMREMUpdate===!0){l.needsPMREMUpdate=!1;let m=e.get(l);return n===null&&(n=new wH(t)),m=d?n.fromEquirectangular(l,m):n.fromCubemap(l,m),e.set(l,m),m.texture}else{if(e.has(l))return e.get(l).texture;{const m=l.image;if(d&&m&&m.height>0||u&&m&&a(m)){n===null&&(n=new wH(t));const p=d?n.fromEquirectangular(l):n.fromCubemap(l);return e.set(l,p),l.addEventListener("dispose",s),p.texture}else return null}}}return l}function a(l){let c=0;const d=6;for(let u=0;u<d;u++)l[u]!==void 0&&c++;return c===d}function s(l){const c=l.target;c.removeEventListener("dispose",s);const d=e.get(c);d!==void 0&&(e.delete(c),d.dispose())}function o(){e=new WeakMap,n!==null&&(n.dispose(),n=null)}return{get:r,dispose:o}}function UCe(t){const e={};function n(r){if(e[r]!==void 0)return e[r];let a;switch(r){case"WEBGL_depth_texture":a=t.getExtension("WEBGL_depth_texture")||t.getExtension("MOZ_WEBGL_depth_texture")||t.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":a=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":a=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":a=t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:a=t.getExtension(r)}return e[r]=a,a}return{has:function(r){return n(r)!==null},init:function(r){r.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(r){const a=n(r);return a===null&&console.warn("THREE.WebGLRenderer: "+r+" extension not supported."),a}}}function BCe(t,e,n,r){const a={},s=new WeakMap;function o(m){const p=m.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 x=p.morphAttributes[y];for(let b=0,v=x.length;b<v;b++)e.remove(x[b])}p.removeEventListener("dispose",o),delete a[p.id];const f=s.get(p);f&&(e.remove(f),s.delete(p)),r.releaseStatesOfGeometry(p),p.isInstancedBufferGeometry===!0&&delete p._maxInstanceCount,n.memory.geometries--}function l(m,p){return a[p.id]===!0||(p.addEventListener("dispose",o),a[p.id]=!0,n.memory.geometries++),p}function c(m){const p=m.attributes;for(const y in p)e.update(p[y],t.ARRAY_BUFFER);const f=m.morphAttributes;for(const y in f){const x=f[y];for(let b=0,v=x.length;b<v;b++)e.update(x[b],t.ARRAY_BUFFER)}}function d(m){const p=[],f=m.index,y=m.attributes.position;let x=0;if(f!==null){const _=f.array;x=f.version;for(let k=0,P=_.length;k<P;k+=3){const C=_[k+0],T=_[k+1],N=_[k+2];p.push(C,T,T,N,N,C)}}else if(y!==void 0){const _=y.array;x=y.version;for(let k=0,P=_.length/3-1;k<P;k+=3){const C=k+0,T=k+1,N=k+2;p.push(C,T,T,N,N,C)}}else return;const b=new(uQ(p)?yQ:xQ)(p,1);b.version=x;const v=s.get(m);v&&e.remove(v),s.set(m,b)}function u(m){const p=s.get(m);if(p){const f=m.index;f!==null&&p.version<f.version&&d(m)}else d(m);return s.get(m)}return{get:l,update:c,getWireframeAttribute:u}}function HCe(t,e,n,r){const a=r.isWebGL2;let s;function o(f){s=f}let l,c;function d(f){l=f.type,c=f.bytesPerElement}function u(f,y){t.drawElements(s,y,l,f*c),n.update(y,s,1)}function m(f,y,x){if(x===0)return;let b,v;if(a)b=t,v="drawElementsInstanced";else if(b=e.get("ANGLE_instanced_arrays"),v="drawElementsInstancedANGLE",b===null){console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}b[v](s,y,l,f*c,x),n.update(y,s,x)}function p(f,y,x){if(x===0)return;const b=e.get("WEBGL_multi_draw");if(b===null)for(let v=0;v<x;v++)this.render(f[v]/c,y[v]);else{b.multiDrawElementsWEBGL(s,y,0,l,f,0,x);let v=0;for(let _=0;_<x;_++)v+=y[_];n.update(v,s,1)}}this.setMode=o,this.setIndex=d,this.render=u,this.renderInstances=m,this.renderMultiDraw=p}function $Ce(t){const e={geometries:0,textures:0},n={frame:0,calls:0,triangles:0,points:0,lines:0};function r(s,o,l){switch(n.calls++,o){case t.TRIANGLES:n.triangles+=l*(s/3);break;case t.LINES:n.lines+=l*(s/2);break;case t.LINE_STRIP:n.lines+=l*(s-1);break;case t.LINE_LOOP:n.lines+=l*s;break;case t.POINTS:n.points+=l*s;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",o);break}}function a(){n.calls=0,n.triangles=0,n.points=0,n.lines=0}return{memory:e,render:n,programs:null,autoReset:!0,reset:a,update:r}}function qCe(t,e){return t[0]-e[0]}function VCe(t,e){return Math.abs(e[1])-Math.abs(t[1])}function GCe(t,e,n){const r={},a=new Float32Array(8),s=new WeakMap,o=new qr,l=[];for(let d=0;d<8;d++)l[d]=[d,0];function c(d,u,m){const p=d.morphTargetInfluences;if(e.isWebGL2===!0){const y=u.morphAttributes.position||u.morphAttributes.normal||u.morphAttributes.color,x=y!==void 0?y.length:0;let b=s.get(u);if(b===void 0||b.count!==x){let te=function(){G.dispose(),s.delete(u),u.removeEventListener("dispose",te)};var f=te;b!==void 0&&b.texture.dispose();const k=u.morphAttributes.position!==void 0,P=u.morphAttributes.normal!==void 0,C=u.morphAttributes.color!==void 0,T=u.morphAttributes.position||[],N=u.morphAttributes.normal||[],R=u.morphAttributes.color||[];let A=0;k===!0&&(A=1),P===!0&&(A=2),C===!0&&(A=3);let D=u.attributes.position.count*A,$=1;D>e.maxTextureSize&&($=Math.ceil(D/e.maxTextureSize),D=e.maxTextureSize);const U=new Float32Array(D*$*4*x),G=new pQ(U,D,$,x);G.type=Wd,G.needsUpdate=!0;const L=A*4;for(let re=0;re<x;re++){const J=T[re],ue=N[re],me=R[re],ge=D*$*4*re;for(let X=0;X<J.count;X++){const ie=X*L;k===!0&&(o.fromBufferAttribute(J,X),U[ge+ie+0]=o.x,U[ge+ie+1]=o.y,U[ge+ie+2]=o.z,U[ge+ie+3]=0),P===!0&&(o.fromBufferAttribute(ue,X),U[ge+ie+4]=o.x,U[ge+ie+5]=o.y,U[ge+ie+6]=o.z,U[ge+ie+7]=0),C===!0&&(o.fromBufferAttribute(me,X),U[ge+ie+8]=o.x,U[ge+ie+9]=o.y,U[ge+ie+10]=o.z,U[ge+ie+11]=me.itemSize===4?o.w:1)}}b={count:x,texture:G,size:new Fn(D,$)},s.set(u,b),u.addEventListener("dispose",te)}let v=0;for(let k=0;k<p.length;k++)v+=p[k];const _=u.morphTargetsRelative?1:1-v;m.getUniforms().setValue(t,"morphTargetBaseInfluence",_),m.getUniforms().setValue(t,"morphTargetInfluences",p),m.getUniforms().setValue(t,"morphTargetsTexture",b.texture,n),m.getUniforms().setValue(t,"morphTargetsTextureSize",b.size)}else{const y=p===void 0?0:p.length;let x=r[u.id];if(x===void 0||x.length!==y){x=[];for(let P=0;P<y;P++)x[P]=[P,0];r[u.id]=x}for(let P=0;P<y;P++){const C=x[P];C[0]=P,C[1]=p[P]}x.sort(VCe);for(let P=0;P<8;P++)P<y&&x[P][1]?(l[P][0]=x[P][0],l[P][1]=x[P][1]):(l[P][0]=Number.MAX_SAFE_INTEGER,l[P][1]=0);l.sort(qCe);const b=u.morphAttributes.position,v=u.morphAttributes.normal;let _=0;for(let P=0;P<8;P++){const C=l[P],T=C[0],N=C[1];T!==Number.MAX_SAFE_INTEGER&&N?(b&&u.getAttribute("morphTarget"+P)!==b[T]&&u.setAttribute("morphTarget"+P,b[T]),v&&u.getAttribute("morphNormal"+P)!==v[T]&&u.setAttribute("morphNormal"+P,v[T]),a[P]=N,_+=N):(b&&u.hasAttribute("morphTarget"+P)===!0&&u.deleteAttribute("morphTarget"+P),v&&u.hasAttribute("morphNormal"+P)===!0&&u.deleteAttribute("morphNormal"+P),a[P]=0)}const k=u.morphTargetsRelative?1:1-_;m.getUniforms().setValue(t,"morphTargetBaseInfluence",k),m.getUniforms().setValue(t,"morphTargetInfluences",a)}}return{update:c}}function WCe(t,e,n,r){let a=new WeakMap;function s(c){const d=r.render.frame,u=c.geometry,m=e.get(c,u);if(a.get(m)!==d&&(e.update(m),a.set(m,d)),c.isInstancedMesh&&(c.hasEventListener("dispose",l)===!1&&c.addEventListener("dispose",l),a.get(c)!==d&&(n.update(c.instanceMatrix,t.ARRAY_BUFFER),c.instanceColor!==null&&n.update(c.instanceColor,t.ARRAY_BUFFER),a.set(c,d))),c.isSkinnedMesh){const p=c.skeleton;a.get(p)!==d&&(p.update(),a.set(p,d))}return m}function o(){a=new WeakMap}function l(c){const d=c.target;d.removeEventListener("dispose",l),n.remove(d.instanceMatrix),d.instanceColor!==null&&n.remove(d.instanceColor)}return{update:s,dispose:o}}class kQ extends oo{constructor(e,n,r,a,s,o,l,c,d,u){if(u=u!==void 0?u:Pp,u!==Pp&&u!==Ub)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");r===void 0&&u===Pp&&(r=jm),r===void 0&&u===Ub&&(r=Tp),super(null,a,s,o,l,c,u,r,d),this.isDepthTexture=!0,this.image={width:e,height:n},this.magFilter=l!==void 0?l:Xa,this.minFilter=c!==void 0?c:Xa,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 NQ=new oo,CQ=new kQ(1,1);CQ.compareFunction=cQ;const TQ=new pQ,PQ=new E1e,AQ=new SQ,NH=[],CH=[],TH=new Float32Array(16),PH=new Float32Array(9),AH=new Float32Array(4);function fx(t,e,n){const r=t[0];if(r<=0||r>0)return t;const a=e*n;let s=NH[a];if(s===void 0&&(s=new Float32Array(a),NH[a]=s),e!==0){r.toArray(s,0);for(let o=1,l=0;o!==e;++o)l+=n,t[o].toArray(s,l)}return s}function ba(t,e){if(t.length!==e.length)return!1;for(let n=0,r=t.length;n<r;n++)if(t[n]!==e[n])return!1;return!0}function xa(t,e){for(let n=0,r=e.length;n<r;n++)t[n]=e[n]}function PC(t,e){let n=CH[e];n===void 0&&(n=new Int32Array(e),CH[e]=n);for(let r=0;r!==e;++r)n[r]=t.allocateTextureUnit();return n}function KCe(t,e){const n=this.cache;n[0]!==e&&(t.uniform1f(this.addr,e),n[0]=e)}function YCe(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(ba(n,e))return;t.uniform2fv(this.addr,e),xa(n,e)}}function XCe(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(ba(n,e))return;t.uniform3fv(this.addr,e),xa(n,e)}}function QCe(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(ba(n,e))return;t.uniform4fv(this.addr,e),xa(n,e)}}function ZCe(t,e){const n=this.cache,r=e.elements;if(r===void 0){if(ba(n,e))return;t.uniformMatrix2fv(this.addr,!1,e),xa(n,e)}else{if(ba(n,r))return;AH.set(r),t.uniformMatrix2fv(this.addr,!1,AH),xa(n,r)}}function JCe(t,e){const n=this.cache,r=e.elements;if(r===void 0){if(ba(n,e))return;t.uniformMatrix3fv(this.addr,!1,e),xa(n,e)}else{if(ba(n,r))return;PH.set(r),t.uniformMatrix3fv(this.addr,!1,PH),xa(n,r)}}function eTe(t,e){const n=this.cache,r=e.elements;if(r===void 0){if(ba(n,e))return;t.uniformMatrix4fv(this.addr,!1,e),xa(n,e)}else{if(ba(n,r))return;TH.set(r),t.uniformMatrix4fv(this.addr,!1,TH),xa(n,r)}}function tTe(t,e){const n=this.cache;n[0]!==e&&(t.uniform1i(this.addr,e),n[0]=e)}function nTe(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(ba(n,e))return;t.uniform2iv(this.addr,e),xa(n,e)}}function rTe(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(ba(n,e))return;t.uniform3iv(this.addr,e),xa(n,e)}}function iTe(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(ba(n,e))return;t.uniform4iv(this.addr,e),xa(n,e)}}function aTe(t,e){const n=this.cache;n[0]!==e&&(t.uniform1ui(this.addr,e),n[0]=e)}function sTe(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(ba(n,e))return;t.uniform2uiv(this.addr,e),xa(n,e)}}function oTe(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(ba(n,e))return;t.uniform3uiv(this.addr,e),xa(n,e)}}function lTe(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(ba(n,e))return;t.uniform4uiv(this.addr,e),xa(n,e)}}function cTe(t,e,n){const r=this.cache,a=n.allocateTextureUnit();r[0]!==a&&(t.uniform1i(this.addr,a),r[0]=a);const s=this.type===t.SAMPLER_2D_SHADOW?CQ:NQ;n.setTexture2D(e||s,a)}function dTe(t,e,n){const r=this.cache,a=n.allocateTextureUnit();r[0]!==a&&(t.uniform1i(this.addr,a),r[0]=a),n.setTexture3D(e||PQ,a)}function uTe(t,e,n){const r=this.cache,a=n.allocateTextureUnit();r[0]!==a&&(t.uniform1i(this.addr,a),r[0]=a),n.setTextureCube(e||AQ,a)}function mTe(t,e,n){const r=this.cache,a=n.allocateTextureUnit();r[0]!==a&&(t.uniform1i(this.addr,a),r[0]=a),n.setTexture2DArray(e||TQ,a)}function hTe(t){switch(t){case 5126:return KCe;case 35664:return YCe;case 35665:return XCe;case 35666:return QCe;case 35674:return ZCe;case 35675:return JCe;case 35676:return eTe;case 5124:case 35670:return tTe;case 35667:case 35671:return nTe;case 35668:case 35672:return rTe;case 35669:case 35673:return iTe;case 5125:return aTe;case 36294:return sTe;case 36295:return oTe;case 36296:return lTe;case 35678:case 36198:case 36298:case 36306:case 35682:return cTe;case 35679:case 36299:case 36307:return dTe;case 35680:case 36300:case 36308:case 36293:return uTe;case 36289:case 36303:case 36311:case 36292:return mTe}}function pTe(t,e){t.uniform1fv(this.addr,e)}function fTe(t,e){const n=fx(e,this.size,2);t.uniform2fv(this.addr,n)}function gTe(t,e){const n=fx(e,this.size,3);t.uniform3fv(this.addr,n)}function bTe(t,e){const n=fx(e,this.size,4);t.uniform4fv(this.addr,n)}function xTe(t,e){const n=fx(e,this.size,4);t.uniformMatrix2fv(this.addr,!1,n)}function yTe(t,e){const n=fx(e,this.size,9);t.uniformMatrix3fv(this.addr,!1,n)}function vTe(t,e){const n=fx(e,this.size,16);t.uniformMatrix4fv(this.addr,!1,n)}function wTe(t,e){t.uniform1iv(this.addr,e)}function STe(t,e){t.uniform2iv(this.addr,e)}function _Te(t,e){t.uniform3iv(this.addr,e)}function kTe(t,e){t.uniform4iv(this.addr,e)}function NTe(t,e){t.uniform1uiv(this.addr,e)}function CTe(t,e){t.uniform2uiv(this.addr,e)}function TTe(t,e){t.uniform3uiv(this.addr,e)}function PTe(t,e){t.uniform4uiv(this.addr,e)}function ATe(t,e,n){const r=this.cache,a=e.length,s=PC(n,a);ba(r,s)||(t.uniform1iv(this.addr,s),xa(r,s));for(let o=0;o!==a;++o)n.setTexture2D(e[o]||NQ,s[o])}function MTe(t,e,n){const r=this.cache,a=e.length,s=PC(n,a);ba(r,s)||(t.uniform1iv(this.addr,s),xa(r,s));for(let o=0;o!==a;++o)n.setTexture3D(e[o]||PQ,s[o])}function ETe(t,e,n){const r=this.cache,a=e.length,s=PC(n,a);ba(r,s)||(t.uniform1iv(this.addr,s),xa(r,s));for(let o=0;o!==a;++o)n.setTextureCube(e[o]||AQ,s[o])}function jTe(t,e,n){const r=this.cache,a=e.length,s=PC(n,a);ba(r,s)||(t.uniform1iv(this.addr,s),xa(r,s));for(let o=0;o!==a;++o)n.setTexture2DArray(e[o]||TQ,s[o])}function DTe(t){switch(t){case 5126:return pTe;case 35664:return fTe;case 35665:return gTe;case 35666:return bTe;case 35674:return xTe;case 35675:return yTe;case 35676:return vTe;case 5124:case 35670:return wTe;case 35667:case 35671:return STe;case 35668:case 35672:return _Te;case 35669:case 35673:return kTe;case 5125:return NTe;case 36294:return CTe;case 36295:return TTe;case 36296:return PTe;case 35678:case 36198:case 36298:case 36306:case 35682:return ATe;case 35679:case 36299:case 36307:return MTe;case 35680:case 36300:case 36308:case 36293:return ETe;case 36289:case 36303:case 36311:case 36292:return jTe}}class RTe{constructor(e,n,r){this.id=e,this.addr=r,this.cache=[],this.type=n.type,this.setValue=hTe(n.type)}}class FTe{constructor(e,n,r){this.id=e,this.addr=r,this.cache=[],this.type=n.type,this.size=n.size,this.setValue=DTe(n.type)}}class LTe{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,n,r){const a=this.seq;for(let s=0,o=a.length;s!==o;++s){const l=a[s];l.setValue(e,n[l.id],r)}}}const m2=/(\w+)(\])?(\[|\.)?/g;function MH(t,e){t.seq.push(e),t.map[e.id]=e}function OTe(t,e,n){const r=t.name,a=r.length;for(m2.lastIndex=0;;){const s=m2.exec(r),o=m2.lastIndex;let l=s[1];const c=s[2]==="]",d=s[3];if(c&&(l=l|0),d===void 0||d==="["&&o+2===a){MH(n,d===void 0?new RTe(l,t,e):new FTe(l,t,e));break}else{let m=n.map[l];m===void 0&&(m=new LTe(l),MH(n,m)),n=m}}}class y1{constructor(e,n){this.seq=[],this.map={};const r=e.getProgramParameter(n,e.ACTIVE_UNIFORMS);for(let a=0;a<r;++a){const s=e.getActiveUniform(n,a),o=e.getUniformLocation(n,s.name);OTe(s,o,this)}}setValue(e,n,r,a){const s=this.map[n];s!==void 0&&s.setValue(e,r,a)}setOptional(e,n,r){const a=n[r];a!==void 0&&this.setValue(e,r,a)}static upload(e,n,r,a){for(let s=0,o=n.length;s!==o;++s){const l=n[s],c=r[l.id];c.needsUpdate!==!1&&l.setValue(e,c.value,a)}}static seqWithValue(e,n){const r=[];for(let a=0,s=e.length;a!==s;++a){const o=e[a];o.id in n&&r.push(o)}return r}}function EH(t,e,n){const r=t.createShader(e);return t.shaderSource(r,n),t.compileShader(r),r}const ITe=37297;let zTe=0;function UTe(t,e){const n=t.split(`
- `),r=[],a=Math.max(e-6,0),s=Math.min(e+6,n.length);for(let o=a;o<s;o++){const l=o+1;r.push(`${l===e?">":" "} ${l}: ${n[o]}`)}return r.join(`
- `)}function BTe(t){const e=Hr.getPrimaries(Hr.workingColorSpace),n=Hr.getPrimaries(t);let r;switch(e===n?r="":e===rk&&n===nk?r="LinearDisplayP3ToLinearSRGB":e===nk&&n===rk&&(r="LinearSRGBToLinearDisplayP3"),t){case hu:case CC:return[r,"LinearTransferOETF"];case Qa:case vL:return[r,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",t),[r,"LinearTransferOETF"]}}function jH(t,e,n){const r=t.getShaderParameter(e,t.COMPILE_STATUS),a=t.getShaderInfoLog(e).trim();if(r&&a==="")return"";const s=/ERROR: 0:(\d+)/.exec(a);if(s){const o=parseInt(s[1]);return n.toUpperCase()+`
- `+a+`
- `+UTe(t.getShaderSource(e),o)}else return a}function HTe(t,e){const n=BTe(e);return`vec4 ${t}( vec4 value ) { return ${n[0]}( ${n[1]}( value ) ); }`}function $Te(t,e){let n;switch(e){case H_e:n="Linear";break;case $_e:n="Reinhard";break;case q_e:n="OptimizedCineon";break;case V_e:n="ACESFilmic";break;case G_e:n="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),n="Linear"}return"vec3 "+t+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}function qTe(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(Gy).join(`
- `)}function VTe(t){const e=[];for(const n in t){const r=t[n];r!==!1&&e.push("#define "+n+" "+r)}return e.join(`
- `)}function GTe(t,e){const n={},r=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES);for(let a=0;a<r;a++){const s=t.getActiveAttrib(e,a),o=s.name;let l=1;s.type===t.FLOAT_MAT2&&(l=2),s.type===t.FLOAT_MAT3&&(l=3),s.type===t.FLOAT_MAT4&&(l=4),n[o]={type:s.type,location:t.getAttribLocation(e,o),locationSize:l}}return n}function Gy(t){return t!==""}function DH(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 RH(t,e){return t.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const WTe=/^[ \t]*#include +<([\w\d./]+)>/gm;function j3(t){return t.replace(WTe,YTe)}const KTe=new Map([["encodings_fragment","colorspace_fragment"],["encodings_pars_fragment","colorspace_pars_fragment"],["output_fragment","opaque_fragment"]]);function YTe(t,e){let n=Vn[e];if(n===void 0){const r=KTe.get(e);if(r!==void 0)n=Vn[r],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,r);else throw new Error("Can not resolve #include <"+e+">")}return j3(n)}const XTe=/#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 FH(t){return t.replace(XTe,QTe)}function QTe(t,e,n,r){let a="";for(let s=parseInt(e);s<parseInt(n);s++)a+=r.replace(/\[\s*i\s*\]/g,"[ "+s+" ]").replace(/UNROLLED_LOOP_INDEX/g,s);return a}function LH(t){let e="precision "+t.precision+` float;
- precision `+t.precision+" int;";return t.precision==="highp"?e+=`
- #define HIGH_PRECISION`:t.precision==="mediump"?e+=`
- #define MEDIUM_PRECISION`:t.precision==="lowp"&&(e+=`
- #define LOW_PRECISION`),e}function ZTe(t){let e="SHADOWMAP_TYPE_BASIC";return t.shadowMapType===ZX?e="SHADOWMAP_TYPE_PCF":t.shadowMapType===g_e?e="SHADOWMAP_TYPE_PCF_SOFT":t.shadowMapType===Od&&(e="SHADOWMAP_TYPE_VSM"),e}function JTe(t){let e="ENVMAP_TYPE_CUBE";if(t.envMap)switch(t.envMapMode){case Ib:case zb:e="ENVMAP_TYPE_CUBE";break;case NC:e="ENVMAP_TYPE_CUBE_UV";break}return e}function ePe(t){let e="ENVMAP_MODE_REFLECTION";return t.envMap&&t.envMapMode===zb&&(e="ENVMAP_MODE_REFRACTION"),e}function tPe(t){let e="ENVMAP_BLENDING_NONE";if(t.envMap)switch(t.combine){case xL:e="ENVMAP_BLENDING_MULTIPLY";break;case U_e:e="ENVMAP_BLENDING_MIX";break;case B_e:e="ENVMAP_BLENDING_ADD";break}return e}function nPe(t){const e=t.envMapCubeUVHeight;if(e===null)return null;const n=Math.log2(e)-2,r=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,n),112)),texelHeight:r,maxMip:n}}function rPe(t,e,n,r){const a=t.getContext(),s=n.defines;let o=n.vertexShader,l=n.fragmentShader;const c=ZTe(n),d=JTe(n),u=ePe(n),m=tPe(n),p=nPe(n),f=n.isWebGL2?"":qTe(n),y=VTe(s),x=a.createProgram();let b,v,_=n.glslVersion?"#version "+n.glslVersion+`
- `:"";n.isRawShaderMaterial?(b=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,y].filter(Gy).join(`
- `),b.length>0&&(b+=`
- `),v=[f,"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,y].filter(Gy).join(`
- `),v.length>0&&(v+=`
- `)):(b=[LH(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 "+u:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.displacementMap?"#define USE_DISPLACEMENTMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.mapUv?"#define MAP_UV "+n.mapUv:"",n.alphaMapUv?"#define ALPHAMAP_UV "+n.alphaMapUv:"",n.lightMapUv?"#define LIGHTMAP_UV "+n.lightMapUv:"",n.aoMapUv?"#define AOMAP_UV "+n.aoMapUv:"",n.emissiveMapUv?"#define EMISSIVEMAP_UV "+n.emissiveMapUv:"",n.bumpMapUv?"#define BUMPMAP_UV "+n.bumpMapUv:"",n.normalMapUv?"#define NORMALMAP_UV "+n.normalMapUv:"",n.displacementMapUv?"#define DISPLACEMENTMAP_UV "+n.displacementMapUv:"",n.metalnessMapUv?"#define METALNESSMAP_UV "+n.metalnessMapUv:"",n.roughnessMapUv?"#define ROUGHNESSMAP_UV "+n.roughnessMapUv:"",n.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+n.anisotropyMapUv:"",n.clearcoatMapUv?"#define CLEARCOATMAP_UV "+n.clearcoatMapUv:"",n.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+n.clearcoatNormalMapUv:"",n.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+n.clearcoatRoughnessMapUv:"",n.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+n.iridescenceMapUv:"",n.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+n.iridescenceThicknessMapUv:"",n.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+n.sheenColorMapUv:"",n.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+n.sheenRoughnessMapUv:"",n.specularMapUv?"#define SPECULARMAP_UV "+n.specularMapUv:"",n.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+n.specularColorMapUv:"",n.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+n.specularIntensityMapUv:"",n.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+n.transmissionMapUv:"",n.thicknessMapUv?"#define THICKNESSMAP_UV "+n.thicknessMapUv:"",n.vertexTangents&&n.flatShading===!1?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&n.flatShading===!1?"#define USE_MORPHNORMALS":"",n.morphColors&&n.isWebGL2?"#define USE_MORPHCOLORS":"",n.morphTargetsCount>0&&n.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",n.morphTargetsCount>0&&n.isWebGL2?"#define MORPHTARGETS_TEXTURE_STRIDE "+n.morphTextureStride:"",n.morphTargetsCount>0&&n.isWebGL2?"#define MORPHTARGETS_COUNT "+n.morphTargetsCount:"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+c:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.useLegacyLights?"#define LEGACY_LIGHTS":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )"," attribute vec3 morphTarget0;"," attribute vec3 morphTarget1;"," attribute vec3 morphTarget2;"," attribute vec3 morphTarget3;"," #ifdef USE_MORPHNORMALS"," attribute vec3 morphNormal0;"," attribute vec3 morphNormal1;"," attribute vec3 morphNormal2;"," attribute vec3 morphNormal3;"," #else"," attribute vec3 morphTarget4;"," attribute vec3 morphTarget5;"," attribute vec3 morphTarget6;"," attribute vec3 morphTarget7;"," #endif","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",`
- `].filter(Gy).join(`
- `),v=[f,LH(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 "+d:"",n.envMap?"#define "+u:"",n.envMap?"#define "+m:"",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 "+c:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.useLegacyLights?"#define LEGACY_LIGHTS":"",n.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",n.toneMapping!==Ym?"#define TONE_MAPPING":"",n.toneMapping!==Ym?Vn.tonemapping_pars_fragment:"",n.toneMapping!==Ym?$Te("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",Vn.colorspace_pars_fragment,HTe("linearToOutputTexel",n.outputColorSpace),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"",`
- `].filter(Gy).join(`
- `)),o=j3(o),o=DH(o,n),o=RH(o,n),l=j3(l),l=DH(l,n),l=RH(l,n),o=FH(o),l=FH(l),n.isWebGL2&&n.isRawShaderMaterial!==!0&&(_=`#version 300 es
- `,b=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join(`
- `)+`
- `+b,v=["precision mediump sampler2DArray;","#define varying in",n.glslVersion===eH?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===eH?"":"#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(`
- `)+`
- `+v);const k=_+b+o,P=_+v+l,C=EH(a,a.VERTEX_SHADER,k),T=EH(a,a.FRAGMENT_SHADER,P);a.attachShader(x,C),a.attachShader(x,T),n.index0AttributeName!==void 0?a.bindAttribLocation(x,0,n.index0AttributeName):n.morphTargets===!0&&a.bindAttribLocation(x,0,"position"),a.linkProgram(x);function N($){if(t.debug.checkShaderErrors){const U=a.getProgramInfoLog(x).trim(),G=a.getShaderInfoLog(C).trim(),L=a.getShaderInfoLog(T).trim();let te=!0,re=!0;if(a.getProgramParameter(x,a.LINK_STATUS)===!1)if(te=!1,typeof t.debug.onShaderError=="function")t.debug.onShaderError(a,x,C,T);else{const J=jH(a,C,"vertex"),ue=jH(a,T,"fragment");console.error("THREE.WebGLProgram: Shader Error "+a.getError()+" - VALIDATE_STATUS "+a.getProgramParameter(x,a.VALIDATE_STATUS)+`
- Program Info Log: `+U+`
- `+J+`
- `+ue)}else U!==""?console.warn("THREE.WebGLProgram: Program Info Log:",U):(G===""||L==="")&&(re=!1);re&&($.diagnostics={runnable:te,programLog:U,vertexShader:{log:G,prefix:b},fragmentShader:{log:L,prefix:v}})}a.deleteShader(C),a.deleteShader(T),R=new y1(a,x),A=GTe(a,x)}let R;this.getUniforms=function(){return R===void 0&&N(this),R};let A;this.getAttributes=function(){return A===void 0&&N(this),A};let D=n.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return D===!1&&(D=a.getProgramParameter(x,ITe)),D},this.destroy=function(){r.releaseStatesOfProgram(this),a.deleteProgram(x),this.program=void 0},this.type=n.shaderType,this.name=n.shaderName,this.id=zTe++,this.cacheKey=e,this.usedTimes=1,this.program=x,this.vertexShader=C,this.fragmentShader=T,this}let iPe=0;class aPe{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const n=e.vertexShader,r=e.fragmentShader,a=this._getShaderStage(n),s=this._getShaderStage(r),o=this._getShaderCacheForMaterial(e);return o.has(a)===!1&&(o.add(a),a.usedTimes++),o.has(s)===!1&&(o.add(s),s.usedTimes++),this}remove(e){const n=this.materialCache.get(e);for(const r of n)r.usedTimes--,r.usedTimes===0&&this.shaderCache.delete(r.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const n=this.materialCache;let r=n.get(e);return r===void 0&&(r=new Set,n.set(e,r)),r}_getShaderStage(e){const n=this.shaderCache;let r=n.get(e);return r===void 0&&(r=new sPe(e),n.set(e,r)),r}}class sPe{constructor(e){this.id=iPe++,this.code=e,this.usedTimes=0}}function oPe(t,e,n,r,a,s,o){const l=new fQ,c=new aPe,d=[],u=a.isWebGL2,m=a.logarithmicDepthBuffer,p=a.vertexTextures;let f=a.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 x(A){return A===0?"uv":`uv${A}`}function b(A,D,$,U,G){const L=U.fog,te=G.geometry,re=A.isMeshStandardMaterial?U.environment:null,J=(A.isMeshStandardMaterial?n:e).get(A.envMap||re),ue=J&&J.mapping===NC?J.image.height:null,me=y[A.type];A.precision!==null&&(f=a.getMaxPrecision(A.precision),f!==A.precision&&console.warn("THREE.WebGLProgram.getParameters:",A.precision,"not supported, using",f,"instead."));const ge=te.morphAttributes.position||te.morphAttributes.normal||te.morphAttributes.color,X=ge!==void 0?ge.length:0;let ie=0;te.morphAttributes.position!==void 0&&(ie=1),te.morphAttributes.normal!==void 0&&(ie=2),te.morphAttributes.color!==void 0&&(ie=3);let le,pe,Ce,q;if(me){const ot=eo[me];le=ot.vertexShader,pe=ot.fragmentShader}else le=A.vertexShader,pe=A.fragmentShader,c.update(A),Ce=c.getVertexShaderID(A),q=c.getFragmentShaderID(A);const Z=t.getRenderTarget(),j=G.isInstancedMesh===!0,E=G.isBatchedMesh===!0,I=!!A.map,W=!!A.matcap,B=!!J,ae=!!A.aoMap,z=!!A.lightMap,V=!!A.bumpMap,ee=!!A.normalMap,K=!!A.displacementMap,ne=!!A.emissiveMap,se=!!A.metalnessMap,ce=!!A.roughnessMap,fe=A.anisotropy>0,oe=A.clearcoat>0,O=A.iridescence>0,F=A.sheen>0,Q=A.transmission>0,ve=fe&&!!A.anisotropyMap,he=oe&&!!A.clearcoatMap,de=oe&&!!A.clearcoatNormalMap,Ae=oe&&!!A.clearcoatRoughnessMap,_e=O&&!!A.iridescenceMap,ze=O&&!!A.iridescenceThicknessMap,Be=F&&!!A.sheenColorMap,Ue=F&&!!A.sheenRoughnessMap,Ne=!!A.specularMap,Ee=!!A.specularColorMap,ke=!!A.specularIntensityMap,Me=Q&&!!A.transmissionMap,Ge=Q&&!!A.thicknessMap,xe=!!A.gradientMap,He=!!A.alphaMap,Pe=A.alphaTest>0,Ve=!!A.alphaHash,je=!!A.extensions,ye=!!te.attributes.uv1,$e=!!te.attributes.uv2,Ye=!!te.attributes.uv3;let lt=Ym;return A.toneMapped&&(Z===null||Z.isXRRenderTarget===!0)&&(lt=t.toneMapping),{isWebGL2:u,shaderID:me,shaderType:A.type,shaderName:A.name,vertexShader:le,fragmentShader:pe,defines:A.defines,customVertexShaderID:Ce,customFragmentShaderID:q,isRawShaderMaterial:A.isRawShaderMaterial===!0,glslVersion:A.glslVersion,precision:f,batching:E,instancing:j,instancingColor:j&&G.instanceColor!==null,supportsVertexTextures:p,outputColorSpace:Z===null?t.outputColorSpace:Z.isXRRenderTarget===!0?Z.texture.colorSpace:hu,map:I,matcap:W,envMap:B,envMapMode:B&&J.mapping,envMapCubeUVHeight:ue,aoMap:ae,lightMap:z,bumpMap:V,normalMap:ee,displacementMap:p&&K,emissiveMap:ne,normalMapObjectSpace:ee&&A.normalMapType===i1e,normalMapTangentSpace:ee&&A.normalMapType===lQ,metalnessMap:se,roughnessMap:ce,anisotropy:fe,anisotropyMap:ve,clearcoat:oe,clearcoatMap:he,clearcoatNormalMap:de,clearcoatRoughnessMap:Ae,iridescence:O,iridescenceMap:_e,iridescenceThicknessMap:ze,sheen:F,sheenColorMap:Be,sheenRoughnessMap:Ue,specularMap:Ne,specularColorMap:Ee,specularIntensityMap:ke,transmission:Q,transmissionMap:Me,thicknessMap:Ge,gradientMap:xe,opaque:A.transparent===!1&&A.blending===xb,alphaMap:He,alphaTest:Pe,alphaHash:Ve,combine:A.combine,mapUv:I&&x(A.map.channel),aoMapUv:ae&&x(A.aoMap.channel),lightMapUv:z&&x(A.lightMap.channel),bumpMapUv:V&&x(A.bumpMap.channel),normalMapUv:ee&&x(A.normalMap.channel),displacementMapUv:K&&x(A.displacementMap.channel),emissiveMapUv:ne&&x(A.emissiveMap.channel),metalnessMapUv:se&&x(A.metalnessMap.channel),roughnessMapUv:ce&&x(A.roughnessMap.channel),anisotropyMapUv:ve&&x(A.anisotropyMap.channel),clearcoatMapUv:he&&x(A.clearcoatMap.channel),clearcoatNormalMapUv:de&&x(A.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Ae&&x(A.clearcoatRoughnessMap.channel),iridescenceMapUv:_e&&x(A.iridescenceMap.channel),iridescenceThicknessMapUv:ze&&x(A.iridescenceThicknessMap.channel),sheenColorMapUv:Be&&x(A.sheenColorMap.channel),sheenRoughnessMapUv:Ue&&x(A.sheenRoughnessMap.channel),specularMapUv:Ne&&x(A.specularMap.channel),specularColorMapUv:Ee&&x(A.specularColorMap.channel),specularIntensityMapUv:ke&&x(A.specularIntensityMap.channel),transmissionMapUv:Me&&x(A.transmissionMap.channel),thicknessMapUv:Ge&&x(A.thicknessMap.channel),alphaMapUv:He&&x(A.alphaMap.channel),vertexTangents:!!te.attributes.tangent&&(ee||fe),vertexColors:A.vertexColors,vertexAlphas:A.vertexColors===!0&&!!te.attributes.color&&te.attributes.color.itemSize===4,vertexUv1s:ye,vertexUv2s:$e,vertexUv3s:Ye,pointsUvs:G.isPoints===!0&&!!te.attributes.uv&&(I||He),fog:!!L,useFog:A.fog===!0,fogExp2:L&&L.isFogExp2,flatShading:A.flatShading===!0,sizeAttenuation:A.sizeAttenuation===!0,logarithmicDepthBuffer:m,skinning:G.isSkinnedMesh===!0,morphTargets:te.morphAttributes.position!==void 0,morphNormals:te.morphAttributes.normal!==void 0,morphColors:te.morphAttributes.color!==void 0,morphTargetsCount:X,morphTextureStride:ie,numDirLights:D.directional.length,numPointLights:D.point.length,numSpotLights:D.spot.length,numSpotLightMaps:D.spotLightMap.length,numRectAreaLights:D.rectArea.length,numHemiLights:D.hemi.length,numDirLightShadows:D.directionalShadowMap.length,numPointLightShadows:D.pointShadowMap.length,numSpotLightShadows:D.spotShadowMap.length,numSpotLightShadowsWithMaps:D.numSpotLightShadowsWithMaps,numLightProbes:D.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:A.dithering,shadowMapEnabled:t.shadowMap.enabled&&$.length>0,shadowMapType:t.shadowMap.type,toneMapping:lt,useLegacyLights:t._useLegacyLights,decodeVideoTexture:I&&A.map.isVideoTexture===!0&&Hr.getTransfer(A.map.colorSpace)===si,premultipliedAlpha:A.premultipliedAlpha,doubleSided:A.side===Bd,flipSided:A.side===so,useDepthPacking:A.depthPacking>=0,depthPacking:A.depthPacking||0,index0AttributeName:A.index0AttributeName,extensionDerivatives:je&&A.extensions.derivatives===!0,extensionFragDepth:je&&A.extensions.fragDepth===!0,extensionDrawBuffers:je&&A.extensions.drawBuffers===!0,extensionShaderTextureLOD:je&&A.extensions.shaderTextureLOD===!0,rendererExtensionFragDepth:u||r.has("EXT_frag_depth"),rendererExtensionDrawBuffers:u||r.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:u||r.has("EXT_shader_texture_lod"),rendererExtensionParallelShaderCompile:r.has("KHR_parallel_shader_compile"),customProgramCacheKey:A.customProgramCacheKey()}}function v(A){const D=[];if(A.shaderID?D.push(A.shaderID):(D.push(A.customVertexShaderID),D.push(A.customFragmentShaderID)),A.defines!==void 0)for(const $ in A.defines)D.push($),D.push(A.defines[$]);return A.isRawShaderMaterial===!1&&(_(D,A),k(D,A),D.push(t.outputColorSpace)),D.push(A.customProgramCacheKey),D.join()}function _(A,D){A.push(D.precision),A.push(D.outputColorSpace),A.push(D.envMapMode),A.push(D.envMapCubeUVHeight),A.push(D.mapUv),A.push(D.alphaMapUv),A.push(D.lightMapUv),A.push(D.aoMapUv),A.push(D.bumpMapUv),A.push(D.normalMapUv),A.push(D.displacementMapUv),A.push(D.emissiveMapUv),A.push(D.metalnessMapUv),A.push(D.roughnessMapUv),A.push(D.anisotropyMapUv),A.push(D.clearcoatMapUv),A.push(D.clearcoatNormalMapUv),A.push(D.clearcoatRoughnessMapUv),A.push(D.iridescenceMapUv),A.push(D.iridescenceThicknessMapUv),A.push(D.sheenColorMapUv),A.push(D.sheenRoughnessMapUv),A.push(D.specularMapUv),A.push(D.specularColorMapUv),A.push(D.specularIntensityMapUv),A.push(D.transmissionMapUv),A.push(D.thicknessMapUv),A.push(D.combine),A.push(D.fogExp2),A.push(D.sizeAttenuation),A.push(D.morphTargetsCount),A.push(D.morphAttributeCount),A.push(D.numDirLights),A.push(D.numPointLights),A.push(D.numSpotLights),A.push(D.numSpotLightMaps),A.push(D.numHemiLights),A.push(D.numRectAreaLights),A.push(D.numDirLightShadows),A.push(D.numPointLightShadows),A.push(D.numSpotLightShadows),A.push(D.numSpotLightShadowsWithMaps),A.push(D.numLightProbes),A.push(D.shadowMapType),A.push(D.toneMapping),A.push(D.numClippingPlanes),A.push(D.numClipIntersection),A.push(D.depthPacking)}function k(A,D){l.disableAll(),D.isWebGL2&&l.enable(0),D.supportsVertexTextures&&l.enable(1),D.instancing&&l.enable(2),D.instancingColor&&l.enable(3),D.matcap&&l.enable(4),D.envMap&&l.enable(5),D.normalMapObjectSpace&&l.enable(6),D.normalMapTangentSpace&&l.enable(7),D.clearcoat&&l.enable(8),D.iridescence&&l.enable(9),D.alphaTest&&l.enable(10),D.vertexColors&&l.enable(11),D.vertexAlphas&&l.enable(12),D.vertexUv1s&&l.enable(13),D.vertexUv2s&&l.enable(14),D.vertexUv3s&&l.enable(15),D.vertexTangents&&l.enable(16),D.anisotropy&&l.enable(17),D.alphaHash&&l.enable(18),D.batching&&l.enable(19),A.push(l.mask),l.disableAll(),D.fog&&l.enable(0),D.useFog&&l.enable(1),D.flatShading&&l.enable(2),D.logarithmicDepthBuffer&&l.enable(3),D.skinning&&l.enable(4),D.morphTargets&&l.enable(5),D.morphNormals&&l.enable(6),D.morphColors&&l.enable(7),D.premultipliedAlpha&&l.enable(8),D.shadowMapEnabled&&l.enable(9),D.useLegacyLights&&l.enable(10),D.doubleSided&&l.enable(11),D.flipSided&&l.enable(12),D.useDepthPacking&&l.enable(13),D.dithering&&l.enable(14),D.transmission&&l.enable(15),D.sheen&&l.enable(16),D.opaque&&l.enable(17),D.pointsUvs&&l.enable(18),D.decodeVideoTexture&&l.enable(19),A.push(l.mask)}function P(A){const D=y[A.type];let $;if(D){const U=eo[D];$=_L.clone(U.uniforms)}else $=A.uniforms;return $}function C(A,D){let $;for(let U=0,G=d.length;U<G;U++){const L=d[U];if(L.cacheKey===D){$=L,++$.usedTimes;break}}return $===void 0&&($=new rPe(t,D,A,s),d.push($)),$}function T(A){if(--A.usedTimes===0){const D=d.indexOf(A);d[D]=d[d.length-1],d.pop(),A.destroy()}}function N(A){c.remove(A)}function R(){c.dispose()}return{getParameters:b,getProgramCacheKey:v,getUniforms:P,acquireProgram:C,releaseProgram:T,releaseShaderCache:N,programs:d,dispose:R}}function lPe(){let t=new WeakMap;function e(s){let o=t.get(s);return o===void 0&&(o={},t.set(s,o)),o}function n(s){t.delete(s)}function r(s,o,l){t.get(s)[o]=l}function a(){t=new WeakMap}return{get:e,remove:n,update:r,dispose:a}}function cPe(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 OH(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 IH(){const t=[];let e=0;const n=[],r=[],a=[];function s(){e=0,n.length=0,r.length=0,a.length=0}function o(m,p,f,y,x,b){let v=t[e];return v===void 0?(v={id:m.id,object:m,geometry:p,material:f,groupOrder:y,renderOrder:m.renderOrder,z:x,group:b},t[e]=v):(v.id=m.id,v.object=m,v.geometry=p,v.material=f,v.groupOrder=y,v.renderOrder=m.renderOrder,v.z=x,v.group=b),e++,v}function l(m,p,f,y,x,b){const v=o(m,p,f,y,x,b);f.transmission>0?r.push(v):f.transparent===!0?a.push(v):n.push(v)}function c(m,p,f,y,x,b){const v=o(m,p,f,y,x,b);f.transmission>0?r.unshift(v):f.transparent===!0?a.unshift(v):n.unshift(v)}function d(m,p){n.length>1&&n.sort(m||cPe),r.length>1&&r.sort(p||OH),a.length>1&&a.sort(p||OH)}function u(){for(let m=e,p=t.length;m<p;m++){const f=t[m];if(f.id===null)break;f.id=null,f.object=null,f.geometry=null,f.material=null,f.group=null}}return{opaque:n,transmissive:r,transparent:a,init:s,push:l,unshift:c,finish:u,sort:d}}function dPe(){let t=new WeakMap;function e(r,a){const s=t.get(r);let o;return s===void 0?(o=new IH,t.set(r,[o])):a>=s.length?(o=new IH,s.push(o)):o=s[a],o}function n(){t=new WeakMap}return{get:e,dispose:n}}function uPe(){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 rt,color:new yn};break;case"SpotLight":n={position:new rt,direction:new rt,color:new yn,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new rt,color:new yn,distance:0,decay:0};break;case"HemisphereLight":n={direction:new rt,skyColor:new yn,groundColor:new yn};break;case"RectAreaLight":n={color:new yn,position:new rt,halfWidth:new rt,halfHeight:new rt};break}return t[e.id]=n,n}}}function mPe(){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 Fn};break;case"SpotLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Fn};break;case"PointLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Fn,shadowCameraNear:1,shadowCameraFar:1e3};break}return t[e.id]=n,n}}}let hPe=0;function pPe(t,e){return(e.castShadow?2:0)-(t.castShadow?2:0)+(e.map?1:0)-(t.map?1:0)}function fPe(t,e){const n=new uPe,r=mPe(),a={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 u=0;u<9;u++)a.probe.push(new rt);const s=new rt,o=new ti,l=new ti;function c(u,m){let p=0,f=0,y=0;for(let U=0;U<9;U++)a.probe[U].set(0,0,0);let x=0,b=0,v=0,_=0,k=0,P=0,C=0,T=0,N=0,R=0,A=0;u.sort(pPe);const D=m===!0?Math.PI:1;for(let U=0,G=u.length;U<G;U++){const L=u[U],te=L.color,re=L.intensity,J=L.distance,ue=L.shadow&&L.shadow.map?L.shadow.map.texture:null;if(L.isAmbientLight)p+=te.r*re*D,f+=te.g*re*D,y+=te.b*re*D;else if(L.isLightProbe){for(let me=0;me<9;me++)a.probe[me].addScaledVector(L.sh.coefficients[me],re);A++}else if(L.isDirectionalLight){const me=n.get(L);if(me.color.copy(L.color).multiplyScalar(L.intensity*D),L.castShadow){const ge=L.shadow,X=r.get(L);X.shadowBias=ge.bias,X.shadowNormalBias=ge.normalBias,X.shadowRadius=ge.radius,X.shadowMapSize=ge.mapSize,a.directionalShadow[x]=X,a.directionalShadowMap[x]=ue,a.directionalShadowMatrix[x]=L.shadow.matrix,P++}a.directional[x]=me,x++}else if(L.isSpotLight){const me=n.get(L);me.position.setFromMatrixPosition(L.matrixWorld),me.color.copy(te).multiplyScalar(re*D),me.distance=J,me.coneCos=Math.cos(L.angle),me.penumbraCos=Math.cos(L.angle*(1-L.penumbra)),me.decay=L.decay,a.spot[v]=me;const ge=L.shadow;if(L.map&&(a.spotLightMap[N]=L.map,N++,ge.updateMatrices(L),L.castShadow&&R++),a.spotLightMatrix[v]=ge.matrix,L.castShadow){const X=r.get(L);X.shadowBias=ge.bias,X.shadowNormalBias=ge.normalBias,X.shadowRadius=ge.radius,X.shadowMapSize=ge.mapSize,a.spotShadow[v]=X,a.spotShadowMap[v]=ue,T++}v++}else if(L.isRectAreaLight){const me=n.get(L);me.color.copy(te).multiplyScalar(re),me.halfWidth.set(L.width*.5,0,0),me.halfHeight.set(0,L.height*.5,0),a.rectArea[_]=me,_++}else if(L.isPointLight){const me=n.get(L);if(me.color.copy(L.color).multiplyScalar(L.intensity*D),me.distance=L.distance,me.decay=L.decay,L.castShadow){const ge=L.shadow,X=r.get(L);X.shadowBias=ge.bias,X.shadowNormalBias=ge.normalBias,X.shadowRadius=ge.radius,X.shadowMapSize=ge.mapSize,X.shadowCameraNear=ge.camera.near,X.shadowCameraFar=ge.camera.far,a.pointShadow[b]=X,a.pointShadowMap[b]=ue,a.pointShadowMatrix[b]=L.shadow.matrix,C++}a.point[b]=me,b++}else if(L.isHemisphereLight){const me=n.get(L);me.skyColor.copy(L.color).multiplyScalar(re*D),me.groundColor.copy(L.groundColor).multiplyScalar(re*D),a.hemi[k]=me,k++}}_>0&&(e.isWebGL2||t.has("OES_texture_float_linear")===!0?(a.rectAreaLTC1=qt.LTC_FLOAT_1,a.rectAreaLTC2=qt.LTC_FLOAT_2):t.has("OES_texture_half_float_linear")===!0?(a.rectAreaLTC1=qt.LTC_HALF_1,a.rectAreaLTC2=qt.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),a.ambient[0]=p,a.ambient[1]=f,a.ambient[2]=y;const $=a.hash;($.directionalLength!==x||$.pointLength!==b||$.spotLength!==v||$.rectAreaLength!==_||$.hemiLength!==k||$.numDirectionalShadows!==P||$.numPointShadows!==C||$.numSpotShadows!==T||$.numSpotMaps!==N||$.numLightProbes!==A)&&(a.directional.length=x,a.spot.length=v,a.rectArea.length=_,a.point.length=b,a.hemi.length=k,a.directionalShadow.length=P,a.directionalShadowMap.length=P,a.pointShadow.length=C,a.pointShadowMap.length=C,a.spotShadow.length=T,a.spotShadowMap.length=T,a.directionalShadowMatrix.length=P,a.pointShadowMatrix.length=C,a.spotLightMatrix.length=T+N-R,a.spotLightMap.length=N,a.numSpotLightShadowsWithMaps=R,a.numLightProbes=A,$.directionalLength=x,$.pointLength=b,$.spotLength=v,$.rectAreaLength=_,$.hemiLength=k,$.numDirectionalShadows=P,$.numPointShadows=C,$.numSpotShadows=T,$.numSpotMaps=N,$.numLightProbes=A,a.version=hPe++)}function d(u,m){let p=0,f=0,y=0,x=0,b=0;const v=m.matrixWorldInverse;for(let _=0,k=u.length;_<k;_++){const P=u[_];if(P.isDirectionalLight){const C=a.directional[p];C.direction.setFromMatrixPosition(P.matrixWorld),s.setFromMatrixPosition(P.target.matrixWorld),C.direction.sub(s),C.direction.transformDirection(v),p++}else if(P.isSpotLight){const C=a.spot[y];C.position.setFromMatrixPosition(P.matrixWorld),C.position.applyMatrix4(v),C.direction.setFromMatrixPosition(P.matrixWorld),s.setFromMatrixPosition(P.target.matrixWorld),C.direction.sub(s),C.direction.transformDirection(v),y++}else if(P.isRectAreaLight){const C=a.rectArea[x];C.position.setFromMatrixPosition(P.matrixWorld),C.position.applyMatrix4(v),l.identity(),o.copy(P.matrixWorld),o.premultiply(v),l.extractRotation(o),C.halfWidth.set(P.width*.5,0,0),C.halfHeight.set(0,P.height*.5,0),C.halfWidth.applyMatrix4(l),C.halfHeight.applyMatrix4(l),x++}else if(P.isPointLight){const C=a.point[f];C.position.setFromMatrixPosition(P.matrixWorld),C.position.applyMatrix4(v),f++}else if(P.isHemisphereLight){const C=a.hemi[b];C.direction.setFromMatrixPosition(P.matrixWorld),C.direction.transformDirection(v),b++}}}return{setup:c,setupView:d,state:a}}function zH(t,e){const n=new fPe(t,e),r=[],a=[];function s(){r.length=0,a.length=0}function o(m){r.push(m)}function l(m){a.push(m)}function c(m){n.setup(r,m)}function d(m){n.setupView(r,m)}return{init:s,state:{lightsArray:r,shadowsArray:a,lights:n},setupLights:c,setupLightsView:d,pushLight:o,pushShadow:l}}function gPe(t,e){let n=new WeakMap;function r(s,o=0){const l=n.get(s);let c;return l===void 0?(c=new zH(t,e),n.set(s,[c])):o>=l.length?(c=new zH(t,e),l.push(c)):c=l[o],c}function a(){n=new WeakMap}return{get:r,dispose:a}}class bPe extends px{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=n1e,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 xPe extends px{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 yPe=`void main() {
- gl_Position = vec4( position, 1.0 );
- }`,vPe=`uniform sampler2D shadow_pass;
- uniform vec2 resolution;
- uniform float radius;
- #include <packing>
- void main() {
- const float samples = float( VSM_SAMPLES );
- float mean = 0.0;
- float squared_mean = 0.0;
- float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );
- float uvStart = samples <= 1.0 ? 0.0 : - 1.0;
- for ( float i = 0.0; i < samples; i ++ ) {
- float uvOffset = uvStart + i * uvStride;
- #ifdef HORIZONTAL_PASS
- vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );
- mean += distribution.x;
- squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;
- #else
- float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );
- mean += depth;
- squared_mean += depth * depth;
- #endif
- }
- mean = mean / samples;
- squared_mean = squared_mean / samples;
- float std_dev = sqrt( squared_mean - mean * mean );
- gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );
- }`;function wPe(t,e,n){let r=new TC;const a=new Fn,s=new Fn,o=new qr,l=new bPe({depthPacking:r1e}),c=new xPe,d={},u=n.maxTextureSize,m={[sh]:so,[so]:sh,[Bd]:Bd},p=new oh({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Fn},radius:{value:4}},vertexShader:yPe,fragmentShader:vPe}),f=p.clone();f.defines.HORIZONTAL_PASS=1;const y=new ys;y.setAttribute("position",new Fo(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const x=new Ql(y,p),b=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=ZX;let v=this.type;this.render=function(C,T,N){if(b.enabled===!1||b.autoUpdate===!1&&b.needsUpdate===!1||C.length===0)return;const R=t.getRenderTarget(),A=t.getActiveCubeFace(),D=t.getActiveMipmapLevel(),$=t.state;$.setBlending(Km),$.buffers.color.setClear(1,1,1,1),$.buffers.depth.setTest(!0),$.setScissorTest(!1);const U=v!==Od&&this.type===Od,G=v===Od&&this.type!==Od;for(let L=0,te=C.length;L<te;L++){const re=C[L],J=re.shadow;if(J===void 0){console.warn("THREE.WebGLShadowMap:",re,"has no shadow.");continue}if(J.autoUpdate===!1&&J.needsUpdate===!1)continue;a.copy(J.mapSize);const ue=J.getFrameExtents();if(a.multiply(ue),s.copy(J.mapSize),(a.x>u||a.y>u)&&(a.x>u&&(s.x=Math.floor(u/ue.x),a.x=s.x*ue.x,J.mapSize.x=s.x),a.y>u&&(s.y=Math.floor(u/ue.y),a.y=s.y*ue.y,J.mapSize.y=s.y)),J.map===null||U===!0||G===!0){const ge=this.type!==Od?{minFilter:Xa,magFilter:Xa}:{};J.map!==null&&J.map.dispose(),J.map=new Qp(a.x,a.y,ge),J.map.texture.name=re.name+".shadowMap",J.camera.updateProjectionMatrix()}t.setRenderTarget(J.map),t.clear();const me=J.getViewportCount();for(let ge=0;ge<me;ge++){const X=J.getViewport(ge);o.set(s.x*X.x,s.y*X.y,s.x*X.z,s.y*X.w),$.viewport(o),J.updateMatrices(re,ge),r=J.getFrustum(),P(T,N,J.camera,re,this.type)}J.isPointLightShadow!==!0&&this.type===Od&&_(J,N),J.needsUpdate=!1}v=this.type,b.needsUpdate=!1,t.setRenderTarget(R,A,D)};function _(C,T){const N=e.update(x);p.defines.VSM_SAMPLES!==C.blurSamples&&(p.defines.VSM_SAMPLES=C.blurSamples,f.defines.VSM_SAMPLES=C.blurSamples,p.needsUpdate=!0,f.needsUpdate=!0),C.mapPass===null&&(C.mapPass=new Qp(a.x,a.y)),p.uniforms.shadow_pass.value=C.map.texture,p.uniforms.resolution.value=C.mapSize,p.uniforms.radius.value=C.radius,t.setRenderTarget(C.mapPass),t.clear(),t.renderBufferDirect(T,null,N,p,x,null),f.uniforms.shadow_pass.value=C.mapPass.texture,f.uniforms.resolution.value=C.mapSize,f.uniforms.radius.value=C.radius,t.setRenderTarget(C.map),t.clear(),t.renderBufferDirect(T,null,N,f,x,null)}function k(C,T,N,R){let A=null;const D=N.isPointLight===!0?C.customDistanceMaterial:C.customDepthMaterial;if(D!==void 0)A=D;else if(A=N.isPointLight===!0?c:l,t.localClippingEnabled&&T.clipShadows===!0&&Array.isArray(T.clippingPlanes)&&T.clippingPlanes.length!==0||T.displacementMap&&T.displacementScale!==0||T.alphaMap&&T.alphaTest>0||T.map&&T.alphaTest>0){const $=A.uuid,U=T.uuid;let G=d[$];G===void 0&&(G={},d[$]=G);let L=G[U];L===void 0&&(L=A.clone(),G[U]=L),A=L}if(A.visible=T.visible,A.wireframe=T.wireframe,R===Od?A.side=T.shadowSide!==null?T.shadowSide:T.side:A.side=T.shadowSide!==null?T.shadowSide:m[T.side],A.alphaMap=T.alphaMap,A.alphaTest=T.alphaTest,A.map=T.map,A.clipShadows=T.clipShadows,A.clippingPlanes=T.clippingPlanes,A.clipIntersection=T.clipIntersection,A.displacementMap=T.displacementMap,A.displacementScale=T.displacementScale,A.displacementBias=T.displacementBias,A.wireframeLinewidth=T.wireframeLinewidth,A.linewidth=T.linewidth,N.isPointLight===!0&&A.isMeshDistanceMaterial===!0){const $=t.properties.get(A);$.light=N}return A}function P(C,T,N,R,A){if(C.visible===!1)return;if(C.layers.test(T.layers)&&(C.isMesh||C.isLine||C.isPoints)&&(C.castShadow||C.receiveShadow&&A===Od)&&(!C.frustumCulled||r.intersectsObject(C))){C.modelViewMatrix.multiplyMatrices(N.matrixWorldInverse,C.matrixWorld);const U=e.update(C),G=C.material;if(Array.isArray(G)){const L=U.groups;for(let te=0,re=L.length;te<re;te++){const J=L[te],ue=G[J.materialIndex];if(ue&&ue.visible){const me=k(C,ue,R,A);C.onBeforeShadow(t,C,T,N,U,me,J),t.renderBufferDirect(N,null,U,me,C,J),C.onAfterShadow(t,C,T,N,U,me,J)}}}else if(G.visible){const L=k(C,G,R,A);C.onBeforeShadow(t,C,T,N,U,L,null),t.renderBufferDirect(N,null,U,L,C,null),C.onAfterShadow(t,C,T,N,U,L,null)}}const $=C.children;for(let U=0,G=$.length;U<G;U++)P($[U],T,N,R,A)}}function SPe(t,e,n){const r=n.isWebGL2;function a(){let Pe=!1;const Ve=new qr;let je=null;const ye=new qr(0,0,0,0);return{setMask:function($e){je!==$e&&!Pe&&(t.colorMask($e,$e,$e,$e),je=$e)},setLocked:function($e){Pe=$e},setClear:function($e,Ye,lt,St,ot){ot===!0&&($e*=St,Ye*=St,lt*=St),Ve.set($e,Ye,lt,St),ye.equals(Ve)===!1&&(t.clearColor($e,Ye,lt,St),ye.copy(Ve))},reset:function(){Pe=!1,je=null,ye.set(-1,0,0,0)}}}function s(){let Pe=!1,Ve=null,je=null,ye=null;return{setTest:function($e){$e?E(t.DEPTH_TEST):I(t.DEPTH_TEST)},setMask:function($e){Ve!==$e&&!Pe&&(t.depthMask($e),Ve=$e)},setFunc:function($e){if(je!==$e){switch($e){case D_e:t.depthFunc(t.NEVER);break;case R_e:t.depthFunc(t.ALWAYS);break;case F_e:t.depthFunc(t.LESS);break;case ek:t.depthFunc(t.LEQUAL);break;case L_e:t.depthFunc(t.EQUAL);break;case O_e:t.depthFunc(t.GEQUAL);break;case I_e:t.depthFunc(t.GREATER);break;case z_e:t.depthFunc(t.NOTEQUAL);break;default:t.depthFunc(t.LEQUAL)}je=$e}},setLocked:function($e){Pe=$e},setClear:function($e){ye!==$e&&(t.clearDepth($e),ye=$e)},reset:function(){Pe=!1,Ve=null,je=null,ye=null}}}function o(){let Pe=!1,Ve=null,je=null,ye=null,$e=null,Ye=null,lt=null,St=null,ot=null;return{setTest:function(ft){Pe||(ft?E(t.STENCIL_TEST):I(t.STENCIL_TEST))},setMask:function(ft){Ve!==ft&&!Pe&&(t.stencilMask(ft),Ve=ft)},setFunc:function(ft,qe,ht){(je!==ft||ye!==qe||$e!==ht)&&(t.stencilFunc(ft,qe,ht),je=ft,ye=qe,$e=ht)},setOp:function(ft,qe,ht){(Ye!==ft||lt!==qe||St!==ht)&&(t.stencilOp(ft,qe,ht),Ye=ft,lt=qe,St=ht)},setLocked:function(ft){Pe=ft},setClear:function(ft){ot!==ft&&(t.clearStencil(ft),ot=ft)},reset:function(){Pe=!1,Ve=null,je=null,ye=null,$e=null,Ye=null,lt=null,St=null,ot=null}}}const l=new a,c=new s,d=new o,u=new WeakMap,m=new WeakMap;let p={},f={},y=new WeakMap,x=[],b=null,v=!1,_=null,k=null,P=null,C=null,T=null,N=null,R=null,A=new yn(0,0,0),D=0,$=!1,U=null,G=null,L=null,te=null,re=null;const J=t.getParameter(t.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let ue=!1,me=0;const ge=t.getParameter(t.VERSION);ge.indexOf("WebGL")!==-1?(me=parseFloat(/^WebGL (\d)/.exec(ge)[1]),ue=me>=1):ge.indexOf("OpenGL ES")!==-1&&(me=parseFloat(/^OpenGL ES (\d)/.exec(ge)[1]),ue=me>=2);let X=null,ie={};const le=t.getParameter(t.SCISSOR_BOX),pe=t.getParameter(t.VIEWPORT),Ce=new qr().fromArray(le),q=new qr().fromArray(pe);function Z(Pe,Ve,je,ye){const $e=new Uint8Array(4),Ye=t.createTexture();t.bindTexture(Pe,Ye),t.texParameteri(Pe,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(Pe,t.TEXTURE_MAG_FILTER,t.NEAREST);for(let lt=0;lt<je;lt++)r&&(Pe===t.TEXTURE_3D||Pe===t.TEXTURE_2D_ARRAY)?t.texImage3D(Ve,0,t.RGBA,1,1,ye,0,t.RGBA,t.UNSIGNED_BYTE,$e):t.texImage2D(Ve+lt,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,$e);return Ye}const j={};j[t.TEXTURE_2D]=Z(t.TEXTURE_2D,t.TEXTURE_2D,1),j[t.TEXTURE_CUBE_MAP]=Z(t.TEXTURE_CUBE_MAP,t.TEXTURE_CUBE_MAP_POSITIVE_X,6),r&&(j[t.TEXTURE_2D_ARRAY]=Z(t.TEXTURE_2D_ARRAY,t.TEXTURE_2D_ARRAY,1,1),j[t.TEXTURE_3D]=Z(t.TEXTURE_3D,t.TEXTURE_3D,1,1)),l.setClear(0,0,0,1),c.setClear(1),d.setClear(0),E(t.DEPTH_TEST),c.setFunc(ek),ne(!1),se(w6),E(t.CULL_FACE),ee(Km);function E(Pe){p[Pe]!==!0&&(t.enable(Pe),p[Pe]=!0)}function I(Pe){p[Pe]!==!1&&(t.disable(Pe),p[Pe]=!1)}function W(Pe,Ve){return f[Pe]!==Ve?(t.bindFramebuffer(Pe,Ve),f[Pe]=Ve,r&&(Pe===t.DRAW_FRAMEBUFFER&&(f[t.FRAMEBUFFER]=Ve),Pe===t.FRAMEBUFFER&&(f[t.DRAW_FRAMEBUFFER]=Ve)),!0):!1}function B(Pe,Ve){let je=x,ye=!1;if(Pe)if(je=y.get(Ve),je===void 0&&(je=[],y.set(Ve,je)),Pe.isWebGLMultipleRenderTargets){const $e=Pe.texture;if(je.length!==$e.length||je[0]!==t.COLOR_ATTACHMENT0){for(let Ye=0,lt=$e.length;Ye<lt;Ye++)je[Ye]=t.COLOR_ATTACHMENT0+Ye;je.length=$e.length,ye=!0}}else je[0]!==t.COLOR_ATTACHMENT0&&(je[0]=t.COLOR_ATTACHMENT0,ye=!0);else je[0]!==t.BACK&&(je[0]=t.BACK,ye=!0);ye&&(n.isWebGL2?t.drawBuffers(je):e.get("WEBGL_draw_buffers").drawBuffersWEBGL(je))}function ae(Pe){return b!==Pe?(t.useProgram(Pe),b=Pe,!0):!1}const z={[lp]:t.FUNC_ADD,[x_e]:t.FUNC_SUBTRACT,[y_e]:t.FUNC_REVERSE_SUBTRACT};if(r)z[N6]=t.MIN,z[C6]=t.MAX;else{const Pe=e.get("EXT_blend_minmax");Pe!==null&&(z[N6]=Pe.MIN_EXT,z[C6]=Pe.MAX_EXT)}const V={[v_e]:t.ZERO,[w_e]:t.ONE,[S_e]:t.SRC_COLOR,[_3]:t.SRC_ALPHA,[P_e]:t.SRC_ALPHA_SATURATE,[C_e]:t.DST_COLOR,[k_e]:t.DST_ALPHA,[__e]:t.ONE_MINUS_SRC_COLOR,[k3]:t.ONE_MINUS_SRC_ALPHA,[T_e]:t.ONE_MINUS_DST_COLOR,[N_e]:t.ONE_MINUS_DST_ALPHA,[A_e]:t.CONSTANT_COLOR,[M_e]:t.ONE_MINUS_CONSTANT_COLOR,[E_e]:t.CONSTANT_ALPHA,[j_e]:t.ONE_MINUS_CONSTANT_ALPHA};function ee(Pe,Ve,je,ye,$e,Ye,lt,St,ot,ft){if(Pe===Km){v===!0&&(I(t.BLEND),v=!1);return}if(v===!1&&(E(t.BLEND),v=!0),Pe!==b_e){if(Pe!==_||ft!==$){if((k!==lp||T!==lp)&&(t.blendEquation(t.FUNC_ADD),k=lp,T=lp),ft)switch(Pe){case xb:t.blendFuncSeparate(t.ONE,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA);break;case S6:t.blendFunc(t.ONE,t.ONE);break;case _6:t.blendFuncSeparate(t.ZERO,t.ONE_MINUS_SRC_COLOR,t.ZERO,t.ONE);break;case k6:t.blendFuncSeparate(t.ZERO,t.SRC_COLOR,t.ZERO,t.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",Pe);break}else switch(Pe){case xb:t.blendFuncSeparate(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA);break;case S6:t.blendFunc(t.SRC_ALPHA,t.ONE);break;case _6:t.blendFuncSeparate(t.ZERO,t.ONE_MINUS_SRC_COLOR,t.ZERO,t.ONE);break;case k6:t.blendFunc(t.ZERO,t.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",Pe);break}P=null,C=null,N=null,R=null,A.set(0,0,0),D=0,_=Pe,$=ft}return}$e=$e||Ve,Ye=Ye||je,lt=lt||ye,(Ve!==k||$e!==T)&&(t.blendEquationSeparate(z[Ve],z[$e]),k=Ve,T=$e),(je!==P||ye!==C||Ye!==N||lt!==R)&&(t.blendFuncSeparate(V[je],V[ye],V[Ye],V[lt]),P=je,C=ye,N=Ye,R=lt),(St.equals(A)===!1||ot!==D)&&(t.blendColor(St.r,St.g,St.b,ot),A.copy(St),D=ot),_=Pe,$=!1}function K(Pe,Ve){Pe.side===Bd?I(t.CULL_FACE):E(t.CULL_FACE);let je=Pe.side===so;Ve&&(je=!je),ne(je),Pe.blending===xb&&Pe.transparent===!1?ee(Km):ee(Pe.blending,Pe.blendEquation,Pe.blendSrc,Pe.blendDst,Pe.blendEquationAlpha,Pe.blendSrcAlpha,Pe.blendDstAlpha,Pe.blendColor,Pe.blendAlpha,Pe.premultipliedAlpha),c.setFunc(Pe.depthFunc),c.setTest(Pe.depthTest),c.setMask(Pe.depthWrite),l.setMask(Pe.colorWrite);const ye=Pe.stencilWrite;d.setTest(ye),ye&&(d.setMask(Pe.stencilWriteMask),d.setFunc(Pe.stencilFunc,Pe.stencilRef,Pe.stencilFuncMask),d.setOp(Pe.stencilFail,Pe.stencilZFail,Pe.stencilZPass)),fe(Pe.polygonOffset,Pe.polygonOffsetFactor,Pe.polygonOffsetUnits),Pe.alphaToCoverage===!0?E(t.SAMPLE_ALPHA_TO_COVERAGE):I(t.SAMPLE_ALPHA_TO_COVERAGE)}function ne(Pe){U!==Pe&&(Pe?t.frontFace(t.CW):t.frontFace(t.CCW),U=Pe)}function se(Pe){Pe!==p_e?(E(t.CULL_FACE),Pe!==G&&(Pe===w6?t.cullFace(t.BACK):Pe===f_e?t.cullFace(t.FRONT):t.cullFace(t.FRONT_AND_BACK))):I(t.CULL_FACE),G=Pe}function ce(Pe){Pe!==L&&(ue&&t.lineWidth(Pe),L=Pe)}function fe(Pe,Ve,je){Pe?(E(t.POLYGON_OFFSET_FILL),(te!==Ve||re!==je)&&(t.polygonOffset(Ve,je),te=Ve,re=je)):I(t.POLYGON_OFFSET_FILL)}function oe(Pe){Pe?E(t.SCISSOR_TEST):I(t.SCISSOR_TEST)}function O(Pe){Pe===void 0&&(Pe=t.TEXTURE0+J-1),X!==Pe&&(t.activeTexture(Pe),X=Pe)}function F(Pe,Ve,je){je===void 0&&(X===null?je=t.TEXTURE0+J-1:je=X);let ye=ie[je];ye===void 0&&(ye={type:void 0,texture:void 0},ie[je]=ye),(ye.type!==Pe||ye.texture!==Ve)&&(X!==je&&(t.activeTexture(je),X=je),t.bindTexture(Pe,Ve||j[Pe]),ye.type=Pe,ye.texture=Ve)}function Q(){const Pe=ie[X];Pe!==void 0&&Pe.type!==void 0&&(t.bindTexture(Pe.type,null),Pe.type=void 0,Pe.texture=void 0)}function ve(){try{t.compressedTexImage2D.apply(t,arguments)}catch(Pe){console.error("THREE.WebGLState:",Pe)}}function he(){try{t.compressedTexImage3D.apply(t,arguments)}catch(Pe){console.error("THREE.WebGLState:",Pe)}}function de(){try{t.texSubImage2D.apply(t,arguments)}catch(Pe){console.error("THREE.WebGLState:",Pe)}}function Ae(){try{t.texSubImage3D.apply(t,arguments)}catch(Pe){console.error("THREE.WebGLState:",Pe)}}function _e(){try{t.compressedTexSubImage2D.apply(t,arguments)}catch(Pe){console.error("THREE.WebGLState:",Pe)}}function ze(){try{t.compressedTexSubImage3D.apply(t,arguments)}catch(Pe){console.error("THREE.WebGLState:",Pe)}}function Be(){try{t.texStorage2D.apply(t,arguments)}catch(Pe){console.error("THREE.WebGLState:",Pe)}}function Ue(){try{t.texStorage3D.apply(t,arguments)}catch(Pe){console.error("THREE.WebGLState:",Pe)}}function Ne(){try{t.texImage2D.apply(t,arguments)}catch(Pe){console.error("THREE.WebGLState:",Pe)}}function Ee(){try{t.texImage3D.apply(t,arguments)}catch(Pe){console.error("THREE.WebGLState:",Pe)}}function ke(Pe){Ce.equals(Pe)===!1&&(t.scissor(Pe.x,Pe.y,Pe.z,Pe.w),Ce.copy(Pe))}function Me(Pe){q.equals(Pe)===!1&&(t.viewport(Pe.x,Pe.y,Pe.z,Pe.w),q.copy(Pe))}function Ge(Pe,Ve){let je=m.get(Ve);je===void 0&&(je=new WeakMap,m.set(Ve,je));let ye=je.get(Pe);ye===void 0&&(ye=t.getUniformBlockIndex(Ve,Pe.name),je.set(Pe,ye))}function xe(Pe,Ve){const ye=m.get(Ve).get(Pe);u.get(Ve)!==ye&&(t.uniformBlockBinding(Ve,ye,Pe.__bindingPointIndex),u.set(Ve,ye))}function He(){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),r===!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={},X=null,ie={},f={},y=new WeakMap,x=[],b=null,v=!1,_=null,k=null,P=null,C=null,T=null,N=null,R=null,A=new yn(0,0,0),D=0,$=!1,U=null,G=null,L=null,te=null,re=null,Ce.set(0,0,t.canvas.width,t.canvas.height),q.set(0,0,t.canvas.width,t.canvas.height),l.reset(),c.reset(),d.reset()}return{buffers:{color:l,depth:c,stencil:d},enable:E,disable:I,bindFramebuffer:W,drawBuffers:B,useProgram:ae,setBlending:ee,setMaterial:K,setFlipSided:ne,setCullFace:se,setLineWidth:ce,setPolygonOffset:fe,setScissorTest:oe,activeTexture:O,bindTexture:F,unbindTexture:Q,compressedTexImage2D:ve,compressedTexImage3D:he,texImage2D:Ne,texImage3D:Ee,updateUBOMapping:Ge,uniformBlockBinding:xe,texStorage2D:Be,texStorage3D:Ue,texSubImage2D:de,texSubImage3D:Ae,compressedTexSubImage2D:_e,compressedTexSubImage3D:ze,scissor:ke,viewport:Me,reset:He}}function _Pe(t,e,n,r,a,s,o){const l=a.isWebGL2,c=a.maxTextures,d=a.maxCubemapSize,u=a.maxTextureSize,m=a.maxSamples,p=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,f=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),y=new WeakMap;let x;const b=new WeakMap;let v=!1;try{v=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function _(O,F){return v?new OffscreenCanvas(O,F):ak("canvas")}function k(O,F,Q,ve){let he=1;if((O.width>ve||O.height>ve)&&(he=ve/Math.max(O.width,O.height)),he<1||F===!0)if(typeof HTMLImageElement<"u"&&O instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&O instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&O instanceof ImageBitmap){const de=F?ik:Math.floor,Ae=de(he*O.width),_e=de(he*O.height);x===void 0&&(x=_(Ae,_e));const ze=Q?_(Ae,_e):x;return ze.width=Ae,ze.height=_e,ze.getContext("2d").drawImage(O,0,0,Ae,_e),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+O.width+"x"+O.height+") to ("+Ae+"x"+_e+")."),ze}else return"data"in O&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+O.width+"x"+O.height+")."),O;return O}function P(O){return E3(O.width)&&E3(O.height)}function C(O){return l?!1:O.wrapS!==Vl||O.wrapT!==Vl||O.minFilter!==Xa&&O.minFilter!==cl}function T(O,F){return O.generateMipmaps&&F&&O.minFilter!==Xa&&O.minFilter!==cl}function N(O){t.generateMipmap(O)}function R(O,F,Q,ve,he=!1){if(l===!1)return F;if(O!==null){if(t[O]!==void 0)return t[O];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+O+"'")}let de=F;if(F===t.RED&&(Q===t.FLOAT&&(de=t.R32F),Q===t.HALF_FLOAT&&(de=t.R16F),Q===t.UNSIGNED_BYTE&&(de=t.R8)),F===t.RED_INTEGER&&(Q===t.UNSIGNED_BYTE&&(de=t.R8UI),Q===t.UNSIGNED_SHORT&&(de=t.R16UI),Q===t.UNSIGNED_INT&&(de=t.R32UI),Q===t.BYTE&&(de=t.R8I),Q===t.SHORT&&(de=t.R16I),Q===t.INT&&(de=t.R32I)),F===t.RG&&(Q===t.FLOAT&&(de=t.RG32F),Q===t.HALF_FLOAT&&(de=t.RG16F),Q===t.UNSIGNED_BYTE&&(de=t.RG8)),F===t.RGBA){const Ae=he?tk:Hr.getTransfer(ve);Q===t.FLOAT&&(de=t.RGBA32F),Q===t.HALF_FLOAT&&(de=t.RGBA16F),Q===t.UNSIGNED_BYTE&&(de=Ae===si?t.SRGB8_ALPHA8:t.RGBA8),Q===t.UNSIGNED_SHORT_4_4_4_4&&(de=t.RGBA4),Q===t.UNSIGNED_SHORT_5_5_5_1&&(de=t.RGB5_A1)}return(de===t.R16F||de===t.R32F||de===t.RG16F||de===t.RG32F||de===t.RGBA16F||de===t.RGBA32F)&&e.get("EXT_color_buffer_float"),de}function A(O,F,Q){return T(O,Q)===!0||O.isFramebufferTexture&&O.minFilter!==Xa&&O.minFilter!==cl?Math.log2(Math.max(F.width,F.height))+1:O.mipmaps!==void 0&&O.mipmaps.length>0?O.mipmaps.length:O.isCompressedTexture&&Array.isArray(O.image)?F.mipmaps.length:1}function D(O){return O===Xa||O===T6||O===zM?t.NEAREST:t.LINEAR}function $(O){const F=O.target;F.removeEventListener("dispose",$),G(F),F.isVideoTexture&&y.delete(F)}function U(O){const F=O.target;F.removeEventListener("dispose",U),te(F)}function G(O){const F=r.get(O);if(F.__webglInit===void 0)return;const Q=O.source,ve=b.get(Q);if(ve){const he=ve[F.__cacheKey];he.usedTimes--,he.usedTimes===0&&L(O),Object.keys(ve).length===0&&b.delete(Q)}r.remove(O)}function L(O){const F=r.get(O);t.deleteTexture(F.__webglTexture);const Q=O.source,ve=b.get(Q);delete ve[F.__cacheKey],o.memory.textures--}function te(O){const F=O.texture,Q=r.get(O),ve=r.get(F);if(ve.__webglTexture!==void 0&&(t.deleteTexture(ve.__webglTexture),o.memory.textures--),O.depthTexture&&O.depthTexture.dispose(),O.isWebGLCubeRenderTarget)for(let he=0;he<6;he++){if(Array.isArray(Q.__webglFramebuffer[he]))for(let de=0;de<Q.__webglFramebuffer[he].length;de++)t.deleteFramebuffer(Q.__webglFramebuffer[he][de]);else t.deleteFramebuffer(Q.__webglFramebuffer[he]);Q.__webglDepthbuffer&&t.deleteRenderbuffer(Q.__webglDepthbuffer[he])}else{if(Array.isArray(Q.__webglFramebuffer))for(let he=0;he<Q.__webglFramebuffer.length;he++)t.deleteFramebuffer(Q.__webglFramebuffer[he]);else t.deleteFramebuffer(Q.__webglFramebuffer);if(Q.__webglDepthbuffer&&t.deleteRenderbuffer(Q.__webglDepthbuffer),Q.__webglMultisampledFramebuffer&&t.deleteFramebuffer(Q.__webglMultisampledFramebuffer),Q.__webglColorRenderbuffer)for(let he=0;he<Q.__webglColorRenderbuffer.length;he++)Q.__webglColorRenderbuffer[he]&&t.deleteRenderbuffer(Q.__webglColorRenderbuffer[he]);Q.__webglDepthRenderbuffer&&t.deleteRenderbuffer(Q.__webglDepthRenderbuffer)}if(O.isWebGLMultipleRenderTargets)for(let he=0,de=F.length;he<de;he++){const Ae=r.get(F[he]);Ae.__webglTexture&&(t.deleteTexture(Ae.__webglTexture),o.memory.textures--),r.remove(F[he])}r.remove(F),r.remove(O)}let re=0;function J(){re=0}function ue(){const O=re;return O>=c&&console.warn("THREE.WebGLTextures: Trying to use "+O+" texture units while this GPU supports only "+c),re+=1,O}function me(O){const F=[];return F.push(O.wrapS),F.push(O.wrapT),F.push(O.wrapR||0),F.push(O.magFilter),F.push(O.minFilter),F.push(O.anisotropy),F.push(O.internalFormat),F.push(O.format),F.push(O.type),F.push(O.generateMipmaps),F.push(O.premultiplyAlpha),F.push(O.flipY),F.push(O.unpackAlignment),F.push(O.colorSpace),F.join()}function ge(O,F){const Q=r.get(O);if(O.isVideoTexture&&fe(O),O.isRenderTargetTexture===!1&&O.version>0&&Q.__version!==O.version){const ve=O.image;if(ve===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(ve.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{E(Q,O,F);return}}n.bindTexture(t.TEXTURE_2D,Q.__webglTexture,t.TEXTURE0+F)}function X(O,F){const Q=r.get(O);if(O.version>0&&Q.__version!==O.version){E(Q,O,F);return}n.bindTexture(t.TEXTURE_2D_ARRAY,Q.__webglTexture,t.TEXTURE0+F)}function ie(O,F){const Q=r.get(O);if(O.version>0&&Q.__version!==O.version){E(Q,O,F);return}n.bindTexture(t.TEXTURE_3D,Q.__webglTexture,t.TEXTURE0+F)}function le(O,F){const Q=r.get(O);if(O.version>0&&Q.__version!==O.version){I(Q,O,F);return}n.bindTexture(t.TEXTURE_CUBE_MAP,Q.__webglTexture,t.TEXTURE0+F)}const pe={[T3]:t.REPEAT,[Vl]:t.CLAMP_TO_EDGE,[P3]:t.MIRRORED_REPEAT},Ce={[Xa]:t.NEAREST,[T6]:t.NEAREST_MIPMAP_NEAREST,[zM]:t.NEAREST_MIPMAP_LINEAR,[cl]:t.LINEAR,[W_e]:t.LINEAR_MIPMAP_NEAREST,[Gv]:t.LINEAR_MIPMAP_LINEAR},q={[a1e]:t.NEVER,[u1e]:t.ALWAYS,[s1e]:t.LESS,[cQ]:t.LEQUAL,[o1e]:t.EQUAL,[d1e]:t.GEQUAL,[l1e]:t.GREATER,[c1e]:t.NOTEQUAL};function Z(O,F,Q){if(Q?(t.texParameteri(O,t.TEXTURE_WRAP_S,pe[F.wrapS]),t.texParameteri(O,t.TEXTURE_WRAP_T,pe[F.wrapT]),(O===t.TEXTURE_3D||O===t.TEXTURE_2D_ARRAY)&&t.texParameteri(O,t.TEXTURE_WRAP_R,pe[F.wrapR]),t.texParameteri(O,t.TEXTURE_MAG_FILTER,Ce[F.magFilter]),t.texParameteri(O,t.TEXTURE_MIN_FILTER,Ce[F.minFilter])):(t.texParameteri(O,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(O,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),(O===t.TEXTURE_3D||O===t.TEXTURE_2D_ARRAY)&&t.texParameteri(O,t.TEXTURE_WRAP_R,t.CLAMP_TO_EDGE),(F.wrapS!==Vl||F.wrapT!==Vl)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),t.texParameteri(O,t.TEXTURE_MAG_FILTER,D(F.magFilter)),t.texParameteri(O,t.TEXTURE_MIN_FILTER,D(F.minFilter)),F.minFilter!==Xa&&F.minFilter!==cl&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),F.compareFunction&&(t.texParameteri(O,t.TEXTURE_COMPARE_MODE,t.COMPARE_REF_TO_TEXTURE),t.texParameteri(O,t.TEXTURE_COMPARE_FUNC,q[F.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){const ve=e.get("EXT_texture_filter_anisotropic");if(F.magFilter===Xa||F.minFilter!==zM&&F.minFilter!==Gv||F.type===Wd&&e.has("OES_texture_float_linear")===!1||l===!1&&F.type===Wv&&e.has("OES_texture_half_float_linear")===!1)return;(F.anisotropy>1||r.get(F).__currentAnisotropy)&&(t.texParameterf(O,ve.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(F.anisotropy,a.getMaxAnisotropy())),r.get(F).__currentAnisotropy=F.anisotropy)}}function j(O,F){let Q=!1;O.__webglInit===void 0&&(O.__webglInit=!0,F.addEventListener("dispose",$));const ve=F.source;let he=b.get(ve);he===void 0&&(he={},b.set(ve,he));const de=me(F);if(de!==O.__cacheKey){he[de]===void 0&&(he[de]={texture:t.createTexture(),usedTimes:0},o.memory.textures++,Q=!0),he[de].usedTimes++;const Ae=he[O.__cacheKey];Ae!==void 0&&(he[O.__cacheKey].usedTimes--,Ae.usedTimes===0&&L(F)),O.__cacheKey=de,O.__webglTexture=he[de].texture}return Q}function E(O,F,Q){let ve=t.TEXTURE_2D;(F.isDataArrayTexture||F.isCompressedArrayTexture)&&(ve=t.TEXTURE_2D_ARRAY),F.isData3DTexture&&(ve=t.TEXTURE_3D);const he=j(O,F),de=F.source;n.bindTexture(ve,O.__webglTexture,t.TEXTURE0+Q);const Ae=r.get(de);if(de.version!==Ae.__version||he===!0){n.activeTexture(t.TEXTURE0+Q);const _e=Hr.getPrimaries(Hr.workingColorSpace),ze=F.colorSpace===ul?null:Hr.getPrimaries(F.colorSpace),Be=F.colorSpace===ul||_e===ze?t.NONE:t.BROWSER_DEFAULT_WEBGL;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,F.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,F.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,F.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,Be);const Ue=C(F)&&P(F.image)===!1;let Ne=k(F.image,Ue,!1,u);Ne=oe(F,Ne);const Ee=P(Ne)||l,ke=s.convert(F.format,F.colorSpace);let Me=s.convert(F.type),Ge=R(F.internalFormat,ke,Me,F.colorSpace,F.isVideoTexture);Z(ve,F,Ee);let xe;const He=F.mipmaps,Pe=l&&F.isVideoTexture!==!0&&Ge!==sQ,Ve=Ae.__version===void 0||he===!0,je=A(F,Ne,Ee);if(F.isDepthTexture)Ge=t.DEPTH_COMPONENT,l?F.type===Wd?Ge=t.DEPTH_COMPONENT32F:F.type===jm?Ge=t.DEPTH_COMPONENT24:F.type===Tp?Ge=t.DEPTH24_STENCIL8:Ge=t.DEPTH_COMPONENT16:F.type===Wd&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),F.format===Pp&&Ge===t.DEPTH_COMPONENT&&F.type!==yL&&F.type!==jm&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),F.type=jm,Me=s.convert(F.type)),F.format===Ub&&Ge===t.DEPTH_COMPONENT&&(Ge=t.DEPTH_STENCIL,F.type!==Tp&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),F.type=Tp,Me=s.convert(F.type))),Ve&&(Pe?n.texStorage2D(t.TEXTURE_2D,1,Ge,Ne.width,Ne.height):n.texImage2D(t.TEXTURE_2D,0,Ge,Ne.width,Ne.height,0,ke,Me,null));else if(F.isDataTexture)if(He.length>0&&Ee){Pe&&Ve&&n.texStorage2D(t.TEXTURE_2D,je,Ge,He[0].width,He[0].height);for(let ye=0,$e=He.length;ye<$e;ye++)xe=He[ye],Pe?n.texSubImage2D(t.TEXTURE_2D,ye,0,0,xe.width,xe.height,ke,Me,xe.data):n.texImage2D(t.TEXTURE_2D,ye,Ge,xe.width,xe.height,0,ke,Me,xe.data);F.generateMipmaps=!1}else Pe?(Ve&&n.texStorage2D(t.TEXTURE_2D,je,Ge,Ne.width,Ne.height),n.texSubImage2D(t.TEXTURE_2D,0,0,0,Ne.width,Ne.height,ke,Me,Ne.data)):n.texImage2D(t.TEXTURE_2D,0,Ge,Ne.width,Ne.height,0,ke,Me,Ne.data);else if(F.isCompressedTexture)if(F.isCompressedArrayTexture){Pe&&Ve&&n.texStorage3D(t.TEXTURE_2D_ARRAY,je,Ge,He[0].width,He[0].height,Ne.depth);for(let ye=0,$e=He.length;ye<$e;ye++)xe=He[ye],F.format!==dl?ke!==null?Pe?n.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,ye,0,0,0,xe.width,xe.height,Ne.depth,ke,xe.data,0,0):n.compressedTexImage3D(t.TEXTURE_2D_ARRAY,ye,Ge,xe.width,xe.height,Ne.depth,0,xe.data,0,0):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Pe?n.texSubImage3D(t.TEXTURE_2D_ARRAY,ye,0,0,0,xe.width,xe.height,Ne.depth,ke,Me,xe.data):n.texImage3D(t.TEXTURE_2D_ARRAY,ye,Ge,xe.width,xe.height,Ne.depth,0,ke,Me,xe.data)}else{Pe&&Ve&&n.texStorage2D(t.TEXTURE_2D,je,Ge,He[0].width,He[0].height);for(let ye=0,$e=He.length;ye<$e;ye++)xe=He[ye],F.format!==dl?ke!==null?Pe?n.compressedTexSubImage2D(t.TEXTURE_2D,ye,0,0,xe.width,xe.height,ke,xe.data):n.compressedTexImage2D(t.TEXTURE_2D,ye,Ge,xe.width,xe.height,0,xe.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Pe?n.texSubImage2D(t.TEXTURE_2D,ye,0,0,xe.width,xe.height,ke,Me,xe.data):n.texImage2D(t.TEXTURE_2D,ye,Ge,xe.width,xe.height,0,ke,Me,xe.data)}else if(F.isDataArrayTexture)Pe?(Ve&&n.texStorage3D(t.TEXTURE_2D_ARRAY,je,Ge,Ne.width,Ne.height,Ne.depth),n.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,0,Ne.width,Ne.height,Ne.depth,ke,Me,Ne.data)):n.texImage3D(t.TEXTURE_2D_ARRAY,0,Ge,Ne.width,Ne.height,Ne.depth,0,ke,Me,Ne.data);else if(F.isData3DTexture)Pe?(Ve&&n.texStorage3D(t.TEXTURE_3D,je,Ge,Ne.width,Ne.height,Ne.depth),n.texSubImage3D(t.TEXTURE_3D,0,0,0,0,Ne.width,Ne.height,Ne.depth,ke,Me,Ne.data)):n.texImage3D(t.TEXTURE_3D,0,Ge,Ne.width,Ne.height,Ne.depth,0,ke,Me,Ne.data);else if(F.isFramebufferTexture){if(Ve)if(Pe)n.texStorage2D(t.TEXTURE_2D,je,Ge,Ne.width,Ne.height);else{let ye=Ne.width,$e=Ne.height;for(let Ye=0;Ye<je;Ye++)n.texImage2D(t.TEXTURE_2D,Ye,Ge,ye,$e,0,ke,Me,null),ye>>=1,$e>>=1}}else if(He.length>0&&Ee){Pe&&Ve&&n.texStorage2D(t.TEXTURE_2D,je,Ge,He[0].width,He[0].height);for(let ye=0,$e=He.length;ye<$e;ye++)xe=He[ye],Pe?n.texSubImage2D(t.TEXTURE_2D,ye,0,0,ke,Me,xe):n.texImage2D(t.TEXTURE_2D,ye,Ge,ke,Me,xe);F.generateMipmaps=!1}else Pe?(Ve&&n.texStorage2D(t.TEXTURE_2D,je,Ge,Ne.width,Ne.height),n.texSubImage2D(t.TEXTURE_2D,0,0,0,ke,Me,Ne)):n.texImage2D(t.TEXTURE_2D,0,Ge,ke,Me,Ne);T(F,Ee)&&N(ve),Ae.__version=de.version,F.onUpdate&&F.onUpdate(F)}O.__version=F.version}function I(O,F,Q){if(F.image.length!==6)return;const ve=j(O,F),he=F.source;n.bindTexture(t.TEXTURE_CUBE_MAP,O.__webglTexture,t.TEXTURE0+Q);const de=r.get(he);if(he.version!==de.__version||ve===!0){n.activeTexture(t.TEXTURE0+Q);const Ae=Hr.getPrimaries(Hr.workingColorSpace),_e=F.colorSpace===ul?null:Hr.getPrimaries(F.colorSpace),ze=F.colorSpace===ul||Ae===_e?t.NONE:t.BROWSER_DEFAULT_WEBGL;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,F.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,F.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,F.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,ze);const Be=F.isCompressedTexture||F.image[0].isCompressedTexture,Ue=F.image[0]&&F.image[0].isDataTexture,Ne=[];for(let ye=0;ye<6;ye++)!Be&&!Ue?Ne[ye]=k(F.image[ye],!1,!0,d):Ne[ye]=Ue?F.image[ye].image:F.image[ye],Ne[ye]=oe(F,Ne[ye]);const Ee=Ne[0],ke=P(Ee)||l,Me=s.convert(F.format,F.colorSpace),Ge=s.convert(F.type),xe=R(F.internalFormat,Me,Ge,F.colorSpace),He=l&&F.isVideoTexture!==!0,Pe=de.__version===void 0||ve===!0;let Ve=A(F,Ee,ke);Z(t.TEXTURE_CUBE_MAP,F,ke);let je;if(Be){He&&Pe&&n.texStorage2D(t.TEXTURE_CUBE_MAP,Ve,xe,Ee.width,Ee.height);for(let ye=0;ye<6;ye++){je=Ne[ye].mipmaps;for(let $e=0;$e<je.length;$e++){const Ye=je[$e];F.format!==dl?Me!==null?He?n.compressedTexSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ye,$e,0,0,Ye.width,Ye.height,Me,Ye.data):n.compressedTexImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ye,$e,xe,Ye.width,Ye.height,0,Ye.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):He?n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ye,$e,0,0,Ye.width,Ye.height,Me,Ge,Ye.data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ye,$e,xe,Ye.width,Ye.height,0,Me,Ge,Ye.data)}}}else{je=F.mipmaps,He&&Pe&&(je.length>0&&Ve++,n.texStorage2D(t.TEXTURE_CUBE_MAP,Ve,xe,Ne[0].width,Ne[0].height));for(let ye=0;ye<6;ye++)if(Ue){He?n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ye,0,0,0,Ne[ye].width,Ne[ye].height,Me,Ge,Ne[ye].data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ye,0,xe,Ne[ye].width,Ne[ye].height,0,Me,Ge,Ne[ye].data);for(let $e=0;$e<je.length;$e++){const lt=je[$e].image[ye].image;He?n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ye,$e+1,0,0,lt.width,lt.height,Me,Ge,lt.data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ye,$e+1,xe,lt.width,lt.height,0,Me,Ge,lt.data)}}else{He?n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ye,0,0,0,Me,Ge,Ne[ye]):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ye,0,xe,Me,Ge,Ne[ye]);for(let $e=0;$e<je.length;$e++){const Ye=je[$e];He?n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ye,$e+1,0,0,Me,Ge,Ye.image[ye]):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ye,$e+1,xe,Me,Ge,Ye.image[ye])}}}T(F,ke)&&N(t.TEXTURE_CUBE_MAP),de.__version=he.version,F.onUpdate&&F.onUpdate(F)}O.__version=F.version}function W(O,F,Q,ve,he,de){const Ae=s.convert(Q.format,Q.colorSpace),_e=s.convert(Q.type),ze=R(Q.internalFormat,Ae,_e,Q.colorSpace);if(!r.get(F).__hasExternalTextures){const Ue=Math.max(1,F.width>>de),Ne=Math.max(1,F.height>>de);he===t.TEXTURE_3D||he===t.TEXTURE_2D_ARRAY?n.texImage3D(he,de,ze,Ue,Ne,F.depth,0,Ae,_e,null):n.texImage2D(he,de,ze,Ue,Ne,0,Ae,_e,null)}n.bindFramebuffer(t.FRAMEBUFFER,O),ce(F)?p.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,ve,he,r.get(Q).__webglTexture,0,se(F)):(he===t.TEXTURE_2D||he>=t.TEXTURE_CUBE_MAP_POSITIVE_X&&he<=t.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&t.framebufferTexture2D(t.FRAMEBUFFER,ve,he,r.get(Q).__webglTexture,de),n.bindFramebuffer(t.FRAMEBUFFER,null)}function B(O,F,Q){if(t.bindRenderbuffer(t.RENDERBUFFER,O),F.depthBuffer&&!F.stencilBuffer){let ve=l===!0?t.DEPTH_COMPONENT24:t.DEPTH_COMPONENT16;if(Q||ce(F)){const he=F.depthTexture;he&&he.isDepthTexture&&(he.type===Wd?ve=t.DEPTH_COMPONENT32F:he.type===jm&&(ve=t.DEPTH_COMPONENT24));const de=se(F);ce(F)?p.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,de,ve,F.width,F.height):t.renderbufferStorageMultisample(t.RENDERBUFFER,de,ve,F.width,F.height)}else t.renderbufferStorage(t.RENDERBUFFER,ve,F.width,F.height);t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.RENDERBUFFER,O)}else if(F.depthBuffer&&F.stencilBuffer){const ve=se(F);Q&&ce(F)===!1?t.renderbufferStorageMultisample(t.RENDERBUFFER,ve,t.DEPTH24_STENCIL8,F.width,F.height):ce(F)?p.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,ve,t.DEPTH24_STENCIL8,F.width,F.height):t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_STENCIL,F.width,F.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.RENDERBUFFER,O)}else{const ve=F.isWebGLMultipleRenderTargets===!0?F.texture:[F.texture];for(let he=0;he<ve.length;he++){const de=ve[he],Ae=s.convert(de.format,de.colorSpace),_e=s.convert(de.type),ze=R(de.internalFormat,Ae,_e,de.colorSpace),Be=se(F);Q&&ce(F)===!1?t.renderbufferStorageMultisample(t.RENDERBUFFER,Be,ze,F.width,F.height):ce(F)?p.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,Be,ze,F.width,F.height):t.renderbufferStorage(t.RENDERBUFFER,ze,F.width,F.height)}}t.bindRenderbuffer(t.RENDERBUFFER,null)}function ae(O,F){if(F&&F.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(n.bindFramebuffer(t.FRAMEBUFFER,O),!(F.depthTexture&&F.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");(!r.get(F.depthTexture).__webglTexture||F.depthTexture.image.width!==F.width||F.depthTexture.image.height!==F.height)&&(F.depthTexture.image.width=F.width,F.depthTexture.image.height=F.height,F.depthTexture.needsUpdate=!0),ge(F.depthTexture,0);const ve=r.get(F.depthTexture).__webglTexture,he=se(F);if(F.depthTexture.format===Pp)ce(F)?p.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.TEXTURE_2D,ve,0,he):t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.TEXTURE_2D,ve,0);else if(F.depthTexture.format===Ub)ce(F)?p.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.TEXTURE_2D,ve,0,he):t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.TEXTURE_2D,ve,0);else throw new Error("Unknown depthTexture format")}function z(O){const F=r.get(O),Q=O.isWebGLCubeRenderTarget===!0;if(O.depthTexture&&!F.__autoAllocateDepthBuffer){if(Q)throw new Error("target.depthTexture not supported in Cube render targets");ae(F.__webglFramebuffer,O)}else if(Q){F.__webglDepthbuffer=[];for(let ve=0;ve<6;ve++)n.bindFramebuffer(t.FRAMEBUFFER,F.__webglFramebuffer[ve]),F.__webglDepthbuffer[ve]=t.createRenderbuffer(),B(F.__webglDepthbuffer[ve],O,!1)}else n.bindFramebuffer(t.FRAMEBUFFER,F.__webglFramebuffer),F.__webglDepthbuffer=t.createRenderbuffer(),B(F.__webglDepthbuffer,O,!1);n.bindFramebuffer(t.FRAMEBUFFER,null)}function V(O,F,Q){const ve=r.get(O);F!==void 0&&W(ve.__webglFramebuffer,O,O.texture,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,0),Q!==void 0&&z(O)}function ee(O){const F=O.texture,Q=r.get(O),ve=r.get(F);O.addEventListener("dispose",U),O.isWebGLMultipleRenderTargets!==!0&&(ve.__webglTexture===void 0&&(ve.__webglTexture=t.createTexture()),ve.__version=F.version,o.memory.textures++);const he=O.isWebGLCubeRenderTarget===!0,de=O.isWebGLMultipleRenderTargets===!0,Ae=P(O)||l;if(he){Q.__webglFramebuffer=[];for(let _e=0;_e<6;_e++)if(l&&F.mipmaps&&F.mipmaps.length>0){Q.__webglFramebuffer[_e]=[];for(let ze=0;ze<F.mipmaps.length;ze++)Q.__webglFramebuffer[_e][ze]=t.createFramebuffer()}else Q.__webglFramebuffer[_e]=t.createFramebuffer()}else{if(l&&F.mipmaps&&F.mipmaps.length>0){Q.__webglFramebuffer=[];for(let _e=0;_e<F.mipmaps.length;_e++)Q.__webglFramebuffer[_e]=t.createFramebuffer()}else Q.__webglFramebuffer=t.createFramebuffer();if(de)if(a.drawBuffers){const _e=O.texture;for(let ze=0,Be=_e.length;ze<Be;ze++){const Ue=r.get(_e[ze]);Ue.__webglTexture===void 0&&(Ue.__webglTexture=t.createTexture(),o.memory.textures++)}}else console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.");if(l&&O.samples>0&&ce(O)===!1){const _e=de?F:[F];Q.__webglMultisampledFramebuffer=t.createFramebuffer(),Q.__webglColorRenderbuffer=[],n.bindFramebuffer(t.FRAMEBUFFER,Q.__webglMultisampledFramebuffer);for(let ze=0;ze<_e.length;ze++){const Be=_e[ze];Q.__webglColorRenderbuffer[ze]=t.createRenderbuffer(),t.bindRenderbuffer(t.RENDERBUFFER,Q.__webglColorRenderbuffer[ze]);const Ue=s.convert(Be.format,Be.colorSpace),Ne=s.convert(Be.type),Ee=R(Be.internalFormat,Ue,Ne,Be.colorSpace,O.isXRRenderTarget===!0),ke=se(O);t.renderbufferStorageMultisample(t.RENDERBUFFER,ke,Ee,O.width,O.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+ze,t.RENDERBUFFER,Q.__webglColorRenderbuffer[ze])}t.bindRenderbuffer(t.RENDERBUFFER,null),O.depthBuffer&&(Q.__webglDepthRenderbuffer=t.createRenderbuffer(),B(Q.__webglDepthRenderbuffer,O,!0)),n.bindFramebuffer(t.FRAMEBUFFER,null)}}if(he){n.bindTexture(t.TEXTURE_CUBE_MAP,ve.__webglTexture),Z(t.TEXTURE_CUBE_MAP,F,Ae);for(let _e=0;_e<6;_e++)if(l&&F.mipmaps&&F.mipmaps.length>0)for(let ze=0;ze<F.mipmaps.length;ze++)W(Q.__webglFramebuffer[_e][ze],O,F,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+_e,ze);else W(Q.__webglFramebuffer[_e],O,F,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+_e,0);T(F,Ae)&&N(t.TEXTURE_CUBE_MAP),n.unbindTexture()}else if(de){const _e=O.texture;for(let ze=0,Be=_e.length;ze<Be;ze++){const Ue=_e[ze],Ne=r.get(Ue);n.bindTexture(t.TEXTURE_2D,Ne.__webglTexture),Z(t.TEXTURE_2D,Ue,Ae),W(Q.__webglFramebuffer,O,Ue,t.COLOR_ATTACHMENT0+ze,t.TEXTURE_2D,0),T(Ue,Ae)&&N(t.TEXTURE_2D)}n.unbindTexture()}else{let _e=t.TEXTURE_2D;if((O.isWebGL3DRenderTarget||O.isWebGLArrayRenderTarget)&&(l?_e=O.isWebGL3DRenderTarget?t.TEXTURE_3D:t.TEXTURE_2D_ARRAY:console.error("THREE.WebGLTextures: THREE.Data3DTexture and THREE.DataArrayTexture only supported with WebGL2.")),n.bindTexture(_e,ve.__webglTexture),Z(_e,F,Ae),l&&F.mipmaps&&F.mipmaps.length>0)for(let ze=0;ze<F.mipmaps.length;ze++)W(Q.__webglFramebuffer[ze],O,F,t.COLOR_ATTACHMENT0,_e,ze);else W(Q.__webglFramebuffer,O,F,t.COLOR_ATTACHMENT0,_e,0);T(F,Ae)&&N(_e),n.unbindTexture()}O.depthBuffer&&z(O)}function K(O){const F=P(O)||l,Q=O.isWebGLMultipleRenderTargets===!0?O.texture:[O.texture];for(let ve=0,he=Q.length;ve<he;ve++){const de=Q[ve];if(T(de,F)){const Ae=O.isWebGLCubeRenderTarget?t.TEXTURE_CUBE_MAP:t.TEXTURE_2D,_e=r.get(de).__webglTexture;n.bindTexture(Ae,_e),N(Ae),n.unbindTexture()}}}function ne(O){if(l&&O.samples>0&&ce(O)===!1){const F=O.isWebGLMultipleRenderTargets?O.texture:[O.texture],Q=O.width,ve=O.height;let he=t.COLOR_BUFFER_BIT;const de=[],Ae=O.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,_e=r.get(O),ze=O.isWebGLMultipleRenderTargets===!0;if(ze)for(let Be=0;Be<F.length;Be++)n.bindFramebuffer(t.FRAMEBUFFER,_e.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+Be,t.RENDERBUFFER,null),n.bindFramebuffer(t.FRAMEBUFFER,_e.__webglFramebuffer),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+Be,t.TEXTURE_2D,null,0);n.bindFramebuffer(t.READ_FRAMEBUFFER,_e.__webglMultisampledFramebuffer),n.bindFramebuffer(t.DRAW_FRAMEBUFFER,_e.__webglFramebuffer);for(let Be=0;Be<F.length;Be++){de.push(t.COLOR_ATTACHMENT0+Be),O.depthBuffer&&de.push(Ae);const Ue=_e.__ignoreDepthValues!==void 0?_e.__ignoreDepthValues:!1;if(Ue===!1&&(O.depthBuffer&&(he|=t.DEPTH_BUFFER_BIT),O.stencilBuffer&&(he|=t.STENCIL_BUFFER_BIT)),ze&&t.framebufferRenderbuffer(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.RENDERBUFFER,_e.__webglColorRenderbuffer[Be]),Ue===!0&&(t.invalidateFramebuffer(t.READ_FRAMEBUFFER,[Ae]),t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,[Ae])),ze){const Ne=r.get(F[Be]).__webglTexture;t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,Ne,0)}t.blitFramebuffer(0,0,Q,ve,0,0,Q,ve,he,t.NEAREST),f&&t.invalidateFramebuffer(t.READ_FRAMEBUFFER,de)}if(n.bindFramebuffer(t.READ_FRAMEBUFFER,null),n.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),ze)for(let Be=0;Be<F.length;Be++){n.bindFramebuffer(t.FRAMEBUFFER,_e.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+Be,t.RENDERBUFFER,_e.__webglColorRenderbuffer[Be]);const Ue=r.get(F[Be]).__webglTexture;n.bindFramebuffer(t.FRAMEBUFFER,_e.__webglFramebuffer),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+Be,t.TEXTURE_2D,Ue,0)}n.bindFramebuffer(t.DRAW_FRAMEBUFFER,_e.__webglMultisampledFramebuffer)}}function se(O){return Math.min(m,O.samples)}function ce(O){const F=r.get(O);return l&&O.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&F.__useRenderToTexture!==!1}function fe(O){const F=o.render.frame;y.get(O)!==F&&(y.set(O,F),O.update())}function oe(O,F){const Q=O.colorSpace,ve=O.format,he=O.type;return O.isCompressedTexture===!0||O.isVideoTexture===!0||O.format===M3||Q!==hu&&Q!==ul&&(Hr.getTransfer(Q)===si?l===!1?e.has("EXT_sRGB")===!0&&ve===dl?(O.format=M3,O.minFilter=cl,O.generateMipmaps=!1):F=mQ.sRGBToLinear(F):(ve!==dl||he!==Xm)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",Q)),F}this.allocateTextureUnit=ue,this.resetTextureUnits=J,this.setTexture2D=ge,this.setTexture2DArray=X,this.setTexture3D=ie,this.setTextureCube=le,this.rebindTextures=V,this.setupRenderTarget=ee,this.updateRenderTargetMipmap=K,this.updateMultisampleRenderTarget=ne,this.setupDepthRenderbuffer=z,this.setupFrameBufferTexture=W,this.useMultisampledRTT=ce}function kPe(t,e,n){const r=n.isWebGL2;function a(s,o=ul){let l;const c=Hr.getTransfer(o);if(s===Xm)return t.UNSIGNED_BYTE;if(s===tQ)return t.UNSIGNED_SHORT_4_4_4_4;if(s===nQ)return t.UNSIGNED_SHORT_5_5_5_1;if(s===K_e)return t.BYTE;if(s===Y_e)return t.SHORT;if(s===yL)return t.UNSIGNED_SHORT;if(s===eQ)return t.INT;if(s===jm)return t.UNSIGNED_INT;if(s===Wd)return t.FLOAT;if(s===Wv)return r?t.HALF_FLOAT:(l=e.get("OES_texture_half_float"),l!==null?l.HALF_FLOAT_OES:null);if(s===X_e)return t.ALPHA;if(s===dl)return t.RGBA;if(s===Q_e)return t.LUMINANCE;if(s===Z_e)return t.LUMINANCE_ALPHA;if(s===Pp)return t.DEPTH_COMPONENT;if(s===Ub)return t.DEPTH_STENCIL;if(s===M3)return l=e.get("EXT_sRGB"),l!==null?l.SRGB_ALPHA_EXT:null;if(s===J_e)return t.RED;if(s===rQ)return t.RED_INTEGER;if(s===e1e)return t.RG;if(s===iQ)return t.RG_INTEGER;if(s===aQ)return t.RGBA_INTEGER;if(s===UM||s===BM||s===HM||s===$M)if(c===si)if(l=e.get("WEBGL_compressed_texture_s3tc_srgb"),l!==null){if(s===UM)return l.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(s===BM)return l.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(s===HM)return l.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(s===$M)return l.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(l=e.get("WEBGL_compressed_texture_s3tc"),l!==null){if(s===UM)return l.COMPRESSED_RGB_S3TC_DXT1_EXT;if(s===BM)return l.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(s===HM)return l.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(s===$M)return l.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(s===P6||s===A6||s===M6||s===E6)if(l=e.get("WEBGL_compressed_texture_pvrtc"),l!==null){if(s===P6)return l.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(s===A6)return l.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(s===M6)return l.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(s===E6)return l.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(s===sQ)return l=e.get("WEBGL_compressed_texture_etc1"),l!==null?l.COMPRESSED_RGB_ETC1_WEBGL:null;if(s===j6||s===D6)if(l=e.get("WEBGL_compressed_texture_etc"),l!==null){if(s===j6)return c===si?l.COMPRESSED_SRGB8_ETC2:l.COMPRESSED_RGB8_ETC2;if(s===D6)return c===si?l.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:l.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(s===R6||s===F6||s===L6||s===O6||s===I6||s===z6||s===U6||s===B6||s===H6||s===$6||s===q6||s===V6||s===G6||s===W6)if(l=e.get("WEBGL_compressed_texture_astc"),l!==null){if(s===R6)return c===si?l.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:l.COMPRESSED_RGBA_ASTC_4x4_KHR;if(s===F6)return c===si?l.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:l.COMPRESSED_RGBA_ASTC_5x4_KHR;if(s===L6)return c===si?l.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:l.COMPRESSED_RGBA_ASTC_5x5_KHR;if(s===O6)return c===si?l.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:l.COMPRESSED_RGBA_ASTC_6x5_KHR;if(s===I6)return c===si?l.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:l.COMPRESSED_RGBA_ASTC_6x6_KHR;if(s===z6)return c===si?l.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:l.COMPRESSED_RGBA_ASTC_8x5_KHR;if(s===U6)return c===si?l.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:l.COMPRESSED_RGBA_ASTC_8x6_KHR;if(s===B6)return c===si?l.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:l.COMPRESSED_RGBA_ASTC_8x8_KHR;if(s===H6)return c===si?l.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:l.COMPRESSED_RGBA_ASTC_10x5_KHR;if(s===$6)return c===si?l.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:l.COMPRESSED_RGBA_ASTC_10x6_KHR;if(s===q6)return c===si?l.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:l.COMPRESSED_RGBA_ASTC_10x8_KHR;if(s===V6)return c===si?l.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:l.COMPRESSED_RGBA_ASTC_10x10_KHR;if(s===G6)return c===si?l.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:l.COMPRESSED_RGBA_ASTC_12x10_KHR;if(s===W6)return c===si?l.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:l.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(s===qM||s===K6||s===Y6)if(l=e.get("EXT_texture_compression_bptc"),l!==null){if(s===qM)return c===si?l.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:l.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(s===K6)return l.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(s===Y6)return l.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(s===t1e||s===X6||s===Q6||s===Z6)if(l=e.get("EXT_texture_compression_rgtc"),l!==null){if(s===qM)return l.COMPRESSED_RED_RGTC1_EXT;if(s===X6)return l.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(s===Q6)return l.COMPRESSED_RED_GREEN_RGTC2_EXT;if(s===Z6)return l.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return s===Tp?r?t.UNSIGNED_INT_24_8:(l=e.get("WEBGL_depth_texture"),l!==null?l.UNSIGNED_INT_24_8_WEBGL:null):t[s]!==void 0?t[s]:null}return{convert:a}}class NPe extends Ao{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class Wy extends Os{constructor(){super(),this.isGroup=!0,this.type="Group"}}const CPe={type:"move"};class h2{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Wy,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 Wy,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new rt,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new rt),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Wy,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new rt,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new rt),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 r of e.hand.values())this._getHandJoint(n,r)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,n,r){let a=null,s=null,o=null;const l=this._targetRay,c=this._grip,d=this._hand;if(e&&n.session.visibilityState!=="visible-blurred"){if(d&&e.hand){o=!0;for(const x of e.hand.values()){const b=n.getJointPose(x,r),v=this._getHandJoint(d,x);b!==null&&(v.matrix.fromArray(b.transform.matrix),v.matrix.decompose(v.position,v.rotation,v.scale),v.matrixWorldNeedsUpdate=!0,v.jointRadius=b.radius),v.visible=b!==null}const u=d.joints["index-finger-tip"],m=d.joints["thumb-tip"],p=u.position.distanceTo(m.position),f=.02,y=.005;d.inputState.pinching&&p>f+y?(d.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!d.inputState.pinching&&p<=f-y&&(d.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else c!==null&&e.gripSpace&&(s=n.getPose(e.gripSpace,r),s!==null&&(c.matrix.fromArray(s.transform.matrix),c.matrix.decompose(c.position,c.rotation,c.scale),c.matrixWorldNeedsUpdate=!0,s.linearVelocity?(c.hasLinearVelocity=!0,c.linearVelocity.copy(s.linearVelocity)):c.hasLinearVelocity=!1,s.angularVelocity?(c.hasAngularVelocity=!0,c.angularVelocity.copy(s.angularVelocity)):c.hasAngularVelocity=!1));l!==null&&(a=n.getPose(e.targetRaySpace,r),a===null&&s!==null&&(a=s),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,this.dispatchEvent(CPe)))}return l!==null&&(l.visible=a!==null),c!==null&&(c.visible=s!==null),d!==null&&(d.visible=o!==null),this}_getHandJoint(e,n){if(e.joints[n.jointName]===void 0){const r=new Wy;r.matrixAutoUpdate=!1,r.visible=!1,e.joints[n.jointName]=r,e.add(r)}return e.joints[n.jointName]}}class TPe extends yf{constructor(e,n){super();const r=this;let a=null,s=1,o=null,l="local-floor",c=1,d=null,u=null,m=null,p=null,f=null,y=null;const x=n.getContextAttributes();let b=null,v=null;const _=[],k=[],P=new Fn;let C=null;const T=new Ao;T.layers.enable(1),T.viewport=new qr;const N=new Ao;N.layers.enable(2),N.viewport=new qr;const R=[T,N],A=new NPe;A.layers.enable(1),A.layers.enable(2);let D=null,$=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(le){let pe=_[le];return pe===void 0&&(pe=new h2,_[le]=pe),pe.getTargetRaySpace()},this.getControllerGrip=function(le){let pe=_[le];return pe===void 0&&(pe=new h2,_[le]=pe),pe.getGripSpace()},this.getHand=function(le){let pe=_[le];return pe===void 0&&(pe=new h2,_[le]=pe),pe.getHandSpace()};function U(le){const pe=k.indexOf(le.inputSource);if(pe===-1)return;const Ce=_[pe];Ce!==void 0&&(Ce.update(le.inputSource,le.frame,d||o),Ce.dispatchEvent({type:le.type,data:le.inputSource}))}function G(){a.removeEventListener("select",U),a.removeEventListener("selectstart",U),a.removeEventListener("selectend",U),a.removeEventListener("squeeze",U),a.removeEventListener("squeezestart",U),a.removeEventListener("squeezeend",U),a.removeEventListener("end",G),a.removeEventListener("inputsourceschange",L);for(let le=0;le<_.length;le++){const pe=k[le];pe!==null&&(k[le]=null,_[le].disconnect(pe))}D=null,$=null,e.setRenderTarget(b),f=null,p=null,m=null,a=null,v=null,ie.stop(),r.isPresenting=!1,e.setPixelRatio(C),e.setSize(P.width,P.height,!1),r.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(le){s=le,r.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(le){l=le,r.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return d||o},this.setReferenceSpace=function(le){d=le},this.getBaseLayer=function(){return p!==null?p:f},this.getBinding=function(){return m},this.getFrame=function(){return y},this.getSession=function(){return a},this.setSession=async function(le){if(a=le,a!==null){if(b=e.getRenderTarget(),a.addEventListener("select",U),a.addEventListener("selectstart",U),a.addEventListener("selectend",U),a.addEventListener("squeeze",U),a.addEventListener("squeezestart",U),a.addEventListener("squeezeend",U),a.addEventListener("end",G),a.addEventListener("inputsourceschange",L),x.xrCompatible!==!0&&await n.makeXRCompatible(),C=e.getPixelRatio(),e.getSize(P),a.renderState.layers===void 0||e.capabilities.isWebGL2===!1){const pe={antialias:a.renderState.layers===void 0?x.antialias:!0,alpha:!0,depth:x.depth,stencil:x.stencil,framebufferScaleFactor:s};f=new XRWebGLLayer(a,n,pe),a.updateRenderState({baseLayer:f}),e.setPixelRatio(1),e.setSize(f.framebufferWidth,f.framebufferHeight,!1),v=new Qp(f.framebufferWidth,f.framebufferHeight,{format:dl,type:Xm,colorSpace:e.outputColorSpace,stencilBuffer:x.stencil})}else{let pe=null,Ce=null,q=null;x.depth&&(q=x.stencil?n.DEPTH24_STENCIL8:n.DEPTH_COMPONENT24,pe=x.stencil?Ub:Pp,Ce=x.stencil?Tp:jm);const Z={colorFormat:n.RGBA8,depthFormat:q,scaleFactor:s};m=new XRWebGLBinding(a,n),p=m.createProjectionLayer(Z),a.updateRenderState({layers:[p]}),e.setPixelRatio(1),e.setSize(p.textureWidth,p.textureHeight,!1),v=new Qp(p.textureWidth,p.textureHeight,{format:dl,type:Xm,depthTexture:new kQ(p.textureWidth,p.textureHeight,Ce,void 0,void 0,void 0,void 0,void 0,void 0,pe),stencilBuffer:x.stencil,colorSpace:e.outputColorSpace,samples:x.antialias?4:0});const j=e.properties.get(v);j.__ignoreDepthValues=p.ignoreDepthValues}v.isXRRenderTarget=!0,this.setFoveation(c),d=null,o=await a.requestReferenceSpace(l),ie.setContext(a),ie.start(),r.isPresenting=!0,r.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(a!==null)return a.environmentBlendMode};function L(le){for(let pe=0;pe<le.removed.length;pe++){const Ce=le.removed[pe],q=k.indexOf(Ce);q>=0&&(k[q]=null,_[q].disconnect(Ce))}for(let pe=0;pe<le.added.length;pe++){const Ce=le.added[pe];let q=k.indexOf(Ce);if(q===-1){for(let j=0;j<_.length;j++)if(j>=k.length){k.push(Ce),q=j;break}else if(k[j]===null){k[j]=Ce,q=j;break}if(q===-1)break}const Z=_[q];Z&&Z.connect(Ce)}}const te=new rt,re=new rt;function J(le,pe,Ce){te.setFromMatrixPosition(pe.matrixWorld),re.setFromMatrixPosition(Ce.matrixWorld);const q=te.distanceTo(re),Z=pe.projectionMatrix.elements,j=Ce.projectionMatrix.elements,E=Z[14]/(Z[10]-1),I=Z[14]/(Z[10]+1),W=(Z[9]+1)/Z[5],B=(Z[9]-1)/Z[5],ae=(Z[8]-1)/Z[0],z=(j[8]+1)/j[0],V=E*ae,ee=E*z,K=q/(-ae+z),ne=K*-ae;pe.matrixWorld.decompose(le.position,le.quaternion,le.scale),le.translateX(ne),le.translateZ(K),le.matrixWorld.compose(le.position,le.quaternion,le.scale),le.matrixWorldInverse.copy(le.matrixWorld).invert();const se=E+K,ce=I+K,fe=V-ne,oe=ee+(q-ne),O=W*I/ce*se,F=B*I/ce*se;le.projectionMatrix.makePerspective(fe,oe,O,F,se,ce),le.projectionMatrixInverse.copy(le.projectionMatrix).invert()}function ue(le,pe){pe===null?le.matrixWorld.copy(le.matrix):le.matrixWorld.multiplyMatrices(pe.matrixWorld,le.matrix),le.matrixWorldInverse.copy(le.matrixWorld).invert()}this.updateCamera=function(le){if(a===null)return;A.near=N.near=T.near=le.near,A.far=N.far=T.far=le.far,(D!==A.near||$!==A.far)&&(a.updateRenderState({depthNear:A.near,depthFar:A.far}),D=A.near,$=A.far);const pe=le.parent,Ce=A.cameras;ue(A,pe);for(let q=0;q<Ce.length;q++)ue(Ce[q],pe);Ce.length===2?J(A,T,N):A.projectionMatrix.copy(T.projectionMatrix),me(le,A,pe)};function me(le,pe,Ce){Ce===null?le.matrix.copy(pe.matrixWorld):(le.matrix.copy(Ce.matrixWorld),le.matrix.invert(),le.matrix.multiply(pe.matrixWorld)),le.matrix.decompose(le.position,le.quaternion,le.scale),le.updateMatrixWorld(!0),le.projectionMatrix.copy(pe.projectionMatrix),le.projectionMatrixInverse.copy(pe.projectionMatrixInverse),le.isPerspectiveCamera&&(le.fov=Yv*2*Math.atan(1/le.projectionMatrix.elements[5]),le.zoom=1)}this.getCamera=function(){return A},this.getFoveation=function(){if(!(p===null&&f===null))return c},this.setFoveation=function(le){c=le,p!==null&&(p.fixedFoveation=le),f!==null&&f.fixedFoveation!==void 0&&(f.fixedFoveation=le)};let ge=null;function X(le,pe){if(u=pe.getViewerPose(d||o),y=pe,u!==null){const Ce=u.views;f!==null&&(e.setRenderTargetFramebuffer(v,f.framebuffer),e.setRenderTarget(v));let q=!1;Ce.length!==A.cameras.length&&(A.cameras.length=0,q=!0);for(let Z=0;Z<Ce.length;Z++){const j=Ce[Z];let E=null;if(f!==null)E=f.getViewport(j);else{const W=m.getViewSubImage(p,j);E=W.viewport,Z===0&&(e.setRenderTargetTextures(v,W.colorTexture,p.ignoreDepthValues?void 0:W.depthStencilTexture),e.setRenderTarget(v))}let I=R[Z];I===void 0&&(I=new Ao,I.layers.enable(Z),I.viewport=new qr,R[Z]=I),I.matrix.fromArray(j.transform.matrix),I.matrix.decompose(I.position,I.quaternion,I.scale),I.projectionMatrix.fromArray(j.projectionMatrix),I.projectionMatrixInverse.copy(I.projectionMatrix).invert(),I.viewport.set(E.x,E.y,E.width,E.height),Z===0&&(A.matrix.copy(I.matrix),A.matrix.decompose(A.position,A.quaternion,A.scale)),q===!0&&A.cameras.push(I)}}for(let Ce=0;Ce<_.length;Ce++){const q=k[Ce],Z=_[Ce];q!==null&&Z!==void 0&&Z.update(q,pe,d||o)}ge&&ge(le,pe),pe.detectedPlanes&&r.dispatchEvent({type:"planesdetected",data:pe}),y=null}const ie=new _Q;ie.setAnimationLoop(X),this.setAnimationLoop=function(le){ge=le},this.dispose=function(){}}}function PPe(t,e){function n(b,v){b.matrixAutoUpdate===!0&&b.updateMatrix(),v.value.copy(b.matrix)}function r(b,v){v.color.getRGB(b.fogColor.value,vQ(t)),v.isFog?(b.fogNear.value=v.near,b.fogFar.value=v.far):v.isFogExp2&&(b.fogDensity.value=v.density)}function a(b,v,_,k,P){v.isMeshBasicMaterial||v.isMeshLambertMaterial?s(b,v):v.isMeshToonMaterial?(s(b,v),m(b,v)):v.isMeshPhongMaterial?(s(b,v),u(b,v)):v.isMeshStandardMaterial?(s(b,v),p(b,v),v.isMeshPhysicalMaterial&&f(b,v,P)):v.isMeshMatcapMaterial?(s(b,v),y(b,v)):v.isMeshDepthMaterial?s(b,v):v.isMeshDistanceMaterial?(s(b,v),x(b,v)):v.isMeshNormalMaterial?s(b,v):v.isLineBasicMaterial?(o(b,v),v.isLineDashedMaterial&&l(b,v)):v.isPointsMaterial?c(b,v,_,k):v.isSpriteMaterial?d(b,v):v.isShadowMaterial?(b.color.value.copy(v.color),b.opacity.value=v.opacity):v.isShaderMaterial&&(v.uniformsNeedUpdate=!1)}function s(b,v){b.opacity.value=v.opacity,v.color&&b.diffuse.value.copy(v.color),v.emissive&&b.emissive.value.copy(v.emissive).multiplyScalar(v.emissiveIntensity),v.map&&(b.map.value=v.map,n(v.map,b.mapTransform)),v.alphaMap&&(b.alphaMap.value=v.alphaMap,n(v.alphaMap,b.alphaMapTransform)),v.bumpMap&&(b.bumpMap.value=v.bumpMap,n(v.bumpMap,b.bumpMapTransform),b.bumpScale.value=v.bumpScale,v.side===so&&(b.bumpScale.value*=-1)),v.normalMap&&(b.normalMap.value=v.normalMap,n(v.normalMap,b.normalMapTransform),b.normalScale.value.copy(v.normalScale),v.side===so&&b.normalScale.value.negate()),v.displacementMap&&(b.displacementMap.value=v.displacementMap,n(v.displacementMap,b.displacementMapTransform),b.displacementScale.value=v.displacementScale,b.displacementBias.value=v.displacementBias),v.emissiveMap&&(b.emissiveMap.value=v.emissiveMap,n(v.emissiveMap,b.emissiveMapTransform)),v.specularMap&&(b.specularMap.value=v.specularMap,n(v.specularMap,b.specularMapTransform)),v.alphaTest>0&&(b.alphaTest.value=v.alphaTest);const _=e.get(v).envMap;if(_&&(b.envMap.value=_,b.flipEnvMap.value=_.isCubeTexture&&_.isRenderTargetTexture===!1?-1:1,b.reflectivity.value=v.reflectivity,b.ior.value=v.ior,b.refractionRatio.value=v.refractionRatio),v.lightMap){b.lightMap.value=v.lightMap;const k=t._useLegacyLights===!0?Math.PI:1;b.lightMapIntensity.value=v.lightMapIntensity*k,n(v.lightMap,b.lightMapTransform)}v.aoMap&&(b.aoMap.value=v.aoMap,b.aoMapIntensity.value=v.aoMapIntensity,n(v.aoMap,b.aoMapTransform))}function o(b,v){b.diffuse.value.copy(v.color),b.opacity.value=v.opacity,v.map&&(b.map.value=v.map,n(v.map,b.mapTransform))}function l(b,v){b.dashSize.value=v.dashSize,b.totalSize.value=v.dashSize+v.gapSize,b.scale.value=v.scale}function c(b,v,_,k){b.diffuse.value.copy(v.color),b.opacity.value=v.opacity,b.size.value=v.size*_,b.scale.value=k*.5,v.map&&(b.map.value=v.map,n(v.map,b.uvTransform)),v.alphaMap&&(b.alphaMap.value=v.alphaMap,n(v.alphaMap,b.alphaMapTransform)),v.alphaTest>0&&(b.alphaTest.value=v.alphaTest)}function d(b,v){b.diffuse.value.copy(v.color),b.opacity.value=v.opacity,b.rotation.value=v.rotation,v.map&&(b.map.value=v.map,n(v.map,b.mapTransform)),v.alphaMap&&(b.alphaMap.value=v.alphaMap,n(v.alphaMap,b.alphaMapTransform)),v.alphaTest>0&&(b.alphaTest.value=v.alphaTest)}function u(b,v){b.specular.value.copy(v.specular),b.shininess.value=Math.max(v.shininess,1e-4)}function m(b,v){v.gradientMap&&(b.gradientMap.value=v.gradientMap)}function p(b,v){b.metalness.value=v.metalness,v.metalnessMap&&(b.metalnessMap.value=v.metalnessMap,n(v.metalnessMap,b.metalnessMapTransform)),b.roughness.value=v.roughness,v.roughnessMap&&(b.roughnessMap.value=v.roughnessMap,n(v.roughnessMap,b.roughnessMapTransform)),e.get(v).envMap&&(b.envMapIntensity.value=v.envMapIntensity)}function f(b,v,_){b.ior.value=v.ior,v.sheen>0&&(b.sheenColor.value.copy(v.sheenColor).multiplyScalar(v.sheen),b.sheenRoughness.value=v.sheenRoughness,v.sheenColorMap&&(b.sheenColorMap.value=v.sheenColorMap,n(v.sheenColorMap,b.sheenColorMapTransform)),v.sheenRoughnessMap&&(b.sheenRoughnessMap.value=v.sheenRoughnessMap,n(v.sheenRoughnessMap,b.sheenRoughnessMapTransform))),v.clearcoat>0&&(b.clearcoat.value=v.clearcoat,b.clearcoatRoughness.value=v.clearcoatRoughness,v.clearcoatMap&&(b.clearcoatMap.value=v.clearcoatMap,n(v.clearcoatMap,b.clearcoatMapTransform)),v.clearcoatRoughnessMap&&(b.clearcoatRoughnessMap.value=v.clearcoatRoughnessMap,n(v.clearcoatRoughnessMap,b.clearcoatRoughnessMapTransform)),v.clearcoatNormalMap&&(b.clearcoatNormalMap.value=v.clearcoatNormalMap,n(v.clearcoatNormalMap,b.clearcoatNormalMapTransform),b.clearcoatNormalScale.value.copy(v.clearcoatNormalScale),v.side===so&&b.clearcoatNormalScale.value.negate())),v.iridescence>0&&(b.iridescence.value=v.iridescence,b.iridescenceIOR.value=v.iridescenceIOR,b.iridescenceThicknessMinimum.value=v.iridescenceThicknessRange[0],b.iridescenceThicknessMaximum.value=v.iridescenceThicknessRange[1],v.iridescenceMap&&(b.iridescenceMap.value=v.iridescenceMap,n(v.iridescenceMap,b.iridescenceMapTransform)),v.iridescenceThicknessMap&&(b.iridescenceThicknessMap.value=v.iridescenceThicknessMap,n(v.iridescenceThicknessMap,b.iridescenceThicknessMapTransform))),v.transmission>0&&(b.transmission.value=v.transmission,b.transmissionSamplerMap.value=_.texture,b.transmissionSamplerSize.value.set(_.width,_.height),v.transmissionMap&&(b.transmissionMap.value=v.transmissionMap,n(v.transmissionMap,b.transmissionMapTransform)),b.thickness.value=v.thickness,v.thicknessMap&&(b.thicknessMap.value=v.thicknessMap,n(v.thicknessMap,b.thicknessMapTransform)),b.attenuationDistance.value=v.attenuationDistance,b.attenuationColor.value.copy(v.attenuationColor)),v.anisotropy>0&&(b.anisotropyVector.value.set(v.anisotropy*Math.cos(v.anisotropyRotation),v.anisotropy*Math.sin(v.anisotropyRotation)),v.anisotropyMap&&(b.anisotropyMap.value=v.anisotropyMap,n(v.anisotropyMap,b.anisotropyMapTransform))),b.specularIntensity.value=v.specularIntensity,b.specularColor.value.copy(v.specularColor),v.specularColorMap&&(b.specularColorMap.value=v.specularColorMap,n(v.specularColorMap,b.specularColorMapTransform)),v.specularIntensityMap&&(b.specularIntensityMap.value=v.specularIntensityMap,n(v.specularIntensityMap,b.specularIntensityMapTransform))}function y(b,v){v.matcap&&(b.matcap.value=v.matcap)}function x(b,v){const _=e.get(v).light;b.referencePosition.value.setFromMatrixPosition(_.matrixWorld),b.nearDistance.value=_.shadow.camera.near,b.farDistance.value=_.shadow.camera.far}return{refreshFogUniforms:r,refreshMaterialUniforms:a}}function APe(t,e,n,r){let a={},s={},o=[];const l=n.isWebGL2?t.getParameter(t.MAX_UNIFORM_BUFFER_BINDINGS):0;function c(_,k){const P=k.program;r.uniformBlockBinding(_,P)}function d(_,k){let P=a[_.id];P===void 0&&(y(_),P=u(_),a[_.id]=P,_.addEventListener("dispose",b));const C=k.program;r.updateUBOMapping(_,C);const T=e.render.frame;s[_.id]!==T&&(p(_),s[_.id]=T)}function u(_){const k=m();_.__bindingPointIndex=k;const P=t.createBuffer(),C=_.__size,T=_.usage;return t.bindBuffer(t.UNIFORM_BUFFER,P),t.bufferData(t.UNIFORM_BUFFER,C,T),t.bindBuffer(t.UNIFORM_BUFFER,null),t.bindBufferBase(t.UNIFORM_BUFFER,k,P),P}function m(){for(let _=0;_<l;_++)if(o.indexOf(_)===-1)return o.push(_),_;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function p(_){const k=a[_.id],P=_.uniforms,C=_.__cache;t.bindBuffer(t.UNIFORM_BUFFER,k);for(let T=0,N=P.length;T<N;T++){const R=P[T];if(f(R,T,C)===!0){const A=R.__offset,D=Array.isArray(R.value)?R.value:[R.value];let $=0;for(let U=0;U<D.length;U++){const G=D[U],L=x(G);typeof G=="number"?(R.__data[0]=G,t.bufferSubData(t.UNIFORM_BUFFER,A+$,R.__data)):G.isMatrix3?(R.__data[0]=G.elements[0],R.__data[1]=G.elements[1],R.__data[2]=G.elements[2],R.__data[3]=G.elements[0],R.__data[4]=G.elements[3],R.__data[5]=G.elements[4],R.__data[6]=G.elements[5],R.__data[7]=G.elements[0],R.__data[8]=G.elements[6],R.__data[9]=G.elements[7],R.__data[10]=G.elements[8],R.__data[11]=G.elements[0]):(G.toArray(R.__data,$),$+=L.storage/Float32Array.BYTES_PER_ELEMENT)}t.bufferSubData(t.UNIFORM_BUFFER,A,R.__data)}}t.bindBuffer(t.UNIFORM_BUFFER,null)}function f(_,k,P){const C=_.value;if(P[k]===void 0){if(typeof C=="number")P[k]=C;else{const T=Array.isArray(C)?C:[C],N=[];for(let R=0;R<T.length;R++)N.push(T[R].clone());P[k]=N}return!0}else if(typeof C=="number"){if(P[k]!==C)return P[k]=C,!0}else{const T=Array.isArray(P[k])?P[k]:[P[k]],N=Array.isArray(C)?C:[C];for(let R=0;R<T.length;R++){const A=T[R];if(A.equals(N[R])===!1)return A.copy(N[R]),!0}}return!1}function y(_){const k=_.uniforms;let P=0;const C=16;let T=0;for(let N=0,R=k.length;N<R;N++){const A=k[N],D={boundary:0,storage:0},$=Array.isArray(A.value)?A.value:[A.value];for(let U=0,G=$.length;U<G;U++){const L=$[U],te=x(L);D.boundary+=te.boundary,D.storage+=te.storage}if(A.__data=new Float32Array(D.storage/Float32Array.BYTES_PER_ELEMENT),A.__offset=P,N>0){T=P%C;const U=C-T;T!==0&&U-D.boundary<0&&(P+=C-T,A.__offset=P)}P+=D.storage}return T=P%C,T>0&&(P+=C-T),_.__size=P,_.__cache={},this}function x(_){const k={boundary:0,storage:0};return typeof _=="number"?(k.boundary=4,k.storage=4):_.isVector2?(k.boundary=8,k.storage=8):_.isVector3||_.isColor?(k.boundary=16,k.storage=12):_.isVector4?(k.boundary=16,k.storage=16):_.isMatrix3?(k.boundary=48,k.storage=48):_.isMatrix4?(k.boundary=64,k.storage=64):_.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",_),k}function b(_){const k=_.target;k.removeEventListener("dispose",b);const P=o.indexOf(k.__bindingPointIndex);o.splice(P,1),t.deleteBuffer(a[k.id]),delete a[k.id],delete s[k.id]}function v(){for(const _ in a)t.deleteBuffer(a[_]);o=[],a={},s={}}return{bind:c,update:d,dispose:v}}class D3{constructor(e={}){const{canvas:n=C1e(),context:r=null,depth:a=!0,stencil:s=!0,alpha:o=!1,antialias:l=!1,premultipliedAlpha:c=!0,preserveDrawingBuffer:d=!1,powerPreference:u="default",failIfMajorPerformanceCaveat:m=!1}=e;this.isWebGLRenderer=!0;let p;r!==null?p=r.getContextAttributes().alpha:p=o;const f=new Uint32Array(4),y=new Int32Array(4);let x=null,b=null;const v=[],_=[];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=Qa,this._useLegacyLights=!1,this.toneMapping=Ym,this.toneMappingExposure=1;const k=this;let P=!1,C=0,T=0,N=null,R=-1,A=null;const D=new qr,$=new qr;let U=null;const G=new yn(0);let L=0,te=n.width,re=n.height,J=1,ue=null,me=null;const ge=new qr(0,0,te,re),X=new qr(0,0,te,re);let ie=!1;const le=new TC;let pe=!1,Ce=!1,q=null;const Z=new ti,j=new Fn,E=new rt,I={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function W(){return N===null?J:1}let B=r;function ae(Ie,De){for(let Xe=0;Xe<Ie.length;Xe++){const at=Ie[Xe],Ke=n.getContext(at,De);if(Ke!==null)return Ke}return null}try{const Ie={alpha:!0,depth:a,stencil:s,antialias:l,premultipliedAlpha:c,preserveDrawingBuffer:d,powerPreference:u,failIfMajorPerformanceCaveat:m};if("setAttribute"in n&&n.setAttribute("data-engine",`three.js r${kC}`),n.addEventListener("webglcontextlost",He,!1),n.addEventListener("webglcontextrestored",Pe,!1),n.addEventListener("webglcontextcreationerror",Ve,!1),B===null){const De=["webgl2","webgl","experimental-webgl"];if(k.isWebGL1Renderer===!0&&De.shift(),B=ae(De,Ie),B===null)throw ae(De)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}typeof WebGLRenderingContext<"u"&&B instanceof WebGLRenderingContext&&console.warn("THREE.WebGLRenderer: WebGL 1 support was deprecated in r153 and will be removed in r163."),B.getShaderPrecisionFormat===void 0&&(B.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(Ie){throw console.error("THREE.WebGLRenderer: "+Ie.message),Ie}let z,V,ee,K,ne,se,ce,fe,oe,O,F,Q,ve,he,de,Ae,_e,ze,Be,Ue,Ne,Ee,ke,Me;function Ge(){z=new UCe(B),V=new DCe(B,z,e),z.init(V),Ee=new kPe(B,z,V),ee=new SPe(B,z,V),K=new $Ce(B),ne=new lPe,se=new _Pe(B,z,ee,ne,V,Ee,K),ce=new FCe(k),fe=new zCe(k),oe=new X1e(B,V),ke=new ECe(B,z,oe,V),O=new BCe(B,oe,K,ke),F=new WCe(B,O,oe,K),Be=new GCe(B,V,se),Ae=new RCe(ne),Q=new oPe(k,ce,fe,z,V,ke,Ae),ve=new PPe(k,ne),he=new dPe,de=new gPe(z,V),ze=new MCe(k,ce,fe,ee,F,p,c),_e=new wPe(k,F,V),Me=new APe(B,K,V,ee),Ue=new jCe(B,z,K,V),Ne=new HCe(B,z,K,V),K.programs=Q.programs,k.capabilities=V,k.extensions=z,k.properties=ne,k.renderLists=he,k.shadowMap=_e,k.state=ee,k.info=K}Ge();const xe=new TPe(k,B);this.xr=xe,this.getContext=function(){return B},this.getContextAttributes=function(){return B.getContextAttributes()},this.forceContextLoss=function(){const Ie=z.get("WEBGL_lose_context");Ie&&Ie.loseContext()},this.forceContextRestore=function(){const Ie=z.get("WEBGL_lose_context");Ie&&Ie.restoreContext()},this.getPixelRatio=function(){return J},this.setPixelRatio=function(Ie){Ie!==void 0&&(J=Ie,this.setSize(te,re,!1))},this.getSize=function(Ie){return Ie.set(te,re)},this.setSize=function(Ie,De,Xe=!0){if(xe.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}te=Ie,re=De,n.width=Math.floor(Ie*J),n.height=Math.floor(De*J),Xe===!0&&(n.style.width=Ie+"px",n.style.height=De+"px"),this.setViewport(0,0,Ie,De)},this.getDrawingBufferSize=function(Ie){return Ie.set(te*J,re*J).floor()},this.setDrawingBufferSize=function(Ie,De,Xe){te=Ie,re=De,J=Xe,n.width=Math.floor(Ie*Xe),n.height=Math.floor(De*Xe),this.setViewport(0,0,Ie,De)},this.getCurrentViewport=function(Ie){return Ie.copy(D)},this.getViewport=function(Ie){return Ie.copy(ge)},this.setViewport=function(Ie,De,Xe,at){Ie.isVector4?ge.set(Ie.x,Ie.y,Ie.z,Ie.w):ge.set(Ie,De,Xe,at),ee.viewport(D.copy(ge).multiplyScalar(J).floor())},this.getScissor=function(Ie){return Ie.copy(X)},this.setScissor=function(Ie,De,Xe,at){Ie.isVector4?X.set(Ie.x,Ie.y,Ie.z,Ie.w):X.set(Ie,De,Xe,at),ee.scissor($.copy(X).multiplyScalar(J).floor())},this.getScissorTest=function(){return ie},this.setScissorTest=function(Ie){ee.setScissorTest(ie=Ie)},this.setOpaqueSort=function(Ie){ue=Ie},this.setTransparentSort=function(Ie){me=Ie},this.getClearColor=function(Ie){return Ie.copy(ze.getClearColor())},this.setClearColor=function(){ze.setClearColor.apply(ze,arguments)},this.getClearAlpha=function(){return ze.getClearAlpha()},this.setClearAlpha=function(){ze.setClearAlpha.apply(ze,arguments)},this.clear=function(Ie=!0,De=!0,Xe=!0){let at=0;if(Ie){let Ke=!1;if(N!==null){const It=N.texture.format;Ke=It===aQ||It===iQ||It===rQ}if(Ke){const It=N.texture.type,Te=It===Xm||It===jm||It===yL||It===Tp||It===tQ||It===nQ,We=ze.getClearColor(),et=ze.getClearAlpha(),Ze=We.r,Le=We.g,mt=We.b;Te?(f[0]=Ze,f[1]=Le,f[2]=mt,f[3]=et,B.clearBufferuiv(B.COLOR,0,f)):(y[0]=Ze,y[1]=Le,y[2]=mt,y[3]=et,B.clearBufferiv(B.COLOR,0,y))}else at|=B.COLOR_BUFFER_BIT}De&&(at|=B.DEPTH_BUFFER_BIT),Xe&&(at|=B.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),B.clear(at)},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",He,!1),n.removeEventListener("webglcontextrestored",Pe,!1),n.removeEventListener("webglcontextcreationerror",Ve,!1),he.dispose(),de.dispose(),ne.dispose(),ce.dispose(),fe.dispose(),F.dispose(),ke.dispose(),Me.dispose(),Q.dispose(),xe.dispose(),xe.removeEventListener("sessionstart",ot),xe.removeEventListener("sessionend",ft),q&&(q.dispose(),q=null),qe.stop()};function He(Ie){Ie.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),P=!0}function Pe(){console.log("THREE.WebGLRenderer: Context Restored."),P=!1;const Ie=K.autoReset,De=_e.enabled,Xe=_e.autoUpdate,at=_e.needsUpdate,Ke=_e.type;Ge(),K.autoReset=Ie,_e.enabled=De,_e.autoUpdate=Xe,_e.needsUpdate=at,_e.type=Ke}function Ve(Ie){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",Ie.statusMessage)}function je(Ie){const De=Ie.target;De.removeEventListener("dispose",je),ye(De)}function ye(Ie){$e(Ie),ne.remove(Ie)}function $e(Ie){const De=ne.get(Ie).programs;De!==void 0&&(De.forEach(function(Xe){Q.releaseProgram(Xe)}),Ie.isShaderMaterial&&Q.releaseShaderCache(Ie))}this.renderBufferDirect=function(Ie,De,Xe,at,Ke,It){De===null&&(De=I);const Te=Ke.isMesh&&Ke.matrixWorld.determinant()<0,We=on(Ie,De,Xe,at,Ke);ee.setMaterial(at,Te);let et=Xe.index,Ze=1;if(at.wireframe===!0){if(et=O.getWireframeAttribute(Xe),et===void 0)return;Ze=2}const Le=Xe.drawRange,mt=Xe.attributes.position;let st=Le.start*Ze,tt=(Le.start+Le.count)*Ze;It!==null&&(st=Math.max(st,It.start*Ze),tt=Math.min(tt,(It.start+It.count)*Ze)),et!==null?(st=Math.max(st,0),tt=Math.min(tt,et.count)):mt!=null&&(st=Math.max(st,0),tt=Math.min(tt,mt.count));const Nt=tt-st;if(Nt<0||Nt===1/0)return;ke.setup(Ke,at,We,Xe,et);let Rt,jt=Ue;if(et!==null&&(Rt=oe.get(et),jt=Ne,jt.setIndex(Rt)),Ke.isMesh)at.wireframe===!0?(ee.setLineWidth(at.wireframeLinewidth*W()),jt.setMode(B.LINES)):jt.setMode(B.TRIANGLES);else if(Ke.isLine){let Ft=at.linewidth;Ft===void 0&&(Ft=1),ee.setLineWidth(Ft*W()),Ke.isLineSegments?jt.setMode(B.LINES):Ke.isLineLoop?jt.setMode(B.LINE_LOOP):jt.setMode(B.LINE_STRIP)}else Ke.isPoints?jt.setMode(B.POINTS):Ke.isSprite&&jt.setMode(B.TRIANGLES);if(Ke.isBatchedMesh)jt.renderMultiDraw(Ke._multiDrawStarts,Ke._multiDrawCounts,Ke._multiDrawCount);else if(Ke.isInstancedMesh)jt.renderInstances(st,Nt,Ke.count);else if(Xe.isInstancedBufferGeometry){const Ft=Xe._maxInstanceCount!==void 0?Xe._maxInstanceCount:1/0,mn=Math.min(Xe.instanceCount,Ft);jt.renderInstances(st,Nt,mn)}else jt.render(st,Nt)};function Ye(Ie,De,Xe){Ie.transparent===!0&&Ie.side===Bd&&Ie.forceSinglePass===!1?(Ie.side=so,Ie.needsUpdate=!0,Xt(Ie,De,Xe),Ie.side=sh,Ie.needsUpdate=!0,Xt(Ie,De,Xe),Ie.side=Bd):Xt(Ie,De,Xe)}this.compile=function(Ie,De,Xe=null){Xe===null&&(Xe=Ie),b=de.get(Xe),b.init(),_.push(b),Xe.traverseVisible(function(Ke){Ke.isLight&&Ke.layers.test(De.layers)&&(b.pushLight(Ke),Ke.castShadow&&b.pushShadow(Ke))}),Ie!==Xe&&Ie.traverseVisible(function(Ke){Ke.isLight&&Ke.layers.test(De.layers)&&(b.pushLight(Ke),Ke.castShadow&&b.pushShadow(Ke))}),b.setupLights(k._useLegacyLights);const at=new Set;return Ie.traverse(function(Ke){const It=Ke.material;if(It)if(Array.isArray(It))for(let Te=0;Te<It.length;Te++){const We=It[Te];Ye(We,Xe,Ke),at.add(We)}else Ye(It,Xe,Ke),at.add(It)}),_.pop(),b=null,at},this.compileAsync=function(Ie,De,Xe=null){const at=this.compile(Ie,De,Xe);return new Promise(Ke=>{function It(){if(at.forEach(function(Te){ne.get(Te).currentProgram.isReady()&&at.delete(Te)}),at.size===0){Ke(Ie);return}setTimeout(It,10)}z.get("KHR_parallel_shader_compile")!==null?It():setTimeout(It,10)})};let lt=null;function St(Ie){lt&<(Ie)}function ot(){qe.stop()}function ft(){qe.start()}const qe=new _Q;qe.setAnimationLoop(St),typeof self<"u"&&qe.setContext(self),this.setAnimationLoop=function(Ie){lt=Ie,xe.setAnimationLoop(Ie),Ie===null?qe.stop():qe.start()},xe.addEventListener("sessionstart",ot),xe.addEventListener("sessionend",ft),this.render=function(Ie,De){if(De!==void 0&&De.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(P===!0)return;Ie.matrixWorldAutoUpdate===!0&&Ie.updateMatrixWorld(),De.parent===null&&De.matrixWorldAutoUpdate===!0&&De.updateMatrixWorld(),xe.enabled===!0&&xe.isPresenting===!0&&(xe.cameraAutoUpdate===!0&&xe.updateCamera(De),De=xe.getCamera()),Ie.isScene===!0&&Ie.onBeforeRender(k,Ie,De,N),b=de.get(Ie,_.length),b.init(),_.push(b),Z.multiplyMatrices(De.projectionMatrix,De.matrixWorldInverse),le.setFromProjectionMatrix(Z),Ce=this.localClippingEnabled,pe=Ae.init(this.clippingPlanes,Ce),x=he.get(Ie,v.length),x.init(),v.push(x),ht(Ie,De,0,k.sortObjects),x.finish(),k.sortObjects===!0&&x.sort(ue,me),this.info.render.frame++,pe===!0&&Ae.beginShadows();const Xe=b.state.shadowsArray;if(_e.render(Xe,Ie,De),pe===!0&&Ae.endShadows(),this.info.autoReset===!0&&this.info.reset(),ze.render(x,Ie),b.setupLights(k._useLegacyLights),De.isArrayCamera){const at=De.cameras;for(let Ke=0,It=at.length;Ke<It;Ke++){const Te=at[Ke];yt(x,Ie,Te,Te.viewport)}}else yt(x,Ie,De);N!==null&&(se.updateMultisampleRenderTarget(N),se.updateRenderTargetMipmap(N)),Ie.isScene===!0&&Ie.onAfterRender(k,Ie,De),ke.resetDefaultState(),R=-1,A=null,_.pop(),_.length>0?b=_[_.length-1]:b=null,v.pop(),v.length>0?x=v[v.length-1]:x=null};function ht(Ie,De,Xe,at){if(Ie.visible===!1)return;if(Ie.layers.test(De.layers)){if(Ie.isGroup)Xe=Ie.renderOrder;else if(Ie.isLOD)Ie.autoUpdate===!0&&Ie.update(De);else if(Ie.isLight)b.pushLight(Ie),Ie.castShadow&&b.pushShadow(Ie);else if(Ie.isSprite){if(!Ie.frustumCulled||le.intersectsSprite(Ie)){at&&E.setFromMatrixPosition(Ie.matrixWorld).applyMatrix4(Z);const Te=F.update(Ie),We=Ie.material;We.visible&&x.push(Ie,Te,We,Xe,E.z,null)}}else if((Ie.isMesh||Ie.isLine||Ie.isPoints)&&(!Ie.frustumCulled||le.intersectsObject(Ie))){const Te=F.update(Ie),We=Ie.material;if(at&&(Ie.boundingSphere!==void 0?(Ie.boundingSphere===null&&Ie.computeBoundingSphere(),E.copy(Ie.boundingSphere.center)):(Te.boundingSphere===null&&Te.computeBoundingSphere(),E.copy(Te.boundingSphere.center)),E.applyMatrix4(Ie.matrixWorld).applyMatrix4(Z)),Array.isArray(We)){const et=Te.groups;for(let Ze=0,Le=et.length;Ze<Le;Ze++){const mt=et[Ze],st=We[mt.materialIndex];st&&st.visible&&x.push(Ie,Te,st,Xe,E.z,mt)}}else We.visible&&x.push(Ie,Te,We,Xe,E.z,null)}}const It=Ie.children;for(let Te=0,We=It.length;Te<We;Te++)ht(It[Te],De,Xe,at)}function yt(Ie,De,Xe,at){const Ke=Ie.opaque,It=Ie.transmissive,Te=Ie.transparent;b.setupLightsView(Xe),pe===!0&&Ae.setGlobalState(k.clippingPlanes,Xe),It.length>0&&Bt(Ke,It,De,Xe),at&&ee.viewport(D.copy(at)),Ke.length>0&&Yt(Ke,De,Xe),It.length>0&&Yt(It,De,Xe),Te.length>0&&Yt(Te,De,Xe),ee.buffers.depth.setTest(!0),ee.buffers.depth.setMask(!0),ee.buffers.color.setMask(!0),ee.setPolygonOffset(!1)}function Bt(Ie,De,Xe,at){if((Xe.isScene===!0?Xe.overrideMaterial:null)!==null)return;const It=V.isWebGL2;q===null&&(q=new Qp(1,1,{generateMipmaps:!0,type:z.has("EXT_color_buffer_half_float")?Wv:Xm,minFilter:Gv,samples:It?4:0})),k.getDrawingBufferSize(j),It?q.setSize(j.x,j.y):q.setSize(ik(j.x),ik(j.y));const Te=k.getRenderTarget();k.setRenderTarget(q),k.getClearColor(G),L=k.getClearAlpha(),L<1&&k.setClearColor(16777215,.5),k.clear();const We=k.toneMapping;k.toneMapping=Ym,Yt(Ie,Xe,at),se.updateMultisampleRenderTarget(q),se.updateRenderTargetMipmap(q);let et=!1;for(let Ze=0,Le=De.length;Ze<Le;Ze++){const mt=De[Ze],st=mt.object,tt=mt.geometry,Nt=mt.material,Rt=mt.group;if(Nt.side===Bd&&st.layers.test(at.layers)){const jt=Nt.side;Nt.side=so,Nt.needsUpdate=!0,xn(st,Xe,at,tt,Nt,Rt),Nt.side=jt,Nt.needsUpdate=!0,et=!0}}et===!0&&(se.updateMultisampleRenderTarget(q),se.updateRenderTargetMipmap(q)),k.setRenderTarget(Te),k.setClearColor(G,L),k.toneMapping=We}function Yt(Ie,De,Xe){const at=De.isScene===!0?De.overrideMaterial:null;for(let Ke=0,It=Ie.length;Ke<It;Ke++){const Te=Ie[Ke],We=Te.object,et=Te.geometry,Ze=at===null?Te.material:at,Le=Te.group;We.layers.test(Xe.layers)&&xn(We,De,Xe,et,Ze,Le)}}function xn(Ie,De,Xe,at,Ke,It){Ie.onBeforeRender(k,De,Xe,at,Ke,It),Ie.modelViewMatrix.multiplyMatrices(Xe.matrixWorldInverse,Ie.matrixWorld),Ie.normalMatrix.getNormalMatrix(Ie.modelViewMatrix),Ke.onBeforeRender(k,De,Xe,at,Ie,It),Ke.transparent===!0&&Ke.side===Bd&&Ke.forceSinglePass===!1?(Ke.side=so,Ke.needsUpdate=!0,k.renderBufferDirect(Xe,De,at,Ke,Ie,It),Ke.side=sh,Ke.needsUpdate=!0,k.renderBufferDirect(Xe,De,at,Ke,Ie,It),Ke.side=Bd):k.renderBufferDirect(Xe,De,at,Ke,Ie,It),Ie.onAfterRender(k,De,Xe,at,Ke,It)}function Xt(Ie,De,Xe){De.isScene!==!0&&(De=I);const at=ne.get(Ie),Ke=b.state.lights,It=b.state.shadowsArray,Te=Ke.state.version,We=Q.getParameters(Ie,Ke.state,It,De,Xe),et=Q.getProgramCacheKey(We);let Ze=at.programs;at.environment=Ie.isMeshStandardMaterial?De.environment:null,at.fog=De.fog,at.envMap=(Ie.isMeshStandardMaterial?fe:ce).get(Ie.envMap||at.environment),Ze===void 0&&(Ie.addEventListener("dispose",je),Ze=new Map,at.programs=Ze);let Le=Ze.get(et);if(Le!==void 0){if(at.currentProgram===Le&&at.lightsStateVersion===Te)return nn(Ie,We),Le}else We.uniforms=Q.getUniforms(Ie),Ie.onBuild(Xe,We,k),Ie.onBeforeCompile(We,k),Le=Q.acquireProgram(We,et),Ze.set(et,Le),at.uniforms=We.uniforms;const mt=at.uniforms;return(!Ie.isShaderMaterial&&!Ie.isRawShaderMaterial||Ie.clipping===!0)&&(mt.clippingPlanes=Ae.uniform),nn(Ie,We),at.needsLights=pn(Ie),at.lightsStateVersion=Te,at.needsLights&&(mt.ambientLightColor.value=Ke.state.ambient,mt.lightProbe.value=Ke.state.probe,mt.directionalLights.value=Ke.state.directional,mt.directionalLightShadows.value=Ke.state.directionalShadow,mt.spotLights.value=Ke.state.spot,mt.spotLightShadows.value=Ke.state.spotShadow,mt.rectAreaLights.value=Ke.state.rectArea,mt.ltc_1.value=Ke.state.rectAreaLTC1,mt.ltc_2.value=Ke.state.rectAreaLTC2,mt.pointLights.value=Ke.state.point,mt.pointLightShadows.value=Ke.state.pointShadow,mt.hemisphereLights.value=Ke.state.hemi,mt.directionalShadowMap.value=Ke.state.directionalShadowMap,mt.directionalShadowMatrix.value=Ke.state.directionalShadowMatrix,mt.spotShadowMap.value=Ke.state.spotShadowMap,mt.spotLightMatrix.value=Ke.state.spotLightMatrix,mt.spotLightMap.value=Ke.state.spotLightMap,mt.pointShadowMap.value=Ke.state.pointShadowMap,mt.pointShadowMatrix.value=Ke.state.pointShadowMatrix),at.currentProgram=Le,at.uniformsList=null,Le}function $t(Ie){if(Ie.uniformsList===null){const De=Ie.currentProgram.getUniforms();Ie.uniformsList=y1.seqWithValue(De.seq,Ie.uniforms)}return Ie.uniformsList}function nn(Ie,De){const Xe=ne.get(Ie);Xe.outputColorSpace=De.outputColorSpace,Xe.batching=De.batching,Xe.instancing=De.instancing,Xe.instancingColor=De.instancingColor,Xe.skinning=De.skinning,Xe.morphTargets=De.morphTargets,Xe.morphNormals=De.morphNormals,Xe.morphColors=De.morphColors,Xe.morphTargetsCount=De.morphTargetsCount,Xe.numClippingPlanes=De.numClippingPlanes,Xe.numIntersection=De.numClipIntersection,Xe.vertexAlphas=De.vertexAlphas,Xe.vertexTangents=De.vertexTangents,Xe.toneMapping=De.toneMapping}function on(Ie,De,Xe,at,Ke){De.isScene!==!0&&(De=I),se.resetTextureUnits();const It=De.fog,Te=at.isMeshStandardMaterial?De.environment:null,We=N===null?k.outputColorSpace:N.isXRRenderTarget===!0?N.texture.colorSpace:hu,et=(at.isMeshStandardMaterial?fe:ce).get(at.envMap||Te),Ze=at.vertexColors===!0&&!!Xe.attributes.color&&Xe.attributes.color.itemSize===4,Le=!!Xe.attributes.tangent&&(!!at.normalMap||at.anisotropy>0),mt=!!Xe.morphAttributes.position,st=!!Xe.morphAttributes.normal,tt=!!Xe.morphAttributes.color;let Nt=Ym;at.toneMapped&&(N===null||N.isXRRenderTarget===!0)&&(Nt=k.toneMapping);const Rt=Xe.morphAttributes.position||Xe.morphAttributes.normal||Xe.morphAttributes.color,jt=Rt!==void 0?Rt.length:0,Ft=ne.get(at),mn=b.state.lights;if(pe===!0&&(Ce===!0||Ie!==A)){const wn=Ie===A&&at.id===R;Ae.setState(at,Ie,wn)}let rn=!1;at.version===Ft.__version?(Ft.needsLights&&Ft.lightsStateVersion!==mn.state.version||Ft.outputColorSpace!==We||Ke.isBatchedMesh&&Ft.batching===!1||!Ke.isBatchedMesh&&Ft.batching===!0||Ke.isInstancedMesh&&Ft.instancing===!1||!Ke.isInstancedMesh&&Ft.instancing===!0||Ke.isSkinnedMesh&&Ft.skinning===!1||!Ke.isSkinnedMesh&&Ft.skinning===!0||Ke.isInstancedMesh&&Ft.instancingColor===!0&&Ke.instanceColor===null||Ke.isInstancedMesh&&Ft.instancingColor===!1&&Ke.instanceColor!==null||Ft.envMap!==et||at.fog===!0&&Ft.fog!==It||Ft.numClippingPlanes!==void 0&&(Ft.numClippingPlanes!==Ae.numPlanes||Ft.numIntersection!==Ae.numIntersection)||Ft.vertexAlphas!==Ze||Ft.vertexTangents!==Le||Ft.morphTargets!==mt||Ft.morphNormals!==st||Ft.morphColors!==tt||Ft.toneMapping!==Nt||V.isWebGL2===!0&&Ft.morphTargetsCount!==jt)&&(rn=!0):(rn=!0,Ft.__version=at.version);let vn=Ft.currentProgram;rn===!0&&(vn=Xt(at,De,Ke));let Dn=!1,Bn=!1,en=!1;const kn=vn.getUniforms(),_n=Ft.uniforms;if(ee.useProgram(vn.program)&&(Dn=!0,Bn=!0,en=!0),at.id!==R&&(R=at.id,Bn=!0),Dn||A!==Ie){kn.setValue(B,"projectionMatrix",Ie.projectionMatrix),kn.setValue(B,"viewMatrix",Ie.matrixWorldInverse);const wn=kn.map.cameraPosition;wn!==void 0&&wn.setValue(B,E.setFromMatrixPosition(Ie.matrixWorld)),V.logarithmicDepthBuffer&&kn.setValue(B,"logDepthBufFC",2/(Math.log(Ie.far+1)/Math.LN2)),(at.isMeshPhongMaterial||at.isMeshToonMaterial||at.isMeshLambertMaterial||at.isMeshBasicMaterial||at.isMeshStandardMaterial||at.isShaderMaterial)&&kn.setValue(B,"isOrthographic",Ie.isOrthographicCamera===!0),A!==Ie&&(A=Ie,Bn=!0,en=!0)}if(Ke.isSkinnedMesh){kn.setOptional(B,Ke,"bindMatrix"),kn.setOptional(B,Ke,"bindMatrixInverse");const wn=Ke.skeleton;wn&&(V.floatVertexTextures?(wn.boneTexture===null&&wn.computeBoneTexture(),kn.setValue(B,"boneTexture",wn.boneTexture,se)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}Ke.isBatchedMesh&&(kn.setOptional(B,Ke,"batchingTexture"),kn.setValue(B,"batchingTexture",Ke._matricesTexture,se));const vr=Xe.morphAttributes;if((vr.position!==void 0||vr.normal!==void 0||vr.color!==void 0&&V.isWebGL2===!0)&&Be.update(Ke,Xe,vn),(Bn||Ft.receiveShadow!==Ke.receiveShadow)&&(Ft.receiveShadow=Ke.receiveShadow,kn.setValue(B,"receiveShadow",Ke.receiveShadow)),at.isMeshGouraudMaterial&&at.envMap!==null&&(_n.envMap.value=et,_n.flipEnvMap.value=et.isCubeTexture&&et.isRenderTargetTexture===!1?-1:1),Bn&&(kn.setValue(B,"toneMappingExposure",k.toneMappingExposure),Ft.needsLights&&cn(_n,en),It&&at.fog===!0&&ve.refreshFogUniforms(_n,It),ve.refreshMaterialUniforms(_n,at,J,re,q),y1.upload(B,$t(Ft),_n,se)),at.isShaderMaterial&&at.uniformsNeedUpdate===!0&&(y1.upload(B,$t(Ft),_n,se),at.uniformsNeedUpdate=!1),at.isSpriteMaterial&&kn.setValue(B,"center",Ke.center),kn.setValue(B,"modelViewMatrix",Ke.modelViewMatrix),kn.setValue(B,"normalMatrix",Ke.normalMatrix),kn.setValue(B,"modelMatrix",Ke.matrixWorld),at.isShaderMaterial||at.isRawShaderMaterial){const wn=at.uniformsGroups;for(let lr=0,ci=wn.length;lr<ci;lr++)if(V.isWebGL2){const zn=wn[lr];Me.update(zn,vn),Me.bind(zn,vn)}else console.warn("THREE.WebGLRenderer: Uniform Buffer Objects can only be used with WebGL 2.")}return vn}function cn(Ie,De){Ie.ambientLightColor.needsUpdate=De,Ie.lightProbe.needsUpdate=De,Ie.directionalLights.needsUpdate=De,Ie.directionalLightShadows.needsUpdate=De,Ie.pointLights.needsUpdate=De,Ie.pointLightShadows.needsUpdate=De,Ie.spotLights.needsUpdate=De,Ie.spotLightShadows.needsUpdate=De,Ie.rectAreaLights.needsUpdate=De,Ie.hemisphereLights.needsUpdate=De}function pn(Ie){return Ie.isMeshLambertMaterial||Ie.isMeshToonMaterial||Ie.isMeshPhongMaterial||Ie.isMeshStandardMaterial||Ie.isShadowMaterial||Ie.isShaderMaterial&&Ie.lights===!0}this.getActiveCubeFace=function(){return C},this.getActiveMipmapLevel=function(){return T},this.getRenderTarget=function(){return N},this.setRenderTargetTextures=function(Ie,De,Xe){ne.get(Ie.texture).__webglTexture=De,ne.get(Ie.depthTexture).__webglTexture=Xe;const at=ne.get(Ie);at.__hasExternalTextures=!0,at.__hasExternalTextures&&(at.__autoAllocateDepthBuffer=Xe===void 0,at.__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"),at.__useRenderToTexture=!1))},this.setRenderTargetFramebuffer=function(Ie,De){const Xe=ne.get(Ie);Xe.__webglFramebuffer=De,Xe.__useDefaultFramebuffer=De===void 0},this.setRenderTarget=function(Ie,De=0,Xe=0){N=Ie,C=De,T=Xe;let at=!0,Ke=null,It=!1,Te=!1;if(Ie){const et=ne.get(Ie);et.__useDefaultFramebuffer!==void 0?(ee.bindFramebuffer(B.FRAMEBUFFER,null),at=!1):et.__webglFramebuffer===void 0?se.setupRenderTarget(Ie):et.__hasExternalTextures&&se.rebindTextures(Ie,ne.get(Ie.texture).__webglTexture,ne.get(Ie.depthTexture).__webglTexture);const Ze=Ie.texture;(Ze.isData3DTexture||Ze.isDataArrayTexture||Ze.isCompressedArrayTexture)&&(Te=!0);const Le=ne.get(Ie).__webglFramebuffer;Ie.isWebGLCubeRenderTarget?(Array.isArray(Le[De])?Ke=Le[De][Xe]:Ke=Le[De],It=!0):V.isWebGL2&&Ie.samples>0&&se.useMultisampledRTT(Ie)===!1?Ke=ne.get(Ie).__webglMultisampledFramebuffer:Array.isArray(Le)?Ke=Le[Xe]:Ke=Le,D.copy(Ie.viewport),$.copy(Ie.scissor),U=Ie.scissorTest}else D.copy(ge).multiplyScalar(J).floor(),$.copy(X).multiplyScalar(J).floor(),U=ie;if(ee.bindFramebuffer(B.FRAMEBUFFER,Ke)&&V.drawBuffers&&at&&ee.drawBuffers(Ie,Ke),ee.viewport(D),ee.scissor($),ee.setScissorTest(U),It){const et=ne.get(Ie.texture);B.framebufferTexture2D(B.FRAMEBUFFER,B.COLOR_ATTACHMENT0,B.TEXTURE_CUBE_MAP_POSITIVE_X+De,et.__webglTexture,Xe)}else if(Te){const et=ne.get(Ie.texture),Ze=De||0;B.framebufferTextureLayer(B.FRAMEBUFFER,B.COLOR_ATTACHMENT0,et.__webglTexture,Xe||0,Ze)}R=-1},this.readRenderTargetPixels=function(Ie,De,Xe,at,Ke,It,Te){if(!(Ie&&Ie.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let We=ne.get(Ie).__webglFramebuffer;if(Ie.isWebGLCubeRenderTarget&&Te!==void 0&&(We=We[Te]),We){ee.bindFramebuffer(B.FRAMEBUFFER,We);try{const et=Ie.texture,Ze=et.format,Le=et.type;if(Ze!==dl&&Ee.convert(Ze)!==B.getParameter(B.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}const mt=Le===Wv&&(z.has("EXT_color_buffer_half_float")||V.isWebGL2&&z.has("EXT_color_buffer_float"));if(Le!==Xm&&Ee.convert(Le)!==B.getParameter(B.IMPLEMENTATION_COLOR_READ_TYPE)&&!(Le===Wd&&(V.isWebGL2||z.has("OES_texture_float")||z.has("WEBGL_color_buffer_float")))&&!mt){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}De>=0&&De<=Ie.width-at&&Xe>=0&&Xe<=Ie.height-Ke&&B.readPixels(De,Xe,at,Ke,Ee.convert(Ze),Ee.convert(Le),It)}finally{const et=N!==null?ne.get(N).__webglFramebuffer:null;ee.bindFramebuffer(B.FRAMEBUFFER,et)}}},this.copyFramebufferToTexture=function(Ie,De,Xe=0){const at=Math.pow(2,-Xe),Ke=Math.floor(De.image.width*at),It=Math.floor(De.image.height*at);se.setTexture2D(De,0),B.copyTexSubImage2D(B.TEXTURE_2D,Xe,0,0,Ie.x,Ie.y,Ke,It),ee.unbindTexture()},this.copyTextureToTexture=function(Ie,De,Xe,at=0){const Ke=De.image.width,It=De.image.height,Te=Ee.convert(Xe.format),We=Ee.convert(Xe.type);se.setTexture2D(Xe,0),B.pixelStorei(B.UNPACK_FLIP_Y_WEBGL,Xe.flipY),B.pixelStorei(B.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Xe.premultiplyAlpha),B.pixelStorei(B.UNPACK_ALIGNMENT,Xe.unpackAlignment),De.isDataTexture?B.texSubImage2D(B.TEXTURE_2D,at,Ie.x,Ie.y,Ke,It,Te,We,De.image.data):De.isCompressedTexture?B.compressedTexSubImage2D(B.TEXTURE_2D,at,Ie.x,Ie.y,De.mipmaps[0].width,De.mipmaps[0].height,Te,De.mipmaps[0].data):B.texSubImage2D(B.TEXTURE_2D,at,Ie.x,Ie.y,Te,We,De.image),at===0&&Xe.generateMipmaps&&B.generateMipmap(B.TEXTURE_2D),ee.unbindTexture()},this.copyTextureToTexture3D=function(Ie,De,Xe,at,Ke=0){if(k.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}const It=Ie.max.x-Ie.min.x+1,Te=Ie.max.y-Ie.min.y+1,We=Ie.max.z-Ie.min.z+1,et=Ee.convert(at.format),Ze=Ee.convert(at.type);let Le;if(at.isData3DTexture)se.setTexture3D(at,0),Le=B.TEXTURE_3D;else if(at.isDataArrayTexture)se.setTexture2DArray(at,0),Le=B.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}B.pixelStorei(B.UNPACK_FLIP_Y_WEBGL,at.flipY),B.pixelStorei(B.UNPACK_PREMULTIPLY_ALPHA_WEBGL,at.premultiplyAlpha),B.pixelStorei(B.UNPACK_ALIGNMENT,at.unpackAlignment);const mt=B.getParameter(B.UNPACK_ROW_LENGTH),st=B.getParameter(B.UNPACK_IMAGE_HEIGHT),tt=B.getParameter(B.UNPACK_SKIP_PIXELS),Nt=B.getParameter(B.UNPACK_SKIP_ROWS),Rt=B.getParameter(B.UNPACK_SKIP_IMAGES),jt=Xe.isCompressedTexture?Xe.mipmaps[0]:Xe.image;B.pixelStorei(B.UNPACK_ROW_LENGTH,jt.width),B.pixelStorei(B.UNPACK_IMAGE_HEIGHT,jt.height),B.pixelStorei(B.UNPACK_SKIP_PIXELS,Ie.min.x),B.pixelStorei(B.UNPACK_SKIP_ROWS,Ie.min.y),B.pixelStorei(B.UNPACK_SKIP_IMAGES,Ie.min.z),Xe.isDataTexture||Xe.isData3DTexture?B.texSubImage3D(Le,Ke,De.x,De.y,De.z,It,Te,We,et,Ze,jt.data):Xe.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),B.compressedTexSubImage3D(Le,Ke,De.x,De.y,De.z,It,Te,We,et,jt.data)):B.texSubImage3D(Le,Ke,De.x,De.y,De.z,It,Te,We,et,Ze,jt),B.pixelStorei(B.UNPACK_ROW_LENGTH,mt),B.pixelStorei(B.UNPACK_IMAGE_HEIGHT,st),B.pixelStorei(B.UNPACK_SKIP_PIXELS,tt),B.pixelStorei(B.UNPACK_SKIP_ROWS,Nt),B.pixelStorei(B.UNPACK_SKIP_IMAGES,Rt),Ke===0&&at.generateMipmaps&&B.generateMipmap(Le),ee.unbindTexture()},this.initTexture=function(Ie){Ie.isCubeTexture?se.setTextureCube(Ie,0):Ie.isData3DTexture?se.setTexture3D(Ie,0):Ie.isDataArrayTexture||Ie.isCompressedArrayTexture?se.setTexture2DArray(Ie,0):se.setTexture2D(Ie,0),ee.unbindTexture()},this.resetState=function(){C=0,T=0,N=null,ee.reset(),ke.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Rc}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const n=this.getContext();n.drawingBufferColorSpace=e===vL?"display-p3":"srgb",n.unpackColorSpace=Hr.workingColorSpace===CC?"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===Qa?Ap:oQ}set outputEncoding(e){console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace=e===Ap?Qa:hu}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 MPe extends D3{}MPe.prototype.isWebGL1Renderer=!0;class CL{constructor(e,n=1,r=1e3){this.isFog=!0,this.name="",this.color=new yn(e),this.near=n,this.far=r}clone(){return new CL(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class EPe extends Os{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 jPe{constructor(e,n){this.isInterleavedBuffer=!0,this.array=e,this.stride=n,this.count=e!==void 0?e.length/n:0,this.usage=A3,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.version=0,this.uuid=eu()}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,r){e*=this.stride,r*=n.stride;for(let a=0,s=this.stride;a<s;a++)this.array[e+a]=n.array[r+a];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=eu()),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]),r=new this.constructor(n,this.stride);return r.setUsage(this.usage),r}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=eu()),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 Cs=new rt;class Dm{constructor(e,n,r,a=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=n,this.offset=r,this.normalized=a}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,r=this.data.count;n<r;n++)Cs.fromBufferAttribute(this,n),Cs.applyMatrix4(e),this.setXYZ(n,Cs.x,Cs.y,Cs.z);return this}applyNormalMatrix(e){for(let n=0,r=this.count;n<r;n++)Cs.fromBufferAttribute(this,n),Cs.applyNormalMatrix(e),this.setXYZ(n,Cs.x,Cs.y,Cs.z);return this}transformDirection(e){for(let n=0,r=this.count;n<r;n++)Cs.fromBufferAttribute(this,n),Cs.transformDirection(e),this.setXYZ(n,Cs.x,Cs.y,Cs.z);return this}setX(e,n){return this.normalized&&(n=Br(n,this.array)),this.data.array[e*this.data.stride+this.offset]=n,this}setY(e,n){return this.normalized&&(n=Br(n,this.array)),this.data.array[e*this.data.stride+this.offset+1]=n,this}setZ(e,n){return this.normalized&&(n=Br(n,this.array)),this.data.array[e*this.data.stride+this.offset+2]=n,this}setW(e,n){return this.normalized&&(n=Br(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=Ec(n,this.array)),n}getY(e){let n=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(n=Ec(n,this.array)),n}getZ(e){let n=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(n=Ec(n,this.array)),n}getW(e){let n=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(n=Ec(n,this.array)),n}setXY(e,n,r){return e=e*this.data.stride+this.offset,this.normalized&&(n=Br(n,this.array),r=Br(r,this.array)),this.data.array[e+0]=n,this.data.array[e+1]=r,this}setXYZ(e,n,r,a){return e=e*this.data.stride+this.offset,this.normalized&&(n=Br(n,this.array),r=Br(r,this.array),a=Br(a,this.array)),this.data.array[e+0]=n,this.data.array[e+1]=r,this.data.array[e+2]=a,this}setXYZW(e,n,r,a,s){return e=e*this.data.stride+this.offset,this.normalized&&(n=Br(n,this.array),r=Br(r,this.array),a=Br(a,this.array),s=Br(s,this.array)),this.data.array[e+0]=n,this.data.array[e+1]=r,this.data.array[e+2]=a,this.data.array[e+3]=s,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 r=0;r<this.count;r++){const a=r*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)n.push(this.data.array[a+s])}return new Fo(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 Dm(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 r=0;r<this.count;r++){const a=r*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)n.push(this.data.array[a+s])}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 DPe extends oo{constructor(e=null,n=1,r=1,a,s,o,l,c,d=Xa,u=Xa,m,p){super(null,o,l,c,d,u,a,s,m,p),this.isDataTexture=!0,this.image={data:e,width:n,height:r},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}function RPe(t,e){return t.z-e.z}function FPe(t,e){return e.z-t.z}class LPe{constructor(){this.index=0,this.pool=[],this.list=[]}push(e,n){const r=this.pool,a=this.list;this.index>=r.length&&r.push({start:-1,count:-1,z:-1});const s=r[this.index];a.push(s),this.index++,s.start=e.start,s.count=e.count,s.z=n}reset(){this.list.length=0,this.index=0}}const Ig="batchId",lm=new ti,UH=new ti,OPe=new ti,BH=new ti,p2=new TC,g_=new gl,Xh=new zc,My=new rt,f2=new LPe,cs=new Ql,b_=[];function IPe(t,e,n=0){const r=e.itemSize;if(t.isInterleavedBufferAttribute||t.array.constructor!==e.array.constructor){const a=t.count;for(let s=0;s<a;s++)for(let o=0;o<r;o++)e.setComponent(s+n,o,t.getComponent(s,o))}else e.array.set(t.array,n*r);e.needsUpdate=!0}class zPe extends Ql{get maxGeometryCount(){return this._maxGeometryCount}constructor(e,n,r=n*2,a){super(new ys,a),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=r,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),r=new DPe(n,e,e,dl,Wd);this._matricesTexture=r}_initializeGeometry(e){const n=this.geometry,r=this._maxVertexCount,a=this._maxGeometryCount,s=this._maxIndexCount;if(this._geometryInitialized===!1){for(const l in e.attributes){const c=e.getAttribute(l),{array:d,itemSize:u,normalized:m}=c,p=new d.constructor(r*u),f=new c.constructor(p,u,m);f.setUsage(c.usage),n.setAttribute(l,f)}if(e.getIndex()!==null){const l=r>65536?new Uint32Array(s):new Uint16Array(s);n.setIndex(new Fo(l,1))}const o=a>65536?new Uint32Array(r):new Uint16Array(r);n.setAttribute(Ig,new Fo(o,1)),this._geometryInitialized=!0}}_validateGeometry(e){if(e.getAttribute(Ig))throw new Error(`BatchedMesh: Geometry cannot use attribute "${Ig}"`);const n=this.geometry;if(!!e.getIndex()!=!!n.getIndex())throw new Error('BatchedMesh: All geometries must consistently have "index".');for(const r in n.attributes){if(r===Ig)continue;if(!e.hasAttribute(r))throw new Error(`BatchedMesh: Added geometry missing "${r}". All geometries must have consistent attributes.`);const a=e.getAttribute(r),s=n.getAttribute(r);if(a.itemSize!==s.itemSize||a.normalized!==s.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 gl);const e=this._geometryCount,n=this.boundingBox,r=this._active;n.makeEmpty();for(let a=0;a<e;a++)r[a]!==!1&&(this.getMatrixAt(a,lm),this.getBoundingBoxAt(a,g_).applyMatrix4(lm),n.union(g_))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new zc);const e=this._geometryCount,n=this.boundingSphere,r=this._active;n.makeEmpty();for(let a=0;a<e;a++)r[a]!==!1&&(this.getMatrixAt(a,lm),this.getBoundingSphereAt(a,Xh).applyMatrix4(lm),n.union(Xh))}addGeometry(e,n=-1,r=-1){if(this._initializeGeometry(e),this._validateGeometry(e),this._geometryCount>=this._maxGeometryCount)throw new Error("BatchedMesh: Maximum geometry count reached.");const a={vertexStart:-1,vertexCount:-1,indexStart:-1,indexCount:-1};let s=null;const o=this._reservedRanges,l=this._drawRanges,c=this._bounds;this._geometryCount!==0&&(s=o[o.length-1]),n===-1?a.vertexCount=e.getAttribute("position").count:a.vertexCount=n,s===null?a.vertexStart=0:a.vertexStart=s.vertexStart+s.vertexCount;const d=e.getIndex(),u=d!==null;if(u&&(r===-1?a.indexCount=d.count:a.indexCount=r,s===null?a.indexStart=0:a.indexStart=s.indexStart+s.indexCount),a.indexStart!==-1&&a.indexStart+a.indexCount>this._maxIndexCount||a.vertexStart+a.vertexCount>this._maxVertexCount)throw new Error("BatchedMesh: Reserved space request exceeds the maximum buffer size.");const m=this._visibility,p=this._active,f=this._matricesTexture,y=this._matricesTexture.image.data;m.push(!0),p.push(!0);const x=this._geometryCount;this._geometryCount++,OPe.toArray(y,x*16),f.needsUpdate=!0,o.push(a),l.push({start:u?a.indexStart:a.vertexStart,count:-1}),c.push({boxInitialized:!1,box:new gl,sphereInitialized:!1,sphere:new zc});const b=this.geometry.getAttribute(Ig);for(let v=0;v<a.vertexCount;v++)b.setX(a.vertexStart+v,x);return b.needsUpdate=!0,this.setGeometryAt(x,e),x}setGeometryAt(e,n){if(e>=this._geometryCount)throw new Error("BatchedMesh: Maximum geometry count reached.");this._validateGeometry(n);const r=this.geometry,a=r.getIndex()!==null,s=r.getIndex(),o=n.getIndex(),l=this._reservedRanges[e];if(a&&o.count>l.indexCount||n.attributes.position.count>l.vertexCount)throw new Error("BatchedMesh: Reserved space not large enough for provided geometry.");const c=l.vertexStart,d=l.vertexCount;for(const f in r.attributes){if(f===Ig)continue;const y=n.getAttribute(f),x=r.getAttribute(f);IPe(y,x,c);const b=y.itemSize;for(let v=y.count,_=d;v<_;v++){const k=c+v;for(let P=0;P<b;P++)x.setComponent(k,P,0)}x.needsUpdate=!0}if(a){const f=l.indexStart;for(let y=0;y<o.count;y++)s.setX(f+y,c+o.getX(y));for(let y=o.count,x=l.indexCount;y<x;y++)s.setX(f+y,c);s.needsUpdate=!0}const u=this._bounds[e];n.boundingBox!==null?(u.box.copy(n.boundingBox),u.boxInitialized=!0):u.boxInitialized=!1,n.boundingSphere!==null?(u.sphere.copy(n.boundingSphere),u.sphereInitialized=!0):u.sphereInitialized=!1;const m=this._drawRanges[e],p=n.getAttribute("position");return m.count=a?o.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 a=this._bounds[e],s=a.box,o=this.geometry;if(a.boxInitialized===!1){s.makeEmpty();const l=o.index,c=o.attributes.position,d=this._drawRanges[e];for(let u=d.start,m=d.start+d.count;u<m;u++){let p=u;l&&(p=l.getX(p)),s.expandByPoint(My.fromBufferAttribute(c,p))}a.boxInitialized=!0}return n.copy(s),n}getBoundingSphereAt(e,n){if(this._active[e]===!1)return this;const a=this._bounds[e],s=a.sphere,o=this.geometry;if(a.sphereInitialized===!1){s.makeEmpty(),this.getBoundingBoxAt(e,g_),g_.getCenter(s.center);const l=o.index,c=o.attributes.position,d=this._drawRanges[e];let u=0;for(let m=d.start,p=d.start+d.count;m<p;m++){let f=m;l&&(f=l.getX(f)),My.fromBufferAttribute(c,f),u=Math.max(u,s.center.distanceToSquared(My))}s.radius=Math.sqrt(u),a.sphereInitialized=!0}return n.copy(s),n}setMatrixAt(e,n){const r=this._active,a=this._matricesTexture,s=this._matricesTexture.image.data,o=this._geometryCount;return e>=o||r[e]===!1?this:(n.toArray(s,e*16),a.needsUpdate=!0,this)}getMatrixAt(e,n){const r=this._active,a=this._matricesTexture.image.data,s=this._geometryCount;return e>=s||r[e]===!1?null:n.fromArray(a,e*16)}setVisibleAt(e,n){const r=this._visibility,a=this._active,s=this._geometryCount;return e>=s||a[e]===!1||r[e]===n?this:(r[e]=n,this._visibilityChanged=!0,this)}getVisibleAt(e){const n=this._visibility,r=this._active,a=this._geometryCount;return e>=a||r[e]===!1?!1:n[e]}raycast(e,n){const r=this._visibility,a=this._active,s=this._drawRanges,o=this._geometryCount,l=this.matrixWorld,c=this.geometry;cs.material=this.material,cs.geometry.index=c.index,cs.geometry.attributes=c.attributes,cs.geometry.boundingBox===null&&(cs.geometry.boundingBox=new gl),cs.geometry.boundingSphere===null&&(cs.geometry.boundingSphere=new zc);for(let d=0;d<o;d++){if(!r[d]||!a[d])continue;const u=s[d];cs.geometry.setDrawRange(u.start,u.count),this.getMatrixAt(d,cs.matrixWorld).premultiply(l),this.getBoundingBoxAt(d,cs.geometry.boundingBox),this.getBoundingSphereAt(d,cs.geometry.boundingSphere),cs.raycast(e,b_);for(let m=0,p=b_.length;m<p;m++){const f=b_[m];f.object=this,f.batchId=d,n.push(f)}b_.length=0}cs.material=null,cs.geometry.index=null,cs.geometry.attributes={},cs.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,r,a,s){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;const o=a.getIndex(),l=o===null?1:o.array.BYTES_PER_ELEMENT,c=this._visibility,d=this._multiDrawStarts,u=this._multiDrawCounts,m=this._drawRanges,p=this.perObjectFrustumCulled;p&&(BH.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse).multiply(this.matrixWorld),p2.setFromProjectionMatrix(BH,e.isWebGPURenderer?Kv:Rc));let f=0;if(this.sortObjects){UH.copy(this.matrixWorld).invert(),My.setFromMatrixPosition(r.matrixWorld).applyMatrix4(UH);for(let b=0,v=c.length;b<v;b++)if(c[b]){this.getMatrixAt(b,lm),this.getBoundingSphereAt(b,Xh).applyMatrix4(lm);let _=!1;if(p&&(_=!p2.intersectsSphere(Xh)),!_){const k=My.distanceTo(Xh.center);f2.push(m[b],k)}}const y=f2.list,x=this.customSort;x===null?y.sort(s.transparent?FPe:RPe):x.call(this,y,r);for(let b=0,v=y.length;b<v;b++){const _=y[b];d[f]=_.start*l,u[f]=_.count,f++}f2.reset()}else for(let y=0,x=c.length;y<x;y++)if(c[y]){let b=!1;if(p&&(this.getMatrixAt(y,lm),this.getBoundingSphereAt(y,Xh).applyMatrix4(lm),b=!p2.intersectsSphere(Xh)),!b){const v=m[y];d[f]=v.start*l,u[f]=v.count,f++}}this._multiDrawCount=f,this._visibilityChanged=!1}onBeforeShadow(e,n,r,a,s,o){this.onBeforeRender(e,null,a,s,o)}}class z0 extends px{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new yn(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 HH=new rt,$H=new rt,qH=new ti,g2=new SL,x_=new zc;let UPe=class extends Os{constructor(e=new ys,n=new z0){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,r=[0];for(let a=1,s=n.count;a<s;a++)HH.fromBufferAttribute(n,a-1),$H.fromBufferAttribute(n,a),r[a]=r[a-1],r[a]+=HH.distanceTo($H);e.setAttribute("lineDistance",new Gi(r,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,n){const r=this.geometry,a=this.matrixWorld,s=e.params.Line.threshold,o=r.drawRange;if(r.boundingSphere===null&&r.computeBoundingSphere(),x_.copy(r.boundingSphere),x_.applyMatrix4(a),x_.radius+=s,e.ray.intersectsSphere(x_)===!1)return;qH.copy(a).invert(),g2.copy(e.ray).applyMatrix4(qH);const l=s/((this.scale.x+this.scale.y+this.scale.z)/3),c=l*l,d=new rt,u=new rt,m=new rt,p=new rt,f=this.isLineSegments?2:1,y=r.index,b=r.attributes.position;if(y!==null){const v=Math.max(0,o.start),_=Math.min(y.count,o.start+o.count);for(let k=v,P=_-1;k<P;k+=f){const C=y.getX(k),T=y.getX(k+1);if(d.fromBufferAttribute(b,C),u.fromBufferAttribute(b,T),g2.distanceSqToSegment(d,u,p,m)>c)continue;p.applyMatrix4(this.matrixWorld);const R=e.ray.origin.distanceTo(p);R<e.near||R>e.far||n.push({distance:R,point:m.clone().applyMatrix4(this.matrixWorld),index:k,face:null,faceIndex:null,object:this})}}else{const v=Math.max(0,o.start),_=Math.min(b.count,o.start+o.count);for(let k=v,P=_-1;k<P;k+=f){if(d.fromBufferAttribute(b,k),u.fromBufferAttribute(b,k+1),g2.distanceSqToSegment(d,u,p,m)>c)continue;p.applyMatrix4(this.matrixWorld);const T=e.ray.origin.distanceTo(p);T<e.near||T>e.far||n.push({distance:T,point:m.clone().applyMatrix4(this.matrixWorld),index:k,face:null,faceIndex:null,object:this})}}}updateMorphTargets(){const n=this.geometry.morphAttributes,r=Object.keys(n);if(r.length>0){const a=n[r[0]];if(a!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=a.length;s<o;s++){const l=a[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[l]=s}}}}};const VH=new rt,GH=new rt;class AC extends UPe{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,r=[];for(let a=0,s=n.count;a<s;a+=2)VH.fromBufferAttribute(n,a),GH.fromBufferAttribute(n,a+1),r[a]=a===0?0:r[a-1],r[a+1]=r[a]+VH.distanceTo(GH);e.setAttribute("lineDistance",new Gi(r,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class BPe extends ys{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},e!==null){const n=[],r=new Set,a=new rt,s=new rt;if(e.index!==null){const o=e.attributes.position,l=e.index;let c=e.groups;c.length===0&&(c=[{start:0,count:l.count,materialIndex:0}]);for(let d=0,u=c.length;d<u;++d){const m=c[d],p=m.start,f=m.count;for(let y=p,x=p+f;y<x;y+=3)for(let b=0;b<3;b++){const v=l.getX(y+b),_=l.getX(y+(b+1)%3);a.fromBufferAttribute(o,v),s.fromBufferAttribute(o,_),WH(a,s,r)===!0&&(n.push(a.x,a.y,a.z),n.push(s.x,s.y,s.z))}}}else{const o=e.attributes.position;for(let l=0,c=o.count/3;l<c;l++)for(let d=0;d<3;d++){const u=3*l+d,m=3*l+(d+1)%3;a.fromBufferAttribute(o,u),s.fromBufferAttribute(o,m),WH(a,s,r)===!0&&(n.push(a.x,a.y,a.z),n.push(s.x,s.y,s.z))}}this.setAttribute("position",new Gi(n,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}function WH(t,e,n){const r=`${t.x},${t.y},${t.z}-${e.x},${e.y},${e.z}`,a=`${e.x},${e.y},${e.z}-${t.x},${t.y},${t.z}`;return n.has(r)===!0||n.has(a)===!0?!1:(n.add(r),n.add(a),!0)}class HPe extends px{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new yn(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new yn(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=lQ,this.normalScale=new Fn(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=xL,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 $Pe extends z0{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 MQ extends Os{constructor(e,n=1){super(),this.isLight=!0,this.type="Light",this.color=new yn(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 b2=new ti,KH=new rt,YH=new rt;class qPe{constructor(e){this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Fn(512,512),this.map=null,this.mapPass=null,this.matrix=new ti,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new TC,this._frameExtents=new Fn(1,1),this._viewportCount=1,this._viewports=[new qr(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const n=this.camera,r=this.matrix;KH.setFromMatrixPosition(e.matrixWorld),n.position.copy(KH),YH.setFromMatrixPosition(e.target.matrixWorld),n.lookAt(YH),n.updateMatrixWorld(),b2.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(b2),r.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),r.multiply(b2)}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 XH=new ti,Ey=new rt,x2=new rt;class VPe extends qPe{constructor(){super(new Ao(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new Fn(4,2),this._viewportCount=6,this._viewports=[new qr(2,1,1,1),new qr(0,1,1,1),new qr(3,1,1,1),new qr(1,1,1,1),new qr(3,0,1,1),new qr(1,0,1,1)],this._cubeDirections=[new rt(1,0,0),new rt(-1,0,0),new rt(0,0,1),new rt(0,0,-1),new rt(0,1,0),new rt(0,-1,0)],this._cubeUps=[new rt(0,1,0),new rt(0,1,0),new rt(0,1,0),new rt(0,1,0),new rt(0,0,1),new rt(0,0,-1)]}updateMatrices(e,n=0){const r=this.camera,a=this.matrix,s=e.distance||r.far;s!==r.far&&(r.far=s,r.updateProjectionMatrix()),Ey.setFromMatrixPosition(e.matrixWorld),r.position.copy(Ey),x2.copy(r.position),x2.add(this._cubeDirections[n]),r.up.copy(this._cubeUps[n]),r.lookAt(x2),r.updateMatrixWorld(),a.makeTranslation(-Ey.x,-Ey.y,-Ey.z),XH.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse),this._frustum.setFromProjectionMatrix(XH)}}class GPe extends MQ{constructor(e,n,r=0,a=2){super(e,n),this.isPointLight=!0,this.type="PointLight",this.distance=r,this.decay=a,this.shadow=new VPe}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 WPe extends MQ{constructor(e,n){super(e,n),this.isAmbientLight=!0,this.type="AmbientLight"}}class KPe extends ys{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 R3 extends jPe{constructor(e,n,r=1){super(e,n),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=r}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 QH{constructor(e=1,n=0,r=0){return this.radius=e,this.phi=n,this.theta=r,this}set(e,n,r){return this.radius=e,this.phi=n,this.theta=r,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,n,r){return this.radius=Math.sqrt(e*e+n*n+r*r),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,r),this.phi=Math.acos(Za(n/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}const ZH=new rt,y_=new rt;class YPe{constructor(e=new rt,n=new rt){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){ZH.subVectors(e,this.start),y_.subVectors(this.end,this.start);const r=y_.dot(y_);let s=y_.dot(ZH)/r;return n&&(s=Za(s,0,1)),s}closestPointToPoint(e,n,r){const a=this.closestPointToPointParameter(e,n);return this.delta(r).multiplyScalar(a).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 XPe extends AC{constructor(e=1){const n=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],r=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],a=new ys;a.setAttribute("position",new Gi(n,3)),a.setAttribute("color",new Gi(r,3));const s=new z0({vertexColors:!0,toneMapped:!1});super(a,s),this.type="AxesHelper"}setColors(e,n,r){const a=new yn,s=this.geometry.attributes.color.array;return a.set(e),a.toArray(s,0),a.toArray(s,3),a.set(n),a.toArray(s,6),a.toArray(s,9),a.set(r),a.toArray(s,12),a.toArray(s,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:kC}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=kC);class Uc{constructor(e,n,r,a,s="div"){this.parent=e,this.object=n,this.property=r,this._disabled=!1,this._hidden=!1,this.initialValue=this.getValue(),this.domElement=document.createElement(s),this.domElement.classList.add("controller"),this.domElement.classList.add(a),this.$name=document.createElement("div"),this.$name.classList.add("name"),Uc.nextNameID=Uc.nextNameID||0,this.$name.id=`lil-gui-name-${++Uc.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",o=>o.stopPropagation()),this.domElement.addEventListener("keyup",o=>o.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(r)}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 QPe extends Uc{constructor(e,n,r){super(e,n,r,"boolean","label"),this.$input=document.createElement("input"),this.$input.setAttribute("type","checkbox"),this.$input.setAttribute("aria-labelledby",this.$name.id),this.$widget.appendChild(this.$input),this.$input.addEventListener("change",()=>{this.setValue(this.$input.checked),this._callOnFinishChange()}),this.$disable=this.$input,this.updateDisplay()}updateDisplay(){return this.$input.checked=this.getValue(),this}}function F3(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 ZPe={isPrimitive:!0,match:t=>typeof t=="string",fromHexString:F3,toHexString:F3},Xv={isPrimitive:!0,match:t=>typeof t=="number",fromHexString:t=>parseInt(t.substring(1),16),toHexString:t=>"#"+t.toString(16).padStart(6,0)},JPe={isPrimitive:!1,match:t=>Array.isArray(t),fromHexString(t,e,n=1){const r=Xv.fromHexString(t);e[0]=(r>>16&255)/255*n,e[1]=(r>>8&255)/255*n,e[2]=(r&255)/255*n},toHexString([t,e,n],r=1){r=255/r;const a=t*r<<16^e*r<<8^n*r<<0;return Xv.toHexString(a)}},eAe={isPrimitive:!1,match:t=>Object(t)===t,fromHexString(t,e,n=1){const r=Xv.fromHexString(t);e.r=(r>>16&255)/255*n,e.g=(r>>8&255)/255*n,e.b=(r&255)/255*n},toHexString({r:t,g:e,b:n},r=1){r=255/r;const a=t*r<<16^e*r<<8^n*r<<0;return Xv.toHexString(a)}},tAe=[ZPe,Xv,JPe,eAe];function nAe(t){return tAe.find(e=>e.match(t))}class rAe extends Uc{constructor(e,n,r,a){super(e,n,r,"color"),this.$input=document.createElement("input"),this.$input.setAttribute("type","color"),this.$input.setAttribute("tabindex",-1),this.$input.setAttribute("aria-labelledby",this.$name.id),this.$text=document.createElement("input"),this.$text.setAttribute("type","text"),this.$text.setAttribute("spellcheck","false"),this.$text.setAttribute("aria-labelledby",this.$name.id),this.$display=document.createElement("div"),this.$display.classList.add("display"),this.$display.appendChild(this.$input),this.$widget.appendChild(this.$display),this.$widget.appendChild(this.$text),this._format=nAe(this.initialValue),this._rgbScale=a,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 s=F3(this.$text.value);s&&this._setValueFromHexString(s)}),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 y2 extends Uc{constructor(e,n,r){super(e,n,r,"function"),this.$button=document.createElement("button"),this.$button.appendChild(this.$name),this.$widget.appendChild(this.$button),this.$button.addEventListener("click",a=>{a.preventDefault(),this.getValue().call(this.object),this._callOnChange()}),this.$button.addEventListener("touchstart",()=>{},{passive:!0}),this.$disable=this.$button}}class iAe extends Uc{constructor(e,n,r,a,s,o){super(e,n,r,"number"),this._initInput(),this.min(a),this.max(s);const l=o!==void 0;this.step(l?o:this._getImplicitStep(),l),this.updateDisplay()}decimals(e){return this._decimals=e,this.updateDisplay(),this}min(e){return this._min=e,this._onUpdateMinMax(),this}max(e){return this._max=e,this._onUpdateMinMax(),this}step(e,n=!0){return this._step=e,this._stepExplicit=n,this}updateDisplay(){const e=this.getValue();if(this._hasSlider){let n=(e-this._min)/(this._max-this._min);n=Math.max(0,Math.min(n,1)),this.$fill.style.width=n*100+"%"}return this._inputFocused||(this.$input.value=this._decimals===void 0?e:e.toFixed(this._decimals)),this}_initInput(){this.$input=document.createElement("input"),this.$input.setAttribute("type","text"),this.$input.setAttribute("aria-labelledby",this.$name.id),window.matchMedia("(pointer: coarse)").matches&&(this.$input.setAttribute("type","number"),this.$input.setAttribute("step","any")),this.$widget.appendChild(this.$input),this.$disable=this.$input;const n=()=>{let _=parseFloat(this.$input.value);isNaN(_)||(this._stepExplicit&&(_=this._snap(_)),this.setValue(this._clamp(_)))},r=_=>{const k=parseFloat(this.$input.value);isNaN(k)||(this._snapClampSetValue(k+_),this.$input.value=this.getValue())},a=_=>{_.key==="Enter"&&this.$input.blur(),_.code==="ArrowUp"&&(_.preventDefault(),r(this._step*this._arrowKeyMultiplier(_))),_.code==="ArrowDown"&&(_.preventDefault(),r(this._step*this._arrowKeyMultiplier(_)*-1))},s=_=>{this._inputFocused&&(_.preventDefault(),r(this._step*this._normalizeMouseWheel(_)))};let o=!1,l,c,d,u,m;const p=5,f=_=>{l=_.clientX,c=d=_.clientY,o=!0,u=this.getValue(),m=0,window.addEventListener("mousemove",y),window.addEventListener("mouseup",x)},y=_=>{if(o){const k=_.clientX-l,P=_.clientY-c;Math.abs(P)>p?(_.preventDefault(),this.$input.blur(),o=!1,this._setDraggingStyle(!0,"vertical")):Math.abs(k)>p&&x()}if(!o){const k=_.clientY-d;m-=k*this._step*this._arrowKeyMultiplier(_),u+m>this._max?m=this._max-u:u+m<this._min&&(m=this._min-u),this._snapClampSetValue(u+m)}d=_.clientY},x=()=>{this._setDraggingStyle(!1,"vertical"),this._callOnFinishChange(),window.removeEventListener("mousemove",y),window.removeEventListener("mouseup",x)},b=()=>{this._inputFocused=!0},v=()=>{this._inputFocused=!1,this.updateDisplay(),this._callOnFinishChange()};this.$input.addEventListener("input",n),this.$input.addEventListener("keydown",a),this.$input.addEventListener("wheel",s,{passive:!1}),this.$input.addEventListener("mousedown",f),this.$input.addEventListener("focus",b),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,_,k,P,C)=>(v-_)/(k-_)*(C-P)+P,n=v=>{const _=this.$slider.getBoundingClientRect();let k=e(v,_.left,_.right,this._min,this._max);this._snapClampSetValue(k)},r=v=>{this._setDraggingStyle(!0),n(v.clientX),window.addEventListener("mousemove",a),window.addEventListener("mouseup",s)},a=v=>{n(v.clientX)},s=()=>{this._callOnFinishChange(),this._setDraggingStyle(!1),window.removeEventListener("mousemove",a),window.removeEventListener("mouseup",s)};let o=!1,l,c;const d=v=>{v.preventDefault(),this._setDraggingStyle(!0),n(v.touches[0].clientX),o=!1},u=v=>{v.touches.length>1||(this._hasScrollBar?(l=v.touches[0].clientX,c=v.touches[0].clientY,o=!0):d(v),window.addEventListener("touchmove",m,{passive:!1}),window.addEventListener("touchend",p))},m=v=>{if(o){const _=v.touches[0].clientX-l,k=v.touches[0].clientY-c;Math.abs(_)>Math.abs(k)?d(v):(window.removeEventListener("touchmove",m),window.removeEventListener("touchend",p))}else v.preventDefault(),n(v.touches[0].clientX)},p=()=>{this._callOnFinishChange(),this._setDraggingStyle(!1),window.removeEventListener("touchmove",m),window.removeEventListener("touchend",p)},f=this._callOnFinishChange.bind(this),y=400;let x;const b=v=>{if(Math.abs(v.deltaX)<Math.abs(v.deltaY)&&this._hasScrollBar)return;v.preventDefault();const k=this._normalizeMouseWheel(v)*this._step;this._snapClampSetValue(this.getValue()+k),this.$input.value=this.getValue(),clearTimeout(x),x=setTimeout(f,y)};this.$slider.addEventListener("mousedown",r),this.$slider.addEventListener("touchstart",u,{passive:!1}),this.$slider.addEventListener("wheel",b,{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:r}=e;return Math.floor(e.deltaY)!==e.deltaY&&e.wheelDelta&&(n=0,r=-e.wheelDelta/120,r*=this._stepExplicit?1:10),n+-r}_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 aAe extends Uc{constructor(e,n,r,a){super(e,n,r,"option"),this.$select=document.createElement("select"),this.$select.setAttribute("aria-labelledby",this.$name.id),this.$display=document.createElement("div"),this.$display.classList.add("display"),this.$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(a)}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 r=document.createElement("option");r.textContent=n,this.$select.appendChild(r)}),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 sAe extends Uc{constructor(e,n,r){super(e,n,r,"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",a=>{a.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 oAe=`.lil-gui {
- font-family: var(--font-family);
- font-size: var(--font-size);
- line-height: 1;
- font-weight: normal;
- font-style: normal;
- text-align: left;
- color: var(--text-color);
- user-select: none;
- -webkit-user-select: none;
- touch-action: manipulation;
- --background-color: #1f1f1f;
- --text-color: #ebebeb;
- --title-background-color: #111111;
- --title-text-color: #ebebeb;
- --widget-color: #424242;
- --hover-color: #4f4f4f;
- --focus-color: #595959;
- --number-color: #2cc9ff;
- --string-color: #a2db3c;
- --font-size: 11px;
- --input-font-size: 11px;
- --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
- --font-family-mono: Menlo, Monaco, Consolas, "Droid Sans Mono", monospace;
- --padding: 4px;
- --spacing: 4px;
- --widget-height: 20px;
- --title-height: calc(var(--widget-height) + var(--spacing) * 1.25);
- --name-width: 45%;
- --slider-knob-width: 2px;
- --slider-input-width: 27%;
- --color-input-width: 27%;
- --slider-input-min-width: 45px;
- --color-input-min-width: 45px;
- --folder-indent: 7px;
- --widget-padding: 0 0 0 3px;
- --widget-border-radius: 2px;
- --checkbox-size: calc(0.75 * var(--widget-height));
- --scrollbar-width: 5px;
- }
- .lil-gui, .lil-gui * {
- box-sizing: border-box;
- margin: 0;
- padding: 0;
- }
- .lil-gui.root {
- width: var(--width, 245px);
- display: flex;
- flex-direction: column;
- background: var(--background-color);
- }
- .lil-gui.root > .title {
- background: var(--title-background-color);
- color: var(--title-text-color);
- }
- .lil-gui.root > .children {
- overflow-x: hidden;
- overflow-y: auto;
- }
- .lil-gui.root > .children::-webkit-scrollbar {
- width: var(--scrollbar-width);
- height: var(--scrollbar-width);
- background: var(--background-color);
- }
- .lil-gui.root > .children::-webkit-scrollbar-thumb {
- border-radius: var(--scrollbar-width);
- background: var(--focus-color);
- }
- @media (pointer: coarse) {
- .lil-gui.allow-touch-styles, .lil-gui.allow-touch-styles .lil-gui {
- --widget-height: 28px;
- --padding: 6px;
- --spacing: 6px;
- --font-size: 13px;
- --input-font-size: 16px;
- --folder-indent: 10px;
- --scrollbar-width: 7px;
- --slider-input-min-width: 50px;
- --color-input-min-width: 65px;
- }
- }
- .lil-gui.force-touch-styles, .lil-gui.force-touch-styles .lil-gui {
- --widget-height: 28px;
- --padding: 6px;
- --spacing: 6px;
- --font-size: 13px;
- --input-font-size: 16px;
- --folder-indent: 10px;
- --scrollbar-width: 7px;
- --slider-input-min-width: 50px;
- --color-input-min-width: 65px;
- }
- .lil-gui.autoPlace {
- max-height: 100%;
- position: fixed;
- top: 0;
- right: 15px;
- z-index: 1001;
- }
- .lil-gui .controller {
- display: flex;
- align-items: center;
- padding: 0 var(--padding);
- margin: var(--spacing) 0;
- }
- .lil-gui .controller.disabled {
- opacity: 0.5;
- }
- .lil-gui .controller.disabled, .lil-gui .controller.disabled * {
- pointer-events: none !important;
- }
- .lil-gui .controller > .name {
- min-width: var(--name-width);
- flex-shrink: 0;
- white-space: pre;
- padding-right: var(--spacing);
- line-height: var(--widget-height);
- }
- .lil-gui .controller .widget {
- position: relative;
- display: flex;
- align-items: center;
- width: 100%;
- min-height: var(--widget-height);
- }
- .lil-gui .controller.string input {
- color: var(--string-color);
- }
- .lil-gui .controller.boolean {
- cursor: pointer;
- }
- .lil-gui .controller.color .display {
- width: 100%;
- height: var(--widget-height);
- border-radius: var(--widget-border-radius);
- position: relative;
- }
- @media (hover: hover) {
- .lil-gui .controller.color .display:hover:before {
- content: " ";
- display: block;
- position: absolute;
- border-radius: var(--widget-border-radius);
- border: 1px solid #fff9;
- top: 0;
- right: 0;
- bottom: 0;
- left: 0;
- }
- }
- .lil-gui .controller.color input[type=color] {
- opacity: 0;
- width: 100%;
- height: 100%;
- cursor: pointer;
- }
- .lil-gui .controller.color input[type=text] {
- margin-left: var(--spacing);
- font-family: var(--font-family-mono);
- min-width: var(--color-input-min-width);
- width: var(--color-input-width);
- flex-shrink: 0;
- }
- .lil-gui .controller.option select {
- opacity: 0;
- position: absolute;
- width: 100%;
- max-width: 100%;
- }
- .lil-gui .controller.option .display {
- position: relative;
- pointer-events: none;
- border-radius: var(--widget-border-radius);
- height: var(--widget-height);
- line-height: var(--widget-height);
- max-width: 100%;
- overflow: hidden;
- word-break: break-all;
- padding-left: 0.55em;
- padding-right: 1.75em;
- background: var(--widget-color);
- }
- @media (hover: hover) {
- .lil-gui .controller.option .display.focus {
- background: var(--focus-color);
- }
- }
- .lil-gui .controller.option .display.active {
- background: var(--focus-color);
- }
- .lil-gui .controller.option .display:after {
- font-family: "lil-gui";
- content: "↕";
- position: absolute;
- top: 0;
- right: 0;
- bottom: 0;
- padding-right: 0.375em;
- }
- .lil-gui .controller.option .widget,
- .lil-gui .controller.option select {
- cursor: pointer;
- }
- @media (hover: hover) {
- .lil-gui .controller.option .widget:hover .display {
- background: var(--hover-color);
- }
- }
- .lil-gui .controller.number input {
- color: var(--number-color);
- }
- .lil-gui .controller.number.hasSlider input {
- margin-left: var(--spacing);
- width: var(--slider-input-width);
- min-width: var(--slider-input-min-width);
- flex-shrink: 0;
- }
- .lil-gui .controller.number .slider {
- width: 100%;
- height: var(--widget-height);
- background: var(--widget-color);
- border-radius: var(--widget-border-radius);
- padding-right: var(--slider-knob-width);
- overflow: hidden;
- cursor: ew-resize;
- touch-action: pan-y;
- }
- @media (hover: hover) {
- .lil-gui .controller.number .slider:hover {
- background: var(--hover-color);
- }
- }
- .lil-gui .controller.number .slider.active {
- background: var(--focus-color);
- }
- .lil-gui .controller.number .slider.active .fill {
- opacity: 0.95;
- }
- .lil-gui .controller.number .fill {
- height: 100%;
- border-right: var(--slider-knob-width) solid var(--number-color);
- box-sizing: content-box;
- }
- .lil-gui-dragging .lil-gui {
- --hover-color: var(--widget-color);
- }
- .lil-gui-dragging * {
- cursor: ew-resize !important;
- }
- .lil-gui-dragging.lil-gui-vertical * {
- cursor: ns-resize !important;
- }
- .lil-gui .title {
- height: var(--title-height);
- line-height: calc(var(--title-height) - 4px);
- font-weight: 600;
- padding: 0 var(--padding);
- -webkit-tap-highlight-color: transparent;
- cursor: pointer;
- outline: none;
- text-decoration-skip: objects;
- }
- .lil-gui .title:before {
- font-family: "lil-gui";
- content: "▾";
- padding-right: 2px;
- display: inline-block;
- }
- .lil-gui .title:active {
- background: var(--title-background-color);
- opacity: 0.75;
- }
- @media (hover: hover) {
- body:not(.lil-gui-dragging) .lil-gui .title:hover {
- background: var(--title-background-color);
- opacity: 0.85;
- }
- .lil-gui .title:focus {
- text-decoration: underline var(--focus-color);
- }
- }
- .lil-gui.root > .title:focus {
- text-decoration: none !important;
- }
- .lil-gui.closed > .title:before {
- content: "▸";
- }
- .lil-gui.closed > .children {
- transform: translateY(-7px);
- opacity: 0;
- }
- .lil-gui.closed:not(.transition) > .children {
- display: none;
- }
- .lil-gui.transition > .children {
- transition-duration: 300ms;
- transition-property: height, opacity, transform;
- transition-timing-function: cubic-bezier(0.2, 0.6, 0.35, 1);
- overflow: hidden;
- pointer-events: none;
- }
- .lil-gui .children:empty:before {
- content: "Empty";
- padding: 0 var(--padding);
- margin: var(--spacing) 0;
- display: block;
- height: var(--widget-height);
- font-style: italic;
- line-height: var(--widget-height);
- opacity: 0.5;
- }
- .lil-gui.root > .children > .lil-gui > .title {
- border: 0 solid var(--widget-color);
- border-width: 1px 0;
- transition: border-color 300ms;
- }
- .lil-gui.root > .children > .lil-gui.closed > .title {
- border-bottom-color: transparent;
- }
- .lil-gui + .controller {
- border-top: 1px solid var(--widget-color);
- margin-top: 0;
- padding-top: var(--spacing);
- }
- .lil-gui .lil-gui .lil-gui > .title {
- border: none;
- }
- .lil-gui .lil-gui .lil-gui > .children {
- border: none;
- margin-left: var(--folder-indent);
- border-left: 2px solid var(--widget-color);
- }
- .lil-gui .lil-gui .controller {
- border: none;
- }
- .lil-gui label, .lil-gui input, .lil-gui button {
- -webkit-tap-highlight-color: transparent;
- }
- .lil-gui input {
- border: 0;
- outline: none;
- font-family: var(--font-family);
- font-size: var(--input-font-size);
- border-radius: var(--widget-border-radius);
- height: var(--widget-height);
- background: var(--widget-color);
- color: var(--text-color);
- width: 100%;
- }
- @media (hover: hover) {
- .lil-gui input:hover {
- background: var(--hover-color);
- }
- .lil-gui input:active {
- background: var(--focus-color);
- }
- }
- .lil-gui input:disabled {
- opacity: 1;
- }
- .lil-gui input[type=text],
- .lil-gui input[type=number] {
- padding: var(--widget-padding);
- -moz-appearance: textfield;
- }
- .lil-gui input[type=text]:focus,
- .lil-gui input[type=number]:focus {
- background: var(--focus-color);
- }
- .lil-gui input[type=checkbox] {
- appearance: none;
- width: var(--checkbox-size);
- height: var(--checkbox-size);
- border-radius: var(--widget-border-radius);
- text-align: center;
- cursor: pointer;
- }
- .lil-gui input[type=checkbox]:checked:before {
- font-family: "lil-gui";
- content: "✓";
- font-size: var(--checkbox-size);
- line-height: var(--checkbox-size);
- }
- @media (hover: hover) {
- .lil-gui input[type=checkbox]:focus {
- box-shadow: inset 0 0 0 1px var(--focus-color);
- }
- }
- .lil-gui button {
- outline: none;
- cursor: pointer;
- font-family: var(--font-family);
- font-size: var(--font-size);
- color: var(--text-color);
- width: 100%;
- height: var(--widget-height);
- text-transform: none;
- background: var(--widget-color);
- border-radius: var(--widget-border-radius);
- border: none;
- }
- @media (hover: hover) {
- .lil-gui button:hover {
- background: var(--hover-color);
- }
- .lil-gui button:focus {
- box-shadow: inset 0 0 0 1px var(--focus-color);
- }
- }
- .lil-gui button:active {
- background: var(--focus-color);
- }
- @font-face {
- font-family: "lil-gui";
- src: url("data:application/font-woff;charset=utf-8;base64,d09GRgABAAAAAAUsAAsAAAAACJwAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABHU1VCAAABCAAAAH4AAADAImwmYE9TLzIAAAGIAAAAPwAAAGBKqH5SY21hcAAAAcgAAAD0AAACrukyyJBnbHlmAAACvAAAAF8AAACEIZpWH2hlYWQAAAMcAAAAJwAAADZfcj2zaGhlYQAAA0QAAAAYAAAAJAC5AHhobXR4AAADXAAAABAAAABMAZAAAGxvY2EAAANsAAAAFAAAACgCEgIybWF4cAAAA4AAAAAeAAAAIAEfABJuYW1lAAADoAAAASIAAAIK9SUU/XBvc3QAAATEAAAAZgAAAJCTcMc2eJxVjbEOgjAURU+hFRBK1dGRL+ALnAiToyMLEzFpnPz/eAshwSa97517c/MwwJmeB9kwPl+0cf5+uGPZXsqPu4nvZabcSZldZ6kfyWnomFY/eScKqZNWupKJO6kXN3K9uCVoL7iInPr1X5baXs3tjuMqCtzEuagm/AAlzQgPAAB4nGNgYRBlnMDAysDAYM/gBiT5oLQBAwuDJAMDEwMrMwNWEJDmmsJwgCFeXZghBcjlZMgFCzOiKOIFAB71Bb8AeJy1kjFuwkAQRZ+DwRAwBtNQRUGKQ8OdKCAWUhAgKLhIuAsVSpWz5Bbkj3dEgYiUIszqWdpZe+Z7/wB1oCYmIoboiwiLT2WjKl/jscrHfGg/pKdMkyklC5Zs2LEfHYpjcRoPzme9MWWmk3dWbK9ObkWkikOetJ554fWyoEsmdSlt+uR0pCJR34b6t/TVg1SY3sYvdf8vuiKrpyaDXDISiegp17p7579Gp3p++y7HPAiY9pmTibljrr85qSidtlg4+l25GLCaS8e6rRxNBmsnERunKbaOObRz7N72ju5vdAjYpBXHgJylOAVsMseDAPEP8LYoUHicY2BiAAEfhiAGJgZWBgZ7RnFRdnVJELCQlBSRlATJMoLV2DK4glSYs6ubq5vbKrJLSbGrgEmovDuDJVhe3VzcXFwNLCOILB/C4IuQ1xTn5FPilBTj5FPmBAB4WwoqAHicY2BkYGAA4sk1sR/j+W2+MnAzpDBgAyEMQUCSg4EJxAEAwUgFHgB4nGNgZGBgSGFggJMhDIwMqEAYAByHATJ4nGNgAIIUNEwmAABl3AGReJxjYAACIQYlBiMGJ3wQAEcQBEV4nGNgZGBgEGZgY2BiAAEQyQWEDAz/wXwGAAsPATIAAHicXdBNSsNAHAXwl35iA0UQXYnMShfS9GPZA7T7LgIu03SSpkwzYTIt1BN4Ak/gKTyAeCxfw39jZkjymzcvAwmAW/wgwHUEGDb36+jQQ3GXGot79L24jxCP4gHzF/EIr4jEIe7wxhOC3g2TMYy4Q7+Lu/SHuEd/ivt4wJd4wPxbPEKMX3GI5+DJFGaSn4qNzk8mcbKSR6xdXdhSzaOZJGtdapd4vVPbi6rP+cL7TGXOHtXKll4bY1Xl7EGnPtp7Xy2n00zyKLVHfkHBa4IcJ2oD3cgggWvt/V/FbDrUlEUJhTn/0azVWbNTNr0Ens8de1tceK9xZmfB1CPjOmPH4kitmvOubcNpmVTN3oFJyjzCvnmrwhJTzqzVj9jiSX911FjeAAB4nG3HMRKCMBBA0f0giiKi4DU8k0V2GWbIZDOh4PoWWvq6J5V8If9NVNQcaDhyouXMhY4rPTcG7jwYmXhKq8Wz+p762aNaeYXom2n3m2dLTVgsrCgFJ7OTmIkYbwIbC6vIB7WmFfAAAA==") format("woff");
- }`;function lAe(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 JH=!1;class sk{constructor({parent:e,autoPlace:n=e===void 0,container:r,width:a,title:s="Controls",closeFolders:o=!1,injectStyles:l=!0,touchStyles:c=!0}={}){if(this.parent=e,this.root=e?e.root:this,this.children=[],this.controllers=[],this.folders=[],this._closed=!1,this._hidden=!1,this.domElement=document.createElement("div"),this.domElement.classList.add("lil-gui"),this.$title=document.createElement("div"),this.$title.classList.add("title"),this.$title.setAttribute("role","button"),this.$title.setAttribute("aria-expanded",!0),this.$title.setAttribute("tabindex",0),this.$title.addEventListener("click",()=>this.openAnimated(this._closed)),this.$title.addEventListener("keydown",d=>{(d.code==="Enter"||d.code==="Space")&&(d.preventDefault(),this.$title.click())}),this.$title.addEventListener("touchstart",()=>{},{passive:!0}),this.$children=document.createElement("div"),this.$children.classList.add("children"),this.domElement.appendChild(this.$title),this.domElement.appendChild(this.$children),this.title(s),this.parent){this.parent.children.push(this),this.parent.folders.push(this),this.parent.$children.appendChild(this.domElement);return}this.domElement.classList.add("root"),c&&this.domElement.classList.add("allow-touch-styles"),!JH&&l&&(lAe(oAe),JH=!0),r?r.appendChild(this.domElement):n&&(this.domElement.classList.add("autoPlace"),document.body.appendChild(this.domElement)),a&&this.domElement.style.setProperty("--width",a+"px"),this._closeFolders=o}add(e,n,r,a,s){if(Object(r)===r)return new aAe(this,e,n,r);const o=e[n];switch(typeof o){case"number":return new iAe(this,e,n,r,a,s);case"boolean":return new QPe(this,e,n);case"string":return new sAe(this,e,n);case"function":return new y2(this,e,n)}console.error(`gui.add failed
- property:`,n,`
- object:`,e,`
- value:`,o)}addColor(e,n,r=1){return new rAe(this,e,n,r)}addFolder(e){const n=new sk({parent:this,title:e});return this.root._closeFolders&&n.close(),n}load(e,n=!0){return e.controllers&&this.controllers.forEach(r=>{r instanceof y2||r._name in e.controllers&&r.load(e.controllers[r._name])}),n&&e.folders&&this.folders.forEach(r=>{r._title in e.folders&&r.load(e.folders[r._title])}),this}save(e=!0){const n={controllers:{},folders:{}};return this.controllers.forEach(r=>{if(!(r instanceof y2)){if(r._name in n.controllers)throw new Error(`Cannot save GUI with duplicate property "${r._name}"`);n.controllers[r._name]=r.save()}}),e&&this.folders.forEach(r=>{if(r._title in n.folders)throw new Error(`Cannot save GUI with duplicate folder "${r._title}"`);n.folders[r._title]=r.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 r=s=>{s.target===this.$children&&(this.$children.style.height="",this.domElement.classList.remove("transition"),this.$children.removeEventListener("transitionend",r))};this.$children.addEventListener("transitionend",r);const a=e?this.$children.scrollHeight:0;this.domElement.classList.toggle("closed",!e),requestAnimationFrame(()=>{this.$children.style.height=a+"px"})}),this}title(e){return this._title=e,this.$title.textContent=e,this}reset(e=!0){return(e?this.controllersRecursive():this.controllers).forEach(r=>r.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 v2(t,e,n,r){return new(n||(n=Promise))((function(a,s){function o(d){try{c(r.next(d))}catch(u){s(u)}}function l(d){try{c(r.throw(d))}catch(u){s(u)}}function c(d){var u;d.done?a(d.value):(u=d.value,u instanceof n?u:new n((function(m){m(u)}))).then(o,l)}c((r=r.apply(t,[])).next())}))}class TL{constructor(e,n,r,a){this.size=e,this.width=n,this.height=r,this.charLength=a,this.chars=""}static parse(e){const n=e.split(" "),r=n[0],a=r.split("x");return new TL(r,+a[0],+a[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 PL{constructor(e,n,r,a){this.src=e,this.gcode=n,this.params=r,this.comment=a}}class e$ extends PL{constructor(e,n,r,a){super(e,n,r,a),this.params=r}}class cm extends PL{constructor(e,n,r,a){super(e,n,void 0,r),this.toolIndex=a}}class t${constructor(e,n,r,a=0){this.layer=e,this.commands=n,this.lineNumber=r,this.height=a}}class ok{constructor(e){this.lines=[],this.preamble=new t$(-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(`
- `);this.lines=this.lines.concat(n);const r=this.lines2commands(n);this.groupIntoLayers(r);const a=this.parseMetadata(r.filter((s=>s.comment))).thumbnails;for(const[s,o]of Object.entries(a))this.metadata.thumbnails[s]=o;return{layers:this.layers,metadata:this.metadata}}lines2commands(e){return e.map((n=>this.parseCommand(n)))}parseCommand(e,n=!0){var r;const a=e.trim().split(";"),s=a[0],o=n&&a[1]||void 0,l=s.split(/([a-zA-Z])/g).slice(1).map((u=>u.trim())),c=l.length?`${(r=l[0])===null||r===void 0?void 0:r.toLowerCase()}${l[1]}`:"",d=this.parseParams(l.slice(2));switch(c){case"g0":case"g00":case"g1":case"g01":case"g2":case"g02":case"g3":case"g03":return new e$(e,c,d,o);case"t0":return new cm(e,c,o,0);case"t1":return new cm(e,c,o,1);case"t2":return new cm(e,c,o,2);case"t3":return new cm(e,c,o,3);case"t4":return new cm(e,c,o,4);case"t5":return new cm(e,c,o,5);case"t6":return new cm(e,c,o,6);case"t7":return new cm(e,c,o,7);default:return new PL(e,c,d,o)}}parseMove(e){return e.reduce(((n,r)=>{const a=r.charAt(0).toLowerCase();return a!="x"&&a!="y"&&a!="z"&&a!="e"&&a!="r"&&a!="f"&&a!="i"&&a!="j"||(n[a]=parseFloat(r.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,r,a,s)=>{if(a%2==0)return n;let o=s[a-1];return o=o.toLowerCase(),this.isAlpha(o)&&(n[o]=parseFloat(r)),n}),{})}groupIntoLayers(e){var n;for(let r=0;r<e.length;r++){const a=e[r];if(a instanceof e$){const s=a.params;if(s.z&&(this.curZ=s.z),((n=s.e)!==null&&n!==void 0?n:0)>0&&(s.x!=null||s.y!=null)&&Math.abs(this.curZ-(this.maxZ||-1/0))>this.tolerance){const o=Math.abs(this.curZ-this.maxZ);this.maxZ=this.curZ,this.layers.push(new t$(this.layers.length,[],r,o))}}this.maxLayer.commands.push(a)}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 r;for(const a of e){const s=a.comment;if(!s)continue;const o=s.indexOf("thumbnail begin"),l=s.indexOf("thumbnail end");o>-1?r=TL.parse(s.slice(o+15).trim()):r&&(l==-1?r.chars+=s.trim():(r.isValid&&(n[r.size]=r),r=void 0))}return{thumbnails:n}}}ok.prototype.parseGcode=ok.prototype.parseGCode;const n$={type:"change"},w2={type:"start"},r$={type:"end"},v_=new SL,i$=new fm,cAe=Math.cos(70*dQ.DEG2RAD);class dAe extends yf{constructor(e,n){super(),this.object=e,this.domElement=n,this.domElement.style.touchAction="none",this.enabled=!0,this.target=new rt,this.cursor=new rt,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:vg.ROTATE,MIDDLE:vg.DOLLY,RIGHT:vg.PAN},this.touches={ONE:wg.ROTATE,TWO:wg.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this.getPolarAngle=function(){return l.phi},this.getAzimuthalAngle=function(){return l.theta},this.getDistance=function(){return this.object.position.distanceTo(this.target)},this.listenToKeyEvents=function(V){V.addEventListener("keydown",W),this._domElementKeyEvents=V},this.stopListenToKeyEvents=function(){this._domElementKeyEvents.removeEventListener("keydown",W),this._domElementKeyEvents=null},this.saveState=function(){r.target0.copy(r.target),r.position0.copy(r.object.position),r.zoom0=r.object.zoom},this.reset=function(){r.target.copy(r.target0),r.object.position.copy(r.position0),r.object.zoom=r.zoom0,r.object.updateProjectionMatrix(),r.dispatchEvent(n$),r.update(),s=a.NONE},this.update=(function(){const V=new rt,ee=new Zp().setFromUnitVectors(e.up,new rt(0,1,0)),K=ee.clone().invert(),ne=new rt,se=new Zp,ce=new rt,fe=2*Math.PI;return function(oe=null){const O=r.object.position;V.copy(O).sub(r.target),V.applyQuaternion(ee),l.setFromVector3(V),r.autoRotate&&s===a.NONE&&D((function(he){return he!==null?2*Math.PI/60*r.autoRotateSpeed*he:2*Math.PI/60/60*r.autoRotateSpeed})(oe)),r.enableDamping?(l.theta+=c.theta*r.dampingFactor,l.phi+=c.phi*r.dampingFactor):(l.theta+=c.theta,l.phi+=c.phi);let F=r.minAzimuthAngle,Q=r.maxAzimuthAngle;isFinite(F)&&isFinite(Q)&&(F<-Math.PI?F+=fe:F>Math.PI&&(F-=fe),Q<-Math.PI?Q+=fe:Q>Math.PI&&(Q-=fe),l.theta=F<=Q?Math.max(F,Math.min(Q,l.theta)):l.theta>(F+Q)/2?Math.max(F,l.theta):Math.min(Q,l.theta)),l.phi=Math.max(r.minPolarAngle,Math.min(r.maxPolarAngle,l.phi)),l.makeSafe(),r.enableDamping===!0?r.target.addScaledVector(u,r.dampingFactor):r.target.add(u),r.target.sub(r.cursor),r.target.clampLength(r.minTargetRadius,r.maxTargetRadius),r.target.add(r.cursor),r.zoomToCursor&&T||r.object.isOrthographicCamera?l.radius=ue(l.radius):l.radius=ue(l.radius*d),V.setFromSpherical(l),V.applyQuaternion(K),O.copy(r.target).add(V),r.object.lookAt(r.target),r.enableDamping===!0?(c.theta*=1-r.dampingFactor,c.phi*=1-r.dampingFactor,u.multiplyScalar(1-r.dampingFactor)):(c.set(0,0,0),u.set(0,0,0));let ve=!1;if(r.zoomToCursor&&T){let he=null;if(r.object.isPerspectiveCamera){const de=V.length();he=ue(de*d);const Ae=de-he;r.object.position.addScaledVector(P,Ae),r.object.updateMatrixWorld()}else if(r.object.isOrthographicCamera){const de=new rt(C.x,C.y,0);de.unproject(r.object),r.object.zoom=Math.max(r.minZoom,Math.min(r.maxZoom,r.object.zoom/d)),r.object.updateProjectionMatrix(),ve=!0;const Ae=new rt(C.x,C.y,0);Ae.unproject(r.object),r.object.position.sub(Ae).add(de),r.object.updateMatrixWorld(),he=V.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),r.zoomToCursor=!1;he!==null&&(this.screenSpacePanning?r.target.set(0,0,-1).transformDirection(r.object.matrix).multiplyScalar(he).add(r.object.position):(v_.origin.copy(r.object.position),v_.direction.set(0,0,-1).transformDirection(r.object.matrix),Math.abs(r.object.up.dot(v_.direction))<cAe?e.lookAt(r.target):(i$.setFromNormalAndCoplanarPoint(r.object.up,r.target),v_.intersectPlane(i$,r.target))))}else r.object.isOrthographicCamera&&(r.object.zoom=Math.max(r.minZoom,Math.min(r.maxZoom,r.object.zoom/d)),r.object.updateProjectionMatrix(),ve=!0);return d=1,T=!1,!!(ve||ne.distanceToSquared(r.object.position)>o||8*(1-se.dot(r.object.quaternion))>o||ce.distanceToSquared(r.target)>0)&&(r.dispatchEvent(n$),ne.copy(r.object.position),se.copy(r.object.quaternion),ce.copy(r.target),!0)}})(),this.dispose=function(){r.domElement.removeEventListener("contextmenu",B),r.domElement.removeEventListener("pointerdown",Z),r.domElement.removeEventListener("pointercancel",E),r.domElement.removeEventListener("wheel",I),r.domElement.removeEventListener("pointermove",j),r.domElement.removeEventListener("pointerup",E),r._domElementKeyEvents!==null&&(r._domElementKeyEvents.removeEventListener("keydown",W),r._domElementKeyEvents=null)};const r=this,a={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let s=a.NONE;const o=1e-6,l=new QH,c=new QH;let d=1;const u=new rt,m=new Fn,p=new Fn,f=new Fn,y=new Fn,x=new Fn,b=new Fn,v=new Fn,_=new Fn,k=new Fn,P=new rt,C=new Fn;let T=!1;const N=[],R={};function A(){return Math.pow(.95,r.zoomSpeed)}function D(V){c.theta-=V}function $(V){c.phi-=V}const U=(function(){const V=new rt;return function(ee,K){V.setFromMatrixColumn(K,0),V.multiplyScalar(-ee),u.add(V)}})(),G=(function(){const V=new rt;return function(ee,K){r.screenSpacePanning===!0?V.setFromMatrixColumn(K,1):(V.setFromMatrixColumn(K,0),V.crossVectors(r.object.up,V)),V.multiplyScalar(ee),u.add(V)}})(),L=(function(){const V=new rt;return function(ee,K){const ne=r.domElement;if(r.object.isPerspectiveCamera){const se=r.object.position;V.copy(se).sub(r.target);let ce=V.length();ce*=Math.tan(r.object.fov/2*Math.PI/180),U(2*ee*ce/ne.clientHeight,r.object.matrix),G(2*K*ce/ne.clientHeight,r.object.matrix)}else r.object.isOrthographicCamera?(U(ee*(r.object.right-r.object.left)/r.object.zoom/ne.clientWidth,r.object.matrix),G(K*(r.object.top-r.object.bottom)/r.object.zoom/ne.clientHeight,r.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),r.enablePan=!1)}})();function te(V){r.object.isPerspectiveCamera||r.object.isOrthographicCamera?d/=V:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),r.enableZoom=!1)}function re(V){r.object.isPerspectiveCamera||r.object.isOrthographicCamera?d*=V:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),r.enableZoom=!1)}function J(V){if(!r.zoomToCursor)return;T=!0;const ee=r.domElement.getBoundingClientRect(),K=V.clientX-ee.left,ne=V.clientY-ee.top,se=ee.width,ce=ee.height;C.x=K/se*2-1,C.y=-ne/ce*2+1,P.set(C.x,C.y,1).unproject(r.object).sub(r.object.position).normalize()}function ue(V){return Math.max(r.minDistance,Math.min(r.maxDistance,V))}function me(V){m.set(V.clientX,V.clientY)}function ge(V){y.set(V.clientX,V.clientY)}function X(){if(N.length===1)m.set(N[0].pageX,N[0].pageY);else{const V=.5*(N[0].pageX+N[1].pageX),ee=.5*(N[0].pageY+N[1].pageY);m.set(V,ee)}}function ie(){if(N.length===1)y.set(N[0].pageX,N[0].pageY);else{const V=.5*(N[0].pageX+N[1].pageX),ee=.5*(N[0].pageY+N[1].pageY);y.set(V,ee)}}function le(){const V=N[0].pageX-N[1].pageX,ee=N[0].pageY-N[1].pageY,K=Math.sqrt(V*V+ee*ee);v.set(0,K)}function pe(V){if(N.length==1)p.set(V.pageX,V.pageY);else{const K=z(V),ne=.5*(V.pageX+K.x),se=.5*(V.pageY+K.y);p.set(ne,se)}f.subVectors(p,m).multiplyScalar(r.rotateSpeed);const ee=r.domElement;D(2*Math.PI*f.x/ee.clientHeight),$(2*Math.PI*f.y/ee.clientHeight),m.copy(p)}function Ce(V){if(N.length===1)x.set(V.pageX,V.pageY);else{const ee=z(V),K=.5*(V.pageX+ee.x),ne=.5*(V.pageY+ee.y);x.set(K,ne)}b.subVectors(x,y).multiplyScalar(r.panSpeed),L(b.x,b.y),y.copy(x)}function q(V){const ee=z(V),K=V.pageX-ee.x,ne=V.pageY-ee.y,se=Math.sqrt(K*K+ne*ne);_.set(0,se),k.set(0,Math.pow(_.y/v.y,r.zoomSpeed)),te(k.y),v.copy(_)}function Z(V){r.enabled!==!1&&(N.length===0&&(r.domElement.setPointerCapture(V.pointerId),r.domElement.addEventListener("pointermove",j),r.domElement.addEventListener("pointerup",E)),(function(ee){N.push(ee)})(V),V.pointerType==="touch"?(function(ee){switch(ae(ee),N.length){case 1:switch(r.touches.ONE){case wg.ROTATE:if(r.enableRotate===!1)return;X(),s=a.TOUCH_ROTATE;break;case wg.PAN:if(r.enablePan===!1)return;ie(),s=a.TOUCH_PAN;break;default:s=a.NONE}break;case 2:switch(r.touches.TWO){case wg.DOLLY_PAN:if(r.enableZoom===!1&&r.enablePan===!1)return;r.enableZoom&&le(),r.enablePan&&ie(),s=a.TOUCH_DOLLY_PAN;break;case wg.DOLLY_ROTATE:if(r.enableZoom===!1&&r.enableRotate===!1)return;r.enableZoom&&le(),r.enableRotate&&X(),s=a.TOUCH_DOLLY_ROTATE;break;default:s=a.NONE}break;default:s=a.NONE}s!==a.NONE&&r.dispatchEvent(w2)})(V):(function(ee){let K;switch(ee.button){case 0:K=r.mouseButtons.LEFT;break;case 1:K=r.mouseButtons.MIDDLE;break;case 2:K=r.mouseButtons.RIGHT;break;default:K=-1}switch(K){case vg.DOLLY:if(r.enableZoom===!1)return;(function(ne){J(ne),v.set(ne.clientX,ne.clientY)})(ee),s=a.DOLLY;break;case vg.ROTATE:if(ee.ctrlKey||ee.metaKey||ee.shiftKey){if(r.enablePan===!1)return;ge(ee),s=a.PAN}else{if(r.enableRotate===!1)return;me(ee),s=a.ROTATE}break;case vg.PAN:if(ee.ctrlKey||ee.metaKey||ee.shiftKey){if(r.enableRotate===!1)return;me(ee),s=a.ROTATE}else{if(r.enablePan===!1)return;ge(ee),s=a.PAN}break;default:s=a.NONE}s!==a.NONE&&r.dispatchEvent(w2)})(V))}function j(V){r.enabled!==!1&&(V.pointerType==="touch"?(function(ee){switch(ae(ee),s){case a.TOUCH_ROTATE:if(r.enableRotate===!1)return;pe(ee),r.update();break;case a.TOUCH_PAN:if(r.enablePan===!1)return;Ce(ee),r.update();break;case a.TOUCH_DOLLY_PAN:if(r.enableZoom===!1&&r.enablePan===!1)return;(function(K){r.enableZoom&&q(K),r.enablePan&&Ce(K)})(ee),r.update();break;case a.TOUCH_DOLLY_ROTATE:if(r.enableZoom===!1&&r.enableRotate===!1)return;(function(K){r.enableZoom&&q(K),r.enableRotate&&pe(K)})(ee),r.update();break;default:s=a.NONE}})(V):(function(ee){switch(s){case a.ROTATE:if(r.enableRotate===!1)return;(function(K){p.set(K.clientX,K.clientY),f.subVectors(p,m).multiplyScalar(r.rotateSpeed);const ne=r.domElement;D(2*Math.PI*f.x/ne.clientHeight),$(2*Math.PI*f.y/ne.clientHeight),m.copy(p),r.update()})(ee);break;case a.DOLLY:if(r.enableZoom===!1)return;(function(K){_.set(K.clientX,K.clientY),k.subVectors(_,v),k.y>0?te(A()):k.y<0&&re(A()),v.copy(_),r.update()})(ee);break;case a.PAN:if(r.enablePan===!1)return;(function(K){x.set(K.clientX,K.clientY),b.subVectors(x,y).multiplyScalar(r.panSpeed),L(b.x,b.y),y.copy(x),r.update()})(ee)}})(V))}function E(V){(function(ee){delete R[ee.pointerId];for(let K=0;K<N.length;K++)if(N[K].pointerId==ee.pointerId)return void N.splice(K,1)})(V),N.length===0&&(r.domElement.releasePointerCapture(V.pointerId),r.domElement.removeEventListener("pointermove",j),r.domElement.removeEventListener("pointerup",E)),r.dispatchEvent(r$),s=a.NONE}function I(V){r.enabled!==!1&&r.enableZoom!==!1&&s===a.NONE&&(V.preventDefault(),r.dispatchEvent(w2),(function(ee){J(ee),ee.deltaY<0?re(A()):ee.deltaY>0&&te(A()),r.update()})(V),r.dispatchEvent(r$))}function W(V){r.enabled!==!1&&r.enablePan!==!1&&(function(ee){let K=!1;switch(ee.code){case r.keys.UP:ee.ctrlKey||ee.metaKey||ee.shiftKey?$(2*Math.PI*r.rotateSpeed/r.domElement.clientHeight):L(0,r.keyPanSpeed),K=!0;break;case r.keys.BOTTOM:ee.ctrlKey||ee.metaKey||ee.shiftKey?$(-2*Math.PI*r.rotateSpeed/r.domElement.clientHeight):L(0,-r.keyPanSpeed),K=!0;break;case r.keys.LEFT:ee.ctrlKey||ee.metaKey||ee.shiftKey?D(2*Math.PI*r.rotateSpeed/r.domElement.clientHeight):L(r.keyPanSpeed,0),K=!0;break;case r.keys.RIGHT:ee.ctrlKey||ee.metaKey||ee.shiftKey?D(-2*Math.PI*r.rotateSpeed/r.domElement.clientHeight):L(-r.keyPanSpeed,0),K=!0}K&&(ee.preventDefault(),r.update())})(V)}function B(V){r.enabled!==!1&&V.preventDefault()}function ae(V){let ee=R[V.pointerId];ee===void 0&&(ee=new Fn,R[V.pointerId]=ee),ee.set(V.pageX,V.pageY)}function z(V){const ee=V.pointerId===N[0].pointerId?N[1]:N[0];return R[ee.pointerId]}r.domElement.addEventListener("contextmenu",B),r.domElement.addEventListener("pointerdown",Z),r.domElement.addEventListener("pointercancel",E),r.domElement.addEventListener("wheel",I,{passive:!1}),this.update()}}qt.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new Fn(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}},eo.line={uniforms:_L.merge([qt.common,qt.fog,qt.line]),vertexShader:`
- #include <common>
- #include <color_pars_vertex>
- #include <fog_pars_vertex>
- #include <logdepthbuf_pars_vertex>
- #include <clipping_planes_pars_vertex>
- uniform float linewidth;
- uniform vec2 resolution;
- attribute vec3 instanceStart;
- attribute vec3 instanceEnd;
- attribute vec3 instanceColorStart;
- attribute vec3 instanceColorEnd;
- #ifdef WORLD_UNITS
- varying vec4 worldPos;
- varying vec3 worldStart;
- varying vec3 worldEnd;
- #ifdef USE_DASH
- varying vec2 vUv;
- #endif
- #else
- varying vec2 vUv;
- #endif
- #ifdef USE_DASH
- uniform float dashScale;
- attribute float instanceDistanceStart;
- attribute float instanceDistanceEnd;
- varying float vLineDistance;
- #endif
- void trimSegment( const in vec4 start, inout vec4 end ) {
- // trim end segment so it terminates between the camera plane and the near plane
- // conservative estimate of the near plane
- float a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column
- float b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column
- float nearEstimate = - 0.5 * b / a;
- float alpha = ( nearEstimate - start.z ) / ( end.z - start.z );
- end.xyz = mix( start.xyz, end.xyz, alpha );
- }
- void main() {
- #ifdef USE_COLOR
- vColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;
- #endif
- #ifdef USE_DASH
- vLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd;
- vUv = uv;
- #endif
- float aspect = resolution.x / resolution.y;
- // camera space
- vec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );
- vec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );
- #ifdef WORLD_UNITS
- worldStart = start.xyz;
- worldEnd = end.xyz;
- #else
- vUv = uv;
- #endif
- // special case for perspective projection, and segments that terminate either in, or behind, the camera plane
- // clearly the gpu firmware has a way of addressing this issue when projecting into ndc space
- // but we need to perform ndc-space calculations in the shader, so we must address this issue directly
- // perhaps there is a more elegant solution -- WestLangley
- bool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column
- if ( perspective ) {
- if ( start.z < 0.0 && end.z >= 0.0 ) {
- trimSegment( start, end );
- } else if ( end.z < 0.0 && start.z >= 0.0 ) {
- trimSegment( end, start );
- }
- }
- // clip space
- vec4 clipStart = projectionMatrix * start;
- vec4 clipEnd = projectionMatrix * end;
- // ndc space
- vec3 ndcStart = clipStart.xyz / clipStart.w;
- vec3 ndcEnd = clipEnd.xyz / clipEnd.w;
- // direction
- vec2 dir = ndcEnd.xy - ndcStart.xy;
- // account for clip-space aspect ratio
- dir.x *= aspect;
- dir = normalize( dir );
- #ifdef WORLD_UNITS
- // get the offset direction as perpendicular to the view vector
- vec3 worldDir = normalize( end.xyz - start.xyz );
- vec3 offset;
- if ( position.y < 0.5 ) {
- offset = normalize( cross( start.xyz, worldDir ) );
- } else {
- offset = normalize( cross( end.xyz, worldDir ) );
- }
- // sign flip
- if ( position.x < 0.0 ) offset *= - 1.0;
- float forwardOffset = dot( worldDir, vec3( 0.0, 0.0, 1.0 ) );
- // don't extend the line if we're rendering dashes because we
- // won't be rendering the endcaps
- #ifndef USE_DASH
- // extend the line bounds to encompass endcaps
- start.xyz += - worldDir * linewidth * 0.5;
- end.xyz += worldDir * linewidth * 0.5;
- // shift the position of the quad so it hugs the forward edge of the line
- offset.xy -= dir * forwardOffset;
- offset.z += 0.5;
- #endif
- // endcaps
- if ( position.y > 1.0 || position.y < 0.0 ) {
- offset.xy += dir * 2.0 * forwardOffset;
- }
- // adjust for linewidth
- offset *= linewidth * 0.5;
- // set the world position
- worldPos = ( position.y < 0.5 ) ? start : end;
- worldPos.xyz += offset;
- // project the worldpos
- vec4 clip = projectionMatrix * worldPos;
- // shift the depth of the projected points so the line
- // segments overlap neatly
- vec3 clipPose = ( position.y < 0.5 ) ? ndcStart : ndcEnd;
- clip.z = clipPose.z * clip.w;
- #else
- vec2 offset = vec2( dir.y, - dir.x );
- // undo aspect ratio adjustment
- dir.x /= aspect;
- offset.x /= aspect;
- // sign flip
- if ( position.x < 0.0 ) offset *= - 1.0;
- // endcaps
- if ( position.y < 0.0 ) {
- offset += - dir;
- } else if ( position.y > 1.0 ) {
- offset += dir;
- }
- // adjust for linewidth
- offset *= linewidth;
- // adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...
- offset /= resolution.y;
- // select end
- vec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;
- // back to clip space
- offset *= clip.w;
- clip.xy += offset;
- #endif
- gl_Position = clip;
- vec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation
- #include <logdepthbuf_vertex>
- #include <clipping_planes_vertex>
- #include <fog_vertex>
- }
- `,fragmentShader:`
- uniform vec3 diffuse;
- uniform float opacity;
- uniform float linewidth;
- #ifdef USE_DASH
- uniform float dashOffset;
- uniform float dashSize;
- uniform float gapSize;
- #endif
- varying float vLineDistance;
- #ifdef WORLD_UNITS
- varying vec4 worldPos;
- varying vec3 worldStart;
- varying vec3 worldEnd;
- #ifdef USE_DASH
- varying vec2 vUv;
- #endif
- #else
- varying vec2 vUv;
- #endif
- #include <common>
- #include <color_pars_fragment>
- #include <fog_pars_fragment>
- #include <logdepthbuf_pars_fragment>
- #include <clipping_planes_pars_fragment>
- vec2 closestLineToLine(vec3 p1, vec3 p2, vec3 p3, vec3 p4) {
- float mua;
- float mub;
- vec3 p13 = p1 - p3;
- vec3 p43 = p4 - p3;
- vec3 p21 = p2 - p1;
- float d1343 = dot( p13, p43 );
- float d4321 = dot( p43, p21 );
- float d1321 = dot( p13, p21 );
- float d4343 = dot( p43, p43 );
- float d2121 = dot( p21, p21 );
- float denom = d2121 * d4343 - d4321 * d4321;
- float numer = d1343 * d4321 - d1321 * d4343;
- mua = numer / denom;
- mua = clamp( mua, 0.0, 1.0 );
- mub = ( d1343 + d4321 * ( mua ) ) / d4343;
- mub = clamp( mub, 0.0, 1.0 );
- return vec2( mua, mub );
- }
- void main() {
- #include <clipping_planes_fragment>
- #ifdef USE_DASH
- if ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps
- if ( mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize ) discard; // todo - FIX
- #endif
- float alpha = opacity;
- #ifdef WORLD_UNITS
- // Find the closest points on the view ray and the line segment
- vec3 rayEnd = normalize( worldPos.xyz ) * 1e5;
- vec3 lineDir = worldEnd - worldStart;
- vec2 params = closestLineToLine( worldStart, worldEnd, vec3( 0.0, 0.0, 0.0 ), rayEnd );
- vec3 p1 = worldStart + lineDir * params.x;
- vec3 p2 = rayEnd * params.y;
- vec3 delta = p1 - p2;
- float len = length( delta );
- float norm = len / linewidth;
- #ifndef USE_DASH
- #ifdef USE_ALPHA_TO_COVERAGE
- float dnorm = fwidth( norm );
- alpha = 1.0 - smoothstep( 0.5 - dnorm, 0.5 + dnorm, norm );
- #else
- if ( norm > 0.5 ) {
- discard;
- }
- #endif
- #endif
- #else
- #ifdef USE_ALPHA_TO_COVERAGE
- // artifacts appear on some hardware if a derivative is taken within a conditional
- float a = vUv.x;
- float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;
- float len2 = a * a + b * b;
- float dlen = fwidth( len2 );
- if ( abs( vUv.y ) > 1.0 ) {
- alpha = 1.0 - smoothstep( 1.0 - dlen, 1.0 + dlen, len2 );
- }
- #else
- if ( abs( vUv.y ) > 1.0 ) {
- float a = vUv.x;
- float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;
- float len2 = a * a + b * b;
- if ( len2 > 1.0 ) discard;
- }
- #endif
- #endif
- vec4 diffuseColor = vec4( diffuse, alpha );
- #include <logdepthbuf_fragment>
- #include <color_fragment>
- gl_FragColor = vec4( diffuseColor.rgb, alpha );
- #include <tonemapping_fragment>
- #include <colorspace_fragment>
- #include <fog_fragment>
- #include <premultiplied_alpha_fragment>
- }
- `};class EQ extends oh{constructor(e){super({type:"LineMaterial",uniforms:_L.clone(eo.line.uniforms),vertexShader:eo.line.vertexShader,fragmentShader:eo.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 a$=new gl,w_=new rt;class jQ extends KPe{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 Gi([-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 Gi([-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],2))}applyMatrix4(e){const n=this.attributes.instanceStart,r=this.attributes.instanceEnd;return n!==void 0&&(n.applyMatrix4(e),r.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 r=new R3(n,6,1);return this.setAttribute("instanceStart",new Dm(r,3,0)),this.setAttribute("instanceEnd",new Dm(r,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(e){let n;e instanceof Float32Array?n=e:Array.isArray(e)&&(n=new Float32Array(e));const r=new R3(n,6,1);return this.setAttribute("instanceColorStart",new Dm(r,3,0)),this.setAttribute("instanceColorEnd",new Dm(r,3,3)),this}fromWireframeGeometry(e){return this.setPositions(e.attributes.position.array),this}fromEdgesGeometry(e){return this.setPositions(e.attributes.position.array),this}fromMesh(e){return this.fromWireframeGeometry(new BPe(e.geometry)),this}fromLineSegments(e){const n=e.geometry;return this.setPositions(n.attributes.position.array),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new gl);const e=this.attributes.instanceStart,n=this.attributes.instanceEnd;e!==void 0&&n!==void 0&&(this.boundingBox.setFromBufferAttribute(e),a$.setFromBufferAttribute(n),this.boundingBox.union(a$))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new zc),this.boundingBox===null&&this.computeBoundingBox();const e=this.attributes.instanceStart,n=this.attributes.instanceEnd;if(e!==void 0&&n!==void 0){const r=this.boundingSphere.center;this.boundingBox.getCenter(r);let a=0;for(let s=0,o=e.count;s<o;s++)w_.fromBufferAttribute(e,s),a=Math.max(a,r.distanceToSquared(w_)),w_.fromBufferAttribute(n,s),a=Math.max(a,r.distanceToSquared(w_));this.boundingSphere.radius=Math.sqrt(a),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 s$=new rt,o$=new rt,qa=new qr,Va=new qr,xc=new qr,S2=new rt,_2=new ti,Ga=new YPe,l$=new rt,S_=new gl,__=new zc,yc=new qr;let vc,dp;function c$(t,e,n){return yc.set(0,0,-e,1).applyMatrix4(t.projectionMatrix),yc.multiplyScalar(1/yc.w),yc.x=dp/n.width,yc.y=dp/n.height,yc.applyMatrix4(t.projectionMatrixInverse),yc.multiplyScalar(1/yc.w),Math.abs(Math.max(yc.x,yc.y))}class uAe extends Ql{constructor(e=new jQ,n=new EQ({color:16777215*Math.random()})){super(e,n),this.isLineSegments2=!0,this.type="LineSegments2"}computeLineDistances(){const e=this.geometry,n=e.attributes.instanceStart,r=e.attributes.instanceEnd,a=new Float32Array(2*n.count);for(let o=0,l=0,c=n.count;o<c;o++,l+=2)s$.fromBufferAttribute(n,o),o$.fromBufferAttribute(r,o),a[l]=l===0?0:a[l-1],a[l+1]=a[l]+s$.distanceTo(o$);const s=new R3(a,2,1);return e.setAttribute("instanceDistanceStart",new Dm(s,1,0)),e.setAttribute("instanceDistanceEnd",new Dm(s,1,1)),this}raycast(e,n){const r=this.material.worldUnits,a=e.camera;a!==null||r||console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.');const s=e.params.Line2!==void 0&&e.params.Line2.threshold||0;vc=e.ray;const o=this.matrixWorld,l=this.geometry,c=this.material;let d,u;dp=c.linewidth+s,l.boundingSphere===null&&l.computeBoundingSphere(),__.copy(l.boundingSphere).applyMatrix4(o),r?d=.5*dp:d=c$(a,Math.max(a.near,__.distanceToPoint(vc.origin)),c.resolution),__.radius+=d,vc.intersectsSphere(__)!==!1&&(l.boundingBox===null&&l.computeBoundingBox(),S_.copy(l.boundingBox).applyMatrix4(o),r?u=.5*dp:u=c$(a,Math.max(a.near,S_.distanceToPoint(vc.origin)),c.resolution),S_.expandByScalar(u),vc.intersectsBox(S_)!==!1&&(r?(function(m,p){const f=m.matrixWorld,y=m.geometry,x=y.attributes.instanceStart,b=y.attributes.instanceEnd;for(let v=0,_=Math.min(y.instanceCount,x.count);v<_;v++){Ga.start.fromBufferAttribute(x,v),Ga.end.fromBufferAttribute(b,v),Ga.applyMatrix4(f);const k=new rt,P=new rt;vc.distanceSqToSegment(Ga.start,Ga.end,P,k),P.distanceTo(k)<.5*dp&&p.push({point:P,pointOnLine:k,distance:vc.origin.distanceTo(P),object:m,face:null,faceIndex:v,uv:null,uv1:null})}})(this,n):(function(m,p,f){const y=p.projectionMatrix,x=m.material.resolution,b=m.matrixWorld,v=m.geometry,_=v.attributes.instanceStart,k=v.attributes.instanceEnd,P=Math.min(v.instanceCount,_.count),C=-p.near;vc.at(1,xc),xc.w=1,xc.applyMatrix4(p.matrixWorldInverse),xc.applyMatrix4(y),xc.multiplyScalar(1/xc.w),xc.x*=x.x/2,xc.y*=x.y/2,xc.z=0,S2.copy(xc),_2.multiplyMatrices(p.matrixWorldInverse,b);for(let T=0,N=P;T<N;T++){if(qa.fromBufferAttribute(_,T),Va.fromBufferAttribute(k,T),qa.w=1,Va.w=1,qa.applyMatrix4(_2),Va.applyMatrix4(_2),qa.z>C&&Va.z>C)continue;if(qa.z>C){const U=qa.z-Va.z,G=(qa.z-C)/U;qa.lerp(Va,G)}else if(Va.z>C){const U=Va.z-qa.z,G=(Va.z-C)/U;Va.lerp(qa,G)}qa.applyMatrix4(y),Va.applyMatrix4(y),qa.multiplyScalar(1/qa.w),Va.multiplyScalar(1/Va.w),qa.x*=x.x/2,qa.y*=x.y/2,Va.x*=x.x/2,Va.y*=x.y/2,Ga.start.copy(qa),Ga.start.z=0,Ga.end.copy(Va),Ga.end.z=0;const R=Ga.closestPointToPointParameter(S2,!0);Ga.at(R,l$);const A=dQ.lerp(qa.z,Va.z,R),D=A>=-1&&A<=1,$=S2.distanceTo(l$)<.5*dp;if(D&&$){Ga.start.fromBufferAttribute(_,T),Ga.end.fromBufferAttribute(k,T),Ga.start.applyMatrix4(b),Ga.end.applyMatrix4(b);const U=new rt,G=new rt;vc.distanceSqToSegment(Ga.start,Ga.end,G,U),f.push({point:G,pointOnLine:U,distance:vc.origin.distanceTo(G),object:m,face:null,faceIndex:T,uv:null,uv1:null})}}})(this,a,n)))}}class mAe extends AC{constructor(e,n,r,a,s=4473924,o=8947848){s=new yn(s),o=new yn(o);const l=Math.round(e/n);r=Math.round(r/a)*a/2;const c=[],d=[];let u=0;for(let p=-1*(e=l*n/2);p<=e;p+=n){c.push(p,0,-1*r,p,0,r);const f=p===0?s:o;f.toArray(d,u),u+=3,f.toArray(d,u),u+=3,f.toArray(d,u),u+=3,f.toArray(d,u),u+=3}for(let p=-1*r;p<=r;p+=a){c.push(-1*e,0,p,e,0,p);const f=p===0?s:o;f.toArray(d,u),u+=3,f.toArray(d,u),u+=3,f.toArray(d,u),u+=3,f.toArray(d,u),u+=3}const m=new ys;m.setAttribute("position",new Gi(c,3)),m.setAttribute("color",new Gi(d,3)),super(m,new z0({vertexColors:!0,toneMapped:!1}))}}function hAe(t,e,n,r){const a=(function(o,l,c){o*=.5,l*=.5,c*=.5;const d=new ys,u=[];return u.push(-o,-l,-c,-o,l,-c,-o,l,-c,o,l,-c,o,l,-c,o,-l,-c,o,-l,-c,-o,-l,-c,-o,-l,c,-o,l,c,-o,l,c,o,l,c,o,l,c,o,-l,c,o,-l,c,-o,-l,c,-o,-l,-c,-o,-l,c,-o,l,-c,-o,l,c,o,l,-c,o,l,c,o,-l,-c,o,-l,c),d.setAttribute("position",new Gi(u,3)),d})(t,e,n),s=new AC(a,new $Pe({color:new yn(r),dashSize:3,gapSize:1}));return s.computeLineDistances(),s}var dv=function(){var t=0,e=document.createElement("div");function n(u){return e.appendChild(u.dom),u}function r(u){for(var m=0;m<e.children.length;m++)e.children[m].style.display=m===u?"block":"none";t=u}e.style.cssText="position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000",e.addEventListener("click",(function(u){u.preventDefault(),r(++t%e.children.length)}),!1);var a=(performance||Date).now(),s=a,o=0,l=n(new dv.Panel("FPS","#0ff","#002")),c=n(new dv.Panel("MS","#0f0","#020"));if(self.performance&&self.performance.memory)var d=n(new dv.Panel("MB","#f08","#201"));return r(0),{REVISION:16,dom:e,addPanel:n,showPanel:r,begin:function(){a=(performance||Date).now()},end:function(){o++;var u=(performance||Date).now();if(c.update(u-a,200),u>=s+1e3&&(l.update(1e3*o/(u-s),100),s=u,o=0,d)){var m=performance.memory;d.update(m.usedJSHeapSize/1048576,m.jsHeapSizeLimit/1048576)}return u},update:function(){a=this.end()},domElement:e,setMode:r}};dv.Panel=function(t,e,n){var r=1/0,a=0,s=Math.round,o=s(window.devicePixelRatio||1),l=80*o,c=48*o,d=3*o,u=2*o,m=3*o,p=15*o,f=74*o,y=30*o,x=document.createElement("canvas");x.width=l,x.height=c,x.style.cssText="width:80px;height:48px";var b=x.getContext("2d");return b.font="bold "+9*o+"px Helvetica,Arial,sans-serif",b.textBaseline="top",b.fillStyle=n,b.fillRect(0,0,l,c),b.fillStyle=e,b.fillText(t,d,u),b.fillRect(m,p,f,y),b.fillStyle=n,b.globalAlpha=.9,b.fillRect(m,p,f,y),{dom:x,update:function(v,_){r=Math.min(r,v),a=Math.max(a,v),b.fillStyle=n,b.globalAlpha=1,b.fillRect(0,0,l,p),b.fillStyle=e,b.fillText(s(v)+" "+t+" ("+s(r)+"-"+s(a)+")",d,u),b.drawImage(x,m+o,p,f-o,y,m,p,f-o,y),b.fillRect(m+f-o,p,o,y),b.fillStyle=n,b.globalAlpha=.9,b.fillRect(m+f-o,p,o,s((1-v/_)*y))}}};var pAe=dv;class d${constructor(e,n){this.openFolders=[],this.watchedObject=e,this.options=n,this.gui=new sk,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 sk,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 r=e.addFolder("Camera rotation");r.add(this.watchedObject.camera.rotation,"x").listen(),r.add(this.watchedObject.camera.rotation,"y").listen(),r.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 fAe extends ys{constructor(e=[new rt],n=.6,r=.2,a=8){super(),this.type="ExtrusionGeometry",this.parameters={points:e,lineWidth:n,lineHeight:r,radialSegments:a,closed:!1};const s=new rt,o=new rt,l=new Fn,c=[],d=[],u=[],m=[];function p(f){const[y,x,b]=(function(v){const _=e[v],k=new rt,P=new rt,C=new rt,T=new rt;k.copy(_).sub(e[v-1]||_).normalize().add((e[v+1]||_).clone().sub(_).normalize()).normalize();let N=Number.MAX_VALUE;const R=Math.abs(k.x),A=Math.abs(k.y),D=Math.abs(k.z);return R<=N&&(N=R,P.set(1,0,0)),A<=N&&(N=A,P.set(0,1,0)),D<=N&&P.set(0,0,1),T.crossVectors(k,P).normalize(),P.crossVectors(k,T),C.crossVectors(k,P),[_,P,C]})(f);for(let v=0;v<=a;v++){const _=v/a*Math.PI*2,k=Math.sin(_),P=-Math.cos(_);o.x=P*x.x+k*b.x,o.y=P*x.y+k*b.y,o.z=P*x.z+k*b.z,o.normalize(),d.push(o.x,o.y,o.z),s.x=y.x+n*o.x*.5,s.y=y.y+n*o.y*.5,s.z=y.z+r*o.z*.5,c.push(s.x,s.y,s.z)}}(function(){for(let f=0;f<e.length;f++)p(f);p(closed===!1?e.length-1:0),(function(){for(let f=0;f<e.length;f++)for(let y=0;y<=a;y++)l.x=f/e.length,l.y=y/a,u.push(l.x,l.y)})(),(function(){for(let f=1;f<e.length;f++)for(let y=1;y<=a;y++){const x=(a+1)*(f-1)+(y-1),b=(a+1)*f+(y-1),v=(a+1)*f+y,_=(a+1)*(f-1)+y;m.push(x,b,_),m.push(b,v,_)}})()})(),this.setIndex(m),this.setAttribute("position",new Gi(c,3)),this.setAttribute("normal",new Gi(d,3)),this.setAttribute("uv",new Gi(u,2))}}class uv{static get initial(){const e=new uv;return Object.assign(e,{x:0,y:0,z:0,r:0,e:0,i:0,j:0,t:0}),e}}const k2={h:0,s:0,l:0};class vb{constructor(e){var n,r,a,s,o,l,c,d,u;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=uv.initial,this.beyondFirstMove=!1,this.disposables=[],this._extrusionColor=vb.defaultExtrusionColor,this.renderLayerIndex=0,this._geometries={},this._backgroundColor=new yn(14737632),this._travelColor=new yn(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 ok(this.minLayerThreshold),this.scene=new EPe,this.scene.background=this._backgroundColor,e.backgroundColor!==void 0&&(this.backgroundColor=new yn(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=(r=e.initialCameraPosition)!==null&&r!==void 0?r:this.initialCameraPosition,this.debug=(a=e.debug)!==null&&a!==void 0?a:this.debug,this.renderExtrusion=(s=e.renderExtrusion)!==null&&s!==void 0?s:this.renderExtrusion,this.renderTravel=(o=e.renderTravel)!==null&&o!==void 0?o:this.renderTravel,this.nonTravelmoves=(l=e.nonTravelMoves)!==null&&l!==void 0?l:this.nonTravelmoves,this.renderTubes=(c=e.renderTubes)!==null&&c!==void 0?c:this.renderTubes,this.extrusionWidth=(d=e.extrusionWidth)!==null&&d!==void 0?d:this.extrusionWidth,this.devMode=(u=e.devMode)!==null&&u!==void 0?u:this.devMode,this.stats=this.devMode?new pAe:void 0,e.extrusionColor!==void 0&&(this.extrusionColor=e.extrusionColor),e.travelColor!==void 0&&(this.travelColor=new yn(e.travelColor)),e.topLayerColor!==void 0&&(this.topLayerColor=new yn(e.topLayerColor)),e.lastSegmentColor!==void 0&&(this.lastSegmentColor=new yn(e.lastSegmentColor)),e.toolColors){this._toolColors={};for(const[f,y]of Object.entries(e.toolColors))this._toolColors[parseInt(f)]=new yn(y)}if(e.disableGradient!==void 0&&(this.disableGradient=e.disableGradient),console.info("Using THREE r"+kC),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 D3({canvas:this.canvas,preserveDrawingBuffer:!0});else{if(!this.targetId)throw Error("Set either opts.canvas or opts.targetId");const f=document.getElementById(this.targetId);if(!f)throw new Error("Unable to find element "+this.targetId);this.renderer=new D3({preserveDrawingBuffer:!0}),this.canvas=this.renderer.domElement,f.appendChild(this.canvas)}this.camera=new Ao(25,this.canvas.offsetWidth/this.canvas.offsetHeight,10,5e3),this.camera.position.fromArray(this.initialCameraPosition);const m=this.camera.far,p=.8*m;this.scene.fog=new CL(this._backgroundColor,p,m),this.resize(),this.controls=new dAe(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,r]of e.entries())this._extrusionColor[n]=new yn(r)}else this._extrusionColor=new yn(e)}get currentToolColor(){var e;return this._extrusionColor===void 0?vb.defaultExtrusionColor:this._extrusionColor instanceof yn?this._extrusionColor:(e=this._extrusionColor[this.state.t])!==null&&e!==void 0?e:vb.defaultExtrusionColor}get backgroundColor(){return this._backgroundColor}set backgroundColor(e){this._backgroundColor=new yn(e),this.scene.background=this._backgroundColor}get travelColor(){return this._travelColor}set travelColor(e){this._travelColor=new yn(e)}get topLayerColor(){return this._topLayerColor}set topLayerColor(e){this._topLayerColor=e!==void 0?new yn(e):void 0}get lastSegmentColor(){return this._lastSegmentColor}set lastSegmentColor(e){this._lastSegmentColor=e!==void 0?new yn(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 XPe(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 WPe(13421772,.3*Math.PI),n=new GPe(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 Wy;return n.name=e,n.quaternion.setFromEuler(new O0(-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=uv.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 v2(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 r=()=>{this.renderLayerIndex>this.layers.length-1?n():(this.renderFrame(e),requestAnimationFrame(r))};r()}))}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,r,a,s,o,l,c,d;if(e>this.maxLayerIndex)return;const u=this.layers[e],m={extrusion:[],travel:[],z:this.state.z,height:u.height};for(const p of u.commands)if(p.gcode!="g20"){if(p.gcode.startsWith("t")){this.doRenderExtrusion(m,e),m.extrusion=[];const f=p;this.state.t=f.toolIndex}else if(["g0","g00","g1","g01","g2","g02","g3","g03"].indexOf(p.gcode)>-1){const f=p,y={x:(n=f.params.x)!==null&&n!==void 0?n:this.state.x,y:(r=f.params.y)!==null&&r!==void 0?r:this.state.y,z:(a=f.params.z)!==null&&a!==void 0?a:this.state.z,r:(s=f.params.r)!==null&&s!==void 0?s:this.state.r,e:(o=f.params.e)!==null&&o!==void 0?o:this.state.e,i:(l=f.params.i)!==null&&l!==void 0?l:this.state.i,j:(c=f.params.j)!==null&&c!==void 0?c:this.state.j,t:this.state.t};if(e>=this.minLayerIndex){const x=((d=f.params.e)!==null&&d!==void 0?d:0)>0||this.nonTravelmoves.indexOf(p.gcode)>-1;(y.x!=this.state.x||y.y!=this.state.y||y.z!=this.state.z)&&(x&&this.renderExtrusion||!x&&this.renderTravel)&&(p.gcode=="g2"||p.gcode=="g3"||p.gcode=="g02"||p.gcode=="g03"?this.addArcSegment(m,this.state,y,x,p.gcode=="g2"||p.gcode=="g02"):this.addLineSegment(m,this.state,y,x))}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(m,e)}doRenderExtrusion(e,n){var r,a;if(this.renderExtrusion){let s=this.currentToolColor;if(!this.singleLayerMode&&!this.renderTubes&&!this.disableGradient){const o=.1+.7*n/this.layers.length;s.getHSL(k2),s=new yn().setHSL(k2.h,k2.s,o)}if(n==this.layers.length-1){const o=(r=this._topLayerColor)!==null&&r!==void 0?r:s,l=(a=this._lastSegmentColor)!==null&&a!==void 0?a:o,c=e.extrusion.splice(-3),d=e.extrusion.splice(-3);this.renderTubes?(this.addTubeLine(e.extrusion,o.getHex(),e.height),this.addTubeLine([...d,...c],l.getHex(),e.height)):(this.addLine(e.extrusion,o.getHex()),this.addLine([...d,...c],l.getHex()))}else this.renderTubes?this.addTubeLine(e.extrusion,s.getHex(),e.height):this.addLine(e.extrusion,s.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 mAe(this.buildVolume.x,10,this.buildVolume.y,10));const e=hAe(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 ok(this.minLayerThreshold)}resetState(){var e;this.startLayer=1,this.endLayer=1/0,this.singleLayerMode=!1,this.beyondFirstMove=!1,this.state=uv.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,r,a){(a?e.extrusion:e.travel).push(n.x,n.y,n.z,r.x,r.y,r.z)}addArcSegment(e,n,r,a,s){const o=a?e.extrusion:e.travel,l=n.x,c=n.y,d=n.z,u=r.x,m=r.y,p=r.z;let f=r.r,y=r.i,x=r.j;if(f){const te=u-l,re=m-c,J=Math.sqrt(Math.pow(te/2,2)+Math.pow(re/2,2));f=Math.max(f,J);const ue=Math.pow(te,2)+Math.pow(re,2),me=Math.pow(f,2)-ue/4;let ge=Math.sqrt(me/ue);(s&&f<0||!s&&f>0)&&(ge=-ge),y=te/2+re*ge,x=re/2-te*ge}const b=l==u&&c==m,v=l+y,_=c+x,k=Math.sqrt(y*y+x*x),P=Math.atan2(-x,-y),C=Math.atan2(m-_,u-v);let T;b?T=2*Math.PI:(T=s?P-C:C-P,T<0&&(T+=2*Math.PI));let N=k*T/1.8;this.inches&&(N*=25),N<1&&(N=1);let R=T/N;R*=s?-1:1;const A=[];A.push({x:l,y:c,z:d});const D=(d-p)/N;let $=l,U=c,G=d,L=P;for(let te=0;te<N-1;te++)L+=R,$=v+k*Math.cos(L),U=_+k*Math.sin(L),G+=D,A.push({x:$,y:U,z:G});A.push({x:r.x,y:r.y,z:r.z});for(let te=0;te<A.length-1;te++)o.push(A[te].x,A[te].y,A[te].z,A[te+1].x,A[te+1].y,A[te+1].z)}addLine(e,n){var r;if(typeof this.lineWidth=="number"&&this.lineWidth>0)return void this.addThickLine(e,n);const a=new ys;a.setAttribute("position",new Gi(e,3)),this.disposables.push(a);const s=new z0({color:n});this.disposables.push(s);const o=new AC(a,s);(r=this.group)===null||r===void 0||r.add(o)}addTubeLine(e,n,r=.2){let a=[];const s=[];for(let o=0;o<e.length;o+=6){const l=e.slice(o,o+9),c=new rt(l[0],l[1],l[2]),d=new rt(l[3],l[4],l[5]),u=new rt(l[6],l[7],l[8]);a.push(c),d.equals(u)||(a.push(d),s.push(a),a=[])}s.forEach((o=>{var l;const c=new fAe(o,this.extrusionWidth,this.lineHeight||r,4);(l=this._geometries)[n]||(l[n]=[]),this._geometries[n].push(c)}))}addThickLine(e,n){var r;if(!e.length||!this.lineWidth)return;const a=new jQ;this.disposables.push(a);const s=new EQ({color:n,linewidth:this.lineWidth/(1e3*window.devicePixelRatio)});this.disposables.push(s),a.setPositions(e);const o=new uAe(a,s);(r=this.group)===null||r===void 0||r.add(o)}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=>v2(this,void 0,void 0,(function*(){var n,r;e.stopPropagation(),e.preventDefault(),this.canvas.classList.remove("dragging");const a=((r=(n=e.dataTransfer)===null||n===void 0?void 0:n.files)!==null&&r!==void 0?r:[])[0];this.clear(),yield this._readFromStream(a.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 r=this._geometries[e].pop();n.addGeometry(r)}}}createBatchMesh(e){var n;const r=this._geometries[e],a=new HPe({color:e,wireframe:this._wireframe});this.disposables.push(a);const s=r.reduce(((l,c)=>3*c.attributes.position.count+l),0),o=new zPe(r.length,s,void 0,a);return this.disposables.push(o),(n=this.group)===null||n===void 0||n.add(o),o}_readFromStream(e){var n,r;return v2(this,void 0,void 0,(function*(){const a=e.getReader();let s,o="",l=0;do{console.debug("reading from stream"),s=yield a.read(),l+=(r=(n=s.value)===null||n===void 0?void 0:n.length)!==null&&r!==void 0?r:0;const d=(c=s.value,new TextDecoder("utf-8").decode(c)),u=d.lastIndexOf(`
- `),m=d.slice(0,u);this.parser.parseGCode(o+m),o=d.slice(u)}while(!s.done);var c;console.debug("read from stream",l)}))}initGui(){typeof this.devMode=="boolean"&&this.devMode===!0?this.devGui=new d$(this):typeof this.devMode=="object"&&(this.devGui=new d$(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())}}vb.defaultExtrusionColor=new yn("hotpink");function DQ({gcodeUrl:t,buildVolume:e={x:256,y:256,z:256},filamentColors:n,className:r=""}){const a=w.useRef(null),s=w.useRef(null),o=w.useRef(null),l=w.useRef(!1),[c,d]=w.useState(!0),[u,m]=w.useState(null),[p,f]=w.useState(!1),[y,x]=w.useState(0),[b,v]=w.useState(0),_=w.useMemo(()=>JSON.stringify(n),[n]);w.useEffect(()=>{if(!a.current||l.current)return;l.current=!0;const C=a.current,T=C.parentElement?.getBoundingClientRect();T&&(C.width=T.width,C.height=T.height);const N=n&&n.length>1,R=n?.[0]||"#00ae42",A=new vb({canvas:C,buildVolume:e,backgroundColor:1710618,extrusionColor:N?n:R,disableGradient:!0,lineHeight:.2,lineWidth:2,renderTravel:!1,renderExtrusion:!0});s.current=A;const D={},$=uu();$&&(D.Authorization=`Bearer ${$}`),fetch(t,{headers:D}).then(async G=>{if(!G.ok)throw G.status===404&&(await G.json().catch(()=>({}))).detail?.includes("sliced")?(f(!0),new Error("not_sliced")):new Error("Failed to load G-code");return G.text()}).then(G=>{const L=new Set,te=/^(\s*)T(\d+)(\s*;.*)?$/gim;let re;for(;(re=te.exec(G))!==null;){const ie=parseInt(re[2],10);ie<=15&&L.add(ie)}const J=new Map,ue=Array.from(L).sort((ie,le)=>ie-le);ue.forEach((ie,le)=>{J.set(ie,le%8)});const me=[];ue.forEach((ie,le)=>{const pe=n?.[ie]||"#00ae42";me[le%8]=pe});const ge=G.split(`
- `).map(ie=>{const le=ie.match(/^(\s*)T(\d+)(\s*;.*)?$/i);if(le){const pe=parseInt(le[2],10);if(pe>15)return`; FILTERED: ${ie.trim()}`;const Ce=J.get(pe)??0;return`${le[1]}T${Ce}${le[3]||""}`}return ie}).join(`
- `);me.length>0&&(A.extrusionColor=me),A.processGCode(ge);const X=A.layers?.length||0;v(X),x(X),A.render(),d(!1)}).catch(G=>{G.message!=="not_sliced"&&m(G.message),d(!1)});const U=()=>{if(C.parentElement&&s.current){const G=C.parentElement.getBoundingClientRect();C.width=G.width,C.height=G.height,s.current.resize()}};return window.addEventListener("resize",U),()=>{window.removeEventListener("resize",U),o.current&&cancelAnimationFrame(o.current),s.current&&(s.current.dispose(),s.current=null),l.current=!1}},[t,_]);const k=w.useCallback(C=>{if(!s.current)return;const T=Math.max(1,Math.min(C,b));x(T),o.current&&cancelAnimationFrame(o.current),o.current=requestAnimationFrame(()=>{s.current&&(s.current.endLayer=T,s.current.render())})},[b]),P=C=>{k(parseInt(C.target.value,10))};return i.jsxs("div",{className:`relative flex flex-col h-full ${r}`,children:[i.jsxs("div",{className:"flex-1 relative bg-bambu-dark rounded-lg overflow-hidden",children:[i.jsx("canvas",{ref:a,className:"w-full h-full"}),c&&i.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-bambu-dark/80",children:i.jsxs("div",{className:"text-center",children:[i.jsx(ct,{className:"w-8 h-8 animate-spin text-bambu-green mx-auto mb-2"}),i.jsx("p",{className:"text-bambu-gray text-sm",children:"Loading G-code..."})]})}),p&&i.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-bambu-dark/80",children:i.jsxs("div",{className:"text-center max-w-sm px-4",children:[i.jsx(Jhe,{className:"w-12 h-12 text-bambu-gray mx-auto mb-3"}),i.jsx("p",{className:"text-white font-medium mb-2",children:"G-code not available"}),i.jsx("p",{className:"text-bambu-gray text-sm",children:"This file hasn't been sliced yet. G-code preview is only available after slicing in Bambu Studio or Orca Slicer."})]})}),u&&!p&&i.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-bambu-dark/80",children:i.jsx("div",{className:"text-center text-red-400",children:i.jsx("p",{className:"text-sm",children:u})})})]}),!c&&!u&&!p&&b>0&&i.jsx("div",{className:"mt-4 px-2",children:i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(Vi,{className:"w-4 h-4 text-bambu-gray flex-shrink-0"}),i.jsx("button",{onClick:()=>k(y-1),disabled:y<=1,className:"p-1 rounded hover:bg-bambu-dark-tertiary disabled:opacity-30 disabled:cursor-not-allowed",children:i.jsx(ec,{className:"w-4 h-4"})}),i.jsx("input",{type:"range",min:1,max:b,value:y,onChange:P,className:"flex-1 h-2 bg-bambu-dark-tertiary rounded-lg appearance-none cursor-pointer accent-bambu-green"}),i.jsx("button",{onClick:()=>k(y+1),disabled:y>=b,className:"p-1 rounded hover:bg-bambu-dark-tertiary disabled:opacity-30 disabled:cursor-not-allowed",children:i.jsx(pa,{className:"w-4 h-4"})}),i.jsxs("span",{className:"text-sm text-bambu-gray min-w-[80px] text-right",children:[y," / ",b]})]})})]})}function gAe({printerId:t,filePath:e,filename:n,onClose:r}){const[a,s]=w.useState(null),[o,l]=w.useState([]),[c,d]=w.useState(!1),[u,m]=w.useState(null),p=n.toLowerCase().split(".").pop()||"",f=p==="3mf"||p==="stl",y=p==="gcode"||p==="3mf";w.useEffect(()=>{s(f?"3d":y?"gcode":null)},[f,y]),w.useEffect(()=>{l([]),m(null),f&&(d(!0),be.getPrinterFilePlates(t,e).then(v=>l(v.plates||[])).catch(()=>l([])).finally(()=>d(!1)))},[e,f,t]);const x=o.length>1,b=u==null?null:o.find(v=>v.index===u)??null;return i.jsx("div",{className:"fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-6",onClick:r,children:i.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:v=>v.stopPropagation(),children:[i.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-bambu-dark-tertiary",children:[i.jsx("h2",{className:"text-lg font-semibold text-white truncate flex-1 mr-4",children:n}),i.jsx(Fe,{variant:"ghost",size:"sm",onClick:r,children:i.jsx(zt,{className:"w-5 h-5"})})]}),i.jsxs("div",{className:"flex border-b border-bambu-dark-tertiary",children:[i.jsxs("button",{onClick:()=>f&&s("3d"),disabled:!f,className:`flex items-center gap-2 px-6 py-3 text-sm font-medium transition-colors ${a==="3d"?"text-bambu-green border-b-2 border-bambu-green":f?"text-bambu-gray hover:text-white":"text-bambu-gray/30 cursor-not-allowed"}`,children:[i.jsx(ra,{className:"w-4 h-4"}),"3D Model",!f&&i.jsx("span",{className:"text-xs",children:"(not available)"})]}),i.jsxs("button",{onClick:()=>y&&s("gcode"),disabled:!y,className:`flex items-center gap-2 px-6 py-3 text-sm font-medium transition-colors ${a==="gcode"?"text-bambu-green border-b-2 border-bambu-green":y?"text-bambu-gray hover:text-white":"text-bambu-gray/30 cursor-not-allowed"}`,children:[i.jsx(Es,{className:"w-4 h-4"}),"G-code Preview",!y&&i.jsx("span",{className:"text-xs",children:"(not sliced)"})]})]}),i.jsx("div",{className:"flex-1 overflow-hidden p-4",children:a==="3d"&&f?i.jsxs("div",{className:"w-full h-full flex flex-col gap-3",children:[x&&i.jsxs("div",{className:"rounded-lg border border-bambu-dark-tertiary bg-bambu-dark p-3",children:[i.jsxs("div",{className:"flex items-center gap-2 text-sm text-bambu-gray mb-2",children:[i.jsx(ra,{className:"w-4 h-4"}),"Plates",c&&i.jsx(ct,{className:"w-3 h-3 animate-spin"})]}),i.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-2",children:[i.jsxs("button",{type:"button",onClick:()=>m(null),className:`flex items-center gap-2 rounded-lg border p-2 text-left transition-colors ${u==null?"border-bambu-green bg-bambu-green/10":"border-bambu-dark-tertiary bg-bambu-dark-secondary hover:border-bambu-gray"}`,children:[i.jsx("div",{className:"w-10 h-10 rounded bg-bambu-dark-tertiary flex items-center justify-center",children:i.jsx(ra,{className:"w-5 h-5 text-bambu-gray"})}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsx("p",{className:"text-sm text-white font-medium truncate",children:"All Plates"}),i.jsxs("p",{className:"text-xs text-bambu-gray truncate",children:[o.length," plate",o.length!==1?"s":""]})]}),u==null&&i.jsx(mo,{className:"w-4 h-4 text-bambu-green flex-shrink-0"})]}),o.map(v=>i.jsxs("button",{type:"button",onClick:()=>m(v.index),className:`flex items-center gap-2 rounded-lg border p-2 text-left transition-colors ${u===v.index?"border-bambu-green bg-bambu-green/10":"border-bambu-dark-tertiary bg-bambu-dark-secondary hover:border-bambu-gray"}`,children:[v.has_thumbnail?i.jsx("img",{src:be.getPrinterFilePlateThumbnail(t,v.index,e),alt:`Plate ${v.index}`,className:"w-10 h-10 rounded object-cover bg-bambu-dark-tertiary"}):i.jsx("div",{className:"w-10 h-10 rounded bg-bambu-dark-tertiary flex items-center justify-center",children:i.jsx(ra,{className:"w-5 h-5 text-bambu-gray"})}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsx("p",{className:"text-sm text-white font-medium truncate",children:v.name||`Plate ${v.index}`}),i.jsx("p",{className:"text-xs text-bambu-gray truncate",children:v.objects.length>0?v.objects.slice(0,2).join(", ")+(v.objects.length>2?"…":""):`${v.filaments.length} filament${v.filaments.length!==1?"s":""}`})]}),u===v.index&&i.jsx(mo,{className:"w-4 h-4 text-bambu-green flex-shrink-0"})]},v.index))]}),b&&i.jsxs("div",{className:"mt-3 text-xs text-bambu-gray flex flex-wrap gap-x-4 gap-y-1",children:[i.jsxs("span",{children:["Plate ",b.index]}),b.print_time_seconds!=null&&i.jsxs("span",{children:["ETA ",Math.round(b.print_time_seconds/60)," min"]}),b.filament_used_grams!=null&&i.jsxs("span",{children:[b.filament_used_grams.toFixed(1)," g"]}),b.filaments.length>0&&i.jsxs("span",{children:[b.filaments.length," filament",b.filaments.length!==1?"s":""]})]})]}),i.jsx("div",{className:"flex-1",children:i.jsx(QX,{url:be.getPrinterFileDownloadUrl(t,e),fileType:p,selectedPlateId:u,className:"w-full h-full"})})]}):a==="gcode"&&y?i.jsx(DQ,{gcodeUrl:be.getPrinterFileGcodeUrl(t,e),className:"w-full h-full"}):i.jsx("div",{className:"w-full h-full flex items-center justify-center text-bambu-gray",children:"No preview available for this file"})})]})})}function u$(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 bAe(t,e){if(e)return GY;switch(t.toLowerCase().split(".").pop()||""){case"3mf":return Cp;case"gcode":return Es;case"mp4":case"avi":return Hm;case"png":case"jpg":case"jpeg":return ou;default:return cC}}const xAe=[{value:"name-asc",label:"Name (A-Z)"},{value:"name-desc",label:"Name (Z-A)"},{value:"size-asc",label:"Size (smallest)"},{value:"size-desc",label:"Size (largest)"},{value:"date-asc",label:"Date (oldest)"},{value:"date-desc",label:"Date (newest)"}];function yAe({printerId:t,printerName:e,onClose:n}){const{t:r}=Mt(),{showToast:a}=bn(),s=tn(),[o,l]=w.useState("/"),[c,d]=w.useState(new Set),[u,m]=w.useState(""),[p,f]=w.useState([]),[y,x]=w.useState("name-asc"),[b,v]=w.useState(null),[_,k]=w.useState(null);w.useEffect(()=>{const J=ue=>{ue.key==="Escape"&&n()};return window.addEventListener("keydown",J),()=>window.removeEventListener("keydown",J)},[n]);const{data:P,isLoading:C,refetch:T}=Je({queryKey:["printerFiles",t,o],queryFn:()=>be.getPrinterFiles(t,o)}),{data:N}=Je({queryKey:["printerStorage",t],queryFn:()=>be.getPrinterStorage(t),staleTime:3e4}),R=ut({mutationFn:async J=>{for(const ue of J)await be.deletePrinterFile(t,ue)},onSuccess:()=>{a(r("printerFiles.toast.filesDeleted",{count:p.length})),s.invalidateQueries({queryKey:["printerFiles",t]}),d(new Set),f([])},onError:J=>{a(r("printerFiles.toast.deleteFailed",{error:J.message}),"error")}}),A=J=>{l(J),d(new Set)},D=()=>{if(o==="/")return;const J=o.split("/").filter(Boolean);J.pop(),l(J.length?"/"+J.join("/"):"/"),d(new Set)},$=(J,ue)=>{ue.stopPropagation(),d(me=>{const ge=new Set(me);return ge.has(J)?ge.delete(J):ge.add(J),ge})},U=()=>{if(!P?.files)return;const J=P.files.filter(ue=>!ue.is_directory&&(!u||ue.name.toLowerCase().includes(u.toLowerCase()))).map(ue=>ue.path);d(new Set(J))},G=()=>{d(new Set)},L=async()=>{if(c.size===0)return;const J=Array.from(c);if(J.length===1){be.downloadPrinterFile(t,J[0]).catch(ue=>{console.error("Printer file download failed:",ue)}),d(new Set);return}v({current:0,total:J.length});try{const ue=await be.downloadPrinterFilesAsZip(t,J),me=URL.createObjectURL(ue),ge=document.createElement("a");ge.href=me,ge.download=`${e.replace(/[^a-zA-Z0-9]/g,"_")}-files.zip`,document.body.appendChild(ge),ge.click(),document.body.removeChild(ge),URL.revokeObjectURL(me),a(`Downloaded ${J.length} files as ZIP`),d(new Set)}catch(ue){a(`Download failed: ${ue instanceof Error?ue.message:"Unknown error"}`,"error")}finally{v(null)}},te=()=>{c.size!==0&&f(Array.from(c))},re=[{path:"/",label:"Root"},{path:"/cache",label:"Cache"},{path:"/model",label:"Models"},{path:"/timelapse",label:"Timelapse"}];return i.jsxs("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",onClick:n,children:[i.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:J=>J.stopPropagation(),children:[i.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-bambu-dark-tertiary flex-shrink-0",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(cx,{className:"w-5 h-5 text-bambu-green"}),i.jsxs("div",{children:[i.jsx("h2",{className:"text-lg font-semibold text-white",children:r("printerFiles.title")}),i.jsx("p",{className:"text-sm text-bambu-gray",children:e})]})]}),i.jsxs("div",{className:"flex items-center gap-4",children:[N&&(N.used_bytes!=null||N.free_bytes!=null)&&i.jsxs("div",{className:"text-sm text-bambu-gray flex items-center gap-2",children:[N.used_bytes!=null&&i.jsxs("span",{children:[r("printerFiles.storageUsed")," ",u$(N.used_bytes)]}),N.used_bytes!=null&&N.free_bytes!=null&&i.jsx("span",{className:"text-bambu-dark-tertiary",children:"|"}),N.free_bytes!=null&&i.jsxs("span",{children:[r("printerFiles.storageFree")," ",u$(N.free_bytes)]})]}),i.jsx("button",{onClick:n,className:"text-bambu-gray hover:text-white transition-colors",title:"Close file manager","aria-label":"Close file manager",children:i.jsx(zt,{className:"w-5 h-5"})})]})]}),i.jsxs("div",{className:"flex items-center gap-2 p-3 border-b border-bambu-dark-tertiary bg-bambu-dark/50 flex-shrink-0",children:[re.map(J=>i.jsx("button",{onClick:()=>{A(J.path),m("")},className:`px-3 py-1 text-sm rounded-full transition-colors ${o===J.path?"bg-bambu-green text-white":"bg-bambu-dark-tertiary text-bambu-gray hover:text-white"}`,children:J.label},J.path)),i.jsx("div",{className:"flex-1"}),i.jsxs("div",{className:"relative",children:[i.jsx(Dr,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray"}),i.jsx("input",{type:"text",placeholder:r("printerFiles.filterPlaceholder"),value:u,onChange:J=>m(J.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"})]}),i.jsxs("div",{className:"relative flex items-center gap-1",children:[i.jsx(VF,{className:"w-4 h-4 text-bambu-gray"}),i.jsx("select",{value:y,onChange:J=>x(J.target.value),className:"appearance-none bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm py-1.5 pl-2 pr-6 focus:border-bambu-green focus:outline-none cursor-pointer",title:"Sort files","aria-label":"Sort files",children:xAe.map(J=>i.jsx("option",{value:J.value,children:J.label},J.value))})]}),i.jsx(Fe,{variant:"secondary",size:"sm",onClick:()=>T(),disabled:C,children:i.jsx(_r,{className:`w-4 h-4 ${C?"animate-spin":""}`})})]}),i.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 bg-bambu-dark text-sm flex-shrink-0",children:[i.jsx("button",{onClick:D,disabled:o==="/",className:"p-1 rounded hover:bg-bambu-dark-tertiary disabled:opacity-50 disabled:cursor-not-allowed",title:"Go to parent folder","aria-label":"Go to parent folder",children:i.jsx(ec,{className:"w-4 h-4"})}),i.jsx("span",{className:"text-bambu-gray font-mono",children:o})]}),i.jsx("div",{className:"flex-1 overflow-y-auto p-2 min-h-0",children:C?i.jsx("div",{className:"flex items-center justify-center py-12",children:i.jsx(ct,{className:"w-8 h-8 text-bambu-green animate-spin"})}):P?.files?.length?i.jsx("div",{className:"space-y-1",children:[...P.files].filter(J=>!u||J.name.toLowerCase().includes(u.toLowerCase())).sort((J,ue)=>{if(J.is_directory&&!ue.is_directory)return-1;if(!J.is_directory&&ue.is_directory)return 1;switch(y){case"name-asc":return J.name.localeCompare(ue.name);case"name-desc":return ue.name.localeCompare(J.name);case"size-asc":return J.size-ue.size;case"size-desc":return ue.size-J.size;case"date-asc":{const me=J.mtime?Jn(J.mtime)?.getTime()??0:0,ge=ue.mtime?Jn(ue.mtime)?.getTime()??0:0;return me-ge}case"date-desc":{const me=J.mtime?Jn(J.mtime)?.getTime()??0:0;return(ue.mtime?Jn(ue.mtime)?.getTime()??0:0)-me}default:return J.name.localeCompare(ue.name)}}).map(J=>{const ue=bAe(J.name,J.is_directory),me=c.has(J.path);return i.jsxs("div",{className:`flex items-center gap-3 p-2 rounded-lg cursor-pointer transition-colors ${me?"bg-bambu-green/20 border border-bambu-green/50":"hover:bg-bambu-dark-tertiary"}`,onClick:()=>{J.is_directory&&A(J.path)},children:[J.is_directory?null:i.jsx("button",{onClick:ge=>$(J.path,ge),className:"flex-shrink-0 text-bambu-gray hover:text-white",children:me?i.jsx(mo,{className:"w-5 h-5 text-bambu-green"}):i.jsx(Sl,{className:"w-5 h-5"})}),i.jsx(ue,{className:`w-5 h-5 flex-shrink-0 ${J.is_directory?"text-bambu-green":"text-bambu-gray"}`}),i.jsx("span",{className:"flex-1 text-white truncate",children:J.name}),!J.is_directory&&i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("span",{className:"text-sm text-bambu-gray",children:no(J.size)}),(J.name.toLowerCase().endsWith(".3mf")||J.name.toLowerCase().endsWith(".gcode")||J.name.toLowerCase().endsWith(".stl"))&&i.jsx("button",{onClick:ge=>{ge.stopPropagation(),k({path:J.path,name:J.name})},className:"p-1 rounded hover:bg-bambu-dark text-bambu-gray hover:text-bambu-green",title:"3D View",children:i.jsx(ra,{className:"w-4 h-4"})})]}),J.is_directory&&i.jsx(ec,{className:"w-4 h-4 text-bambu-gray rotate-180"})]},J.path)})}):i.jsx("div",{className:"text-center py-12 text-bambu-gray",children:"No files in this directory"})}),i.jsxs("div",{className:"flex items-center justify-between p-4 border-t border-bambu-dark-tertiary bg-bambu-dark/50 flex-shrink-0",children:[i.jsxs("div",{className:"flex items-center gap-4",children:[i.jsx("div",{className:"text-sm text-bambu-gray",children:c.size>0?`${c.size} selected`:u?`${P?.files?.filter(J=>J.name.toLowerCase().includes(u.toLowerCase())).length||0} of ${P?.files?.length||0} items`:`${P?.files?.length||0} items`}),P?.files?.some(J=>!J.is_directory)&&i.jsx("div",{className:"flex items-center gap-2",children:c.size>0?i.jsxs("button",{onClick:G,className:"flex items-center gap-1 text-xs text-bambu-gray hover:text-white transition-colors",children:[i.jsx(cge,{className:"w-4 h-4"}),"Deselect All"]}):i.jsxs("button",{onClick:U,className:"flex items-center gap-1 text-xs text-bambu-gray hover:text-white transition-colors",children:[i.jsx(mo,{className:"w-4 h-4"}),"Select All"]})})]}),i.jsxs("div",{className:"flex gap-2",children:[i.jsx(Fe,{variant:"secondary",disabled:c.size===0||b!==null,onClick:L,children:b?i.jsxs(i.Fragment,{children:[i.jsx(ct,{className:"w-4 h-4 animate-spin"}),b.current,"/",b.total]}):i.jsxs(i.Fragment,{children:[i.jsx(pi,{className:"w-4 h-4"}),"Download",c.size>1?` (${c.size})`:""]})}),i.jsxs(Fe,{variant:"secondary",disabled:c.size===0||R.isPending,onClick:te,className:"text-red-400 hover:text-red-300",children:[R.isPending?i.jsx(ct,{className:"w-4 h-4 animate-spin"}):i.jsx(Qt,{className:"w-4 h-4"}),r("printerFiles.deleteButton"),c.size>1?` (${c.size})`:""]})]})]})]}),p.length>0&&i.jsx(Nn,{title:p.length>1?r("printerFiles.deleteFiles",{count:p.length}):r("fileManager.deleteFile"),message:p.length>1?r("printerFiles.deleteFilesConfirm",{count:p.length}):r("printerFiles.deleteFileConfirm",{name:p[0].split("/").pop()}),confirmText:r("common.delete"),variant:"danger",onConfirm:()=>{R.mutate(p)},onCancel:()=>f([])}),_&&i.jsx(gAe,{printerId:t,filePath:_.path,filename:_.name,onClose:()=>k(null)})]})}function AL({on:t,className:e="w-5 h-5"}){const n=t?"#facc15":"none",r=t?"#78350f":"currentColor",a=t?1:0;return i.jsxs("svg",{viewBox:"0 0 32 32",fill:"none",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:e,children:[i.jsxs("g",{stroke:r,opacity:a,children:[i.jsx("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),i.jsx("line",{x1:"6.1",y1:"6.1",x2:"8.9",y2:"8.9"}),i.jsx("line",{x1:"25.9",y1:"6.1",x2:"23.1",y2:"8.9"}),i.jsx("line",{x1:"2",y1:"16",x2:"6",y2:"16"}),i.jsx("line",{x1:"30",y1:"16",x2:"26",y2:"16"})]}),i.jsx("path",{d:"M12 24v-2.3c0-.9-.4-1.7-1-2.3C9.2 17.6 8 15.4 8 13c0-4.4 3.6-8 8-8s8 3.6 8 8c0 2.4-1.2 4.6-3 6.4-.6.6-1 1.4-1 2.3V24",fill:n,stroke:r}),i.jsx("path",{d:"M12 24h8",stroke:r}),i.jsx("path",{d:"M12 27h8",stroke:r}),i.jsx("path",{d:"M13 30h6",stroke:r})]})}const MC=({className:t})=>i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[i.jsx("rect",{x:"2",y:"15",width:"5",height:"5",rx:"0.5"}),i.jsx("rect",{x:"9.5",y:"15",width:"5",height:"5",rx:"0.5",fill:"currentColor",opacity:"0.3"}),i.jsx("rect",{x:"17",y:"15",width:"5",height:"5",rx:"0.5"}),i.jsx("path",{d:"M4 12 C4 6, 14 6, 14 12"}),i.jsx("polyline",{points:"12,10 14,12 12,14"})]});function ML({printerId:t,isOpen:e,onClose:n}){const{t:r}=Mt(),{showToast:a}=bn(),{hasPermission:s}=Rr(),[o,l]=w.useState(null),[c,d]=w.useState(!1),{data:u}=Je({queryKey:["printerStatus",t],queryFn:()=>be.getPrinterStatus(t),refetchInterval:3e4,enabled:e}),{data:m,refetch:p}=Je({queryKey:["printableObjects",t],queryFn:()=>be.getPrintableObjects(t),enabled:e,refetchInterval:e?5e3:!1}),f=ut({mutationFn:y=>be.skipObjects(t,y),onSuccess:y=>{a(y.message||r("printers.skipObjects.objectsSkipped")),l(null),p()},onError:y=>a(y.message||r("printers.toast.failedToSkipObjects"),"error")});return e?i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",onClick:n,onKeyDown:y=>{y.key==="Escape"&&(c?d(!1):n())},tabIndex:-1,ref:y=>y?.focus(),children:[i.jsx("div",{className:"absolute inset-0 bg-black/50 z-0"}),i.jsxs("div",{className:"relative z-10 bg-white dark:bg-bambu-dark border border-gray-200 dark:border-bambu-dark-tertiary rounded-xl shadow-2xl w-[560px] max-h-[85vh] flex flex-col overflow-hidden",onClick:y=>y.stopPropagation(),children:[i.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-gray-200 dark:border-bambu-dark-tertiary bg-gray-50 dark:bg-bambu-dark",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(MC,{className:"w-4 h-4 text-bambu-green"}),i.jsx("span",{className:"text-sm font-medium text-gray-900 dark:text-white",children:r("printers.skipObjects.title")})]}),i.jsx("button",{onClick:n,className:"p-1 text-gray-500 dark:text-bambu-gray hover:text-gray-900 dark:hover:text-white rounded transition-colors",children:i.jsx(zt,{className:"w-4 h-4"})})]}),m?m.objects.length===0?i.jsxs("div",{className:"text-center py-8 px-4 text-bambu-gray",children:[i.jsx("p",{className:"text-sm",children:r("printers.noObjectsFound")}),i.jsx("p",{className:"text-xs mt-1 opacity-70",children:r("printers.objectsLoadedOnPrintStart")})]}):i.jsxs("div",{className:"flex flex-col overflow-hidden",children:[i.jsxs("div",{className:"flex items-center gap-3 px-4 py-2.5 bg-blue-50 dark:bg-blue-500/10 border-b border-gray-200 dark:border-bambu-dark-tertiary",children:[i.jsx("div",{className:"flex-shrink-0 w-8 h-8 rounded-lg bg-blue-100 dark:bg-blue-500/20 flex items-center justify-center",children:i.jsx(ffe,{className:"w-4 h-4 text-blue-500 dark:text-blue-400"})}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsx("p",{className:"text-xs text-blue-600 dark:text-blue-300",children:r("printers.skipObjects.matchIdsInfo")}),i.jsx("p",{className:"text-[10px] text-blue-500/70 dark:text-blue-300/60",children:r("printers.skipObjects.printerShowsIds")})]}),i.jsxs("div",{className:"flex-shrink-0 text-xs text-gray-500 dark:text-bambu-gray",children:[m.skipped_count,"/",m.total," ",r("printers.skipObjects.skipped")]})]}),(u?.layer_num??0)<=1&&i.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 bg-amber-50 dark:bg-amber-500/10 border-b border-gray-200 dark:border-bambu-dark-tertiary",children:[i.jsx(Ii,{className:"w-4 h-4 text-amber-500 dark:text-amber-400 flex-shrink-0"}),i.jsx("p",{className:"text-xs text-amber-600 dark:text-amber-400",children:r("printers.skipObjects.waitForLayer",{layer:u?.layer_num??0})})]}),i.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[i.jsx("div",{className:"w-52 flex-shrink-0 p-4 border-r border-gray-200 dark:border-bambu-dark-tertiary bg-gray-50 dark:bg-bambu-dark-secondary overflow-y-auto",children:i.jsxs("div",{className:"relative cursor-pointer group",onClick:()=>d(!0),children:[u?.cover_url?i.jsx("img",{src:`${u.cover_url}?view=top`,alt:r("printers.printPreview"),className:"w-full aspect-square object-contain rounded-lg bg-gray-900 dark:bg-gray-900 border border-gray-300 dark:border-gray-600"}):i.jsx("div",{className:"w-full aspect-square rounded-lg bg-gray-100 dark:bg-bambu-dark flex items-center justify-center",children:i.jsx(ra,{className:"w-8 h-8 text-gray-300 dark:text-bambu-gray/30"})}),i.jsx("div",{className:"absolute top-2 right-2 p-1 bg-black/60 rounded opacity-0 group-hover:opacity-100 transition-opacity",children:i.jsx(hC,{className:"w-3.5 h-3.5 text-white"})}),m.objects.length>0&&i.jsx("div",{className:"absolute inset-0 pointer-events-none",children:m.objects.map((y,x)=>{let b,v;if(y.x!=null&&y.y!=null&&m.bbox_all){const[_,k,P,C]=m.bbox_all,T=P-_,N=C-k,R=8,A=100-R*2;b=R+(y.x-_)/T*A,v=R+(C-y.y)/N*A,b=Math.max(5,Math.min(95,b)),v=Math.max(5,Math.min(95,v))}else if(y.x!=null&&y.y!=null)b=y.x/256*100,v=100-y.y/256*100,b=Math.max(5,Math.min(95,b)),v=Math.max(5,Math.min(95,v));else{const _=Math.ceil(Math.sqrt(m.objects.length)),k=Math.floor(x/_),P=x%_,C=Math.ceil(m.objects.length/_);b=15+P*(70/_)+35/_,v=15+k*(70/C)+35/C}return i.jsx("div",{className:`absolute flex items-center justify-center w-6 h-6 rounded-full text-[10px] font-bold shadow-lg ${y.skipped?"bg-red-500 text-white line-through":"bg-bambu-green text-black"}`,style:{left:`${b}%`,top:`${v}%`,transform:"translate(-50%, -50%)"},title:y.name,children:y.id},y.id)})}),i.jsx("div",{className:"absolute bottom-2 right-2 px-2 py-1 bg-white/90 dark:bg-black/80 rounded text-[10px] text-gray-700 dark:text-white shadow-sm",children:r("printers.skipObjects.activeCount",{count:m.objects.filter(y=>!y.skipped).length})})]})}),i.jsx("div",{className:"flex-1 min-w-0 overflow-y-auto",children:m.objects.map(y=>i.jsxs("div",{className:`
- flex items-center gap-3 px-4 py-3 border-b border-gray-200 dark:border-bambu-dark-tertiary/50 last:border-0
- ${y.skipped?"bg-red-50 dark:bg-red-500/10":"hover:bg-gray-50 dark:hover:bg-bambu-dark/50"}
- `,children:[i.jsxs("div",{className:`
- w-12 h-12 flex-shrink-0 rounded-lg flex flex-col items-center justify-center
- ${y.skipped?"bg-red-100 dark:bg-red-500/20 border border-red-300 dark:border-red-500/40":"bg-green-100 dark:bg-bambu-green/20 border border-green-300 dark:border-bambu-green/40"}
- `,children:[i.jsx("span",{className:`text-lg font-mono font-bold ${y.skipped?"text-red-500 dark:text-red-400":"text-green-600 dark:text-bambu-green"}`,children:y.id}),i.jsx("span",{className:`text-[8px] uppercase tracking-wider ${y.skipped?"text-red-400/60":"text-green-500/60 dark:text-bambu-green/60"}`,children:"ID"})]}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsx("span",{className:`block text-sm truncate ${y.skipped?"text-red-500 dark:text-red-400 line-through":"text-gray-900 dark:text-white"}`,children:y.name}),y.skipped&&i.jsx("span",{className:"text-[10px] text-red-400/60",children:r("printers.willBeSkipped")})]}),y.skipped?i.jsx("span",{className:"px-4 py-2 text-xs text-red-500 dark:text-red-400/70 bg-red-100 dark:bg-red-500/10 rounded-lg",children:r("printers.skipObjects.skipped")}):i.jsx("button",{onClick:()=>l({id:y.id,name:y.name}),disabled:f.isPending||(u?.layer_num??0)<=1||!s("printers:control"),className:`px-4 py-2 text-xs font-medium rounded-lg transition-colors ${(u?.layer_num??0)<=1||!s("printers:control")?"bg-gray-100 dark:bg-bambu-dark text-gray-400 dark:text-bambu-gray/50 cursor-not-allowed":"bg-red-100 dark:bg-red-500/20 text-red-600 dark:text-red-400 hover:bg-red-200 dark:hover:bg-red-500/30 border border-red-300 dark:border-red-500/30"}`,title:s("printers:control")?(u?.layer_num??0)<=1?r("printers.skipObjects.waitForLayer",{layer:u?.layer_num??0}):r("printers.skipObjects.skip"):r("printers.permission.noControl"),children:r("printers.skipObjects.skip")})]},y.id))})]})]}):i.jsx("div",{className:"flex items-center justify-center py-12",children:i.jsx(ct,{className:"w-5 h-5 animate-spin text-bambu-gray"})})]})]}),o&&i.jsx(Nn,{variant:"warning",title:r("printers.skipObjects.confirmTitle"),message:r("printers.skipObjects.confirmMessage",{name:o.name}),confirmText:r("printers.skipObjects.skip"),isLoading:f.isPending,onConfirm:()=>f.mutate([o.id]),onCancel:()=>l(null)}),c&&m&&i.jsxs("div",{className:"fixed inset-0 bg-black/90 flex items-center justify-center z-60",onClick:()=>d(!1),children:[i.jsx("button",{onClick:()=>d(!1),className:"absolute top-4 right-4 p-2 text-white/70 hover:text-white transition-colors",children:i.jsx(zt,{className:"w-6 h-6"})}),i.jsxs("div",{className:"relative max-w-[600px] max-h-[80vh] aspect-square",onClick:y=>y.stopPropagation(),children:[u?.cover_url?i.jsx("img",{src:`${u.cover_url}?view=top`,alt:r("printers.printPreview"),className:"w-full h-full object-contain rounded-lg bg-gray-900"}):i.jsx("div",{className:"w-full h-full rounded-lg bg-gray-800 flex items-center justify-center",children:i.jsx(ra,{className:"w-16 h-16 text-gray-500"})}),m.objects.length>0&&i.jsx("div",{className:"absolute inset-0 pointer-events-none",children:m.objects.map((y,x)=>{let b,v;if(y.x!=null&&y.y!=null&&m.bbox_all){const[_,k,P,C]=m.bbox_all,T=P-_,N=C-k,R=8,A=100-R*2;b=R+(y.x-_)/T*A,v=R+(C-y.y)/N*A,b=Math.max(5,Math.min(95,b)),v=Math.max(5,Math.min(95,v))}else if(y.x!=null&&y.y!=null)b=y.x/256*100,v=100-y.y/256*100,b=Math.max(5,Math.min(95,b)),v=Math.max(5,Math.min(95,v));else{const _=Math.ceil(Math.sqrt(m.objects.length)),k=Math.floor(x/_),P=x%_,C=Math.ceil(m.objects.length/_);b=15+P*(70/_)+35/_,v=15+k*(70/C)+35/C}return i.jsx("div",{className:`absolute flex items-center justify-center w-6 h-6 rounded-full text-[10px] font-bold shadow-lg ${y.skipped?"bg-red-500 text-white line-through":"bg-bambu-green text-black"}`,style:{left:`${b}%`,top:`${v}%`,transform:"translate(-50%, -50%)"},title:y.name,children:y.id},y.id)})}),i.jsx("div",{className:"absolute bottom-2 right-2 px-2 py-1 bg-white/90 dark:bg-black/80 rounded text-[10px] text-gray-700 dark:text-white shadow-sm",children:r("printers.skipObjects.activeCount",{count:m.objects.filter(y=>!y.skipped).length})})]})]})]}):null}const vAe="embeddedCameraState_",m$=5,wAe=2e3,SAe=3e4,_Ae=5e3,N2={x:window.innerWidth-420,y:20,width:400,height:300};function kAe({printerId:t,printerName:e,viewerIndex:n=0,onClose:r}){const{t:a}=Mt(),s=tn(),{showToast:o}=bn(),{hasPermission:l}=Rr(),c=`${vAe}${t}`,d=()=>{try{const ye=localStorage.getItem(c);if(ye){const $e=JSON.parse(ye);return{x:Math.min(Math.max(0,$e.x),window.innerWidth-100),y:Math.min(Math.max(0,$e.y),window.innerHeight-100),width:Math.max(200,Math.min($e.width,window.innerWidth-20)),height:Math.max(150,Math.min($e.height,window.innerHeight-20))}}}catch{}const je=n*30;return{...N2,x:Math.max(0,N2.x-je),y:Math.max(0,N2.y+je)}},[u,m]=w.useState(d),[p,f]=w.useState(!1),[y,x]=w.useState(!1),[b,v]=w.useState({x:0,y:0}),[_,k]=w.useState(!1),[P,C]=w.useState(!1),[T,N]=w.useState(1),[R,A]=w.useState({x:0,y:0}),[D,$]=w.useState(!1),[U,G]=w.useState({x:0,y:0}),[L,te]=w.useState(null),[re,J]=w.useState(null),[ue,me]=w.useState(!1),[ge,X]=w.useState(!0),[ie,le]=w.useState(Date.now()),[pe,Ce]=w.useState(0),[q,Z]=w.useState(!1),[j,E]=w.useState(0),I=w.useRef(null),W=w.useRef(null),B=w.useRef(null),ae=w.useRef(null),z=w.useRef(null),[V,ee]=w.useState(!1),{data:K}=Je({queryKey:["printer",t],queryFn:()=>be.getPrinter(t),enabled:t>0}),{data:ne}=Je({queryKey:["printerStatus",t],queryFn:()=>be.getPrinterStatus(t),refetchInterval:3e4,enabled:t>0}),se=ut({mutationFn:je=>be.setChamberLight(t,je),onMutate:async je=>{await s.cancelQueries({queryKey:["printerStatus",t]});const ye=s.getQueryData(["printerStatus",t]);return s.setQueryData(["printerStatus",t],$e=>({...$e,chamber_light:je})),{previousStatus:ye}},onSuccess:(je,ye)=>{o(`Chamber light ${ye?"on":"off"}`)},onError:(je,ye,$e)=>{$e?.previousStatus&&s.setQueryData(["printerStatus",t],$e.previousStatus),o(je.message||a("printers.toast.failedToControlChamberLight"),"error")}}),ce=(ne?.state==="RUNNING"||ne?.state==="PAUSE")&&(ne?.printable_objects_count??0)>=2;w.useEffect(()=>{const je=setTimeout(()=>{localStorage.setItem(c,JSON.stringify(u))},500);return()=>clearTimeout(je)},[u,c]);const fe=w.useRef(!1);w.useEffect(()=>{fe.current=!1;const je=`/api/v1/printers/${t}/camera/stop`,ye=()=>{if(t>0&&!fe.current){fe.current=!0;const Ye={},lt=uu();lt&&(Ye.Authorization=`Bearer ${lt}`),fetch(je,{method:"POST",keepalive:!0,headers:Ye}).catch(()=>{})}},$e=W.current;return()=>{$e&&($e.src=""),ye(),B.current&&clearTimeout(B.current),ae.current&&clearInterval(ae.current),z.current&&clearInterval(z.current)}},[t]),w.useEffect(()=>{if(ge){const je=setTimeout(()=>X(!1),3e3);return()=>clearTimeout(je)}},[ge,ie]);const oe=w.useCallback(()=>{if(pe>=m$){Z(!1),me(!0);return}const je=Math.min(wAe*Math.pow(2,pe),SAe);Z(!0),E(Math.ceil(je/1e3)),ae.current=setInterval(()=>{E(ye=>ye<=1?(ae.current&&clearInterval(ae.current),0):ye-1)},1e3),B.current=setTimeout(()=>{Ce(ye=>ye+1),Z(!1),X(!0),me(!1),W.current&&(W.current.src=""),le(Date.now())},je)},[pe]);w.useEffect(()=>{if(ge||q||_){z.current&&(clearInterval(z.current),z.current=null);return}return z.current=setInterval(async()=>{try{const je=await be.getCameraStatus(t);(je.stalled||!je.active&&!ue)&&(z.current&&(clearInterval(z.current),z.current=null),X(!1),oe())}catch{}},_Ae),()=>{z.current&&(clearInterval(z.current),z.current=null)}},[ge,ue,q,_,t,oe]),w.useEffect(()=>{const je=()=>{const ye=!!document.fullscreenElement;C(ye),ye||(N(1),A({x:0,y:0}))};return document.addEventListener("fullscreenchange",je),()=>document.removeEventListener("fullscreenchange",je)},[]);const O=()=>{I.current&&(document.fullscreenElement?document.exitFullscreen():I.current.requestFullscreen())},F=()=>{N(je=>Math.min(je+.5,4))},Q=()=>{N(je=>{const ye=Math.max(je-.5,1);return ye===1&&A({x:0,y:0}),ye})},ve=je=>{je.preventDefault(),je.deltaY<0?F():Q()},he=je=>{T>1&&(je.preventDefault(),$(!0),G({x:je.clientX-R.x,y:je.clientY-R.y}))},de=w.useCallback(()=>{if(!I.current||!W.current)return{x:200,y:150};const je=I.current.getBoundingClientRect(),ye=je.width*(T-1)/2,$e=je.height*(T-1)/2;return{x:Math.max(50,ye),y:Math.max(50,$e)}},[T]),Ae=je=>{if(D&&T>1){const ye=je.clientX-U.x,$e=je.clientY-U.y,Ye=de();A({x:Math.max(-Ye.x,Math.min(Ye.x,ye)),y:Math.max(-Ye.y,Math.min(Ye.y,$e))})}},_e=()=>{$(!1)},ze=je=>{if(je.length<2)return 0;const ye=je[0].clientX-je[1].clientX,$e=je[0].clientY-je[1].clientY;return Math.sqrt(ye*ye+$e*$e)},Be=je=>je.length<2?{x:je[0].clientX,y:je[0].clientY}:{x:(je[0].clientX+je[1].clientX)/2,y:(je[0].clientY+je[1].clientY)/2},Ue=je=>{je.touches.length===2?(je.preventDefault(),te(ze(je.touches)),J(Be(je.touches))):je.touches.length===1&&T>1&&(je.preventDefault(),$(!0),G({x:je.touches[0].clientX-R.x,y:je.touches[0].clientY-R.y}))},Ne=je=>{if(je.touches.length===2&&L!==null){je.preventDefault();const ye=ze(je.touches),$e=ye/L;N(lt=>{const St=Math.max(1,Math.min(4,lt*$e));return St===1&&A({x:0,y:0}),St}),te(ye);const Ye=Be(je.touches);if(re){const lt=de();A(St=>({x:Math.max(-lt.x,Math.min(lt.x,St.x+(Ye.x-re.x))),y:Math.max(-lt.y,Math.min(lt.y,St.y+(Ye.y-re.y)))}))}J(Ye)}else if(je.touches.length===1&&D&&T>1){je.preventDefault();const ye=je.touches[0].clientX-U.x,$e=je.touches[0].clientY-U.y,Ye=de();A({x:Math.max(-Ye.x,Math.min(Ye.x,ye)),y:Math.max(-Ye.y,Math.min(Ye.y,$e))})}},Ee=je=>{je.touches.length<2&&(te(null),J(null)),je.touches.length===0&&$(!1)},ke=()=>{N(1),A({x:0,y:0})},Me=()=>{X(!1),pe<m$?oe():me(!0)},Ge=()=>{X(!1),me(!1),Ce(0),Z(!1),B.current&&clearTimeout(B.current),ae.current&&clearInterval(ae.current)},xe=()=>{X(!0),me(!1),Ce(0),Z(!1),B.current&&clearTimeout(B.current),ae.current&&clearInterval(ae.current);const je={},ye=uu();ye&&(je.Authorization=`Bearer ${ye}`),fetch(`/api/v1/printers/${t}/camera/stop`,{method:"POST",headers:je}).catch(()=>{}),W.current&&(W.current.src=""),setTimeout(()=>le(Date.now()),100)},He=je=>{je.target.closest(".no-drag")||(f(!0),v({x:je.clientX-u.x,y:je.clientY-u.y}))},Pe=je=>{je.stopPropagation(),x(!0)};w.useEffect(()=>{const je=$e=>{if(p)m(Ye=>({...Ye,x:Math.max(0,Math.min($e.clientX-b.x,window.innerWidth-Ye.width)),y:Math.max(0,Math.min($e.clientY-b.y,window.innerHeight-Ye.height))}));else if(y&&I.current){const Ye=I.current.getBoundingClientRect();m(lt=>({...lt,width:Math.max(200,Math.min($e.clientX-Ye.left,window.innerWidth-lt.x-10)),height:Math.max(150,Math.min($e.clientY-Ye.top,window.innerHeight-lt.y-10))}))}},ye=()=>{f(!1),x(!1)};if(p||y)return document.addEventListener("mousemove",je),document.addEventListener("mouseup",ye),()=>{document.removeEventListener("mousemove",je),document.removeEventListener("mouseup",ye)}},[p,y,b]);const Ve=`/api/v1/printers/${t}/camera/stream?fps=15&t=${ie}`;return i.jsxs("div",{ref:I,className:`${P?"fixed inset-0 z-[100]":"fixed z-50 rounded-lg shadow-2xl border border-bambu-dark-tertiary"} bg-bambu-dark-secondary overflow-hidden`,style:P?void 0:{left:u.x,top:u.y,width:_?200:u.width,height:_?40:u.height,cursor:p?"grabbing":"default"},children:[i.jsxs("div",{className:"flex items-center justify-between px-3 py-2 bg-bambu-dark border-b border-bambu-dark-tertiary cursor-grab active:cursor-grabbing",onMouseDown:He,children:[i.jsxs("div",{className:"flex items-center gap-2 text-sm text-white truncate",children:[i.jsx(qm,{className:"w-4 h-4 text-bambu-gray flex-shrink-0"}),i.jsx("span",{className:"truncate",children:K?.name||e})]}),i.jsxs("div",{className:"flex items-center gap-1 no-drag",children:[i.jsx("button",{onClick:()=>se.mutate(!ne?.chamber_light),disabled:!ne?.connected||se.isPending||!l("printers:control"),className:`p-1 rounded disabled:opacity-50 ${ne?.chamber_light?"bg-yellow-500/20 hover:bg-yellow-500/30":"hover:bg-bambu-dark-tertiary"}`,title:l("printers:control")?a("camera.chamberLight"):a("printers.permission.noControl"),children:i.jsx(AL,{on:ne?.chamber_light??!1,className:"w-3.5 h-3.5"})}),i.jsx("button",{onClick:()=>ee(!0),disabled:!ce||!l("printers:control"),className:`p-1 rounded disabled:opacity-50 ${ce&&l("printers:control")?"hover:bg-bambu-dark-tertiary":""}`,title:l("printers:control")?a(ce?"printers.skipObjects.tooltip":"printers.skipObjects.onlyWhilePrinting"):a("printers.permission.noControl"),children:i.jsx(MC,{className:"w-3.5 h-3.5 text-bambu-gray"})}),i.jsx("button",{onClick:xe,disabled:ge||q,className:"p-1 hover:bg-bambu-dark-tertiary rounded disabled:opacity-50",title:"Refresh stream",children:i.jsx(_r,{className:`w-3.5 h-3.5 text-bambu-gray ${ge?"animate-spin":""}`})}),i.jsx("button",{onClick:O,className:"p-1 hover:bg-bambu-dark-tertiary rounded",title:P?"Exit fullscreen":"Fullscreen",children:P?i.jsx(YY,{className:"w-3.5 h-3.5 text-bambu-gray"}):i.jsx(ppe,{className:"w-3.5 h-3.5 text-bambu-gray"})}),i.jsx("button",{onClick:()=>k(!_),className:"p-1 hover:bg-bambu-dark-tertiary rounded",title:_?"Expand":"Minimize",children:_?i.jsx(hC,{className:"w-3.5 h-3.5 text-bambu-gray"}):i.jsx(WF,{className:"w-3.5 h-3.5 text-bambu-gray"})}),i.jsx("button",{onClick:r,className:"p-1 hover:bg-red-500/20 rounded",title:"Close",children:i.jsx(zt,{className:"w-3.5 h-3.5 text-bambu-gray hover:text-red-400"})})]})]}),!_&&i.jsxs("div",{className:"relative w-full bg-black flex items-center justify-center overflow-hidden h-[calc(100%-40px)]",onWheel:ve,onMouseMove:Ae,onMouseUp:_e,onMouseLeave:_e,onTouchStart:Ue,onTouchMove:Ne,onTouchEnd:Ee,style:{touchAction:"none"},children:[ge&&!q&&i.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/50 z-10",children:i.jsx(_r,{className:"w-6 h-6 text-bambu-gray animate-spin"})}),q&&i.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/80 z-10",children:i.jsxs("div",{className:"text-center p-2",children:[i.jsx(rh,{className:"w-6 h-6 text-orange-400 mx-auto mb-2"}),i.jsxs("p",{className:"text-xs text-bambu-gray",children:["Reconnecting in ",j,"s..."]})]})}),ue&&!q&&i.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black z-10",children:i.jsxs("div",{className:"text-center p-2",children:[i.jsx(En,{className:"w-6 h-6 text-orange-400 mx-auto mb-2"}),i.jsx("p",{className:"text-xs text-bambu-gray mb-2",children:"Camera unavailable"}),i.jsx("button",{onClick:xe,className:"px-2 py-1 text-xs bg-bambu-green text-white rounded hover:bg-bambu-green/80",children:"Retry"})]})}),i.jsx("img",{ref:W,src:Ve,alt:"Camera stream",className:"max-w-full max-h-full object-contain select-none",style:{transform:`scale(${T}) translate(${R.x/T}px, ${R.y/T}px)`,cursor:T>1?D?"grabbing":"grab":"default"},onError:Me,onLoad:Ge,onMouseDown:he,draggable:!1},ie),i.jsxs("div",{className:"absolute bottom-2 left-2 flex items-center gap-1 bg-black/60 rounded px-1.5 py-1 no-drag",children:[i.jsx("button",{onClick:Q,disabled:T<=1,className:"p-1 hover:bg-white/10 rounded disabled:opacity-30",title:"Zoom out",children:i.jsx(JF,{className:"w-3.5 h-3.5 text-white"})}),i.jsxs("button",{onClick:ke,className:"px-1.5 py-0.5 text-xs text-white hover:bg-white/10 rounded min-w-[32px]",title:"Reset zoom",children:[Math.round(T*100),"%"]}),i.jsx("button",{onClick:F,disabled:T>=4,className:"p-1 hover:bg-white/10 rounded disabled:opacity-30",title:"Zoom in",children:i.jsx(ZF,{className:"w-3.5 h-3.5 text-white"})})]}),!P&&i.jsx("div",{className:"absolute bottom-0 right-0 w-6 h-6 cursor-se-resize no-drag hover:bg-white/10 rounded-tl transition-colors",onMouseDown:Pe,title:"Drag to resize",children:i.jsx("svg",{className:"w-6 h-6 text-bambu-gray/70 hover:text-bambu-gray",viewBox:"0 0 24 24",fill:"currentColor",children:i.jsx("path",{d:"M22 22H20V20H22V22ZM22 18H20V16H22V18ZM18 22H16V20H18V22ZM22 14H20V12H22V14ZM18 18H16V16H18V18ZM14 22H12V20H14V22ZM22 10H20V8H22V10ZM18 14H16V12H18V14ZM14 18H12V16H14V18ZM10 22H8V20H10V22Z"})})})]}),i.jsx(ML,{printerId:t,isOpen:V,onClose:()=>ee(!1)})]})}function NAe({printerId:t,printerName:e,onClose:n}){const{t:r}=Mt(),a=tn(),[s,o]=w.useState(!0),[l,c]=w.useState(new Set),[d,u]=w.useState(""),[m,p]=w.useState("all"),f=w.useRef(null),{data:y,isLoading:x,refetch:b}=Je({queryKey:["mqtt-logs",t],queryFn:()=>be.getMQTTLogs(t),refetchInterval:1e3}),v=ut({mutationFn:()=>be.enableMQTTLogging(t),onSuccess:()=>{a.invalidateQueries({queryKey:["mqtt-logs",t]})}}),_=ut({mutationFn:()=>be.disableMQTTLogging(t),onSuccess:()=>{a.invalidateQueries({queryKey:["mqtt-logs",t]})}}),k=ut({mutationFn:()=>be.clearMQTTLogs(t),onSuccess:()=>{a.invalidateQueries({queryKey:["mqtt-logs",t]})}});w.useEffect(()=>{const D=$=>{$.key==="Escape"&&n()};return window.addEventListener("keydown",D),()=>window.removeEventListener("keydown",D)},[n]),w.useEffect(()=>{s&&f.current&&(f.current.scrollTop=f.current.scrollHeight)},[y?.logs,s]);const P=D=>{c($=>{const U=new Set($);return U.has(D)?U.delete(D):U.add(D),U})},C=D=>new Date(D).toLocaleTimeString("en-US",{hour12:!1,fractionalSecondDigits:3}),T=(D,$)=>{if(D==null)return"<empty>";const U=typeof D=="string"?JSON.parse(D):D,G=JSON.stringify(U,null,$?2:0);return!$&&G.length>100?G.substring(0,100)+"...":G},N=y?.logging_enabled??!1,R=w.useMemo(()=>y?.logs??[],[y?.logs]),A=w.useMemo(()=>R.filter(D=>{if(m!=="all"&&D.direction!==m)return!1;if(d.trim()){const $=d.toLowerCase(),U=D.topic.toLowerCase().includes($),L=JSON.stringify(D.payload).toLowerCase().includes($);return U||L}return!0}),[R,d,m]);return i.jsx("div",{className:"fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-4",children:i.jsxs("div",{className:"bg-bambu-dark-secondary rounded-lg max-w-4xl w-full max-h-[85vh] flex flex-col",children:[i.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-bambu-dark-tertiary",children:[i.jsxs("div",{children:[i.jsx("h2",{className:"text-lg font-semibold text-white",children:r("mqttDebug.title")}),i.jsx("p",{className:"text-sm text-bambu-gray",children:e})]}),i.jsx("button",{onClick:n,className:"text-bambu-gray hover:text-white transition-colors",children:i.jsx(zt,{className:"w-5 h-5"})})]}),i.jsxs("div",{className:"flex flex-col gap-2 p-4 border-b border-bambu-dark-tertiary",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[N?i.jsxs(Fe,{size:"sm",variant:"secondary",onClick:()=>_.mutate(),disabled:_.isPending,children:[i.jsx(Sl,{className:"w-4 h-4"}),r("mqttDebug.stopLogging")]}):i.jsxs(Fe,{size:"sm",onClick:()=>v.mutate(),disabled:v.isPending,children:[i.jsx(co,{className:"w-4 h-4"}),r("mqttDebug.startLogging")]}),i.jsxs(Fe,{size:"sm",variant:"secondary",onClick:()=>k.mutate(),disabled:k.isPending||R.length===0,children:[i.jsx(Qt,{className:"w-4 h-4"}),r("mqttDebug.clearLog")]}),i.jsx(Fe,{size:"sm",variant:"secondary",onClick:()=>b(),disabled:x,children:i.jsx(_r,{className:`w-4 h-4 ${x?"animate-spin":""}`})}),i.jsx("div",{className:"flex-1"}),i.jsxs("label",{className:"flex items-center gap-2 text-sm text-bambu-gray cursor-pointer",children:[i.jsx("input",{type:"checkbox",checked:s,onChange:D=>o(D.target.checked),className:"rounded border-bambu-dark-tertiary"}),"Auto-scroll"]}),i.jsxs("span",{className:"text-sm text-bambu-gray",children:[A.length,"/",R.length]})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs("div",{className:"relative flex-1",children:[i.jsx(Dr,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray"}),i.jsx("input",{type:"text",placeholder:r("mqttDebug.searchPlaceholder"),value:d,onChange:D=>u(D.target.value),className:"w-full pl-8 pr-3 py-1.5 text-sm bg-bambu-dark border border-bambu-dark-tertiary rounded text-white placeholder-bambu-gray focus:border-bambu-green focus:outline-none"}),d&&i.jsx("button",{onClick:()=>u(""),className:"absolute right-2 top-1/2 -translate-y-1/2 text-bambu-gray hover:text-white",children:i.jsx(zt,{className:"w-4 h-4"})})]}),i.jsxs("div",{className:"flex items-center gap-1 bg-bambu-dark rounded border border-bambu-dark-tertiary",children:[i.jsx("button",{onClick:()=>p("all"),className:`px-2 py-1.5 text-xs rounded-l transition-colors ${m==="all"?"bg-bambu-green text-white":"text-bambu-gray hover:text-white"}`,children:r("mqttDebug.all")}),i.jsxs("button",{onClick:()=>p("in"),className:`px-2 py-1.5 text-xs transition-colors flex items-center gap-1 ${m==="in"?"bg-blue-500 text-white":"text-bambu-gray hover:text-white"}`,children:[i.jsx(Pb,{className:"w-3 h-3"}),r("mqttDebug.incoming")]}),i.jsxs("button",{onClick:()=>p("out"),className:`px-2 py-1.5 text-xs rounded-r transition-colors flex items-center gap-1 ${m==="out"?"bg-green-500 text-white":"text-bambu-gray hover:text-white"}`,children:[i.jsx(Hp,{className:"w-3 h-3"}),r("mqttDebug.outgoing")]})]})]})]}),i.jsx("div",{ref:f,className:"flex-1 overflow-auto p-4 font-mono text-xs bg-black min-h-[400px]",children:R.length===0?i.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-bambu-gray",children:[i.jsx("p",{className:"mb-2",children:r("mqttDebug.noMessages")}),!N&&i.jsx("p",{className:"text-sm",children:r("mqttDebug.startLoggingHint")})]}):A.length===0?i.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-bambu-gray",children:[i.jsx("p",{className:"mb-2",children:r("mqttDebug.noMessagesMatch")}),i.jsx("p",{className:"text-sm",children:r("mqttDebug.adjustFilterHint")})]}):i.jsx("div",{className:"space-y-1",children:A.map((D,$)=>{const U=l.has($),G=D.direction==="in";return i.jsxs("div",{className:`p-2 rounded cursor-pointer hover:bg-bambu-dark-secondary transition-colors ${U?"bg-bambu-dark-secondary":""}`,onClick:()=>P($),children:[i.jsxs("div",{className:"flex items-start gap-2",children:[i.jsx("span",{className:"text-bambu-gray shrink-0",children:C(D.timestamp)}),i.jsx("span",{className:`shrink-0 ${G?"text-blue-400":"text-green-400"}`,title:r(G?"mqttDebug.incoming":"mqttDebug.outgoing"),children:G?i.jsx(Pb,{className:"w-3 h-3"}):i.jsx(Hp,{className:"w-3 h-3"})}),i.jsx("span",{className:"text-purple-400 shrink-0",children:D.topic})]}),U?i.jsx("pre",{className:"mt-2 p-3 bg-gray-900 border border-gray-700 rounded text-green-400 overflow-x-auto whitespace-pre-wrap break-all max-h-96 overflow-y-auto text-xs",children:T(D.payload,!0)}):i.jsx("pre",{className:"mt-1 text-white/80 truncate",children:T(D.payload,!1)})]},$)})})}),i.jsxs("div",{className:"flex items-center justify-between p-4 border-t border-bambu-dark-tertiary",children:[i.jsx("div",{className:"text-sm text-bambu-gray",children:N?i.jsxs("span",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"w-2 h-2 bg-green-500 rounded-full animate-pulse"}),r("mqttDebug.loggingActive")]}):i.jsx("span",{children:r("mqttDebug.loggingStopped")})}),i.jsx(Fe,{variant:"secondary",onClick:n,children:r("common.close")})]})]})})}const L3={"0300_4000":"Z axis homing failed; the task has been stopped.","0300_4001":"The printer timed out waiting for the nozzle to cool down before homing.","0300_4002":"Auto Bed Leveling failed; the task has been stopped.","0300_4005":"The hotend cooling fan speed is abnormal.","0300_4006":"The nozzle is clogged.","0300_4008":"The AMS failed to change filament.","0300_4009":"Homing XY axis failed.","0300_400A":"Mechanical resonance frequency identification failed.","0300_400B":"Internal communication exception","0300_400C":"The task was canceled.","0300_400D":"Resume failed after power loss.","0300_400E":"The motor self-check failed.","0300_400F":"The power supply voltage does not match the printer.","0300_4010":"Nozzle offset calibration failed.","0300_4011":"Flow Dynamics Calibration failed; please reinitiate printing or calibration.","0300_4013":"Printing cannot be initiated while AMS is drying.","0300_4014":"Homing Z axis failed: temperature control abnormality.","0300_4015":"Nozzle clumping detection calibration failed. Please go to 'Assistant' for troubleshooting.","0300_4016":"Nozzle cleaning failed. Please click the Assistant for troubleshooting.","0300_401F":"The hotend is not installed, and the toolhead cannot perform homing. Please install the hotend and then continue.","0300_4020":"The nozzle presence detection failed. Please check the Assistant for details.","0300_4021":"Nozzle offset calibration sensor signal abnormality detected. Please check the sensor and retry.","0300_4042":"The Laser Safety Window is not properly installed. The task has been stopped.","0300_4044":"The Flame Sensor is abnormal. The sensor may be short-circuited. Please troubleshoot the issue before starting a print job.","0300_404B":"Task aborted because the front door or top cover is open.","0300_404D":"The current temperature of the hotend, heatbed, or chamber is too high. Please wait for it to cool down to room temperature before restarting the task.","0300_4050":"Liveview Camera calibration timeout; please restart the printer.","0300_4052":"Blade Z-axis homing failed","0300_4057":"Z-axis step loss detected. The task has stopped. Please check if there are any obstructions beneath the heatbed.","0300_4066":"Calibration of motion precision failed.","0300_4067":"Calibration result is over the threshold.","0300_4068":"Step loss occurred during the motion accuracy enhancement process. Please try again.","0300_8000":"Printing was paused for unknown reason. You can select 'Resume' to resume the print job.","0300_8001":"Printing was paused by the user. You can select 'Resume' to continue printing.","0300_8002":"First layer defects were detected by the Micro Lidar. Please check the quality of the printed model before continuing your print.","0300_8003":"Spaghetti defects were detected by the AI Print Monitoring. Please check the quality of the printed model before continuing your print.","0300_8004":"Filament ran out. Please load new filament.","0300_8005":"Toolhead front cover fell off. Please remount the front cover and check to make sure your print is going okay.","0300_8006":"The build plate marker was not detected. Please confirm the build plate is correctly positioned on the heatbed with all four corners aligned, and the marker is visible.","0300_8007":"There was an unfinished print job when the printer lost power. If the model is still adhered to the build plate, you can try resuming the print job.","0300_8008":"Nozzle temperature malfunction","0300_8009":"Heatbed temperature malfunction","0300_800A":"A Filament pile-up was detected by AI Print Monitoring. Please clean filament from the waste chute.","0300_800B":"The cutter is stuck. Please make sure the cutter handle is out and check the filament sensor cable connection.","0300_800C":"Skipped step detected: auto-recover complete; please resume print and check if there are any layer shift problems.","0300_800D":"Detected that the extruder is not extruding normally. If the defects are acceptable, select 'Resume' to resume the print job.","0300_800E":"The print file is not available. Please check to see if the storage media has been removed.","0300_800F":"The door seems to be open, so printing was paused.","0300_8010":"The hotend cooling fan speed is abnormal.","0300_8011":"Detected build plate is not the same as the Gcode file. Please adjust slicer settings or use the correct plate.","0300_8013":"Printing paused due to the pause command added to the printing file.","0300_8014":"The nozzle is covered with filament, or the build plate is installed incorrectly. Please cancel this print and clean the nozzle or adjust the build plate according to the actual status. You can als...","0300_8015":"The filament on external spool has run out; please load new filament. If the filament is loaded, please select 'Resume'.","0300_8016":"The nozzle is clogged with filament. Please cancel this print and clean the nozzle or select 'Resume' to resume the print job.","0300_8017":"Foreign objects detected on heatbed. Please check and clean the heatbed. Then, select 'Resume' to resume the print job.","0300_8018":"Chamber temperature malfunction.","0300_8019":"No build plate is placed.","0300_801A":"Filament extrusion error; please check the assistant for troubleshooting. After resolving the issue, decide whether to cancel or resume the print job based on the actual print status.","0300_801B":"Nozzle temperature problem detected. Refer to Assistant to re-connect the hotend connector. POWER OFF the printer before this operation to avoid short circuits.","0300_801C":"The extrusion resistance is abnormal. The extruder may be clogged; please refer to the assistant. After trouble shooting, you can select 'Resume' to resume the print job.","0300_801D":"The extruder servo motor position sensor is malfunctioning. Please power off the printer first and check if the connection cable is loose.","0300_801E":"The extrusion motor is overloaded, please check the Assistant for details.","0300_8021":"The nozzle may not be installed or not properly installed. Please ensure the nozzle is correctly installed before proceeding.","0300_8022":"The heatbed may be obstructed while moving downward. Please clear any objects beneath the heatbed and check for any resistance or jamming during its movement.","0300_8028":"Nozzle offset calibration sensor error. If using a single hotend or the calibration function is disabled, you may ignore this and continue printing; otherwise, it is recommended to check the sensor...","0300_8041":"Platform detection timeout: please restart the printer.","0300_8042":"Task paused because the door is open.","0300_8043":"The laser module is abnormal.","0300_8044":"Fire was detected inside the chamber.","0300_8045":"Material detection timeout: please restart the printer.","0300_8046":"Foreign object detect timeout: please restart the printer.","0300_8047":"Quick-release lever detection time out: please restart the printer.","0300_8048":"Laser Module unlock has timed out, and the task cannot proceed. Please restart the printer and try again.","0300_8049":"The current plate is invalid.","0300_804A":"Emergency stop button improperly installed. Please reinstall according to the Wiki before proceeding.","0300_804B":"Task paused. The Laser Safety Window is open.","0300_804E":"This is a printing task. Please detach the Laser/Cutting Module from the Toolhead.","0300_804F":"The loading/unloading process is currently ongoing. Please stop the process or remove the laser/cutting module.","0300_8050":"This device does not support the 40W Laser Module. Please remove it or replace it with a 10W Laser Module.","0300_8051":"The cutting module has dropped or the cutting module cable is disconnected; please check the module.","0300_8053":"Laser module detected. Please install the right nozzle correctly to ensure proper Laser Module Mounting Calibration.","0300_8054":"Please place the paper required for Print Then Cut.","0300_8055":"The module mounted on the toolhead does not match the task. Please install the correct module.","0300_8057":"The rotary attachment is disconnected. Please ensure it is properly installed and the cable is securely plugged in.","0300_8058":"The rotary attachment is detected. Please remove it before continuing.","0300_8061":"The mode of Airflow System failed to activate; check the air door condition.","0300_8062":"The chamber temperature is too high. It may be due to high environmental temperature.","0300_8063":"The chamber temperature is too high. Please open the top cover and front door to cool down.","0300_8064":"The chamber temperature is too high. Please open the top cover and front door to cool down. (Open door detection for this print job will be set to 'Notification' level)","0300_8065":"The temperature of the MC module is too high. Please check the Wiki for possible explanations.","0300_8071":"The Toolhead Enhanced Cooling Fan module is malfunctioning.","0300_807D":"Fire Extinguisher not detected, the automatic extinguishing function will be unavailable.","0300_807E":"Fire Extinguisher not detected, the automatic extinguishing function will be unavailable.","0300_807F":"Fire Extinguisher is malfunctioning.","0300_8080":"Fire extinguisher motor reset failed.","0300_8081":"Fire extinguisher cylinder not installed. Please confirm on the extinguisher page.","0300_8082":"The Fire Extinguisher Gas Cylinder is empty.","0300_C012":"Please heat the nozzle to above 170°C.","0300_C056":"A minor fire was detected inside the chamber, and the Auto Fire Extinguishing process has been aborted.","0300_C070":"The fire extinguisher has been detected and is ready for use after the laser module is connected.","0500_4001":"Failed to connect to Bambu Cloud. Please check your network connection.","0500_4002":"Unsupported print file path or name. Please resend the print job.","0500_4003":"Printing stopped because the printer was unable to parse the file. Please resend your print job.","0500_4004":"Device is busy and cannot start new task. Please wait for current task to complete before sending new task.","0500_4005":"Print jobs are not allowed to be sent while updating firmware.","0500_4006":"There is not enough free storage space for the print job. Restoring to factory settings can free up available space.","0500_4007":"The device requires a repair upgrade, and printing is currently unavailable.","0500_4008":"Starting printing failed; please power cycle the printer and resend the print job.","0500_4009":"Print jobs are not allowed to be sent while updating logs.","0500_400A":"The file name is not supported. Please rename and restart the print job.","0500_400B":"There was a problem downloading a file. Please check your network connection and resend the print job.","0500_400C":"Please insert a MicroSD card and restart the print job.","0500_400D":"Please run a self-test and restart the print job.","0500_400E":"Printing was cancelled.","0500_400F":"AMS is initializing and cannot be upgraded at the moment. Please try again later.","0500_4010":"AMS is drying and cannot be upgraded at the moment. Please try again later.","0500_4011":"The printer is loading or unloading filament and cannot be upgraded at the moment. Please try again later.","0500_4012":"The device is printing and cannot be upgraded at the moment. Please try again later.","0500_4013":"AMS is in operation and cannot be upgraded at the moment. Please try again when it is idle.","0500_4014":"Slicing for the print job failed. Please check your settings and restart the print job.","0500_4015":"There is not enough free storage space for the print job. Please format or clear files from the MicroSD card to free up space.","0500_4016":"The MicroSD Card is write-protected. Please replace the MicroSD Card.","0500_4017":"Binding failed. Please retry or restart the printer and retry.","0500_4018":"Binding configuration information parsing failed; please try again.","0500_4019":"The printer has already been bound. Please unbind it and try again.","0500_401A":"Cloud access failed. Possible reasons include network instability caused by interference, inability to access the internet, or router firewall configuration restrictions. You can try moving the pri...","0500_401B":"Cloud response is invalid. If you have tried multiple times and are still failing, please contact customer support.","0500_401C":"Cloud access is rejected. If you have tried multiple times and are still failing, please contact customer support.","0500_401D":"Cloud access failed, which may be caused by network instability due to interference. You can try moving the printer closer to the router before you try again.","0500_401E":"Cloud response is invalid. If you have tried multiple times and are still failing, please contact customer support.","0500_401F":"Authorization timed out. Please make sure that your phone or PC has access to the internet, and ensure that the Bambu Studio/Bambu Handy APP is running in the foreground during the binding operation.","0500_4020":"Cloud access rejected. If you have tried multiple times and are still failing, please contact customer support.","0500_4021":"Cloud access failed, which may be caused by network instability due to interference. You can try moving the printer closer to the router before you try again.","0500_4022":"Cloud response is invalid. If you have tried multiple times and are still failing, please contact customer support.","0500_4023":"Cloud access rejected. If you have tried multiple times and are still failing, please contact customer support.","0500_4024":"Cloud access failed. Possible reasons include network instability caused by interference, inability to access the internet, or router firewall configuration restrictions. You can try moving the pri...","0500_4025":"Cloud response is invalid. If you have tried multiple times and are still failing, please contact customer support.","0500_4026":"Cloud access rejected. If you have tried multiple times and are still failing, please contact customer support.","0500_4027":"Cloud access failed; this may be caused by network instability due to interference. You can try moving the printer closer to the router before you try again.","0500_4028":"Cloud response is invalid. If you have tried multiple times and are still failing, please contact customer support.","0500_4029":"Cloud access is rejected. If you have tried multiple times and are still failing, please contact customer support.","0500_402A":"Failed to connect to the router, which may be caused by wireless interference or being too far away from the router. Please try again or move the printer closer to the router and try again.","0500_402B":"Router connection failed due to incorrect password. Please check the password and try again.","0500_402C":"Failed to obtain IP address, which may be caused by wireless interference resulting in data transmission failure or the DHCP address pool of the router being full. Please move the printer closer to...","0500_402D":"System exception","0500_402E":"System does not support the file system currently used by the USB flash drive. Please replace or format the USB flash drive to FAT32.","0500_402F":"The MicroSD card sector data is damaged. Please use the SD card repair tool to repair or format it. If it still cannot be identified, please replace the MicroSD card.","0500_4030":"The device is currently upgrading. Please try again when it is idle.","0500_4031":"The accessory firmware does not match the printer. Please update it on the 'Firmware' page.","0500_4033":"The AMS firmware does not match the printer. Please update it on the 'Firmware' page.","0500_4034":"The Laser Module firmware does not match the printer. Please update it on the 'Firmware' page.","0500_4035":"The BirdsEye Camera is malfunctioning. Please try restarting the device. If the issue persists after multiple restarts, check the camera connection status or contact customer support.","0500_4037":"Your sliced file is not compatible with current printer model. This file can't be printed on this printer.","0500_4038":"The nozzle diameter in sliced file is not consistent with the current nozzle setting. This file can't be printed.","0500_4039":"The current task does not allow the installation of the laser/cutting module, and the task has been halted.","0500_403A":"The current temperature is too low. In order to protect you and your printer, printing tasks, moving an axis and other operations are disabled. Please move the printer to an environment above 10 de...","0500_403B":"Laser/cutting tasks cannot be initiated on the machine at the moment. Please use the computer software to start the task.","0500_403C":"The current nozzle setting does not match the slicing file. Continuing to print may affect print quality. It is recommended to re-slice before starting the print.","0500_403D":"The toolhead module is not set up. Please set it up before initiating the task.","0500_403E":"The current tool head does not support initialization.","0500_403F":"Failed to download print job; please check your network connection.","0500_4040":"The printer has reached its power limit. Please connect a dedicated power adapter to this AMS to enable drying.","0500_4041":"The AMS drying cannot be started during printing.","0500_4042":"Due to power limitations, starting AMS drying will pause current operations such as nozzle heating and fan running. Do you want to proceed with drying?","0500_4043":"Due to power limitations, only one AMS is allowed to use the device's power for drying.","0500_4044":"BirdsEye Camera malfunction: please contact customer support.","0500_4045":"Hotend check in progress. This operation is temporarily unavailable. Please wait.","0500_4050":"Error detected on the print board.","0500_4052":"Error detected on the hot end.","0500_4054":"Error detected on the mat.","0500_405D":"Laser module Serial Number error: unable to calibrate or make project.","0500_4065":"The task requires a Laser Platform, but the current one is a Cutting Platform. Please replace it, measure the material thickness in the software, and then restart the task.","0500_4070":"The laser or cutter module is connected, so the device cannot initiate a 3D printing task.","0500_4075":"No Laser Platform was detected, which may affect thickness measurement accuracy. Please place the laser platform correctly and ensure the rear markers are not blocked, then restart the thickness me...","0500_4076":"Please place the Laser Platform correctly and ensure the rear markers are not blocked, then restart the thickness measurement in the software before initiating the task.","0500_4097":"The device cannot detect the Laser Module. Please reconnect the module cable or restart the printer.","0500_4098":"The device cannot detect AMS A. Please reconnect the AMS cable or restart the printer.","0500_4099":"The firmware of Cutting Module does not match the printer; the device cannot continue working. Please update it on the 'Firmware' page.","0500_409A":"The firmware of the Air Pump does not match the printer; the device cannot continue working. Please update it on the 'Firmware' page.","0500_409B":"The firmware of the Laser Module does not match the printer; the device cannot continue working. Please update it on the 'Firmware' page.","0500_409D":"The firmware of AMS A does not match the printer; the device cannot continue working. Please upgrade it on the 'Firmware' page.","0500_409E":"The device cannot detect the Cutting Module. Please reconnect the module cable or restart the printer.","0500_409F":"The device cannot detect the Air Pump. Please reconnect the module cable or restart the printer.","0500_40A0":"The Rotary Attachment module is not detected. Please reconnect the cable or restart the printer.","0500_40A1":"The Auto Fire Extinguishing System is not detected. Please reconnect the module cable or restart the printer.","0500_40A3":"AMS(or AMS lite) A communication is abnormal. Please reconnect the module cable or restart the printer.","0500_40A4":"The current firmware only supports 1 AMS Lite. Please remove all AMS units before reconnecting the supported AMS Lite device.","0500_40A5":"The current firmware only supports AMS/AMS 2 Pro/AMS HT, with a maximum of 4 units. Please remove all AMS units before reconnecting the supported one.","0500_8013":"The print file is not available. Please check to see if the storage media has been removed.","0500_8036":"Your sliced file is not consistent with the current printer model. Continue?","0500_803C":"The current nozzle setting does not match the slicing file. Continuing to print may affect print quality. It is recommended to re-slice before starting the print.","0500_8040":"Toolhead front cover is detached. Moving the toolhead may damage the printer. Do you want to continue?","0500_8041":"The filament in hotend is too cold. Extrusion may damage the extruder. Still feeding in/out the filament?","0500_8048":"The module on the toolhead is not calibrated. Please cancel the task to perform calibration or switch to a calibrated module.","0500_8051":"Detected build plate is not the same as the Gcode file. Please adjust slicer settings or use the correct plate.","0500_8053":"Nozzle mismatch was detected during printing. Please initiate the print after re-slicing, or continue printing after replacing with the correct nozzle. Caution: the hotend temperature is high.","0500_8055":"Laser module is installed, but a Cutting Platform is detected. Please place a Laser Platform and perform laser calibration.","0500_8056":"Cutting module is installed, but the laser platform is detected. Please place the cutting platform for calibration.","0500_8058":"Please place the light grip cutting mat correctly and ensure the marker is exposed.","0500_8059":"Cutting platform base is not correctly aligned. Please ensure that the four corners of the platform are aligned with the heatbed.","0500_805A":"Please place the cutting mat on cutting protection base.","0500_805B":"The cutting mat type is unknown; please replace it with the correct cutting mat.","0500_805C":"The grip cutting mat type does not match; please place a LightGrip cutting mat.","0500_805E":"Cutting module Serial Number error: unable to calibrate or make project.","0500_8060":"The current module on toolhead does not meet requirements. Please replace the module as per the on-screen instructions.","0500_8061":"No print plate detected. Please make sure it is placed correctly.","0500_8062":"The print plate marker was not detected. Please confirm the print plate is correctly positioned on the heatbed with all four corners aligned, and the marker is visible. If strong light is shining o...","0500_8063":"The platform is not detected during calibration; please make sure the Laser Platform is properly placed.","0500_8064":"Please place the Laser Platform correctly and ensure the rear markers are not blocked for laser calibration.","0500_8066":"The task requires a Cutting Platform, but the current one is a Laser Platform. Please replace it with a Cutting Platform (Cutting Protection Base + LightGrip cutting mat).","0500_8067":"Please place a LightGrip cutting mat on the cutting protection base.","0500_8068":"Please place the strong grip cutting mat correctly and ensure the marker is exposed.","0500_8069":"Unable to recognize the left and right hotends. They might be third party hotends, or the hotend marks may be dirty. Please manually set the hotend types.","0500_806A":"Unable to recognize the left and right hotends. They might be third party hotends, or the hotend marks may be dirty. Please set hotend types on printer screen before next print.","0500_806B":"Quick-release Lever is not locked. Please press down the external toolhead module to ensure it is properly seated, then push down the level to lock it in place.","0500_806C":"Please place the cutting platform correctly and ensure the marker is exposed.","0500_806D":"Material not detected. Please confirm placement and continue.","0500_806E":"Foreign objects detected on heatbed; please check and clean up the heatbed.","0500_806F":"The grip cutting mat type does not match; please place a StrongGrip cutting mat.","0500_8071":"No cutting platform was detected. Please confirm that it has been correctly placed.","0500_8072":"Live View camera is blocked","0500_8073":"Heatbed limit block is obstructed or contaminated. Please clean and ensure the limit block is visible, otherwise platform position offset detection may be inaccurate.","0500_8074":"The Laser Platform is offset. Please ensure that the four corners of the platform are aligned with the heatbed, and the marker is not obstructed.","0500_8077":"The visual marker was not detected. Please ensure the paper is properly placed.","0500_8078":"Current material does not match the sliced file settings. Please load the correct material and ensure the QR code on the material is not damaged or dirty.","0500_8079":"Please place the Laser Test Material (350g paperboard) and position support strips underneath to prevent material warping.","0500_807A":"The foreign object detection function is not working. You can continue the task or check the assistant for troubleshooting.","0500_807B":"Please place the cutting platform (cutting protection base + LightGrip cutting mat).","0500_807C":"Please place the cutting platform (cutting protection base + StrongGrip cutting mat).","0500_807D":"This task requires a Cutting Platform, but the current one is a Laser Platform. Please replace it with a Cutting Platform (Cutting Protection Base + StrongGrip Cutting Mat).","0500_807E":"Please place a StrongGrip cutting mat on the cutting protection base.","0500_8080":"The left and right hotends are not installed.","0500_8081":"The left and right hotends are not installed.","0500_8082":"Please remove the protective film on the Opaque Glossy Acrylic before processing","0500_8083":"Material is not allowed in Mounting Calibration. Please remove the material from the platform.","0500_8084":"The Live View Camera is dirty; please clean it and continue.","0500_8085":"Toolhead camera is obstructed","0500_8086":"Toolhead Camera is dirty, which affects the AI function; please clean the lens surface.","0500_8087":"BirdsEye camera is obstructed","0500_8088":"The Birdseye Camera is dirty","0500_8089":"Task paused due to Presence Check failed. Please check the printer to continue.","0500_808A":"The BirdsEye Camera is installed offset. Please refer to the assistant to reinstall it.","0500_808B":"The BirdsEye Camera setup failed. Please remove all objects and the mat on the heatbed to ensure the heatbed markers are visible. Meanwhile, please ensure the BirdsEye Camera is installed correctly...","0500_808C":"Detected build plate offset. Please align the build plate with the heatbed, and then continue.","0500_808D":"The Cutting Module offset calibration failed, which may result in inaccurate cuts. Please ensure the cutting material is properly positioned and check whether the cutting blade tip is worn.","0500_808E":"BirdsEye Camera initialization failed. The toolhead camera did not detect the Heatbed features. Please clean the Heatbed, remove all objects and pads, and ensure the bed markings are visible. Check...","0500_808F":"Nozzle camera lens is dirty, affecting AI monitoring. Clean the lens with a non-woven cloth and a small amount of alcohol. Beware of hotend heat; wait for it to cool before handling.","0500_8090":"Please attach the 80g White Printing Paper to the center area of the platform.","0500_8091":"The Cutting Module offset calibration failed, which may result in inaccurate cuts. Please ensure the 80g white printer paper(letter paper thickness) is properly positioned and check whether the cut...","0500_8092":"Toolhead Camera initialization failed. This print can still continue, but some AI functions will be disabled. If you encounter this issue again after restarting, please contact customer support.","0500_8093":"The nozzle silicone sleeve is not installed; there is a risk of temperature control failure. Please install it correctly and try again.","0500_80A0":"The visual encoder board was not detected. Please check if the board is properly placed and aligned at all four corners, and ensure the positioning markings are clear and free from wear.","0500_C010":"MicroSD Card read/write exception: please reinsert or replace the MicroSD Card.","0500_C032":"Laser/Cutting module connected to the toolhead. The drying process has been automatically stopped.","0500_C036":"This is a printing task. Please detach the Laser/Cutting Module from the Toolhead.","0500_C07F":"Device is busy and cannot perform this operation. To proceed, please pause or stop the current task.","0501_4017":"Binding failed. Please retry or restart the printer and retry.","0501_4018":"Binding configuration information parsing failed; please try again.","0501_4019":"The printer has already been bound. Please unbind it and try again.","0501_401A":"Cloud access failed. Possible reasons include network instability caused by interference, inability to access the internet, or router firewall configuration restrictions. You can try moving the pri...","0501_401B":"Cloud response is invalid. If you have tried multiple times and are still failing, please contact customer support.","0501_401C":"Cloud access is rejected. If you have tried multiple times and are still failing, please contact customer support.","0501_401D":"Cloud access failed, which may be caused by network instability due to interference. You can try moving the printer closer to the router before you try again.","0501_401E":"Cloud response is invalid. If you have tried multiple times and are still failing, please contact customer support.","0501_401F":"Authorization timed out. Please make sure that your phone or PC has access to the internet, and ensure that the Bambu Studio/Bambu Handy APP is running in the foreground during the binding operation.","0501_4020":"Cloud access rejected. If you have tried multiple times and are still failing, please contact customer support.","0501_4021":"Cloud access failed, which may be caused by network instability due to interference. You can try moving the printer closer to the router before you try again.","0501_4022":"Cloud response is invalid. If you have tried multiple times and are still failing, please contact customer support.","0501_4023":"Cloud access rejected. If you have tried multiple times and are still failing, please contact customer support.","0501_4024":"Cloud access failed. Possible reasons include network instability caused by interference, inability to access the internet, or router firewall configuration restrictions. You can try moving the pri...","0501_4025":"Cloud response is invalid. If you have tried multiple times and are still failing, please contact customer support.","0501_4026":"Cloud access rejected. If you have tried multiple times and are still failing, please contact customer support.","0501_4027":"Cloud access failed; this may be caused by network instability due to interference. You can try moving the printer closer to the router before you try again.","0501_4028":"Cloud response is invalid. If you have tried multiple times and are still failing, please contact customer support.","0501_4029":"Cloud access is rejected. If you have tried multiple times and are still failing, please contact customer support.","0501_4031":"Device discovery binding is in progress, and the QR code cannot be displayed on the screen. You can wait for the binding to finish or abort the device discovery binding process in the APP/Studio an...","0501_4032":"QR code binding is in progress, so device discovery binding cannot be performed. You can scan the QR code on the screen for binding or exit the QR code display page on screen and try device discove...","0501_4033":"Your APP region does not match with your printer; please download the APP in the corresponding region and register your account again.","0501_4034":"The slicing progress has not been updated for a long time, and the printing task has exited. Please confirm the parameters and reinitiate printing.","0501_4035":"The device is in the process of binding and cannot respond to new binding requests.","0501_4038":"The regional settings do not match the printer; please check the printer's regional settings.","0501_4039":"Device login has expired; please try to bind again.","0501_4098":"The device cannot detect AMS B. Please reconnect the AMS cable or restart the printer.","0501_409D":"The firmware of AMS B does not match the printer; the device cannot continue working. Please update it on the 'Firmware' page.","0501_40A3":"AMS(or AMS lite) B communication is abnormal. Please reconnect the module cable or restart the printer.","0502_4001":"Current filament will be used in this print job. Settings cannot be changed.","0502_4002":"Please go to “Settings > Calibration” to run the Motion Accuracy Enhancement Calibration before turning on Motion Accuracy Enhancement mode.","0502_4003":"The printer is currently printing and the motion accuracy enhancement feature cannot be turned on or off.","0502_4004":"Some features are not supported by the current device. Please check the Studio feature settings or update the firmware to the latest version.","0502_4005":"The AMS has not been calibrated yet, so printing cannot be initiated.","0502_4006":"Unknown module detected; please try updating the firmware to the latest version.","0502_400D":"Failed to start a new task: filament loading/unloading not completed.","0502_400E":"Failed to start a new task: The nozzle cold pull was not completed.","0502_4013":"This device is not compatible with the 40W laser module. Please replace it with a 10W laser module or remove it.","0502_4098":"The device cannot detect AMS C. Please reconnect the AMS cable or restart the printer.","0502_409D":"The firmware of AMS C does not match the printer; the device cannot continue working. Please upgrade it on the 'Firmware' page.","0502_40A3":"AMS(or AMS lite) C communication is abnormal. Please reconnect the module cable or restart the printer.","0502_C00F":"The device is busy and cannot perform nozzle identification.","0502_C010":"Due to printer power limitations, printing, calibration, controls and other actions cannot be performed during AMS drying. Please stop the drying process before proceeding with any other operation.","0502_C011":"Currently in 2D production mode. Please continue the operation on the printer","0502_C012":"The task cannot be paused.","0502_C014":"The AMS Remaining Filament Estimation is enabled by default and cannot be disabled.","0502_C024":"The flow dynamic calibration records have exceeded the storage limit. Please delete some historical records in the slicer software before adding new calibration data.","0503_4098":"The device cannot detect AMS D. Please reconnect the AMS cable or restart the printer.","0503_409D":"The firmware of AMS D does not match the printer; the device cannot continue working. Please update it on the 'Firmware' page.","0503_40A3":"AMS(or AMS lite) D communication is abnormal. Please reconnect the module cable or restart the printer.","0580_4096":"The device cannot detect AMS-HT A. Please reconnect the AMS-HT cable or restart the printer.","0580_409C":"The firmware of AMS-HT A does not match the printer; the device cannot continue working. Please update it on the 'Firmware' page.","0580_40A2":"AMS-HT A communication is abnormal. Please reconnect the module cable or restart the printer.","0581_4096":"The device cannot detect AMS-HT B. Please reconnect the AMS-HT cable or restart the printer.","0581_409C":"The firmware of AMS-HT B does not match the printer; the device cannot continue working. Please update it on the 'Firmware' page.","0581_40A2":"AMS-HT B communication is abnormal. Please reconnect the module cable or restart the printer.","0582_4096":"The device cannot detect AMS-HT C. Please reconnect the AMS-HT cable or restart the printer.","0582_409C":"The firmware of AMS-HT C does not match the printer; the device cannot continue working. Please update it on the 'Firmware' page.","0582_40A2":"AMS-HT C communication is abnormal. Please reconnect the module cable or restart the printer.","0583_4096":"The device cannot detect AMS-HT D. Please reconnect the AMS-HT cable or restart the printer.","0583_409C":"The firmware of AMS-HT D does not match the printer; the device cannot continue working. Please update it on the 'Firmware' page.","0583_40A2":"AMS-HT D communication is abnormal. Please reconnect the module cable or restart the printer.","0584_4096":"The device cannot detect AMS-HT F. Please reconnect the AMS-HT cable or restart the printer.","0584_409C":"The firmware of AMS-HT E does not match the printer; the device cannot continue working. Please update it on the 'Firmware' page.","0584_40A2":"AMS-HT E communication is abnormal. Please reconnect the module cable or restart the printer.","0585_4096":"The device cannot detect AMS-HT E. Please reconnect the AMS-HT cable or restart the printer.","0585_409C":"The firmware of AMS-HT F does not match the printer; the device cannot continue working. Please update it on the 'Firmware' page.","0585_40A2":"AMS-HT F communication is abnormal. Please reconnect the module cable or restart the printer.","0586_4096":"The device cannot detect AMS-HT G. Please reconnect the AMS-HT cable or restart the printer.","0586_409C":"The firmware of AMS-HT G does not match the printer; the device cannot continue working. Please update it on the 'Firmware' page.","0586_40A2":"AMS-HT G communication is abnormal. Please reconnect the module cable or restart the printer.","0587_4096":"The device cannot detect AMS-HT H. Please reconnect the AMS-HT cable or restart the printer.","0587_409C":"The firmware of AMS-HT H does not match the printer; the device cannot continue working. Please upgrade it on the 'Firmware' page.","0587_40A2":"AMS-HT H communication is abnormal. Please reconnect the module cable or restart the printer.","05FE_8053":"The left nozzle is not matched with slicing file. Please initiate the print after re-slicing, or continue printing after replacing with the correct nozzle. Caution: the hotend temperature is high.","05FE_8069":"Unable to recognize the left hotend. It might be a third party hotend, or the hotend mark may be dirty. Please manually set the hotend type.","05FE_806A":"Unable to recognize the left hotend. It might be a third party hotend, or the hotend mark may be dirty. Please set hotend type on printer screen before next print.","05FE_8080":"The left hotend is not installed.","05FE_8081":"The left hotend is not installed.","05FF_8053":"The right nozzle is not matched with slicing file. Please initiate the print after re-slicing, or continue printing after replacing with the correct nozzle. Caution: the hotend temperature is high.","05FF_8069":"Unable to recognize the right hotend. It might be a third party hotend, or the hotend mark may be dirty. Please manually set the hotend type.","05FF_806A":"Unable to recognize the right hotend. It might be a third party hotend, or the hotend mark may be dirty. Please set hotend type on printer screen before next print.","05FF_8080":"The right hotend is not installed.","05FF_8081":"The right hotend is not installed.","0700_4001":"The AMS has been disabled for a print, but it still has filament loaded. Please unload the AMS filament and switch to the spool holder filament for printing.","0700_4025":"Failed to read the filament information.","0700_8001":"Failed to cut the filament. Please check the cutter.","0700_8002":"The cutter is stuck. Please make sure the cutter handle is out.","0700_8003":"Failed to pull out the filament from the extruder. This might be caused by clogged extruder or filament broken inside the extruder.","0700_8004":"AMS failed to pull back filament. This could be due to a stuck spool or the end of the filament being stuck in the path.","0700_8005":"The AMS failed to send out filament. You can clip the end of your filament flat, and reinsert. If this message persists, please check the PTFE tubes in AMS for any signs of wear and tear.","0700_8006":"Unable to feed filament into the extruder. The AMS may be mismatched with the extruder. You can rerun the AMS Setup. This could also be due to an entangled filament or a stuck spool. If not, please...","0700_8007":"Extruding filament failed. The extruder might be clogged.","0700_800A":"PTFE tube disconnection detected. Please check if the PTFE tube from AMS A to the extruder is properly connected.","0700_8010":"The AMS assist motor is overloaded. This could be due to entangled filament or a stuck spool.","0700_8011":"AMS filament ran out. Please insert a new filament into the same AMS slot.","0700_8012":"Failed to get AMS mapping table; please select 'Resume' to retry.","0700_8013":"Timeout purging old filament: Please check if the filament is stuck or the extruder is clogged.","0700_8016":"The extruder is not extruding normally; please refer to the Assistant. After trouble shooting. If the defects are acceptable, please resume.","0700_8017":"AMS A is drying. Please stop drying process before loading/unloading material.","0700_8021":"AMS setup failed; please refer to the assistant.","0700_8023":"AMS A cooling failed. The ambient temperature may be too high. Please operate the device in a suitable environment.","0700_C069":"An error occurred during AMS A drying. Please go to Assistant for more details.","0700_C06A":"AMS A is reading RFID. Unable to start drying. Please try again later.","0700_C06B":"AMS A is changing filament. Unable to start drying. Please try again later.","0700_C06C":"AMS A is in Feed Assist Mode. Unable to start drying. Please try again later.","0700_C06D":"AMS A is assisting in filament insertion. Unable to start drying. Please try again later.","0700_C06E":"AMS A motor is performing self-test. Unable to start drying. Please try again later.","0701_4001":"Filament is still loaded from the AMS after it has been disabled. Please unload the filament, load from the spool holder, and restart printing.","0701_4025":"Failed to read the filament information.","0701_8001":"Failed to cut the filament. Please check the cutter.","0701_8002":"The cutter is stuck. Please make sure the cutter handle is out.","0701_8003":"Failed to pull out the filament from the extruder. This might be caused by clogged extruder or filament broken inside the extruder.","0701_8004":"AMS failed to pull back filament. This could be due to a stuck spool or the end of the filament being stuck in the path.","0701_8005":"The AMS failed to send out filament. You can clip the end of your filament flat, and reinsert. If this message persists, please check the PTFE tubes in AMS for any signs of wear and tear.","0701_8006":"Unable to feed filament into the extruder. The AMS may be mismatched with the extruder. You can rerun the AMS Setup. This could also be due to an entangled filament or a stuck spool. If not, please...","0701_8007":"Extruding filament failed. The extruder might be clogged.","0701_800A":"PTFE tube disconnection detected. Please check if the PTFE tube from AMS B to the extruder is properly connected.","0701_8010":"The AMS assist motor is overloaded. This could be due to entangled filament or a stuck spool.","0701_8011":"AMS filament ran out. Please insert a new filament into the same AMS slot.","0701_8012":"Failed to get AMS mapping table; please select 'Resume' to retry.","0701_8013":"Timeout purging old filament: Please check if the filament is stuck or the extruder is clogged.","0701_8016":"The extruder is not extruding normally; please refer to the Assistant. After trouble shooting. If the defects are acceptable, please resume.","0701_8017":"AMS B is drying. Please stop drying process before loading/unloading material.","0701_8021":"AMS setup failed; please refer to the assistant.","0701_8023":"AMS B cooling failed. The ambient temperature may be too high. Please operate the device in a suitable environment.","0701_C069":"An error occurred during AMS B drying. Please go to Assistant for more details.","0701_C06A":"AMS B is reading RFID. Unable to start drying. Please try again later.","0701_C06B":"AMS B is changing filament. Unable to start drying. Please try again later.","0701_C06C":"AMS B is in Feed Assist Mode. Unable to start drying. Please try again later.","0701_C06D":"AMS B is assisting in filament insertion. Unable to start drying. Please try again later.","0701_C06E":"AMS B motor is performing self-test. Unable to start drying. Please try again later.","0702_4001":"Filament is still loaded from the AMS after it has been disabled. Please unload the filament, load from the spool holder, and restart printing.","0702_4025":"Failed to read the filament information.","0702_8001":"Failed to cut the filament. Please check the cutter.","0702_8002":"The cutter is stuck. Please make sure the cutter handle is out.","0702_8003":"Failed to pull out the filament from the extruder. This might be caused by clogged extruder or filament broken inside the extruder.","0702_8004":"AMS failed to pull back filament. This could be due to a stuck spool or the end of the filament being stuck in the path.","0702_8005":"The AMS failed to send out filament. You can clip the end of your filament flat, and reinsert. If this message persists, please check the PTFE tubes in AMS for any signs of wear and tear.","0702_8006":"Unable to feed filament into the extruder. The AMS may be mismatched with the extruder. You can rerun the AMS Setup. This could also be due to an entangled filament or a stuck spool. If not, please...","0702_8007":"Extruding filament failed. The extruder might be clogged.","0702_800A":"PTFE tube disconnection detected. Please check if the PTFE tube from AMS C to the extruder is properly connected.","0702_8010":"The AMS assist motor is overloaded. This could be due to entangled filament or a stuck spool.","0702_8011":"AMS filament ran out. Please insert a new filament into the same AMS slot.","0702_8012":"Failed to get AMS mapping table; please select 'Resume' to retry.","0702_8013":"Timeout purging old filament: Please check if the filament is stuck or the extruder is clogged.","0702_8016":"The extruder is not extruding normally; please refer to the Assistant. After trouble shooting. If the defects are acceptable, please resume.","0702_8017":"AMS C is drying. Please stop drying process before loading/unloading material.","0702_8021":"AMS setup failed; please refer to the assistant.","0702_8023":"AMS C cooling failed. The ambient temperature may be too high. Please operate the device in a suitable environment.","0702_C069":"An error occurred during AMS C drying. Please go to Assistant for more details.","0702_C06A":"AMS C is reading RFID. Unable to start drying. Please try again later.","0702_C06B":"AMS C is changing filament. Unable to start drying. Please try again later.","0702_C06C":"AMS C is in Feed Assist Mode. Unable to start drying. Please try again later.","0702_C06D":"AMS C is assisting in filament insertion. Unable to start drying. Please try again later.","0702_C06E":"AMS C motor is performing self-test. Unable to start drying. Please try again later.","0703_4001":"Filament is still loaded from the AMS after it has been disabled. Please unload the filament, load from the spool holder, and restart printing.","0703_4025":"Failed to read the filament information.","0703_8001":"Failed to cut the filament. Please check the cutter.","0703_8002":"The cutter is stuck. Please make sure the cutter handle is out.","0703_8003":"Failed to pull out the filament from the extruder. This might be caused by clogged extruder or filament broken inside the extruder.","0703_8004":"AMS failed to pull back filament. This could be due to a stuck spool or the end of the filament being stuck in the path.","0703_8005":"The AMS failed to send out filament. You can clip the end of your filament flat, and reinsert. If this message persists, please check the PTFE tubes in AMS for any signs of wear and tear.","0703_8006":"Unable to feed filament into the extruder. The AMS may be mismatched with the extruder. You can rerun the AMS Setup. This could also be due to an entangled filament or a stuck spool. If not, please...","0703_8007":"Extruding filament failed. The extruder might be clogged.","0703_800A":"PTFE tube disconnection detected. Please check if the PTFE tube from AMS D to the extruder is properly connected.","0703_8010":"The AMS assist motor is overloaded. This could be due to entangled filament or a stuck spool.","0703_8011":"AMS filament ran out. Please insert a new filament into the same AMS slot.","0703_8012":"Failed to get AMS mapping table; please select 'Resume' to retry.","0703_8013":"Timeout purging old filament: Please check if the filament is stuck or the extruder is clogged.","0703_8016":"The extruder is not extruding normally; please refer to the Assistant. After trouble shooting. If the defects are acceptable, please resume.","0703_8017":"AMS D is drying. Please stop drying process before loading/unloading material.","0703_8021":"AMS setup failed; please refer to the assistant.","0703_8023":"AMS D cooling failed. The ambient temperature may be too high. Please operate the device in a suitable environment.","0703_C069":"An error occurred during AMS D drying. Please go to Assistant for more details.","0703_C06A":"AMS D is reading RFID. Unable to start drying. Please try again later.","0703_C06B":"AMS D is changing filament. Unable to start drying. Please try again later.","0703_C06C":"AMS D is in Feed Assist Mode. Unable to start drying. Please try again later.","0703_C06D":"AMS D is assisting in filament insertion. Unable to start drying. Please try again later.","0703_C06E":"AMS D motor is performing self-test. Unable to start drying. Please try again later.","0704_4025":"Failed to read the filament information.","0704_8003":"Failed to pull out the filament from the extruder. This might be caused by clogged extruder or filament broken inside the extruder.","0704_8004":"AMS failed to pull back filament. This could be due to a stuck spool or the end of the filament being stuck in the path.","0704_8005":"The AMS failed to send out filament. You can clip the end of your filament flat, and reinsert. If this message persists, please check the PTFE tubes in AMS for any signs of wear and tear.","0704_8006":"Unable to feed filament into the extruder. The AMS may be mismatched with the extruder. You can rerun the AMS Setup. This could also be due to an entangled filament or a stuck spool. If not, please...","0704_8007":"Extruding filament failed. The extruder might be clogged.","0704_800A":"PTFE tube disconnection detected. Please check if the PTFE tube from AMS E to the extruder is properly connected.","0704_8010":"The AMS assist motor is overloaded. This could be due to entangled filament or a stuck spool.","0704_8011":"AMS filament ran out. Please insert a new filament into the same AMS slot.","0704_8012":"Failed to get AMS mapping table; please select 'Resume' to retry.","0704_8013":"Timeout purging old filament: Please check if the filament is stuck or the extruder is clogged.","0704_8016":"The extruder is not extruding normally; please refer to the Assistant. After trouble shooting. If the defects are acceptable, please resume.","0704_8021":"AMS setup failed; please refer to the assistant.","0704_8023":"AMS E cooling failed. The ambient temperature may be too high. Please operate the device in a suitable environment.","0705_4025":"Failed to read the filament information.","0705_8003":"Failed to pull out the filament from the extruder. This might be caused by clogged extruder or filament broken inside the extruder.","0705_8004":"AMS failed to pull back filament. This could be due to a stuck spool or the end of the filament being stuck in the path.","0705_8005":"The AMS failed to send out filament. You can clip the end of your filament flat, and reinsert. If this message persists, please check the PTFE tubes in AMS for any signs of wear and tear.","0705_8006":"Unable to feed filament into the extruder. The AMS may be mismatched with the extruder. You can rerun the AMS Setup. This could also be due to an entangled filament or a stuck spool. If not, please...","0705_8007":"Extruding filament failed. The extruder might be clogged.","0705_800A":"PTFE tube disconnection detected. Please check if the PTFE tube from AMS F to the extruder is properly connected.","0705_8010":"The AMS assist motor is overloaded. This could be due to entangled filament or a stuck spool.","0705_8011":"AMS filament ran out. Please insert a new filament into the same AMS slot.","0705_8012":"Failed to get AMS mapping table; please select 'Resume' to retry.","0705_8013":"Timeout purging old filament: Please check if the filament is stuck or the extruder is clogged.","0705_8016":"The extruder is not extruding normally; please refer to the Assistant. After trouble shooting. If the defects are acceptable, please resume.","0705_8021":"AMS setup failed; please refer to the assistant.","0705_8023":"AMS F cooling failed. The ambient temperature may be too high. Please operate the device in a suitable environment.","0706_4025":"Failed to read the filament information.","0706_8003":"Failed to pull out the filament from the extruder. This might be caused by clogged extruder or filament broken inside the extruder.","0706_8004":"AMS failed to pull back filament. This could be due to a stuck spool or the end of the filament being stuck in the path.","0706_8005":"The AMS failed to send out filament. You can clip the end of your filament flat, and reinsert. If this message persists, please check the PTFE tubes in AMS for any signs of wear and tear.","0706_8006":"Unable to feed filament into the extruder. The AMS may be mismatched with the extruder. You can rerun the AMS Setup. This could also be due to an entangled filament or a stuck spool. If not, please...","0706_8007":"Extruding filament failed. The extruder might be clogged.","0706_800A":"PTFE tube disconnection detected. Please check if the PTFE tube from AMS G to the extruder is properly connected.","0706_8010":"The AMS assist motor is overloaded. This could be due to entangled filament or a stuck spool.","0706_8011":"AMS filament ran out. Please insert a new filament into the same AMS slot.","0706_8012":"Failed to get AMS mapping table; please select 'Resume' to retry.","0706_8013":"Timeout purging old filament: Please check if the filament is stuck or the extruder is clogged.","0706_8016":"The extruder is not extruding normally; please refer to the Assistant. After trouble shooting. If the defects are acceptable, please resume.","0706_8021":"AMS setup failed; please refer to the assistant.","0706_8023":"AMS G cooling failed. The ambient temperature may be too high. Please operate the device in a suitable environment.","0707_4025":"Failed to read the filament information.","0707_8003":"Failed to pull out the filament from the extruder. This might be caused by clogged extruder or filament broken inside the extruder.","0707_8004":"AMS failed to pull back filament. This could be due to a stuck spool or the end of the filament being stuck in the path.","0707_8005":"The AMS failed to send out filament. You can clip the end of your filament flat, and reinsert. If this message persists, please check the PTFE tubes in AMS for any signs of wear and tear.","0707_8006":"Unable to feed filament into the extruder. The AMS may be mismatched with the extruder. You can rerun the AMS Setup. This could also be due to an entangled filament or a stuck spool. If not, please...","0707_8007":"Extruding filament failed. The extruder might be clogged.","0707_800A":"PTFE tube disconnection detected. Please check if the PTFE tube from AMS H to the extruder is properly connected.","0707_8010":"The AMS assist motor is overloaded. This could be due to entangled filament or a stuck spool.","0707_8011":"AMS filament ran out. Please insert a new filament into the same AMS slot.","0707_8012":"Failed to get AMS mapping table; please select 'Resume' to retry.","0707_8013":"Timeout purging old filament: Please check if the filament is stuck or the extruder is clogged.","0707_8016":"The extruder is not extruding normally; please refer to the Assistant. After trouble shooting. If the defects are acceptable, please resume.","0707_8021":"AMS setup failed; please refer to the assistant.","0707_8023":"AMS H cooling failed. The ambient temperature may be too high. Please operate the device in a suitable environment.","07FE_8001":"Failed to cut the filament of the left extruder. Please check the cutter.","07FE_8002":"The cutter of the left extruder is stuck. Please pull out the cutter handle.","07FE_8003":"Please pull out the filament on the spool holder of the left extruder. If this message persists, please check to see if there is filament broken in the extruder. (Connect a PTFE tube if you are ab...","07FE_8004":"Failed to pull back the filament from the left extruder. Please check whether the filament is stuck inside the extruder.","07FE_8005":"Failed to feed the filament outside the AMS. Please clip the end of the filament flat and check to see if the spool is stuck.","07FE_8006":"Please feed filament into the PTFE tube of the left extruder until it can not be pushed any farther.","07FE_8007":"Please observe the nozzle of the left extruder. If the filament has been extruded, select 'Continue'; if it has not, please push the filament forward slightly, and then select 'Retry'.","07FE_8010":"Check if the left external filament spool or filament is stuck.","07FE_8011":"The external filament connected to the left extruder has run out; please load a new filament.","07FE_8012":"Failed to get mapping table; please select 'Resume' to retry.","07FE_8013":"Timeout purging old filament of the left extruder: Please check if the filament is stuck or the extruder is clogged.","07FE_8020":"Extruder change failed; please refer to the assistant.","07FE_8021":"AMS setup failed; please refer to the assistant.","07FE_8024":"Extruder position calibration failed; please refer to the assistant.","07FE_8025":"Cold pull timed out. Please promptly operate or check whether the filament is broken inside the extruder, and click the Assistant for details.","07FE_8030":"The filament specified in the slicer has been used up. Printing is paused. Please go to the machine to replace the material and resume printing.","07FE_C003":"Please pull out the filament on the spool holder of the left extruder. If this message persists, please check to see if there is filament broken in the extruder or PTFE tube. (Connect a PTFE tube i...","07FE_C006":"Please feed filament into the PTFE tube of the left extruder until it can not be pushed any farther.","07FE_C008":"Please pull out the filament on the spool holder of the left extruder. If this message persists, please check to see if there is filament broken in the extruder or PTFE tube. (Connect a PTFE tube i...","07FE_C009":"Please feed filament into the PTFE tube of the left extruder until it can not be pushed any farther.","07FE_C00A":"Please observe the nozzle of the left extruder. If the filament has been extruded, select 'Continue'; if not, please push the filament forward slightly and then select 'Retry'.","07FE_C010":"Insert the filament (over 30cm long) until it stops. You might see slight smoke during flushing. After insertion, close the front door and top cover.","07FE_C011":"Please manually and slowly pull out the filament from the extruder. Then click “Continue”.","07FE_C012":"Press the black PTFE tube coupler and unplug the PTFE tube. After completing the operation, click 'Continue.'","07FF_4001":"Filament is still loaded from the AMS after it has been disabled. Please unload the filament, load from the spool holder, and restart printing.","07FF_8001":"Failed to cut the filament of the right extruder. Please check the cutter.","07FF_8002":"The cutter is stuck. Please make sure the cutter handle is out.","07FF_8003":"Please pull out the filament on the spool holder of the right extruder. If this message persists, please check to see if there is filament broken in the extruder. (Connect a PTFE tube if you are a...","07FF_8004":"Failed to pull back the filament from the right extruder. Please check whether the filament is stuck inside the extruder.","07FF_8005":"Failed to feed the filament outside the AMS. Please clip the end of the filament flat and check to see if the spool is stuck.","07FF_8006":"Please feed filament into the PTFE tube of the right extruder until it can not be pushed any farther.","07FF_8007":"Please observe the nozzle of the right extruder. If the filament has been extruded, select 'Continue'; if it has not, please push the filament forward slightly, and then select 'Retry'.","07FF_8010":"Check if the external filament spool or filament is stuck.","07FF_8011":"External filament has run out; please load a new filament.","07FF_8012":"Failed to get AMS mapping table; please select 'Resume' to retry.","07FF_8013":"Timeout purging old filament of the right extruder: Please check if the filament is stuck or the extruder is clogged.","07FF_8020":"Extruder change failed; please refer to the assistant.","07FF_8021":"AMS setup failed; please refer to the assistant.","07FF_8024":"Extruder position calibration failed; please refer to the assistant.","07FF_8025":"Cold pull timed out. Please promptly operate or check whether the filament is broken inside the extruder, and click the Assistant for details.","07FF_8030":"The filament specified in the slicer has been used up. Printing is paused. Please go to the machine to replace the material and resume printing.","07FF_C003":"Please pull out the filament on the spool holder of the right extruder. If this message persists, please check to see if there is filament broken in the extruder or PTFE tube. (Connect a PTFE tube ...","07FF_C006":"Please feed filament into the PTFE tube of the right extruder until it can not be pushed any farther.","07FF_C008":"Please pull out the filament on the spool holder of the right extruder. If this message persists, please check to see if there is filament broken in the extruder or PTFE tube. (Connect a PTFE tube ...","07FF_C009":"Please feed filament into the PTFE tube of the right extruder until it can not be pushed any farther.","07FF_C00A":"Please observe the nozzle of the right extruder. If the filament has been extruded, select 'Continue'; if not, please push the filament forward slightly and then select 'Retry'.","07FF_C010":"Insert the filament (over 30cm long) until it stops. You might see slight smoke during flushing. After insertion, close the front door and top cover.","07FF_C011":"Hold the driven wheel bracket, slowly pull the filament from the extruder, then press 'Continue'.","07FF_C012":"Press the black PTFE tube coupler and unplug the PTFE tube. After completing the operation, click 'Continue.'","0C00_4020":"The setup of BirdsEye Camera failed. Please clear all objects and remove the mat. Make sure the marker is not obstructed. Meanwhile, clean both the BirdsEye Camera and Toolhead Camera, and remove a...","0C00_4021":"The setup of BirdsEye Camera failed; please reboot the printer.","0C00_4022":"The setup of BirdsEye Camera failed. Please check if the laser module is working properly.","0C00_4024":"The Birdseye Camera is installed offset. Please refer to the assistant to reinstall it.","0C00_4025":"The Birdseye Camera is dirty. Please clean it and restart the process.","0C00_4026":"The Live View Camera initialization failed; please reboot the printer.","0C00_4027":"The Live View Camera calibration failed. Please refer to the assistant for details and recalibrate the camera after processing.","0C00_4029":"Material not detected. Please confirm placement and continue.","0C00_402A":"The visual marker was not detected. Please re-paste the paper in the correct position.","0C00_402C":"Device data link error. Please reboot the printer","0C00_402D":"The toolhead camera is not working properly; please reboot the device.","0C00_403D":"The vision encoder plate was not detected. Please confirm it is correctly positioned on the heatbed.","0C00_403E":"The high-precision nozzle offset calibration has failed, possibly due to a damaged pattern or the similarity of the colors of the two selected filaments. Please clear the printed pattern and replac...","0C00_4041":"Toolhead camera calibration failed. Please ensure the Calibration Marker on the heatbed or Height Calibration Marker on the homing area is clean and undamaged, then re-run the calibration process.","0C00_8001":"First layer defects were detected. If the defects are acceptable, select 'Resume' to resume the print job.","0C00_8005":"Purged filament has piled up in the waste chute, which may cause a tool head collision.","0C00_8009":"Build plate localization marker was not found.","0C00_800B":"The heatbed marker was not detected. Please clear all objects and remove the mat. Make sure the marker is not obstructed.","0C00_8015":"Objects detected on the platform; please clean them up in a timely manner.","0C00_8016":"The foreign object detection function is not working. You can continue the task or check assistant for solutions.","0C00_8017":"Foreign objects detected on the platform; please clean them up on time.","0C00_8018":"The foreign object detection function is not working. You can continue the task or view the assistant for troubleshooting.","0C00_8033":"Quick-release Lever is not locked. Please push it down to secure.","0C00_8034":"Liveview Camera initialization failed. This print can still continue, but some AI functions will be disabled. If you encounter this issue again after restarting, please contact customer support.","0C00_803F":"AI detected nozzle clumping. Please check the nozzle condition. Refer to assistant for solutions.","0C00_8040":"AI detected air-printing defect. Please check the hotend extrusion status. Refer to assistant for solutions.","0C00_8042":"The AI print monitor has detected a spaghetti defect. Please check the print and take the necessary action.","0C00_8043":"AI detected nozzle clumping. Please check the nozzle condition. Refer to assistant for solutions.","0C00_C003":"Possible defects were detected in the first layer.","0C00_C004":"Possible spaghetti failure was detected.","0C00_C006":"Purged filament may have piled up in the waste chute.","1000_C001":"High bed temperature may lead to filament clogging in the nozzle. You may open the chamber door.","1000_C002":"Printing CF material with stainless steel may cause nozzle damage.","1000_C003":"Enabling Timelapse in traditional mode may cause defects; please activate this feature as needed.","1001_4001":"Timelapse is not supported as Spiral Vase mode is enabled in slicing presets.","1001_4002":"Timelapse is not supported as the Print sequence is set to 'By object'.","1001_8003":"The time-lapse mode is set to Traditional in the slicing file. This may cause surface defects. Would you like to enable it?","1001_8004":"Prime Tower is not enabled and time-lapse mode is set to Smooth in slicing file. This may cause surface defects. Would you like to enable it?","1200_4001":"Filament is still loaded from the AMS when it has been disabled. Please unload AMS filament, load from spool holder, and restart print job.","1200_8001":"Cutting the filament failed. Please check to see if the cutter is stuck. Refer to the Assistant for solutions.","1200_8002":"The cutter is stuck. Please pull out the cutter handle.","1200_8003":"Failed to pull out the filament from the extruder. Please check whether the extruder is clogged or whether the filament is broken inside the extruder.","1200_8004":"Failed to pull back the filament from the toolhead. Please check whether the filament is stuck.","1200_8005":"The filament is not inserted. Please insert the filament.","1200_8006":"Unable to feed filament into the extruder. This could be due to tangled filament or a stuck spool. If not, please check if the AMS PTFE tube is connected.","1200_8007":"Failed to extrude the filament. This might be caused by clogged extruder or stuck filament. Refer to the Assistant for solutions.","1200_8010":"Filament or spool may be stuck.","1200_8011":"AMS filament has run out. Please insert a new filament into the same AMS slot.","1200_8012":"Failed to get AMS mapping table; please select 'Resume' to retry.","1200_8013":"Timeout while purging old filament. Please check if the filament is stuck or the extruder clogged.","1200_8014":"The filament location in the toolhead was not found. Refer to the Assistant for solutions.","1200_8015":"Failed to pull out the filament from the toolhead. Please check if the filament is stuck, or if it is broken inside the extruder or PTFE tube.","1200_8016":"The extruder is not extruding normally. Refer to the Assistant for troubleshooting. There may be defects in this layer, but you may resume if the defects are acceptable.","1201_4001":"Filament is still loaded from the AMS when it has been disabled. Please unload AMS filament, load from spool holder, and restart print job.","1201_8001":"Failed to cut the filament. Please check the cutter.","1201_8002":"The cutter is stuck. Please pull out the cutter handle.","1201_8003":"Failed to pull out the filament from the extruder. Please check whether the extruder is clogged or whether the filament is broken inside the extruder.","1201_8004":"Failed to pull back the filament from the toolhead. Please check whether the filament is stuck.","1201_8005":"Failed to feed the filament. Please load the filament and then select 'Retry'.","1201_8006":"Failed to feed the filament into the toolhead. Please check whether the filament is stuck.","1201_8007":"Failed to extrude the filament. The extruder may be clogged or the filament may be stuck; please refer to HMS.","1201_8010":"Please check if the spool or filament is stuck.","1201_8011":"AMS filament has run out. Please insert a new filament into the same AMS slot.","1201_8012":"Failed to get AMS mapping table; please select 'Resume' to retry.","1201_8013":"Timeout while purging old filament. Please check if the filament is stuck or the extruder clogged.","1201_8014":"Failed to check the filament location in the tool head; please refer to the HMS.","1201_8015":"Failed to pull back the filament from the toolhead. Please check if the filament is stuck or the filament is broken inside the extruder.","1201_8016":"The extruder is not extruding normally; please refer to the HMS. After trouble shooting, if the defects are acceptable, please resume printing.","1202_4001":"Filament is still loaded from the AMS when it has been disabled. Please unload AMS filament, load from spool holder, and restart print job.","1202_8001":"Failed to cut the filament. Please check the cutter.","1202_8002":"The cutter is stuck. Please pull out the cutter handle.","1202_8003":"Failed to pull out the filament from the extruder. Please check whether the extruder is clogged or whether the filament is broken inside the extruder.","1202_8004":"Failed to pull back the filament from the toolhead. Please check whether the filament is stuck.","1202_8005":"The filament is not inserted. Please insert the filament.","1202_8006":"Failed to feed the filament into the toolhead. Please check whether the filament is stuck.","1202_8007":"Failed to extrude the filament. The extruder may be clogged or the filament may be stuck; please refer to HMS.","1202_8010":"Please check if the spool or filament is stuck.","1202_8011":"AMS filament has run out. Please insert a new filament into the same AMS slot.","1202_8012":"Failed to get AMS mapping table; please select 'Resume' to retry.","1202_8013":"Timeout while purging old filament. Please check if the filament is stuck or the extruder clogged.","1202_8014":"Failed to check the filament location in the tool head; please refer to the HMS.","1202_8015":"Failed to pull back the filament from the toolhead. Please check if the filament is stuck or is broken inside the extruder.","1202_8016":"The extruder is not extruding normally; please refer to the HMS. After trouble shooting, if the defects are acceptable, please resume printing.","1203_4001":"Filament is still loaded from the AMS when it has been disabled. Please unload AMS filament, load from spool holder, and restart print job.","1203_8001":"Failed to cut the filament. Please check the cutter.","1203_8002":"The cutter is stuck. Please pull out the cutter handle.","1203_8003":"Failed to pull out the filament from the extruder. Please check whether the extruder is clogged or whether the filament is broken inside the extruder.","1203_8004":"Failed to pull back the filament from the toolhead. Please check whether the filament is stuck.","1203_8005":"The filament is not inserted. Please insert the filament.","1203_8006":"Failed to feed the filament into the toolhead. Please check whether the filament is stuck.","1203_8007":"Failed to extrude the filament. The extruder may be clogged or the filament may be stuck; please refer to HMS.","1203_8010":"Please check if the spool or filament is stuck.","1203_8011":"AMS filament has run out. Please insert a new filament into the same AMS slot.","1203_8012":"Failed to get AMS mapping table; please select 'Resume' to retry.","1203_8013":"Timeout while purging old filament. Please check if the filament is stuck or the extruder clogged.","1203_8014":"Failed to check the filament location in the tool head; please refer to the HMS.","1203_8015":"Failed to pull back the filament from the toolhead. Please check if the filament is stuck or is broken inside the extruder.","1203_8016":"The extruder is not extruding normally; please refer to the HMS. After trouble shooting, if the defects are acceptable, please resume printing.","12FF_4001":"Filament is still loaded from the AMS when it has been disabled. Please unload AMS filament, load from spool holder, and restart print job.","12FF_8001":"Failed to cut the filament. Please check the cutter.","12FF_8002":"The cutter is stuck. Please pull out the cutter handle.","12FF_8003":"Please pull out the filament on the spool holder. If this message persists, please check to see if there is filament broken in the extruder or PTFE tube. (Connect a PTFE tube if you are about to us...","12FF_8004":"Failed to pull back the filament from the toolhead. Please check whether the filament is stuck.","12FF_8005":"The filament is not inserted. Please insert the filament.","12FF_8006":"Please feed filament into the PTFE tube until it can not be pushed any farther.","12FF_8007":"Check nozzle. Select 'Done' if filament was extruded, otherwise push filament forward slightly and select 'Retry.'","12FF_8010":"Please check if the filament or the spool is stuck.","12FF_8011":"AMS filament has run out. Please insert a new filament into the same AMS slot.","12FF_8012":"Failed to get AMS mapping table; please select 'Resume' to retry.","12FF_8013":"Timeout while purging old filament. Please check if the filament is stuck or the extruder clogged.","12FF_C003":"Please pull out the filament on the spool holder. If this message persists, please check to see if there is filament broken in the extruder or PTFE Tube. (Connect a PTFE tube if you are about to us...","12FF_C006":"Please feed filament into the PTFE tube until it can not be pushed any farther.","1800_4025":"Failed to read the filament information.","1800_8003":"Failed to pull out the filament from the extruder. This might be caused by clogged extruder or filament broken inside the extruder.","1800_8004":"AMS-HT failed to pull back filament. This could be due to a stuck spool or the end of the filament being stuck in the path.","1800_8005":"The AMS-HT failed to send out filament. You can clip the end of your filament flat, and reinsert. If this message persists, please check the PTFE tubes in AMS for any signs of wear and tear.","1800_8006":"Unable to feed filament into the extruder. The AMS may be mismatched with the extruder. You can rerun the AMS Setup. This could also be due to an entangled filament or a stuck spool. If not, please...","1800_8007":"Extruding filament failed. The extruder might be clogged.","1800_800A":"PTFE tube disconnection detected. Please check if the PTFE tube from AMS-HT A to the extruder is properly connected.","1800_8010":"The AMS-HT assist motor is overloaded. This could be due to entangled filament or a stuck spool.","1800_8011":"AMS-HT filament ran out. Please insert a new filament into the same AMS-HT slot.","1800_8012":"Failed to get AMS mapping table; please select 'Resume' to retry.","1800_8013":"Timeout purging old filament: Please check if the filament is stuck or the extruder is clogged.","1800_8016":"The extruder is not extruding normally; please refer to the Assistant. After trouble shooting. If the defects are acceptable, please resume.","1800_8017":"AMS-HT A is drying. Please stop drying process before loading/unloading material.","1800_8021":"AMS setup failed; please refer to the assistant.","1800_8023":"AMS-HT A cooling failed. The ambient temperature may be too high. Please operate the device in a suitable environment.","1800_C069":"An error occurred during AMS-HT A drying. Please go to Assistant for more details.","1800_C06A":"AMS-HT A is reading RFID. Unable to start drying. Please try again later.","1800_C06B":"AMS-HT A is changing filament. Unable to start drying. Please try again later.","1800_C06C":"AMS-HT A is in Feed Assist Mode. Unable to start drying. Please try again later.","1800_C06D":"AMS-HT A is assisting in filament insertion. Unable to start drying. Please try again later.","1800_C06E":"AMS-HT A motor is performing self-test. Unable to start drying. Please try again later.","1801_4025":"Failed to read the filament information.","1801_8003":"Failed to pull out the filament from the extruder. This might be caused by clogged extruder or filament broken inside the extruder.","1801_8004":"AMS-HT failed to pull back filament. This could be due to a stuck spool or the end of the filament being stuck in the path.","1801_8005":"The AMS-HT failed to send out filament. You can clip the end of your filament flat, and reinsert. If this message persists, please check the PTFE tubes in AMS for any signs of wear and tear.","1801_8006":"Unable to feed filament into the extruder. The AMS may be mismatched with the extruder. You can rerun the AMS Setup. This could also be due to an entangled filament or a stuck spool. If not, please...","1801_8007":"Extruding filament failed. The extruder might be clogged.","1801_800A":"PTFE tube disconnection detected. Please check if the PTFE tube from AMS-HT B to the extruder is properly connected.","1801_8010":"The AMS-HT assist motor is overloaded. This could be due to entangled filament or a stuck spool.","1801_8011":"AMS-HT filament ran out. Please insert a new filament into the same AMS-HT slot.","1801_8012":"Failed to get AMS mapping table; please select 'Resume' to retry.","1801_8013":"Timeout purging old filament: Please check if the filament is stuck or the extruder is clogged.","1801_8016":"The extruder is not extruding normally; please refer to the Assistant. After trouble shooting. If the defects are acceptable, please resume.","1801_8017":"AMS-HT B is drying. Please stop drying process before loading/unloading material.","1801_8021":"AMS setup failed; please refer to the assistant.","1801_8023":"AMS-HT B cooling failed. The ambient temperature may be too high. Please operate the device in a suitable environment.","1801_C069":"An error occurred during AMS-HT B drying. Please go to Assistant for more details.","1801_C06A":"AMS-HT B is reading RFID. Unable to start drying. Please try again later.","1801_C06B":"AMS-HT B is changing filament. Unable to start drying. Please try again later.","1801_C06C":"AMS-HT B is in Feed Assist Mode. Unable to start drying. Please try again later.","1801_C06D":"AMS-HT B is assisting in filament insertion. Unable to start drying. Please try again later.","1801_C06E":"AMS-HT B motor is performing self-test. Unable to start drying. Please try again later.","1802_4025":"Failed to read the filament information.","1802_8003":"Failed to pull out the filament from the extruder. This might be caused by clogged extruder or filament broken inside the extruder.","1802_8004":"AMS-HT failed to pull back filament. This could be due to a stuck spool or the end of the filament being stuck in the path.","1802_8005":"The AMS-HT failed to send out filament. You can clip the end of your filament flat, and reinsert. If this message persists, please check the PTFE tubes in AMS for any signs of wear and tear.","1802_8006":"Unable to feed filament into the extruder. The AMS may be mismatched with the extruder. You can rerun the AMS Setup. This could also be due to an entangled filament or a stuck spool. If not, please...","1802_8007":"Extruding filament failed. The extruder might be clogged.","1802_800A":"PTFE tube disconnection detected. Please check if the PTFE tube from AMS-HT C to the extruder is properly connected.","1802_8010":"The AMS-HT assist motor is overloaded. This could be due to entangled filament or a stuck spool.","1802_8011":"AMS-HT filament ran out. Please insert a new filament into the same AMS-HT slot.","1802_8012":"Failed to get AMS mapping table; please select 'Resume' to retry.","1802_8013":"Timeout purging old filament: Please check if the filament is stuck or the extruder is clogged.","1802_8016":"The extruder is not extruding normally; please refer to the Assistant. After trouble shooting. If the defects are acceptable, please resume.","1802_8017":"AMS-HT C is drying. Please stop drying process before loading/unloading material.","1802_8021":"AMS setup failed; please refer to the assistant.","1802_8023":"AMS-HT C cooling failed. The ambient temperature may be too high. Please operate the device in a suitable environment.","1802_C069":"An error occurred during AMS-HT C drying. Please go to Assistant for more details.","1802_C06A":"AMS-HT C is reading RFID. Unable to start drying. Please try again later.","1802_C06B":"AMS-HT C is changing filament. Unable to start drying. Please try again later.","1802_C06C":"AMS-HT C is in Feed Assist Mode. Unable to start drying. Please try again later.","1802_C06D":"AMS-HT C is assisting in filament insertion. Unable to start drying. Please try again later.","1802_C06E":"AMS-HT C motor is performing self-test. Unable to start drying. Please try again later.","1803_4025":"Failed to read the filament information.","1803_8003":"Failed to pull out the filament from the extruder. This might be caused by clogged extruder or filament broken inside the extruder.","1803_8004":"AMS-HT failed to pull back filament. This could be due to a stuck spool or the end of the filament being stuck in the path.","1803_8005":"The AMS-HT failed to send out filament. You can clip the end of your filament flat, and reinsert. If this message persists, please check the PTFE tubes in AMS for any signs of wear and tear.","1803_8006":"Unable to feed filament into the extruder. The AMS may be mismatched with the extruder. You can rerun the AMS Setup. This could also be due to an entangled filament or a stuck spool. If not, please...","1803_8007":"Extruding filament failed. The extruder might be clogged.","1803_800A":"PTFE tube disconnection detected. Please check if the PTFE tube from AMS-HT D to the extruder is properly connected.","1803_8010":"The AMS-HT assist motor is overloaded. This could be due to entangled filament or a stuck spool.","1803_8011":"AMS-HT filament ran out. Please insert a new filament into the same AMS-HT slot.","1803_8012":"Failed to get AMS mapping table; please select 'Resume' to retry.","1803_8013":"Timeout purging old filament: Please check if the filament is stuck or the extruder is clogged.","1803_8016":"The extruder is not extruding normally; please refer to the Assistant. After trouble shooting. If the defects are acceptable, please resume.","1803_8017":"AMS-HT D is drying. Please stop drying process before loading/unloading material.","1803_8021":"AMS setup failed; please refer to the assistant.","1803_8023":"AMS-HT D cooling failed. The ambient temperature may be too high. Please operate the device in a suitable environment.","1803_C069":"An error occurred during AMS-HT D drying. Please go to Assistant for more details.","1803_C06A":"AMS-HT D is reading RFID. Unable to start drying. Please try again later.","1803_C06B":"AMS-HT D is changing filament. Unable to start drying. Please try again later.","1803_C06C":"AMS-HT D is in Feed Assist Mode. Unable to start drying. Please try again later.","1803_C06D":"AMS-HT D is assisting in filament insertion. Unable to start drying. Please try again later.","1803_C06E":"AMS-HT D motor is performing self-test. Unable to start drying. Please try again later.","1804_4025":"Failed to read the filament information.","1804_8003":"Failed to pull out the filament from the extruder. This might be caused by clogged extruder or filament broken inside the extruder.","1804_8004":"AMS-HT failed to pull back filament. This could be due to a stuck spool or the end of the filament being stuck in the path.","1804_8005":"The AMS-HT failed to send out filament. You can clip the end of your filament flat, and reinsert. If this message persists, please check the PTFE tubes in AMS for any signs of wear and tear.","1804_8006":"Unable to feed filament into the extruder. The AMS may be mismatched with the extruder. You can rerun the AMS Setup. This could also be due to an entangled filament or a stuck spool. If not, please...","1804_8007":"Extruding filament failed. The extruder might be clogged.","1804_800A":"PTFE tube disconnection detected. Please check if the PTFE tube from AMS-HT E to the extruder is properly connected.","1804_8010":"The AMS-HT assist motor is overloaded. This could be due to entangled filament or a stuck spool.","1804_8011":"AMS-HT filament ran out. Please insert a new filament into the same AMS-HT slot.","1804_8012":"Failed to get AMS mapping table; please select 'Resume' to retry.","1804_8013":"Timeout purging old filament: Please check if the filament is stuck or the extruder is clogged.","1804_8016":"The extruder is not extruding normally; please refer to the Assistant. After trouble shooting. If the defects are acceptable, please resume.","1804_8021":"AMS setup failed; please refer to the assistant.","1804_8023":"AMS-HT E cooling failed. The ambient temperature may be too high. Please operate the device in a suitable environment.","1804_C069":"An error occurred during AMS-HT E drying. Please go to Assistant for more details.","1804_C06A":"AMS-HT E is reading RFID. Unable to start drying. Please try again later.","1804_C06B":"AMS-HT E is changing filament. Unable to start drying. Please try again later.","1804_C06C":"AMS-HT E is in Feed Assist Mode. Unable to start drying. Please try again later.","1804_C06D":"AMS-HT E is assisting in filament insertion. Unable to start drying. Please try again later.","1804_C06E":"AMS-HT E motor is performing self-test. Unable to start drying. Please try again later.","1805_4025":"Failed to read the filament information.","1805_8003":"Failed to pull out the filament from the extruder. This might be caused by clogged extruder or filament broken inside the extruder.","1805_8004":"AMS-HT failed to pull back filament. This could be due to a stuck spool or the end of the filament being stuck in the path.","1805_8005":"The AMS-HT failed to send out filament. You can clip the end of your filament flat, and reinsert. If this message persists, please check the PTFE tubes in AMS for any signs of wear and tear.","1805_8006":"Unable to feed filament into the extruder. The AMS may be mismatched with the extruder. You can rerun the AMS Setup. This could also be due to an entangled filament or a stuck spool. If not, please...","1805_8007":"Extruding filament failed. The extruder might be clogged.","1805_800A":"PTFE tube disconnection detected. Please check if the PTFE tube from AMS-HT F to the extruder is properly connected.","1805_8010":"The AMS-HT assist motor is overloaded. This could be due to entangled filament or a stuck spool.","1805_8011":"AMS-HT filament ran out. Please insert a new filament into the same AMS-HT slot.","1805_8012":"Failed to get AMS mapping table; please select 'Resume' to retry.","1805_8013":"Timeout purging old filament: Please check if the filament is stuck or the extruder is clogged.","1805_8016":"The extruder is not extruding normally; please refer to the Assistant. After trouble shooting. If the defects are acceptable, please resume.","1805_8021":"AMS setup failed; please refer to the assistant.","1805_8023":"AMS-HT F cooling failed. The ambient temperature may be too high. Please operate the device in a suitable environment.","1805_C069":"An error occurred during AMS-HT F drying. Please go to Assistant for more details.","1805_C06A":"AMS-HT F is reading RFID. Unable to start drying. Please try again later.","1805_C06B":"AMS-HT F is changing filament. Unable to start drying. Please try again later.","1805_C06C":"AMS-HT F is in Feed Assist Mode. Unable to start drying. Please try again later.","1805_C06D":"AMS-HT F is assisting in filament insertion. Unable to start drying. Please try again later.","1805_C06E":"AMS-HT F motor is performing self-test. Unable to start drying. Please try again later.","1806_4025":"Failed to read the filament information.","1806_8003":"Failed to pull out the filament from the extruder. This might be caused by clogged extruder or filament broken inside the extruder.","1806_8004":"AMS-HT failed to pull back filament. This could be due to a stuck spool or the end of the filament being stuck in the path.","1806_8005":"The AMS-HT failed to send out filament. You can clip the end of your filament flat, and reinsert. If this message persists, please check the PTFE tubes in AMS for any signs of wear and tear.","1806_8006":"Unable to feed filament into the extruder. The AMS may be mismatched with the extruder. You can rerun the AMS Setup. This could also be due to an entangled filament or a stuck spool. If not, please...","1806_8007":"Extruding filament failed. The extruder might be clogged.","1806_800A":"PTFE tube disconnection detected. Please check if the PTFE tube from AMS-HT G to the extruder is properly connected.","1806_8010":"The AMS-HT assist motor is overloaded. This could be due to entangled filament or a stuck spool.","1806_8011":"AMS-HT filament ran out. Please insert a new filament into the same AMS-HT slot.","1806_8012":"Failed to get AMS mapping table; please select 'Resume' to retry.","1806_8013":"Timeout purging old filament: Please check if the filament is stuck or the extruder is clogged.","1806_8016":"The extruder is not extruding normally; please refer to the Assistant. After trouble shooting. If the defects are acceptable, please resume.","1806_8021":"AMS setup failed; please refer to the assistant.","1806_8023":"AMS-HT G cooling failed. The ambient temperature may be too high. Please operate the device in a suitable environment.","1806_C069":"An error occurred during AMS-HT G drying. Please go to Assistant for more details.","1806_C06A":"AMS-HT G is reading RFID. Unable to start drying. Please try again later.","1806_C06B":"AMS-HT G is changing filament. Unable to start drying. Please try again later.","1806_C06C":"AMS-HT G is in Feed Assist Mode. Unable to start drying. Please try again later.","1806_C06D":"AMS-HT G is assisting in filament insertion. Unable to start drying. Please try again later.","1806_C06E":"AMS-HT G motor is performing self-test. Unable to start drying. Please try again later.","1807_4025":"Failed to read the filament information.","1807_8003":"Failed to pull out the filament from the extruder. This might be caused by clogged extruder or filament broken inside the extruder.","1807_8004":"AMS-HT failed to pull back filament. This could be due to a stuck spool or the end of the filament being stuck in the path.","1807_8005":"The AMS-HT failed to send out filament. You can clip the end of your filament flat, and reinsert. If this message persists, please check the PTFE tubes in AMS for any signs of wear and tear.","1807_8006":"Unable to feed filament into the extruder. The AMS may be mismatched with the extruder. You can rerun the AMS Setup. This could also be due to an entangled filament or a stuck spool. If not, please...","1807_8007":"Extruding filament failed. The extruder might be clogged.","1807_800A":"PTFE tube disconnection detected. Please check if the PTFE tube from AMS-HT H to the extruder is properly connected.","1807_8010":"The AMS-HT assist motor is overloaded. This could be due to entangled filament or a stuck spool.","1807_8011":"AMS-HT filament ran out. Please insert a new filament into the same AMS-HT slot.","1807_8012":"Failed to get AMS mapping table; please select 'Resume' to retry.","1807_8013":"Timeout purging old filament: Please check if the filament is stuck or the extruder is clogged.","1807_8016":"The extruder is not extruding normally; please refer to the Assistant. After trouble shooting. If the defects are acceptable, please resume.","1807_8021":"AMS setup failed; please refer to the assistant.","1807_8023":"AMS-HT H cooling failed. The ambient temperature may be too high. Please operate the device in a suitable environment.","1807_C069":"An error occurred during AMS-HT H drying. Please go to Assistant for more details.","1807_C06A":"AMS-HT H is reading RFID. Unable to start drying. Please try again later.","1807_C06B":"AMS-HT H is changing filament. Unable to start drying. Please try again later.","1807_C06C":"AMS-HT H is in Feed Assist Mode. Unable to start drying. Please try again later.","1807_C06D":"AMS-HT H is assisting in filament insertion. Unable to start drying. Please try again later.","1807_C06E":"AMS-HT H motor is performing self-test. Unable to start drying. Please try again later.","18FE_8001":"Failed to cut the filament of the left extruder. Please check the cutter.","18FE_8002":"The cutter of the left extruder is stuck. Please pull out the cutter handle.","18FE_8003":"Please pull out the filament on the spool holder of the left extruder. If this message persists, please check to see if there is filament broken in the extruder. (Connect a PTFE tube if you are ab...","18FE_8004":"Failed to pull back the filament from the left extruder. Please check whether the filament is stuck inside the extruder.","18FE_8005":"Failed to feed the filament outside the AMS-HT. Please clip the end of the filament flat and check to see if the spool is stuck.","18FE_8006":"Please feed filament into the PTFE tube of the left extruder until it can not be pushed any farther.","18FE_8007":"Please observe the nozzle of the left extruder. If the filament has been extruded, select 'Continue'; if it has not, please push the filament forward slightly, and then select 'Retry'.","18FE_8011":"The external filament connected to the left extruder has run out; please load a new filament.","18FE_8012":"Failed to get mapping table; please select 'Resume' to retry.","18FE_8013":"Timeout purging old filament of the left extruder: Please check if the filament is stuck or the extruder is clogged.","18FE_8020":"Extruder change failed; please refer to the assistant.","18FE_8021":"AMS setup failed; please refer to the assistant.","18FE_8024":"Extruder position calibration failed; please refer to the assistant.","18FE_C003":"Please pull out the filament on the spool holder of the left extruder. If this message persists, please check to see if there is filament broken in the extruder or PTFE tube. (Connect a PTFE tube i...","18FE_C006":"Please feed filament into the PTFE tube of the left extruder until it can not be pushed any farther.","18FE_C008":"Please pull out the filament on the spool holder of the left extruder. If this message persists, please check to see if there is filament broken in the extruder or PTFE tube. (Connect a PTFE tube i...","18FE_C009":"Please feed filament into the PTFE tube of the left extruder until it can not be pushed any farther.","18FE_C00A":"Please observe the nozzle of the left extruder. If the filament has been extruded, select 'Continue'; if not, please push the filament forward slightly and then select 'Retry'.","18FF_8001":"Failed to cut the filament of the right extruder. Please check the cutter.","18FF_8002":"The cutter of the right extruder is stuck. Please pull out the cutter handle.","18FF_8003":"Please pull out the filament on the spool holder of the right extruder. If this message persists, please check to see if there is filament broken in the extruder. (Connect a PTFE tube if you are a...","18FF_8004":"Failed to pull back the filament from the right extruder. Please check whether the filament is stuck inside the extruder.","18FF_8005":"Failed to feed the filament outside the AMS-HT. Please clip the end of the filament flat and check to see if the spool is stuck.","18FF_8006":"Please feed filament into the PTFE tube of the right extruder until it can not be pushed any farther.","18FF_8007":"Please observe the nozzle of the right extruder. If the filament has been extruded, select 'Continue'; if it has not, please push the filament forward slightly, and then select 'Retry'.","18FF_8011":"The external filament connected to the right extruder has run out; please load a new filament.","18FF_8012":"Failed to get AMS mapping table; please select 'Resume' to retry.","18FF_8013":"Timeout purging old filament of the right extruder: Please check if the filament is stuck or the extruder is clogged.","18FF_8020":"Extruder change failed; please refer to the assistant.","18FF_8021":"AMS setup failed; please refer to the assistant.","18FF_8024":"Extruder position calibration failed; please refer to the assistant.","18FF_C003":"Please pull out the filament on the spool holder of the right extruder. If this message persists, please check to see if there is filament broken in the extruder or PTFE tube. (Connect a PTFE tube ...","18FF_C006":"Please feed filament into the PTFE tube of the right extruder until it can not be pushed any farther.","18FF_C008":"Please pull out the filament on the spool holder of the right extruder. If this message persists, please check to see if there is filament broken in the extruder or PTFE tube. (Connect a PTFE tube ...","18FF_C009":"Please feed filament into the PTFE tube of the right extruder until it can not be pushed any farther.","18FF_C00A":"Please observe the nozzle of the right extruder. If the filament has been extruded, select 'Continue'; if not, please push the filament forward slightly and then select 'Retry'."};function CAe(t){switch(t){case 1:return{label:"Fatal",color:"text-red-500",bgColor:"bg-red-500/20",Icon:En};case 2:return{label:"Serious",color:"text-red-400",bgColor:"bg-red-500/15",Icon:En};case 3:return{label:"Warning",color:"text-orange-400",bgColor:"bg-orange-500/20",Icon:Ii};default:return{label:"Info",color:"text-blue-400",bgColor:"bg-blue-500/20",Icon:js}}}function O3(t,e){const n=t>>16&65535||(t>>8&255)<<8|t&255,r=e&65535;return`${n.toString(16).padStart(4,"0").toUpperCase()}_${r.toString(16).padStart(4,"0").toUpperCase()}`}function TAe(t){return t.filter(e=>{const n=parseInt(e.code.replace("0x",""),16)||0,r=O3(e.attr,n);return L3[r]!==void 0})}function PAe(){return"https://wiki.bambulab.com/en/hms/home"}function AAe({printerName:t,errors:e,onClose:n,printerId:r,hasPermission:a}){const{t:s}=Mt(),{showToast:o}=bn(),l=ut({mutationFn:()=>be.clearHMSErrors(r),onSuccess:()=>{o(s("hmsErrors.clearSuccess"),"success"),n()},onError:()=>{o(s("hmsErrors.clearFailed"),"error")}}),c=e.filter(d=>{const u=parseInt(d.code.replace("0x",""),16)||0,m=O3(d.attr,u);return L3[m]!==void 0});return w.useEffect(()=>{const d=u=>{u.key==="Escape"&&n()};return window.addEventListener("keydown",d),()=>window.removeEventListener("keydown",d)},[n]),i.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",children:i.jsxs("div",{className:"bg-bambu-dark-secondary rounded-lg shadow-xl max-w-lg w-full max-h-[80vh] flex flex-col",children:[i.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-bambu-dark-tertiary",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(En,{className:"w-5 h-5 text-orange-400"}),i.jsx("h2",{className:"text-lg font-semibold text-white",children:s("hmsErrors.title",{name:t})})]}),i.jsx("button",{onClick:n,className:"p-1 hover:bg-bambu-dark-tertiary rounded-lg transition-colors",children:i.jsx(zt,{className:"w-5 h-5 text-bambu-gray"})})]}),i.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:c.length===0?i.jsxs("div",{className:"text-center py-8 text-bambu-gray",children:[i.jsx(Ii,{className:"w-12 h-12 mx-auto mb-3 opacity-30"}),i.jsx("p",{children:s("hmsErrors.noErrors")})]}):i.jsx("div",{className:"space-y-3",children:c.map((d,u)=>{const{label:m,color:p,bgColor:f,Icon:y}=CAe(d.severity),x=parseInt(d.code.replace("0x",""),16)||0,b=O3(d.attr,x),v=L3[b],_=PAe(),k=b.replace("_","-");return i.jsx("div",{className:`p-4 rounded-lg ${f} border border-white/10`,children:i.jsxs("div",{className:"flex items-start gap-3",children:[i.jsx(y,{className:`w-5 h-5 ${p} flex-shrink-0 mt-0.5`}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[i.jsxs("span",{className:`font-mono text-sm ${p}`,children:["[",k,"]"]}),i.jsx("span",{className:`text-xs px-2 py-0.5 rounded-full ${f} ${p}`,children:m})]}),i.jsx("p",{className:"text-sm text-bambu-gray mb-2",children:v}),i.jsxs("a",{href:_,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-xs text-bambu-green hover:underline",children:[i.jsx(ei,{className:"w-3 h-3"}),s("hmsErrors.viewOnWiki")]})]})]})},`${d.code}-${u}`)})})}),i.jsxs("div",{className:"p-4 border-t border-bambu-dark-tertiary flex items-center justify-between gap-3",children:[i.jsx("p",{className:"text-xs text-bambu-gray",children:s("hmsErrors.clearInstructions")}),c.length>0&&i.jsxs("button",{onClick:()=>l.mutate(),disabled:!a("printers:control")||l.isPending,className:"flex items-center gap-1.5 px-3 py-1.5 text-sm font-medium rounded-lg bg-red-500/20 text-red-400 hover:bg-red-500/30 transition-colors disabled:opacity-50 disabled:cursor-not-allowed flex-shrink-0",children:[l.isPending?i.jsx(ct,{className:"w-4 h-4 animate-spin"}):i.jsx(Qt,{className:"w-4 h-4"}),s("hmsErrors.clearErrors")]})]})]})})}function RQ(t){if(!t)return"/img/printers/default.png";const e=t.toLowerCase().replace(/\s+/g,"");return e.includes("x1e")?"/img/printers/x1e.png":e.includes("x1c")||e.includes("x1carbon")||e.includes("x1")?"/img/printers/x1c.png":e.includes("h2dpro")||e.includes("h2d-pro")?"/img/printers/h2dpro.png":e.includes("h2d")?"/img/printers/h2d.png":e.includes("h2c")?"/img/printers/h2c.png":e.includes("h2s")?"/img/printers/h2d.png":e.includes("p2s")||e.includes("p1s")?"/img/printers/p1s.png":e.includes("p1p")?"/img/printers/p1p.png":e.includes("a1mini")?"/img/printers/a1mini.png":e.includes("a1")?"/img/printers/a1.png":"/img/printers/default.png"}function FQ(t){return t>=-50?{labelKey:"printers.wifiSignal.excellent",color:"text-bambu-green",bars:4}:t>=-60?{labelKey:"printers.wifiSignal.good",color:"text-bambu-green",bars:3}:t>=-70?{labelKey:"printers.wifiSignal.fair",color:"text-yellow-400",bars:2}:t>=-80?{labelKey:"printers.wifiSignal.weak",color:"text-orange-400",bars:1}:{labelKey:"printers.wifiSignal.veryWeak",color:"text-red-400",bars:1}}function LQ(t,e,n){return t.filter(r=>{if(r.required_filament_types&&r.required_filament_types.length>0&&e!==void 0&&!r.required_filament_types.every(a=>e.has(a.toUpperCase())))return!1;if(r.filament_overrides&&r.filament_overrides.length>0&&n!==void 0){const a=r.filament_overrides.filter(o=>o.force_color_match===!0),s=r.filament_overrides.filter(o=>o.force_color_match!==!0);if(a.length>0&&!a.every(l=>{const c=(l.type||"").toUpperCase(),d=(l.color||"").replace("#","").toLowerCase().slice(0,6);return n.has(`${c}:${d}`)})||s.length>0&&a.length===0&&!s.some(l=>{const c=(l.type||"").toUpperCase(),d=(l.color||"").replace("#","").toLowerCase().slice(0,6);return n.has(`${c}:${d}`)}))return!1}return!0})}function MAe({printerId:t,printerModel:e,printerState:n,plateCleared:r,loadedFilamentTypes:a,loadedFilaments:s}){const{t:o}=Mt(),l=tn(),{showToast:c}=bn(),{hasPermission:d}=Rr(),{data:u}=Je({queryKey:["queue",t,"pending",e],queryFn:()=>be.getQueue(t,"pending",e||void 0),refetchInterval:3e4}),m=ut({mutationFn:()=>be.clearPlate(t),onSuccess:()=>{l.invalidateQueries({queryKey:["queue",t]}),l.invalidateQueries({queryKey:["printerStatus",t]}),c(o("queue.clearPlateSuccess"),"success")},onError:_=>{c(_.message,"error")}}),p=u?LQ(u,a,s):void 0,f=p?.filter(_=>!_.manual_start)??[],y=p?.length||0;if(y===0)return null;const x=f[0],b=p?.[0];if((n==="FINISH"||n==="FAILED")&&!r&&f.length>0){const _=x||b;return i.jsxs("div",{className:"mb-3 p-3 bg-bambu-dark rounded-lg border border-yellow-400/30",children:[i.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[i.jsx(Xr,{className:"w-5 h-5 text-yellow-400 flex-shrink-0"}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsx("p",{className:"text-xs text-bambu-gray",children:o("queue.nextInQueue")}),i.jsx("p",{className:"text-sm text-white truncate",children:_?.archive_name||_?.library_file_name||`File #${_?.archive_id||_?.library_file_id}`})]}),y>1&&i.jsxs("span",{className:"text-xs px-1.5 py-0.5 bg-yellow-400/20 text-yellow-400 rounded flex-shrink-0",children:["+",y-1]})]}),m.isSuccess?i.jsxs("div",{className:"w-full py-2 px-3 rounded-lg bg-bambu-green/10 border border-bambu-green/20 text-bambu-green text-sm flex items-center justify-center gap-2",children:[i.jsx(Eb,{className:"w-4 h-4"}),o("queue.plateReady")]}):i.jsxs("button",{onClick:()=>m.mutate(),disabled:m.isPending||!d("printers:clear_plate"),className:"w-full py-2 px-3 rounded-lg bg-bambu-green/20 border border-bambu-green/40 text-bambu-green hover:bg-bambu-green/30 transition-colors text-sm font-medium flex items-center justify-center gap-2 disabled:opacity-50",children:[m.isPending?i.jsx(ct,{className:"w-4 h-4 animate-spin"}):i.jsx(Eb,{className:"w-4 h-4"}),o("queue.clearPlate")]})]})}return i.jsx(Js,{to:"/queue",className:"block mb-3 p-3 bg-bambu-dark rounded-lg hover:bg-bambu-dark-tertiary transition-colors",children:i.jsxs("div",{className:"flex items-center justify-between gap-3",children:[i.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[i.jsx(Xr,{className:"w-5 h-5 text-yellow-400 flex-shrink-0"}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsx("p",{className:"text-xs text-bambu-gray",children:o("queue.nextInQueue")}),i.jsx("p",{className:"text-sm text-white truncate",children:b?.archive_name||b?.library_file_name||`File #${b?.archive_id||b?.library_file_id}`})]})]}),i.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[i.jsxs("span",{className:"text-xs text-bambu-gray flex items-center gap-1",children:[i.jsx(er,{className:"w-3 h-3"}),b?.scheduled_time?zv(b.scheduled_time,"system",o):o("time.waiting")]}),y>1&&i.jsxs("span",{className:"text-xs px-1.5 py-0.5 bg-yellow-400/20 text-yellow-400 rounded",children:["+",y-1]}),i.jsx(pa,{className:"w-4 h-4 text-bambu-gray"})]})]})})}function OQ(t){var e,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var a=t.length;for(e=0;e<a;e++)t[e]&&(n=OQ(t[e]))&&(r&&(r+=" "),r+=n)}else for(n in t)t[n]&&(r&&(r+=" "),r+=n);return r}function pr(){for(var t,e,n=0,r="",a=arguments.length;n<a;n++)(t=arguments[n])&&(e=OQ(t))&&(r&&(r+=" "),r+=e);return r}var EAe=["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 EL(t){if(typeof t!="string")return!1;var e=EAe;return e.includes(t)}var jAe=["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"],DAe=new Set(jAe);function IQ(t){return typeof t!="string"?!1:DAe.has(t)}function zQ(t){return typeof t=="string"&&t.startsWith("data-")}function Is(t){if(typeof t!="object"||t===null)return{};var e={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(IQ(n)||zQ(n))&&(e[n]=t[n]);return e}function Jp(t){if(t==null)return null;if(w.isValidElement(t)&&typeof t.props=="object"&&t.props!==null){var e=t.props;return Is(e)}return typeof t=="object"&&!Array.isArray(t)?Is(t):null}function ns(t){var e={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(IQ(n)||zQ(n)||EL(n))&&(e[n]=t[n]);return e}function RAe(t){return t==null?null:w.isValidElement(t)?ns(t.props):typeof t=="object"&&!Array.isArray(t)?ns(t):null}var FAe=["children","width","height","viewBox","className","style","title","desc"];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 r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},I3.apply(null,arguments)}function LAe(t,e){if(t==null)return{};var n,r,a=OAe(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(r=0;r<s.length;r++)n=s[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(a[n]=t[n])}return a}function OAe(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}var jL=w.forwardRef((t,e)=>{var{children:n,width:r,height:a,viewBox:s,className:o,style:l,title:c,desc:d}=t,u=LAe(t,FAe),m=s||{width:r,height:a,x:0,y:0},p=pr("recharts-surface",o);return w.createElement("svg",I3({},ns(u),{className:p,width:r,height:a,style:l,viewBox:"".concat(m.x," ").concat(m.y," ").concat(m.width," ").concat(m.height),ref:e}),w.createElement("title",null,c),w.createElement("desc",null,d),n)}),IAe=["children","className"];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 r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},z3.apply(null,arguments)}function zAe(t,e){if(t==null)return{};var n,r,a=UAe(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(r=0;r<s.length;r++)n=s[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(a[n]=t[n])}return a}function UAe(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}var _i=w.forwardRef((t,e)=>{var{children:n,className:r}=t,a=zAe(t,IAe),s=pr("recharts-layer",r);return w.createElement("g",z3({className:s},ns(a),{ref:e}),n)}),UQ=w.createContext(null),BAe=()=>w.useContext(UQ);function Jr(t){return function(){return t}}const BQ=Math.cos,lk=Math.sin,lc=Math.sqrt,ck=Math.PI,EC=2*ck,U3=Math.PI,B3=2*U3,rp=1e-6,HAe=B3-rp;function HQ(t){this._+=t[0];for(let e=1,n=t.length;e<n;++e)this._+=arguments[e]+t[e]}function $Ae(t){let e=Math.floor(t);if(!(e>=0))throw new Error(`invalid digits: ${t}`);if(e>15)return HQ;const n=10**e;return function(r){this._+=r[0];for(let a=1,s=r.length;a<s;++a)this._+=Math.round(arguments[a]*n)/n+r[a]}}class qAe{constructor(e){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=e==null?HQ:$Ae(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,r,a){this._append`Q${+e},${+n},${this._x1=+r},${this._y1=+a}`}bezierCurveTo(e,n,r,a,s,o){this._append`C${+e},${+n},${+r},${+a},${this._x1=+s},${this._y1=+o}`}arcTo(e,n,r,a,s){if(e=+e,n=+n,r=+r,a=+a,s=+s,s<0)throw new Error(`negative radius: ${s}`);let o=this._x1,l=this._y1,c=r-e,d=a-n,u=o-e,m=l-n,p=u*u+m*m;if(this._x1===null)this._append`M${this._x1=e},${this._y1=n}`;else if(p>rp)if(!(Math.abs(m*c-d*u)>rp)||!s)this._append`L${this._x1=e},${this._y1=n}`;else{let f=r-o,y=a-l,x=c*c+d*d,b=f*f+y*y,v=Math.sqrt(x),_=Math.sqrt(p),k=s*Math.tan((U3-Math.acos((x+p-b)/(2*v*_)))/2),P=k/_,C=k/v;Math.abs(P-1)>rp&&this._append`L${e+P*u},${n+P*m}`,this._append`A${s},${s},0,0,${+(m*f>u*y)},${this._x1=e+C*c},${this._y1=n+C*d}`}}arc(e,n,r,a,s,o){if(e=+e,n=+n,r=+r,o=!!o,r<0)throw new Error(`negative radius: ${r}`);let l=r*Math.cos(a),c=r*Math.sin(a),d=e+l,u=n+c,m=1^o,p=o?a-s:s-a;this._x1===null?this._append`M${d},${u}`:(Math.abs(this._x1-d)>rp||Math.abs(this._y1-u)>rp)&&this._append`L${d},${u}`,r&&(p<0&&(p=p%B3+B3),p>HAe?this._append`A${r},${r},0,1,${m},${e-l},${n-c}A${r},${r},0,1,${m},${this._x1=d},${this._y1=u}`:p>rp&&this._append`A${r},${r},0,${+(p>=U3)},${m},${this._x1=e+r*Math.cos(s)},${this._y1=n+r*Math.sin(s)}`)}rect(e,n,r,a){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+n}h${r=+r}v${+a}h${-r}Z`}toString(){return this._}}function DL(t){let e=3;return t.digits=function(n){if(!arguments.length)return e;if(n==null)e=null;else{const r=Math.floor(n);if(!(r>=0))throw new RangeError(`invalid digits: ${n}`);e=r}return t},()=>new qAe(e)}function RL(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function $Q(t){this._context=t}$Q.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 jC(t){return new $Q(t)}function qQ(t){return t[0]}function VQ(t){return t[1]}function GQ(t,e){var n=Jr(!0),r=null,a=jC,s=null,o=DL(l);t=typeof t=="function"?t:t===void 0?qQ:Jr(t),e=typeof e=="function"?e:e===void 0?VQ:Jr(e);function l(c){var d,u=(c=RL(c)).length,m,p=!1,f;for(r==null&&(s=a(f=o())),d=0;d<=u;++d)!(d<u&&n(m=c[d],d,c))===p&&((p=!p)?s.lineStart():s.lineEnd()),p&&s.point(+t(m,d,c),+e(m,d,c));if(f)return s=null,f+""||null}return l.x=function(c){return arguments.length?(t=typeof c=="function"?c:Jr(+c),l):t},l.y=function(c){return arguments.length?(e=typeof c=="function"?c:Jr(+c),l):e},l.defined=function(c){return arguments.length?(n=typeof c=="function"?c:Jr(!!c),l):n},l.curve=function(c){return arguments.length?(a=c,r!=null&&(s=a(r)),l):a},l.context=function(c){return arguments.length?(c==null?r=s=null:s=a(r=c),l):r},l}function k_(t,e,n){var r=null,a=Jr(!0),s=null,o=jC,l=null,c=DL(d);t=typeof t=="function"?t:t===void 0?qQ:Jr(+t),e=typeof e=="function"?e:Jr(e===void 0?0:+e),n=typeof n=="function"?n:n===void 0?VQ:Jr(+n);function d(m){var p,f,y,x=(m=RL(m)).length,b,v=!1,_,k=new Array(x),P=new Array(x);for(s==null&&(l=o(_=c())),p=0;p<=x;++p){if(!(p<x&&a(b=m[p],p,m))===v)if(v=!v)f=p,l.areaStart(),l.lineStart();else{for(l.lineEnd(),l.lineStart(),y=p-1;y>=f;--y)l.point(k[y],P[y]);l.lineEnd(),l.areaEnd()}v&&(k[p]=+t(b,p,m),P[p]=+e(b,p,m),l.point(r?+r(b,p,m):k[p],n?+n(b,p,m):P[p]))}if(_)return l=null,_+""||null}function u(){return GQ().defined(a).curve(o).context(s)}return d.x=function(m){return arguments.length?(t=typeof m=="function"?m:Jr(+m),r=null,d):t},d.x0=function(m){return arguments.length?(t=typeof m=="function"?m:Jr(+m),d):t},d.x1=function(m){return arguments.length?(r=m==null?null:typeof m=="function"?m:Jr(+m),d):r},d.y=function(m){return arguments.length?(e=typeof m=="function"?m:Jr(+m),n=null,d):e},d.y0=function(m){return arguments.length?(e=typeof m=="function"?m:Jr(+m),d):e},d.y1=function(m){return arguments.length?(n=m==null?null:typeof m=="function"?m:Jr(+m),d):n},d.lineX0=d.lineY0=function(){return u().x(t).y(e)},d.lineY1=function(){return u().x(t).y(n)},d.lineX1=function(){return u().x(r).y(e)},d.defined=function(m){return arguments.length?(a=typeof m=="function"?m:Jr(!!m),d):a},d.curve=function(m){return arguments.length?(o=m,s!=null&&(l=o(s)),d):o},d.context=function(m){return arguments.length?(m==null?s=l=null:l=o(s=m),d):s},d}class WQ{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 VAe(t){return new WQ(t,!0)}function GAe(t){return new WQ(t,!1)}const FL={draw(t,e){const n=lc(e/ck);t.moveTo(n,0),t.arc(0,0,n,0,EC)}},WAe={draw(t,e){const n=lc(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()}},KQ=lc(1/3),KAe=KQ*2,YAe={draw(t,e){const n=lc(e/KAe),r=n*KQ;t.moveTo(0,-n),t.lineTo(r,0),t.lineTo(0,n),t.lineTo(-r,0),t.closePath()}},XAe={draw(t,e){const n=lc(e),r=-n/2;t.rect(r,r,n,n)}},QAe=.8908130915292852,YQ=lk(ck/10)/lk(7*ck/10),ZAe=lk(EC/10)*YQ,JAe=-BQ(EC/10)*YQ,eMe={draw(t,e){const n=lc(e*QAe),r=ZAe*n,a=JAe*n;t.moveTo(0,-n),t.lineTo(r,a);for(let s=1;s<5;++s){const o=EC*s/5,l=BQ(o),c=lk(o);t.lineTo(c*n,-l*n),t.lineTo(l*r-c*a,c*r+l*a)}t.closePath()}},C2=lc(3),tMe={draw(t,e){const n=-lc(e/(C2*3));t.moveTo(0,n*2),t.lineTo(-C2*n,-n),t.lineTo(C2*n,-n),t.closePath()}},Qo=-.5,Zo=lc(3)/2,H3=1/lc(12),nMe=(H3/2+1)*3,rMe={draw(t,e){const n=lc(e/nMe),r=n/2,a=n*H3,s=r,o=n*H3+n,l=-s,c=o;t.moveTo(r,a),t.lineTo(s,o),t.lineTo(l,c),t.lineTo(Qo*r-Zo*a,Zo*r+Qo*a),t.lineTo(Qo*s-Zo*o,Zo*s+Qo*o),t.lineTo(Qo*l-Zo*c,Zo*l+Qo*c),t.lineTo(Qo*r+Zo*a,Qo*a-Zo*r),t.lineTo(Qo*s+Zo*o,Qo*o-Zo*s),t.lineTo(Qo*l+Zo*c,Qo*c-Zo*l),t.closePath()}};function iMe(t,e){let n=null,r=DL(a);t=typeof t=="function"?t:Jr(t||FL),e=typeof e=="function"?e:Jr(e===void 0?64:+e);function a(){let s;if(n||(n=s=r()),t.apply(this,arguments).draw(n,+e.apply(this,arguments)),s)return n=null,s+""||null}return a.type=function(s){return arguments.length?(t=typeof s=="function"?s:Jr(s),a):t},a.size=function(s){return arguments.length?(e=typeof s=="function"?s:Jr(+s),a):e},a.context=function(s){return arguments.length?(n=s??null,a):n},a}function dk(){}function uk(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 XQ(t){this._context=t}XQ.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:uk(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:uk(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function aMe(t){return new XQ(t)}function QQ(t){this._context=t}QQ.prototype={areaStart:dk,areaEnd:dk,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:uk(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function sMe(t){return new QQ(t)}function ZQ(t){this._context=t}ZQ.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,r=(this._y0+4*this._y1+e)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:uk(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function oMe(t){return new ZQ(t)}function JQ(t){this._context=t}JQ.prototype={areaStart:dk,areaEnd:dk,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 lMe(t){return new JQ(t)}function h$(t){return t<0?-1:1}function p$(t,e,n){var r=t._x1-t._x0,a=e-t._x1,s=(t._y1-t._y0)/(r||a<0&&-0),o=(n-t._y1)/(a||r<0&&-0),l=(s*a+o*r)/(r+a);return(h$(s)+h$(o))*Math.min(Math.abs(s),Math.abs(o),.5*Math.abs(l))||0}function f$(t,e){var n=t._x1-t._x0;return n?(3*(t._y1-t._y0)/n-e)/2:e}function T2(t,e,n){var r=t._x0,a=t._y0,s=t._x1,o=t._y1,l=(s-r)/3;t._context.bezierCurveTo(r+l,a+l*e,s-l,o-l*n,s,o)}function mk(t){this._context=t}mk.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:T2(this,this._t0,f$(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,T2(this,f$(this,n=p$(this,t,e)),n);break;default:T2(this,this._t0,n=p$(this,t,e));break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e,this._t0=n}}};function eZ(t){this._context=new tZ(t)}(eZ.prototype=Object.create(mk.prototype)).point=function(t,e){mk.prototype.point.call(this,e,t)};function tZ(t){this._context=t}tZ.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,r,a,s){this._context.bezierCurveTo(e,t,r,n,s,a)}};function cMe(t){return new mk(t)}function dMe(t){return new eZ(t)}function nZ(t){this._context=t}nZ.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 r=g$(t),a=g$(e),s=0,o=1;o<n;++s,++o)this._context.bezierCurveTo(r[0][s],a[0][s],r[1][s],a[1][s],t[o],e[o]);(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 g$(t){var e,n=t.length-1,r,a=new Array(n),s=new Array(n),o=new Array(n);for(a[0]=0,s[0]=2,o[0]=t[0]+2*t[1],e=1;e<n-1;++e)a[e]=1,s[e]=4,o[e]=4*t[e]+2*t[e+1];for(a[n-1]=2,s[n-1]=7,o[n-1]=8*t[n-1]+t[n],e=1;e<n;++e)r=a[e]/s[e-1],s[e]-=r,o[e]-=r*o[e-1];for(a[n-1]=o[n-1]/s[n-1],e=n-2;e>=0;--e)a[e]=(o[e]-a[e+1])/s[e];for(s[n-1]=(t[n]+a[n-1])/2,e=0;e<n-1;++e)s[e]=2*t[e+1]-a[e+1];return[a,s]}function uMe(t){return new nZ(t)}function DC(t,e){this._context=t,this._t=e}DC.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 mMe(t){return new DC(t,.5)}function hMe(t){return new DC(t,0)}function pMe(t){return new DC(t,1)}function ef(t,e){if((o=t.length)>1)for(var n=1,r,a,s=t[e[0]],o,l=s.length;n<o;++n)for(a=s,s=t[e[n]],r=0;r<l;++r)s[r][1]+=s[r][0]=isNaN(a[r][1])?a[r][0]:a[r][1]}function $3(t){for(var e=t.length,n=new Array(e);--e>=0;)n[e]=e;return n}function fMe(t,e){return t[e]}function gMe(t){const e=[];return e.key=t,e}function bMe(){var t=Jr([]),e=$3,n=ef,r=fMe;function a(s){var o=Array.from(t.apply(this,arguments),gMe),l,c=o.length,d=-1,u;for(const m of s)for(l=0,++d;l<c;++l)(o[l][d]=[0,+r(m,o[l].key,d,s)]).data=m;for(l=0,u=RL(e(o));l<c;++l)o[u[l]].index=l;return n(o,u),o}return a.keys=function(s){return arguments.length?(t=typeof s=="function"?s:Jr(Array.from(s)),a):t},a.value=function(s){return arguments.length?(r=typeof s=="function"?s:Jr(+s),a):r},a.order=function(s){return arguments.length?(e=s==null?$3:typeof s=="function"?s:Jr(Array.from(s)),a):e},a.offset=function(s){return arguments.length?(n=s??ef,a):n},a}function xMe(t,e){if((r=t.length)>0){for(var n,r,a=0,s=t[0].length,o;a<s;++a){for(o=n=0;n<r;++n)o+=t[n][a][1]||0;if(o)for(n=0;n<r;++n)t[n][a][1]/=o}ef(t,e)}}function yMe(t,e){if((a=t.length)>0){for(var n=0,r=t[e[0]],a,s=r.length;n<s;++n){for(var o=0,l=0;o<a;++o)l+=t[o][n][1]||0;r[n][1]+=r[n][0]=-l/2}ef(t,e)}}function vMe(t,e){if(!(!((o=t.length)>0)||!((s=(a=t[e[0]]).length)>0))){for(var n=0,r=1,a,s,o;r<s;++r){for(var l=0,c=0,d=0;l<o;++l){for(var u=t[e[l]],m=u[r][1]||0,p=u[r-1][1]||0,f=(m-p)/2,y=0;y<l;++y){var x=t[e[y]],b=x[r][1]||0,v=x[r-1][1]||0;f+=b-v}c+=m,d+=f*m}a[r-1][1]+=a[r-1][0]=n,c&&(n-=d/c)}a[r-1][1]+=a[r-1][0]=n,ef(t,e)}}var P2={},A2={},b$;function wMe(){return b$||(b$=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function e(n){return n==="__proto__"}t.isUnsafeProperty=e})(A2)),A2}var M2={},x$;function rZ(){return x$||(x$=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})(M2)),M2}var E2={},y$;function LL(){return y$||(y$=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})(E2)),E2}var j2={},D2={},v$;function SMe(){return v$||(v$=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 r=String(n);return r==="0"&&Object.is(Number(n),-0)?"-0":r}t.toString=e})(D2)),D2}var w$;function OL(){return w$||(w$=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=SMe(),n=LL();function r(a){if(Array.isArray(a))return a.map(n.toKey);if(typeof a=="symbol")return[a];a=e.toString(a);const s=[],o=a.length;if(o===0)return s;let l=0,c="",d="",u=!1;for(a.charCodeAt(0)===46&&(s.push(""),l++);l<o;){const m=a[l];d?m==="\\"&&l+1<o?(l++,c+=a[l]):m===d?d="":c+=m:u?m==='"'||m==="'"?d=m:m==="]"?(u=!1,s.push(c),c=""):c+=m:m==="["?(u=!0,c&&(s.push(c),c="")):m==="."?c&&(s.push(c),c=""):c+=m,l++}return c&&s.push(c),s}t.toPath=r})(j2)),j2}var S$;function IL(){return S$||(S$=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=wMe(),n=rZ(),r=LL(),a=OL();function s(l,c,d){if(l==null)return d;switch(typeof c){case"string":{if(e.isUnsafeProperty(c))return d;const u=l[c];return u===void 0?n.isDeepKey(c)?s(l,a.toPath(c),d):d:u}case"number":case"symbol":{typeof c=="number"&&(c=r.toKey(c));const u=l[c];return u===void 0?d:u}default:{if(Array.isArray(c))return o(l,c,d);if(Object.is(c?.valueOf(),-0)?c="-0":c=String(c),e.isUnsafeProperty(c))return d;const u=l[c];return u===void 0?d:u}}}function o(l,c,d){if(c.length===0)return d;let u=l;for(let m=0;m<c.length;m++){if(u==null||e.isUnsafeProperty(c[m]))return d;u=u[c[m]]}return u===void 0?d:u}t.get=s})(P2)),P2}var R2,_$;function _Me(){return _$||(_$=1,R2=IL().get),R2}var kMe=_Me();const tf=Pl(kMe);var NMe=4;function Rm(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:NMe,n=10**e,r=Math.round(t*n)/n;return Object.is(r,-0)?0:r}function ji(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return t.reduce((a,s,o)=>{var l=n[o-1];return typeof l=="string"?a+l+s:l!==void 0?a+Rm(l)+s:a+s},"")}var Ra=t=>t===0?0:t>0?1:-1,ic=t=>typeof t=="number"&&t!=+t,nf=t=>typeof t=="string"&&t.indexOf("%")===t.length-1,Gt=t=>(typeof t=="number"||t instanceof Number)&&!ic(t),Nl=t=>Gt(t)||typeof t=="string",CMe=0,Qv=t=>{var e=++CMe;return"".concat(t||"").concat(e)},bs=function(e,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!Gt(e)&&typeof e!="string")return r;var s;if(nf(e)){if(n==null)return r;var o=e.indexOf("%");s=n*parseFloat(e.slice(0,o))/100}else s=+e;return ic(s)&&(s=r),a&&n!=null&&s>n&&(s=n),s},iZ=t=>{if(!Array.isArray(t))return!1;for(var e=t.length,n={},r=0;r<e;r++)if(!n[String(t[r])])n[String(t[r])]=!0;else return!0;return!1};function Cr(t,e,n){return Gt(t)&&Gt(e)?Rm(t+n*(e-t)):e}function aZ(t,e,n){if(!(!t||!t.length))return t.find(r=>r&&(typeof e=="function"?e(r):tf(r,e))===n)}var fi=t=>t===null||typeof t>"u",U0=t=>fi(t)?t:"".concat(t.charAt(0).toUpperCase()).concat(t.slice(1));function ro(t){return t!=null}function hh(){}var TMe=["type","size","sizeType"];function q3(){return q3=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},q3.apply(null,arguments)}function k$(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),n.push.apply(n,r)}return n}function N$(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?k$(Object(n),!0).forEach(function(r){PMe(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):k$(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function PMe(t,e,n){return(e=AMe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function AMe(t){var e=MMe(t,"string");return typeof e=="symbol"?e:e+""}function MMe(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function EMe(t,e){if(t==null)return{};var n,r,a=jMe(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(r=0;r<s.length;r++)n=s[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(a[n]=t[n])}return a}function jMe(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}var sZ={symbolCircle:FL,symbolCross:WAe,symbolDiamond:YAe,symbolSquare:XAe,symbolStar:eMe,symbolTriangle:tMe,symbolWye:rMe},DMe=Math.PI/180,RMe=t=>{var e="symbol".concat(U0(t));return sZ[e]||FL},FMe=(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 r=18*DMe;return 1.25*t*t*(Math.tan(r)-Math.tan(r*2)*Math.tan(r)**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}},LMe=(t,e)=>{sZ["symbol".concat(U0(t))]=e},zL=t=>{var{type:e="circle",size:n=64,sizeType:r="area"}=t,a=EMe(t,TMe),s=N$(N$({},a),{},{type:e,size:n,sizeType:r}),o="circle";typeof e=="string"&&(o=e);var l=()=>{var p=RMe(o),f=iMe().type(p).size(FMe(n,r,o)),y=f();if(y!==null)return y},{className:c,cx:d,cy:u}=s,m=ns(s);return Gt(d)&&Gt(u)&&Gt(n)?w.createElement("path",q3({},m,{className:pr("recharts-symbols",c),transform:"translate(".concat(d,", ").concat(u,")"),d:l()})):null};zL.registerSymbol=LMe;var oZ=t=>"radius"in t&&"startAngle"in t&&"endAngle"in t,UL=(t,e)=>{if(!t||typeof t=="function"||typeof t=="boolean")return null;var n=t;if(w.isValidElement(t)&&(n=t.props),typeof n!="object"&&typeof n!="function")return null;var r={};return Object.keys(n).forEach(a=>{EL(a)&&(r[a]=(s=>n[a](n,s)))}),r},OMe=(t,e,n)=>r=>(t(e,n,r),null),B0=(t,e,n)=>{if(t===null||typeof t!="object"&&typeof t!="function")return null;var r=null;return Object.keys(t).forEach(a=>{var s=t[a];EL(a)&&typeof s=="function"&&(r||(r={}),r[a]=OMe(s,e,n))}),r};function C$(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),n.push.apply(n,r)}return n}function IMe(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?C$(Object(n),!0).forEach(function(r){zMe(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):C$(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function zMe(t,e,n){return(e=UMe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function UMe(t){var e=BMe(t,"string");return typeof e=="symbol"?e:e+""}function BMe(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function ki(t,e){var n=IMe({},t),r=e,a=Object.keys(e),s=a.reduce((o,l)=>(o[l]===void 0&&r[l]!==void 0&&(o[l]=r[l]),o),n);return s}function hk(){return hk=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},hk.apply(null,arguments)}function T$(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),n.push.apply(n,r)}return n}function HMe(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?T$(Object(n),!0).forEach(function(r){$Me(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):T$(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function $Me(t,e,n){return(e=qMe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function qMe(t){var e=VMe(t,"string");return typeof e=="symbol"?e:e+""}function VMe(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var tl=32,GMe={align:"center",iconSize:14,inactiveColor:"#ccc",layout:"horizontal",verticalAlign:"middle"};function WMe(t){var{data:e,iconType:n,inactiveColor:r}=t,a=tl/2,s=tl/6,o=tl/3,l=e.inactive?r:e.color,c=n??e.type;if(c==="none")return null;if(c==="plainline"){var d;return w.createElement("line",{strokeWidth:4,fill:"none",stroke:l,strokeDasharray:(d=e.payload)===null||d===void 0?void 0:d.strokeDasharray,x1:0,y1:a,x2:tl,y2:a,className:"recharts-legend-icon"})}if(c==="line")return w.createElement("path",{strokeWidth:4,fill:"none",stroke:l,d:"M0,".concat(a,"h").concat(o,`
- A`).concat(s,",").concat(s,",0,1,1,").concat(2*o,",").concat(a,`
- H`).concat(tl,"M").concat(2*o,",").concat(a,`
- A`).concat(s,",").concat(s,",0,1,1,").concat(o,",").concat(a),className:"recharts-legend-icon"});if(c==="rect")return w.createElement("path",{stroke:"none",fill:l,d:"M0,".concat(tl/8,"h").concat(tl,"v").concat(tl*3/4,"h").concat(-tl,"z"),className:"recharts-legend-icon"});if(w.isValidElement(e.legendIcon)){var u=HMe({},e);return delete u.legendIcon,w.cloneElement(e.legendIcon,u)}return w.createElement(zL,{fill:l,cx:a,cy:a,size:tl,sizeType:"diameter",type:c})}function KMe(t){var{payload:e,iconSize:n,layout:r,formatter:a,inactiveColor:s,iconType:o}=t,l={x:0,y:0,width:tl,height:tl},c={display:r==="horizontal"?"inline-block":"block",marginRight:10},d={display:"inline-block",verticalAlign:"middle",marginRight:4};return e.map((u,m)=>{var p=u.formatter||a,f=pr({"recharts-legend-item":!0,["legend-item-".concat(m)]:!0,inactive:u.inactive});if(u.type==="none")return null;var y=u.inactive?s:u.color,x=p?p(u.value,u,m):u.value;return w.createElement("li",hk({className:f,style:c,key:"legend-item-".concat(m)},B0(t,u,m)),w.createElement(jL,{width:n,height:n,viewBox:l,style:d,"aria-label":"".concat(x," legend icon")},w.createElement(WMe,{data:u,iconType:o,inactiveColor:s})),w.createElement("span",{className:"recharts-legend-item-text",style:{color:y}},x))})}var YMe=t=>{var e=ki(t,GMe),{payload:n,layout:r,align:a}=e;if(!n||!n.length)return null;var s={padding:0,margin:0,textAlign:r==="horizontal"?a:"left"};return w.createElement("ul",{className:"recharts-default-legend",style:s},w.createElement(KMe,hk({},e,{payload:n})))},F2={},L2={},P$;function XMe(){return P$||(P$=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function e(n,r){const a=new Map;for(let s=0;s<n.length;s++){const o=n[s],l=r(o,s,n);a.has(l)||a.set(l,o)}return Array.from(a.values())}t.uniqBy=e})(L2)),L2}var O2={},A$;function QMe(){return A$||(A$=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function e(n,r){return function(...a){return n.apply(this,a.slice(0,r))}}t.ary=e})(O2)),O2}var I2={},M$;function lZ(){return M$||(M$=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function e(n){return n}t.identity=e})(I2)),I2}var z2={},U2={},B2={},E$;function ZMe(){return E$||(E$=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function e(n){return Number.isSafeInteger(n)&&n>=0}t.isLength=e})(B2)),B2}var j$;function BL(){return j$||(j$=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=ZMe();function n(r){return r!=null&&typeof r!="function"&&e.isLength(r.length)}t.isArrayLike=n})(U2)),U2}var H2={},D$;function JMe(){return D$||(D$=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function e(n){return typeof n=="object"&&n!==null}t.isObjectLike=e})(H2)),H2}var R$;function e2e(){return R$||(R$=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=BL(),n=JMe();function r(a){return n.isObjectLike(a)&&e.isArrayLike(a)}t.isArrayLikeObject=r})(z2)),z2}var $2={},q2={},F$;function t2e(){return F$||(F$=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=IL();function n(r){return function(a){return e.get(a,r)}}t.property=n})(q2)),q2}var V2={},G2={},W2={},K2={},L$;function cZ(){return L$||(L$=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})(K2)),K2}var Y2={},O$;function dZ(){return O$||(O$=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})(Y2)),Y2}var X2={},I$;function uZ(){return I$||(I$=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function e(n,r){return n===r||Number.isNaN(n)&&Number.isNaN(r)}t.isEqualsSameValueZero=e})(X2)),X2}var z$;function n2e(){return z$||(z$=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=cZ(),n=dZ(),r=uZ();function a(u,m,p){return typeof p!="function"?a(u,m,()=>{}):s(u,m,function f(y,x,b,v,_,k){const P=p(y,x,b,v,_,k);return P!==void 0?!!P:s(y,x,f,k)},new Map)}function s(u,m,p,f){if(m===u)return!0;switch(typeof m){case"object":return o(u,m,p,f);case"function":return Object.keys(m).length>0?s(u,{...m},p,f):r.isEqualsSameValueZero(u,m);default:return e.isObject(u)?typeof m=="string"?m==="":!0:r.isEqualsSameValueZero(u,m)}}function o(u,m,p,f){if(m==null)return!0;if(Array.isArray(m))return c(u,m,p,f);if(m instanceof Map)return l(u,m,p,f);if(m instanceof Set)return d(u,m,p,f);const y=Object.keys(m);if(u==null||n.isPrimitive(u))return y.length===0;if(y.length===0)return!0;if(f?.has(m))return f.get(m)===u;f?.set(m,u);try{for(let x=0;x<y.length;x++){const b=y[x];if(!n.isPrimitive(u)&&!(b in u)||m[b]===void 0&&u[b]!==void 0||m[b]===null&&u[b]!==null||!p(u[b],m[b],b,u,m,f))return!1}return!0}finally{f?.delete(m)}}function l(u,m,p,f){if(m.size===0)return!0;if(!(u instanceof Map))return!1;for(const[y,x]of m.entries()){const b=u.get(y);if(p(b,x,y,u,m,f)===!1)return!1}return!0}function c(u,m,p,f){if(m.length===0)return!0;if(!Array.isArray(u))return!1;const y=new Set;for(let x=0;x<m.length;x++){const b=m[x];let v=!1;for(let _=0;_<u.length;_++){if(y.has(_))continue;const k=u[_];let P=!1;if(p(k,b,x,u,m,f)&&(P=!0),P){y.add(_),v=!0;break}}if(!v)return!1}return!0}function d(u,m,p,f){return m.size===0?!0:u instanceof Set?c([...u],[...m],p,f):!1}t.isMatchWith=a,t.isSetMatch=d})(W2)),W2}var U$;function mZ(){return U$||(U$=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=n2e();function n(r,a){return e.isMatchWith(r,a,()=>{})}t.isMatch=n})(G2)),G2}var Q2={},Z2={},J2={},B$;function r2e(){return B$||(B$=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function e(n){return Object.getOwnPropertySymbols(n).filter(r=>Object.prototype.propertyIsEnumerable.call(n,r))}t.getSymbols=e})(J2)),J2}var eE={},H$;function HL(){return H$||(H$=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})(eE)),eE}var tE={},$$;function hZ(){return $$||($$=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e="[object RegExp]",n="[object String]",r="[object Number]",a="[object Boolean]",s="[object Arguments]",o="[object Symbol]",l="[object Date]",c="[object Map]",d="[object Set]",u="[object Array]",m="[object Function]",p="[object ArrayBuffer]",f="[object Object]",y="[object Error]",x="[object DataView]",b="[object Uint8Array]",v="[object Uint8ClampedArray]",_="[object Uint16Array]",k="[object Uint32Array]",P="[object BigUint64Array]",C="[object Int8Array]",T="[object Int16Array]",N="[object Int32Array]",R="[object BigInt64Array]",A="[object Float32Array]",D="[object Float64Array]";t.argumentsTag=s,t.arrayBufferTag=p,t.arrayTag=u,t.bigInt64ArrayTag=R,t.bigUint64ArrayTag=P,t.booleanTag=a,t.dataViewTag=x,t.dateTag=l,t.errorTag=y,t.float32ArrayTag=A,t.float64ArrayTag=D,t.functionTag=m,t.int16ArrayTag=T,t.int32ArrayTag=N,t.int8ArrayTag=C,t.mapTag=c,t.numberTag=r,t.objectTag=f,t.regexpTag=e,t.setTag=d,t.stringTag=n,t.symbolTag=o,t.uint16ArrayTag=_,t.uint32ArrayTag=k,t.uint8ArrayTag=b,t.uint8ClampedArrayTag=v})(tE)),tE}var nE={},q$;function i2e(){return q$||(q$=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function e(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}t.isTypedArray=e})(nE)),nE}var V$;function pZ(){return V$||(V$=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=r2e(),n=HL(),r=hZ(),a=dZ(),s=i2e();function o(u,m){return l(u,void 0,u,new Map,m)}function l(u,m,p,f=new Map,y=void 0){const x=y?.(u,m,p,f);if(x!==void 0)return x;if(a.isPrimitive(u))return u;if(f.has(u))return f.get(u);if(Array.isArray(u)){const b=new Array(u.length);f.set(u,b);for(let v=0;v<u.length;v++)b[v]=l(u[v],v,p,f,y);return Object.hasOwn(u,"index")&&(b.index=u.index),Object.hasOwn(u,"input")&&(b.input=u.input),b}if(u instanceof Date)return new Date(u.getTime());if(u instanceof RegExp){const b=new RegExp(u.source,u.flags);return b.lastIndex=u.lastIndex,b}if(u instanceof Map){const b=new Map;f.set(u,b);for(const[v,_]of u)b.set(v,l(_,v,p,f,y));return b}if(u instanceof Set){const b=new Set;f.set(u,b);for(const v of u)b.add(l(v,void 0,p,f,y));return b}if(typeof Buffer<"u"&&Buffer.isBuffer(u))return u.subarray();if(s.isTypedArray(u)){const b=new(Object.getPrototypeOf(u)).constructor(u.length);f.set(u,b);for(let v=0;v<u.length;v++)b[v]=l(u[v],v,p,f,y);return b}if(u instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&u instanceof SharedArrayBuffer)return u.slice(0);if(u instanceof DataView){const b=new DataView(u.buffer.slice(0),u.byteOffset,u.byteLength);return f.set(u,b),c(b,u,p,f,y),b}if(typeof File<"u"&&u instanceof File){const b=new File([u],u.name,{type:u.type});return f.set(u,b),c(b,u,p,f,y),b}if(typeof Blob<"u"&&u instanceof Blob){const b=new Blob([u],{type:u.type});return f.set(u,b),c(b,u,p,f,y),b}if(u instanceof Error){const b=new u.constructor;return f.set(u,b),b.message=u.message,b.name=u.name,b.stack=u.stack,b.cause=u.cause,c(b,u,p,f,y),b}if(u instanceof Boolean){const b=new Boolean(u.valueOf());return f.set(u,b),c(b,u,p,f,y),b}if(u instanceof Number){const b=new Number(u.valueOf());return f.set(u,b),c(b,u,p,f,y),b}if(u instanceof String){const b=new String(u.valueOf());return f.set(u,b),c(b,u,p,f,y),b}if(typeof u=="object"&&d(u)){const b=Object.create(Object.getPrototypeOf(u));return f.set(u,b),c(b,u,p,f,y),b}return u}function c(u,m,p=u,f,y){const x=[...Object.keys(m),...e.getSymbols(m)];for(let b=0;b<x.length;b++){const v=x[b],_=Object.getOwnPropertyDescriptor(u,v);(_==null||_.writable)&&(u[v]=l(m[v],v,p,f,y))}}function d(u){switch(n.getTag(u)){case r.argumentsTag:case r.arrayTag:case r.arrayBufferTag:case r.dataViewTag:case r.booleanTag:case r.dateTag:case r.float32ArrayTag:case r.float64ArrayTag:case r.int8ArrayTag:case r.int16ArrayTag:case r.int32ArrayTag:case r.mapTag:case r.numberTag:case r.objectTag:case r.regexpTag:case r.setTag:case r.stringTag:case r.symbolTag:case r.uint8ArrayTag:case r.uint8ClampedArrayTag:case r.uint16ArrayTag:case r.uint32ArrayTag:return!0;default:return!1}}t.cloneDeepWith=o,t.cloneDeepWithImpl=l,t.copyProperties=c})(Z2)),Z2}var G$;function a2e(){return G$||(G$=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=pZ();function n(r){return e.cloneDeepWithImpl(r,void 0,r,new Map,void 0)}t.cloneDeep=n})(Q2)),Q2}var W$;function s2e(){return W$||(W$=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=mZ(),n=a2e();function r(a){return a=n.cloneDeep(a),s=>e.isMatch(s,a)}t.matches=r})(V2)),V2}var rE={},iE={},aE={},K$;function o2e(){return K$||(K$=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=pZ(),n=HL(),r=hZ();function a(s,o){return e.cloneDeepWith(s,(l,c,d,u)=>{const m=o?.(l,c,d,u);if(m!==void 0)return m;if(typeof s=="object"){if(n.getTag(s)===r.objectTag&&typeof s.constructor!="function"){const p={};return u.set(s,p),e.copyProperties(p,s,d,u),p}switch(Object.prototype.toString.call(s)){case r.numberTag:case r.stringTag:case r.booleanTag:{const p=new s.constructor(s?.valueOf());return e.copyProperties(p,s),p}case r.argumentsTag:{const p={};return e.copyProperties(p,s),p.length=s.length,p[Symbol.iterator]=s[Symbol.iterator],p}default:return}}})}t.cloneDeepWith=a})(aE)),aE}var Y$;function l2e(){return Y$||(Y$=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=o2e();function n(r){return e.cloneDeepWith(r)}t.cloneDeep=n})(iE)),iE}var sE={},oE={},X$;function fZ(){return X$||(X$=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=/^(?:0|[1-9]\d*)$/;function n(r,a=Number.MAX_SAFE_INTEGER){switch(typeof r){case"number":return Number.isInteger(r)&&r>=0&&r<a;case"symbol":return!1;case"string":return e.test(r)}}t.isIndex=n})(oE)),oE}var lE={},Q$;function c2e(){return Q$||(Q$=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=HL();function n(r){return r!==null&&typeof r=="object"&&e.getTag(r)==="[object Arguments]"}t.isArguments=n})(lE)),lE}var Z$;function d2e(){return Z$||(Z$=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=rZ(),n=fZ(),r=c2e(),a=OL();function s(o,l){let c;if(Array.isArray(l)?c=l:typeof l=="string"&&e.isDeepKey(l)&&o?.[l]==null?c=a.toPath(l):c=[l],c.length===0)return!1;let d=o;for(let u=0;u<c.length;u++){const m=c[u];if((d==null||!Object.hasOwn(d,m))&&!((Array.isArray(d)||r.isArguments(d))&&n.isIndex(m)&&m<d.length))return!1;d=d[m]}return!0}t.has=s})(sE)),sE}var J$;function u2e(){return J$||(J$=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=mZ(),n=LL(),r=l2e(),a=IL(),s=d2e();function o(l,c){switch(typeof l){case"object":{Object.is(l?.valueOf(),-0)&&(l="-0");break}case"number":{l=n.toKey(l);break}}return c=r.cloneDeep(c),function(d){const u=a.get(d,l);return u===void 0?s.has(d,l):c===void 0?u===void 0:e.isMatch(u,c)}}t.matchesProperty=o})(rE)),rE}var eq;function m2e(){return eq||(eq=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=lZ(),n=t2e(),r=s2e(),a=u2e();function s(o){if(o==null)return e.identity;switch(typeof o){case"function":return o;case"object":return Array.isArray(o)&&o.length===2?a.matchesProperty(o[0],o[1]):r.matches(o);case"string":case"symbol":case"number":return n.property(o)}}t.iteratee=s})($2)),$2}var tq;function h2e(){return tq||(tq=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=XMe(),n=QMe(),r=lZ(),a=e2e(),s=m2e();function o(l,c=r.identity){return a.isArrayLikeObject(l)?e.uniqBy(Array.from(l),n.ary(s.iteratee(c),1)):[]}t.uniqBy=o})(F2)),F2}var cE,nq;function p2e(){return nq||(nq=1,cE=h2e().uniqBy),cE}var f2e=p2e();const rq=Pl(f2e);function gZ(t,e,n){return e===!0?rq(t,n):typeof e=="function"?rq(t,e):t}var dE={exports:{}},uE={};var iq;function g2e(){if(iq)return uE;iq=1;var t=pf(),e=eY();function n(d,u){return d===u&&(d!==0||1/d===1/u)||d!==d&&u!==u}var r=typeof Object.is=="function"?Object.is:n,a=e.useSyncExternalStore,s=t.useRef,o=t.useEffect,l=t.useMemo,c=t.useDebugValue;return uE.useSyncExternalStoreWithSelector=function(d,u,m,p,f){var y=s(null);if(y.current===null){var x={hasValue:!1,value:null};y.current=x}else x=y.current;y=l(function(){function v(T){if(!_){if(_=!0,k=T,T=p(T),f!==void 0&&x.hasValue){var N=x.value;if(f(N,T))return P=N}return P=T}if(N=P,r(k,T))return N;var R=p(T);return f!==void 0&&f(N,R)?(k=T,N):(k=T,P=R)}var _=!1,k,P,C=m===void 0?null:m;return[function(){return v(u())},C===null?void 0:function(){return v(C())}]},[u,m,p,f]);var b=a(d,y[0],y[1]);return o(function(){x.hasValue=!0,x.value=b},[b]),c(b),b},uE}var aq;function b2e(){return aq||(aq=1,dE.exports=g2e()),dE.exports}var bZ=b2e(),$L=w.createContext(null),x2e=t=>t,Zr=()=>{var t=w.useContext($L);return t?t.store.dispatch:x2e},v1=()=>{},y2e=()=>v1,v2e=(t,e)=>t===e;function Kt(t){var e=w.useContext($L),n=w.useMemo(()=>e?r=>{if(r!=null)return t(r)}:v1,[e,t]);return bZ.useSyncExternalStoreWithSelector(e?e.subscription.addNestedSub:y2e,e?e.store.getState:v1,e?e.store.getState:v1,n,v2e)}function w2e(t,e=`expected a function, instead received ${typeof t}`){if(typeof t!="function")throw new TypeError(e)}function S2e(t,e=`expected an object, instead received ${typeof t}`){if(typeof t!="object")throw new TypeError(e)}function _2e(t,e="expected all items to be functions, instead received the following types: "){if(!t.every(n=>typeof n=="function")){const n=t.map(r=>typeof r=="function"?`function ${r.name||"unnamed"}()`:typeof r).join(", ");throw new TypeError(`${e}[${n}]`)}}var sq=t=>Array.isArray(t)?t:[t];function k2e(t){const e=Array.isArray(t[0])?t[0]:t;return _2e(e,"createSelector expects all input-selectors to be functions, but received the following types: "),e}function N2e(t,e){const n=[],{length:r}=t;for(let a=0;a<r;a++)n.push(t[a].apply(null,e));return n}var C2e=class{constructor(t){this.value=t}deref(){return this.value}},T2e=typeof WeakRef<"u"?WeakRef:C2e,P2e=0,oq=1;function N_(){return{s:P2e,v:void 0,o:null,p:null}}function xZ(t,e={}){let n=N_();const{resultEqualityCheck:r}=e;let a,s=0;function o(){let l=n;const{length:c}=arguments;for(let m=0,p=c;m<p;m++){const f=arguments[m];if(typeof f=="function"||typeof f=="object"&&f!==null){let y=l.o;y===null&&(l.o=y=new WeakMap);const x=y.get(f);x===void 0?(l=N_(),y.set(f,l)):l=x}else{let y=l.p;y===null&&(l.p=y=new Map);const x=y.get(f);x===void 0?(l=N_(),y.set(f,l)):l=x}}const d=l;let u;if(l.s===oq)u=l.v;else if(u=t.apply(null,arguments),s++,r){const m=a?.deref?.()??a;m!=null&&r(m,u)&&(u=m,s!==0&&s--),a=typeof u=="object"&&u!==null||typeof u=="function"?new T2e(u):u}return d.s=oq,d.v=u,u}return o.clearCache=()=>{n=N_(),o.resetResultsCount()},o.resultsCount=()=>s,o.resetResultsCount=()=>{s=0},o}function A2e(t,...e){const n=typeof t=="function"?{memoize:t,memoizeOptions:e}:t,r=(...a)=>{let s=0,o=0,l,c={},d=a.pop();typeof d=="object"&&(c=d,d=a.pop()),w2e(d,`createSelector expects an output function after the inputs, but received: [${typeof d}]`);const u={...n,...c},{memoize:m,memoizeOptions:p=[],argsMemoize:f=xZ,argsMemoizeOptions:y=[]}=u,x=sq(p),b=sq(y),v=k2e(a),_=m(function(){return s++,d.apply(null,arguments)},...x),k=f(function(){o++;const C=N2e(v,arguments);return l=_.apply(null,C),l},...b);return Object.assign(k,{resultFunc:d,memoizedResultFunc:_,dependencies:v,dependencyRecomputations:()=>o,resetDependencyRecomputations:()=>{o=0},lastResult:()=>l,recomputations:()=>s,resetRecomputations:()=>{s=0},memoize:m,argsMemoize:f})};return Object.assign(r,{withTypes:()=>r}),r}var pt=A2e(xZ),M2e=Object.assign((t,e=pt)=>{S2e(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),r=n.map(s=>t[s]);return e(r,(...s)=>s.reduce((o,l,c)=>(o[n[c]]=l,o),{}))},{withTypes:()=>M2e}),mE={},hE={},pE={},lq;function E2e(){return lq||(lq=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function e(r){return typeof r=="symbol"?1:r===null?2:r===void 0?3:r!==r?4:0}const n=(r,a,s)=>{if(r!==a){const o=e(r),l=e(a);if(o===l&&o===0){if(r<a)return s==="desc"?1:-1;if(r>a)return s==="desc"?-1:1}return s==="desc"?l-o:o-l}return 0};t.compareValues=n})(pE)),pE}var fE={},gE={},cq;function yZ(){return cq||(cq=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function e(n){return typeof n=="symbol"||n instanceof Symbol}t.isSymbol=e})(gE)),gE}var dq;function j2e(){return dq||(dq=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=yZ(),n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,r=/^\w*$/;function a(s,o){return Array.isArray(s)?!1:typeof s=="number"||typeof s=="boolean"||s==null||e.isSymbol(s)?!0:typeof s=="string"&&(r.test(s)||!n.test(s))||o!=null&&Object.hasOwn(o,s)}t.isKey=a})(fE)),fE}var uq;function D2e(){return uq||(uq=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=E2e(),n=j2e(),r=OL();function a(s,o,l,c){if(s==null)return[];l=c?void 0:l,Array.isArray(s)||(s=Object.values(s)),Array.isArray(o)||(o=o==null?[null]:[o]),o.length===0&&(o=[null]),Array.isArray(l)||(l=l==null?[]:[l]),l=l.map(f=>String(f));const d=(f,y)=>{let x=f;for(let b=0;b<y.length&&x!=null;++b)x=x[y[b]];return x},u=(f,y)=>y==null||f==null?y:typeof f=="object"&&"key"in f?Object.hasOwn(y,f.key)?y[f.key]:d(y,f.path):typeof f=="function"?f(y):Array.isArray(f)?d(y,f):typeof y=="object"?y[f]:y,m=o.map(f=>(Array.isArray(f)&&f.length===1&&(f=f[0]),f==null||typeof f=="function"||Array.isArray(f)||n.isKey(f)?f:{key:f,path:r.toPath(f)}));return s.map(f=>({original:f,criteria:m.map(y=>u(y,f))})).slice().sort((f,y)=>{for(let x=0;x<m.length;x++){const b=e.compareValues(f.criteria[x],y.criteria[x],l[x]);if(b!==0)return b}return 0}).map(f=>f.original)}t.orderBy=a})(hE)),hE}var bE={},mq;function R2e(){return mq||(mq=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function e(n,r=1){const a=[],s=Math.floor(r),o=(l,c)=>{for(let d=0;d<l.length;d++){const u=l[d];Array.isArray(u)&&c<s?o(u,c+1):a.push(u)}};return o(n,0),a}t.flatten=e})(bE)),bE}var xE={},hq;function vZ(){return hq||(hq=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=fZ(),n=BL(),r=cZ(),a=uZ();function s(o,l,c){return r.isObject(c)&&(typeof l=="number"&&n.isArrayLike(c)&&e.isIndex(l)&&l<c.length||typeof l=="string"&&l in c)?a.isEqualsSameValueZero(c[l],o):!1}t.isIterateeCall=s})(xE)),xE}var pq;function F2e(){return pq||(pq=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=D2e(),n=R2e(),r=vZ();function a(s,...o){const l=o.length;return l>1&&r.isIterateeCall(s,o[0],o[1])?o=[]:l>2&&r.isIterateeCall(o[0],o[1],o[2])&&(o=[o[0]]),e.orderBy(s,n.flatten(o),["asc"])}t.sortBy=a})(mE)),mE}var yE,fq;function L2e(){return fq||(fq=1,yE=F2e().sortBy),yE}var O2e=L2e();const RC=Pl(O2e);var wZ=t=>t.legend.settings,I2e=t=>t.legend.size,z2e=t=>t.legend.payload,U2e=pt([z2e,wZ],(t,e)=>{var{itemSorter:n}=e,r=t.flat(1);return n?RC(r,n):r});function B2e(){return Kt(U2e)}var C_=1;function SZ(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],[e,n]=w.useState({height:0,left:0,top:0,width:0}),r=w.useCallback(a=>{if(a!=null){var s=a.getBoundingClientRect(),o={height:s.height,left:s.left,top:s.top,width:s.width};(Math.abs(o.height-e.height)>C_||Math.abs(o.left-e.left)>C_||Math.abs(o.top-e.top)>C_||Math.abs(o.width-e.width)>C_)&&n({height:o.height,left:o.left,top:o.top,width:o.width})}},[e.width,e.height,e.top,e.left,...t]);return[e,r]}function Wa(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 H2e=typeof Symbol=="function"&&Symbol.observable||"@@observable",gq=H2e,vE=()=>Math.random().toString(36).substring(7).split("").join("."),$2e={INIT:`@@redux/INIT${vE()}`,REPLACE:`@@redux/REPLACE${vE()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${vE()}`},pk=$2e;function qL(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 _Z(t,e,n){if(typeof t!="function")throw new Error(Wa(2));if(typeof e=="function"&&typeof n=="function"||typeof n=="function"&&typeof arguments[3]=="function")throw new Error(Wa(0));if(typeof e=="function"&&typeof n>"u"&&(n=e,e=void 0),typeof n<"u"){if(typeof n!="function")throw new Error(Wa(1));return n(_Z)(t,e)}let r=t,a=e,s=new Map,o=s,l=0,c=!1;function d(){o===s&&(o=new Map,s.forEach((b,v)=>{o.set(v,b)}))}function u(){if(c)throw new Error(Wa(3));return a}function m(b){if(typeof b!="function")throw new Error(Wa(4));if(c)throw new Error(Wa(5));let v=!0;d();const _=l++;return o.set(_,b),function(){if(v){if(c)throw new Error(Wa(6));v=!1,d(),o.delete(_),s=null}}}function p(b){if(!qL(b))throw new Error(Wa(7));if(typeof b.type>"u")throw new Error(Wa(8));if(typeof b.type!="string")throw new Error(Wa(17));if(c)throw new Error(Wa(9));try{c=!0,a=r(a,b)}finally{c=!1}return(s=o).forEach(_=>{_()}),b}function f(b){if(typeof b!="function")throw new Error(Wa(10));r=b,p({type:pk.REPLACE})}function y(){const b=m;return{subscribe(v){if(typeof v!="object"||v===null)throw new Error(Wa(11));function _(){const P=v;P.next&&P.next(u())}return _(),{unsubscribe:b(_)}},[gq](){return this}}}return p({type:pk.INIT}),{dispatch:p,subscribe:m,getState:u,replaceReducer:f,[gq]:y}}function q2e(t){Object.keys(t).forEach(e=>{const n=t[e];if(typeof n(void 0,{type:pk.INIT})>"u")throw new Error(Wa(12));if(typeof n(void 0,{type:pk.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(Wa(13))})}function kZ(t){const e=Object.keys(t),n={};for(let s=0;s<e.length;s++){const o=e[s];typeof t[o]=="function"&&(n[o]=t[o])}const r=Object.keys(n);let a;try{q2e(n)}catch(s){a=s}return function(o={},l){if(a)throw a;let c=!1;const d={};for(let u=0;u<r.length;u++){const m=r[u],p=n[m],f=o[m],y=p(f,l);if(typeof y>"u")throw l&&l.type,new Error(Wa(14));d[m]=y,c=c||y!==f}return c=c||r.length!==Object.keys(o).length,c?d:o}}function fk(...t){return t.length===0?e=>e:t.length===1?t[0]:t.reduce((e,n)=>(...r)=>e(n(...r)))}function V2e(...t){return e=>(n,r)=>{const a=e(n,r);let s=()=>{throw new Error(Wa(15))};const o={getState:a.getState,dispatch:(c,...d)=>s(c,...d)},l=t.map(c=>c(o));return s=fk(...l)(a.dispatch),{...a,dispatch:s}}}function NZ(t){return qL(t)&&"type"in t&&typeof t.type=="string"}var CZ=Symbol.for("immer-nothing"),bq=Symbol.for("immer-draftable"),zs=Symbol.for("immer-state");function Gl(t,...e){throw new Error(`[Immer] minified error nr: ${t}. Full error at: https://bit.ly/3cXEKWf`)}var jo=Object,Hb=jo.getPrototypeOf,gk="constructor",FC="prototype",V3="configurable",bk="enumerable",w1="writable",Zv="value",pu=t=>!!t&&!!t[zs];function ac(t){return t?TZ(t)||OC(t)||!!t[bq]||!!t[gk]?.[bq]||IC(t)||zC(t):!1}var G2e=jo[FC][gk].toString(),xq=new WeakMap;function TZ(t){if(!t||!VL(t))return!1;const e=Hb(t);if(e===null||e===jo[FC])return!0;const n=jo.hasOwnProperty.call(e,gk)&&e[gk];if(n===Object)return!0;if(!Zg(n))return!1;let r=xq.get(n);return r===void 0&&(r=Function.toString.call(n),xq.set(n,r)),r===G2e}function LC(t,e,n=!0){H0(t)===0?(n?Reflect.ownKeys(t):jo.keys(t)).forEach(a=>{e(a,t[a],t)}):t.forEach((r,a)=>e(a,r,t))}function H0(t){const e=t[zs];return e?e.type_:OC(t)?1:IC(t)?2:zC(t)?3:0}var yq=(t,e,n=H0(t))=>n===2?t.has(e):jo[FC].hasOwnProperty.call(t,e),G3=(t,e,n=H0(t))=>n===2?t.get(e):t[e],xk=(t,e,n,r=H0(t))=>{r===2?t.set(e,n):r===3?t.add(n):t[e]=n};function W2e(t,e){return t===e?t!==0||1/t===1/e:t!==t&&e!==e}var OC=Array.isArray,IC=t=>t instanceof Map,zC=t=>t instanceof Set,VL=t=>typeof t=="object",Zg=t=>typeof t=="function",wE=t=>typeof t=="boolean";function K2e(t){const e=+t;return Number.isInteger(e)&&String(e)===t}var Ud=t=>t.copy_||t.base_,GL=t=>t.modified_?t.copy_:t.base_;function W3(t,e){if(IC(t))return new Map(t);if(zC(t))return new Set(t);if(OC(t))return Array[FC].slice.call(t);const n=TZ(t);if(e===!0||e==="class_only"&&!n){const r=jo.getOwnPropertyDescriptors(t);delete r[zs];let a=Reflect.ownKeys(r);for(let s=0;s<a.length;s++){const o=a[s],l=r[o];l[w1]===!1&&(l[w1]=!0,l[V3]=!0),(l.get||l.set)&&(r[o]={[V3]:!0,[w1]:!0,[bk]:l[bk],[Zv]:t[o]})}return jo.create(Hb(t),r)}else{const r=Hb(t);if(r!==null&&n)return{...t};const a=jo.create(r);return jo.assign(a,t)}}function WL(t,e=!1){return UC(t)||pu(t)||!ac(t)||(H0(t)>1&&jo.defineProperties(t,{set:T_,add:T_,clear:T_,delete:T_}),jo.freeze(t),e&&LC(t,(n,r)=>{WL(r,!0)},!1)),t}function Y2e(){Gl(2)}var T_={[Zv]:Y2e};function UC(t){return t===null||!VL(t)?!0:jo.isFrozen(t)}var yk="MapSet",K3="Patches",vq="ArrayMethods",PZ={};function rf(t){const e=PZ[t];return e||Gl(0,t),e}var wq=t=>!!PZ[t],Jv,AZ=()=>Jv,X2e=(t,e)=>({drafts_:[],parent_:t,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:wq(yk)?rf(yk):void 0,arrayMethodsPlugin_:wq(vq)?rf(vq):void 0});function Sq(t,e){e&&(t.patchPlugin_=rf(K3),t.patches_=[],t.inversePatches_=[],t.patchListener_=e)}function Y3(t){X3(t),t.drafts_.forEach(Q2e),t.drafts_=null}function X3(t){t===Jv&&(Jv=t.parent_)}var _q=t=>Jv=X2e(Jv,t);function Q2e(t){const e=t[zs];e.type_===0||e.type_===1?e.revoke_():e.revoked_=!0}function kq(t,e){e.unfinalizedDrafts_=e.drafts_.length;const n=e.drafts_[0];if(t!==void 0&&t!==n){n[zs].modified_&&(Y3(e),Gl(4)),ac(t)&&(t=Nq(e,t));const{patchPlugin_:a}=e;a&&a.generateReplacementPatches_(n[zs].base_,t,e)}else t=Nq(e,n);return Z2e(e,t,!0),Y3(e),e.patches_&&e.patchListener_(e.patches_,e.inversePatches_),t!==CZ?t:void 0}function Nq(t,e){if(UC(e))return e;const n=e[zs];if(!n)return vk(e,t.handledSet_,t);if(!BC(n,t))return e;if(!n.modified_)return n.base_;if(!n.finalized_){const{callbacks_:r}=n;if(r)for(;r.length>0;)r.pop()(t);jZ(n,t)}return n.copy_}function Z2e(t,e,n=!1){!t.parent_&&t.immer_.autoFreeze_&&t.canAutoFreeze_&&WL(e,n)}function MZ(t){t.finalized_=!0,t.scope_.unfinalizedDrafts_--}var BC=(t,e)=>t.scope_===e,J2e=[];function EZ(t,e,n,r){const a=Ud(t),s=t.type_;if(r!==void 0&&G3(a,r,s)===e){xk(a,r,n,s);return}if(!t.draftLocations_){const l=t.draftLocations_=new Map;LC(a,(c,d)=>{if(pu(d)){const u=l.get(d)||[];u.push(c),l.set(d,u)}})}const o=t.draftLocations_.get(e)??J2e;for(const l of o)xk(a,l,n,s)}function eEe(t,e,n){t.callbacks_.push(function(a){const s=e;if(!s||!BC(s,a))return;a.mapSetPlugin_?.fixSetContents(s);const o=GL(s);EZ(t,s.draft_??s,o,n),jZ(s,a)})}function jZ(t,e){if(t.modified_&&!t.finalized_&&(t.type_===3||t.type_===1&&t.allIndicesReassigned_||(t.assigned_?.size??0)>0)){const{patchPlugin_:r}=e;if(r){const a=r.getPath(t);a&&r.generatePatches_(t,a,e)}MZ(t)}}function tEe(t,e,n){const{scope_:r}=t;if(pu(n)){const a=n[zs];BC(a,r)&&a.callbacks_.push(function(){S1(t);const o=GL(a);EZ(t,n,o,e)})}else ac(n)&&t.callbacks_.push(function(){const s=Ud(t);t.type_===3?s.has(n)&&vk(n,r.handledSet_,r):G3(s,e,t.type_)===n&&r.drafts_.length>1&&(t.assigned_.get(e)??!1)===!0&&t.copy_&&vk(G3(t.copy_,e,t.type_),r.handledSet_,r)})}function vk(t,e,n){return!n.immer_.autoFreeze_&&n.unfinalizedDrafts_<1||pu(t)||e.has(t)||!ac(t)||UC(t)||(e.add(t),LC(t,(r,a)=>{if(pu(a)){const s=a[zs];if(BC(s,n)){const o=GL(s);xk(t,r,o,t.type_),MZ(s)}}else ac(a)&&vk(a,e,n)})),t}function nEe(t,e){const n=OC(t),r={type_:n?1:0,scope_:e?e.scope_:AZ(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:e,base_:t,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0};let a=r,s=wk;n&&(a=[r],s=e0);const{revoke:o,proxy:l}=Proxy.revocable(a,s);return r.draft_=l,r.revoke_=o,[l,r]}var wk={get(t,e){if(e===zs)return t;let n=t.scope_.arrayMethodsPlugin_;const r=t.type_===1&&typeof e=="string";if(r&&n?.isArrayOperationMethod(e))return n.createMethodInterceptor(t,e);const a=Ud(t);if(!yq(a,e,t.type_))return rEe(t,a,e);const s=a[e];if(t.finalized_||!ac(s)||r&&t.operationMethod&&n?.isMutatingArrayMethod(t.operationMethod)&&K2e(e))return s;if(s===SE(t.base_,e)){S1(t);const o=t.type_===1?+e:e,l=Z3(t.scope_,s,t,o);return t.copy_[o]=l}return s},has(t,e){return e in Ud(t)},ownKeys(t){return Reflect.ownKeys(Ud(t))},set(t,e,n){const r=DZ(Ud(t),e);if(r?.set)return r.set.call(t.draft_,n),!0;if(!t.modified_){const a=SE(Ud(t),e),s=a?.[zs];if(s&&s.base_===n)return t.copy_[e]=n,t.assigned_.set(e,!1),!0;if(W2e(n,a)&&(n!==void 0||yq(t.base_,e,t.type_)))return!0;S1(t),Q3(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),tEe(t,e,n)),!0},deleteProperty(t,e){return S1(t),SE(t.base_,e)!==void 0||e in t.base_?(t.assigned_.set(e,!1),Q3(t)):t.assigned_.delete(e),t.copy_&&delete t.copy_[e],!0},getOwnPropertyDescriptor(t,e){const n=Ud(t),r=Reflect.getOwnPropertyDescriptor(n,e);return r&&{[w1]:!0,[V3]:t.type_!==1||e!=="length",[bk]:r[bk],[Zv]:n[e]}},defineProperty(){Gl(11)},getPrototypeOf(t){return Hb(t.base_)},setPrototypeOf(){Gl(12)}},e0={};for(let t in wk){let e=wk[t];e0[t]=function(){const n=arguments;return n[0]=n[0][0],e.apply(this,n)}}e0.deleteProperty=function(t,e){return e0.set.call(this,t,e,void 0)};e0.set=function(t,e,n){return wk.set.call(this,t[0],e,n,t[0])};function SE(t,e){const n=t[zs];return(n?Ud(n):t)[e]}function rEe(t,e,n){const r=DZ(e,n);return r?Zv in r?r[Zv]:r.get?.call(t.draft_):void 0}function DZ(t,e){if(!(e in t))return;let n=Hb(t);for(;n;){const r=Object.getOwnPropertyDescriptor(n,e);if(r)return r;n=Hb(n)}}function Q3(t){t.modified_||(t.modified_=!0,t.parent_&&Q3(t.parent_))}function S1(t){t.copy_||(t.assigned_=new Map,t.copy_=W3(t.base_,t.scope_.immer_.useStrictShallowCopy_))}var iEe=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(n,r,a)=>{if(Zg(n)&&!Zg(r)){const o=r;r=n;const l=this;return function(d=o,...u){return l.produce(d,m=>r.call(this,m,...u))}}Zg(r)||Gl(6),a!==void 0&&!Zg(a)&&Gl(7);let s;if(ac(n)){const o=_q(this),l=Z3(o,n,void 0);let c=!0;try{s=r(l),c=!1}finally{c?Y3(o):X3(o)}return Sq(o,a),kq(s,o)}else if(!n||!VL(n)){if(s=r(n),s===void 0&&(s=n),s===CZ&&(s=void 0),this.autoFreeze_&&WL(s,!0),a){const o=[],l=[];rf(K3).generateReplacementPatches_(n,s,{patches_:o,inversePatches_:l}),a(o,l)}return s}else Gl(1,n)},this.produceWithPatches=(n,r)=>{if(Zg(n))return(l,...c)=>this.produceWithPatches(l,d=>n(d,...c));let a,s;return[this.produce(n,r,(l,c)=>{a=l,s=c}),a,s]},wE(e?.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),wE(e?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),wE(e?.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){ac(e)||Gl(8),pu(e)&&(e=Jl(e));const n=_q(this),r=Z3(n,e,void 0);return r[zs].isManual_=!0,X3(n),r}finishDraft(e,n){const r=e&&e[zs];(!r||!r.isManual_)&&Gl(9);const{scope_:a}=r;return Sq(a,n),kq(void 0,a)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,n){let r;for(r=n.length-1;r>=0;r--){const s=n[r];if(s.path.length===0&&s.op==="replace"){e=s.value;break}}r>-1&&(n=n.slice(r+1));const a=rf(K3).applyPatches_;return pu(e)?a(e,n):this.produce(e,s=>a(s,n))}};function Z3(t,e,n,r){const[a,s]=IC(e)?rf(yk).proxyMap_(e,n):zC(e)?rf(yk).proxySet_(e,n):nEe(e,n);return(n?.scope_??AZ()).drafts_.push(a),s.callbacks_=n?.callbacks_??[],s.key_=r,n&&r!==void 0?eEe(n,s,r):s.callbacks_.push(function(c){c.mapSetPlugin_?.fixSetContents(s);const{patchPlugin_:d}=c;s.modified_&&d&&d.generatePatches_(s,[],c)}),a}function Jl(t){return pu(t)||Gl(10,t),RZ(t)}function RZ(t){if(!ac(t)||UC(t))return t;const e=t[zs];let n,r=!0;if(e){if(!e.modified_)return e.base_;e.finalized_=!0,n=W3(t,e.scope_.immer_.useStrictShallowCopy_),r=e.scope_.immer_.shouldUseStrictIteration()}else n=W3(t,!0);return LC(n,(a,s)=>{xk(n,a,RZ(s))},r),e&&(e.finalized_=!1),n}var aEe=new iEe,FZ=aEe.produce;function LZ(t){return({dispatch:n,getState:r})=>a=>s=>typeof s=="function"?s(n,r,t):a(s)}var sEe=LZ(),oEe=LZ,lEe=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?fk:fk.apply(null,arguments)};function Cl(t,e){function n(...r){if(e){let a=e(...r);if(!a)throw new Error(Lo(0));return{type:t,payload:a.payload,..."meta"in a&&{meta:a.meta},..."error"in a&&{error:a.error}}}return{type:t,payload:r[0]}}return n.toString=()=>`${t}`,n.type=t,n.match=r=>NZ(r)&&r.type===t,n}var OZ=class Ky extends Array{constructor(...e){super(...e),Object.setPrototypeOf(this,Ky.prototype)}static get[Symbol.species](){return Ky}concat(...e){return super.concat.apply(this,e)}prepend(...e){return e.length===1&&Array.isArray(e[0])?new Ky(...e[0].concat(this)):new Ky(...e.concat(this))}};function Cq(t){return ac(t)?FZ(t,()=>{}):t}function P_(t,e,n){return t.has(e)?t.get(e):t.set(e,n(e)).get(e)}function cEe(t){return typeof t=="boolean"}var dEe=()=>function(e){const{thunk:n=!0,immutableCheck:r=!0,serializableCheck:a=!0,actionCreatorCheck:s=!0}=e??{};let o=new OZ;return n&&(cEe(n)?o.push(sEe):o.push(oEe(n.extraArgument))),o},IZ="RTK_autoBatch",ui=()=>t=>({payload:t,meta:{[IZ]:!0}}),Tq=t=>e=>{setTimeout(e,t)},zZ=(t={type:"raf"})=>e=>(...n)=>{const r=e(...n);let a=!0,s=!1,o=!1;const l=new Set,c=t.type==="tick"?queueMicrotask:t.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?window.requestAnimationFrame:Tq(10):t.type==="callback"?t.queueNotification:Tq(t.timeout),d=()=>{o=!1,s&&(s=!1,l.forEach(u=>u()))};return Object.assign({},r,{subscribe(u){const m=()=>a&&u(),p=r.subscribe(m);return l.add(u),()=>{p(),l.delete(u)}},dispatch(u){try{return a=!u?.meta?.[IZ],s=!a,s&&(o||(o=!0,c(d))),r.dispatch(u)}finally{a=!0}}})},uEe=t=>function(n){const{autoBatch:r=!0}=n??{};let a=new OZ(t);return r&&a.push(zZ(typeof r=="object"?r:void 0)),a};function mEe(t){const e=dEe(),{reducer:n=void 0,middleware:r,devTools:a=!0,preloadedState:s=void 0,enhancers:o=void 0}=t||{};let l;if(typeof n=="function")l=n;else if(qL(n))l=kZ(n);else throw new Error(Lo(1));let c;typeof r=="function"?c=r(e):c=e();let d=fk;a&&(d=lEe({trace:!1,...typeof a=="object"&&a}));const u=V2e(...c),m=uEe(u);let p=typeof o=="function"?o(m):m();const f=d(...p);return _Z(l,s,f)}function UZ(t){const e={},n=[];let r;const a={addCase(s,o){const l=typeof s=="string"?s:s.type;if(!l)throw new Error(Lo(28));if(l in e)throw new Error(Lo(29));return e[l]=o,a},addAsyncThunk(s,o){return o.pending&&(e[s.pending.type]=o.pending),o.rejected&&(e[s.rejected.type]=o.rejected),o.fulfilled&&(e[s.fulfilled.type]=o.fulfilled),o.settled&&n.push({matcher:s.settled,reducer:o.settled}),a},addMatcher(s,o){return n.push({matcher:s,reducer:o}),a},addDefaultCase(s){return r=s,a}};return t(a),[e,n,r]}function hEe(t){return typeof t=="function"}function pEe(t,e){let[n,r,a]=UZ(e),s;if(hEe(t))s=()=>Cq(t());else{const l=Cq(t);s=()=>l}function o(l=s(),c){let d=[n[c.type],...r.filter(({matcher:u})=>u(c)).map(({reducer:u})=>u)];return d.filter(u=>!!u).length===0&&(d=[a]),d.reduce((u,m)=>{if(m)if(pu(u)){const f=m(u,c);return f===void 0?u:f}else{if(ac(u))return FZ(u,p=>m(p,c));{const p=m(u,c);if(p===void 0){if(u===null)return u;throw Error("A case reducer on a non-draftable value must not return undefined")}return p}}return u},l)}return o.getInitialState=s,o}var fEe="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",gEe=(t=21)=>{let e="",n=t;for(;n--;)e+=fEe[Math.random()*64|0];return e},bEe=Symbol.for("rtk-slice-createasyncthunk");function xEe(t,e){return`${t}/${e}`}function yEe({creators:t}={}){const e=t?.asyncThunk?.[bEe];return function(r){const{name:a,reducerPath:s=a}=r;if(!a)throw new Error(Lo(11));const o=(typeof r.reducers=="function"?r.reducers(wEe()):r.reducers)||{},l=Object.keys(o),c={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},d={addCase(k,P){const C=typeof k=="string"?k:k.type;if(!C)throw new Error(Lo(12));if(C in c.sliceCaseReducersByType)throw new Error(Lo(13));return c.sliceCaseReducersByType[C]=P,d},addMatcher(k,P){return c.sliceMatchers.push({matcher:k,reducer:P}),d},exposeAction(k,P){return c.actionCreators[k]=P,d},exposeCaseReducer(k,P){return c.sliceCaseReducersByName[k]=P,d}};l.forEach(k=>{const P=o[k],C={reducerName:k,type:xEe(a,k),createNotation:typeof r.reducers=="function"};_Ee(P)?NEe(C,P,d,e):SEe(C,P,d)});function u(){const[k={},P=[],C=void 0]=typeof r.extraReducers=="function"?UZ(r.extraReducers):[r.extraReducers],T={...k,...c.sliceCaseReducersByType};return pEe(r.initialState,N=>{for(let R in T)N.addCase(R,T[R]);for(let R of c.sliceMatchers)N.addMatcher(R.matcher,R.reducer);for(let R of P)N.addMatcher(R.matcher,R.reducer);C&&N.addDefaultCase(C)})}const m=k=>k,p=new Map,f=new WeakMap;let y;function x(k,P){return y||(y=u()),y(k,P)}function b(){return y||(y=u()),y.getInitialState()}function v(k,P=!1){function C(N){let R=N[k];return typeof R>"u"&&P&&(R=P_(f,C,b)),R}function T(N=m){const R=P_(p,P,()=>new WeakMap);return P_(R,N,()=>{const A={};for(const[D,$]of Object.entries(r.selectors??{}))A[D]=vEe($,N,()=>P_(f,N,b),P);return A})}return{reducerPath:k,getSelectors:T,get selectors(){return T(C)},selectSlice:C}}const _={name:a,reducer:x,actions:c.actionCreators,caseReducers:c.sliceCaseReducersByName,getInitialState:b,...v(s),injectInto(k,{reducerPath:P,...C}={}){const T=P??s;return k.inject({reducerPath:T,reducer:x},C),{..._,...v(T,!0)}}};return _}}function vEe(t,e,n,r){function a(s,...o){let l=e(s);return typeof l>"u"&&r&&(l=n()),t(l,...o)}return a.unwrapped=t,a}var ho=yEe();function wEe(){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 SEe({type:t,reducerName:e,createNotation:n},r,a){let s,o;if("reducer"in r){if(n&&!kEe(r))throw new Error(Lo(17));s=r.reducer,o=r.prepare}else s=r;a.addCase(t,s).exposeCaseReducer(e,s).exposeAction(e,o?Cl(t,o):Cl(t))}function _Ee(t){return t._reducerDefinitionType==="asyncThunk"}function kEe(t){return t._reducerDefinitionType==="reducerWithPrepare"}function NEe({type:t,reducerName:e},n,r,a){if(!a)throw new Error(Lo(18));const{payloadCreator:s,fulfilled:o,pending:l,rejected:c,settled:d,options:u}=n,m=a(t,s,u);r.exposeAction(e,m),o&&r.addCase(m.fulfilled,o),l&&r.addCase(m.pending,l),c&&r.addCase(m.rejected,c),d&&r.addMatcher(m.settled,d),r.exposeCaseReducer(e,{fulfilled:o||A_,pending:l||A_,rejected:c||A_,settled:d||A_})}function A_(){}var CEe="task",BZ="listener",HZ="completed",KL="cancelled",TEe=`task-${KL}`,PEe=`task-${HZ}`,J3=`${BZ}-${KL}`,AEe=`${BZ}-${HZ}`,HC=class{constructor(t){this.code=t,this.message=`${CEe} ${KL} (reason: ${t})`}name="TaskAbortError";message},YL=(t,e)=>{if(typeof t!="function")throw new TypeError(Lo(32))},Sk=()=>{},$Z=(t,e=Sk)=>(t.catch(e),t),qZ=(t,e)=>(t.addEventListener("abort",e,{once:!0}),()=>t.removeEventListener("abort",e)),Mp=t=>{if(t.aborted)throw new HC(t.reason)};function VZ(t,e){let n=Sk;return new Promise((r,a)=>{const s=()=>a(new HC(t.reason));if(t.aborted){s();return}n=qZ(t,s),e.finally(()=>n()).then(r,a)}).finally(()=>{n=Sk})}var MEe=async(t,e)=>{try{return await Promise.resolve(),{status:"ok",value:await t()}}catch(n){return{status:n instanceof HC?"cancelled":"rejected",error:n}}finally{e?.()}},_k=t=>e=>$Z(VZ(t,e).then(n=>(Mp(t),n))),GZ=t=>{const e=_k(t);return n=>e(new Promise(r=>setTimeout(r,n)))},{assign:wb}=Object,Pq={},$C="listenerMiddleware",EEe=(t,e)=>{const n=r=>qZ(t,()=>r.abort(t.reason));return(r,a)=>{YL(r);const s=new AbortController;n(s);const o=MEe(async()=>{Mp(t),Mp(s.signal);const l=await r({pause:_k(s.signal),delay:GZ(s.signal),signal:s.signal});return Mp(s.signal),l},()=>s.abort(PEe));return a?.autoJoin&&e.push(o.catch(Sk)),{result:_k(t)(o),cancel(){s.abort(TEe)}}}},jEe=(t,e)=>{const n=async(r,a)=>{Mp(e);let s=()=>{};const l=[new Promise((c,d)=>{let u=t({predicate:r,effect:(m,p)=>{p.unsubscribe(),c([m,p.getState(),p.getOriginalState()])}});s=()=>{u(),d()}})];a!=null&&l.push(new Promise(c=>setTimeout(c,a,null)));try{const c=await VZ(e,Promise.race(l));return Mp(e),c}finally{s()}};return(r,a)=>$Z(n(r,a))},WZ=t=>{let{type:e,actionCreator:n,matcher:r,predicate:a,effect:s}=t;if(e)a=Cl(e).match;else if(n)e=n.type,a=n.match;else if(r)a=r;else if(!a)throw new Error(Lo(21));return YL(s),{predicate:a,type:e,effect:s}},KZ=wb(t=>{const{type:e,predicate:n,effect:r}=WZ(t);return{id:gEe(),effect:r,type:e,predicate:n,pending:new Set,unsubscribe:()=>{throw new Error(Lo(22))}}},{withTypes:()=>KZ}),Aq=(t,e)=>{const{type:n,effect:r,predicate:a}=WZ(e);return Array.from(t.values()).find(s=>(typeof n=="string"?s.type===n:s.predicate===a)&&s.effect===r)},eR=t=>{t.pending.forEach(e=>{e.abort(J3)})},DEe=(t,e)=>()=>{for(const n of e.keys())eR(n);t.clear()},Mq=(t,e,n)=>{try{t(e,n)}catch(r){setTimeout(()=>{throw r},0)}},YZ=wb(Cl(`${$C}/add`),{withTypes:()=>YZ}),REe=Cl(`${$C}/removeAll`),XZ=wb(Cl(`${$C}/remove`),{withTypes:()=>XZ}),FEe=(...t)=>{console.error(`${$C}/error`,...t)},$0=(t={})=>{const e=new Map,n=new Map,r=f=>{const y=n.get(f)??0;n.set(f,y+1)},a=f=>{const y=n.get(f)??1;y===1?n.delete(f):n.set(f,y-1)},{extra:s,onError:o=FEe}=t;YL(o);const l=f=>(f.unsubscribe=()=>e.delete(f.id),e.set(f.id,f),y=>{f.unsubscribe(),y?.cancelActive&&eR(f)}),c=f=>{const y=Aq(e,f)??KZ(f);return l(y)};wb(c,{withTypes:()=>c});const d=f=>{const y=Aq(e,f);return y&&(y.unsubscribe(),f.cancelActive&&eR(y)),!!y};wb(d,{withTypes:()=>d});const u=async(f,y,x,b)=>{const v=new AbortController,_=jEe(c,v.signal),k=[];try{f.pending.add(v),r(f),await Promise.resolve(f.effect(y,wb({},x,{getOriginalState:b,condition:(P,C)=>_(P,C).then(Boolean),take:_,delay:GZ(v.signal),pause:_k(v.signal),extra:s,signal:v.signal,fork:EEe(v.signal,k),unsubscribe:f.unsubscribe,subscribe:()=>{e.set(f.id,f)},cancelActiveListeners:()=>{f.pending.forEach((P,C,T)=>{P!==v&&(P.abort(J3),T.delete(P))})},cancel:()=>{v.abort(J3),f.pending.delete(v)},throwIfCancelled:()=>{Mp(v.signal)}})))}catch(P){P instanceof HC||Mq(o,P,{raisedBy:"effect"})}finally{await Promise.all(k),v.abort(AEe),a(f),f.pending.delete(v)}},m=DEe(e,n);return{middleware:f=>y=>x=>{if(!NZ(x))return y(x);if(YZ.match(x))return c(x.payload);if(REe.match(x)){m();return}if(XZ.match(x))return d(x.payload);let b=f.getState();const v=()=>{if(b===Pq)throw new Error(Lo(23));return b};let _;try{if(_=y(x),e.size>0){const k=f.getState(),P=Array.from(e.values());for(const C of P){let T=!1;try{T=C.predicate(x,k,b)}catch(N){T=!1,Mq(o,N,{raisedBy:"predicate"})}T&&u(C,x,f,v)}}}finally{b=Pq}return _},startListening:c,stopListening:d,clearListeners:m}};function Lo(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 LEe={layoutType:"horizontal",width:0,height:0,margin:{top:5,right:5,bottom:5,left:5},scale:1},QZ=ho({name:"chartLayout",initialState:LEe,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,r,a,s;t.margin.top=(n=e.payload.top)!==null&&n!==void 0?n:0,t.margin.right=(r=e.payload.right)!==null&&r!==void 0?r:0,t.margin.bottom=(a=e.payload.bottom)!==null&&a!==void 0?a:0,t.margin.left=(s=e.payload.left)!==null&&s!==void 0?s:0},setScale(t,e){t.scale=e.payload}}}),{setMargin:OEe,setLayout:IEe,setChartSize:zEe,setScale:UEe}=QZ.actions,BEe=QZ.reducer;function ZZ(t,e,n){return Array.isArray(t)&&t&&e+n!==0?t.slice(e,n+1):t}function Ln(t){return Number.isFinite(t)}function Vc(t){return typeof t=="number"&&t>0&&Number.isFinite(t)}function Eq(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),n.push.apply(n,r)}return n}function ob(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Eq(Object(n),!0).forEach(function(r){HEe(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Eq(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function HEe(t,e,n){return(e=$Ee(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function $Ee(t){var e=qEe(t,"string");return typeof e=="symbol"?e:e+""}function qEe(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Tr(t,e,n){return fi(t)||fi(e)?n:Nl(e)?tf(t,e,n):typeof e=="function"?e(t):n}var VEe=(t,e,n)=>{if(e&&n){var{width:r,height:a}=n,{align:s,verticalAlign:o,layout:l}=e;if((l==="vertical"||l==="horizontal"&&o==="middle")&&s!=="center"&&Gt(t[s]))return ob(ob({},t),{},{[s]:t[s]+(r||0)});if((l==="horizontal"||l==="vertical"&&s==="center")&&o!=="middle"&&Gt(t[o]))return ob(ob({},t),{},{[o]:t[o]+(a||0)})}return t},cc=(t,e)=>t==="horizontal"&&e==="xAxis"||t==="vertical"&&e==="yAxis"||t==="centric"&&e==="angleAxis"||t==="radial"&&e==="radiusAxis",JZ=(t,e,n,r)=>{if(r)return t.map(l=>l.coordinate);var a,s,o=t.map(l=>(l.coordinate===e&&(a=!0),l.coordinate===n&&(s=!0),l.coordinate));return a||o.push(e),s||o.push(n),o},eJ=(t,e,n)=>{if(!t)return null;var{duplicateDomain:r,type:a,range:s,scale:o,realScaleType:l,isCategorical:c,categoricalDomain:d,tickCount:u,ticks:m,niceTicks:p,axisType:f}=t;if(!o)return null;var y=l==="scaleBand"&&o.bandwidth?o.bandwidth()/2:2,x=a==="category"&&o.bandwidth?o.bandwidth()/y:0;if(x=f==="angleAxis"&&s&&s.length>=2?Ra(s[0]-s[1])*2*x:x,m||p){var b=(m||p||[]).map((v,_)=>{var k=r?r.indexOf(v):v,P=o.map(k);return Ln(P)?{coordinate:P+x,value:v,offset:x,index:_}:null}).filter(ro);return b}return c&&d?d.map((v,_)=>{var k=o.map(v);return Ln(k)?{coordinate:k+x,value:v,index:_,offset:x}:null}).filter(ro):o.ticks&&u!=null?o.ticks(u).map((v,_)=>{var k=o.map(v);return Ln(k)?{coordinate:k+x,value:v,index:_,offset:x}:null}).filter(ro):o.domain().map((v,_)=>{var k=o.map(v);return Ln(k)?{coordinate:k+x,value:r?r[v]:v,index:_,offset:x}:null}).filter(ro)},GEe=(t,e)=>{if(!e||e.length!==2||!Gt(e[0])||!Gt(e[1]))return t;var n=Math.min(e[0],e[1]),r=Math.max(e[0],e[1]),a=[t[0],t[1]];return(!Gt(t[0])||t[0]<n)&&(a[0]=n),(!Gt(t[1])||t[1]>r)&&(a[1]=r),a[0]>r&&(a[0]=r),a[1]<n&&(a[1]=n),a},WEe=t=>{var e,n=t.length;if(!(n<=0)){var r=(e=t[0])===null||e===void 0?void 0:e.length;if(!(r==null||r<=0))for(var a=0;a<r;++a)for(var s=0,o=0,l=0;l<n;++l){var c=t[l],d=c?.[a];if(d!=null){var u=d[1],m=d[0],p=ic(u)?m:u;p>=0?(d[0]=s,s+=p,d[1]=s):(d[0]=o,o+=p,d[1]=o)}}}},KEe=t=>{var e,n=t.length;if(!(n<=0)){var r=(e=t[0])===null||e===void 0?void 0:e.length;if(!(r==null||r<=0))for(var a=0;a<r;++a)for(var s=0,o=0;o<n;++o){var l=t[o],c=l?.[a];if(c!=null){var d=ic(c[1])?c[0]:c[1];d>=0?(c[0]=s,s+=d,c[1]=s):(c[0]=0,c[1]=0)}}}},YEe={sign:WEe,expand:xMe,none:ef,silhouette:yMe,wiggle:vMe,positive:KEe},XEe=(t,e,n)=>{var r,a=(r=YEe[n])!==null&&r!==void 0?r:ef,s=bMe().keys(e).value((l,c)=>Number(Tr(l,c,0))).order($3).offset(a),o=s(t);return o.forEach((l,c)=>{l.forEach((d,u)=>{var m=Tr(t[u],e[c],0);Array.isArray(m)&&m.length===2&&Gt(m[0])&&Gt(m[1])&&(d[0]=m[0],d[1]=m[1])})}),o};function tJ(t){return t==null?void 0:String(t)}function kk(t){var{axis:e,ticks:n,bandSize:r,entry:a,index:s,dataKey:o}=t;if(e.type==="category"){if(!e.allowDuplicatedCategory&&e.dataKey&&!fi(a[e.dataKey])){var l=aZ(n,"value",a[e.dataKey]);if(l)return l.coordinate+r/2}return n!=null&&n[s]?n[s].coordinate+r/2:null}var c=Tr(a,fi(o)?e.dataKey:o),d=e.scale.map(c);return Gt(d)?d:null}var jq=t=>{var{axis:e,ticks:n,offset:r,bandSize:a,entry:s,index:o}=t;if(e.type==="category")return n[o]?n[o].coordinate+r:null;var l=Tr(s,e.dataKey,e.scale.domain()[o]);if(fi(l))return null;var c=e.scale.map(l);return Gt(c)?c-a/2+r:null},QEe=t=>{var{numericAxis:e}=t,n=e.scale.domain();if(e.type==="number"){var r=Math.min(n[0],n[1]),a=Math.max(n[0],n[1]);return r<=0&&a>=0?0:a<0?a:r}return n[0]},ZEe=t=>{var e=t.flat(2).filter(Gt);return[Math.min(...e),Math.max(...e)]},JEe=t=>[t[0]===1/0?0:t[0],t[1]===-1/0?0:t[1]],eje=(t,e,n)=>{if(t!=null)return JEe(Object.keys(t).reduce((r,a)=>{var s=t[a];if(!s)return r;var{stackedData:o}=s,l=o.reduce((c,d)=>{var u=ZZ(d,e,n),m=ZEe(u);return!Ln(m[0])||!Ln(m[1])?c:[Math.min(c[0],m[0]),Math.max(c[1],m[1])]},[1/0,-1/0]);return[Math.min(l[0],r[0]),Math.max(l[1],r[1])]},[1/0,-1/0]))},Dq=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,Rq=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,lh=(t,e,n)=>{if(t&&t.scale&&t.scale.bandwidth){var r=t.scale.bandwidth();if(!n||r>0)return r}if(t&&e&&e.length>=2){for(var a=RC(e,u=>u.coordinate),s=1/0,o=1,l=a.length;o<l;o++){var c=a[o],d=a[o-1];s=Math.min((c?.coordinate||0)-(d?.coordinate||0),s)}return s===1/0?0:s}return n?void 0:0};function Fq(t){var{tooltipEntrySettings:e,dataKey:n,payload:r,value:a,name:s}=t;return ob(ob({},e),{},{dataKey:n,payload:r,value:a,name:s})}function ph(t,e){if(t)return String(t);if(typeof e=="string")return e}var tje=(t,e)=>{if(e==="horizontal")return t.chartX;if(e==="vertical")return t.chartY},nje=(t,e)=>e==="centric"?t.angle:t.radius,Su=t=>t.layout.width,_u=t=>t.layout.height,rje=t=>t.layout.scale,nJ=t=>t.layout.margin,qC=pt(t=>t.cartesianAxis.xAxis,t=>Object.values(t)),VC=pt(t=>t.cartesianAxis.yAxis,t=>Object.values(t)),rJ="data-recharts-item-index",iJ="data-recharts-item-id",q0=60;function Lq(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),n.push.apply(n,r)}return n}function M_(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Lq(Object(n),!0).forEach(function(r){ije(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Lq(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function ije(t,e,n){return(e=aje(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function aje(t){var e=sje(t,"string");return typeof e=="symbol"?e:e+""}function sje(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var oje=t=>t.brush.height;function lje(t){var e=VC(t);return e.reduce((n,r)=>{if(r.orientation==="left"&&!r.mirror&&!r.hide){var a=typeof r.width=="number"?r.width:q0;return n+a}return n},0)}function cje(t){var e=VC(t);return e.reduce((n,r)=>{if(r.orientation==="right"&&!r.mirror&&!r.hide){var a=typeof r.width=="number"?r.width:q0;return n+a}return n},0)}function dje(t){var e=qC(t);return e.reduce((n,r)=>r.orientation==="top"&&!r.mirror&&!r.hide?n+r.height:n,0)}function uje(t){var e=qC(t);return e.reduce((n,r)=>r.orientation==="bottom"&&!r.mirror&&!r.hide?n+r.height:n,0)}var ya=pt([Su,_u,nJ,oje,lje,cje,dje,uje,wZ,I2e],(t,e,n,r,a,s,o,l,c,d)=>{var u={left:(n.left||0)+a,right:(n.right||0)+s},m={top:(n.top||0)+o,bottom:(n.bottom||0)+l},p=M_(M_({},m),u),f=p.bottom;p.bottom+=r,p=VEe(p,c,d);var y=t-p.left-p.right,x=e-p.top-p.bottom;return M_(M_({brushBottom:f},p),{},{width:Math.max(y,0),height:Math.max(x,0)})}),mje=pt(ya,t=>({x:t.left,y:t.top,width:t.width,height:t.height})),XL=pt(Su,_u,(t,e)=>({x:0,y:0,width:t,height:e})),hje=w.createContext(null),va=()=>w.useContext(hje)!=null,GC=t=>t.brush,WC=pt([GC,ya,nJ],(t,e,n)=>({height:t.height,x:Gt(t.x)?t.x:e.left,y:Gt(t.y)?t.y:e.top+e.height+e.brushBottom-(n?.bottom||0),width:Gt(t.width)?t.width:e.width})),_E={},kE={},NE={},Oq;function pje(){return Oq||(Oq=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function e(n,r,{signal:a,edges:s}={}){let o,l=null;const c=s!=null&&s.includes("leading"),d=s==null||s.includes("trailing"),u=()=>{l!==null&&(n.apply(o,l),o=void 0,l=null)},m=()=>{d&&u(),x()};let p=null;const f=()=>{p!=null&&clearTimeout(p),p=setTimeout(()=>{p=null,m()},r)},y=()=>{p!==null&&(clearTimeout(p),p=null)},x=()=>{y(),o=void 0,l=null},b=()=>{u()},v=function(..._){if(a?.aborted)return;o=this,l=_;const k=p==null;f(),c&&k&&u()};return v.schedule=f,v.cancel=x,v.flush=b,a?.addEventListener("abort",x,{once:!0}),v}t.debounce=e})(NE)),NE}var Iq;function fje(){return Iq||(Iq=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=pje();function n(r,a=0,s={}){typeof s!="object"&&(s={});const{leading:o=!1,trailing:l=!0,maxWait:c}=s,d=Array(2);o&&(d[0]="leading"),l&&(d[1]="trailing");let u,m=null;const p=e.debounce(function(...x){u=r.apply(this,x),m=null},a,{edges:d}),f=function(...x){return c!=null&&(m===null&&(m=Date.now()),Date.now()-m>=c)?(u=r.apply(this,x),m=Date.now(),p.cancel(),p.schedule(),u):(p.apply(this,x),u)},y=()=>(p.flush(),u);return f.cancel=p.cancel,f.flush=y,f}t.debounce=n})(kE)),kE}var zq;function gje(){return zq||(zq=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=fje();function n(r,a=0,s={}){const{leading:o=!0,trailing:l=!0}=s;return e.debounce(r,a,{leading:o,maxWait:a,trailing:l})}t.throttle=n})(_E)),_E}var CE,Uq;function bje(){return Uq||(Uq=1,CE=gje().throttle),CE}var xje=bje();const yje=Pl(xje);var Nk=function(e,n){for(var r=arguments.length,a=new Array(r>2?r-2:0),s=2;s<r;s++)a[s-2]=arguments[s];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 o=0;console.warn(n.replace(/%s/g,()=>a[o++]))}},Fc={width:"100%",height:"100%",debounce:0,minWidth:0,initialDimension:{width:-1,height:-1}},aJ=(t,e,n)=>{var{width:r=Fc.width,height:a=Fc.height,aspect:s,maxHeight:o}=n,l=nf(r)?t:Number(r),c=nf(a)?e:Number(a);return s&&s>0&&(l?c=l/s:c&&(l=c*s),o&&c!=null&&c>o&&(c=o)),{calculatedWidth:l,calculatedHeight:c}},vje={width:0,height:0,overflow:"visible"},wje={width:0,overflowX:"visible"},Sje={height:0,overflowY:"visible"},_je={},kje=t=>{var{width:e,height:n}=t,r=nf(e),a=nf(n);return r&&a?vje:r?wje:a?Sje:_je};function Nje(t){var{width:e,height:n,aspect:r}=t,a=e,s=n;return a===void 0&&s===void 0?(a=Fc.width,s=Fc.height):a===void 0?a=r&&r>0?void 0:Fc.width:s===void 0&&(s=r&&r>0?void 0:Fc.height),{width:a,height:s}}function tR(){return tR=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},tR.apply(null,arguments)}function Bq(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),n.push.apply(n,r)}return n}function Hq(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Bq(Object(n),!0).forEach(function(r){Cje(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Bq(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Cje(t,e,n){return(e=Tje(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Tje(t){var e=Pje(t,"string");return typeof e=="symbol"?e:e+""}function Pje(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var sJ=w.createContext(Fc.initialDimension);function Aje(t){return Vc(t.width)&&Vc(t.height)}function oJ(t){var{children:e,width:n,height:r}=t,a=w.useMemo(()=>({width:n,height:r}),[n,r]);return Aje(a)?w.createElement(sJ.Provider,{value:a},e):null}var QL=()=>w.useContext(sJ),Mje=w.forwardRef((t,e)=>{var{aspect:n,initialDimension:r=Fc.initialDimension,width:a,height:s,minWidth:o=Fc.minWidth,minHeight:l,maxHeight:c,children:d,debounce:u=Fc.debounce,id:m,className:p,onResize:f,style:y={}}=t,x=w.useRef(null),b=w.useRef();b.current=f,w.useImperativeHandle(e,()=>x.current);var[v,_]=w.useState({containerWidth:r.width,containerHeight:r.height}),k=w.useCallback((R,A)=>{_(D=>{var $=Math.round(R),U=Math.round(A);return D.containerWidth===$&&D.containerHeight===U?D:{containerWidth:$,containerHeight:U}})},[]);w.useEffect(()=>{if(x.current==null||typeof ResizeObserver>"u")return hh;var R=U=>{var G,L=U[0];if(L!=null){var{width:te,height:re}=L.contentRect;k(te,re),(G=b.current)===null||G===void 0||G.call(b,te,re)}};u>0&&(R=yje(R,u,{trailing:!0,leading:!1}));var A=new ResizeObserver(R),{width:D,height:$}=x.current.getBoundingClientRect();return k(D,$),A.observe(x.current),()=>{A.disconnect()}},[k,u]);var{containerWidth:P,containerHeight:C}=v;Nk(!n||n>0,"The aspect(%s) must be greater than zero.",n);var{calculatedWidth:T,calculatedHeight:N}=aJ(P,C,{width:a,height:s,aspect:n,maxHeight:c});return Nk(T!=null&&T>0||N!=null&&N>0,`The width(%s) and height(%s) of chart should be greater than 0,
- please check the style of container, or the props width(%s) and height(%s),
- or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the
- height and width.`,T,N,a,s,o,l,n),w.createElement("div",{id:m?"".concat(m):void 0,className:pr("recharts-responsive-container",p),style:Hq(Hq({},y),{},{width:a,height:s,minWidth:o,minHeight:l,maxHeight:c}),ref:x},w.createElement("div",{style:kje({width:a,height:s})},w.createElement(oJ,{width:T,height:N},d)))}),Fm=w.forwardRef((t,e)=>{var n=QL();if(Vc(n.width)&&Vc(n.height))return t.children;var{width:r,height:a}=Nje({width:t.width,height:t.height,aspect:t.aspect}),{calculatedWidth:s,calculatedHeight:o}=aJ(void 0,void 0,{width:r,height:a,aspect:t.aspect,maxHeight:t.maxHeight});return Gt(s)&&Gt(o)?w.createElement(oJ,{width:s,height:o},t.children):w.createElement(Mje,tR({},t,{width:r,height:a,ref:e}))});function ZL(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 V0=()=>{var t,e=va(),n=Kt(mje),r=Kt(WC),a=(t=Kt(GC))===null||t===void 0?void 0:t.padding;return!e||!r||!a?n:{width:r.width-a.left-a.right,height:r.height-a.top-a.bottom,x:a.left,y:a.top}},Eje={top:0,bottom:0,left:0,right:0,width:0,height:0,brushBottom:0},lJ=()=>{var t;return(t=Kt(ya))!==null&&t!==void 0?t:Eje},JL=()=>Kt(Su),eO=()=>Kt(_u),jje=()=>Kt(t=>t.layout.margin),hr=t=>t.layout.layoutType,fh=()=>Kt(hr),tO=()=>{var t=fh();if(t==="horizontal"||t==="vertical")return t},cJ=t=>{var e=t.layout.layoutType;if(e==="centric"||e==="radial")return e},Dje=()=>{var t=fh();return t!==void 0},G0=t=>{var e=Zr(),n=va(),{width:r,height:a}=t,s=QL(),o=r,l=a;return s&&(o=s.width>0?s.width:r,l=s.height>0?s.height:a),w.useEffect(()=>{!n&&Vc(o)&&Vc(l)&&e(zEe({width:o,height:l}))},[e,n,o,l]),null},dJ=Symbol.for("immer-nothing"),$q=Symbol.for("immer-draftable"),zo=Symbol.for("immer-state");function Wl(t,...e){throw new Error(`[Immer] minified error nr: ${t}. Full error at: https://bit.ly/3cXEKWf`)}var t0=Object.getPrototypeOf;function $b(t){return!!t&&!!t[zo]}function af(t){return t?uJ(t)||Array.isArray(t)||!!t[$q]||!!t.constructor?.[$q]||W0(t)||YC(t):!1}var Rje=Object.prototype.constructor.toString(),qq=new WeakMap;function uJ(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 r=qq.get(n);return r===void 0&&(r=Function.toString.call(n),qq.set(n,r)),r===Rje}function Ck(t,e,n=!0){KC(t)===0?(n?Reflect.ownKeys(t):Object.keys(t)).forEach(a=>{e(a,t[a],t)}):t.forEach((r,a)=>e(a,r,t))}function KC(t){const e=t[zo];return e?e.type_:Array.isArray(t)?1:W0(t)?2:YC(t)?3:0}function nR(t,e){return KC(t)===2?t.has(e):Object.prototype.hasOwnProperty.call(t,e)}function mJ(t,e,n){const r=KC(t);r===2?t.set(e,n):r===3?t.add(n):t[e]=n}function Fje(t,e){return t===e?t!==0||1/t===1/e:t!==t&&e!==e}function W0(t){return t instanceof Map}function YC(t){return t instanceof Set}function ip(t){return t.copy_||t.base_}function rR(t,e){if(W0(t))return new Map(t);if(YC(t))return new Set(t);if(Array.isArray(t))return Array.prototype.slice.call(t);const n=uJ(t);if(e===!0||e==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(t);delete r[zo];let a=Reflect.ownKeys(r);for(let s=0;s<a.length;s++){const o=a[s],l=r[o];l.writable===!1&&(l.writable=!0,l.configurable=!0),(l.get||l.set)&&(r[o]={configurable:!0,writable:!0,enumerable:l.enumerable,value:t[o]})}return Object.create(t0(t),r)}else{const r=t0(t);if(r!==null&&n)return{...t};const a=Object.create(r);return Object.assign(a,t)}}function nO(t,e=!1){return XC(t)||$b(t)||!af(t)||(KC(t)>1&&Object.defineProperties(t,{set:E_,add:E_,clear:E_,delete:E_}),Object.freeze(t),e&&Object.values(t).forEach(n=>nO(n,!0))),t}function Lje(){Wl(2)}var E_={value:Lje};function XC(t){return t===null||typeof t!="object"?!0:Object.isFrozen(t)}var Oje={};function sf(t){const e=Oje[t];return e||Wl(0,t),e}var n0;function hJ(){return n0}function Ije(t,e){return{drafts_:[],parent_:t,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Vq(t,e){e&&(sf("Patches"),t.patches_=[],t.inversePatches_=[],t.patchListener_=e)}function iR(t){aR(t),t.drafts_.forEach(zje),t.drafts_=null}function aR(t){t===n0&&(n0=t.parent_)}function Gq(t){return n0=Ije(n0,t)}function zje(t){const e=t[zo];e.type_===0||e.type_===1?e.revoke_():e.revoked_=!0}function Wq(t,e){e.unfinalizedDrafts_=e.drafts_.length;const n=e.drafts_[0];return t!==void 0&&t!==n?(n[zo].modified_&&(iR(e),Wl(4)),af(t)&&(t=Tk(e,t),e.parent_||Pk(e,t)),e.patches_&&sf("Patches").generateReplacementPatches_(n[zo].base_,t,e.patches_,e.inversePatches_)):t=Tk(e,n,[]),iR(e),e.patches_&&e.patchListener_(e.patches_,e.inversePatches_),t!==dJ?t:void 0}function Tk(t,e,n){if(XC(e))return e;const r=t.immer_.shouldUseStrictIteration(),a=e[zo];if(!a)return Ck(e,(s,o)=>Kq(t,a,e,s,o,n),r),e;if(a.scope_!==t)return e;if(!a.modified_)return Pk(t,a.base_,!0),a.base_;if(!a.finalized_){a.finalized_=!0,a.scope_.unfinalizedDrafts_--;const s=a.copy_;let o=s,l=!1;a.type_===3&&(o=new Set(s),s.clear(),l=!0),Ck(o,(c,d)=>Kq(t,a,s,c,d,n,l),r),Pk(t,s,!1),n&&t.patches_&&sf("Patches").generatePatches_(a,n,t.patches_,t.inversePatches_)}return a.copy_}function Kq(t,e,n,r,a,s,o){if(a==null||typeof a!="object"&&!o)return;const l=XC(a);if(!(l&&!o)){if($b(a)){const c=s&&e&&e.type_!==3&&!nR(e.assigned_,r)?s.concat(r):void 0,d=Tk(t,a,c);if(mJ(n,r,d),$b(d))t.canAutoFreeze_=!1;else return}else o&&n.add(a);if(af(a)&&!l){if(!t.immer_.autoFreeze_&&t.unfinalizedDrafts_<1||e&&e.base_&&e.base_[r]===a&&l)return;Tk(t,a),(!e||!e.scope_.parent_)&&typeof r!="symbol"&&(W0(n)?n.has(r):Object.prototype.propertyIsEnumerable.call(n,r))&&Pk(t,a)}}}function Pk(t,e,n=!1){!t.parent_&&t.immer_.autoFreeze_&&t.canAutoFreeze_&&nO(e,n)}function Uje(t,e){const n=Array.isArray(t),r={type_:n?1:0,scope_:e?e.scope_:hJ(),modified_:!1,finalized_:!1,assigned_:{},parent_:e,base_:t,draft_:null,copy_:null,revoke_:null,isManual_:!1};let a=r,s=rO;n&&(a=[r],s=r0);const{revoke:o,proxy:l}=Proxy.revocable(a,s);return r.draft_=l,r.revoke_=o,l}var rO={get(t,e){if(e===zo)return t;const n=ip(t);if(!nR(n,e))return Bje(t,n,e);const r=n[e];return t.finalized_||!af(r)?r:r===TE(t.base_,e)?(PE(t),t.copy_[e]=oR(r,t)):r},has(t,e){return e in ip(t)},ownKeys(t){return Reflect.ownKeys(ip(t))},set(t,e,n){const r=pJ(ip(t),e);if(r?.set)return r.set.call(t.draft_,n),!0;if(!t.modified_){const a=TE(ip(t),e),s=a?.[zo];if(s&&s.base_===n)return t.copy_[e]=n,t.assigned_[e]=!1,!0;if(Fje(n,a)&&(n!==void 0||nR(t.base_,e)))return!0;PE(t),sR(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 TE(t.base_,e)!==void 0||e in t.base_?(t.assigned_[e]=!1,PE(t),sR(t)):delete t.assigned_[e],t.copy_&&delete t.copy_[e],!0},getOwnPropertyDescriptor(t,e){const n=ip(t),r=Reflect.getOwnPropertyDescriptor(n,e);return r&&{writable:!0,configurable:t.type_!==1||e!=="length",enumerable:r.enumerable,value:n[e]}},defineProperty(){Wl(11)},getPrototypeOf(t){return t0(t.base_)},setPrototypeOf(){Wl(12)}},r0={};Ck(rO,(t,e)=>{r0[t]=function(){return arguments[0]=arguments[0][0],e.apply(this,arguments)}});r0.deleteProperty=function(t,e){return r0.set.call(this,t,e,void 0)};r0.set=function(t,e,n){return rO.set.call(this,t[0],e,n,t[0])};function TE(t,e){const n=t[zo];return(n?ip(n):t)[e]}function Bje(t,e,n){const r=pJ(e,n);return r?"value"in r?r.value:r.get?.call(t.draft_):void 0}function pJ(t,e){if(!(e in t))return;let n=t0(t);for(;n;){const r=Object.getOwnPropertyDescriptor(n,e);if(r)return r;n=t0(n)}}function sR(t){t.modified_||(t.modified_=!0,t.parent_&&sR(t.parent_))}function PE(t){t.copy_||(t.copy_=rR(t.base_,t.scope_.immer_.useStrictShallowCopy_))}var Hje=class{constructor(t){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!0,this.produce=(e,n,r)=>{if(typeof e=="function"&&typeof n!="function"){const s=n;n=e;const o=this;return function(c=s,...d){return o.produce(c,u=>n.call(this,u,...d))}}typeof n!="function"&&Wl(6),r!==void 0&&typeof r!="function"&&Wl(7);let a;if(af(e)){const s=Gq(this),o=oR(e,void 0);let l=!0;try{a=n(o),l=!1}finally{l?iR(s):aR(s)}return Vq(s,r),Wq(a,s)}else if(!e||typeof e!="object"){if(a=n(e),a===void 0&&(a=e),a===dJ&&(a=void 0),this.autoFreeze_&&nO(a,!0),r){const s=[],o=[];sf("Patches").generateReplacementPatches_(e,a,s,o),r(s,o)}return a}else Wl(1,e)},this.produceWithPatches=(e,n)=>{if(typeof e=="function")return(o,...l)=>this.produceWithPatches(o,c=>e(c,...l));let r,a;return[this.produce(e,n,(o,l)=>{r=o,a=l}),r,a]},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){af(t)||Wl(8),$b(t)&&(t=$je(t));const e=Gq(this),n=oR(t,void 0);return n[zo].isManual_=!0,aR(e),n}finishDraft(t,e){const n=t&&t[zo];(!n||!n.isManual_)&&Wl(9);const{scope_:r}=n;return Vq(r,e),Wq(void 0,r)}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 a=e[n];if(a.path.length===0&&a.op==="replace"){t=a.value;break}}n>-1&&(e=e.slice(n+1));const r=sf("Patches").applyPatches_;return $b(t)?r(t,e):this.produce(t,a=>r(a,e))}};function oR(t,e){const n=W0(t)?sf("MapSet").proxyMap_(t,e):YC(t)?sf("MapSet").proxySet_(t,e):Uje(t,e);return(e?e.scope_:hJ()).drafts_.push(n),n}function $je(t){return $b(t)||Wl(10,t),fJ(t)}function fJ(t){if(!af(t)||XC(t))return t;const e=t[zo];let n,r=!0;if(e){if(!e.modified_)return e.base_;e.finalized_=!0,n=rR(t,e.scope_.immer_.useStrictShallowCopy_),r=e.scope_.immer_.shouldUseStrictIteration()}else n=rR(t,!0);return Ck(n,(a,s)=>{mJ(n,a,fJ(s))},r),e&&(e.finalized_=!1),n}var qje=new Hje;qje.produce;var Vje={settings:{layout:"horizontal",align:"center",verticalAlign:"middle",itemSorter:"value"},size:{width:0,height:0},payload:[]},gJ=ho({name:"legend",initialState:Vje,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:ui()},replaceLegendPayload:{reducer(t,e){var{prev:n,next:r}=e.payload,a=Jl(t).payload.indexOf(n);a>-1&&(t.payload[a]=r)},prepare:ui()},removeLegendPayload:{reducer(t,e){var n=Jl(t).payload.indexOf(e.payload);n>-1&&t.payload.splice(n,1)},prepare:ui()}}}),{setLegendSize:Yq,setLegendSettings:Gje,addLegendPayload:bJ,replaceLegendPayload:xJ,removeLegendPayload:yJ}=gJ.actions,Wje=gJ.reducer,Kje=["contextPayload"];function lR(){return lR=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},lR.apply(null,arguments)}function Xq(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),n.push.apply(n,r)}return n}function qb(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Xq(Object(n),!0).forEach(function(r){Yje(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Xq(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Yje(t,e,n){return(e=Xje(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Xje(t){var e=Qje(t,"string");return typeof e=="symbol"?e:e+""}function Qje(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Zje(t,e){if(t==null)return{};var n,r,a=Jje(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(r=0;r<s.length;r++)n=s[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(a[n]=t[n])}return a}function Jje(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}function eDe(t){return t.value}function tDe(t){var{contextPayload:e}=t,n=Zje(t,Kje),r=gZ(e,t.payloadUniqBy,eDe),a=qb(qb({},n),{},{payload:r});return w.isValidElement(t.content)?w.cloneElement(t.content,a):typeof t.content=="function"?w.createElement(t.content,a):w.createElement(YMe,a)}function nDe(t,e,n,r,a,s){var{layout:o,align:l,verticalAlign:c}=e,d,u;return(!t||(t.left===void 0||t.left===null)&&(t.right===void 0||t.right===null))&&(l==="center"&&o==="vertical"?d={left:((r||0)-s.width)/2}:d=l==="right"?{right:n&&n.right||0}:{left:n&&n.left||0}),(!t||(t.top===void 0||t.top===null)&&(t.bottom===void 0||t.bottom===null))&&(c==="middle"?u={top:((a||0)-s.height)/2}:u=c==="bottom"?{bottom:n&&n.bottom||0}:{top:n&&n.top||0}),qb(qb({},d),u)}function rDe(t){var e=Zr();return w.useEffect(()=>{e(Gje(t))},[e,t]),null}function iDe(t){var e=Zr();return w.useEffect(()=>(e(Yq(t)),()=>{e(Yq({width:0,height:0}))}),[e,t]),null}function aDe(t,e,n,r){return t==="vertical"&&e!=null?{height:e}:t==="horizontal"?{width:n||r}:null}var sDe={align:"center",iconSize:14,inactiveColor:"#ccc",itemSorter:"value",layout:"horizontal",verticalAlign:"bottom"};function vJ(t){var e=ki(t,sDe),n=B2e(),r=BAe(),a=jje(),{width:s,height:o,wrapperStyle:l,portal:c}=e,[d,u]=SZ([n]),m=JL(),p=eO();if(m==null||p==null)return null;var f=m-(a?.left||0)-(a?.right||0),y=aDe(e.layout,o,s,f),x=c?l:qb(qb({position:"absolute",width:y?.width||s||"auto",height:y?.height||o||"auto"},nDe(l,e,a,m,p,d)),l),b=c??r;if(b==null||n==null)return null;var v=w.createElement("div",{className:"recharts-legend-wrapper",style:x,ref:u},w.createElement(rDe,{layout:e.layout,align:e.align,verticalAlign:e.verticalAlign,itemSorter:e.itemSorter}),!c&&w.createElement(iDe,{width:d.width,height:d.height}),w.createElement(tDe,lR({},e,y,{margin:a,chartWidth:m,chartHeight:p,contextPayload:n})));return $d.createPortal(v,b)}vJ.displayName="Legend";function cR(){return cR=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},cR.apply(null,arguments)}function Qq(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),n.push.apply(n,r)}return n}function jy(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Qq(Object(n),!0).forEach(function(r){oDe(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Qq(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function oDe(t,e,n){return(e=lDe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function lDe(t){var e=cDe(t,"string");return typeof e=="symbol"?e:e+""}function cDe(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function dDe(t){return Array.isArray(t)&&Nl(t[0])&&Nl(t[1])?t.join(" ~ "):t}var zg={separator:" : ",contentStyle:{margin:0,padding:10,backgroundColor:"#fff",border:"1px solid #ccc",whiteSpace:"nowrap"},itemStyle:{display:"block",paddingTop:4,paddingBottom:4,color:"#000"},labelStyle:{},accessibilityLayer:!1},uDe=t=>{var{separator:e=zg.separator,contentStyle:n,itemStyle:r,labelStyle:a=zg.labelStyle,payload:s,formatter:o,itemSorter:l,wrapperClassName:c,labelClassName:d,label:u,labelFormatter:m,accessibilityLayer:p=zg.accessibilityLayer}=t,f=()=>{if(s&&s.length){var C={padding:0,margin:0},T=(l?RC(s,l):s).map((N,R)=>{if(N.type==="none")return null;var A=N.formatter||o||dDe,{value:D,name:$}=N,U=D,G=$;if(A){var L=A(D,$,N,R,s);if(Array.isArray(L))[U,G]=L;else if(L!=null)U=L;else return null}var te=jy(jy({},zg.itemStyle),{},{color:N.color||zg.itemStyle.color},r);return w.createElement("li",{className:"recharts-tooltip-item",key:"tooltip-item-".concat(R),style:te},Nl(G)?w.createElement("span",{className:"recharts-tooltip-item-name"},G):null,Nl(G)?w.createElement("span",{className:"recharts-tooltip-item-separator"},e):null,w.createElement("span",{className:"recharts-tooltip-item-value"},U),w.createElement("span",{className:"recharts-tooltip-item-unit"},N.unit||""))});return w.createElement("ul",{className:"recharts-tooltip-item-list",style:C},T)}return null},y=jy(jy({},zg.contentStyle),n),x=jy({margin:0},a),b=!fi(u),v=b?u:"",_=pr("recharts-default-tooltip",c),k=pr("recharts-tooltip-label",d);b&&m&&s!==void 0&&s!==null&&(v=m(u,s));var P=p?{role:"status","aria-live":"assertive"}:{};return w.createElement("div",cR({className:_,style:y},P),w.createElement("p",{className:k,style:x},w.isValidElement(v)?v:"".concat(v)),f())},Dy="recharts-tooltip-wrapper",mDe={visibility:"hidden"};function hDe(t){var{coordinate:e,translateX:n,translateY:r}=t;return pr(Dy,{["".concat(Dy,"-right")]:Gt(n)&&e&&Gt(e.x)&&n>=e.x,["".concat(Dy,"-left")]:Gt(n)&&e&&Gt(e.x)&&n<e.x,["".concat(Dy,"-bottom")]:Gt(r)&&e&&Gt(e.y)&&r>=e.y,["".concat(Dy,"-top")]:Gt(r)&&e&&Gt(e.y)&&r<e.y})}function Zq(t){var{allowEscapeViewBox:e,coordinate:n,key:r,offset:a,position:s,reverseDirection:o,tooltipDimension:l,viewBox:c,viewBoxDimension:d}=t;if(s&&Gt(s[r]))return s[r];var u=n[r]-l-(a>0?a:0),m=n[r]+a;if(e[r])return o[r]?u:m;var p=c[r];if(p==null)return 0;if(o[r]){var f=u,y=p;return f<y?Math.max(m,p):Math.max(u,p)}if(d==null)return 0;var x=m+l,b=p+d;return x>b?Math.max(u,p):Math.max(m,p)}function pDe(t){var{translateX:e,translateY:n,useTranslate3d:r}=t;return{transform:r?"translate3d(".concat(e,"px, ").concat(n,"px, 0)"):"translate(".concat(e,"px, ").concat(n,"px)")}}function fDe(t){var{allowEscapeViewBox:e,coordinate:n,offsetTop:r,offsetLeft:a,position:s,reverseDirection:o,tooltipBox:l,useTranslate3d:c,viewBox:d}=t,u,m,p;return l.height>0&&l.width>0&&n?(m=Zq({allowEscapeViewBox:e,coordinate:n,key:"x",offset:a,position:s,reverseDirection:o,tooltipDimension:l.width,viewBox:d,viewBoxDimension:d.width}),p=Zq({allowEscapeViewBox:e,coordinate:n,key:"y",offset:r,position:s,reverseDirection:o,tooltipDimension:l.height,viewBox:d,viewBoxDimension:d.height}),u=pDe({translateX:m,translateY:p,useTranslate3d:c})):u=mDe,{cssProperties:u,cssClasses:hDe({translateX:m,translateY:p,coordinate:n})}}function Jq(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),n.push.apply(n,r)}return n}function j_(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Jq(Object(n),!0).forEach(function(r){dR(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Jq(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function dR(t,e,n){return(e=gDe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function gDe(t){var e=bDe(t,"string");return typeof e=="symbol"?e:e+""}function bDe(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}class xDe extends w.PureComponent{constructor(){super(...arguments),dR(this,"state",{dismissed:!1,dismissedAtCoordinate:{x:0,y:0}}),dR(this,"handleKeyDown",e=>{if(e.key==="Escape"){var n,r,a,s;this.setState({dismissed:!0,dismissedAtCoordinate:{x:(n=(r=this.props.coordinate)===null||r===void 0?void 0:r.x)!==null&&n!==void 0?n:0,y:(a=(s=this.props.coordinate)===null||s===void 0?void 0:s.y)!==null&&a!==void 0?a: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:r,animationEasing:a,children:s,coordinate:o,hasPayload:l,isAnimationActive:c,offset:d,position:u,reverseDirection:m,useTranslate3d:p,viewBox:f,wrapperStyle:y,lastBoundingBox:x,innerRef:b,hasPortalFromProps:v}=this.props,_=typeof d=="number"?d:d.x,k=typeof d=="number"?d:d.y,{cssClasses:P,cssProperties:C}=fDe({allowEscapeViewBox:n,coordinate:o,offsetLeft:_,offsetTop:k,position:u,reverseDirection:m,tooltipBox:{height:x.height,width:x.width},useTranslate3d:p,viewBox:f}),T=v?{}:j_(j_({transition:c&&e?"transform ".concat(r,"ms ").concat(a):void 0},C),{},{pointerEvents:"none",visibility:!this.state.dismissed&&e&&l?"visible":"hidden",position:"absolute",top:0,left:0}),N=j_(j_({},T),{},{visibility:!this.state.dismissed&&e&&l?"visible":"hidden"},y);return w.createElement("div",{xmlns:"http://www.w3.org/1999/xhtml",tabIndex:-1,className:P,style:N,ref:b},s)}}var wJ=()=>{var t;return(t=Kt(e=>e.rootProps.accessibilityLayer))!==null&&t!==void 0?t:!0};function uR(){return uR=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},uR.apply(null,arguments)}function eV(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),n.push.apply(n,r)}return n}function tV(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?eV(Object(n),!0).forEach(function(r){yDe(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):eV(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function yDe(t,e,n){return(e=vDe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function vDe(t){var e=wDe(t,"string");return typeof e=="symbol"?e:e+""}function wDe(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var nV={curveBasisClosed:sMe,curveBasisOpen:oMe,curveBasis:aMe,curveBumpX:VAe,curveBumpY:GAe,curveLinearClosed:lMe,curveLinear:jC,curveMonotoneX:cMe,curveMonotoneY:dMe,curveNatural:uMe,curveStep:mMe,curveStepAfter:pMe,curveStepBefore:hMe},Ak=t=>Ln(t.x)&&Ln(t.y),rV=t=>t.base!=null&&Ak(t.base)&&Ak(t),Ry=t=>t.x,Fy=t=>t.y,SDe=(t,e)=>{if(typeof t=="function")return t;var n="curve".concat(U0(t));if((n==="curveMonotone"||n==="curveBump")&&e){var r=nV["".concat(n).concat(e==="vertical"?"Y":"X")];if(r)return r}return nV[n]||jC},iV={connectNulls:!1,type:"linear"},_De=t=>{var{type:e=iV.type,points:n=[],baseLine:r,layout:a,connectNulls:s=iV.connectNulls}=t,o=SDe(e,a),l=s?n.filter(Ak):n;if(Array.isArray(r)){var c,d=n.map((y,x)=>tV(tV({},y),{},{base:r[x]}));a==="vertical"?c=k_().y(Fy).x1(Ry).x0(y=>y.base.x):c=k_().x(Ry).y1(Fy).y0(y=>y.base.y);var u=c.defined(rV).curve(o),m=s?d.filter(rV):d;return u(m)}var p;a==="vertical"&&Gt(r)?p=k_().y(Fy).x1(Ry).x0(r):Gt(r)?p=k_().x(Ry).y1(Fy).y0(r):p=GQ().x(Ry).y(Fy);var f=p.defined(Ak).curve(o);return f(l)},Sb=t=>{var{className:e,points:n,path:r,pathRef:a}=t,s=fh();if((!n||!n.length)&&!r)return null;var o={type:t.type,points:t.points,baseLine:t.baseLine,layout:t.layout||s,connectNulls:t.connectNulls},l=n&&n.length?_De(o):r;return w.createElement("path",uR({},Is(t),UL(t),{className:pr("recharts-curve",e),d:l===null?void 0:l,ref:a}))},kDe=["x","y","top","left","width","height","className"];function mR(){return mR=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},mR.apply(null,arguments)}function aV(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),n.push.apply(n,r)}return n}function NDe(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?aV(Object(n),!0).forEach(function(r){CDe(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):aV(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function CDe(t,e,n){return(e=TDe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function TDe(t){var e=PDe(t,"string");return typeof e=="symbol"?e:e+""}function PDe(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function ADe(t,e){if(t==null)return{};var n,r,a=MDe(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(r=0;r<s.length;r++)n=s[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(a[n]=t[n])}return a}function MDe(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}var EDe=(t,e,n,r,a,s)=>"M".concat(t,",").concat(a,"v").concat(r,"M").concat(s,",").concat(e,"h").concat(n),jDe=t=>{var{x:e=0,y:n=0,top:r=0,left:a=0,width:s=0,height:o=0,className:l}=t,c=ADe(t,kDe),d=NDe({x:e,y:n,top:r,left:a,width:s,height:o},c);return!Gt(e)||!Gt(n)||!Gt(s)||!Gt(o)||!Gt(r)||!Gt(a)?null:w.createElement("path",mR({},ns(d),{className:pr("recharts-cross",l),d:EDe(e,n,s,o,r,a)}))};function DDe(t,e,n,r){var a=r/2;return{stroke:"none",fill:"#ccc",x:t==="horizontal"?e.x-a:n.left+.5,y:t==="horizontal"?n.top+.5:e.y-a,width:t==="horizontal"?r:n.width-1,height:t==="horizontal"?n.height-1:r}}function sV(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),n.push.apply(n,r)}return n}function oV(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?sV(Object(n),!0).forEach(function(r){RDe(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):sV(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function RDe(t,e,n){return(e=FDe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function FDe(t){var e=LDe(t,"string");return typeof e=="symbol"?e:e+""}function LDe(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var ODe=t=>t.replace(/([A-Z])/g,e=>"-".concat(e.toLowerCase())),SJ=(t,e,n)=>t.map(r=>"".concat(ODe(r)," ").concat(e,"ms ").concat(n)).join(","),IDe=(t,e)=>[Object.keys(t),Object.keys(e)].reduce((n,r)=>n.filter(a=>r.includes(a))),i0=(t,e)=>Object.keys(e).reduce((n,r)=>oV(oV({},n),{},{[r]:t(r,e[r])}),{});function lV(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),n.push.apply(n,r)}return n}function ma(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?lV(Object(n),!0).forEach(function(r){zDe(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):lV(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function zDe(t,e,n){return(e=UDe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function UDe(t){var e=BDe(t,"string");return typeof e=="symbol"?e:e+""}function BDe(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Mk=(t,e,n)=>t+(e-t)*n,hR=t=>{var{from:e,to:n}=t;return e!==n},_J=(t,e,n)=>{var r=i0((a,s)=>{if(hR(s)){var[o,l]=t(s.from,s.to,s.velocity);return ma(ma({},s),{},{from:o,velocity:l})}return s},e);return n<1?i0((a,s)=>hR(s)&&r[a]!=null?ma(ma({},s),{},{velocity:Mk(s.velocity,r[a].velocity,n),from:Mk(s.from,r[a].from,n)}):s,e):_J(t,r,n-1)};function HDe(t,e,n,r,a,s){var o,l=r.reduce((p,f)=>ma(ma({},p),{},{[f]:{from:t[f],velocity:0,to:e[f]}}),{}),c=()=>i0((p,f)=>f.from,l),d=()=>!Object.values(l).filter(hR).length,u=null,m=p=>{o||(o=p);var f=p-o,y=f/n.dt;l=_J(n,l,y),a(ma(ma(ma({},t),e),c())),o=p,d()||(u=s.setTimeout(m))};return()=>(u=s.setTimeout(m),()=>{var p;(p=u)===null||p===void 0||p()})}function $De(t,e,n,r,a,s,o){var l=null,c=a.reduce((m,p)=>{var f=t[p],y=e[p];return f==null||y==null?m:ma(ma({},m),{},{[p]:[f,y]})},{}),d,u=m=>{d||(d=m);var p=(m-d)/r,f=i0((x,b)=>Mk(...b,n(p)),c);if(s(ma(ma(ma({},t),e),f)),p<1)l=o.setTimeout(u);else{var y=i0((x,b)=>Mk(...b,n(1)),c);s(ma(ma(ma({},t),e),y))}};return()=>(l=o.setTimeout(u),()=>{var m;(m=l)===null||m===void 0||m()})}const qDe=(t,e,n,r,a,s)=>{var o=IDe(t,e);return n==null?()=>(a(ma(ma({},t),e)),()=>{}):n.isStepper===!0?HDe(t,e,n,o,a,s):$De(t,e,n,r,o,a,s)};var Ek=1e-4,kJ=(t,e)=>[0,3*t,3*e-6*t,3*t-3*e+1],NJ=(t,e)=>t.map((n,r)=>n*e**r).reduce((n,r)=>n+r),cV=(t,e)=>n=>{var r=kJ(t,e);return NJ(r,n)},VDe=(t,e)=>n=>{var r=kJ(t,e),a=[...r.map((s,o)=>s*o).slice(1),0];return NJ(a,n)},GDe=t=>{var e,n=t.split("(");if(n.length!==2||n[0]!=="cubic-bezier")return null;var r=(e=n[1])===null||e===void 0||(e=e.split(")")[0])===null||e===void 0?void 0:e.split(",");if(r==null||r.length!==4)return null;var a=r.map(s=>parseFloat(s));return[a[0],a[1],a[2],a[3]]},WDe=function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];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 a=GDe(n[0]);if(a)return a}}return n.length===4?n:[0,0,1,1]},KDe=(t,e,n,r)=>{var a=cV(t,n),s=cV(e,r),o=VDe(t,n),l=d=>d>1?1:d<0?0:d,c=d=>{for(var u=d>1?1:d,m=u,p=0;p<8;++p){var f=a(m)-u,y=o(m);if(Math.abs(f-u)<Ek||y<Ek)return s(m);m=l(m-f/y)}return s(m)};return c.isStepper=!1,c},dV=function(){return KDe(...WDe(...arguments))},YDe=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},{stiff:n=100,damping:r=8,dt:a=17}=e,s=(o,l,c)=>{var d=-(o-l)*n,u=c*r,m=c+(d-u)*a/1e3,p=c*a/1e3+o;return Math.abs(p-l)<Ek&&Math.abs(m)<Ek?[l,0]:[p,m]};return s.isStepper=!0,s.dt=a,s},XDe=t=>{if(typeof t=="string")switch(t){case"ease":case"ease-in-out":case"ease-out":case"ease-in":case"linear":return dV(t);case"spring":return YDe();default:if(t.split("(")[0]==="cubic-bezier")return dV(t)}return typeof t=="function"?t:null};function QDe(t){var e,n=()=>null,r=!1,a=null,s=o=>{if(!r){if(Array.isArray(o)){if(!o.length)return;var l=o,[c,...d]=l;if(typeof c=="number"){a=t.setTimeout(s.bind(null,d),c);return}s(c),a=t.setTimeout(s.bind(null,d));return}typeof o=="string"&&(e=o,n(e)),typeof o=="object"&&(e=o,n(e)),typeof o=="function"&&o()}};return{stop:()=>{r=!0},start:o=>{r=!1,a&&(a(),a=null),s(o)},subscribe:o=>(n=o,()=>{n=()=>null}),getTimeoutController:()=>t}}class ZDe{setTimeout(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=performance.now(),a=null,s=o=>{o-r>=n?e(o):typeof requestAnimationFrame=="function"&&(a=requestAnimationFrame(s))};return a=requestAnimationFrame(s),()=>{a!=null&&cancelAnimationFrame(a)}}}function JDe(){return QDe(new ZDe)}var e3e=w.createContext(JDe);function t3e(t,e){var n=w.useContext(e3e);return w.useMemo(()=>e??n(t),[t,e,n])}var n3e=()=>!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout),K0={isSsr:n3e()},r3e={begin:0,duration:1e3,easing:"ease",isActive:!0,canBegin:!0,onAnimationEnd:()=>{},onAnimationStart:()=>{}},uV={t:0},AE={t:1};function gx(t){var e=ki(t,r3e),{isActive:n,canBegin:r,duration:a,easing:s,begin:o,onAnimationEnd:l,onAnimationStart:c,children:d}=e,u=n==="auto"?!K0.isSsr:n,m=t3e(e.animationId,e.animationManager),[p,f]=w.useState(u?uV:AE),y=w.useRef(null);return w.useEffect(()=>{u||f(AE)},[u]),w.useEffect(()=>{if(!u||!r)return hh;var x=qDe(uV,AE,XDe(s),a,f,m.getTimeoutController()),b=()=>{y.current=x()};return m.start([c,o,b,a,l]),()=>{m.stop(),y.current&&y.current(),l()}},[u,r,a,s,o,c,l,m]),d(p.t)}function bx(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"animation-",n=w.useRef(Qv(e)),r=w.useRef(t);return r.current!==t&&(n.current=Qv(e),r.current=t),n.current}var i3e=["radius"],a3e=["radius"],mV,hV,pV,fV,gV,bV,xV,yV,vV,wV;function SV(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),n.push.apply(n,r)}return n}function _V(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?SV(Object(n),!0).forEach(function(r){s3e(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):SV(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function s3e(t,e,n){return(e=o3e(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function o3e(t){var e=l3e(t,"string");return typeof e=="symbol"?e:e+""}function l3e(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function jk(){return jk=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},jk.apply(null,arguments)}function kV(t,e){if(t==null)return{};var n,r,a=c3e(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(r=0;r<s.length;r++)n=s[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(a[n]=t[n])}return a}function c3e(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}function wc(t,e){return e||(e=t.slice(0)),Object.freeze(Object.defineProperties(t,{raw:{value:Object.freeze(e)}}))}var NV=(t,e,n,r,a)=>{var s=Rm(n),o=Rm(r),l=Math.min(Math.abs(s)/2,Math.abs(o)/2),c=o>=0?1:-1,d=s>=0?1:-1,u=o>=0&&s>=0||o<0&&s<0?1:0,m;if(l>0&&Array.isArray(a)){for(var p=[0,0,0,0],f=0,y=4;f<y;f++){var x,b=(x=a[f])!==null&&x!==void 0?x:0;p[f]=b>l?l:b}m=ji(mV||(mV=wc(["M",",",""])),t,e+c*p[0]),p[0]>0&&(m+=ji(hV||(hV=wc(["A ",",",",0,0,",",",",",""])),p[0],p[0],u,t+d*p[0],e)),m+=ji(pV||(pV=wc(["L ",",",""])),t+n-d*p[1],e),p[1]>0&&(m+=ji(fV||(fV=wc(["A ",",",",0,0,",`,
- `,",",""])),p[1],p[1],u,t+n,e+c*p[1])),m+=ji(gV||(gV=wc(["L ",",",""])),t+n,e+r-c*p[2]),p[2]>0&&(m+=ji(bV||(bV=wc(["A ",",",",0,0,",`,
- `,",",""])),p[2],p[2],u,t+n-d*p[2],e+r)),m+=ji(xV||(xV=wc(["L ",",",""])),t+d*p[3],e+r),p[3]>0&&(m+=ji(yV||(yV=wc(["A ",",",",0,0,",`,
- `,",",""])),p[3],p[3],u,t,e+r-c*p[3])),m+="Z"}else if(l>0&&a===+a&&a>0){var v=Math.min(l,a);m=ji(vV||(vV=wc(["M ",",",`
- A `,",",",0,0,",",",",",`
- L `,",",`
- A `,",",",0,0,",",",",",`
- L `,",",`
- A `,",",",0,0,",",",",",`
- L `,",",`
- A `,",",",0,0,",",",","," Z"])),t,e+c*v,v,v,u,t+d*v,e,t+n-d*v,e,v,v,u,t+n,e+c*v,t+n,e+r-c*v,v,v,u,t+n-d*v,e+r,t+d*v,e+r,v,v,u,t,e+r-c*v)}else m=ji(wV||(wV=wc(["M ",","," h "," v "," h "," Z"])),t,e,n,r,-n);return m},CV={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},CJ=t=>{var e=ki(t,CV),n=w.useRef(null),[r,a]=w.useState(-1);w.useEffect(()=>{if(n.current&&n.current.getTotalLength)try{var J=n.current.getTotalLength();J&&a(J)}catch{}},[]);var{x:s,y:o,width:l,height:c,radius:d,className:u}=e,{animationEasing:m,animationDuration:p,animationBegin:f,isAnimationActive:y,isUpdateAnimationActive:x}=e,b=w.useRef(l),v=w.useRef(c),_=w.useRef(s),k=w.useRef(o),P=w.useMemo(()=>({x:s,y:o,width:l,height:c,radius:d}),[s,o,l,c,d]),C=bx(P,"rectangle-");if(s!==+s||o!==+o||l!==+l||c!==+c||l===0||c===0)return null;var T=pr("recharts-rectangle",u);if(!x){var N=ns(e),{radius:R}=N,A=kV(N,i3e);return w.createElement("path",jk({},A,{x:Rm(s),y:Rm(o),width:Rm(l),height:Rm(c),radius:typeof d=="number"?d:void 0,className:T,d:NV(s,o,l,c,d)}))}var D=b.current,$=v.current,U=_.current,G=k.current,L="0px ".concat(r===-1?1:r,"px"),te="".concat(r,"px 0px"),re=SJ(["strokeDasharray"],p,typeof m=="string"?m:CV.animationEasing);return w.createElement(gx,{animationId:C,key:C,canBegin:r>0,duration:p,easing:m,isActive:x,begin:f},J=>{var ue=Cr(D,l,J),me=Cr($,c,J),ge=Cr(U,s,J),X=Cr(G,o,J);n.current&&(b.current=ue,v.current=me,_.current=ge,k.current=X);var ie;y?J>0?ie={transition:re,strokeDasharray:te}:ie={strokeDasharray:L}:ie={strokeDasharray:te};var le=ns(e),{radius:pe}=le,Ce=kV(le,a3e);return w.createElement("path",jk({},Ce,{radius:typeof d=="number"?d:void 0,className:T,d:NV(ge,X,ue,me,d),ref:n,style:_V(_V({},ie),e.style)}))})};function TV(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),n.push.apply(n,r)}return n}function PV(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?TV(Object(n),!0).forEach(function(r){d3e(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):TV(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function d3e(t,e,n){return(e=u3e(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function u3e(t){var e=m3e(t,"string");return typeof e=="symbol"?e:e+""}function m3e(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Dk=Math.PI/180,h3e=t=>t*180/Math.PI,ia=(t,e,n,r)=>({x:t+Math.cos(-Dk*r)*n,y:e+Math.sin(-Dk*r)*n}),TJ=function(e,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{top:0,right:0,bottom:0,left:0};return Math.min(Math.abs(e-(r.left||0)-(r.right||0)),Math.abs(n-(r.top||0)-(r.bottom||0)))/2},p3e=(t,e)=>{var{x:n,y:r}=t,{x:a,y:s}=e;return Math.sqrt((n-a)**2+(r-s)**2)},f3e=(t,e)=>{var{x:n,y:r}=t,{cx:a,cy:s}=e,o=p3e({x:n,y:r},{x:a,y:s});if(o<=0)return{radius:o,angle:0};var l=(n-a)/o,c=Math.acos(l);return r>s&&(c=2*Math.PI-c),{radius:o,angle:h3e(c),angleInRadian:c}},g3e=t=>{var{startAngle:e,endAngle:n}=t,r=Math.floor(e/360),a=Math.floor(n/360),s=Math.min(r,a);return{startAngle:e-s*360,endAngle:n-s*360}},b3e=(t,e)=>{var{startAngle:n,endAngle:r}=e,a=Math.floor(n/360),s=Math.floor(r/360),o=Math.min(a,s);return t+o*360},x3e=(t,e)=>{var{chartX:n,chartY:r}=t,{radius:a,angle:s}=f3e({x:n,y:r},e),{innerRadius:o,outerRadius:l}=e;if(a<o||a>l||a===0)return null;var{startAngle:c,endAngle:d}=g3e(e),u=s,m;if(c<=d){for(;u>d;)u-=360;for(;u<c;)u+=360;m=u>=c&&u<=d}else{for(;u>c;)u-=360;for(;u<d;)u+=360;m=u>=d&&u<=c}return m?PV(PV({},e),{},{radius:a,angle:b3e(u,e)}):null};function PJ(t){var{cx:e,cy:n,radius:r,startAngle:a,endAngle:s}=t,o=ia(e,n,r,a),l=ia(e,n,r,s);return{points:[o,l],cx:e,cy:n,radius:r,startAngle:a,endAngle:s}}var AV,MV,EV,jV,DV,RV,FV;function pR(){return pR=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},pR.apply(null,arguments)}function pp(t,e){return e||(e=t.slice(0)),Object.freeze(Object.defineProperties(t,{raw:{value:Object.freeze(e)}}))}var y3e=(t,e)=>{var n=Ra(e-t),r=Math.min(Math.abs(e-t),359.999);return n*r},D_=t=>{var{cx:e,cy:n,radius:r,angle:a,sign:s,isExternal:o,cornerRadius:l,cornerIsExternal:c}=t,d=l*(o?1:-1)+r,u=Math.asin(l/d)/Dk,m=c?a:a+s*u,p=ia(e,n,d,m),f=ia(e,n,r,m),y=c?a-s*u:a,x=ia(e,n,d*Math.cos(u*Dk),y);return{center:p,circleTangency:f,lineTangency:x,theta:u}},AJ=t=>{var{cx:e,cy:n,innerRadius:r,outerRadius:a,startAngle:s,endAngle:o}=t,l=y3e(s,o),c=s+l,d=ia(e,n,a,s),u=ia(e,n,a,c),m=ji(AV||(AV=pp(["M ",",",`
- A `,",",`,0,
- `,",",`,
- `,",",`
- `])),d.x,d.y,a,a,+(Math.abs(l)>180),+(s>c),u.x,u.y);if(r>0){var p=ia(e,n,r,s),f=ia(e,n,r,c);m+=ji(MV||(MV=pp(["L ",",",`
- A `,",",`,0,
- `,",",`,
- `,","," Z"])),f.x,f.y,r,r,+(Math.abs(l)>180),+(s<=c),p.x,p.y)}else m+=ji(EV||(EV=pp(["L ",","," Z"])),e,n);return m},v3e=t=>{var{cx:e,cy:n,innerRadius:r,outerRadius:a,cornerRadius:s,forceCornerRadius:o,cornerIsExternal:l,startAngle:c,endAngle:d}=t,u=Ra(d-c),{circleTangency:m,lineTangency:p,theta:f}=D_({cx:e,cy:n,radius:a,angle:c,sign:u,cornerRadius:s,cornerIsExternal:l}),{circleTangency:y,lineTangency:x,theta:b}=D_({cx:e,cy:n,radius:a,angle:d,sign:-u,cornerRadius:s,cornerIsExternal:l}),v=l?Math.abs(c-d):Math.abs(c-d)-f-b;if(v<0)return o?ji(jV||(jV=pp(["M ",",",`
- a`,",",",0,0,1,",`,0
- a`,",",",0,0,1,",`,0
- `])),p.x,p.y,s,s,s*2,s,s,-s*2):AJ({cx:e,cy:n,innerRadius:r,outerRadius:a,startAngle:c,endAngle:d});var _=ji(DV||(DV=pp(["M ",",",`
- A`,",",",0,0,",",",",",`
- A`,",",",0,",",",",",",",`
- A`,",",",0,0,",",",",",`
- `])),p.x,p.y,s,s,+(u<0),m.x,m.y,a,a,+(v>180),+(u<0),y.x,y.y,s,s,+(u<0),x.x,x.y);if(r>0){var{circleTangency:k,lineTangency:P,theta:C}=D_({cx:e,cy:n,radius:r,angle:c,sign:u,isExternal:!0,cornerRadius:s,cornerIsExternal:l}),{circleTangency:T,lineTangency:N,theta:R}=D_({cx:e,cy:n,radius:r,angle:d,sign:-u,isExternal:!0,cornerRadius:s,cornerIsExternal:l}),A=l?Math.abs(c-d):Math.abs(c-d)-C-R;if(A<0&&s===0)return"".concat(_,"L").concat(e,",").concat(n,"Z");_+=ji(RV||(RV=pp(["L",",",`
- A`,",",",0,0,",",",",",`
- A`,",",",0,",",",",",",",`
- A`,",",",0,0,",",",",","Z"])),N.x,N.y,s,s,+(u<0),T.x,T.y,r,r,+(A>180),+(u>0),k.x,k.y,s,s,+(u<0),P.x,P.y)}else _+=ji(FV||(FV=pp(["L",",","Z"])),e,n);return _},w3e={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},MJ=t=>{var e=ki(t,w3e),{cx:n,cy:r,innerRadius:a,outerRadius:s,cornerRadius:o,forceCornerRadius:l,cornerIsExternal:c,startAngle:d,endAngle:u,className:m}=e;if(s<a||d===u)return null;var p=pr("recharts-sector",m),f=s-a,y=bs(o,f,0,!0),x;return y>0&&Math.abs(d-u)<360?x=v3e({cx:n,cy:r,innerRadius:a,outerRadius:s,cornerRadius:Math.min(y,f/2),forceCornerRadius:l,cornerIsExternal:c,startAngle:d,endAngle:u}):x=AJ({cx:n,cy:r,innerRadius:a,outerRadius:s,startAngle:d,endAngle:u}),w.createElement("path",pR({},ns(e),{className:p,d:x}))};function S3e(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(oZ(e)){if(t==="centric"){var{cx:r,cy:a,innerRadius:s,outerRadius:o,angle:l}=e,c=ia(r,a,s,l),d=ia(r,a,o,l);return[{x:c.x,y:c.y},{x:d.x,y:d.y}]}return PJ(e)}}var ME={},EE={},jE={},LV;function _3e(){return LV||(LV=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=yZ();function n(r){return e.isSymbol(r)?NaN:Number(r)}t.toNumber=n})(jE)),jE}var OV;function k3e(){return OV||(OV=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=_3e();function n(r){return r?(r=e.toNumber(r),r===1/0||r===-1/0?(r<0?-1:1)*Number.MAX_VALUE:r===r?r:0):r===0?r:0}t.toFinite=n})(EE)),EE}var IV;function N3e(){return IV||(IV=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=vZ(),n=k3e();function r(a,s,o){o&&typeof o!="number"&&e.isIterateeCall(a,s,o)&&(s=o=void 0),a=n.toFinite(a),s===void 0?(s=a,a=0):s=n.toFinite(s),o=o===void 0?a<s?1:-1:n.toFinite(o);const l=Math.max(Math.ceil((s-a)/(o||1)),0),c=new Array(l);for(let d=0;d<l;d++)c[d]=a,a+=o;return c}t.range=r})(ME)),ME}var DE,zV;function C3e(){return zV||(zV=1,DE=N3e().range),DE}var T3e=C3e();const EJ=Pl(T3e);function Qm(t,e){return t==null||e==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function P3e(t,e){return t==null||e==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function iO(t){let e,n,r;t.length!==2?(e=Qm,n=(l,c)=>Qm(t(l),c),r=(l,c)=>t(l)-c):(e=t===Qm||t===P3e?t:A3e,n=t,r=t);function a(l,c,d=0,u=l.length){if(d<u){if(e(c,c)!==0)return u;do{const m=d+u>>>1;n(l[m],c)<0?d=m+1:u=m}while(d<u)}return d}function s(l,c,d=0,u=l.length){if(d<u){if(e(c,c)!==0)return u;do{const m=d+u>>>1;n(l[m],c)<=0?d=m+1:u=m}while(d<u)}return d}function o(l,c,d=0,u=l.length){const m=a(l,c,d,u-1);return m>d&&r(l[m-1],c)>-r(l[m],c)?m-1:m}return{left:a,center:o,right:s}}function A3e(){return 0}function jJ(t){return t===null?NaN:+t}function*M3e(t,e){for(let n of t)n!=null&&(n=+n)>=n&&(yield n)}const E3e=iO(Qm),Y0=E3e.right;iO(jJ).center;class UV extends Map{constructor(e,n=R3e){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),e!=null)for(const[r,a]of e)this.set(r,a)}get(e){return super.get(BV(this,e))}has(e){return super.has(BV(this,e))}set(e,n){return super.set(j3e(this,e),n)}delete(e){return super.delete(D3e(this,e))}}function BV({_intern:t,_key:e},n){const r=e(n);return t.has(r)?t.get(r):n}function j3e({_intern:t,_key:e},n){const r=e(n);return t.has(r)?t.get(r):(t.set(r,n),n)}function D3e({_intern:t,_key:e},n){const r=e(n);return t.has(r)&&(n=t.get(r),t.delete(r)),n}function R3e(t){return t!==null&&typeof t=="object"?t.valueOf():t}function F3e(t=Qm){if(t===Qm)return DJ;if(typeof t!="function")throw new TypeError("compare is not a function");return(e,n)=>{const r=t(e,n);return r||r===0?r:(t(n,n)===0)-(t(e,e)===0)}}function DJ(t,e){return(t==null||!(t>=t))-(e==null||!(e>=e))||(t<e?-1:t>e?1:0)}const L3e=Math.sqrt(50),O3e=Math.sqrt(10),I3e=Math.sqrt(2);function Rk(t,e,n){const r=(e-t)/Math.max(0,n),a=Math.floor(Math.log10(r)),s=r/Math.pow(10,a),o=s>=L3e?10:s>=O3e?5:s>=I3e?2:1;let l,c,d;return a<0?(d=Math.pow(10,-a)/o,l=Math.round(t*d),c=Math.round(e*d),l/d<t&&++l,c/d>e&&--c,d=-d):(d=Math.pow(10,a)*o,l=Math.round(t/d),c=Math.round(e/d),l*d<t&&++l,c*d>e&&--c),c<l&&.5<=n&&n<2?Rk(t,e,n*2):[l,c,d]}function fR(t,e,n){if(e=+e,t=+t,n=+n,!(n>0))return[];if(t===e)return[t];const r=e<t,[a,s,o]=r?Rk(e,t,n):Rk(t,e,n);if(!(s>=a))return[];const l=s-a+1,c=new Array(l);if(r)if(o<0)for(let d=0;d<l;++d)c[d]=(s-d)/-o;else for(let d=0;d<l;++d)c[d]=(s-d)*o;else if(o<0)for(let d=0;d<l;++d)c[d]=(a+d)/-o;else for(let d=0;d<l;++d)c[d]=(a+d)*o;return c}function gR(t,e,n){return e=+e,t=+t,n=+n,Rk(t,e,n)[2]}function bR(t,e,n){e=+e,t=+t,n=+n;const r=e<t,a=r?gR(e,t,n):gR(t,e,n);return(r?-1:1)*(a<0?1/-a:a)}function HV(t,e){let n;for(const r of t)r!=null&&(n<r||n===void 0&&r>=r)&&(n=r);return n}function $V(t,e){let n;for(const r of t)r!=null&&(n>r||n===void 0&&r>=r)&&(n=r);return n}function RJ(t,e,n=0,r=1/0,a){if(e=Math.floor(e),n=Math.floor(Math.max(0,n)),r=Math.floor(Math.min(t.length-1,r)),!(n<=e&&e<=r))return t;for(a=a===void 0?DJ:F3e(a);r>n;){if(r-n>600){const c=r-n+1,d=e-n+1,u=Math.log(c),m=.5*Math.exp(2*u/3),p=.5*Math.sqrt(u*m*(c-m)/c)*(d-c/2<0?-1:1),f=Math.max(n,Math.floor(e-d*m/c+p)),y=Math.min(r,Math.floor(e+(c-d)*m/c+p));RJ(t,e,f,y,a)}const s=t[e];let o=n,l=r;for(Ly(t,n,e),a(t[r],s)>0&&Ly(t,n,r);o<l;){for(Ly(t,o,l),++o,--l;a(t[o],s)<0;)++o;for(;a(t[l],s)>0;)--l}a(t[n],s)===0?Ly(t,n,l):(++l,Ly(t,l,r)),l<=e&&(n=l+1),e<=l&&(r=l-1)}return t}function Ly(t,e,n){const r=t[e];t[e]=t[n],t[n]=r}function z3e(t,e,n){if(t=Float64Array.from(M3e(t)),!(!(r=t.length)||isNaN(e=+e))){if(e<=0||r<2)return $V(t);if(e>=1)return HV(t);var r,a=(r-1)*e,s=Math.floor(a),o=HV(RJ(t,s).subarray(0,s+1)),l=$V(t.subarray(s+1));return o+(l-o)*(a-s)}}function U3e(t,e,n=jJ){if(!(!(r=t.length)||isNaN(e=+e))){if(e<=0||r<2)return+n(t[0],0,t);if(e>=1)return+n(t[r-1],r-1,t);var r,a=(r-1)*e,s=Math.floor(a),o=+n(t[s],s,t),l=+n(t[s+1],s+1,t);return o+(l-o)*(a-s)}}function B3e(t,e,n){t=+t,e=+e,n=(a=arguments.length)<2?(e=t,t=0,1):a<3?1:+n;for(var r=-1,a=Math.max(0,Math.ceil((e-t)/n))|0,s=new Array(a);++r<a;)s[r]=t+r*n;return s}function El(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t);break}return this}function ku(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 xR=Symbol("implicit");function aO(){var t=new UV,e=[],n=[],r=xR;function a(s){let o=t.get(s);if(o===void 0){if(r!==xR)return r;t.set(s,o=e.push(s)-1)}return n[o%n.length]}return a.domain=function(s){if(!arguments.length)return e.slice();e=[],t=new UV;for(const o of s)t.has(o)||t.set(o,e.push(o)-1);return a},a.range=function(s){return arguments.length?(n=Array.from(s),a):n.slice()},a.unknown=function(s){return arguments.length?(r=s,a):r},a.copy=function(){return aO(e,n).unknown(r)},El.apply(a,arguments),a}function sO(){var t=aO().unknown(void 0),e=t.domain,n=t.range,r=0,a=1,s,o,l=!1,c=0,d=0,u=.5;delete t.unknown;function m(){var p=e().length,f=a<r,y=f?a:r,x=f?r:a;s=(x-y)/Math.max(1,p-c+d*2),l&&(s=Math.floor(s)),y+=(x-y-s*(p-c))*u,o=s*(1-c),l&&(y=Math.round(y),o=Math.round(o));var b=B3e(p).map(function(v){return y+s*v});return n(f?b.reverse():b)}return t.domain=function(p){return arguments.length?(e(p),m()):e()},t.range=function(p){return arguments.length?([r,a]=p,r=+r,a=+a,m()):[r,a]},t.rangeRound=function(p){return[r,a]=p,r=+r,a=+a,l=!0,m()},t.bandwidth=function(){return o},t.step=function(){return s},t.round=function(p){return arguments.length?(l=!!p,m()):l},t.padding=function(p){return arguments.length?(c=Math.min(1,d=+p),m()):c},t.paddingInner=function(p){return arguments.length?(c=Math.min(1,p),m()):c},t.paddingOuter=function(p){return arguments.length?(d=+p,m()):d},t.align=function(p){return arguments.length?(u=Math.max(0,Math.min(1,p)),m()):u},t.copy=function(){return sO(e(),[r,a]).round(l).paddingInner(c).paddingOuter(d).align(u)},El.apply(m(),arguments)}function FJ(t){var e=t.copy;return t.padding=t.paddingOuter,delete t.paddingInner,delete t.paddingOuter,t.copy=function(){return FJ(e())},t}function H3e(){return FJ(sO.apply(null,arguments).paddingInner(1))}function oO(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function LJ(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function X0(){}var a0=.7,Fk=1/a0,_b="\\s*([+-]?\\d+)\\s*",s0="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Bc="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",$3e=/^#([0-9a-f]{3,8})$/,q3e=new RegExp(`^rgb\\(${_b},${_b},${_b}\\)$`),V3e=new RegExp(`^rgb\\(${Bc},${Bc},${Bc}\\)$`),G3e=new RegExp(`^rgba\\(${_b},${_b},${_b},${s0}\\)$`),W3e=new RegExp(`^rgba\\(${Bc},${Bc},${Bc},${s0}\\)$`),K3e=new RegExp(`^hsl\\(${s0},${Bc},${Bc}\\)$`),Y3e=new RegExp(`^hsla\\(${s0},${Bc},${Bc},${s0}\\)$`),qV={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};oO(X0,o0,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:VV,formatHex:VV,formatHex8:X3e,formatHsl:Q3e,formatRgb:GV,toString:GV});function VV(){return this.rgb().formatHex()}function X3e(){return this.rgb().formatHex8()}function Q3e(){return OJ(this).formatHsl()}function GV(){return this.rgb().formatRgb()}function o0(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=$3e.exec(t))?(n=e[1].length,e=parseInt(e[1],16),n===6?WV(e):n===3?new io(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):n===8?R_(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):n===4?R_(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=q3e.exec(t))?new io(e[1],e[2],e[3],1):(e=V3e.exec(t))?new io(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=G3e.exec(t))?R_(e[1],e[2],e[3],e[4]):(e=W3e.exec(t))?R_(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=K3e.exec(t))?XV(e[1],e[2]/100,e[3]/100,1):(e=Y3e.exec(t))?XV(e[1],e[2]/100,e[3]/100,e[4]):qV.hasOwnProperty(t)?WV(qV[t]):t==="transparent"?new io(NaN,NaN,NaN,0):null}function WV(t){return new io(t>>16&255,t>>8&255,t&255,1)}function R_(t,e,n,r){return r<=0&&(t=e=n=NaN),new io(t,e,n,r)}function Z3e(t){return t instanceof X0||(t=o0(t)),t?(t=t.rgb(),new io(t.r,t.g,t.b,t.opacity)):new io}function yR(t,e,n,r){return arguments.length===1?Z3e(t):new io(t,e,n,r??1)}function io(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}oO(io,yR,LJ(X0,{brighter(t){return t=t==null?Fk:Math.pow(Fk,t),new io(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?a0:Math.pow(a0,t),new io(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new io(Ep(this.r),Ep(this.g),Ep(this.b),Lk(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:KV,formatHex:KV,formatHex8:J3e,formatRgb:YV,toString:YV}));function KV(){return`#${fp(this.r)}${fp(this.g)}${fp(this.b)}`}function J3e(){return`#${fp(this.r)}${fp(this.g)}${fp(this.b)}${fp((isNaN(this.opacity)?1:this.opacity)*255)}`}function YV(){const t=Lk(this.opacity);return`${t===1?"rgb(":"rgba("}${Ep(this.r)}, ${Ep(this.g)}, ${Ep(this.b)}${t===1?")":`, ${t})`}`}function Lk(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Ep(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function fp(t){return t=Ep(t),(t<16?"0":"")+t.toString(16)}function XV(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new Kl(t,e,n,r)}function OJ(t){if(t instanceof Kl)return new Kl(t.h,t.s,t.l,t.opacity);if(t instanceof X0||(t=o0(t)),!t)return new Kl;if(t instanceof Kl)return t;t=t.rgb();var e=t.r/255,n=t.g/255,r=t.b/255,a=Math.min(e,n,r),s=Math.max(e,n,r),o=NaN,l=s-a,c=(s+a)/2;return l?(e===s?o=(n-r)/l+(n<r)*6:n===s?o=(r-e)/l+2:o=(e-n)/l+4,l/=c<.5?s+a:2-s-a,o*=60):l=c>0&&c<1?0:o,new Kl(o,l,c,t.opacity)}function eRe(t,e,n,r){return arguments.length===1?OJ(t):new Kl(t,e,n,r??1)}function Kl(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}oO(Kl,eRe,LJ(X0,{brighter(t){return t=t==null?Fk:Math.pow(Fk,t),new Kl(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?a0:Math.pow(a0,t),new Kl(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,r=n+(n<.5?n:1-n)*e,a=2*n-r;return new io(RE(t>=240?t-240:t+120,a,r),RE(t,a,r),RE(t<120?t+240:t-120,a,r),this.opacity)},clamp(){return new Kl(QV(this.h),F_(this.s),F_(this.l),Lk(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=Lk(this.opacity);return`${t===1?"hsl(":"hsla("}${QV(this.h)}, ${F_(this.s)*100}%, ${F_(this.l)*100}%${t===1?")":`, ${t})`}`}}));function QV(t){return t=(t||0)%360,t<0?t+360:t}function F_(t){return Math.max(0,Math.min(1,t||0))}function RE(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 lO=t=>()=>t;function tRe(t,e){return function(n){return t+n*e}}function nRe(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(r){return Math.pow(t+r*e,n)}}function rRe(t){return(t=+t)==1?IJ:function(e,n){return n-e?nRe(e,n,t):lO(isNaN(e)?n:e)}}function IJ(t,e){var n=e-t;return n?tRe(t,n):lO(isNaN(t)?e:t)}const ZV=(function t(e){var n=rRe(e);function r(a,s){var o=n((a=yR(a)).r,(s=yR(s)).r),l=n(a.g,s.g),c=n(a.b,s.b),d=IJ(a.opacity,s.opacity);return function(u){return a.r=o(u),a.g=l(u),a.b=c(u),a.opacity=d(u),a+""}}return r.gamma=t,r})(1);function iRe(t,e){e||(e=[]);var n=t?Math.min(e.length,t.length):0,r=e.slice(),a;return function(s){for(a=0;a<n;++a)r[a]=t[a]*(1-s)+e[a]*s;return r}}function aRe(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function sRe(t,e){var n=e?e.length:0,r=t?Math.min(n,t.length):0,a=new Array(r),s=new Array(n),o;for(o=0;o<r;++o)a[o]=xx(t[o],e[o]);for(;o<n;++o)s[o]=e[o];return function(l){for(o=0;o<r;++o)s[o]=a[o](l);return s}}function oRe(t,e){var n=new Date;return t=+t,e=+e,function(r){return n.setTime(t*(1-r)+e*r),n}}function Ok(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}function lRe(t,e){var n={},r={},a;(t===null||typeof t!="object")&&(t={}),(e===null||typeof e!="object")&&(e={});for(a in e)a in t?n[a]=xx(t[a],e[a]):r[a]=e[a];return function(s){for(a in n)r[a]=n[a](s);return r}}var vR=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,FE=new RegExp(vR.source,"g");function cRe(t){return function(){return t}}function dRe(t){return function(e){return t(e)+""}}function uRe(t,e){var n=vR.lastIndex=FE.lastIndex=0,r,a,s,o=-1,l=[],c=[];for(t=t+"",e=e+"";(r=vR.exec(t))&&(a=FE.exec(e));)(s=a.index)>n&&(s=e.slice(n,s),l[o]?l[o]+=s:l[++o]=s),(r=r[0])===(a=a[0])?l[o]?l[o]+=a:l[++o]=a:(l[++o]=null,c.push({i:o,x:Ok(r,a)})),n=FE.lastIndex;return n<e.length&&(s=e.slice(n),l[o]?l[o]+=s:l[++o]=s),l.length<2?c[0]?dRe(c[0].x):cRe(e):(e=c.length,function(d){for(var u=0,m;u<e;++u)l[(m=c[u]).i]=m.x(d);return l.join("")})}function xx(t,e){var n=typeof e,r;return e==null||n==="boolean"?lO(e):(n==="number"?Ok:n==="string"?(r=o0(e))?(e=r,ZV):uRe:e instanceof o0?ZV:e instanceof Date?oRe:aRe(e)?iRe:Array.isArray(e)?sRe:typeof e.valueOf!="function"&&typeof e.toString!="function"||isNaN(e)?lRe:Ok)(t,e)}function cO(t,e){return t=+t,e=+e,function(n){return Math.round(t*(1-n)+e*n)}}function mRe(t,e){e===void 0&&(e=t,t=xx);for(var n=0,r=e.length-1,a=e[0],s=new Array(r<0?0:r);n<r;)s[n]=t(a,a=e[++n]);return function(o){var l=Math.max(0,Math.min(r-1,Math.floor(o*=r)));return s[l](o-l)}}function hRe(t){return function(){return t}}function Ik(t){return+t}var JV=[0,1];function Ds(t){return t}function wR(t,e){return(e-=t=+t)?function(n){return(n-t)/e}:hRe(isNaN(e)?NaN:.5)}function pRe(t,e){var n;return t>e&&(n=t,t=e,e=n),function(r){return Math.max(t,Math.min(e,r))}}function fRe(t,e,n){var r=t[0],a=t[1],s=e[0],o=e[1];return a<r?(r=wR(a,r),s=n(o,s)):(r=wR(r,a),s=n(s,o)),function(l){return s(r(l))}}function gRe(t,e,n){var r=Math.min(t.length,e.length)-1,a=new Array(r),s=new Array(r),o=-1;for(t[r]<t[0]&&(t=t.slice().reverse(),e=e.slice().reverse());++o<r;)a[o]=wR(t[o],t[o+1]),s[o]=n(e[o],e[o+1]);return function(l){var c=Y0(t,l,1,r)-1;return s[c](a[c](l))}}function Q0(t,e){return e.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown())}function QC(){var t=JV,e=JV,n=xx,r,a,s,o=Ds,l,c,d;function u(){var p=Math.min(t.length,e.length);return o!==Ds&&(o=pRe(t[0],t[p-1])),l=p>2?gRe:fRe,c=d=null,m}function m(p){return p==null||isNaN(p=+p)?s:(c||(c=l(t.map(r),e,n)))(r(o(p)))}return m.invert=function(p){return o(a((d||(d=l(e,t.map(r),Ok)))(p)))},m.domain=function(p){return arguments.length?(t=Array.from(p,Ik),u()):t.slice()},m.range=function(p){return arguments.length?(e=Array.from(p),u()):e.slice()},m.rangeRound=function(p){return e=Array.from(p),n=cO,u()},m.clamp=function(p){return arguments.length?(o=p?!0:Ds,u()):o!==Ds},m.interpolate=function(p){return arguments.length?(n=p,u()):n},m.unknown=function(p){return arguments.length?(s=p,m):s},function(p,f){return r=p,a=f,u()}}function dO(){return QC()(Ds,Ds)}function bRe(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)}function zk(t,e){if(!isFinite(t)||t===0)return null;var n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"),r=t.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+t.slice(n+1)]}function Vb(t){return t=zk(Math.abs(t)),t?t[1]:NaN}function xRe(t,e){return function(n,r){for(var a=n.length,s=[],o=0,l=t[0],c=0;a>0&&l>0&&(c+l+1>r&&(l=Math.max(1,r-c)),s.push(n.substring(a-=l,a+l)),!((c+=l+1)>r));)l=t[o=(o+1)%t.length];return s.reverse().join(e)}}function yRe(t){return function(e){return e.replace(/[0-9]/g,function(n){return t[+n]})}}var vRe=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function l0(t){if(!(e=vRe.exec(t)))throw new Error("invalid format: "+t);var e;return new uO({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]})}l0.prototype=uO.prototype;function uO(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+""}uO.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 wRe(t){e:for(var e=t.length,n=1,r=-1,a;n<e;++n)switch(t[n]){case".":r=a=n;break;case"0":r===0&&(r=n),a=n;break;default:if(!+t[n])break e;r>0&&(r=0);break}return r>0?t.slice(0,r)+t.slice(a+1):t}var Uk;function SRe(t,e){var n=zk(t,e);if(!n)return Uk=void 0,t.toPrecision(e);var r=n[0],a=n[1],s=a-(Uk=Math.max(-8,Math.min(8,Math.floor(a/3)))*3)+1,o=r.length;return s===o?r:s>o?r+new Array(s-o+1).join("0"):s>0?r.slice(0,s)+"."+r.slice(s):"0."+new Array(1-s).join("0")+zk(t,Math.max(0,e+s-1))[0]}function e7(t,e){var n=zk(t,e);if(!n)return t+"";var r=n[0],a=n[1];return a<0?"0."+new Array(-a).join("0")+r:r.length>a+1?r.slice(0,a+1)+"."+r.slice(a+1):r+new Array(a-r.length+2).join("0")}const t7={"%":(t,e)=>(t*100).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:bRe,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)=>e7(t*100,e),r:e7,s:SRe,X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function n7(t){return t}var r7=Array.prototype.map,i7=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function _Re(t){var e=t.grouping===void 0||t.thousands===void 0?n7:xRe(r7.call(t.grouping,Number),t.thousands+""),n=t.currency===void 0?"":t.currency[0]+"",r=t.currency===void 0?"":t.currency[1]+"",a=t.decimal===void 0?".":t.decimal+"",s=t.numerals===void 0?n7:yRe(r7.call(t.numerals,String)),o=t.percent===void 0?"%":t.percent+"",l=t.minus===void 0?"−":t.minus+"",c=t.nan===void 0?"NaN":t.nan+"";function d(m,p){m=l0(m);var f=m.fill,y=m.align,x=m.sign,b=m.symbol,v=m.zero,_=m.width,k=m.comma,P=m.precision,C=m.trim,T=m.type;T==="n"?(k=!0,T="g"):t7[T]||(P===void 0&&(P=12),C=!0,T="g"),(v||f==="0"&&y==="=")&&(v=!0,f="0",y="=");var N=(p&&p.prefix!==void 0?p.prefix:"")+(b==="$"?n:b==="#"&&/[boxX]/.test(T)?"0"+T.toLowerCase():""),R=(b==="$"?r:/[%p]/.test(T)?o:"")+(p&&p.suffix!==void 0?p.suffix:""),A=t7[T],D=/[defgprs%]/.test(T);P=P===void 0?6:/[gprs]/.test(T)?Math.max(1,Math.min(21,P)):Math.max(0,Math.min(20,P));function $(U){var G=N,L=R,te,re,J;if(T==="c")L=A(U)+L,U="";else{U=+U;var ue=U<0||1/U<0;if(U=isNaN(U)?c:A(Math.abs(U),P),C&&(U=wRe(U)),ue&&+U==0&&x!=="+"&&(ue=!1),G=(ue?x==="("?x:l:x==="-"||x==="("?"":x)+G,L=(T==="s"&&!isNaN(U)&&Uk!==void 0?i7[8+Uk/3]:"")+L+(ue&&x==="("?")":""),D){for(te=-1,re=U.length;++te<re;)if(J=U.charCodeAt(te),48>J||J>57){L=(J===46?a+U.slice(te+1):U.slice(te))+L,U=U.slice(0,te);break}}}k&&!v&&(U=e(U,1/0));var me=G.length+U.length+L.length,ge=me<_?new Array(_-me+1).join(f):"";switch(k&&v&&(U=e(ge+U,ge.length?_-L.length:1/0),ge=""),y){case"<":U=G+U+L+ge;break;case"=":U=G+ge+U+L;break;case"^":U=ge.slice(0,me=ge.length>>1)+G+U+L+ge.slice(me);break;default:U=ge+G+U+L;break}return s(U)}return $.toString=function(){return m+""},$}function u(m,p){var f=Math.max(-8,Math.min(8,Math.floor(Vb(p)/3)))*3,y=Math.pow(10,-f),x=d((m=l0(m),m.type="f",m),{suffix:i7[8+f/3]});return function(b){return x(y*b)}}return{format:d,formatPrefix:u}}var L_,mO,zJ;kRe({thousands:",",grouping:[3],currency:["$",""]});function kRe(t){return L_=_Re(t),mO=L_.format,zJ=L_.formatPrefix,L_}function NRe(t){return Math.max(0,-Vb(Math.abs(t)))}function CRe(t,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Vb(e)/3)))*3-Vb(Math.abs(t)))}function TRe(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,Vb(e)-Vb(t))+1}function UJ(t,e,n,r){var a=bR(t,e,n),s;switch(r=l0(r??",f"),r.type){case"s":{var o=Math.max(Math.abs(t),Math.abs(e));return r.precision==null&&!isNaN(s=CRe(a,o))&&(r.precision=s),zJ(r,o)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(s=TRe(a,Math.max(Math.abs(t),Math.abs(e))))&&(r.precision=s-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(s=NRe(a))&&(r.precision=s-(r.type==="%")*2);break}}return mO(r)}function gh(t){var e=t.domain;return t.ticks=function(n){var r=e();return fR(r[0],r[r.length-1],n??10)},t.tickFormat=function(n,r){var a=e();return UJ(a[0],a[a.length-1],n??10,r)},t.nice=function(n){n==null&&(n=10);var r=e(),a=0,s=r.length-1,o=r[a],l=r[s],c,d,u=10;for(l<o&&(d=o,o=l,l=d,d=a,a=s,s=d);u-- >0;){if(d=gR(o,l,n),d===c)return r[a]=o,r[s]=l,e(r);if(d>0)o=Math.floor(o/d)*d,l=Math.ceil(l/d)*d;else if(d<0)o=Math.ceil(o*d)/d,l=Math.floor(l*d)/d;else break;c=d}return t},t}function BJ(){var t=dO();return t.copy=function(){return Q0(t,BJ())},El.apply(t,arguments),gh(t)}function HJ(t){var e;function n(r){return r==null||isNaN(r=+r)?e:r}return n.invert=n,n.domain=n.range=function(r){return arguments.length?(t=Array.from(r,Ik),n):t.slice()},n.unknown=function(r){return arguments.length?(e=r,n):e},n.copy=function(){return HJ(t).unknown(e)},t=arguments.length?Array.from(t,Ik):[0,1],gh(n)}function $J(t,e){t=t.slice();var n=0,r=t.length-1,a=t[n],s=t[r],o;return s<a&&(o=n,n=r,r=o,o=a,a=s,s=o),t[n]=e.floor(a),t[r]=e.ceil(s),t}function a7(t){return Math.log(t)}function s7(t){return Math.exp(t)}function PRe(t){return-Math.log(-t)}function ARe(t){return-Math.exp(-t)}function MRe(t){return isFinite(t)?+("1e"+t):t<0?0:t}function ERe(t){return t===10?MRe:t===Math.E?Math.exp:e=>Math.pow(t,e)}function jRe(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 o7(t){return(e,n)=>-t(-e,n)}function hO(t){const e=t(a7,s7),n=e.domain;let r=10,a,s;function o(){return a=jRe(r),s=ERe(r),n()[0]<0?(a=o7(a),s=o7(s),t(PRe,ARe)):t(a7,s7),e}return e.base=function(l){return arguments.length?(r=+l,o()):r},e.domain=function(l){return arguments.length?(n(l),o()):n()},e.ticks=l=>{const c=n();let d=c[0],u=c[c.length-1];const m=u<d;m&&([d,u]=[u,d]);let p=a(d),f=a(u),y,x;const b=l==null?10:+l;let v=[];if(!(r%1)&&f-p<b){if(p=Math.floor(p),f=Math.ceil(f),d>0){for(;p<=f;++p)for(y=1;y<r;++y)if(x=p<0?y/s(-p):y*s(p),!(x<d)){if(x>u)break;v.push(x)}}else for(;p<=f;++p)for(y=r-1;y>=1;--y)if(x=p>0?y/s(-p):y*s(p),!(x<d)){if(x>u)break;v.push(x)}v.length*2<b&&(v=fR(d,u,b))}else v=fR(p,f,Math.min(f-p,b)).map(s);return m?v.reverse():v},e.tickFormat=(l,c)=>{if(l==null&&(l=10),c==null&&(c=r===10?"s":","),typeof c!="function"&&(!(r%1)&&(c=l0(c)).precision==null&&(c.trim=!0),c=mO(c)),l===1/0)return c;const d=Math.max(1,r*l/e.ticks().length);return u=>{let m=u/s(Math.round(a(u)));return m*r<r-.5&&(m*=r),m<=d?c(u):""}},e.nice=()=>n($J(n(),{floor:l=>s(Math.floor(a(l))),ceil:l=>s(Math.ceil(a(l)))})),e}function qJ(){const t=hO(QC()).domain([1,10]);return t.copy=()=>Q0(t,qJ()).base(t.base()),El.apply(t,arguments),t}function l7(t){return function(e){return Math.sign(e)*Math.log1p(Math.abs(e/t))}}function c7(t){return function(e){return Math.sign(e)*Math.expm1(Math.abs(e))*t}}function pO(t){var e=1,n=t(l7(e),c7(e));return n.constant=function(r){return arguments.length?t(l7(e=+r),c7(e)):e},gh(n)}function VJ(){var t=pO(QC());return t.copy=function(){return Q0(t,VJ()).constant(t.constant())},El.apply(t,arguments)}function d7(t){return function(e){return e<0?-Math.pow(-e,t):Math.pow(e,t)}}function DRe(t){return t<0?-Math.sqrt(-t):Math.sqrt(t)}function RRe(t){return t<0?-t*t:t*t}function fO(t){var e=t(Ds,Ds),n=1;function r(){return n===1?t(Ds,Ds):n===.5?t(DRe,RRe):t(d7(n),d7(1/n))}return e.exponent=function(a){return arguments.length?(n=+a,r()):n},gh(e)}function gO(){var t=fO(QC());return t.copy=function(){return Q0(t,gO()).exponent(t.exponent())},El.apply(t,arguments),t}function FRe(){return gO.apply(null,arguments).exponent(.5)}function u7(t){return Math.sign(t)*t*t}function LRe(t){return Math.sign(t)*Math.sqrt(Math.abs(t))}function GJ(){var t=dO(),e=[0,1],n=!1,r;function a(s){var o=LRe(t(s));return isNaN(o)?r:n?Math.round(o):o}return a.invert=function(s){return t.invert(u7(s))},a.domain=function(s){return arguments.length?(t.domain(s),a):t.domain()},a.range=function(s){return arguments.length?(t.range((e=Array.from(s,Ik)).map(u7)),a):e.slice()},a.rangeRound=function(s){return a.range(s).round(!0)},a.round=function(s){return arguments.length?(n=!!s,a):n},a.clamp=function(s){return arguments.length?(t.clamp(s),a):t.clamp()},a.unknown=function(s){return arguments.length?(r=s,a):r},a.copy=function(){return GJ(t.domain(),e).round(n).clamp(t.clamp()).unknown(r)},El.apply(a,arguments),gh(a)}function WJ(){var t=[],e=[],n=[],r;function a(){var o=0,l=Math.max(1,e.length);for(n=new Array(l-1);++o<l;)n[o-1]=U3e(t,o/l);return s}function s(o){return o==null||isNaN(o=+o)?r:e[Y0(n,o)]}return s.invertExtent=function(o){var l=e.indexOf(o);return l<0?[NaN,NaN]:[l>0?n[l-1]:t[0],l<n.length?n[l]:t[t.length-1]]},s.domain=function(o){if(!arguments.length)return t.slice();t=[];for(let l of o)l!=null&&!isNaN(l=+l)&&t.push(l);return t.sort(Qm),a()},s.range=function(o){return arguments.length?(e=Array.from(o),a()):e.slice()},s.unknown=function(o){return arguments.length?(r=o,s):r},s.quantiles=function(){return n.slice()},s.copy=function(){return WJ().domain(t).range(e).unknown(r)},El.apply(s,arguments)}function KJ(){var t=0,e=1,n=1,r=[.5],a=[0,1],s;function o(c){return c!=null&&c<=c?a[Y0(r,c,0,n)]:s}function l(){var c=-1;for(r=new Array(n);++c<n;)r[c]=((c+1)*e-(c-n)*t)/(n+1);return o}return o.domain=function(c){return arguments.length?([t,e]=c,t=+t,e=+e,l()):[t,e]},o.range=function(c){return arguments.length?(n=(a=Array.from(c)).length-1,l()):a.slice()},o.invertExtent=function(c){var d=a.indexOf(c);return d<0?[NaN,NaN]:d<1?[t,r[0]]:d>=n?[r[n-1],e]:[r[d-1],r[d]]},o.unknown=function(c){return arguments.length&&(s=c),o},o.thresholds=function(){return r.slice()},o.copy=function(){return KJ().domain([t,e]).range(a).unknown(s)},El.apply(gh(o),arguments)}function YJ(){var t=[.5],e=[0,1],n,r=1;function a(s){return s!=null&&s<=s?e[Y0(t,s,0,r)]:n}return a.domain=function(s){return arguments.length?(t=Array.from(s),r=Math.min(t.length,e.length-1),a):t.slice()},a.range=function(s){return arguments.length?(e=Array.from(s),r=Math.min(t.length,e.length-1),a):e.slice()},a.invertExtent=function(s){var o=e.indexOf(s);return[t[o-1],t[o]]},a.unknown=function(s){return arguments.length?(n=s,a):n},a.copy=function(){return YJ().domain(t).range(e).unknown(n)},El.apply(a,arguments)}const LE=new Date,OE=new Date;function wa(t,e,n,r){function a(s){return t(s=arguments.length===0?new Date:new Date(+s)),s}return a.floor=s=>(t(s=new Date(+s)),s),a.ceil=s=>(t(s=new Date(s-1)),e(s,1),t(s),s),a.round=s=>{const o=a(s),l=a.ceil(s);return s-o<l-s?o:l},a.offset=(s,o)=>(e(s=new Date(+s),o==null?1:Math.floor(o)),s),a.range=(s,o,l)=>{const c=[];if(s=a.ceil(s),l=l==null?1:Math.floor(l),!(s<o)||!(l>0))return c;let d;do c.push(d=new Date(+s)),e(s,l),t(s);while(d<s&&s<o);return c},a.filter=s=>wa(o=>{if(o>=o)for(;t(o),!s(o);)o.setTime(o-1)},(o,l)=>{if(o>=o)if(l<0)for(;++l<=0;)for(;e(o,-1),!s(o););else for(;--l>=0;)for(;e(o,1),!s(o););}),n&&(a.count=(s,o)=>(LE.setTime(+s),OE.setTime(+o),t(LE),t(OE),Math.floor(n(LE,OE))),a.every=s=>(s=Math.floor(s),!isFinite(s)||!(s>0)?null:s>1?a.filter(r?o=>r(o)%s===0:o=>a.count(0,o)%s===0):a)),a}const Bk=wa(()=>{},(t,e)=>{t.setTime(+t+e)},(t,e)=>e-t);Bk.every=t=>(t=Math.floor(t),!isFinite(t)||!(t>0)?null:t>1?wa(e=>{e.setTime(Math.floor(e/t)*t)},(e,n)=>{e.setTime(+e+n*t)},(e,n)=>(n-e)/t):Bk);Bk.range;const Kd=1e3,pl=Kd*60,Yd=pl*60,fu=Yd*24,bO=fu*7,m7=fu*30,IE=fu*365,gp=wa(t=>{t.setTime(t-t.getMilliseconds())},(t,e)=>{t.setTime(+t+e*Kd)},(t,e)=>(e-t)/Kd,t=>t.getUTCSeconds());gp.range;const xO=wa(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*Kd)},(t,e)=>{t.setTime(+t+e*pl)},(t,e)=>(e-t)/pl,t=>t.getMinutes());xO.range;const yO=wa(t=>{t.setUTCSeconds(0,0)},(t,e)=>{t.setTime(+t+e*pl)},(t,e)=>(e-t)/pl,t=>t.getUTCMinutes());yO.range;const vO=wa(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*Kd-t.getMinutes()*pl)},(t,e)=>{t.setTime(+t+e*Yd)},(t,e)=>(e-t)/Yd,t=>t.getHours());vO.range;const wO=wa(t=>{t.setUTCMinutes(0,0,0)},(t,e)=>{t.setTime(+t+e*Yd)},(t,e)=>(e-t)/Yd,t=>t.getUTCHours());wO.range;const Z0=wa(t=>t.setHours(0,0,0,0),(t,e)=>t.setDate(t.getDate()+e),(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*pl)/fu,t=>t.getDate()-1);Z0.range;const ZC=wa(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/fu,t=>t.getUTCDate()-1);ZC.range;const XJ=wa(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/fu,t=>Math.floor(t/fu));XJ.range;function vf(t){return wa(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())*pl)/bO)}const JC=vf(0),Hk=vf(1),ORe=vf(2),IRe=vf(3),Gb=vf(4),zRe=vf(5),URe=vf(6);JC.range;Hk.range;ORe.range;IRe.range;Gb.range;zRe.range;URe.range;function wf(t){return wa(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)/bO)}const eT=wf(0),$k=wf(1),BRe=wf(2),HRe=wf(3),Wb=wf(4),$Re=wf(5),qRe=wf(6);eT.range;$k.range;BRe.range;HRe.range;Wb.range;$Re.range;qRe.range;const SO=wa(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());SO.range;const _O=wa(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());_O.range;const gu=wa(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());gu.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:wa(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)});gu.range;const bu=wa(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());bu.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:wa(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)});bu.range;function QJ(t,e,n,r,a,s){const o=[[gp,1,Kd],[gp,5,5*Kd],[gp,15,15*Kd],[gp,30,30*Kd],[s,1,pl],[s,5,5*pl],[s,15,15*pl],[s,30,30*pl],[a,1,Yd],[a,3,3*Yd],[a,6,6*Yd],[a,12,12*Yd],[r,1,fu],[r,2,2*fu],[n,1,bO],[e,1,m7],[e,3,3*m7],[t,1,IE]];function l(d,u,m){const p=u<d;p&&([d,u]=[u,d]);const f=m&&typeof m.range=="function"?m:c(d,u,m),y=f?f.range(d,+u+1):[];return p?y.reverse():y}function c(d,u,m){const p=Math.abs(u-d)/m,f=iO(([,,b])=>b).right(o,p);if(f===o.length)return t.every(bR(d/IE,u/IE,m));if(f===0)return Bk.every(Math.max(bR(d,u,m),1));const[y,x]=o[p/o[f-1][2]<o[f][2]/p?f-1:f];return y.every(x)}return[l,c]}const[VRe,GRe]=QJ(bu,_O,eT,XJ,wO,yO),[WRe,KRe]=QJ(gu,SO,JC,Z0,vO,xO);function zE(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 UE(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 Oy(t,e,n){return{y:t,m:e,d:n,H:0,M:0,S:0,L:0}}function YRe(t){var e=t.dateTime,n=t.date,r=t.time,a=t.periods,s=t.days,o=t.shortDays,l=t.months,c=t.shortMonths,d=Iy(a),u=zy(a),m=Iy(s),p=zy(s),f=Iy(o),y=zy(o),x=Iy(l),b=zy(l),v=Iy(c),_=zy(c),k={a:J,A:ue,b:me,B:ge,c:null,d:x7,e:x7,f:xFe,g:PFe,G:MFe,H:fFe,I:gFe,j:bFe,L:ZJ,m:yFe,M:vFe,p:X,q:ie,Q:w7,s:S7,S:wFe,u:SFe,U:_Fe,V:kFe,w:NFe,W:CFe,x:null,X:null,y:TFe,Y:AFe,Z:EFe,"%":v7},P={a:le,A:pe,b:Ce,B:q,c:null,d:y7,e:y7,f:FFe,g:VFe,G:WFe,H:jFe,I:DFe,j:RFe,L:eee,m:LFe,M:OFe,p:Z,q:j,Q:w7,s:S7,S:IFe,u:zFe,U:UFe,V:BFe,w:HFe,W:$Fe,x:null,X:null,y:qFe,Y:GFe,Z:KFe,"%":v7},C={a:D,A:$,b:U,B:G,c:L,d:g7,e:g7,f:uFe,g:f7,G:p7,H:b7,I:b7,j:oFe,L:dFe,m:sFe,M:lFe,p:A,q:aFe,Q:hFe,s:pFe,S:cFe,u:eFe,U:tFe,V:nFe,w:JRe,W:rFe,x:te,X:re,y:f7,Y:p7,Z:iFe,"%":mFe};k.x=T(n,k),k.X=T(r,k),k.c=T(e,k),P.x=T(n,P),P.X=T(r,P),P.c=T(e,P);function T(E,I){return function(W){var B=[],ae=-1,z=0,V=E.length,ee,K,ne;for(W instanceof Date||(W=new Date(+W));++ae<V;)E.charCodeAt(ae)===37&&(B.push(E.slice(z,ae)),(K=h7[ee=E.charAt(++ae)])!=null?ee=E.charAt(++ae):K=ee==="e"?" ":"0",(ne=I[ee])&&(ee=ne(W,K)),B.push(ee),z=ae+1);return B.push(E.slice(z,ae)),B.join("")}}function N(E,I){return function(W){var B=Oy(1900,void 0,1),ae=R(B,E,W+="",0),z,V;if(ae!=W.length)return null;if("Q"in B)return new Date(B.Q);if("s"in B)return new Date(B.s*1e3+("L"in B?B.L:0));if(I&&!("Z"in B)&&(B.Z=0),"p"in B&&(B.H=B.H%12+B.p*12),B.m===void 0&&(B.m="q"in B?B.q:0),"V"in B){if(B.V<1||B.V>53)return null;"w"in B||(B.w=1),"Z"in B?(z=UE(Oy(B.y,0,1)),V=z.getUTCDay(),z=V>4||V===0?$k.ceil(z):$k(z),z=ZC.offset(z,(B.V-1)*7),B.y=z.getUTCFullYear(),B.m=z.getUTCMonth(),B.d=z.getUTCDate()+(B.w+6)%7):(z=zE(Oy(B.y,0,1)),V=z.getDay(),z=V>4||V===0?Hk.ceil(z):Hk(z),z=Z0.offset(z,(B.V-1)*7),B.y=z.getFullYear(),B.m=z.getMonth(),B.d=z.getDate()+(B.w+6)%7)}else("W"in B||"U"in B)&&("w"in B||(B.w="u"in B?B.u%7:"W"in B?1:0),V="Z"in B?UE(Oy(B.y,0,1)).getUTCDay():zE(Oy(B.y,0,1)).getDay(),B.m=0,B.d="W"in B?(B.w+6)%7+B.W*7-(V+5)%7:B.w+B.U*7-(V+6)%7);return"Z"in B?(B.H+=B.Z/100|0,B.M+=B.Z%100,UE(B)):zE(B)}}function R(E,I,W,B){for(var ae=0,z=I.length,V=W.length,ee,K;ae<z;){if(B>=V)return-1;if(ee=I.charCodeAt(ae++),ee===37){if(ee=I.charAt(ae++),K=C[ee in h7?I.charAt(ae++):ee],!K||(B=K(E,W,B))<0)return-1}else if(ee!=W.charCodeAt(B++))return-1}return B}function A(E,I,W){var B=d.exec(I.slice(W));return B?(E.p=u.get(B[0].toLowerCase()),W+B[0].length):-1}function D(E,I,W){var B=f.exec(I.slice(W));return B?(E.w=y.get(B[0].toLowerCase()),W+B[0].length):-1}function $(E,I,W){var B=m.exec(I.slice(W));return B?(E.w=p.get(B[0].toLowerCase()),W+B[0].length):-1}function U(E,I,W){var B=v.exec(I.slice(W));return B?(E.m=_.get(B[0].toLowerCase()),W+B[0].length):-1}function G(E,I,W){var B=x.exec(I.slice(W));return B?(E.m=b.get(B[0].toLowerCase()),W+B[0].length):-1}function L(E,I,W){return R(E,e,I,W)}function te(E,I,W){return R(E,n,I,W)}function re(E,I,W){return R(E,r,I,W)}function J(E){return o[E.getDay()]}function ue(E){return s[E.getDay()]}function me(E){return c[E.getMonth()]}function ge(E){return l[E.getMonth()]}function X(E){return a[+(E.getHours()>=12)]}function ie(E){return 1+~~(E.getMonth()/3)}function le(E){return o[E.getUTCDay()]}function pe(E){return s[E.getUTCDay()]}function Ce(E){return c[E.getUTCMonth()]}function q(E){return l[E.getUTCMonth()]}function Z(E){return a[+(E.getUTCHours()>=12)]}function j(E){return 1+~~(E.getUTCMonth()/3)}return{format:function(E){var I=T(E+="",k);return I.toString=function(){return E},I},parse:function(E){var I=N(E+="",!1);return I.toString=function(){return E},I},utcFormat:function(E){var I=T(E+="",P);return I.toString=function(){return E},I},utcParse:function(E){var I=N(E+="",!0);return I.toString=function(){return E},I}}}var h7={"-":"",_:" ",0:"0"},Oa=/^\s*\d+/,XRe=/^%/,QRe=/[\\^$*+?|[\]().{}]/g;function yr(t,e,n){var r=t<0?"-":"",a=(r?-t:t)+"",s=a.length;return r+(s<n?new Array(n-s+1).join(e)+a:a)}function ZRe(t){return t.replace(QRe,"\\$&")}function Iy(t){return new RegExp("^(?:"+t.map(ZRe).join("|")+")","i")}function zy(t){return new Map(t.map((e,n)=>[e.toLowerCase(),n]))}function JRe(t,e,n){var r=Oa.exec(e.slice(n,n+1));return r?(t.w=+r[0],n+r[0].length):-1}function eFe(t,e,n){var r=Oa.exec(e.slice(n,n+1));return r?(t.u=+r[0],n+r[0].length):-1}function tFe(t,e,n){var r=Oa.exec(e.slice(n,n+2));return r?(t.U=+r[0],n+r[0].length):-1}function nFe(t,e,n){var r=Oa.exec(e.slice(n,n+2));return r?(t.V=+r[0],n+r[0].length):-1}function rFe(t,e,n){var r=Oa.exec(e.slice(n,n+2));return r?(t.W=+r[0],n+r[0].length):-1}function p7(t,e,n){var r=Oa.exec(e.slice(n,n+4));return r?(t.y=+r[0],n+r[0].length):-1}function f7(t,e,n){var r=Oa.exec(e.slice(n,n+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function iFe(t,e,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(n,n+6));return r?(t.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function aFe(t,e,n){var r=Oa.exec(e.slice(n,n+1));return r?(t.q=r[0]*3-3,n+r[0].length):-1}function sFe(t,e,n){var r=Oa.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function g7(t,e,n){var r=Oa.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function oFe(t,e,n){var r=Oa.exec(e.slice(n,n+3));return r?(t.m=0,t.d=+r[0],n+r[0].length):-1}function b7(t,e,n){var r=Oa.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function lFe(t,e,n){var r=Oa.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function cFe(t,e,n){var r=Oa.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function dFe(t,e,n){var r=Oa.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function uFe(t,e,n){var r=Oa.exec(e.slice(n,n+6));return r?(t.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function mFe(t,e,n){var r=XRe.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function hFe(t,e,n){var r=Oa.exec(e.slice(n));return r?(t.Q=+r[0],n+r[0].length):-1}function pFe(t,e,n){var r=Oa.exec(e.slice(n));return r?(t.s=+r[0],n+r[0].length):-1}function x7(t,e){return yr(t.getDate(),e,2)}function fFe(t,e){return yr(t.getHours(),e,2)}function gFe(t,e){return yr(t.getHours()%12||12,e,2)}function bFe(t,e){return yr(1+Z0.count(gu(t),t),e,3)}function ZJ(t,e){return yr(t.getMilliseconds(),e,3)}function xFe(t,e){return ZJ(t,e)+"000"}function yFe(t,e){return yr(t.getMonth()+1,e,2)}function vFe(t,e){return yr(t.getMinutes(),e,2)}function wFe(t,e){return yr(t.getSeconds(),e,2)}function SFe(t){var e=t.getDay();return e===0?7:e}function _Fe(t,e){return yr(JC.count(gu(t)-1,t),e,2)}function JJ(t){var e=t.getDay();return e>=4||e===0?Gb(t):Gb.ceil(t)}function kFe(t,e){return t=JJ(t),yr(Gb.count(gu(t),t)+(gu(t).getDay()===4),e,2)}function NFe(t){return t.getDay()}function CFe(t,e){return yr(Hk.count(gu(t)-1,t),e,2)}function TFe(t,e){return yr(t.getFullYear()%100,e,2)}function PFe(t,e){return t=JJ(t),yr(t.getFullYear()%100,e,2)}function AFe(t,e){return yr(t.getFullYear()%1e4,e,4)}function MFe(t,e){var n=t.getDay();return t=n>=4||n===0?Gb(t):Gb.ceil(t),yr(t.getFullYear()%1e4,e,4)}function EFe(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+yr(e/60|0,"0",2)+yr(e%60,"0",2)}function y7(t,e){return yr(t.getUTCDate(),e,2)}function jFe(t,e){return yr(t.getUTCHours(),e,2)}function DFe(t,e){return yr(t.getUTCHours()%12||12,e,2)}function RFe(t,e){return yr(1+ZC.count(bu(t),t),e,3)}function eee(t,e){return yr(t.getUTCMilliseconds(),e,3)}function FFe(t,e){return eee(t,e)+"000"}function LFe(t,e){return yr(t.getUTCMonth()+1,e,2)}function OFe(t,e){return yr(t.getUTCMinutes(),e,2)}function IFe(t,e){return yr(t.getUTCSeconds(),e,2)}function zFe(t){var e=t.getUTCDay();return e===0?7:e}function UFe(t,e){return yr(eT.count(bu(t)-1,t),e,2)}function tee(t){var e=t.getUTCDay();return e>=4||e===0?Wb(t):Wb.ceil(t)}function BFe(t,e){return t=tee(t),yr(Wb.count(bu(t),t)+(bu(t).getUTCDay()===4),e,2)}function HFe(t){return t.getUTCDay()}function $Fe(t,e){return yr($k.count(bu(t)-1,t),e,2)}function qFe(t,e){return yr(t.getUTCFullYear()%100,e,2)}function VFe(t,e){return t=tee(t),yr(t.getUTCFullYear()%100,e,2)}function GFe(t,e){return yr(t.getUTCFullYear()%1e4,e,4)}function WFe(t,e){var n=t.getUTCDay();return t=n>=4||n===0?Wb(t):Wb.ceil(t),yr(t.getUTCFullYear()%1e4,e,4)}function KFe(){return"+0000"}function v7(){return"%"}function w7(t){return+t}function S7(t){return Math.floor(+t/1e3)}var Ug,nee,ree;YFe({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 YFe(t){return Ug=YRe(t),nee=Ug.format,Ug.parse,ree=Ug.utcFormat,Ug.utcParse,Ug}function XFe(t){return new Date(t)}function QFe(t){return t instanceof Date?+t:+new Date(+t)}function kO(t,e,n,r,a,s,o,l,c,d){var u=dO(),m=u.invert,p=u.domain,f=d(".%L"),y=d(":%S"),x=d("%I:%M"),b=d("%I %p"),v=d("%a %d"),_=d("%b %d"),k=d("%B"),P=d("%Y");function C(T){return(c(T)<T?f:l(T)<T?y:o(T)<T?x:s(T)<T?b:r(T)<T?a(T)<T?v:_:n(T)<T?k:P)(T)}return u.invert=function(T){return new Date(m(T))},u.domain=function(T){return arguments.length?p(Array.from(T,QFe)):p().map(XFe)},u.ticks=function(T){var N=p();return t(N[0],N[N.length-1],T??10)},u.tickFormat=function(T,N){return N==null?C:d(N)},u.nice=function(T){var N=p();return(!T||typeof T.range!="function")&&(T=e(N[0],N[N.length-1],T??10)),T?p($J(N,T)):u},u.copy=function(){return Q0(u,kO(t,e,n,r,a,s,o,l,c,d))},u}function ZFe(){return El.apply(kO(WRe,KRe,gu,SO,JC,Z0,vO,xO,gp,nee).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function JFe(){return El.apply(kO(VRe,GRe,bu,_O,eT,ZC,wO,yO,gp,ree).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}function tT(){var t=0,e=1,n,r,a,s,o=Ds,l=!1,c;function d(m){return m==null||isNaN(m=+m)?c:o(a===0?.5:(m=(s(m)-n)*a,l?Math.max(0,Math.min(1,m)):m))}d.domain=function(m){return arguments.length?([t,e]=m,n=s(t=+t),r=s(e=+e),a=n===r?0:1/(r-n),d):[t,e]},d.clamp=function(m){return arguments.length?(l=!!m,d):l},d.interpolator=function(m){return arguments.length?(o=m,d):o};function u(m){return function(p){var f,y;return arguments.length?([f,y]=p,o=m(f,y),d):[o(0),o(1)]}}return d.range=u(xx),d.rangeRound=u(cO),d.unknown=function(m){return arguments.length?(c=m,d):c},function(m){return s=m,n=m(t),r=m(e),a=n===r?0:1/(r-n),d}}function bh(t,e){return e.domain(t.domain()).interpolator(t.interpolator()).clamp(t.clamp()).unknown(t.unknown())}function iee(){var t=gh(tT()(Ds));return t.copy=function(){return bh(t,iee())},ku.apply(t,arguments)}function aee(){var t=hO(tT()).domain([1,10]);return t.copy=function(){return bh(t,aee()).base(t.base())},ku.apply(t,arguments)}function see(){var t=pO(tT());return t.copy=function(){return bh(t,see()).constant(t.constant())},ku.apply(t,arguments)}function NO(){var t=fO(tT());return t.copy=function(){return bh(t,NO()).exponent(t.exponent())},ku.apply(t,arguments)}function eLe(){return NO.apply(null,arguments).exponent(.5)}function oee(){var t=[],e=Ds;function n(r){if(r!=null&&!isNaN(r=+r))return e((Y0(t,r,1)-1)/(t.length-1))}return n.domain=function(r){if(!arguments.length)return t.slice();t=[];for(let a of r)a!=null&&!isNaN(a=+a)&&t.push(a);return t.sort(Qm),n},n.interpolator=function(r){return arguments.length?(e=r,n):e},n.range=function(){return t.map((r,a)=>e(a/(t.length-1)))},n.quantiles=function(r){return Array.from({length:r+1},(a,s)=>z3e(t,s/r))},n.copy=function(){return oee(e).domain(t)},ku.apply(n,arguments)}function nT(){var t=0,e=.5,n=1,r=1,a,s,o,l,c,d=Ds,u,m=!1,p;function f(x){return isNaN(x=+x)?p:(x=.5+((x=+u(x))-s)*(r*x<r*s?l:c),d(m?Math.max(0,Math.min(1,x)):x))}f.domain=function(x){return arguments.length?([t,e,n]=x,a=u(t=+t),s=u(e=+e),o=u(n=+n),l=a===s?0:.5/(s-a),c=s===o?0:.5/(o-s),r=s<a?-1:1,f):[t,e,n]},f.clamp=function(x){return arguments.length?(m=!!x,f):m},f.interpolator=function(x){return arguments.length?(d=x,f):d};function y(x){return function(b){var v,_,k;return arguments.length?([v,_,k]=b,d=mRe(x,[v,_,k]),f):[d(0),d(.5),d(1)]}}return f.range=y(xx),f.rangeRound=y(cO),f.unknown=function(x){return arguments.length?(p=x,f):p},function(x){return u=x,a=x(t),s=x(e),o=x(n),l=a===s?0:.5/(s-a),c=s===o?0:.5/(o-s),r=s<a?-1:1,f}}function lee(){var t=gh(nT()(Ds));return t.copy=function(){return bh(t,lee())},ku.apply(t,arguments)}function cee(){var t=hO(nT()).domain([.1,1,10]);return t.copy=function(){return bh(t,cee()).base(t.base())},ku.apply(t,arguments)}function dee(){var t=pO(nT());return t.copy=function(){return bh(t,dee()).constant(t.constant())},ku.apply(t,arguments)}function CO(){var t=fO(nT());return t.copy=function(){return bh(t,CO()).exponent(t.exponent())},ku.apply(t,arguments)}function tLe(){return CO.apply(null,arguments).exponent(.5)}const Yy=Object.freeze(Object.defineProperty({__proto__:null,scaleBand:sO,scaleDiverging:lee,scaleDivergingLog:cee,scaleDivergingPow:CO,scaleDivergingSqrt:tLe,scaleDivergingSymlog:dee,scaleIdentity:HJ,scaleImplicit:xR,scaleLinear:BJ,scaleLog:qJ,scaleOrdinal:aO,scalePoint:H3e,scalePow:gO,scaleQuantile:WJ,scaleQuantize:KJ,scaleRadial:GJ,scaleSequential:iee,scaleSequentialLog:aee,scaleSequentialPow:NO,scaleSequentialQuantile:oee,scaleSequentialSqrt:eLe,scaleSequentialSymlog:see,scaleSqrt:FRe,scaleSymlog:VJ,scaleThreshold:YJ,scaleTime:ZFe,scaleUtc:JFe,tickFormat:UJ},Symbol.toStringTag,{value:"Module"}));var Nu=t=>t.chartData,rT=pt([Nu],t=>{var e=t.chartData!=null?t.chartData.length-1:0;return{chartData:t.chartData,computedData:t.computedData,dataEndIndex:e,dataStartIndex:0}}),TO=(t,e,n,r)=>r?rT(t):Nu(t),uee=(t,e,n)=>n?rT(t):Nu(t);function xu(t){if(Array.isArray(t)&&t.length===2){var[e,n]=t;if(Ln(e)&&Ln(n))return!0}return!1}function _7(t,e,n){return n?t:[Math.min(t[0],e[0]),Math.max(t[1],e[1])]}function mee(t,e){if(e&&typeof t!="function"&&Array.isArray(t)&&t.length===2){var[n,r]=t,a,s;if(Ln(n))a=n;else if(typeof n=="function")return;if(Ln(r))s=r;else if(typeof r=="function")return;var o=[a,s];if(xu(o))return o}}function nLe(t,e,n){if(!(!n&&e==null)){if(typeof t=="function"&&e!=null)try{var r=t(e,n);if(xu(r))return _7(r,e,n)}catch{}if(Array.isArray(t)&&t.length===2){var[a,s]=t,o,l;if(a==="auto")e!=null&&(o=Math.min(...e));else if(Gt(a))o=a;else if(typeof a=="function")try{e!=null&&(o=a(e?.[0]))}catch{}else if(typeof a=="string"&&Dq.test(a)){var c=Dq.exec(a);if(c==null||c[1]==null||e==null)o=void 0;else{var d=+c[1];o=e[0]-d}}else o=e?.[0];if(s==="auto")e!=null&&(l=Math.max(...e));else if(Gt(s))l=s;else if(typeof s=="function")try{e!=null&&(l=s(e?.[1]))}catch{}else if(typeof s=="string"&&Rq.test(s)){var u=Rq.exec(s);if(u==null||u[1]==null||e==null)l=void 0;else{var m=+u[1];l=e[1]+m}}else l=e?.[1];var p=[o,l];if(xu(p))return e==null?p:_7(p,e,n)}}}var yx=1e9,rLe={precision:20,rounding:4,toExpNeg:-7,toExpPos:21,LN10:"2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286"},AO,mi=!0,Tl="[DecimalError] ",jp=Tl+"Invalid argument: ",PO=Tl+"Exponent out of range: ",vx=Math.floor,ap=Math.pow,iLe=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,Mo,Ea=1e7,li=7,hee=9007199254740991,qk=vx(hee/li),Zt={};Zt.absoluteValue=Zt.abs=function(){var t=new this.constructor(this);return t.s&&(t.s=1),t};Zt.comparedTo=Zt.cmp=function(t){var e,n,r,a,s=this;if(t=new s.constructor(t),s.s!==t.s)return s.s||-t.s;if(s.e!==t.e)return s.e>t.e^s.s<0?1:-1;for(r=s.d.length,a=t.d.length,e=0,n=r<a?r:a;e<n;++e)if(s.d[e]!==t.d[e])return s.d[e]>t.d[e]^s.s<0?1:-1;return r===a?0:r>a^s.s<0?1:-1};Zt.decimalPlaces=Zt.dp=function(){var t=this,e=t.d.length-1,n=(e-t.e)*li;if(e=t.d[e],e)for(;e%10==0;e/=10)n--;return n<0?0:n};Zt.dividedBy=Zt.div=function(t){return tu(this,new this.constructor(t))};Zt.dividedToIntegerBy=Zt.idiv=function(t){var e=this,n=e.constructor;return Qr(tu(e,new n(t),0,1),n.precision)};Zt.equals=Zt.eq=function(t){return!this.cmp(t)};Zt.exponent=function(){return la(this)};Zt.greaterThan=Zt.gt=function(t){return this.cmp(t)>0};Zt.greaterThanOrEqualTo=Zt.gte=function(t){return this.cmp(t)>=0};Zt.isInteger=Zt.isint=function(){return this.e>this.d.length-2};Zt.isNegative=Zt.isneg=function(){return this.s<0};Zt.isPositive=Zt.ispos=function(){return this.s>0};Zt.isZero=function(){return this.s===0};Zt.lessThan=Zt.lt=function(t){return this.cmp(t)<0};Zt.lessThanOrEqualTo=Zt.lte=function(t){return this.cmp(t)<1};Zt.logarithm=Zt.log=function(t){var e,n=this,r=n.constructor,a=r.precision,s=a+5;if(t===void 0)t=new r(10);else if(t=new r(t),t.s<1||t.eq(Mo))throw Error(Tl+"NaN");if(n.s<1)throw Error(Tl+(n.s?"NaN":"-Infinity"));return n.eq(Mo)?new r(0):(mi=!1,e=tu(c0(n,s),c0(t,s),s),mi=!0,Qr(e,a))};Zt.minus=Zt.sub=function(t){var e=this;return t=new e.constructor(t),e.s==t.s?gee(e,t):pee(e,(t.s=-t.s,t))};Zt.modulo=Zt.mod=function(t){var e,n=this,r=n.constructor,a=r.precision;if(t=new r(t),!t.s)throw Error(Tl+"NaN");return n.s?(mi=!1,e=tu(n,t,0,1).times(t),mi=!0,n.minus(e)):Qr(new r(n),a)};Zt.naturalExponential=Zt.exp=function(){return fee(this)};Zt.naturalLogarithm=Zt.ln=function(){return c0(this)};Zt.negated=Zt.neg=function(){var t=new this.constructor(this);return t.s=-t.s||0,t};Zt.plus=Zt.add=function(t){var e=this;return t=new e.constructor(t),e.s==t.s?pee(e,t):gee(e,(t.s=-t.s,t))};Zt.precision=Zt.sd=function(t){var e,n,r,a=this;if(t!==void 0&&t!==!!t&&t!==1&&t!==0)throw Error(jp+t);if(e=la(a)+1,r=a.d.length-1,n=r*li+1,r=a.d[r],r){for(;r%10==0;r/=10)n--;for(r=a.d[0];r>=10;r/=10)n++}return t&&e>n?e:n};Zt.squareRoot=Zt.sqrt=function(){var t,e,n,r,a,s,o,l=this,c=l.constructor;if(l.s<1){if(!l.s)return new c(0);throw Error(Tl+"NaN")}for(t=la(l),mi=!1,a=Math.sqrt(+l),a==0||a==1/0?(e=Lc(l.d),(e.length+t)%2==0&&(e+="0"),a=Math.sqrt(e),t=vx((t+1)/2)-(t<0||t%2),a==1/0?e="5e"+t:(e=a.toExponential(),e=e.slice(0,e.indexOf("e")+1)+t),r=new c(e)):r=new c(a.toString()),n=c.precision,a=o=n+3;;)if(s=r,r=s.plus(tu(l,s,o+2)).times(.5),Lc(s.d).slice(0,o)===(e=Lc(r.d)).slice(0,o)){if(e=e.slice(o-3,o+1),a==o&&e=="4999"){if(Qr(s,n+1,0),s.times(s).eq(l)){r=s;break}}else if(e!="9999")break;o+=4}return mi=!0,Qr(r,n)};Zt.times=Zt.mul=function(t){var e,n,r,a,s,o,l,c,d,u=this,m=u.constructor,p=u.d,f=(t=new m(t)).d;if(!u.s||!t.s)return new m(0);for(t.s*=u.s,n=u.e+t.e,c=p.length,d=f.length,c<d&&(s=p,p=f,f=s,o=c,c=d,d=o),s=[],o=c+d,r=o;r--;)s.push(0);for(r=d;--r>=0;){for(e=0,a=c+r;a>r;)l=s[a]+f[r]*p[a-r-1]+e,s[a--]=l%Ea|0,e=l/Ea|0;s[a]=(s[a]+e)%Ea|0}for(;!s[--o];)s.pop();return e?++n:s.shift(),t.d=s,t.e=n,mi?Qr(t,m.precision):t};Zt.toDecimalPlaces=Zt.todp=function(t,e){var n=this,r=n.constructor;return n=new r(n),t===void 0?n:(Gc(t,0,yx),e===void 0?e=r.rounding:Gc(e,0,8),Qr(n,t+la(n)+1,e))};Zt.toExponential=function(t,e){var n,r=this,a=r.constructor;return t===void 0?n=of(r,!0):(Gc(t,0,yx),e===void 0?e=a.rounding:Gc(e,0,8),r=Qr(new a(r),t+1,e),n=of(r,!0,t+1)),n};Zt.toFixed=function(t,e){var n,r,a=this,s=a.constructor;return t===void 0?of(a):(Gc(t,0,yx),e===void 0?e=s.rounding:Gc(e,0,8),r=Qr(new s(a),t+la(a)+1,e),n=of(r.abs(),!1,t+la(r)+1),a.isneg()&&!a.isZero()?"-"+n:n)};Zt.toInteger=Zt.toint=function(){var t=this,e=t.constructor;return Qr(new e(t),la(t)+1,e.rounding)};Zt.toNumber=function(){return+this};Zt.toPower=Zt.pow=function(t){var e,n,r,a,s,o,l=this,c=l.constructor,d=12,u=+(t=new c(t));if(!t.s)return new c(Mo);if(l=new c(l),!l.s){if(t.s<1)throw Error(Tl+"Infinity");return l}if(l.eq(Mo))return l;if(r=c.precision,t.eq(Mo))return Qr(l,r);if(e=t.e,n=t.d.length-1,o=e>=n,s=l.s,o){if((n=u<0?-u:u)<=hee){for(a=new c(Mo),e=Math.ceil(r/li+4),mi=!1;n%2&&(a=a.times(l),N7(a.d,e)),n=vx(n/2),n!==0;)l=l.times(l),N7(l.d,e);return mi=!0,t.s<0?new c(Mo).div(a):Qr(a,r)}}else if(s<0)throw Error(Tl+"NaN");return s=s<0&&t.d[Math.max(e,n)]&1?-1:1,l.s=1,mi=!1,a=t.times(c0(l,r+d)),mi=!0,a=fee(a),a.s=s,a};Zt.toPrecision=function(t,e){var n,r,a=this,s=a.constructor;return t===void 0?(n=la(a),r=of(a,n<=s.toExpNeg||n>=s.toExpPos)):(Gc(t,1,yx),e===void 0?e=s.rounding:Gc(e,0,8),a=Qr(new s(a),t,e),n=la(a),r=of(a,t<=n||n<=s.toExpNeg,t)),r};Zt.toSignificantDigits=Zt.tosd=function(t,e){var n=this,r=n.constructor;return t===void 0?(t=r.precision,e=r.rounding):(Gc(t,1,yx),e===void 0?e=r.rounding:Gc(e,0,8)),Qr(new r(n),t,e)};Zt.toString=Zt.valueOf=Zt.val=Zt.toJSON=Zt[Symbol.for("nodejs.util.inspect.custom")]=function(){var t=this,e=la(t),n=t.constructor;return of(t,e<=n.toExpNeg||e>=n.toExpPos)};function pee(t,e){var n,r,a,s,o,l,c,d,u=t.constructor,m=u.precision;if(!t.s||!e.s)return e.s||(e=new u(t)),mi?Qr(e,m):e;if(c=t.d,d=e.d,o=t.e,a=e.e,c=c.slice(),s=o-a,s){for(s<0?(r=c,s=-s,l=d.length):(r=d,a=o,l=c.length),o=Math.ceil(m/li),l=o>l?o+1:l+1,s>l&&(s=l,r.length=1),r.reverse();s--;)r.push(0);r.reverse()}for(l=c.length,s=d.length,l-s<0&&(s=l,r=d,d=c,c=r),n=0;s;)n=(c[--s]=c[s]+d[s]+n)/Ea|0,c[s]%=Ea;for(n&&(c.unshift(n),++a),l=c.length;c[--l]==0;)c.pop();return e.d=c,e.e=a,mi?Qr(e,m):e}function Gc(t,e,n){if(t!==~~t||t<e||t>n)throw Error(jp+t)}function Lc(t){var e,n,r,a=t.length-1,s="",o=t[0];if(a>0){for(s+=o,e=1;e<a;e++)r=t[e]+"",n=li-r.length,n&&(s+=gm(n)),s+=r;o=t[e],r=o+"",n=li-r.length,n&&(s+=gm(n))}else if(o===0)return"0";for(;o%10===0;)o/=10;return s+o}var tu=(function(){function t(r,a){var s,o=0,l=r.length;for(r=r.slice();l--;)s=r[l]*a+o,r[l]=s%Ea|0,o=s/Ea|0;return o&&r.unshift(o),r}function e(r,a,s,o){var l,c;if(s!=o)c=s>o?1:-1;else for(l=c=0;l<s;l++)if(r[l]!=a[l]){c=r[l]>a[l]?1:-1;break}return c}function n(r,a,s){for(var o=0;s--;)r[s]-=o,o=r[s]<a[s]?1:0,r[s]=o*Ea+r[s]-a[s];for(;!r[0]&&r.length>1;)r.shift()}return function(r,a,s,o){var l,c,d,u,m,p,f,y,x,b,v,_,k,P,C,T,N,R,A=r.constructor,D=r.s==a.s?1:-1,$=r.d,U=a.d;if(!r.s)return new A(r);if(!a.s)throw Error(Tl+"Division by zero");for(c=r.e-a.e,N=U.length,C=$.length,f=new A(D),y=f.d=[],d=0;U[d]==($[d]||0);)++d;if(U[d]>($[d]||0)&&--c,s==null?_=s=A.precision:o?_=s+(la(r)-la(a))+1:_=s,_<0)return new A(0);if(_=_/li+2|0,d=0,N==1)for(u=0,U=U[0],_++;(d<C||u)&&_--;d++)k=u*Ea+($[d]||0),y[d]=k/U|0,u=k%U|0;else{for(u=Ea/(U[0]+1)|0,u>1&&(U=t(U,u),$=t($,u),N=U.length,C=$.length),P=N,x=$.slice(0,N),b=x.length;b<N;)x[b++]=0;R=U.slice(),R.unshift(0),T=U[0],U[1]>=Ea/2&&++T;do u=0,l=e(U,x,N,b),l<0?(v=x[0],N!=b&&(v=v*Ea+(x[1]||0)),u=v/T|0,u>1?(u>=Ea&&(u=Ea-1),m=t(U,u),p=m.length,b=x.length,l=e(m,x,p,b),l==1&&(u--,n(m,N<p?R:U,p))):(u==0&&(l=u=1),m=U.slice()),p=m.length,p<b&&m.unshift(0),n(x,m,b),l==-1&&(b=x.length,l=e(U,x,N,b),l<1&&(u++,n(x,N<b?R:U,b))),b=x.length):l===0&&(u++,x=[0]),y[d++]=u,l&&x[0]?x[b++]=$[P]||0:(x=[$[P]],b=1);while((P++<C||x[0]!==void 0)&&_--)}return y[0]||y.shift(),f.e=c,Qr(f,o?s+la(f)+1:s)}})();function fee(t,e){var n,r,a,s,o,l,c=0,d=0,u=t.constructor,m=u.precision;if(la(t)>16)throw Error(PO+la(t));if(!t.s)return new u(Mo);for(mi=!1,l=m,o=new u(.03125);t.abs().gte(.1);)t=t.times(o),d+=5;for(r=Math.log(ap(2,d))/Math.LN10*2+5|0,l+=r,n=a=s=new u(Mo),u.precision=l;;){if(a=Qr(a.times(t),l),n=n.times(++c),o=s.plus(tu(a,n,l)),Lc(o.d).slice(0,l)===Lc(s.d).slice(0,l)){for(;d--;)s=Qr(s.times(s),l);return u.precision=m,e==null?(mi=!0,Qr(s,m)):s}s=o}}function la(t){for(var e=t.e*li,n=t.d[0];n>=10;n/=10)e++;return e}function BE(t,e,n){if(e>t.LN10.sd())throw mi=!0,n&&(t.precision=n),Error(Tl+"LN10 precision limit exceeded");return Qr(new t(t.LN10),e)}function gm(t){for(var e="";t--;)e+="0";return e}function c0(t,e){var n,r,a,s,o,l,c,d,u,m=1,p=10,f=t,y=f.d,x=f.constructor,b=x.precision;if(f.s<1)throw Error(Tl+(f.s?"NaN":"-Infinity"));if(f.eq(Mo))return new x(0);if(e==null?(mi=!1,d=b):d=e,f.eq(10))return e==null&&(mi=!0),BE(x,d);if(d+=p,x.precision=d,n=Lc(y),r=n.charAt(0),s=la(f),Math.abs(s)<15e14){for(;r<7&&r!=1||r==1&&n.charAt(1)>3;)f=f.times(t),n=Lc(f.d),r=n.charAt(0),m++;s=la(f),r>1?(f=new x("0."+n),s++):f=new x(r+"."+n.slice(1))}else return c=BE(x,d+2,b).times(s+""),f=c0(new x(r+"."+n.slice(1)),d-p).plus(c),x.precision=b,e==null?(mi=!0,Qr(f,b)):f;for(l=o=f=tu(f.minus(Mo),f.plus(Mo),d),u=Qr(f.times(f),d),a=3;;){if(o=Qr(o.times(u),d),c=l.plus(tu(o,new x(a),d)),Lc(c.d).slice(0,d)===Lc(l.d).slice(0,d))return l=l.times(2),s!==0&&(l=l.plus(BE(x,d+2,b).times(s+""))),l=tu(l,new x(m),d),x.precision=b,e==null?(mi=!0,Qr(l,b)):l;l=c,a+=2}}function k7(t,e){var n,r,a;for((n=e.indexOf("."))>-1&&(e=e.replace(".","")),(r=e.search(/e/i))>0?(n<0&&(n=r),n+=+e.slice(r+1),e=e.substring(0,r)):n<0&&(n=e.length),r=0;e.charCodeAt(r)===48;)++r;for(a=e.length;e.charCodeAt(a-1)===48;)--a;if(e=e.slice(r,a),e){if(a-=r,n=n-r-1,t.e=vx(n/li),t.d=[],r=(n+1)%li,n<0&&(r+=li),r<a){for(r&&t.d.push(+e.slice(0,r)),a-=li;r<a;)t.d.push(+e.slice(r,r+=li));e=e.slice(r),r=li-e.length}else r-=a;for(;r--;)e+="0";if(t.d.push(+e),mi&&(t.e>qk||t.e<-qk))throw Error(PO+n)}else t.s=0,t.e=0,t.d=[0];return t}function Qr(t,e,n){var r,a,s,o,l,c,d,u,m=t.d;for(o=1,s=m[0];s>=10;s/=10)o++;if(r=e-o,r<0)r+=li,a=e,d=m[u=0];else{if(u=Math.ceil((r+1)/li),s=m.length,u>=s)return t;for(d=s=m[u],o=1;s>=10;s/=10)o++;r%=li,a=r-li+o}if(n!==void 0&&(s=ap(10,o-a-1),l=d/s%10|0,c=e<0||m[u+1]!==void 0||d%s,c=n<4?(l||c)&&(n==0||n==(t.s<0?3:2)):l>5||l==5&&(n==4||c||n==6&&(r>0?a>0?d/ap(10,o-a):0:m[u-1])%10&1||n==(t.s<0?8:7))),e<1||!m[0])return c?(s=la(t),m.length=1,e=e-s-1,m[0]=ap(10,(li-e%li)%li),t.e=vx(-e/li)||0):(m.length=1,m[0]=t.e=t.s=0),t;if(r==0?(m.length=u,s=1,u--):(m.length=u+1,s=ap(10,li-r),m[u]=a>0?(d/ap(10,o-a)%ap(10,a)|0)*s:0),c)for(;;)if(u==0){(m[0]+=s)==Ea&&(m[0]=1,++t.e);break}else{if(m[u]+=s,m[u]!=Ea)break;m[u--]=0,s=1}for(r=m.length;m[--r]===0;)m.pop();if(mi&&(t.e>qk||t.e<-qk))throw Error(PO+la(t));return t}function gee(t,e){var n,r,a,s,o,l,c,d,u,m,p=t.constructor,f=p.precision;if(!t.s||!e.s)return e.s?e.s=-e.s:e=new p(t),mi?Qr(e,f):e;if(c=t.d,m=e.d,r=e.e,d=t.e,c=c.slice(),o=d-r,o){for(u=o<0,u?(n=c,o=-o,l=m.length):(n=m,r=d,l=c.length),a=Math.max(Math.ceil(f/li),l)+2,o>a&&(o=a,n.length=1),n.reverse(),a=o;a--;)n.push(0);n.reverse()}else{for(a=c.length,l=m.length,u=a<l,u&&(l=a),a=0;a<l;a++)if(c[a]!=m[a]){u=c[a]<m[a];break}o=0}for(u&&(n=c,c=m,m=n,e.s=-e.s),l=c.length,a=m.length-l;a>0;--a)c[l++]=0;for(a=m.length;a>o;){if(c[--a]<m[a]){for(s=a;s&&c[--s]===0;)c[s]=Ea-1;--c[s],c[a]+=Ea}c[a]-=m[a]}for(;c[--l]===0;)c.pop();for(;c[0]===0;c.shift())--r;return c[0]?(e.d=c,e.e=r,mi?Qr(e,f):e):new p(0)}function of(t,e,n){var r,a=la(t),s=Lc(t.d),o=s.length;return e?(n&&(r=n-o)>0?s=s.charAt(0)+"."+s.slice(1)+gm(r):o>1&&(s=s.charAt(0)+"."+s.slice(1)),s=s+(a<0?"e":"e+")+a):a<0?(s="0."+gm(-a-1)+s,n&&(r=n-o)>0&&(s+=gm(r))):a>=o?(s+=gm(a+1-o),n&&(r=n-a-1)>0&&(s=s+"."+gm(r))):((r=a+1)<o&&(s=s.slice(0,r)+"."+s.slice(r)),n&&(r=n-o)>0&&(a+1===o&&(s+="."),s+=gm(r))),t.s<0?"-"+s:s}function N7(t,e){if(t.length>e)return t.length=e,!0}function bee(t){var e,n,r;function a(s){var o=this;if(!(o instanceof a))return new a(s);if(o.constructor=a,s instanceof a){o.s=s.s,o.e=s.e,o.d=(s=s.d)?s.slice():s;return}if(typeof s=="number"){if(s*0!==0)throw Error(jp+s);if(s>0)o.s=1;else if(s<0)s=-s,o.s=-1;else{o.s=0,o.e=0,o.d=[0];return}if(s===~~s&&s<1e7){o.e=0,o.d=[s];return}return k7(o,s.toString())}else if(typeof s!="string")throw Error(jp+s);if(s.charCodeAt(0)===45?(s=s.slice(1),o.s=-1):o.s=1,iLe.test(s))k7(o,s);else throw Error(jp+s)}if(a.prototype=Zt,a.ROUND_UP=0,a.ROUND_DOWN=1,a.ROUND_CEIL=2,a.ROUND_FLOOR=3,a.ROUND_HALF_UP=4,a.ROUND_HALF_DOWN=5,a.ROUND_HALF_EVEN=6,a.ROUND_HALF_CEIL=7,a.ROUND_HALF_FLOOR=8,a.clone=bee,a.config=a.set=aLe,t===void 0&&(t={}),t)for(r=["precision","rounding","toExpNeg","toExpPos","LN10"],e=0;e<r.length;)t.hasOwnProperty(n=r[e++])||(t[n]=this[n]);return a.config(t),a}function aLe(t){if(!t||typeof t!="object")throw Error(Tl+"Object expected");var e,n,r,a=["precision",1,yx,"rounding",0,8,"toExpNeg",-1/0,0,"toExpPos",0,1/0];for(e=0;e<a.length;e+=3)if((r=t[n=a[e]])!==void 0)if(vx(r)===r&&r>=a[e+1]&&r<=a[e+2])this[n]=r;else throw Error(jp+n+": "+r);if((r=t[n="LN10"])!==void 0)if(r==Math.LN10)this[n]=new this(r);else throw Error(jp+n+": "+r);return this}var AO=bee(rLe);Mo=new AO(1);const jr=AO;function xee(t){var e;return t===0?e=1:e=Math.floor(new jr(t).abs().log(10).toNumber())+1,e}function yee(t,e,n){for(var r=new jr(t),a=0,s=[];r.lt(e)&&a<1e5;)s.push(r.toNumber()),r=r.add(n),a++;return s}var vee=t=>{var[e,n]=t,[r,a]=[e,n];return e>n&&([r,a]=[n,e]),[r,a]},wee=(t,e,n)=>{if(t.lte(0))return new jr(0);var r=xee(t.toNumber()),a=new jr(10).pow(r),s=t.div(a),o=r!==1?.05:.1,l=new jr(Math.ceil(s.div(o).toNumber())).add(n).mul(o),c=l.mul(a);return e?new jr(c.toNumber()):new jr(Math.ceil(c.toNumber()))},sLe=(t,e,n)=>{var r=new jr(1),a=new jr(t);if(!a.isint()&&n){var s=Math.abs(t);s<1?(r=new jr(10).pow(xee(t)-1),a=new jr(Math.floor(a.div(r).toNumber())).mul(r)):s>1&&(a=new jr(Math.floor(t)))}else t===0?a=new jr(Math.floor((e-1)/2)):n||(a=new jr(Math.floor(t)));for(var o=Math.floor((e-1)/2),l=[],c=0;c<e;c++)l.push(a.add(new jr(c-o).mul(r)).toNumber());return l},See=function(e,n,r,a){var s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0;if(!Number.isFinite((n-e)/(r-1)))return{step:new jr(0),tickMin:new jr(0),tickMax:new jr(0)};var o=wee(new jr(n).sub(e).div(r-1),a,s),l;e<=0&&n>=0?l=new jr(0):(l=new jr(e).add(n).div(2),l=l.sub(new jr(l).mod(o)));var c=Math.ceil(l.sub(e).div(o).toNumber()),d=Math.ceil(new jr(n).sub(l).div(o).toNumber()),u=c+d+1;return u>r?See(e,n,r,a,s+1):(u<r&&(d=n>0?d+(r-u):d,c=n>0?c:c+(r-u)),{step:o,tickMin:l.sub(new jr(c).mul(o)),tickMax:l.add(new jr(d).mul(o))})},oLe=function(e){var[n,r]=e,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=Math.max(a,2),[l,c]=vee([n,r]);if(l===-1/0||c===1/0){var d=c===1/0?[l,...Array(a-1).fill(1/0)]:[...Array(a-1).fill(-1/0),c];return n>r?d.reverse():d}if(l===c)return sLe(l,a,s);var{step:u,tickMin:m,tickMax:p}=See(l,c,o,s,0),f=yee(m,p.add(new jr(.1).mul(u)),u);return n>r?f.reverse():f},lLe=function(e,n){var[r,a]=e,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,[o,l]=vee([r,a]);if(o===-1/0||l===1/0)return[r,a];if(o===l)return[o];var c=Math.max(n,2),d=wee(new jr(l).sub(o).div(c-1),s,0),u=[...yee(new jr(o),new jr(l),d),l];return s===!1&&(u=u.map(m=>Math.round(m))),r>a?u.reverse():u},_ee=t=>t.rootProps.maxBarSize,cLe=t=>t.rootProps.barGap,kee=t=>t.rootProps.barCategoryGap,dLe=t=>t.rootProps.barSize,J0=t=>t.rootProps.stackOffset,Nee=t=>t.rootProps.reverseStackOrder,MO=t=>t.options.chartName,EO=t=>t.rootProps.syncId,Cee=t=>t.rootProps.syncMethod,jO=t=>t.options.eventEmitter,uLe=t=>t.rootProps.baseValue,Oi={grid:-100,barBackground:-50,area:100,cursorRectangle:200,bar:300,line:400,axis:500,scatter:600,activeBar:1e3,cursorLine:1100,activeDot:1200,label:2e3},Qh={allowDecimals:!1,allowDataOverflow:!1,angleAxisId:0,reversed:!1,scale:"auto",tick:!0,type:"auto"},Sc={allowDataOverflow:!1,allowDecimals:!1,allowDuplicatedCategory:!0,includeHidden:!1,radiusAxisId:0,reversed:!1,scale:"auto",tick:!0,tickCount:5,type:"auto"},iT=(t,e)=>{if(!(!t||!e))return t!=null&&t.reversed?[e[1],e[0]]:e};function aT(t,e,n){if(n!=="auto")return n;if(t!=null)return cc(t,e)?"category":"number"}function C7(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),n.push.apply(n,r)}return n}function Vk(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?C7(Object(n),!0).forEach(function(r){mLe(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):C7(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function mLe(t,e,n){return(e=hLe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function hLe(t){var e=pLe(t,"string");return typeof e=="symbol"?e:e+""}function pLe(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var T7={allowDataOverflow:Qh.allowDataOverflow,allowDecimals:Qh.allowDecimals,allowDuplicatedCategory:!1,dataKey:void 0,domain:void 0,id:Qh.angleAxisId,includeHidden:!1,name:void 0,reversed:Qh.reversed,scale:Qh.scale,tick:Qh.tick,tickCount:void 0,ticks:void 0,type:Qh.type,unit:void 0},P7={allowDataOverflow:Sc.allowDataOverflow,allowDecimals:Sc.allowDecimals,allowDuplicatedCategory:Sc.allowDuplicatedCategory,dataKey:void 0,domain:void 0,id:Sc.radiusAxisId,includeHidden:Sc.includeHidden,name:void 0,reversed:Sc.reversed,scale:Sc.scale,tick:Sc.tick,tickCount:Sc.tickCount,ticks:void 0,type:Sc.type,unit:void 0},fLe=(t,e)=>{if(e!=null)return t.polarAxis.angleAxis[e]},DO=pt([fLe,cJ],(t,e)=>{var n;if(t!=null)return t;var r=(n=aT(e,"angleAxis",T7.type))!==null&&n!==void 0?n:"category";return Vk(Vk({},T7),{},{type:r})}),gLe=(t,e)=>t.polarAxis.radiusAxis[e],RO=pt([gLe,cJ],(t,e)=>{var n;if(t!=null)return t;var r=(n=aT(e,"radiusAxis",P7.type))!==null&&n!==void 0?n:"category";return Vk(Vk({},P7),{},{type:r})}),sT=t=>t.polarOptions,FO=pt([Su,_u,ya],TJ),Tee=pt([sT,FO],(t,e)=>{if(t!=null)return bs(t.innerRadius,e,0)}),Pee=pt([sT,FO],(t,e)=>{if(t!=null)return bs(t.outerRadius,e,e*.8)}),bLe=t=>{if(t==null)return[0,0];var{startAngle:e,endAngle:n}=t;return[e,n]},Aee=pt([sT],bLe);pt([DO,Aee],iT);var Mee=pt([FO,Tee,Pee],(t,e,n)=>{if(!(t==null||e==null||n==null))return[e,n]});pt([RO,Mee],iT);var Eee=pt([hr,sT,Tee,Pee,Su,_u],(t,e,n,r,a,s)=>{if(!(t!=="centric"&&t!=="radial"||e==null||n==null||r==null)){var{cx:o,cy:l,startAngle:c,endAngle:d}=e;return{cx:bs(o,a,a/2),cy:bs(l,s,s/2),innerRadius:n,outerRadius:r,startAngle:c,endAngle:d,clockWise:!1}}}),Ni=(t,e)=>e,ew=(t,e,n)=>n;function oT(t){return t?.id}function jee(t,e,n){var{chartData:r=[]}=e,{allowDuplicatedCategory:a,dataKey:s}=n,o=new Map;return t.forEach(l=>{var c,d=(c=l.data)!==null&&c!==void 0?c:r;if(!(d==null||d.length===0)){var u=oT(l);d.forEach((m,p)=>{var f=s==null||a?p:String(Tr(m,s,null)),y=Tr(m,l.dataKey,0),x;o.has(f)?x=o.get(f):x={},Object.assign(x,{[u]:y}),o.set(f,x)})}}),Array.from(o.values())}function lT(t){return"stackId"in t&&t.stackId!=null&&t.dataKey!=null}var cT=(t,e)=>t===e?!0:t==null||e==null?!1:t[0]===e[0]&&t[1]===e[1];function dT(t,e){return Array.isArray(t)&&Array.isArray(e)&&t.length===0&&e.length===0?!0:t===e}function xLe(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 Ia=t=>{var e=hr(t);return e==="horizontal"?"xAxis":e==="vertical"?"yAxis":e==="centric"?"angleAxis":"radiusAxis"},wx=t=>t.tooltip.settings.axisId;function yLe(t){if(t in Yy)return Yy[t]();var e="scale".concat(U0(t));if(e in Yy)return Yy[e]()}function A7(t){var e=t.ticks,n=t.bandwidth,r=t.range(),a=[Math.min(...r),Math.max(...r)];return{domain:()=>t.domain(),range:(function(s){function o(){return s.apply(this,arguments)}return o.toString=function(){return s.toString()},o})(()=>a),rangeMin:()=>a[0],rangeMax:()=>a[1],isInRange(s){var o=a[0],l=a[1];return o<=l?s>=o&&s<=l:s>=l&&s<=o},bandwidth:n?()=>n.call(t):void 0,ticks:e?s=>e.call(t,s):void 0,map:(s,o)=>{var l=t(s);if(l!=null){if(t.bandwidth&&o!==null&&o!==void 0&&o.position){var c=t.bandwidth();switch(o.position){case"middle":l+=c/2;break;case"end":l+=c;break}}return l}}}}function M7(t,e,n){if(typeof t=="function")return A7(t.copy().domain(e).range(n));if(t!=null){var r=yLe(t);if(r!=null)return r.domain(e).range(n),A7(r)}}var Dee=(t,e)=>{if(e!=null)switch(t){case"linear":{if(!xu(e)){for(var n,r,a=0;a<e.length;a++){var s=e[a];Ln(s)&&((n===void 0||s<n)&&(n=s),(r===void 0||s>r)&&(r=s))}return n!==void 0&&r!==void 0?[n,r]:void 0}return e}default:return e}};function E7(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),n.push.apply(n,r)}return n}function Gk(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?E7(Object(n),!0).forEach(function(r){vLe(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):E7(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function vLe(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=SLe(t,"string");return typeof e=="symbol"?e:e+""}function SLe(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var SR=[0,"auto"],Aa={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},Ree=(t,e)=>t.cartesianAxis.xAxis[e],Jc=(t,e)=>{var n=Ree(t,e);return n??Aa},Ma={allowDataOverflow:!1,allowDecimals:!0,allowDuplicatedCategory:!0,angle:0,dataKey:void 0,domain:SR,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:q0},Fee=(t,e)=>t.cartesianAxis.yAxis[e],ed=(t,e)=>{var n=Fee(t,e);return n??Ma},_Le={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:""},LO=(t,e)=>{var n=t.cartesianAxis.zAxis[e];return n??_Le},Ui=(t,e,n)=>{switch(e){case"xAxis":return Jc(t,n);case"yAxis":return ed(t,n);case"zAxis":return LO(t,n);case"angleAxis":return DO(t,n);case"radiusAxis":return RO(t,n);default:throw new Error("Unexpected axis type: ".concat(e))}},kLe=(t,e,n)=>{switch(e){case"xAxis":return Jc(t,n);case"yAxis":return ed(t,n);default:throw new Error("Unexpected axis type: ".concat(e))}},Sx=(t,e,n)=>{switch(e){case"xAxis":return Jc(t,n);case"yAxis":return ed(t,n);case"angleAxis":return DO(t,n);case"radiusAxis":return RO(t,n);default:throw new Error("Unexpected axis type: ".concat(e))}},Lee=t=>t.graphicalItems.cartesianItems.some(e=>e.type==="bar")||t.graphicalItems.polarItems.some(e=>e.type==="radialBar");function OO(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 tw=t=>t.graphicalItems.cartesianItems,NLe=pt([Ni,ew],OO),IO=(t,e,n)=>t.filter(n).filter(r=>e?.includeHidden===!0?!0:!r.hide),nw=pt([tw,Ui,NLe],IO,{memoizeOptions:{resultEqualityCheck:dT}}),Oee=pt([nw],t=>t.filter(e=>e.type==="area"||e.type==="bar").filter(lT)),Iee=t=>t.filter(e=>!("stackId"in e)||e.stackId===void 0),CLe=pt([nw],Iee),zO=t=>t.map(e=>e.data).filter(Boolean).flat(1),TLe=pt([nw],zO,{memoizeOptions:{resultEqualityCheck:dT}}),UO=(t,e)=>{var{chartData:n=[],dataStartIndex:r,dataEndIndex:a}=e;return t.length>0?t:n.slice(r,a+1)},BO=pt([TLe,TO],UO),HO=(t,e,n)=>e?.dataKey!=null?t.map(r=>({value:Tr(r,e.dataKey)})):n.length>0?n.map(r=>r.dataKey).flatMap(r=>t.map(a=>({value:Tr(a,r)}))):t.map(r=>({value:r})),uT=pt([BO,Ui,nw],HO);function zee(t,e){switch(t){case"xAxis":return e.direction==="x";case"yAxis":return e.direction==="y";default:return!1}}function _1(t){if(Nl(t)||t instanceof Date){var e=Number(t);if(Ln(e))return e}}function j7(t){if(Array.isArray(t)){var e=[_1(t[0]),_1(t[1])];return xu(e)?e:void 0}var n=_1(t);if(n!=null)return[n,n]}function yu(t){return t.map(_1).filter(ro)}function PLe(t,e,n){return!n||typeof e!="number"||ic(e)?[]:n.length?yu(n.flatMap(r=>{var a=Tr(t,r.dataKey),s,o;if(Array.isArray(a)?[s,o]=a:s=o=a,!(!Ln(s)||!Ln(o)))return[e-s,e+o]})):[]}var Sa=t=>{var e=Ia(t),n=wx(t);return Sx(t,e,n)},rw=pt([Sa],t=>t?.dataKey),ALe=pt([Oee,TO,Sa],jee),Uee=(t,e,n,r)=>{var a={},s=e.reduce((o,l)=>{if(l.stackId==null)return o;var c=o[l.stackId];return c==null&&(c=[]),c.push(l),o[l.stackId]=c,o},a);return Object.fromEntries(Object.entries(s).map(o=>{var[l,c]=o,d=r?[...c].reverse():c,u=d.map(oT);return[l,{stackedData:XEe(t,u,n),graphicalItems:d}]}))},Wk=pt([ALe,Oee,J0,Nee],Uee),Bee=(t,e,n,r)=>{var{dataStartIndex:a,dataEndIndex:s}=e;if(r==null&&n!=="zAxis"){var o=eje(t,a,s);if(!(o!=null&&o[0]===0&&o[1]===0))return o}},MLe=pt([Ui],t=>t.allowDataOverflow),$O=t=>{var e;if(t==null||!("domain"in t))return SR;if(t.domain!=null)return t.domain;if("ticks"in t&&t.ticks!=null){if(t.type==="number"){var n=yu(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:SR},qO=pt([Ui],$O),VO=pt([qO,MLe],mee),ELe=pt([Wk,Nu,Ni,VO],Bee,{memoizeOptions:{resultEqualityCheck:cT}}),mT=t=>t.errorBars,jLe=(t,e,n)=>t.flatMap(r=>e[r.id]).filter(Boolean).filter(r=>zee(n,r)),Kk=function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];var a=n.filter(Boolean);if(a.length!==0){var s=a.flat(),o=Math.min(...s),l=Math.max(...s);return[o,l]}},GO=(t,e,n,r,a)=>{var s,o;if(n.length>0&&t.forEach(l=>{n.forEach(c=>{var d,u,m=(d=r[c.id])===null||d===void 0?void 0:d.filter(v=>zee(a,v)),p=Tr(l,(u=e.dataKey)!==null&&u!==void 0?u:c.dataKey),f=PLe(l,p,m);if(f.length>=2){var y=Math.min(...f),x=Math.max(...f);(s==null||y<s)&&(s=y),(o==null||x>o)&&(o=x)}var b=j7(p);b!=null&&(s=s==null?b[0]:Math.min(s,b[0]),o=o==null?b[1]:Math.max(o,b[1]))})}),e?.dataKey!=null&&t.forEach(l=>{var c=j7(Tr(l,e.dataKey));c!=null&&(s=s==null?c[0]:Math.min(s,c[0]),o=o==null?c[1]:Math.max(o,c[1]))}),Ln(s)&&Ln(o))return[s,o]},DLe=pt([BO,Ui,CLe,mT,Ni],GO,{memoizeOptions:{resultEqualityCheck:cT}});function RLe(t){var{value:e}=t;if(Nl(e)||e instanceof Date)return e}var FLe=(t,e,n)=>{var r=t.map(RLe).filter(a=>a!=null);return n&&(e.dataKey==null||e.allowDuplicatedCategory&&iZ(r))?EJ(0,t.length):e.allowDuplicatedCategory?r:Array.from(new Set(r))},Hee=t=>t.referenceElements.dots,_x=(t,e,n)=>t.filter(r=>r.ifOverflow==="extendDomain").filter(r=>e==="xAxis"?r.xAxisId===n:r.yAxisId===n),LLe=pt([Hee,Ni,ew],_x),$ee=t=>t.referenceElements.areas,OLe=pt([$ee,Ni,ew],_x),qee=t=>t.referenceElements.lines,ILe=pt([qee,Ni,ew],_x),Vee=(t,e)=>{if(t!=null){var n=yu(t.map(r=>e==="xAxis"?r.x:r.y));if(n.length!==0)return[Math.min(...n),Math.max(...n)]}},zLe=pt(LLe,Ni,Vee),Gee=(t,e)=>{if(t!=null){var n=yu(t.flatMap(r=>[e==="xAxis"?r.x1:r.y1,e==="xAxis"?r.x2:r.y2]));if(n.length!==0)return[Math.min(...n),Math.max(...n)]}},ULe=pt([OLe,Ni],Gee);function BLe(t){var e;if(t.x!=null)return yu([t.x]);var n=(e=t.segment)===null||e===void 0?void 0:e.map(r=>r.x);return n==null||n.length===0?[]:yu(n)}function HLe(t){var e;if(t.y!=null)return yu([t.y]);var n=(e=t.segment)===null||e===void 0?void 0:e.map(r=>r.y);return n==null||n.length===0?[]:yu(n)}var Wee=(t,e)=>{if(t!=null){var n=t.flatMap(r=>e==="xAxis"?BLe(r):HLe(r));if(n.length!==0)return[Math.min(...n),Math.max(...n)]}},$Le=pt([ILe,Ni],Wee),qLe=pt(zLe,$Le,ULe,(t,e,n)=>Kk(t,n,e)),WO=(t,e,n,r,a,s,o,l)=>{if(n!=null)return n;var c=o==="vertical"&&l==="xAxis"||o==="horizontal"&&l==="yAxis",d=c?Kk(r,s,a):Kk(s,a);return nLe(e,d,t.allowDataOverflow)},VLe=pt([Ui,qO,VO,ELe,DLe,qLe,hr,Ni],WO,{memoizeOptions:{resultEqualityCheck:cT}}),GLe=[0,1],KO=(t,e,n,r,a,s,o)=>{if(!((t==null||n==null||n.length===0)&&o===void 0)){var{dataKey:l,type:c}=t,d=cc(e,s);if(d&&l==null){var u;return EJ(0,(u=n?.length)!==null&&u!==void 0?u:0)}return c==="category"?FLe(r,t,d):a==="expand"?GLe:o}},YO=pt([Ui,hr,BO,uT,J0,Ni,VLe],KO);function WLe(t){return t in Yy}var Kee=(t,e,n)=>{if(t!=null){var{scale:r,type:a}=t;if(r==="auto")return a==="category"&&n&&(n.indexOf("LineChart")>=0||n.indexOf("AreaChart")>=0||n.indexOf("ComposedChart")>=0&&!e)?"point":a==="category"?"band":"linear";if(typeof r=="string"){var s="scale".concat(U0(r));return WLe(s)?s:"point"}}},xh=pt([Ui,Lee,MO],Kee);function XO(t,e,n,r){if(!(n==null||r==null))return typeof t.scale=="function"?M7(t.scale,n,r):M7(e,n,r)}var QO=(t,e,n)=>{var r=$O(e);if(!(n!=="auto"&&n!=="linear")){if(e!=null&&e.tickCount&&Array.isArray(r)&&(r[0]==="auto"||r[1]==="auto")&&xu(t))return oLe(t,e.tickCount,e.allowDecimals);if(e!=null&&e.tickCount&&e.type==="number"&&xu(t))return lLe(t,e.tickCount,e.allowDecimals)}},ZO=pt([YO,Sx,xh],QO),JO=(t,e,n,r)=>{if(r!=="angleAxis"&&t?.type==="number"&&xu(e)&&Array.isArray(n)&&n.length>0){var a,s,o=e[0],l=(a=n[0])!==null&&a!==void 0?a:0,c=e[1],d=(s=n[n.length-1])!==null&&s!==void 0?s:0;return[Math.min(o,l),Math.max(c,d)]}return e},KLe=pt([Ui,YO,ZO,Ni],JO),YLe=pt(uT,Ui,(t,e)=>{if(!(!e||e.type!=="number")){var n=1/0,r=Array.from(yu(t.map(m=>m.value))).sort((m,p)=>m-p),a=r[0],s=r[r.length-1];if(a==null||s==null)return 1/0;var o=s-a;if(o===0)return 1/0;for(var l=0;l<r.length-1;l++){var c=r[l],d=r[l+1];if(!(c==null||d==null)){var u=d-c;n=Math.min(n,u)}}return n/o}}),Yee=pt(YLe,hr,kee,ya,(t,e,n,r,a)=>a,(t,e,n,r,a)=>{if(!Ln(t))return 0;var s=e==="vertical"?r.height:r.width;if(a==="gap")return t*s/2;if(a==="no-gap"){var o=bs(n,t*s),l=t*s/2;return l-o-(l-o)/s*o}return 0}),XLe=(t,e,n)=>{var r=Jc(t,e);return r==null||typeof r.padding!="string"?0:Yee(t,"xAxis",e,n,r.padding)},QLe=(t,e,n)=>{var r=ed(t,e);return r==null||typeof r.padding!="string"?0:Yee(t,"yAxis",e,n,r.padding)},ZLe=pt(Jc,XLe,(t,e)=>{var n,r;if(t==null)return{left:0,right:0};var{padding:a}=t;return typeof a=="string"?{left:e,right:e}:{left:((n=a.left)!==null&&n!==void 0?n:0)+e,right:((r=a.right)!==null&&r!==void 0?r:0)+e}}),JLe=pt(ed,QLe,(t,e)=>{var n,r;if(t==null)return{top:0,bottom:0};var{padding:a}=t;return typeof a=="string"?{top:e,bottom:e}:{top:((n=a.top)!==null&&n!==void 0?n:0)+e,bottom:((r=a.bottom)!==null&&r!==void 0?r:0)+e}}),eOe=pt([ya,ZLe,WC,GC,(t,e,n)=>n],(t,e,n,r,a)=>{var{padding:s}=r;return a?[s.left,n.width-s.right]:[t.left+e.left,t.left+t.width-e.right]}),tOe=pt([ya,hr,JLe,WC,GC,(t,e,n)=>n],(t,e,n,r,a,s)=>{var{padding:o}=a;return s?[r.height-o.bottom,o.top]:e==="horizontal"?[t.top+t.height-n.bottom,t.top+n.top]:[t.top+n.top,t.top+t.height-n.bottom]}),iw=(t,e,n,r)=>{var a;switch(e){case"xAxis":return eOe(t,n,r);case"yAxis":return tOe(t,n,r);case"zAxis":return(a=LO(t,n))===null||a===void 0?void 0:a.range;case"angleAxis":return Aee(t);case"radiusAxis":return Mee(t,n);default:return}},Xee=pt([Ui,iw],iT),nOe=pt([xh,KLe],Dee),Kb=pt([Ui,xh,nOe,Xee],XO);pt([nw,mT,Ni],jLe);function Qee(t,e){return t.id<e.id?-1:t.id>e.id?1:0}var hT=(t,e)=>e,pT=(t,e,n)=>n,rOe=pt(qC,hT,pT,(t,e,n)=>t.filter(r=>r.orientation===e).filter(r=>r.mirror===n).sort(Qee)),iOe=pt(VC,hT,pT,(t,e,n)=>t.filter(r=>r.orientation===e).filter(r=>r.mirror===n).sort(Qee)),Zee=(t,e)=>({width:t.width,height:e.height}),aOe=(t,e)=>{var n=typeof e.width=="number"?e.width:q0;return{width:n,height:t.height}},Jee=pt(ya,Jc,Zee),sOe=(t,e,n)=>{switch(e){case"top":return t.top;case"bottom":return n-t.bottom;default:return 0}},oOe=(t,e,n)=>{switch(e){case"left":return t.left;case"right":return n-t.right;default:return 0}},lOe=pt(_u,ya,rOe,hT,pT,(t,e,n,r,a)=>{var s={},o;return n.forEach(l=>{var c=Zee(e,l);o==null&&(o=sOe(e,r,t));var d=r==="top"&&!a||r==="bottom"&&a;s[l.id]=o-Number(d)*c.height,o+=(d?-1:1)*c.height}),s}),cOe=pt(Su,ya,iOe,hT,pT,(t,e,n,r,a)=>{var s={},o;return n.forEach(l=>{var c=aOe(e,l);o==null&&(o=oOe(e,r,t));var d=r==="left"&&!a||r==="right"&&a;s[l.id]=o-Number(d)*c.width,o+=(d?-1:1)*c.width}),s}),dOe=(t,e)=>{var n=Jc(t,e);if(n!=null)return lOe(t,n.orientation,n.mirror)},uOe=pt([ya,Jc,dOe,(t,e)=>e],(t,e,n,r)=>{if(e!=null){var a=n?.[r];return a==null?{x:t.left,y:0}:{x:t.left,y:a}}}),mOe=(t,e)=>{var n=ed(t,e);if(n!=null)return cOe(t,n.orientation,n.mirror)},hOe=pt([ya,ed,mOe,(t,e)=>e],(t,e,n,r)=>{if(e!=null){var a=n?.[r];return a==null?{x:0,y:t.top}:{x:a,y:t.top}}}),ete=pt(ya,ed,(t,e)=>{var n=typeof e.width=="number"?e.width:q0;return{width:n,height:t.height}}),D7=(t,e,n)=>{switch(e){case"xAxis":return Jee(t,n).width;case"yAxis":return ete(t,n).height;default:return}},tte=(t,e,n,r)=>{if(n!=null){var{allowDuplicatedCategory:a,type:s,dataKey:o}=n,l=cc(t,r),c=e.map(d=>d.value);if(o&&l&&s==="category"&&a&&iZ(c))return c}},e4=pt([hr,uT,Ui,Ni],tte),nte=(t,e,n,r)=>{if(!(n==null||n.dataKey==null)){var{type:a,scale:s}=n,o=cc(t,r);if(o&&(a==="number"||s!=="auto"))return e.map(l=>l.value)}},t4=pt([hr,uT,Sx,Ni],nte),R7=pt([hr,kLe,xh,Kb,e4,t4,iw,ZO,Ni],(t,e,n,r,a,s,o,l,c)=>{if(e!=null){var d=cc(t,c);return{angle:e.angle,interval:e.interval,minTickGap:e.minTickGap,orientation:e.orientation,tick:e.tick,tickCount:e.tickCount,tickFormatter:e.tickFormatter,ticks:e.ticks,type:e.type,unit:e.unit,axisType:c,categoricalDomain:s,duplicateDomain:a,isCategorical:d,niceTicks:l,range:o,realScaleType:n,scale:r}}}),pOe=(t,e,n,r,a,s,o,l,c)=>{if(!(e==null||r==null)){var d=cc(t,c),{type:u,ticks:m,tickCount:p}=e,f=n==="scaleBand"&&typeof r.bandwidth=="function"?r.bandwidth()/2:2,y=u==="category"&&r.bandwidth?r.bandwidth()/f:0;y=c==="angleAxis"&&s!=null&&s.length>=2?Ra(s[0]-s[1])*2*y:y;var x=m||a;return x?x.map((b,v)=>{var _=o?o.indexOf(b):b,k=r.map(_);return Ln(k)?{index:v,coordinate:k+y,value:b,offset:y}:null}).filter(ro):d&&l?l.map((b,v)=>{var _=r.map(b);return Ln(_)?{coordinate:_+y,value:b,index:v,offset:y}:null}).filter(ro):r.ticks?r.ticks(p).map((b,v)=>{var _=r.map(b);return Ln(_)?{coordinate:_+y,value:b,index:v,offset:y}:null}).filter(ro):r.domain().map((b,v)=>{var _=r.map(b);return Ln(_)?{coordinate:_+y,value:o?o[b]:b,index:v,offset:y}:null}).filter(ro)}},rte=pt([hr,Sx,xh,Kb,ZO,iw,e4,t4,Ni],pOe),fOe=(t,e,n,r,a,s,o)=>{if(!(e==null||n==null||r==null||r[0]===r[1])){var l=cc(t,o),{tickCount:c}=e,d=0;return d=o==="angleAxis"&&r?.length>=2?Ra(r[0]-r[1])*2*d:d,l&&s?s.map((u,m)=>{var p=n.map(u);return Ln(p)?{coordinate:p+d,value:u,index:m,offset:d}:null}).filter(ro):n.ticks?n.ticks(c).map((u,m)=>{var p=n.map(u);return Ln(p)?{coordinate:p+d,value:u,index:m,offset:d}:null}).filter(ro):n.domain().map((u,m)=>{var p=n.map(u);return Ln(p)?{coordinate:p+d,value:a?a[u]:u,index:m,offset:d}:null}).filter(ro)}},Wc=pt([hr,Sx,Kb,iw,e4,t4,Ni],fOe),Kc=pt(Ui,Kb,(t,e)=>{if(!(t==null||e==null))return Gk(Gk({},t),{},{scale:e})}),gOe=pt([Ui,xh,YO,Xee],XO);pt((t,e,n)=>LO(t,n),gOe,(t,e)=>{if(!(t==null||e==null))return Gk(Gk({},t),{},{scale:e})});var bOe=pt([hr,qC,VC],(t,e,n)=>{switch(t){case"horizontal":return e.some(r=>r.reversed)?"right-to-left":"left-to-right";case"vertical":return n.some(r=>r.reversed)?"bottom-to-top":"top-to-bottom";case"centric":case"radial":return"left-to-right";default:return}}),ite=t=>t.options.defaultTooltipEventType,ate=t=>t.options.validateTooltipEventTypes;function ste(t,e,n){if(t==null)return e;var r=t?"axis":"item";return n==null?e:n.includes(r)?r:e}function n4(t,e){var n=ite(t),r=ate(t);return ste(e,n,r)}function xOe(t){return Kt(e=>n4(e,t))}var ote=(t,e)=>{var n,r=Number(e);if(!(ic(r)||e==null))return r>=0?t==null||(n=t[r])===null||n===void 0?void 0:n.value:void 0},yOe=t=>t.tooltip.settings,km={active:!1,index:null,dataKey:void 0,graphicalItemId:void 0,coordinate:void 0},vOe={itemInteraction:{click:km,hover:km},axisInteraction:{click:km,hover:km},keyboardInteraction:km,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}},lte=ho({name:"tooltip",initialState:vOe,reducers:{addTooltipEntrySettings:{reducer(t,e){t.tooltipItemPayloads.push(e.payload)},prepare:ui()},replaceTooltipEntrySettings:{reducer(t,e){var{prev:n,next:r}=e.payload,a=Jl(t).tooltipItemPayloads.indexOf(n);a>-1&&(t.tooltipItemPayloads[a]=r)},prepare:ui()},removeTooltipEntrySettings:{reducer(t,e){var n=Jl(t).tooltipItemPayloads.indexOf(e.payload);n>-1&&t.tooltipItemPayloads.splice(n,1)},prepare:ui()},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}}}),{addTooltipEntrySettings:wOe,replaceTooltipEntrySettings:SOe,removeTooltipEntrySettings:_Oe,setTooltipSettingsState:kOe,setActiveMouseOverItemIndex:cte,mouseLeaveItem:NOe,mouseLeaveChart:dte,setActiveClickItemIndex:COe,setMouseOverAxisIndex:ute,setMouseClickAxisIndex:TOe,setSyncInteraction:_R,setKeyboardInteraction:kR}=lte.actions,POe=lte.reducer;function F7(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),n.push.apply(n,r)}return n}function O_(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?F7(Object(n),!0).forEach(function(r){AOe(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):F7(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function AOe(t,e,n){return(e=MOe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function MOe(t){var e=EOe(t,"string");return typeof e=="symbol"?e:e+""}function EOe(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function jOe(t,e,n){return e==="axis"?n==="click"?t.axisInteraction.click:t.axisInteraction.hover:n==="click"?t.itemInteraction.click:t.itemInteraction.hover}function DOe(t){return t.index!=null}var mte=(t,e,n,r)=>{if(e==null)return km;var a=jOe(t,e,n);if(a==null)return km;if(a.active)return a;if(t.keyboardInteraction.active)return t.keyboardInteraction;if(t.syncInteraction.active&&t.syncInteraction.index!=null)return t.syncInteraction;var s=t.settings.active===!0;if(DOe(a)){if(s)return O_(O_({},a),{},{active:!0})}else if(r!=null)return{active:!0,coordinate:void 0,dataKey:void 0,index:r,graphicalItemId:void 0};return O_(O_({},km),{},{coordinate:a.coordinate})};function ROe(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 FOe(t,e){var n=ROe(t),r=e[0],a=e[1];if(n===void 0)return!1;var s=Math.min(r,a),o=Math.max(r,a);return n>=s&&n<=o}function LOe(t,e,n){if(n==null||e==null)return!0;var r=Tr(t,e);return r==null||!xu(n)?!0:FOe(r,n)}var r4=(t,e,n,r)=>{var a=t?.index;if(a==null)return null;var s=Number(a);if(!Ln(s))return a;var o=0,l=1/0;e.length>0&&(l=e.length-1);var c=Math.max(o,Math.min(s,l)),d=e[c];return d==null||LOe(d,n,r)?String(c):null},hte=(t,e,n,r,a,s,o)=>{if(s!=null){var l=o[0],c=l?.getPosition(s);if(c!=null)return c;var d=a?.[Number(s)];if(d)return n==="horizontal"?{x:d.coordinate,y:(r.top+e)/2}:{x:(r.left+t)/2,y:d.coordinate}}},pte=(t,e,n,r)=>{if(e==="axis")return t.tooltipItemPayloads;if(t.tooltipItemPayloads.length===0)return[];var a;if(n==="hover"?a=t.itemInteraction.hover.graphicalItemId:a=t.itemInteraction.click.graphicalItemId,a==null&&r!=null){var s=t.tooltipItemPayloads[0];return s!=null?[s]:[]}return t.tooltipItemPayloads.filter(o=>{var l;return((l=o.settings)===null||l===void 0?void 0:l.graphicalItemId)===a})},fte=t=>t.options.tooltipPayloadSearcher,kx=t=>t.tooltip;function L7(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),n.push.apply(n,r)}return n}function O7(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?L7(Object(n),!0).forEach(function(r){OOe(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):L7(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function OOe(t,e,n){return(e=IOe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function IOe(t){var e=zOe(t,"string");return typeof e=="symbol"?e:e+""}function zOe(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function UOe(t,e){return t??e}var gte=(t,e,n,r,a,s,o)=>{if(!(e==null||s==null)){var{chartData:l,computedData:c,dataStartIndex:d,dataEndIndex:u}=n,m=[];return t.reduce((p,f)=>{var y,{dataDefinedOnItem:x,settings:b}=f,v=UOe(x,l),_=Array.isArray(v)?ZZ(v,d,u):v,k=(y=b?.dataKey)!==null&&y!==void 0?y:r,P=b?.nameKey,C;if(r&&Array.isArray(_)&&!Array.isArray(_[0])&&o==="axis"?C=aZ(_,r,a):C=s(_,e,c,P),Array.isArray(C))C.forEach(N=>{var R=O7(O7({},b),{},{name:N.name,unit:N.unit,color:void 0,fill:void 0});p.push(Fq({tooltipEntrySettings:R,dataKey:N.dataKey,payload:N.payload,value:Tr(N.payload,N.dataKey),name:N.name}))});else{var T;p.push(Fq({tooltipEntrySettings:b,dataKey:k,payload:C,value:Tr(C,k),name:(T=Tr(C,P))!==null&&T!==void 0?T:b?.name}))}return p},m)}},i4=pt([Sa,Lee,MO],Kee),BOe=pt([t=>t.graphicalItems.cartesianItems,t=>t.graphicalItems.polarItems],(t,e)=>[...t,...e]),HOe=pt([Ia,wx],OO),Nx=pt([BOe,Sa,HOe],IO,{memoizeOptions:{resultEqualityCheck:dT}}),$Oe=pt([Nx],t=>t.filter(lT)),qOe=pt([Nx],zO,{memoizeOptions:{resultEqualityCheck:dT}}),Cx=pt([qOe,Nu],UO),VOe=pt([$Oe,Nu,Sa],jee),a4=pt([Cx,Sa,Nx],HO),bte=pt([Sa],$O),GOe=pt([Sa],t=>t.allowDataOverflow),xte=pt([bte,GOe],mee),WOe=pt([Nx],t=>t.filter(lT)),KOe=pt([VOe,WOe,J0,Nee],Uee),YOe=pt([KOe,Nu,Ia,xte],Bee),XOe=pt([Nx],Iee),QOe=pt([Cx,Sa,XOe,mT,Ia],GO,{memoizeOptions:{resultEqualityCheck:cT}}),ZOe=pt([Hee,Ia,wx],_x),JOe=pt([ZOe,Ia],Vee),e4e=pt([$ee,Ia,wx],_x),t4e=pt([e4e,Ia],Gee),n4e=pt([qee,Ia,wx],_x),r4e=pt([n4e,Ia],Wee),i4e=pt([JOe,r4e,t4e],Kk),a4e=pt([Sa,bte,xte,YOe,QOe,i4e,hr,Ia],WO),aw=pt([Sa,hr,Cx,a4,J0,Ia,a4e],KO),s4e=pt([aw,Sa,i4],QO),o4e=pt([Sa,aw,s4e,Ia],JO),yte=t=>{var e=Ia(t),n=wx(t),r=!1;return iw(t,e,n,r)},vte=pt([Sa,yte],iT),wte=pt([Sa,i4,o4e,vte],XO),l4e=pt([hr,a4,Sa,Ia],tte),c4e=pt([hr,a4,Sa,Ia],nte),d4e=(t,e,n,r,a,s,o,l)=>{if(e){var{type:c}=e,d=cc(t,l);if(r){var u=n==="scaleBand"&&r.bandwidth?r.bandwidth()/2:2,m=c==="category"&&r.bandwidth?r.bandwidth()/u:0;return m=l==="angleAxis"&&a!=null&&a?.length>=2?Ra(a[0]-a[1])*2*m:m,d&&o?o.map((p,f)=>{var y=r.map(p);return Ln(y)?{coordinate:y+m,value:p,index:f,offset:m}:null}).filter(ro):r.domain().map((p,f)=>{var y=r.map(p);return Ln(y)?{coordinate:y+m,value:s?s[p]:p,index:f,offset:m}:null}).filter(ro)}}},Cu=pt([hr,Sa,i4,wte,yte,l4e,c4e,Ia],d4e),s4=pt([ite,ate,yOe],(t,e,n)=>ste(n.shared,t,e)),Ste=t=>t.tooltip.settings.trigger,o4=t=>t.tooltip.settings.defaultIndex,sw=pt([kx,s4,Ste,o4],mte),ch=pt([sw,Cx,rw,aw],r4),_te=pt([Cu,ch],ote),l4=pt([sw],t=>{if(t)return t.dataKey}),u4e=pt([sw],t=>{if(t)return t.graphicalItemId}),kte=pt([kx,s4,Ste,o4],pte),m4e=pt([Su,_u,hr,ya,Cu,o4,kte],hte),h4e=pt([sw,m4e],(t,e)=>t!=null&&t.coordinate?t.coordinate:e),p4e=pt([sw],t=>{var e;return(e=t?.active)!==null&&e!==void 0?e:!1}),f4e=pt([kte,ch,Nu,rw,_te,fte,s4],gte),g4e=pt([f4e],t=>{if(t!=null){var e=t.map(n=>n.payload).filter(n=>n!=null);return Array.from(new Set(e))}});function I7(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),n.push.apply(n,r)}return n}function z7(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?I7(Object(n),!0).forEach(function(r){b4e(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):I7(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function b4e(t,e,n){return(e=x4e(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function x4e(t){var e=y4e(t,"string");return typeof e=="symbol"?e:e+""}function y4e(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var v4e=()=>Kt(Sa),w4e=()=>{var t=v4e(),e=Kt(Cu),n=Kt(wte);return lh(!t||!n?void 0:z7(z7({},t),{},{scale:n}),e)};function U7(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),n.push.apply(n,r)}return n}function Bg(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?U7(Object(n),!0).forEach(function(r){S4e(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):U7(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function S4e(t,e,n){return(e=_4e(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function _4e(t){var e=k4e(t,"string");return typeof e=="symbol"?e:e+""}function k4e(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var N4e=(t,e,n,r)=>{var a=e.find(s=>s&&s.index===n);if(a){if(t==="horizontal")return{x:a.coordinate,y:r.chartY};if(t==="vertical")return{x:r.chartX,y:a.coordinate}}return{x:0,y:0}},C4e=(t,e,n,r)=>{var a=e.find(d=>d&&d.index===n);if(a){if(t==="centric"){var s=a.coordinate,{radius:o}=r;return Bg(Bg(Bg({},r),ia(r.cx,r.cy,o,s)),{},{angle:s,radius:o})}var l=a.coordinate,{angle:c}=r;return Bg(Bg(Bg({},r),ia(r.cx,r.cy,l,c)),{},{angle:c,radius:l})}return{angle:0,clockWise:!1,cx:0,cy:0,endAngle:0,innerRadius:0,outerRadius:0,radius:0,startAngle:0,x:0,y:0}};function T4e(t,e){var{chartX:n,chartY:r}=t;return n>=e.left&&n<=e.left+e.width&&r>=e.top&&r<=e.top+e.height}var Nte=(t,e,n,r,a)=>{var s,o=(s=e?.length)!==null&&s!==void 0?s:0;if(o<=1||t==null)return 0;if(r==="angleAxis"&&a!=null&&Math.abs(Math.abs(a[1]-a[0])-360)<=1e-6)for(var l=0;l<o;l++){var c,d,u,m,p,f=l>0?(c=n[l-1])===null||c===void 0?void 0:c.coordinate:(d=n[o-1])===null||d===void 0?void 0:d.coordinate,y=(u=n[l])===null||u===void 0?void 0:u.coordinate,x=l>=o-1?(m=n[0])===null||m===void 0?void 0:m.coordinate:(p=n[l+1])===null||p===void 0?void 0:p.coordinate,b=void 0;if(!(f==null||y==null||x==null))if(Ra(y-f)!==Ra(x-y)){var v=[];if(Ra(x-y)===Ra(a[1]-a[0])){b=x;var _=y+a[1]-a[0];v[0]=Math.min(_,(_+f)/2),v[1]=Math.max(_,(_+f)/2)}else{b=f;var k=x+a[1]-a[0];v[0]=Math.min(y,(k+y)/2),v[1]=Math.max(y,(k+y)/2)}var P=[Math.min(y,(b+y)/2),Math.max(y,(b+y)/2)];if(t>P[0]&&t<=P[1]||t>=v[0]&&t<=v[1]){var C;return(C=n[l])===null||C===void 0?void 0:C.index}}else{var T=Math.min(f,x),N=Math.max(f,x);if(t>(T+y)/2&&t<=(N+y)/2){var R;return(R=n[l])===null||R===void 0?void 0:R.index}}}else if(e)for(var A=0;A<o;A++){var D=e[A];if(D!=null){var $=e[A+1],U=e[A-1];if(A===0&&$!=null&&t<=(D.coordinate+$.coordinate)/2||A===o-1&&U!=null&&t>(D.coordinate+U.coordinate)/2||A>0&&A<o-1&&U!=null&&$!=null&&t>(D.coordinate+U.coordinate)/2&&t<=(D.coordinate+$.coordinate)/2)return D.index}}return-1},Cte=()=>Kt(MO),c4=(t,e)=>e,Tte=(t,e,n)=>n,d4=(t,e,n,r)=>r,P4e=pt(Cu,t=>RC(t,e=>e.coordinate)),u4=pt([kx,c4,Tte,d4],mte),m4=pt([u4,Cx,rw,aw],r4),A4e=(t,e,n)=>{if(e!=null){var r=kx(t);return e==="axis"?n==="hover"?r.axisInteraction.hover.dataKey:r.axisInteraction.click.dataKey:n==="hover"?r.itemInteraction.hover.dataKey:r.itemInteraction.click.dataKey}},Pte=pt([kx,c4,Tte,d4],pte),Yk=pt([Su,_u,hr,ya,Cu,d4,Pte],hte),M4e=pt([u4,Yk],(t,e)=>{var n;return(n=t.coordinate)!==null&&n!==void 0?n:e}),Ate=pt([Cu,m4],ote),E4e=pt([Pte,m4,Nu,rw,Ate,fte,c4],gte),j4e=pt([u4,m4],(t,e)=>({isActive:t.active&&e!=null,activeIndex:e})),D4e=(t,e,n,r,a,s,o)=>{if(!(!t||!n||!r||!a)&&T4e(t,o)){var l=tje(t,e),c=Nte(l,s,a,n,r),d=N4e(e,a,c,t);return{activeIndex:String(c),activeCoordinate:d}}},R4e=(t,e,n,r,a,s,o)=>{if(!(!t||!r||!a||!s||!n)){var l=x3e(t,n);if(l){var c=nje(l,e),d=Nte(c,o,s,r,a),u=C4e(e,s,d,l);return{activeIndex:String(d),activeCoordinate:u}}}},F4e=(t,e,n,r,a,s,o,l)=>{if(!(!t||!e||!r||!a||!s))return e==="horizontal"||e==="vertical"?D4e(t,e,r,a,s,o,l):R4e(t,e,n,r,a,s,o)},L4e=pt(t=>t.zIndex.zIndexMap,(t,e)=>e,(t,e,n)=>n,(t,e,n)=>{if(e!=null){var r=t[e];if(r!=null)return n?r.panoramaElement:r.element}}),O4e=pt(t=>t.zIndex.zIndexMap,t=>{var e=Object.keys(t).map(r=>parseInt(r,10)).concat(Object.values(Oi)),n=Array.from(new Set(e));return n.sort((r,a)=>r-a)},{memoizeOptions:{resultEqualityCheck:xLe}});function B7(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),n.push.apply(n,r)}return n}function H7(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?B7(Object(n),!0).forEach(function(r){I4e(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):B7(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function I4e(t,e,n){return(e=z4e(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function z4e(t){var e=U4e(t,"string");return typeof e=="symbol"?e:e+""}function U4e(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var B4e={},H4e={zIndexMap:Object.values(Oi).reduce((t,e)=>H7(H7({},t),{},{[e]:{element:void 0,panoramaElement:void 0,consumers:0}}),B4e)},$4e=new Set(Object.values(Oi));function q4e(t){return $4e.has(t)}var Mte=ho({name:"zIndex",initialState:H4e,reducers:{registerZIndexPortal:{reducer:(t,e)=>{var{zIndex:n}=e.payload;t.zIndexMap[n]?t.zIndexMap[n].consumers+=1:t.zIndexMap[n]={consumers:1,element:void 0,panoramaElement:void 0}},prepare:ui()},unregisterZIndexPortal:{reducer:(t,e)=>{var{zIndex:n}=e.payload;t.zIndexMap[n]&&(t.zIndexMap[n].consumers-=1,t.zIndexMap[n].consumers<=0&&!q4e(n)&&delete t.zIndexMap[n])},prepare:ui()},registerZIndexPortalElement:{reducer:(t,e)=>{var{zIndex:n,element:r,isPanorama:a}=e.payload;t.zIndexMap[n]?a?t.zIndexMap[n].panoramaElement=r:t.zIndexMap[n].element=r:t.zIndexMap[n]={consumers:0,element:a?void 0:r,panoramaElement:a?r:void 0}},prepare:ui()},unregisterZIndexPortalElement:{reducer:(t,e)=>{var{zIndex:n}=e.payload;t.zIndexMap[n]&&(e.payload.isPanorama?t.zIndexMap[n].panoramaElement=void 0:t.zIndexMap[n].element=void 0)},prepare:ui()}}}),{registerZIndexPortal:V4e,unregisterZIndexPortal:G4e,registerZIndexPortalElement:W4e,unregisterZIndexPortalElement:K4e}=Mte.actions,Y4e=Mte.reducer;function vs(t){var{zIndex:e,children:n}=t,r=Dje(),a=r&&e!==void 0&&e!==0,s=va(),o=Zr();w.useLayoutEffect(()=>a?(o(V4e({zIndex:e})),()=>{o(G4e({zIndex:e}))}):hh,[o,e,a]);var l=Kt(c=>L4e(c,e,s));return a?l?$d.createPortal(n,l):null:n}function NR(){return NR=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},NR.apply(null,arguments)}function $7(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),n.push.apply(n,r)}return n}function I_(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?$7(Object(n),!0).forEach(function(r){X4e(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):$7(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function X4e(t,e,n){return(e=Q4e(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Q4e(t){var e=Z4e(t,"string");return typeof e=="symbol"?e:e+""}function Z4e(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function J4e(t){var{cursor:e,cursorComp:n,cursorProps:r}=t;return w.isValidElement(e)?w.cloneElement(e,r):w.createElement(n,r)}function eIe(t){var e,{coordinate:n,payload:r,index:a,offset:s,tooltipAxisBandSize:o,layout:l,cursor:c,tooltipEventType:d,chartName:u}=t,m=n,p=r,f=a;if(!c||!m||u!=="ScatterChart"&&d!=="axis")return null;var y,x,b;if(u==="ScatterChart")y=m,x=jDe,b=Oi.cursorLine;else if(u==="BarChart")y=DDe(l,m,s,o),x=CJ,b=Oi.cursorRectangle;else if(l==="radial"&&oZ(m)){var{cx:v,cy:_,radius:k,startAngle:P,endAngle:C}=PJ(m);y={cx:v,cy:_,startAngle:P,endAngle:C,innerRadius:k,outerRadius:k},x=MJ,b=Oi.cursorLine}else y={points:S3e(l,m,s)},x=Sb,b=Oi.cursorLine;var T=typeof c=="object"&&"className"in c?c.className:void 0,N=I_(I_(I_(I_({stroke:"#ccc",pointerEvents:"none"},s),y),Jp(c)),{},{payload:p,payloadIndex:f,className:pr("recharts-tooltip-cursor",T)});return w.createElement(vs,{zIndex:(e=t.zIndex)!==null&&e!==void 0?e:b},w.createElement(J4e,{cursor:c,cursorComp:x,cursorProps:N}))}function tIe(t){var e=w4e(),n=lJ(),r=fh(),a=Cte();return e==null||n==null||r==null||a==null?null:w.createElement(eIe,NR({},t,{offset:n,layout:r,tooltipAxisBandSize:e,chartName:a}))}var Ete=w.createContext(null),nIe=()=>w.useContext(Ete),HE={exports:{}},q7;function rIe(){return q7||(q7=1,(function(t){var e=Object.prototype.hasOwnProperty,n="~";function r(){}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(n=!1));function a(c,d,u){this.fn=c,this.context=d,this.once=u||!1}function s(c,d,u,m,p){if(typeof u!="function")throw new TypeError("The listener must be a function");var f=new a(u,m||c,p),y=n?n+d:d;return c._events[y]?c._events[y].fn?c._events[y]=[c._events[y],f]:c._events[y].push(f):(c._events[y]=f,c._eventsCount++),c}function o(c,d){--c._eventsCount===0?c._events=new r:delete c._events[d]}function l(){this._events=new r,this._eventsCount=0}l.prototype.eventNames=function(){var d=[],u,m;if(this._eventsCount===0)return d;for(m in u=this._events)e.call(u,m)&&d.push(n?m.slice(1):m);return Object.getOwnPropertySymbols?d.concat(Object.getOwnPropertySymbols(u)):d},l.prototype.listeners=function(d){var u=n?n+d:d,m=this._events[u];if(!m)return[];if(m.fn)return[m.fn];for(var p=0,f=m.length,y=new Array(f);p<f;p++)y[p]=m[p].fn;return y},l.prototype.listenerCount=function(d){var u=n?n+d:d,m=this._events[u];return m?m.fn?1:m.length:0},l.prototype.emit=function(d,u,m,p,f,y){var x=n?n+d:d;if(!this._events[x])return!1;var b=this._events[x],v=arguments.length,_,k;if(b.fn){switch(b.once&&this.removeListener(d,b.fn,void 0,!0),v){case 1:return b.fn.call(b.context),!0;case 2:return b.fn.call(b.context,u),!0;case 3:return b.fn.call(b.context,u,m),!0;case 4:return b.fn.call(b.context,u,m,p),!0;case 5:return b.fn.call(b.context,u,m,p,f),!0;case 6:return b.fn.call(b.context,u,m,p,f,y),!0}for(k=1,_=new Array(v-1);k<v;k++)_[k-1]=arguments[k];b.fn.apply(b.context,_)}else{var P=b.length,C;for(k=0;k<P;k++)switch(b[k].once&&this.removeListener(d,b[k].fn,void 0,!0),v){case 1:b[k].fn.call(b[k].context);break;case 2:b[k].fn.call(b[k].context,u);break;case 3:b[k].fn.call(b[k].context,u,m);break;case 4:b[k].fn.call(b[k].context,u,m,p);break;default:if(!_)for(C=1,_=new Array(v-1);C<v;C++)_[C-1]=arguments[C];b[k].fn.apply(b[k].context,_)}}return!0},l.prototype.on=function(d,u,m){return s(this,d,u,m,!1)},l.prototype.once=function(d,u,m){return s(this,d,u,m,!0)},l.prototype.removeListener=function(d,u,m,p){var f=n?n+d:d;if(!this._events[f])return this;if(!u)return o(this,f),this;var y=this._events[f];if(y.fn)y.fn===u&&(!p||y.once)&&(!m||y.context===m)&&o(this,f);else{for(var x=0,b=[],v=y.length;x<v;x++)(y[x].fn!==u||p&&!y[x].once||m&&y[x].context!==m)&&b.push(y[x]);b.length?this._events[f]=b.length===1?b[0]:b:o(this,f)}return this},l.prototype.removeAllListeners=function(d){var u;return d?(u=n?n+d:d,this._events[u]&&o(this,u)):(this._events=new r,this._eventsCount=0),this},l.prototype.off=l.prototype.removeListener,l.prototype.addListener=l.prototype.on,l.prefixed=n,l.EventEmitter=l,t.exports=l})(HE)),HE.exports}var iIe=rIe();const aIe=Pl(iIe);var d0=new aIe,CR="recharts.syncEvent.tooltip",V7="recharts.syncEvent.brush",fT=(t,e)=>{if(e&&Array.isArray(t)){var n=Number.parseInt(e,10);if(!ic(n))return t[n]}},sIe={chartName:"",tooltipPayloadSearcher:()=>{},eventEmitter:void 0,defaultTooltipEventType:"axis"},jte=ho({name:"options",initialState:sIe,reducers:{createEventEmitter:t=>{t.eventEmitter==null&&(t.eventEmitter=Symbol("rechartsEventEmitter"))}}}),oIe=jte.reducer,{createEventEmitter:lIe}=jte.actions;function cIe(t){return t.tooltip.syncInteraction}var dIe={chartData:void 0,computedData:void 0,dataStartIndex:0,dataEndIndex:0},Dte=ho({name:"chartData",initialState:dIe,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:r}=e.payload;n!=null&&(t.dataStartIndex=n),r!=null&&(t.dataEndIndex=r)}}}),{setChartData:G7,setDataStartEndIndexes:uIe,setComputedData:lrt}=Dte.actions,mIe=Dte.reducer,hIe=["x","y"];function W7(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),n.push.apply(n,r)}return n}function Hg(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?W7(Object(n),!0).forEach(function(r){pIe(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):W7(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function pIe(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=gIe(t,"string");return typeof e=="symbol"?e:e+""}function gIe(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function bIe(t,e){if(t==null)return{};var n,r,a=xIe(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(r=0;r<s.length;r++)n=s[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(a[n]=t[n])}return a}function xIe(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}function yIe(){var t=Kt(EO),e=Kt(jO),n=Zr(),r=Kt(Cee),a=Kt(Cu),s=fh(),o=V0(),l=Kt(c=>c.rootProps.className);w.useEffect(()=>{if(t==null)return hh;var c=(d,u,m)=>{if(e!==m&&t===d){if(r==="index"){var p;if(o&&u!==null&&u!==void 0&&(p=u.payload)!==null&&p!==void 0&&p.coordinate&&u.payload.sourceViewBox){var f=u.payload.coordinate,{x:y,y:x}=f,b=bIe(f,hIe),{x:v,y:_,width:k,height:P}=u.payload.sourceViewBox,C=Hg(Hg({},b),{},{x:o.x+(k?(y-v)/k:0)*o.width,y:o.y+(P?(x-_)/P:0)*o.height});n(Hg(Hg({},u),{},{payload:Hg(Hg({},u.payload),{},{coordinate:C})}))}else n(u);return}if(a!=null){var T;if(typeof r=="function"){var N={activeTooltipIndex:u.payload.index==null?void 0:Number(u.payload.index),isTooltipActive:u.payload.active,activeIndex:u.payload.index==null?void 0:Number(u.payload.index),activeLabel:u.payload.label,activeDataKey:u.payload.dataKey,activeCoordinate:u.payload.coordinate},R=r(a,N);T=a[R]}else r==="value"&&(T=a.find(re=>String(re.value)===u.payload.label));var{coordinate:A}=u.payload;if(T==null||u.payload.active===!1||A==null||o==null){n(_R({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:void 0,graphicalItemId:void 0}));return}var{x:D,y:$}=A,U=Math.min(D,o.x+o.width),G=Math.min($,o.y+o.height),L={x:s==="horizontal"?T.coordinate:U,y:s==="horizontal"?G:T.coordinate},te=_R({active:u.payload.active,coordinate:L,dataKey:u.payload.dataKey,index:String(T.index),label:u.payload.label,sourceViewBox:u.payload.sourceViewBox,graphicalItemId:u.payload.graphicalItemId});n(te)}}};return d0.on(CR,c),()=>{d0.off(CR,c)}},[l,n,e,t,r,a,s,o])}function vIe(){var t=Kt(EO),e=Kt(jO),n=Zr();w.useEffect(()=>{if(t==null)return hh;var r=(a,s,o)=>{e!==o&&t===a&&n(uIe(s))};return d0.on(V7,r),()=>{d0.off(V7,r)}},[n,e,t])}function wIe(){var t=Zr();w.useEffect(()=>{t(lIe())},[t]),yIe(),vIe()}function SIe(t,e,n,r,a,s){var o=Kt(f=>A4e(f,t,e)),l=Kt(jO),c=Kt(EO),d=Kt(Cee),u=Kt(cIe),m=u?.active,p=V0();w.useEffect(()=>{if(!m&&c!=null&&l!=null){var f=_R({active:s,coordinate:n,dataKey:o,index:a,label:typeof r=="number"?String(r):r,sourceViewBox:p,graphicalItemId:void 0});d0.emit(CR,c,f,l)}},[m,n,o,a,r,l,c,d,s,p])}function K7(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),n.push.apply(n,r)}return n}function Y7(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?K7(Object(n),!0).forEach(function(r){_Ie(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):K7(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function _Ie(t,e,n){return(e=kIe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function kIe(t){var e=NIe(t,"string");return typeof e=="symbol"?e:e+""}function NIe(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function CIe(t){return t.dataKey}function TIe(t,e){return w.isValidElement(t)?w.cloneElement(t,e):typeof t=="function"?w.createElement(t,e):w.createElement(uDe,e)}var X7=[],PIe={allowEscapeViewBox:{x:!1,y:!1},animationDuration:400,animationEasing:"ease",axisId:0,contentStyle:{},cursor:!0,filterNull:!0,includeHidden:!1,isAnimationActive:"auto",itemSorter:"name",itemStyle:{},labelStyle:{},offset:10,reverseDirection:{x:!1,y:!1},separator:" : ",trigger:"hover",useTranslate3d:!1,wrapperStyle:{}};function Lm(t){var e,n,r=ki(t,PIe),{active:a,allowEscapeViewBox:s,animationDuration:o,animationEasing:l,content:c,filterNull:d,isAnimationActive:u,offset:m,payloadUniqBy:p,position:f,reverseDirection:y,useTranslate3d:x,wrapperStyle:b,cursor:v,shared:_,trigger:k,defaultIndex:P,portal:C,axisId:T}=r,N=Zr(),R=typeof P=="number"?String(P):P;w.useEffect(()=>{N(kOe({shared:_,trigger:k,axisId:T,active:a,defaultIndex:R}))},[N,_,k,T,a,R]);var A=V0(),D=wJ(),$=xOe(_),{activeIndex:U,isActive:G}=(e=Kt(Z=>j4e(Z,$,k,R)))!==null&&e!==void 0?e:{},L=Kt(Z=>E4e(Z,$,k,R)),te=Kt(Z=>Ate(Z,$,k,R)),re=Kt(Z=>M4e(Z,$,k,R)),J=L,ue=nIe(),me=(n=a??G)!==null&&n!==void 0?n:!1,[ge,X]=SZ([J,me]),ie=$==="axis"?te:void 0;SIe($,k,re,ie,U,me);var le=C??ue;if(le==null||A==null||$==null)return null;var pe=J??X7;me||(pe=X7),d&&pe.length&&(pe=gZ(pe.filter(Z=>Z.value!=null&&(Z.hide!==!0||r.includeHidden)),p,CIe));var Ce=pe.length>0,q=w.createElement(xDe,{allowEscapeViewBox:s,animationDuration:o,animationEasing:l,isAnimationActive:u,active:me,coordinate:re,hasPayload:Ce,offset:m,position:f,reverseDirection:y,useTranslate3d:x,viewBox:A,wrapperStyle:b,lastBoundingBox:ge,innerRef:X,hasPortalFromProps:!!C},TIe(c,Y7(Y7({},r),{},{payload:pe,label:ie,active:me,activeIndex:U,coordinate:re,accessibilityLayer:D})));return w.createElement(w.Fragment,null,$d.createPortal(q,le),me&&w.createElement(tIe,{cursor:v,tooltipEventType:$,coordinate:re,payload:pe,index:U}))}var Yb=t=>null;Yb.displayName="Cell";function AIe(t,e,n){return(e=MIe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function MIe(t){var e=EIe(t,"string");return typeof e=="symbol"?e:e+""}function EIe(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}class jIe{constructor(e){AIe(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 r=this.cache.keys().next().value;r!=null&&this.cache.delete(r)}this.cache.set(e,n)}clear(){this.cache.clear()}size(){return this.cache.size}}function Q7(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),n.push.apply(n,r)}return n}function DIe(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Q7(Object(n),!0).forEach(function(r){RIe(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Q7(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function RIe(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=LIe(t,"string");return typeof e=="symbol"?e:e+""}function LIe(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var OIe={cacheSize:2e3,enableCache:!0},Rte=DIe({},OIe),Z7=new jIe(Rte.cacheSize),IIe={position:"absolute",top:"-20000px",left:0,padding:0,margin:0,border:"none",whiteSpace:"pre"},J7="recharts_measurement_span";function zIe(t,e){var n=e.fontSize||"",r=e.fontFamily||"",a=e.fontWeight||"",s=e.fontStyle||"",o=e.letterSpacing||"",l=e.textTransform||"";return"".concat(t,"|").concat(n,"|").concat(r,"|").concat(a,"|").concat(s,"|").concat(o,"|").concat(l)}var e9=(t,e)=>{try{var n=document.getElementById(J7);n||(n=document.createElement("span"),n.setAttribute("id",J7),n.setAttribute("aria-hidden","true"),document.body.appendChild(n)),Object.assign(n.style,IIe,e),n.textContent="".concat(t);var r=n.getBoundingClientRect();return{width:r.width,height:r.height}}catch{return{width:0,height:0}}},mv=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(e==null||K0.isSsr)return{width:0,height:0};if(!Rte.enableCache)return e9(e,n);var r=zIe(e,n),a=Z7.get(r);if(a)return a;var s=e9(e,n);return Z7.set(r,s),s},Fte;function UIe(t,e,n){return(e=BIe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function BIe(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 r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var t9=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([*/])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,n9=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([+-])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,$Ie=/^px|cm|vh|vw|em|rem|%|mm|in|pt|pc|ex|ch|vmin|vmax|Q$/,qIe=/(-?\d+(?:\.\d+)?)([a-zA-Z%]+)?/,VIe={cm:96/2.54,mm:96/25.4,pt:96/72,pc:96/6,in:96,Q:96/(2.54*40),px:1},GIe=["cm","mm","pt","pc","in","Q","px"];function WIe(t){return GIe.includes(t)}var lb="NaN";function KIe(t,e){return t*VIe[e]}class Ya{static parse(e){var n,[,r,a]=(n=qIe.exec(e))!==null&&n!==void 0?n:[];return r==null?Ya.NaN:new Ya(parseFloat(r),a??"")}constructor(e,n){this.num=e,this.unit=n,this.num=e,this.unit=n,ic(e)&&(this.unit=""),n!==""&&!$Ie.test(n)&&(this.num=NaN,this.unit=""),WIe(n)&&(this.num=KIe(e,n),this.unit="px")}add(e){return this.unit!==e.unit?new Ya(NaN,""):new Ya(this.num+e.num,this.unit)}subtract(e){return this.unit!==e.unit?new Ya(NaN,""):new Ya(this.num-e.num,this.unit)}multiply(e){return this.unit!==""&&e.unit!==""&&this.unit!==e.unit?new Ya(NaN,""):new Ya(this.num*e.num,this.unit||e.unit)}divide(e){return this.unit!==""&&e.unit!==""&&this.unit!==e.unit?new Ya(NaN,""):new Ya(this.num/e.num,this.unit||e.unit)}toString(){return"".concat(this.num).concat(this.unit)}isNaN(){return ic(this.num)}}Fte=Ya;UIe(Ya,"NaN",new Fte(NaN,""));function Lte(t){if(t==null||t.includes(lb))return lb;for(var e=t;e.includes("*")||e.includes("/");){var n,[,r,a,s]=(n=t9.exec(e))!==null&&n!==void 0?n:[],o=Ya.parse(r??""),l=Ya.parse(s??""),c=a==="*"?o.multiply(l):o.divide(l);if(c.isNaN())return lb;e=e.replace(t9,c.toString())}for(;e.includes("+")||/.-\d+(?:\.\d+)?/.test(e);){var d,[,u,m,p]=(d=n9.exec(e))!==null&&d!==void 0?d:[],f=Ya.parse(u??""),y=Ya.parse(p??""),x=m==="+"?f.add(y):f.subtract(y);if(x.isNaN())return lb;e=e.replace(n9,x.toString())}return e}var r9=/\(([^()]*)\)/;function YIe(t){for(var e=t,n;(n=r9.exec(e))!=null;){var[,r]=n;e=e.replace(r9,Lte(r))}return e}function XIe(t){var e=t.replace(/\s+/g,"");return e=YIe(e),e=Lte(e),e}function QIe(t){try{return XIe(t)}catch{return lb}}function $E(t){var e=QIe(t.slice(5,-1));return e===lb?"":e}var ZIe=["x","y","lineHeight","capHeight","fill","scaleToFit","textAnchor","verticalAnchor"],JIe=["dx","dy","angle","className","breakAll"];function TR(){return TR=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},TR.apply(null,arguments)}function i9(t,e){if(t==null)return{};var n,r,a=e5e(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(r=0;r<s.length;r++)n=s[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(a[n]=t[n])}return a}function e5e(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}var Ote=/[ \f\n\r\t\v\u2028\u2029]+/,Ite=t=>{var{children:e,breakAll:n,style:r}=t;try{var a=[];fi(e)||(n?a=e.toString().split(""):a=e.toString().split(Ote));var s=a.map(l=>({word:l,width:mv(l,r).width})),o=n?0:mv(" ",r).width;return{wordsWithComputedWidth:s,spaceWidth:o}}catch{return null}};function t5e(t){return t==="start"||t==="middle"||t==="end"||t==="inherit"}var zte=(t,e,n,r)=>t.reduce((a,s)=>{var{word:o,width:l}=s,c=a[a.length-1];if(c&&l!=null&&(e==null||r||c.width+l+n<Number(e)))c.words.push(o),c.width+=l+n;else{var d={words:[o],width:l};a.push(d)}return a},[]),Ute=t=>t.reduce((e,n)=>e.width>n.width?e:n),n5e="…",a9=(t,e,n,r,a,s,o,l)=>{var c=t.slice(0,e),d=Ite({breakAll:n,style:r,children:c+n5e});if(!d)return[!1,[]];var u=zte(d.wordsWithComputedWidth,s,o,l),m=u.length>a||Ute(u).width>Number(s);return[m,u]},r5e=(t,e,n,r,a)=>{var{maxLines:s,children:o,style:l,breakAll:c}=t,d=Gt(s),u=String(o),m=zte(e,r,n,a);if(!d||a)return m;var p=m.length>s||Ute(m).width>Number(r);if(!p)return m;for(var f=0,y=u.length-1,x=0,b;f<=y&&x<=u.length-1;){var v=Math.floor((f+y)/2),_=v-1,[k,P]=a9(u,_,c,l,s,r,n,a),[C]=a9(u,v,c,l,s,r,n,a);if(!k&&!C&&(f=v+1),k&&C&&(y=v-1),!k&&C){b=P;break}x++}return b||m},s9=t=>{var e=fi(t)?[]:t.toString().split(Ote);return[{words:e,width:void 0}]},i5e=t=>{var{width:e,scaleToFit:n,children:r,style:a,breakAll:s,maxLines:o}=t;if((e||n)&&!K0.isSsr){var l,c,d=Ite({breakAll:s,children:r,style:a});if(d){var{wordsWithComputedWidth:u,spaceWidth:m}=d;l=u,c=m}else return s9(r);return r5e({breakAll:s,children:r,maxLines:o,style:a},l,c,e,!!n)}return s9(r)},Bte="#808080",a5e={angle:0,breakAll:!1,capHeight:"0.71em",fill:Bte,lineHeight:"1em",scaleToFit:!1,textAnchor:"start",verticalAnchor:"end",x:0,y:0},gT=w.forwardRef((t,e)=>{var n=ki(t,a5e),{x:r,y:a,lineHeight:s,capHeight:o,fill:l,scaleToFit:c,textAnchor:d,verticalAnchor:u}=n,m=i9(n,ZIe),p=w.useMemo(()=>i5e({breakAll:m.breakAll,children:m.children,maxLines:m.maxLines,scaleToFit:c,style:m.style,width:m.width}),[m.breakAll,m.children,m.maxLines,c,m.style,m.width]),{dx:f,dy:y,angle:x,className:b,breakAll:v}=m,_=i9(m,JIe);if(!Nl(r)||!Nl(a)||p.length===0)return null;var k=Number(r)+(Gt(f)?f:0),P=Number(a)+(Gt(y)?y:0);if(!Ln(k)||!Ln(P))return null;var C;switch(u){case"start":C=$E("calc(".concat(o,")"));break;case"middle":C=$E("calc(".concat((p.length-1)/2," * -").concat(s," + (").concat(o," / 2))"));break;default:C=$E("calc(".concat(p.length-1," * -").concat(s,")"));break}var T=[],N=p[0];if(c&&N!=null){var R=N.width,{width:A}=m;T.push("scale(".concat(Gt(A)&&Gt(R)?A/R:1,")"))}return x&&T.push("rotate(".concat(x,", ").concat(k,", ").concat(P,")")),T.length&&(_.transform=T.join(" ")),w.createElement("text",TR({},ns(_),{ref:e,x:k,y:P,className:pr("recharts-text",b),textAnchor:d,fill:l.includes("url")?Bte:l}),p.map((D,$)=>{var U=D.words.join(v?"":" ");return w.createElement("tspan",{x:k,dy:$===0?C:s,key:"".concat(U,"-").concat($)},U)}))});gT.displayName="Text";function o9(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),n.push.apply(n,r)}return n}function _c(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?o9(Object(n),!0).forEach(function(r){s5e(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):o9(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function s5e(t,e,n){return(e=o5e(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function o5e(t){var e=l5e(t,"string");return typeof e=="symbol"?e:e+""}function l5e(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var c5e=t=>{var{viewBox:e,position:n,offset:r=0,parentViewBox:a}=t,{x:s,y:o,height:l,upperWidth:c,lowerWidth:d}=ZL(e),u=s,m=s+(c-d)/2,p=(u+m)/2,f=(c+d)/2,y=u+c/2,x=l>=0?1:-1,b=x*r,v=x>0?"end":"start",_=x>0?"start":"end",k=c>=0?1:-1,P=k*r,C=k>0?"end":"start",T=k>0?"start":"end",N=a;if(n==="top"){var R={x:u+c/2,y:o-b,horizontalAnchor:"middle",verticalAnchor:v};return N&&(R.height=Math.max(o-N.y,0),R.width=c),R}if(n==="bottom"){var A={x:m+d/2,y:o+l+b,horizontalAnchor:"middle",verticalAnchor:_};return N&&(A.height=Math.max(N.y+N.height-(o+l),0),A.width=d),A}if(n==="left"){var D={x:p-P,y:o+l/2,horizontalAnchor:C,verticalAnchor:"middle"};return N&&(D.width=Math.max(D.x-N.x,0),D.height=l),D}if(n==="right"){var $={x:p+f+P,y:o+l/2,horizontalAnchor:T,verticalAnchor:"middle"};return N&&($.width=Math.max(N.x+N.width-$.x,0),$.height=l),$}var U=N?{width:f,height:l}:{};return n==="insideLeft"?_c({x:p+P,y:o+l/2,horizontalAnchor:T,verticalAnchor:"middle"},U):n==="insideRight"?_c({x:p+f-P,y:o+l/2,horizontalAnchor:C,verticalAnchor:"middle"},U):n==="insideTop"?_c({x:u+c/2,y:o+b,horizontalAnchor:"middle",verticalAnchor:_},U):n==="insideBottom"?_c({x:m+d/2,y:o+l-b,horizontalAnchor:"middle",verticalAnchor:v},U):n==="insideTopLeft"?_c({x:u+P,y:o+b,horizontalAnchor:T,verticalAnchor:_},U):n==="insideTopRight"?_c({x:u+c-P,y:o+b,horizontalAnchor:C,verticalAnchor:_},U):n==="insideBottomLeft"?_c({x:m+P,y:o+l-b,horizontalAnchor:T,verticalAnchor:v},U):n==="insideBottomRight"?_c({x:m+d-P,y:o+l-b,horizontalAnchor:C,verticalAnchor:v},U):n&&typeof n=="object"&&(Gt(n.x)||nf(n.x))&&(Gt(n.y)||nf(n.y))?_c({x:s+bs(n.x,f),y:o+bs(n.y,l),horizontalAnchor:"end",verticalAnchor:"end"},U):_c({x:y,y:o+l/2,horizontalAnchor:"middle",verticalAnchor:"middle"},U)},d5e=["labelRef"],u5e=["content"];function l9(t,e){if(t==null)return{};var n,r,a=m5e(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(r=0;r<s.length;r++)n=s[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(a[n]=t[n])}return a}function m5e(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}function c9(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),n.push.apply(n,r)}return n}function Xy(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?c9(Object(n),!0).forEach(function(r){h5e(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):c9(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function h5e(t,e,n){return(e=p5e(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function p5e(t){var e=f5e(t,"string");return typeof e=="symbol"?e:e+""}function f5e(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Hd(){return Hd=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Hd.apply(null,arguments)}var Hte=w.createContext(null),$te=t=>{var{x:e,y:n,upperWidth:r,lowerWidth:a,width:s,height:o,children:l}=t,c=w.useMemo(()=>({x:e,y:n,upperWidth:r,lowerWidth:a,width:s,height:o}),[e,n,r,a,s,o]);return w.createElement(Hte.Provider,{value:c},l)},qte=()=>{var t=w.useContext(Hte),e=V0();return t||(e?ZL(e):void 0)},g5e=w.createContext(null),b5e=()=>{var t=w.useContext(g5e),e=Kt(Eee);return t||e},x5e=t=>{var{value:e,formatter:n}=t,r=fi(t.children)?e:t.children;return typeof n=="function"?n(r):r},h4=t=>t!=null&&typeof t=="function",y5e=(t,e)=>{var n=Ra(e-t),r=Math.min(Math.abs(e-t),360);return n*r},v5e=(t,e,n,r,a)=>{var{offset:s,className:o}=t,{cx:l,cy:c,innerRadius:d,outerRadius:u,startAngle:m,endAngle:p,clockWise:f}=a,y=(d+u)/2,x=y5e(m,p),b=x>=0?1:-1,v,_;switch(e){case"insideStart":v=m+b*s,_=f;break;case"insideEnd":v=p-b*s,_=!f;break;case"end":v=p+b*s,_=f;break;default:throw new Error("Unsupported position ".concat(e))}_=x<=0?_:!_;var k=ia(l,c,y,v),P=ia(l,c,y,v+(_?1:-1)*359),C="M".concat(k.x,",").concat(k.y,`
- A`).concat(y,",").concat(y,",0,1,").concat(_?0:1,`,
- `).concat(P.x,",").concat(P.y),T=fi(t.id)?Qv("recharts-radial-line-"):t.id;return w.createElement("text",Hd({},r,{dominantBaseline:"central",className:pr("recharts-radial-bar-label",o)}),w.createElement("defs",null,w.createElement("path",{id:T,d:C})),w.createElement("textPath",{xlinkHref:"#".concat(T)},n))},w5e=(t,e,n)=>{var{cx:r,cy:a,innerRadius:s,outerRadius:o,startAngle:l,endAngle:c}=t,d=(l+c)/2;if(n==="outside"){var{x:u,y:m}=ia(r,a,o+e,d);return{x:u,y:m,textAnchor:u>=r?"start":"end",verticalAnchor:"middle"}}if(n==="center")return{x:r,y:a,textAnchor:"middle",verticalAnchor:"middle"};if(n==="centerTop")return{x:r,y:a,textAnchor:"middle",verticalAnchor:"start"};if(n==="centerBottom")return{x:r,y:a,textAnchor:"middle",verticalAnchor:"end"};var p=(s+o)/2,{x:f,y}=ia(r,a,p,d);return{x:f,y,textAnchor:"middle",verticalAnchor:"middle"}},k1=t=>t!=null&&"cx"in t&&Gt(t.cx),S5e={angle:0,offset:5,zIndex:Oi.label,position:"middle",textBreakAll:!1};function _5e(t){if(!k1(t))return t;var{cx:e,cy:n,outerRadius:r}=t,a=r*2;return{x:e-r,y:n-r,width:a,upperWidth:a,lowerWidth:a,height:a}}function bm(t){var e=ki(t,S5e),{viewBox:n,parentViewBox:r,position:a,value:s,children:o,content:l,className:c="",textBreakAll:d,labelRef:u}=e,m=b5e(),p=qte(),f=a==="center"?p:m??p,y,x,b;n==null?y=f:k1(n)?y=n:y=ZL(n);var v=_5e(y);if(!y||fi(s)&&fi(o)&&!w.isValidElement(l)&&typeof l!="function")return null;var _=Xy(Xy({},e),{},{viewBox:y});if(w.isValidElement(l)){var{labelRef:k}=_,P=l9(_,d5e);return w.cloneElement(l,P)}if(typeof l=="function"){var{content:C}=_,T=l9(_,u5e);if(x=w.createElement(l,T),w.isValidElement(x))return x}else x=x5e(e);var N=ns(e);if(k1(y)){if(a==="insideStart"||a==="insideEnd"||a==="end")return v5e(e,a,x,N,y);b=w5e(y,e.offset,e.position)}else{if(!v)return null;var R=c5e({viewBox:v,position:a,offset:e.offset,parentViewBox:k1(r)?void 0:r});b=Xy(Xy({x:R.x,y:R.y,textAnchor:R.horizontalAnchor,verticalAnchor:R.verticalAnchor},R.width!==void 0?{width:R.width}:{}),R.height!==void 0?{height:R.height}:{})}return w.createElement(vs,{zIndex:e.zIndex},w.createElement(gT,Hd({ref:u,className:pr("recharts-label",c)},N,b,{textAnchor:t5e(N.textAnchor)?N.textAnchor:b.textAnchor,breakAll:d}),x))}bm.displayName="Label";var k5e=(t,e,n)=>{if(!t)return null;var r={viewBox:e,labelRef:n};return t===!0?w.createElement(bm,Hd({key:"label-implicit"},r)):Nl(t)?w.createElement(bm,Hd({key:"label-implicit",value:t},r)):w.isValidElement(t)?t.type===bm?w.cloneElement(t,Xy({key:"label-implicit"},r)):w.createElement(bm,Hd({key:"label-implicit",content:t},r)):h4(t)?w.createElement(bm,Hd({key:"label-implicit",content:t},r)):t&&typeof t=="object"?w.createElement(bm,Hd({},t,{key:"label-implicit"},r)):null};function Vte(t){var{label:e,labelRef:n}=t,r=qte();return k5e(e,r,n)||null}var qE={},VE={},d9;function N5e(){return d9||(d9=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function e(n){return n[n.length-1]}t.last=e})(VE)),VE}var GE={},u9;function C5e(){return u9||(u9=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function e(n){return Array.isArray(n)?n:Array.from(n)}t.toArray=e})(GE)),GE}var m9;function T5e(){return m9||(m9=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=N5e(),n=C5e(),r=BL();function a(s){if(r.isArrayLike(s))return e.last(n.toArray(s))}t.last=a})(qE)),qE}var WE,h9;function P5e(){return h9||(h9=1,WE=T5e().last),WE}var A5e=P5e();const M5e=Pl(A5e);var E5e=["valueAccessor"],j5e=["dataKey","clockWise","id","textBreakAll","zIndex"];function Xk(){return Xk=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Xk.apply(null,arguments)}function p9(t,e){if(t==null)return{};var n,r,a=D5e(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(r=0;r<s.length;r++)n=s[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(a[n]=t[n])}return a}function D5e(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}var R5e=t=>Array.isArray(t.value)?M5e(t.value):t.value,Gte=w.createContext(void 0),p4=Gte.Provider,Wte=w.createContext(void 0),F5e=Wte.Provider;function L5e(){return w.useContext(Gte)}function O5e(){return w.useContext(Wte)}function N1(t){var{valueAccessor:e=R5e}=t,n=p9(t,E5e),{dataKey:r,clockWise:a,id:s,textBreakAll:o,zIndex:l}=n,c=p9(n,j5e),d=L5e(),u=O5e(),m=d||u;return!m||!m.length?null:w.createElement(vs,{zIndex:l??Oi.label},w.createElement(_i,{className:"recharts-label-list"},m.map((p,f)=>{var y,x=fi(r)?e(p,f):Tr(p.payload,r),b=fi(s)?{}:{id:"".concat(s,"-").concat(f)};return w.createElement(bm,Xk({key:"label-".concat(f)},ns(p),c,b,{fill:(y=n.fill)!==null&&y!==void 0?y:p.fill,parentViewBox:p.parentViewBox,value:x,textBreakAll:o,viewBox:p.viewBox,index:f,zIndex:0}))})))}N1.displayName="LabelList";function bT(t){var{label:e}=t;return e?e===!0?w.createElement(N1,{key:"labelList-implicit"}):w.isValidElement(e)||h4(e)?w.createElement(N1,{key:"labelList-implicit",content:e}):typeof e=="object"?w.createElement(N1,Xk({key:"labelList-implicit"},e,{type:String(e.type)})):null:null}function PR(){return PR=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},PR.apply(null,arguments)}var Kte=t=>{var{cx:e,cy:n,r,className:a}=t,s=pr("recharts-dot",a);return Gt(e)&&Gt(n)&&Gt(r)?w.createElement("circle",PR({},Is(t),UL(t),{className:s,cx:e,cy:n,r})):null},Yte=t=>t.graphicalItems.polarItems,I5e=pt([Ni,ew],OO),xT=pt([Yte,Ui,I5e],IO),z5e=pt([xT],zO),yT=pt([z5e,rT],UO),U5e=pt([yT,Ui,xT],HO);pt([yT,Ui,xT],(t,e,n)=>n.length>0?t.flatMap(r=>n.flatMap(a=>{var s,o=Tr(r,(s=e.dataKey)!==null&&s!==void 0?s:a.dataKey);return{value:o,errorDomain:[]}})).filter(Boolean):e?.dataKey!=null?t.map(r=>({value:Tr(r,e.dataKey),errorDomain:[]})):t.map(r=>({value:r,errorDomain:[]})));var f9=()=>{},B5e=pt([yT,Ui,xT,mT,Ni],GO),H5e=pt([Ui,qO,VO,f9,B5e,f9,hr,Ni],WO),Xte=pt([Ui,hr,yT,U5e,J0,Ni,H5e],KO),$5e=pt([Xte,Sx,xh],QO),q5e=pt([Ui,Xte,$5e,Ni],JO);pt([xh,q5e],Dee);var V5e={radiusAxis:{},angleAxis:{}},Qte=ho({name:"polarAxis",initialState:V5e,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:crt,removeRadiusAxis:drt,addAngleAxis:urt,removeAngleAxis:mrt}=Qte.actions,G5e=Qte.reducer;function Zte(t){return t&&typeof t=="object"&&"className"in t&&typeof t.className=="string"?t.className:""}function g9(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),n.push.apply(n,r)}return n}function b9(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?g9(Object(n),!0).forEach(function(r){W5e(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):g9(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function W5e(t,e,n){return(e=K5e(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function K5e(t){var e=Y5e(t,"string");return typeof e=="symbol"?e:e+""}function Y5e(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var X5e=(t,e)=>e,f4=pt([Yte,X5e],(t,e)=>t.filter(n=>n.type==="pie").find(n=>n.id===e)),Q5e=[],g4=(t,e,n)=>n?.length===0?Q5e:n,Jte=pt([rT,f4,g4],(t,e,n)=>{var{chartData:r}=t;if(e!=null){var a;if(e?.data!=null&&e.data.length>0?a=e.data:a=r,(!a||!a.length)&&n!=null&&(a=n.map(s=>b9(b9({},e.presentationProps),s.props))),a!=null)return a}}),Z5e=pt([Jte,f4,g4],(t,e,n)=>{if(!(t==null||e==null))return t.map((r,a)=>{var s,o=Tr(r,e.nameKey,e.name),l;return n!=null&&(s=n[a])!==null&&s!==void 0&&(s=s.props)!==null&&s!==void 0&&s.fill?l=n[a].props.fill:typeof r=="object"&&r!=null&&"fill"in r?l=r.fill:l=e.fill,{value:ph(o,e.dataKey),color:l,payload:r,type:e.legendType}})}),J5e=pt([Jte,f4,g4,ya],(t,e,n,r)=>{if(!(e==null||t==null))return eUe({offset:r,pieSettings:e,displayedData:t,cells:n})}),KE={exports:{}},zr={};var x9;function eze(){if(x9)return zr;x9=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),s=Symbol.for("react.consumer"),o=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),c=Symbol.for("react.suspense"),d=Symbol.for("react.suspense_list"),u=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),p=Symbol.for("react.view_transition"),f=Symbol.for("react.client.reference");function y(x){if(typeof x=="object"&&x!==null){var b=x.$$typeof;switch(b){case t:switch(x=x.type,x){case n:case a:case r:case c:case d:case p:return x;default:switch(x=x&&x.$$typeof,x){case o:case l:case m:case u:return x;case s:return x;default:return b}}case e:return b}}}return zr.ContextConsumer=s,zr.ContextProvider=o,zr.Element=t,zr.ForwardRef=l,zr.Fragment=n,zr.Lazy=m,zr.Memo=u,zr.Portal=e,zr.Profiler=a,zr.StrictMode=r,zr.Suspense=c,zr.SuspenseList=d,zr.isContextConsumer=function(x){return y(x)===s},zr.isContextProvider=function(x){return y(x)===o},zr.isElement=function(x){return typeof x=="object"&&x!==null&&x.$$typeof===t},zr.isForwardRef=function(x){return y(x)===l},zr.isFragment=function(x){return y(x)===n},zr.isLazy=function(x){return y(x)===m},zr.isMemo=function(x){return y(x)===u},zr.isPortal=function(x){return y(x)===e},zr.isProfiler=function(x){return y(x)===a},zr.isStrictMode=function(x){return y(x)===r},zr.isSuspense=function(x){return y(x)===c},zr.isSuspenseList=function(x){return y(x)===d},zr.isValidElementType=function(x){return typeof x=="string"||typeof x=="function"||x===n||x===a||x===r||x===c||x===d||typeof x=="object"&&x!==null&&(x.$$typeof===m||x.$$typeof===u||x.$$typeof===o||x.$$typeof===s||x.$$typeof===l||x.$$typeof===f||x.getModuleId!==void 0)},zr.typeOf=y,zr}var y9;function tze(){return y9||(y9=1,KE.exports=eze()),KE.exports}var nze=tze(),v9=t=>typeof t=="string"?t:t?t.displayName||t.name||"Component":"",w9=null,YE=null,ene=t=>{if(t===w9&&Array.isArray(YE))return YE;var e=[];return w.Children.forEach(t,n=>{fi(n)||(nze.isFragment(n)?e=e.concat(ene(n.props.children)):e.push(n))}),YE=e,w9=t,e};function b4(t,e){var n=[],r=[];return Array.isArray(e)?r=e.map(a=>v9(a)):r=[v9(e)],ene(t).forEach(a=>{var s=tf(a,"type.displayName")||tf(a,"type.name");s&&r.indexOf(s)!==-1&&n.push(a)}),n}var x4=t=>t&&typeof t=="object"&&"clipDot"in t?!!t.clipDot:!0,XE={},S9;function rze(){return S9||(S9=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 a=n[Symbol.toStringTag];return a==null||!Object.getOwnPropertyDescriptor(n,Symbol.toStringTag)?.writable?!1:n.toString()===`[object ${a}]`}let r=n;for(;Object.getPrototypeOf(r)!==null;)r=Object.getPrototypeOf(r);return Object.getPrototypeOf(n)===r}t.isPlainObject=e})(XE)),XE}var QE,_9;function ize(){return _9||(_9=1,QE=rze().isPlainObject),QE}var aze=ize();const sze=Pl(aze);var k9,N9,C9,T9,P9;function A9(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),n.push.apply(n,r)}return n}function M9(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?A9(Object(n),!0).forEach(function(r){oze(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):A9(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function oze(t,e,n){return(e=lze(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function lze(t){var e=cze(t,"string");return typeof e=="symbol"?e:e+""}function cze(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Qk(){return Qk=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Qk.apply(null,arguments)}function Uy(t,e){return e||(e=t.slice(0)),Object.freeze(Object.defineProperties(t,{raw:{value:Object.freeze(e)}}))}var E9=(t,e,n,r,a)=>{var s=n-r,o;return o=ji(k9||(k9=Uy(["M ",",",""])),t,e),o+=ji(N9||(N9=Uy(["L ",",",""])),t+n,e),o+=ji(C9||(C9=Uy(["L ",",",""])),t+n-s/2,e+a),o+=ji(T9||(T9=Uy(["L ",",",""])),t+n-s/2-r,e+a),o+=ji(P9||(P9=Uy(["L ",","," Z"])),t,e),o},dze={x:0,y:0,upperWidth:0,lowerWidth:0,height:0,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},uze=t=>{var e=ki(t,dze),{x:n,y:r,upperWidth:a,lowerWidth:s,height:o,className:l}=e,{animationEasing:c,animationDuration:d,animationBegin:u,isUpdateAnimationActive:m}=e,p=w.useRef(null),[f,y]=w.useState(-1),x=w.useRef(a),b=w.useRef(s),v=w.useRef(o),_=w.useRef(n),k=w.useRef(r),P=bx(t,"trapezoid-");if(w.useEffect(()=>{if(p.current&&p.current.getTotalLength)try{var L=p.current.getTotalLength();L&&y(L)}catch{}},[]),n!==+n||r!==+r||a!==+a||s!==+s||o!==+o||a===0&&s===0||o===0)return null;var C=pr("recharts-trapezoid",l);if(!m)return w.createElement("g",null,w.createElement("path",Qk({},ns(e),{className:C,d:E9(n,r,a,s,o)})));var T=x.current,N=b.current,R=v.current,A=_.current,D=k.current,$="0px ".concat(f===-1?1:f,"px"),U="".concat(f,"px 0px"),G=SJ(["strokeDasharray"],d,c);return w.createElement(gx,{animationId:P,key:P,canBegin:f>0,duration:d,easing:c,isActive:m,begin:u},L=>{var te=Cr(T,a,L),re=Cr(N,s,L),J=Cr(R,o,L),ue=Cr(A,n,L),me=Cr(D,r,L);p.current&&(x.current=te,b.current=re,v.current=J,_.current=ue,k.current=me);var ge=L>0?{transition:G,strokeDasharray:U}:{strokeDasharray:$};return w.createElement("path",Qk({},ns(e),{className:C,d:E9(ue,me,te,re,J),ref:p,style:M9(M9({},ge),e.style)}))})},mze=["option","shapeType","activeClassName"];function hze(t,e){if(t==null)return{};var n,r,a=pze(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(r=0;r<s.length;r++)n=s[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(a[n]=t[n])}return a}function pze(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}function j9(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),n.push.apply(n,r)}return n}function Zk(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?j9(Object(n),!0).forEach(function(r){fze(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):j9(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function fze(t,e,n){return(e=gze(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function gze(t){var e=bze(t,"string");return typeof e=="symbol"?e:e+""}function bze(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function xze(t,e){return Zk(Zk({},e),t)}function yze(t,e){return t==="symbols"}function D9(t){var{shapeType:e,elementProps:n}=t;switch(e){case"rectangle":return w.createElement(CJ,n);case"trapezoid":return w.createElement(uze,n);case"sector":return w.createElement(MJ,n);case"symbols":if(yze(e))return w.createElement(zL,n);break;case"curve":return w.createElement(Sb,n);default:return null}}function vze(t){return w.isValidElement(t)?t.props:t}function y4(t){var{option:e,shapeType:n,activeClassName:r="recharts-active-shape"}=t,a=hze(t,mze),s;if(w.isValidElement(e))s=w.cloneElement(e,Zk(Zk({},a),vze(e)));else if(typeof e=="function")s=e(a,a.index);else if(sze(e)&&typeof e!="boolean"){var o=xze(e,a);s=w.createElement(D9,{shapeType:n,elementProps:o})}else{var l=a;s=w.createElement(D9,{shapeType:n,elementProps:l})}return a.isActive?w.createElement(_i,{className:r},s):s}var v4=(t,e,n)=>{var r=Zr();return(a,s)=>o=>{t?.(a,s,o),r(cte({activeIndex:String(s),activeDataKey:e,activeCoordinate:a.tooltipPosition,activeGraphicalItemId:n}))}},w4=t=>{var e=Zr();return(n,r)=>a=>{t?.(n,r,a),e(NOe())}},S4=(t,e,n)=>{var r=Zr();return(a,s)=>o=>{t?.(a,s,o),r(COe({activeIndex:String(s),activeDataKey:e,activeCoordinate:a.tooltipPosition,activeGraphicalItemId:n}))}};function vT(t){var{tooltipEntrySettings:e}=t,n=Zr(),r=va(),a=w.useRef(null);return w.useLayoutEffect(()=>{r||(a.current===null?n(wOe(e)):a.current!==e&&n(SOe({prev:a.current,next:e})),a.current=e)},[e,n,r]),w.useLayoutEffect(()=>()=>{a.current&&(n(_Oe(a.current)),a.current=null)},[n]),null}function _4(t){var{legendPayload:e}=t,n=Zr(),r=va(),a=w.useRef(null);return w.useLayoutEffect(()=>{r||(a.current===null?n(bJ(e)):a.current!==e&&n(xJ({prev:a.current,next:e})),a.current=e)},[n,r,e]),w.useLayoutEffect(()=>()=>{a.current&&(n(yJ(a.current)),a.current=null)},[n]),null}function wze(t){var{legendPayload:e}=t,n=Zr(),r=Kt(hr),a=w.useRef(null);return w.useLayoutEffect(()=>{r!=="centric"&&r!=="radial"||(a.current===null?n(bJ(e)):a.current!==e&&n(xJ({prev:a.current,next:e})),a.current=e)},[n,r,e]),w.useLayoutEffect(()=>()=>{a.current&&(n(yJ(a.current)),a.current=null)},[n]),null}var ZE,Sze=()=>{var[t]=w.useState(()=>Qv("uid-"));return t},_ze=(ZE=qle.useId)!==null&&ZE!==void 0?ZE:Sze;function kze(t,e){var n=_ze();return e||(t?"".concat(t,"-").concat(n):n)}var Nze=w.createContext(void 0),wT=t=>{var{id:e,type:n,children:r}=t,a=kze("recharts-".concat(n),e);return w.createElement(Nze.Provider,{value:a},r(a))},Cze={cartesianItems:[],polarItems:[]},tne=ho({name:"graphicalItems",initialState:Cze,reducers:{addCartesianGraphicalItem:{reducer(t,e){t.cartesianItems.push(e.payload)},prepare:ui()},replaceCartesianGraphicalItem:{reducer(t,e){var{prev:n,next:r}=e.payload,a=Jl(t).cartesianItems.indexOf(n);a>-1&&(t.cartesianItems[a]=r)},prepare:ui()},removeCartesianGraphicalItem:{reducer(t,e){var n=Jl(t).cartesianItems.indexOf(e.payload);n>-1&&t.cartesianItems.splice(n,1)},prepare:ui()},addPolarGraphicalItem:{reducer(t,e){t.polarItems.push(e.payload)},prepare:ui()},removePolarGraphicalItem:{reducer(t,e){var n=Jl(t).polarItems.indexOf(e.payload);n>-1&&t.polarItems.splice(n,1)},prepare:ui()}}}),{addCartesianGraphicalItem:Tze,replaceCartesianGraphicalItem:Pze,removeCartesianGraphicalItem:Aze,addPolarGraphicalItem:Mze,removePolarGraphicalItem:Eze}=tne.actions,jze=tne.reducer,Dze=t=>{var e=Zr(),n=w.useRef(null);return w.useLayoutEffect(()=>{n.current===null?e(Tze(t)):n.current!==t&&e(Pze({prev:n.current,next:t})),n.current=t},[e,t]),w.useLayoutEffect(()=>()=>{n.current&&(e(Aze(n.current)),n.current=null)},[e]),null},k4=w.memo(Dze);function Rze(t){var e=Zr();return w.useLayoutEffect(()=>(e(Mze(t)),()=>{e(Eze(t))}),[e,t]),null}var Fze=["key"],Lze=["onMouseEnter","onClick","onMouseLeave"],Oze=["id"],Ize=["id"];function R9(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),n.push.apply(n,r)}return n}function Di(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?R9(Object(n),!0).forEach(function(r){zze(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):R9(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function zze(t,e,n){return(e=Uze(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Uze(t){var e=Bze(t,"string");return typeof e=="symbol"?e:e+""}function Bze(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function dh(){return dh=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},dh.apply(null,arguments)}function ST(t,e){if(t==null)return{};var n,r,a=Hze(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(r=0;r<s.length;r++)n=s[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(a[n]=t[n])}return a}function Hze(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}function $ze(t){var e=w.useMemo(()=>b4(t.children,Yb),[t.children]),n=Kt(r=>Z5e(r,t.id,e));return n==null?null:w.createElement(wze,{legendPayload:n})}var qze=w.memo(t=>{var{dataKey:e,nameKey:n,sectors:r,stroke:a,strokeWidth:s,fill:o,name:l,hide:c,tooltipType:d,id:u}=t,m={dataDefinedOnItem:r.map(p=>p.tooltipPayload),getPosition:p=>{var f;return(f=r[Number(p)])===null||f===void 0?void 0:f.tooltipPosition},settings:{stroke:a,strokeWidth:s,fill:o,dataKey:e,nameKey:n,name:ph(l,e),hide:c,type:d,color:o,unit:"",graphicalItemId:u}};return w.createElement(vT,{tooltipEntrySettings:m})}),Vze=(t,e)=>t>e?"start":t<e?"end":"middle",Gze=(t,e,n)=>bs(typeof e=="function"?e(t):e,n,n*.8),Wze=(t,e,n)=>{var{top:r,left:a,width:s,height:o}=e,l=TJ(s,o),c=a+bs(t.cx,s,s/2),d=r+bs(t.cy,o,o/2),u=bs(t.innerRadius,l,0),m=Gze(n,t.outerRadius,l),p=t.maxRadius||Math.sqrt(s*s+o*o)/2;return{cx:c,cy:d,innerRadius:u,outerRadius:m,maxRadius:p}},Kze=(t,e)=>{var n=Ra(e-t),r=Math.min(Math.abs(e-t),360);return n*r},Yze=(t,e)=>{if(w.isValidElement(t))return w.cloneElement(t,e);if(typeof t=="function")return t(e);var n=pr("recharts-pie-label-line",typeof t!="boolean"?t.className:""),{key:r}=e,a=ST(e,Fze);return w.createElement(Sb,dh({},a,{type:"linear",className:n}))},Xze=(t,e,n)=>{if(w.isValidElement(t))return w.cloneElement(t,e);var r=n;if(typeof t=="function"&&(r=t(e),w.isValidElement(r)))return r;var a=pr("recharts-pie-label-text",Zte(t));return w.createElement(gT,dh({},e,{alignmentBaseline:"middle",className:a}),r)};function Qze(t){var{sectors:e,props:n,showLabels:r}=t,{label:a,labelLine:s,dataKey:o}=n;if(!r||!a||!e)return null;var l=Is(n),c=Jp(a),d=Jp(s),u=typeof a=="object"&&"offsetRadius"in a&&typeof a.offsetRadius=="number"&&a.offsetRadius||20,m=e.map((p,f)=>{var y=(p.startAngle+p.endAngle)/2,x=ia(p.cx,p.cy,p.outerRadius+u,y),b=Di(Di(Di(Di({},l),p),{},{stroke:"none"},c),{},{index:f,textAnchor:Vze(x.x,p.cx)},x),v=Di(Di(Di(Di({},l),p),{},{fill:"none",stroke:p.fill},d),{},{index:f,points:[ia(p.cx,p.cy,p.outerRadius,y),x],key:"line"});return w.createElement(vs,{zIndex:Oi.label,key:"label-".concat(p.startAngle,"-").concat(p.endAngle,"-").concat(p.midAngle,"-").concat(f)},w.createElement(_i,null,s&&Yze(s,v),Xze(a,b,Tr(p,o))))});return w.createElement(_i,{className:"recharts-pie-labels"},m)}function Zze(t){var{sectors:e,props:n,showLabels:r}=t,{label:a}=n;return typeof a=="object"&&a!=null&&"position"in a?w.createElement(bT,{label:a}):w.createElement(Qze,{sectors:e,props:n,showLabels:r})}function Jze(t){var{sectors:e,activeShape:n,inactiveShape:r,allOtherPieProps:a,shape:s,id:o}=t,l=Kt(ch),c=Kt(l4),d=Kt(u4e),{onMouseEnter:u,onClick:m,onMouseLeave:p}=a,f=ST(a,Lze),y=v4(u,a.dataKey,o),x=w4(p),b=S4(m,a.dataKey,o);return e==null||e.length===0?null:w.createElement(w.Fragment,null,e.map((v,_)=>{if(v?.startAngle===0&&v?.endAngle===0&&e.length!==1)return null;var k=d==null||d===o,P=String(_)===l&&(c==null||a.dataKey===c)&&k,C=l?r:null,T=n&&P?n:C,N=Di(Di({},v),{},{stroke:v.stroke,tabIndex:-1,[rJ]:_,[iJ]:o});return w.createElement(_i,dh({key:"sector-".concat(v?.startAngle,"-").concat(v?.endAngle,"-").concat(v.midAngle,"-").concat(_),tabIndex:-1,className:"recharts-pie-sector"},B0(f,v,_),{onMouseEnter:y(v,_),onMouseLeave:x(v,_),onClick:b(v,_)}),w.createElement(y4,dh({option:s??T,index:_,shapeType:"sector",isActive:P},N)))}))}function eUe(t){var e,{pieSettings:n,displayedData:r,cells:a,offset:s}=t,{cornerRadius:o,startAngle:l,endAngle:c,dataKey:d,nameKey:u,tooltipType:m}=n,p=Math.abs(n.minAngle),f=Kze(l,c),y=Math.abs(f),x=r.length<=1?0:(e=n.paddingAngle)!==null&&e!==void 0?e:0,b=r.filter(T=>Tr(T,d,0)!==0).length,v=(y>=360?b:b-1)*x,_=y-b*p-v,k=r.reduce((T,N)=>{var R=Tr(N,d,0);return T+(Gt(R)?R:0)},0),P;if(k>0){var C;P=r.map((T,N)=>{var R=Tr(T,d,0),A=Tr(T,u,N),D=Wze(n,s,T),$=(Gt(R)?R:0)/k,U,G=Di(Di({},T),a&&a[N]&&a[N].props);N?U=C.endAngle+Ra(f)*x*(R!==0?1:0):U=l;var L=U+Ra(f)*((R!==0?p:0)+$*_),te=(U+L)/2,re=(D.innerRadius+D.outerRadius)/2,J=[{name:A,value:R,payload:G,dataKey:d,type:m,graphicalItemId:n.id}],ue=ia(D.cx,D.cy,re,te);return C=Di(Di(Di(Di({},n.presentationProps),{},{percent:$,cornerRadius:typeof o=="string"?parseFloat(o):o,name:A,tooltipPayload:J,midAngle:te,middleRadius:re,tooltipPosition:ue},G),D),{},{value:R,dataKey:d,startAngle:U,endAngle:L,payload:G,paddingAngle:Ra(f)*x}),C})}return P}function tUe(t){var{showLabels:e,sectors:n,children:r}=t,a=w.useMemo(()=>!e||!n?[]:n.map(s=>({value:s.value,payload:s.payload,clockWise:!1,parentViewBox:void 0,viewBox:{cx:s.cx,cy:s.cy,innerRadius:s.innerRadius,outerRadius:s.outerRadius,startAngle:s.startAngle,endAngle:s.endAngle,clockWise:!1},fill:s.fill})),[n,e]);return w.createElement(F5e,{value:e?a:void 0},r)}function nUe(t){var{props:e,previousSectorsRef:n,id:r}=t,{sectors:a,isAnimationActive:s,animationBegin:o,animationDuration:l,animationEasing:c,activeShape:d,inactiveShape:u,onAnimationStart:m,onAnimationEnd:p}=e,f=bx(e,"recharts-pie-"),y=n.current,[x,b]=w.useState(!1),v=w.useCallback(()=>{typeof p=="function"&&p(),b(!1)},[p]),_=w.useCallback(()=>{typeof m=="function"&&m(),b(!0)},[m]);return w.createElement(tUe,{showLabels:!x,sectors:a},w.createElement(gx,{animationId:f,begin:o,duration:l,isActive:s,easing:c,onAnimationStart:_,onAnimationEnd:v,key:f},k=>{var P,C=[],T=a&&a[0],N=(P=T?.startAngle)!==null&&P!==void 0?P:0;return a?.forEach((R,A)=>{var D=y&&y[A],$=A>0?tf(R,"paddingAngle",0):0;if(D){var U=Cr(D.endAngle-D.startAngle,R.endAngle-R.startAngle,k),G=Di(Di({},R),{},{startAngle:N+$,endAngle:N+U+$});C.push(G),N=G.endAngle}else{var{endAngle:L,startAngle:te}=R,re=Cr(0,L-te,k),J=Di(Di({},R),{},{startAngle:N+$,endAngle:N+re+$});C.push(J),N=J.endAngle}}),n.current=C,w.createElement(_i,null,w.createElement(Jze,{sectors:C,activeShape:d,inactiveShape:u,allOtherPieProps:e,shape:e.shape,id:r}))}),w.createElement(Zze,{showLabels:!x,sectors:a,props:e}),e.children)}var rUe={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:Oi.area};function iUe(t){var{id:e}=t,n=ST(t,Oze),{hide:r,className:a,rootTabIndex:s}=t,o=w.useMemo(()=>b4(t.children,Yb),[t.children]),l=Kt(u=>J5e(u,e,o)),c=w.useRef(null),d=pr("recharts-pie",a);return r||l==null?(c.current=null,w.createElement(_i,{tabIndex:s,className:d})):w.createElement(vs,{zIndex:t.zIndex},w.createElement(qze,{dataKey:t.dataKey,nameKey:t.nameKey,sectors:l,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,tooltipType:t.tooltipType,id:e}),w.createElement(_i,{tabIndex:s,className:d},w.createElement(nUe,{props:Di(Di({},n),{},{sectors:l}),previousSectorsRef:c,id:e})))}function AR(t){var e=ki(t,rUe),{id:n}=e,r=ST(e,Ize),a=Is(r);return w.createElement(wT,{id:n,type:"pie"},s=>w.createElement(w.Fragment,null,w.createElement(Rze,{type:"pie",id:s,data:r.data,dataKey:r.dataKey,hide:r.hide,angleAxisId:0,radiusAxisId:0,name:r.name,nameKey:r.nameKey,tooltipType:r.tooltipType,legendType:r.legendType,fill:r.fill,cx:r.cx,cy:r.cy,startAngle:r.startAngle,endAngle:r.endAngle,paddingAngle:r.paddingAngle,minAngle:r.minAngle,innerRadius:r.innerRadius,outerRadius:r.outerRadius,cornerRadius:r.cornerRadius,presentationProps:a,maxRadius:e.maxRadius}),w.createElement($ze,dh({},r,{id:s})),w.createElement(iUe,dh({},r,{id:s}))))}AR.displayName="Pie";var aUe=["points"];function F9(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),n.push.apply(n,r)}return n}function JE(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?F9(Object(n),!0).forEach(function(r){sUe(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):F9(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function sUe(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 r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Jk(){return Jk=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Jk.apply(null,arguments)}function cUe(t,e){if(t==null)return{};var n,r,a=dUe(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(r=0;r<s.length;r++)n=s[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(a[n]=t[n])}return a}function dUe(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}function uUe(t){var{option:e,dotProps:n,className:r}=t;if(w.isValidElement(e))return w.cloneElement(e,n);if(typeof e=="function")return e(n);var a=pr(r,typeof e!="boolean"?e.className:""),s=n??{},{points:o}=s,l=cUe(s,aUe);return w.createElement(Kte,Jk({},l,{className:a}))}function mUe(t,e){return t==null?!1:e?!0:t.length===1}function nne(t){var{points:e,dot:n,className:r,dotClassName:a,dataKey:s,baseProps:o,needClip:l,clipPathId:c,zIndex:d=Oi.scatter}=t;if(!mUe(e,n))return null;var u=x4(n),m=RAe(n),p=e.map((y,x)=>{var b,v,_=JE(JE(JE({r:3},o),m),{},{index:x,cx:(b=y.x)!==null&&b!==void 0?b:void 0,cy:(v=y.y)!==null&&v!==void 0?v:void 0,dataKey:s,value:y.value,payload:y.payload,points:e});return w.createElement(uUe,{key:"dot-".concat(x),option:n,dotProps:_,className:a})}),f={};return l&&c!=null&&(f.clipPath="url(#clipPath-".concat(u?"":"dots-").concat(c,")")),w.createElement(vs,{zIndex:d},w.createElement(_i,Jk({className:r},f),p))}function L9(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),n.push.apply(n,r)}return n}function O9(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?L9(Object(n),!0).forEach(function(r){hUe(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):L9(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function hUe(t,e,n){return(e=pUe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function pUe(t){var e=fUe(t,"string");return typeof e=="symbol"?e:e+""}function fUe(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var rne=0,gUe={xAxis:{},yAxis:{},zAxis:{}},ine=ho({name:"cartesianAxis",initialState:gUe,reducers:{addXAxis:{reducer(t,e){t.xAxis[e.payload.id]=e.payload},prepare:ui()},replaceXAxis:{reducer(t,e){var{prev:n,next:r}=e.payload;t.xAxis[n.id]!==void 0&&(n.id!==r.id&&delete t.xAxis[n.id],t.xAxis[r.id]=r)},prepare:ui()},removeXAxis:{reducer(t,e){delete t.xAxis[e.payload.id]},prepare:ui()},addYAxis:{reducer(t,e){t.yAxis[e.payload.id]=e.payload},prepare:ui()},replaceYAxis:{reducer(t,e){var{prev:n,next:r}=e.payload;t.yAxis[n.id]!==void 0&&(n.id!==r.id&&delete t.yAxis[n.id],t.yAxis[r.id]=r)},prepare:ui()},removeYAxis:{reducer(t,e){delete t.yAxis[e.payload.id]},prepare:ui()},addZAxis:{reducer(t,e){t.zAxis[e.payload.id]=e.payload},prepare:ui()},replaceZAxis:{reducer(t,e){var{prev:n,next:r}=e.payload;t.zAxis[n.id]!==void 0&&(n.id!==r.id&&delete t.zAxis[n.id],t.zAxis[r.id]=r)},prepare:ui()},removeZAxis:{reducer(t,e){delete t.zAxis[e.payload.id]},prepare:ui()},updateYAxisWidth(t,e){var{id:n,width:r}=e.payload,a=t.yAxis[n];if(a){var s,o=a.widthHistory||[];if(o.length===3&&o[0]===o[2]&&r===o[1]&&r!==a.width&&Math.abs(r-((s=o[0])!==null&&s!==void 0?s:0))<=1)return;var l=[...o,r].slice(-3);t.yAxis[n]=O9(O9({},a),{},{width:r,widthHistory:l})}}}}),{addXAxis:bUe,replaceXAxis:xUe,removeXAxis:yUe,addYAxis:vUe,replaceYAxis:wUe,removeYAxis:SUe,addZAxis:hrt,replaceZAxis:prt,removeZAxis:frt,updateYAxisWidth:_Ue}=ine.actions,kUe=ine.reducer,NUe=pt([ya],t=>({top:t.top,bottom:t.bottom,left:t.left,right:t.right})),CUe=pt([NUe,Su,_u],(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)}}),_T=()=>Kt(CUe),TUe=()=>Kt(g4e);function I9(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),n.push.apply(n,r)}return n}function ej(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?I9(Object(n),!0).forEach(function(r){PUe(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):I9(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function PUe(t,e,n){return(e=AUe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function AUe(t){var e=MUe(t,"string");return typeof e=="symbol"?e:e+""}function MUe(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var EUe=t=>{var{point:e,childIndex:n,mainColor:r,activeDot:a,dataKey:s,clipPath:o}=t;if(a===!1||e.x==null||e.y==null)return null;var l={index:n,dataKey:s,cx:e.x,cy:e.y,r:4,fill:r??"none",strokeWidth:2,stroke:"#fff",payload:e.payload,value:e.value},c=ej(ej(ej({},l),Jp(a)),UL(a)),d;return w.isValidElement(a)?d=w.cloneElement(a,c):typeof a=="function"?d=a(c):d=w.createElement(Kte,c),w.createElement(_i,{className:"recharts-active-dot",clipPath:o},d)};function MR(t){var{points:e,mainColor:n,activeDot:r,itemDataKey:a,clipPath:s,zIndex:o=Oi.activeDot}=t,l=Kt(ch),c=TUe();if(e==null||c==null)return null;var d=e.find(u=>c.includes(u.payload));return fi(d)?null:w.createElement(vs,{zIndex:o},w.createElement(EUe,{point:d,childIndex:Number(l),mainColor:n,dataKey:a,activeDot:r,clipPath:s}))}var z9=(t,e,n)=>{var r=n??t;if(!fi(r))return bs(r,e,0)},jUe=(t,e,n)=>{var r={},a=t.filter(lT),s=t.filter(d=>d.stackId==null),o=a.reduce((d,u)=>{var m=d[u.stackId];return m==null&&(m=[]),m.push(u),d[u.stackId]=m,d},r),l=Object.entries(o).map(d=>{var u,[m,p]=d,f=p.map(x=>x.dataKey),y=z9(e,n,(u=p[0])===null||u===void 0?void 0:u.barSize);return{stackId:m,dataKeys:f,barSize:y}}),c=s.map(d=>{var u=[d.dataKey].filter(p=>p!=null),m=z9(e,n,d.barSize);return{stackId:void 0,dataKeys:u,barSize:m}});return[...l,...c]};function U9(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),n.push.apply(n,r)}return n}function z_(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?U9(Object(n),!0).forEach(function(r){DUe(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):U9(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function DUe(t,e,n){return(e=RUe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function RUe(t){var e=FUe(t,"string");return typeof e=="symbol"?e:e+""}function FUe(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function LUe(t,e,n,r,a){var s,o=r.length;if(!(o<1)){var l=bs(t,n,0,!0),c,d=[];if(Ln((s=r[0])===null||s===void 0?void 0:s.barSize)){var u=!1,m=n/o,p=r.reduce((_,k)=>_+(k.barSize||0),0);p+=(o-1)*l,p>=n&&(p-=(o-1)*l,l=0),p>=n&&m>0&&(u=!0,m*=.9,p=o*m);var f=(n-p)/2>>0,y={offset:f-l,size:0};c=r.reduce((_,k)=>{var P,C={stackId:k.stackId,dataKeys:k.dataKeys,position:{offset:y.offset+y.size+l,size:u?m:(P=k.barSize)!==null&&P!==void 0?P:0}},T=[..._,C];return y=C.position,T},d)}else{var x=bs(e,n,0,!0);n-2*x-(o-1)*l<=0&&(l=0);var b=(n-2*x-(o-1)*l)/o;b>1&&(b>>=0);var v=Ln(a)?Math.min(b,a):b;c=r.reduce((_,k,P)=>[..._,{stackId:k.stackId,dataKeys:k.dataKeys,position:{offset:x+(b+l)*P+(b-v)/2,size:v}}],d)}return c}}var OUe=(t,e,n,r,a,s,o)=>{var l=fi(o)?e:o,c=LUe(n,r,a!==s?a:s,t,l);return a!==s&&c!=null&&(c=c.map(d=>z_(z_({},d),{},{position:z_(z_({},d.position),{},{offset:d.position.offset-a/2})}))),c},IUe=(t,e)=>{var n=oT(e);if(!(!t||n==null||e==null)){var{stackId:r}=e;if(r!=null){var a=t[r];if(a){var{stackedData:s}=a;if(s)return s.find(o=>o.key===n)}}}},zUe=(t,e)=>{if(!(t==null||e==null)){var n=t.find(r=>r.stackId===e.stackId&&e.dataKey!=null&&r.dataKeys.includes(e.dataKey));if(n!=null)return n.position}};function UUe(t,e){return t&&typeof t=="object"&&"zIndex"in t&&typeof t.zIndex=="number"&&Ln(t.zIndex)?t.zIndex:e}var ane=t=>{var{chartData:e}=t,n=Zr(),r=va();return w.useEffect(()=>r?()=>{}:(n(G7(e)),()=>{n(G7(void 0))}),[e,n,r]),null},B9={x:0,y:0,width:0,height:0,padding:{top:0,right:0,bottom:0,left:0}},sne=ho({name:"brush",initialState:B9,reducers:{setBrushSettings(t,e){return e.payload==null?B9:e.payload}}}),{setBrushSettings:grt}=sne.actions,BUe=sne.reducer,HUe=(t,e)=>{var{x:n,y:r}=t,{x:a,y:s}=e;return{x:Math.min(n,a),y:Math.min(r,s),width:Math.abs(a-n),height:Math.abs(s-r)}},$Ue=t=>{var{x1:e,y1:n,x2:r,y2:a}=t;return HUe({x:e,y:n},{x:r,y:a})};function qUe(t){return(t%180+180)%180}var VUe=function(e){var{width:n,height:r}=e,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,s=qUe(a),o=s*Math.PI/180,l=Math.atan(r/n),c=o>l&&o<Math.PI-l?r/Math.sin(o):n/Math.cos(o);return Math.abs(c)},GUe={dots:[],areas:[],lines:[]},one=ho({name:"referenceElements",initialState:GUe,reducers:{addDot:(t,e)=>{t.dots.push(e.payload)},removeDot:(t,e)=>{var n=Jl(t).dots.findIndex(r=>r===e.payload);n!==-1&&t.dots.splice(n,1)},addArea:(t,e)=>{t.areas.push(e.payload)},removeArea:(t,e)=>{var n=Jl(t).areas.findIndex(r=>r===e.payload);n!==-1&&t.areas.splice(n,1)},addLine:(t,e)=>{t.lines.push(e.payload)},removeLine:(t,e)=>{var n=Jl(t).lines.findIndex(r=>r===e.payload);n!==-1&&t.lines.splice(n,1)}}}),{addDot:brt,removeDot:xrt,addArea:yrt,removeArea:vrt,addLine:WUe,removeLine:KUe}=one.actions,YUe=one.reducer,lne=w.createContext(void 0),XUe=t=>{var{children:e}=t,[n]=w.useState("".concat(Qv("recharts"),"-clip")),r=_T();if(r==null)return null;var{x:a,y:s,width:o,height:l}=r;return w.createElement(lne.Provider,{value:n},w.createElement("defs",null,w.createElement("clipPath",{id:n},w.createElement("rect",{x:a,y:s,height:l,width:o}))),e)},QUe=()=>w.useContext(lne);class ZUe{constructor(e){var{x:n,y:r}=e;this.xAxisScale=n,this.yAxisScale=r}map(e,n){var r,a,{position:s}=n;return{x:(r=this.xAxisScale.map(e.x,{position:s}))!==null&&r!==void 0?r:0,y:(a=this.yAxisScale.map(e.y,{position:s}))!==null&&a!==void 0?a:0}}mapWithFallback(e,n){var r,a,{position:s,fallback:o}=n,l,c;return o==="rangeMin"?l=this.yAxisScale.rangeMin():o==="rangeMax"?l=this.yAxisScale.rangeMax():l=0,o==="rangeMin"?c=this.xAxisScale.rangeMin():o==="rangeMax"?c=this.xAxisScale.rangeMax():c=0,{x:(r=this.xAxisScale.map(e.x,{position:s}))!==null&&r!==void 0?r:c,y:(a=this.yAxisScale.map(e.y,{position:s}))!==null&&a!==void 0?a:l}}isInRange(e){var{x:n,y:r}=e,a=n==null||this.xAxisScale.isInRange(n),s=r==null||this.yAxisScale.isInRange(r);return a&&s}}function H9(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),n.push.apply(n,r)}return n}function $9(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?H9(Object(n),!0).forEach(function(r){JUe(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):H9(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function JUe(t,e,n){return(e=eBe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function eBe(t){var e=tBe(t,"string");return typeof e=="symbol"?e:e+""}function tBe(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function eN(){return eN=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},eN.apply(null,arguments)}var nBe=(t,e)=>{var n;if(w.isValidElement(t))n=w.cloneElement(t,e);else if(typeof t=="function")n=t(e);else{if(!Ln(e.x1)||!Ln(e.y1)||!Ln(e.x2)||!Ln(e.y2))return null;n=w.createElement("line",eN({},e,{className:"recharts-reference-line-line"}))}return n},rBe=(t,e,n,r,a,s)=>{var{x:o,width:l}=s,c=a.map(t,{position:n});if(!Ln(c)||e==="discard"&&!a.isInRange(c))return null;var d=[{x:o+l,y:c},{x:o,y:c}];return r==="left"?d.reverse():d},iBe=(t,e,n,r,a,s)=>{var{y:o,height:l}=s,c=a.map(t,{position:n});if(!Ln(c)||e==="discard"&&!a.isInRange(c))return null;var d=[{x:c,y:o+l},{x:c,y:o}];return r==="top"?d.reverse():d},aBe=(t,e,n,r)=>{var a=[r.mapWithFallback(t[0],{position:n,fallback:"rangeMin"}),r.mapWithFallback(t[1],{position:n,fallback:"rangeMax"})];return e==="discard"&&a.some(s=>!r.isInRange(s))?null:a},sBe=(t,e,n,r,a,s,o)=>{var{x:l,y:c,segment:d,ifOverflow:u}=o,m=Nl(l),p=Nl(c);return p?rBe(c,u,r,s,e,n):m?iBe(l,u,r,a,t,n):d!=null&&d.length===2?aBe(d,u,r,new ZUe({x:t,y:e})):null};function oBe(t){var e=Zr();return w.useEffect(()=>(e(WUe(t)),()=>{e(KUe(t))})),null}function lBe(t){var{xAxisId:e,yAxisId:n,shape:r,className:a,ifOverflow:s}=t,o=va(),l=QUe(),c=Kt(N=>Jc(N,e)),d=Kt(N=>ed(N,n)),u=Kt(N=>Kb(N,"xAxis",e,o)),m=Kt(N=>Kb(N,"yAxis",n,o)),p=V0();if(!l||!p||c==null||d==null||u==null||m==null)return null;var f=sBe(u,m,p,t.position,c.orientation,d.orientation,t);if(!f)return null;var y=f[0],x=f[1];if(y==null||x==null)return null;var{x:b,y:v}=y,{x:_,y:k}=x,P=s==="hidden"?"url(#".concat(l,")"):void 0,C=$9($9({clipPath:P},ns(t)),{},{x1:b,y1:v,x2:_,y2:k}),T=$Ue({x1:b,y1:v,x2:_,y2:k});return w.createElement(vs,{zIndex:t.zIndex},w.createElement(_i,{className:pr("recharts-reference-line",a)},nBe(r,C),w.createElement($te,eN({},T,{lowerWidth:T.width,upperWidth:T.width}),w.createElement(Vte,{label:t.label}),t.children)))}var cBe={ifOverflow:"discard",xAxisId:0,yAxisId:0,fill:"none",label:!1,stroke:"#ccc",fillOpacity:1,strokeWidth:1,position:"middle",zIndex:Oi.line};function Qy(t){var e=ki(t,cBe);return w.createElement(w.Fragment,null,w.createElement(oBe,{yAxisId:e.yAxisId,xAxisId:e.xAxisId,ifOverflow:e.ifOverflow,x:e.x,y:e.y,segment:e.segment}),w.createElement(lBe,e))}Qy.displayName="ReferenceLine";function cne(t,e){if(e<1)return[];if(e===1)return t;for(var n=[],r=0;r<t.length;r+=e){var a=t[r];a!==void 0&&n.push(a)}return n}function dBe(t,e,n){var r={width:t.width+e.width,height:t.height+e.height};return VUe(r,n)}function uBe(t,e,n){var r=n==="width",{x:a,y:s,width:o,height:l}=t;return e===1?{start:r?a:s,end:r?a+o:s+l}:{start:r?a+o:s+l,end:r?a:s}}function u0(t,e,n,r,a){if(t*e<t*r||t*e>t*a)return!1;var s=n();return t*(e-t*s/2-r)>=0&&t*(e+t*s/2-a)<=0}function mBe(t,e){return cne(t,e+1)}function hBe(t,e,n,r,a){for(var s=(r||[]).slice(),{start:o,end:l}=e,c=0,d=1,u=o,m=function(){var y=r?.[c];if(y===void 0)return{v:cne(r,d)};var x=c,b,v=()=>(b===void 0&&(b=n(y,x)),b),_=y.coordinate,k=c===0||u0(t,_,v,u,l);k||(c=0,u=o,d+=1),k&&(u=_+t*(v()/2+a),c+=d)},p;d<=s.length;)if(p=m(),p)return p.v;return[]}function pBe(t,e,n,r,a){var s=(r||[]).slice(),o=s.length;if(o===0)return[];for(var{start:l,end:c}=e,d=1;d<=o;d++){for(var u=(o-1)%d,m=l,p=!0,f=function(){var P=r[x];if(P==null)return 0;var C=x,T,N=()=>(T===void 0&&(T=n(P,C)),T),R=P.coordinate,A=x===u||u0(t,R,N,m,c);if(!A)return p=!1,1;A&&(m=R+t*(N()/2+a))},y,x=u;x<o&&(y=f(),!(y!==0&&y===1));x+=d);if(p){for(var b=[],v=u;v<o;v+=d){var _=r[v];_!=null&&b.push(_)}return b}}return[]}function q9(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),n.push.apply(n,r)}return n}function ds(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?q9(Object(n),!0).forEach(function(r){fBe(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):q9(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function fBe(t,e,n){return(e=gBe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function gBe(t){var e=bBe(t,"string");return typeof e=="symbol"?e:e+""}function bBe(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function xBe(t,e,n,r,a){for(var s=(r||[]).slice(),o=s.length,{start:l}=e,{end:c}=e,d=function(p){var f=s[p];if(f==null)return 1;var y=f,x,b=()=>(x===void 0&&(x=n(f,p)),x);if(p===o-1){var v=t*(y.coordinate+t*b()/2-c);s[p]=y=ds(ds({},y),{},{tickCoord:v>0?y.coordinate-v*t:y.coordinate})}else s[p]=y=ds(ds({},y),{},{tickCoord:y.coordinate});if(y.tickCoord!=null){var _=u0(t,y.tickCoord,b,l,c);_&&(c=y.tickCoord-t*(b()/2+a),s[p]=ds(ds({},y),{},{isShow:!0}))}},u=o-1;u>=0;u--)d(u);return s}function yBe(t,e,n,r,a,s){var o=(r||[]).slice(),l=o.length,{start:c,end:d}=e;if(s){var u=r[l-1];if(u!=null){var m=n(u,l-1),p=t*(u.coordinate+t*m/2-d);if(o[l-1]=u=ds(ds({},u),{},{tickCoord:p>0?u.coordinate-p*t:u.coordinate}),u.tickCoord!=null){var f=u0(t,u.tickCoord,()=>m,c,d);f&&(d=u.tickCoord-t*(m/2+a),o[l-1]=ds(ds({},u),{},{isShow:!0}))}}}for(var y=s?l-1:l,x=function(_){var k=o[_];if(k==null)return 1;var P=k,C,T=()=>(C===void 0&&(C=n(k,_)),C);if(_===0){var N=t*(P.coordinate-t*T()/2-c);o[_]=P=ds(ds({},P),{},{tickCoord:N<0?P.coordinate-N*t:P.coordinate})}else o[_]=P=ds(ds({},P),{},{tickCoord:P.coordinate});if(P.tickCoord!=null){var R=u0(t,P.tickCoord,T,c,d);R&&(c=P.tickCoord+t*(T()/2+a),o[_]=ds(ds({},P),{},{isShow:!0}))}},b=0;b<y;b++)x(b);return o}function N4(t,e,n){var{tick:r,ticks:a,viewBox:s,minTickGap:o,orientation:l,interval:c,tickFormatter:d,unit:u,angle:m}=t;if(!a||!a.length||!r)return[];if(Gt(c)||K0.isSsr){var p;return(p=mBe(a,Gt(c)?c:0))!==null&&p!==void 0?p:[]}var f=[],y=l==="top"||l==="bottom"?"width":"height",x=u&&y==="width"?mv(u,{fontSize:e,letterSpacing:n}):{width:0,height:0},b=(C,T)=>{var N=typeof d=="function"?d(C.value,T):C.value;return y==="width"?dBe(mv(N,{fontSize:e,letterSpacing:n}),x,m):mv(N,{fontSize:e,letterSpacing:n})[y]},v=a[0],_=a[1],k=a.length>=2&&v!=null&&_!=null?Ra(_.coordinate-v.coordinate):1,P=uBe(s,k,y);return c==="equidistantPreserveStart"?hBe(k,P,b,a,o):c==="equidistantPreserveEnd"?pBe(k,P,b,a,o):(c==="preserveStart"||c==="preserveStartEnd"?f=yBe(k,P,b,a,o,c==="preserveStartEnd"):f=xBe(k,P,b,a,o),f.filter(C=>C.isShow))}var vBe=t=>{var{ticks:e,label:n,labelGapWithTick:r=5,tickSize:a=0,tickMargin:s=0}=t,o=0;if(e){Array.from(e).forEach(u=>{if(u){var m=u.getBoundingClientRect();m.width>o&&(o=m.width)}});var l=n?n.getBoundingClientRect().width:0,c=a+s,d=o+c+l+(n?r:0);return Math.round(d)}return 0},wBe=["axisLine","width","height","className","hide","ticks","axisType"];function SBe(t,e){if(t==null)return{};var n,r,a=_Be(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(r=0;r<s.length;r++)n=s[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(a[n]=t[n])}return a}function _Be(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}function lf(){return lf=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},lf.apply(null,arguments)}function V9(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),n.push.apply(n,r)}return n}function Ei(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?V9(Object(n),!0).forEach(function(r){kBe(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):V9(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function kBe(t,e,n){return(e=NBe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function NBe(t){var e=CBe(t,"string");return typeof e=="symbol"?e:e+""}function CBe(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var nu={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:Oi.axis};function TBe(t){var{x:e,y:n,width:r,height:a,orientation:s,mirror:o,axisLine:l,otherSvgProps:c}=t;if(!l)return null;var d=Ei(Ei(Ei({},c),Is(l)),{},{fill:"none"});if(s==="top"||s==="bottom"){var u=+(s==="top"&&!o||s==="bottom"&&o);d=Ei(Ei({},d),{},{x1:e,y1:n+u*a,x2:e+r,y2:n+u*a})}else{var m=+(s==="left"&&!o||s==="right"&&o);d=Ei(Ei({},d),{},{x1:e+m*r,y1:n,x2:e+m*r,y2:n+a})}return w.createElement("line",lf({},d,{className:pr("recharts-cartesian-axis-line",tf(l,"className"))}))}function PBe(t,e,n,r,a,s,o,l,c){var d,u,m,p,f,y,x=l?-1:1,b=t.tickSize||o,v=Gt(t.tickCoord)?t.tickCoord:t.coordinate;switch(s){case"top":d=u=t.coordinate,p=n+ +!l*a,m=p-x*b,y=m-x*c,f=v;break;case"left":m=p=t.coordinate,u=e+ +!l*r,d=u-x*b,f=d-x*c,y=v;break;case"right":m=p=t.coordinate,u=e+ +l*r,d=u+x*b,f=d+x*c,y=v;break;default:d=u=t.coordinate,p=n+ +l*a,m=p+x*b,y=m+x*c,f=v;break}return{line:{x1:d,y1:m,x2:u,y2:p},tick:{x:f,y}}}function ABe(t,e){switch(t){case"left":return e?"start":"end";case"right":return e?"end":"start";default:return"middle"}}function MBe(t,e){switch(t){case"left":case"right":return"middle";case"top":return e?"start":"end";default:return e?"end":"start"}}function EBe(t){var{option:e,tickProps:n,value:r}=t,a,s=pr(n.className,"recharts-cartesian-axis-tick-value");if(w.isValidElement(e))a=w.cloneElement(e,Ei(Ei({},n),{},{className:s}));else if(typeof e=="function")a=e(Ei(Ei({},n),{},{className:s}));else{var o="recharts-cartesian-axis-tick-value";typeof e!="boolean"&&(o=pr(o,Zte(e))),a=w.createElement(gT,lf({},n,{className:o}),r)}return a}var jBe=w.forwardRef((t,e)=>{var{ticks:n=[],tick:r,tickLine:a,stroke:s,tickFormatter:o,unit:l,padding:c,tickTextProps:d,orientation:u,mirror:m,x:p,y:f,width:y,height:x,tickSize:b,tickMargin:v,fontSize:_,letterSpacing:k,getTicksConfig:P,events:C,axisType:T}=t,N=N4(Ei(Ei({},P),{},{ticks:n}),_,k),R=ABe(u,m),A=MBe(u,m),D=Is(P),$=Jp(r),U={};typeof a=="object"&&(U=a);var G=Ei(Ei({},D),{},{fill:"none"},U),L=N.map(J=>Ei({entry:J},PBe(J,p,f,y,x,u,b,m,v))),te=L.map(J=>{var{entry:ue,line:me}=J;return w.createElement(_i,{className:"recharts-cartesian-axis-tick",key:"tick-".concat(ue.value,"-").concat(ue.coordinate,"-").concat(ue.tickCoord)},a&&w.createElement("line",lf({},G,me,{className:pr("recharts-cartesian-axis-tick-line",tf(a,"className"))})))}),re=L.map((J,ue)=>{var me,ge,{entry:X,tick:ie}=J,le=Ei(Ei(Ei(Ei({verticalAnchor:A},D),{},{textAnchor:R,stroke:"none",fill:s},ie),{},{index:ue,payload:X,visibleTicksCount:N.length,tickFormatter:o,padding:c},d),{},{angle:(me=(ge=d?.angle)!==null&&ge!==void 0?ge:D.angle)!==null&&me!==void 0?me:0}),pe=Ei(Ei({},le),$);return w.createElement(_i,lf({className:"recharts-cartesian-axis-tick-label",key:"tick-label-".concat(X.value,"-").concat(X.coordinate,"-").concat(X.tickCoord)},B0(C,X,ue)),r&&w.createElement(EBe,{option:r,tickProps:pe,value:"".concat(typeof o=="function"?o(X.value,ue):X.value).concat(l||"")}))});return w.createElement("g",{className:"recharts-cartesian-axis-ticks recharts-".concat(T,"-ticks")},re.length>0&&w.createElement(vs,{zIndex:Oi.label},w.createElement("g",{className:"recharts-cartesian-axis-tick-labels recharts-".concat(T,"-tick-labels"),ref:e},re)),te.length>0&&w.createElement("g",{className:"recharts-cartesian-axis-tick-lines recharts-".concat(T,"-tick-lines")},te))}),DBe=w.forwardRef((t,e)=>{var{axisLine:n,width:r,height:a,className:s,hide:o,ticks:l,axisType:c}=t,d=SBe(t,wBe),[u,m]=w.useState(""),[p,f]=w.useState(""),y=w.useRef(null);w.useImperativeHandle(e,()=>({getCalculatedWidth:()=>{var b;return vBe({ticks:y.current,label:(b=t.labelRef)===null||b===void 0?void 0:b.current,labelGapWithTick:5,tickSize:t.tickSize,tickMargin:t.tickMargin})}}));var x=w.useCallback(b=>{if(b){var v=b.getElementsByClassName("recharts-cartesian-axis-tick-value");y.current=v;var _=v[0];if(_){var k=window.getComputedStyle(_),P=k.fontSize,C=k.letterSpacing;(P!==u||C!==p)&&(m(P),f(C))}}},[u,p]);return o||r!=null&&r<=0||a!=null&&a<=0?null:w.createElement(vs,{zIndex:t.zIndex},w.createElement(_i,{className:pr("recharts-cartesian-axis",s)},w.createElement(TBe,{x:t.x,y:t.y,width:r,height:a,orientation:t.orientation,mirror:t.mirror,axisLine:n,otherSvgProps:Is(t)}),w.createElement(jBe,{ref:x,axisType:c,events:d,fontSize:u,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:l,unit:t.unit,width:t.width,x:t.x,y:t.y}),w.createElement($te,{x:t.x,y:t.y,width:t.width,height:t.height,lowerWidth:t.width,upperWidth:t.width},w.createElement(Vte,{label:t.label,labelRef:t.labelRef}),t.children)))}),C4=w.forwardRef((t,e)=>{var n=ki(t,nu);return w.createElement(DBe,lf({},n,{ref:e}))});C4.displayName="CartesianAxis";var RBe=["x1","y1","x2","y2","key"],FBe=["offset"],LBe=["xAxisId","yAxisId"],OBe=["xAxisId","yAxisId"];function G9(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),n.push.apply(n,r)}return n}function hs(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?G9(Object(n),!0).forEach(function(r){IBe(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):G9(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function IBe(t,e,n){return(e=zBe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function zBe(t){var e=UBe(t,"string");return typeof e=="symbol"?e:e+""}function UBe(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function bp(){return bp=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},bp.apply(null,arguments)}function tN(t,e){if(t==null)return{};var n,r,a=BBe(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(r=0;r<s.length;r++)n=s[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(a[n]=t[n])}return a}function BBe(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}var HBe=t=>{var{fill:e}=t;if(!e||e==="none")return null;var{fillOpacity:n,x:r,y:a,width:s,height:o,ry:l}=t;return w.createElement("rect",{x:r,y:a,ry:l,width:s,height:o,stroke:"none",fill:e,fillOpacity:n,className:"recharts-cartesian-grid-bg"})};function dne(t){var{option:e,lineItemProps:n}=t,r;if(w.isValidElement(e))r=w.cloneElement(e,n);else if(typeof e=="function")r=e(n);else{var a,{x1:s,y1:o,x2:l,y2:c,key:d}=n,u=tN(n,RBe),m=(a=Is(u))!==null&&a!==void 0?a:{},{offset:p}=m,f=tN(m,FBe);r=w.createElement("line",bp({},f,{x1:s,y1:o,x2:l,y2:c,fill:"none",key:d}))}return r}function $Be(t){var{x:e,width:n,horizontal:r=!0,horizontalPoints:a}=t;if(!r||!a||!a.length)return null;var{xAxisId:s,yAxisId:o}=t,l=tN(t,LBe),c=a.map((d,u)=>{var m=hs(hs({},l),{},{x1:e,y1:d,x2:e+n,y2:d,key:"line-".concat(u),index:u});return w.createElement(dne,{key:"line-".concat(u),option:r,lineItemProps:m})});return w.createElement("g",{className:"recharts-cartesian-grid-horizontal"},c)}function qBe(t){var{y:e,height:n,vertical:r=!0,verticalPoints:a}=t;if(!r||!a||!a.length)return null;var{xAxisId:s,yAxisId:o}=t,l=tN(t,OBe),c=a.map((d,u)=>{var m=hs(hs({},l),{},{x1:d,y1:e,x2:d,y2:e+n,key:"line-".concat(u),index:u});return w.createElement(dne,{option:r,lineItemProps:m,key:"line-".concat(u)})});return w.createElement("g",{className:"recharts-cartesian-grid-vertical"},c)}function VBe(t){var{horizontalFill:e,fillOpacity:n,x:r,y:a,width:s,height:o,horizontalPoints:l,horizontal:c=!0}=t;if(!c||!e||!e.length||l==null)return null;var d=l.map(m=>Math.round(m+a-a)).sort((m,p)=>m-p);a!==d[0]&&d.unshift(0);var u=d.map((m,p)=>{var f=d[p+1],y=f==null,x=y?a+o-m:f-m;if(x<=0)return null;var b=p%e.length;return w.createElement("rect",{key:"react-".concat(p),y:m,x:r,height:x,width:s,stroke:"none",fill:e[b],fillOpacity:n,className:"recharts-cartesian-grid-bg"})});return w.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},u)}function GBe(t){var{vertical:e=!0,verticalFill:n,fillOpacity:r,x:a,y:s,width:o,height:l,verticalPoints:c}=t;if(!e||!n||!n.length)return null;var d=c.map(m=>Math.round(m+a-a)).sort((m,p)=>m-p);a!==d[0]&&d.unshift(0);var u=d.map((m,p)=>{var f=d[p+1],y=f==null,x=y?a+o-m:f-m;if(x<=0)return null;var b=p%n.length;return w.createElement("rect",{key:"react-".concat(p),x:m,y:s,width:x,height:l,stroke:"none",fill:n[b],fillOpacity:r,className:"recharts-cartesian-grid-bg"})});return w.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},u)}var WBe=(t,e)=>{var{xAxis:n,width:r,height:a,offset:s}=t;return JZ(N4(hs(hs(hs({},nu),n),{},{ticks:eJ(n),viewBox:{x:0,y:0,width:r,height:a}})),s.left,s.left+s.width,e)},KBe=(t,e)=>{var{yAxis:n,width:r,height:a,offset:s}=t;return JZ(N4(hs(hs(hs({},nu),n),{},{ticks:eJ(n),viewBox:{x:0,y:0,width:r,height:a}})),s.top,s.top+s.height,e)},YBe={horizontal:!0,vertical:!0,horizontalPoints:[],verticalPoints:[],stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[],xAxisId:0,yAxisId:0,syncWithTicks:!1,zIndex:Oi.grid};function xp(t){var e=JL(),n=eO(),r=lJ(),a=hs(hs({},ki(t,YBe)),{},{x:Gt(t.x)?t.x:r.left,y:Gt(t.y)?t.y:r.top,width:Gt(t.width)?t.width:r.width,height:Gt(t.height)?t.height:r.height}),{xAxisId:s,yAxisId:o,x:l,y:c,width:d,height:u,syncWithTicks:m,horizontalValues:p,verticalValues:f}=a,y=va(),x=Kt(A=>R7(A,"xAxis",s,y)),b=Kt(A=>R7(A,"yAxis",o,y));if(!Vc(d)||!Vc(u)||!Gt(l)||!Gt(c))return null;var v=a.verticalCoordinatesGenerator||WBe,_=a.horizontalCoordinatesGenerator||KBe,{horizontalPoints:k,verticalPoints:P}=a;if((!k||!k.length)&&typeof _=="function"){var C=p&&p.length,T=_({yAxis:b?hs(hs({},b),{},{ticks:C?p:b.ticks}):void 0,width:e??d,height:n??u,offset:r},C?!0:m);Nk(Array.isArray(T),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(typeof T,"]")),Array.isArray(T)&&(k=T)}if((!P||!P.length)&&typeof v=="function"){var N=f&&f.length,R=v({xAxis:x?hs(hs({},x),{},{ticks:N?f:x.ticks}):void 0,width:e??d,height:n??u,offset:r},N?!0:m);Nk(Array.isArray(R),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(typeof R,"]")),Array.isArray(R)&&(P=R)}return w.createElement(vs,{zIndex:a.zIndex},w.createElement("g",{className:"recharts-cartesian-grid"},w.createElement(HBe,{fill:a.fill,fillOpacity:a.fillOpacity,x:a.x,y:a.y,width:a.width,height:a.height,ry:a.ry}),w.createElement(VBe,bp({},a,{horizontalPoints:k})),w.createElement(GBe,bp({},a,{verticalPoints:P})),w.createElement($Be,bp({},a,{offset:r,horizontalPoints:k,xAxis:x,yAxis:b})),w.createElement(qBe,bp({},a,{offset:r,verticalPoints:P,xAxis:x,yAxis:b}))))}xp.displayName="CartesianGrid";var XBe={},une=ho({name:"errorBars",initialState:XBe,reducers:{addErrorBar:(t,e)=>{var{itemId:n,errorBar:r}=e.payload;t[n]||(t[n]=[]),t[n].push(r)},replaceErrorBar:(t,e)=>{var{itemId:n,prev:r,next:a}=e.payload;t[n]&&(t[n]=t[n].map(s=>s.dataKey===r.dataKey&&s.direction===r.direction?a:s))},removeErrorBar:(t,e)=>{var{itemId:n,errorBar:r}=e.payload;t[n]&&(t[n]=t[n].filter(a=>a.dataKey!==r.dataKey||a.direction!==r.direction))}}}),{addErrorBar:wrt,replaceErrorBar:Srt,removeErrorBar:_rt}=une.actions,QBe=une.reducer,ZBe=["children"];function JBe(t,e){if(t==null)return{};var n,r,a=e8e(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(r=0;r<s.length;r++)n=s[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(a[n]=t[n])}return a}function e8e(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}var t8e={data:[],xAxisId:"xAxis-0",yAxisId:"yAxis-0",dataPointFormatter:()=>({x:0,y:0,value:0}),errorBarOffset:0},n8e=w.createContext(t8e);function mne(t){var{children:e}=t,n=JBe(t,ZBe);return w.createElement(n8e.Provider,{value:n},e)}function kT(t,e){var n,r,a=Kt(d=>Jc(d,t)),s=Kt(d=>ed(d,e)),o=(n=a?.allowDataOverflow)!==null&&n!==void 0?n:Aa.allowDataOverflow,l=(r=s?.allowDataOverflow)!==null&&r!==void 0?r:Ma.allowDataOverflow,c=o||l;return{needClip:c,needClipX:o,needClipY:l}}function T4(t){var{xAxisId:e,yAxisId:n,clipPathId:r}=t,a=_T(),{needClipX:s,needClipY:o,needClip:l}=kT(e,n);if(!l||!a)return null;var{x:c,y:d,width:u,height:m}=a;return w.createElement("clipPath",{id:"clipPath-".concat(r)},w.createElement("rect",{x:s?c:c-u/2,y:o?d:d-m/2,width:s?u:u*2,height:o?m:m*2}))}var hne=(t,e,n,r)=>Kc(t,"xAxis",e,r),pne=(t,e,n,r)=>Wc(t,"xAxis",e,r),fne=(t,e,n,r)=>Kc(t,"yAxis",n,r),gne=(t,e,n,r)=>Wc(t,"yAxis",n,r),r8e=pt([hr,hne,fne,pne,gne],(t,e,n,r,a)=>cc(t,"xAxis")?lh(e,r,!1):lh(n,a,!1)),i8e=(t,e,n,r,a)=>a;function a8e(t){return t.type==="line"}var s8e=pt([tw,i8e],(t,e)=>t.filter(a8e).find(n=>n.id===e)),o8e=pt([hr,hne,fne,pne,gne,s8e,r8e,TO],(t,e,n,r,a,s,o,l)=>{var{chartData:c,dataStartIndex:d,dataEndIndex:u}=l;if(!(s==null||e==null||n==null||r==null||a==null||r.length===0||a.length===0||o==null||t!=="horizontal"&&t!=="vertical")){var{dataKey:m,data:p}=s,f;if(p!=null&&p.length>0?f=p:f=c?.slice(d,u+1),f!=null)return W8e({layout:t,xAxis:e,yAxis:n,xAxisTicks:r,yAxisTicks:a,dataKey:m,bandSize:o,displayedData:f})}});function bne(t){var e=Jp(t),n=3,r=2;if(e!=null){var{r:a,strokeWidth:s}=e,o=Number(a),l=Number(s);return(Number.isNaN(o)||o<0)&&(o=n),(Number.isNaN(l)||l<0)&&(l=r),{r:o,strokeWidth:l}}return{r:n,strokeWidth:r}}var tj={exports:{}},nj={};var W9;function l8e(){if(W9)return nj;W9=1;var t=pf();function e(c,d){return c===d&&(c!==0||1/c===1/d)||c!==c&&d!==d}var n=typeof Object.is=="function"?Object.is:e,r=t.useSyncExternalStore,a=t.useRef,s=t.useEffect,o=t.useMemo,l=t.useDebugValue;return nj.useSyncExternalStoreWithSelector=function(c,d,u,m,p){var f=a(null);if(f.current===null){var y={hasValue:!1,value:null};f.current=y}else y=f.current;f=o(function(){function b(C){if(!v){if(v=!0,_=C,C=m(C),p!==void 0&&y.hasValue){var T=y.value;if(p(T,C))return k=T}return k=C}if(T=k,n(_,C))return T;var N=m(C);return p!==void 0&&p(T,N)?(_=C,T):(_=C,k=N)}var v=!1,_,k,P=u===void 0?null:u;return[function(){return b(d())},P===null?void 0:function(){return b(P())}]},[d,u,m,p]);var x=r(c,f[0],f[1]);return s(function(){y.hasValue=!0,y.value=x},[x]),l(x),x},nj}var K9;function c8e(){return K9||(K9=1,tj.exports=l8e()),tj.exports}c8e();function d8e(t){t()}function u8e(){let t=null,e=null;return{clear(){t=null,e=null},notify(){d8e(()=>{let n=t;for(;n;)n.callback(),n=n.next})},get(){const n=[];let r=t;for(;r;)n.push(r),r=r.next;return n},subscribe(n){let r=!0;const a=e={callback:n,next:null,prev:e};return a.prev?a.prev.next=a:t=a,function(){!r||t===null||(r=!1,a.next?a.next.prev=a.prev:e=a.prev,a.prev?a.prev.next=a.next:t=a.next)}}}}var Y9={notify(){},get:()=>[]};function m8e(t,e){let n,r=Y9,a=0,s=!1;function o(x){u();const b=r.subscribe(x);let v=!1;return()=>{v||(v=!0,b(),m())}}function l(){r.notify()}function c(){y.onStateChange&&y.onStateChange()}function d(){return s}function u(){a++,n||(n=t.subscribe(c),r=u8e())}function m(){a--,n&&a===0&&(n(),n=void 0,r.clear(),r=Y9)}function p(){s||(s=!0,u())}function f(){s&&(s=!1,m())}const y={addNestedSub:o,notifyNestedSubs:l,handleChangeWrapper:c,isSubscribed:d,trySubscribe:p,tryUnsubscribe:f,getListeners:()=>r};return y}var h8e=()=>typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",p8e=h8e(),f8e=()=>typeof navigator<"u"&&navigator.product==="ReactNative",g8e=f8e(),b8e=()=>p8e||g8e?w.useLayoutEffect:w.useEffect,x8e=b8e();function X9(t,e){return t===e?t!==0||e!==0||1/t===1/e:t!==t&&e!==e}function y8e(t,e){if(X9(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;const n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(let a=0;a<n.length;a++)if(!Object.prototype.hasOwnProperty.call(e,n[a])||!X9(t[n[a]],e[n[a]]))return!1;return!0}var v8e=Symbol.for("react-redux-context"),w8e=typeof globalThis<"u"?globalThis:{};function S8e(){if(!w.createContext)return{};const t=w8e[v8e]??=new Map;let e=t.get(w.createContext);return e||(e=w.createContext(null),t.set(w.createContext,e)),e}var _8e=S8e();function k8e(t){const{children:e,context:n,serverState:r,store:a}=t,s=w.useMemo(()=>{const c=m8e(a);return{store:a,subscription:c,getServerState:r?()=>r:void 0}},[a,r]),o=w.useMemo(()=>a.getState(),[a]);x8e(()=>{const{subscription:c}=s;return c.onStateChange=c.notifyNestedSubs,c.trySubscribe(),o!==a.getState()&&c.notifyNestedSubs(),()=>{c.tryUnsubscribe(),c.onStateChange=void 0}},[s,o]);const l=n||_8e;return w.createElement(l.Provider,{value:s},e)}var N8e=k8e,C8e=new Set(["axisLine","tickLine","activeBar","activeDot","activeLabel","activeShape","allowEscapeViewBox","background","cursor","dot","label","line","margin","padding","position","shape","style","tick","wrapperStyle","radius"]);function T8e(t,e){return t==null&&e==null?!0:typeof t=="number"&&typeof e=="number"?t===e||t!==t&&e!==e:t===e}function ow(t,e){var n=new Set([...Object.keys(t),...Object.keys(e)]);for(var r of n)if(C8e.has(r)){if(t[r]==null&&e[r]==null)continue;if(!y8e(t[r],e[r]))return!1}else if(!T8e(t[r],e[r]))return!1;return!0}var P8e=["id"],A8e=["type","layout","connectNulls","needClip","shape"],M8e=["activeDot","animateNewValues","animationBegin","animationDuration","animationEasing","connectNulls","dot","hide","isAnimationActive","label","legendType","xAxisId","yAxisId","id"];function m0(){return m0=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},m0.apply(null,arguments)}function Q9(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),n.push.apply(n,r)}return n}function Ac(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Q9(Object(n),!0).forEach(function(r){E8e(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Q9(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function E8e(t,e,n){return(e=j8e(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function j8e(t){var e=D8e(t,"string");return typeof e=="symbol"?e:e+""}function D8e(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function P4(t,e){if(t==null)return{};var n,r,a=R8e(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(r=0;r<s.length;r++)n=s[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(a[n]=t[n])}return a}function R8e(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}var F8e=t=>{var{dataKey:e,name:n,stroke:r,legendType:a,hide:s}=t;return[{inactive:s,dataKey:e,type:a,color:r,value:ph(n,e),payload:t}]},L8e=w.memo(t=>{var{dataKey:e,data:n,stroke:r,strokeWidth:a,fill:s,name:o,hide:l,unit:c,tooltipType:d,id:u}=t,m={dataDefinedOnItem:n,getPosition:hh,settings:{stroke:r,strokeWidth:a,fill:s,dataKey:e,nameKey:void 0,name:ph(o,e),hide:l,type:d,color:r,unit:c,graphicalItemId:u}};return w.createElement(vT,{tooltipEntrySettings:m})}),xne=(t,e)=>"".concat(e,"px ").concat(t-e,"px");function O8e(t,e){for(var n=t.length%2!==0?[...t,0]:t,r=[],a=0;a<e;++a)r=[...r,...n];return r}var I8e=(t,e,n)=>{var r=n.reduce((f,y)=>f+y);if(!r)return xne(e,t);for(var a=Math.floor(t/r),s=t%r,o=e-t,l=[],c=0,d=0;c<n.length;d+=(u=n[c])!==null&&u!==void 0?u:0,++c){var u,m=n[c];if(m!=null&&d+m>s){l=[...n.slice(0,c),s-d];break}}var p=l.length%2===0?[0,o]:[o];return[...O8e(n,a),...l,...p].map(f=>"".concat(f,"px")).join(", ")};function z8e(t){var{clipPathId:e,points:n,props:r}=t,{dot:a,dataKey:s,needClip:o}=r,{id:l}=r,c=P4(r,P8e),d=Is(c);return w.createElement(nne,{points:n,dot:a,className:"recharts-line-dots",dotClassName:"recharts-line-dot",dataKey:s,baseProps:d,needClip:o,clipPathId:e})}function U8e(t){var{showLabels:e,children:n,points:r}=t,a=w.useMemo(()=>r?.map(s=>{var o,l,c={x:(o=s.x)!==null&&o!==void 0?o:0,y:(l=s.y)!==null&&l!==void 0?l:0,width:0,lowerWidth:0,upperWidth:0,height:0};return Ac(Ac({},c),{},{value:s.value,payload:s.payload,viewBox:c,parentViewBox:void 0,fill:void 0})}),[r]);return w.createElement(p4,{value:e?a:void 0},n)}function Z9(t){var{clipPathId:e,pathRef:n,points:r,strokeDasharray:a,props:s}=t,{type:o,layout:l,connectNulls:c,needClip:d,shape:u}=s,m=P4(s,A8e),p=Ac(Ac({},ns(m)),{},{fill:"none",className:"recharts-line-curve",clipPath:d?"url(#clipPath-".concat(e,")"):void 0,points:r,type:o,layout:l,connectNulls:c,strokeDasharray:a??s.strokeDasharray});return w.createElement(w.Fragment,null,r?.length>1&&w.createElement(y4,m0({shapeType:"curve",option:u},p,{pathRef:n})),w.createElement(z8e,{points:r,clipPathId:e,props:s}))}function B8e(t){try{return t&&t.getTotalLength&&t.getTotalLength()||0}catch{return 0}}function H8e(t){var{clipPathId:e,props:n,pathRef:r,previousPointsRef:a,longestAnimatedLengthRef:s}=t,{points:o,strokeDasharray:l,isAnimationActive:c,animationBegin:d,animationDuration:u,animationEasing:m,animateNewValues:p,width:f,height:y,onAnimationEnd:x,onAnimationStart:b}=n,v=a.current,_=bx(o,"recharts-line-"),k=w.useRef(_),[P,C]=w.useState(!1),T=!P,N=w.useCallback(()=>{typeof x=="function"&&x(),C(!1)},[x]),R=w.useCallback(()=>{typeof b=="function"&&b(),C(!0)},[b]),A=B8e(r.current),D=w.useRef(0);k.current!==_&&(D.current=s.current,k.current=_);var $=D.current;return w.createElement(U8e,{points:o,showLabels:T},n.children,w.createElement(gx,{animationId:_,begin:d,duration:u,isActive:c,easing:m,onAnimationEnd:N,onAnimationStart:R,key:_},U=>{var G=Cr($,A+$,U),L=Math.min(G,A),te;if(c)if(l){var re="".concat(l).split(/[,\s]+/gim).map(me=>parseFloat(me));te=I8e(L,A,re)}else te=xne(A,L);else te=l==null?void 0:String(l);if(U>0&&A>0&&(a.current=o,s.current=Math.max(s.current,L)),v){var J=v.length/o.length,ue=U===1?o:o.map((me,ge)=>{var X=Math.floor(ge*J);if(v[X]){var ie=v[X];return Ac(Ac({},me),{},{x:Cr(ie.x,me.x,U),y:Cr(ie.y,me.y,U)})}return p?Ac(Ac({},me),{},{x:Cr(f*2,me.x,U),y:Cr(y/2,me.y,U)}):Ac(Ac({},me),{},{x:me.x,y:me.y})});return a.current=ue,w.createElement(Z9,{props:n,points:ue,clipPathId:e,pathRef:r,strokeDasharray:te})}return w.createElement(Z9,{props:n,points:o,clipPathId:e,pathRef:r,strokeDasharray:te})}),w.createElement(bT,{label:n.label}))}function $8e(t){var{clipPathId:e,props:n}=t,r=w.useRef(null),a=w.useRef(0),s=w.useRef(null);return w.createElement(H8e,{props:n,clipPathId:e,previousPointsRef:r,longestAnimatedLengthRef:a,pathRef:s})}var q8e=(t,e)=>{var n,r;return{x:(n=t.x)!==null&&n!==void 0?n:void 0,y:(r=t.y)!==null&&r!==void 0?r:void 0,value:t.value,errorVal:Tr(t.payload,e)}};class V8e extends w.Component{render(){var{hide:e,dot:n,points:r,className:a,xAxisId:s,yAxisId:o,top:l,left:c,width:d,height:u,id:m,needClip:p,zIndex:f}=this.props;if(e)return null;var y=pr("recharts-line",a),x=m,{r:b,strokeWidth:v}=bne(n),_=x4(n),k=b*2+v,P=p?"url(#clipPath-".concat(_?"":"dots-").concat(x,")"):void 0;return w.createElement(vs,{zIndex:f},w.createElement(_i,{className:y},p&&w.createElement("defs",null,w.createElement(T4,{clipPathId:x,xAxisId:s,yAxisId:o}),!_&&w.createElement("clipPath",{id:"clipPath-dots-".concat(x)},w.createElement("rect",{x:c-k/2,y:l-k/2,width:d+k,height:u+k}))),w.createElement(mne,{xAxisId:s,yAxisId:o,data:r,dataPointFormatter:q8e,errorBarOffset:0},w.createElement($8e,{props:this.props,clipPathId:x}))),w.createElement(MR,{activeDot:this.props.activeDot,points:r,mainColor:this.props.stroke,itemDataKey:this.props.dataKey,clipPath:P}))}}var yne={activeDot:!0,animateNewValues:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",connectNulls:!1,dot:!0,fill:"#fff",hide:!1,isAnimationActive:"auto",label:!1,legendType:"line",stroke:"#3182bd",strokeWidth:1,xAxisId:0,yAxisId:0,zIndex:Oi.line,type:"linear"};function G8e(t){var e=ki(t,yne),{activeDot:n,animateNewValues:r,animationBegin:a,animationDuration:s,animationEasing:o,connectNulls:l,dot:c,hide:d,isAnimationActive:u,label:m,legendType:p,xAxisId:f,yAxisId:y,id:x}=e,b=P4(e,M8e),{needClip:v}=kT(f,y),_=_T(),k=fh(),P=va(),C=Kt(D=>o8e(D,f,y,P,x));if(k!=="horizontal"&&k!=="vertical"||C==null||_==null)return null;var{height:T,width:N,x:R,y:A}=_;return w.createElement(V8e,m0({},b,{id:x,connectNulls:l,dot:c,activeDot:n,animateNewValues:r,animationBegin:a,animationDuration:s,animationEasing:o,isAnimationActive:u,hide:d,label:m,legendType:p,xAxisId:f,yAxisId:y,points:C,layout:k,height:T,width:N,left:R,top:A,needClip:v}))}function W8e(t){var{layout:e,xAxis:n,yAxis:r,xAxisTicks:a,yAxisTicks:s,dataKey:o,bandSize:l,displayedData:c}=t;return c.map((d,u)=>{var m=Tr(d,o);if(e==="horizontal"){var p=kk({axis:n,ticks:a,bandSize:l,entry:d,index:u}),f=fi(m)?null:r.scale.map(m);return{x:p,y:f??null,value:m,payload:d}}var y=fi(m)?null:n.scale.map(m),x=kk({axis:r,ticks:s,bandSize:l,entry:d,index:u});return y==null||x==null?null:{x:y,y:x,value:m,payload:d}}).filter(Boolean)}function K8e(t){var e=ki(t,yne),n=va();return w.createElement(wT,{id:e.id,type:"line"},r=>w.createElement(w.Fragment,null,w.createElement(_4,{legendPayload:F8e(e)}),w.createElement(L8e,{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,id:r}),w.createElement(k4,{type:"line",id:r,data:e.data,xAxisId:e.xAxisId,yAxisId:e.yAxisId,zAxisId:0,dataKey:e.dataKey,hide:e.hide,isPanorama:n}),w.createElement(G8e,m0({},e,{id:r}))))}var vne=w.memo(K8e,ow);vne.displayName="Line";function td(t,e){var n,r;return(n=(r=t.graphicalItems.cartesianItems.find(a=>a.id===e))===null||r===void 0?void 0:r.xAxisId)!==null&&n!==void 0?n:rne}function nd(t,e){var n,r;return(n=(r=t.graphicalItems.cartesianItems.find(a=>a.id===e))===null||r===void 0?void 0:r.yAxisId)!==null&&n!==void 0?n:rne}var wne=(t,e,n)=>Kc(t,"xAxis",td(t,e),n),Sne=(t,e,n)=>Wc(t,"xAxis",td(t,e),n),_ne=(t,e,n)=>Kc(t,"yAxis",nd(t,e),n),kne=(t,e,n)=>Wc(t,"yAxis",nd(t,e),n),Y8e=pt([hr,wne,_ne,Sne,kne],(t,e,n,r,a)=>cc(t,"xAxis")?lh(e,r,!1):lh(n,a,!1)),X8e=(t,e)=>e,Nne=pt([tw,X8e],(t,e)=>t.filter(n=>n.type==="area").find(n=>n.id===e)),Cne=t=>{var e=hr(t),n=cc(e,"xAxis");return n?"yAxis":"xAxis"},Q8e=(t,e)=>{var n=Cne(t);return n==="yAxis"?nd(t,e):td(t,e)},Z8e=(t,e,n)=>Wk(t,Cne(t),Q8e(t,e),n),J8e=pt([Nne,Z8e],(t,e)=>{var n;if(!(t==null||e==null)){var{stackId:r}=t,a=oT(t);if(!(r==null||a==null)){var s=(n=e[r])===null||n===void 0?void 0:n.stackedData,o=s?.find(l=>l.key===a);if(o!=null)return o.map(l=>[l[0],l[1]])}}}),e6e=pt([hr,wne,_ne,Sne,kne,J8e,uee,Y8e,Nne,uLe],(t,e,n,r,a,s,o,l,c,d)=>{var{chartData:u,dataStartIndex:m,dataEndIndex:p}=o;if(!(c==null||t!=="horizontal"&&t!=="vertical"||e==null||n==null||r==null||a==null||r.length===0||a.length===0||l==null)){var{data:f}=c,y;if(f&&f.length>0?y=f:y=u?.slice(m,p+1),y!=null)return y6e({layout:t,xAxis:e,yAxis:n,xAxisTicks:r,yAxisTicks:a,dataStartIndex:m,areaSettings:c,stackedData:s,displayedData:y,chartBaseValue:d,bandSize:l})}}),t6e=["id"],n6e=["activeDot","animationBegin","animationDuration","animationEasing","connectNulls","dot","fill","fillOpacity","hide","isAnimationActive","legendType","stroke","xAxisId","yAxisId"];function Dp(){return Dp=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Dp.apply(null,arguments)}function Tne(t,e){if(t==null)return{};var n,r,a=r6e(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(r=0;r<s.length;r++)n=s[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(a[n]=t[n])}return a}function r6e(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}function J9(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),n.push.apply(n,r)}return n}function cb(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?J9(Object(n),!0).forEach(function(r){i6e(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):J9(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function i6e(t,e,n){return(e=a6e(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function a6e(t){var e=s6e(t,"string");return typeof e=="symbol"?e:e+""}function s6e(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function nN(t,e){return t&&t!=="none"?t:e}var o6e=t=>{var{dataKey:e,name:n,stroke:r,fill:a,legendType:s,hide:o}=t;return[{inactive:o,dataKey:e,type:s,color:nN(r,a),value:ph(n,e),payload:t}]},l6e=w.memo(t=>{var{dataKey:e,data:n,stroke:r,strokeWidth:a,fill:s,name:o,hide:l,unit:c,tooltipType:d,id:u}=t,m={dataDefinedOnItem:n,getPosition:hh,settings:{stroke:r,strokeWidth:a,fill:s,dataKey:e,nameKey:void 0,name:ph(o,e),hide:l,type:d,color:nN(r,s),unit:c,graphicalItemId:u}};return w.createElement(vT,{tooltipEntrySettings:m})});function c6e(t){var{clipPathId:e,points:n,props:r}=t,{needClip:a,dot:s,dataKey:o}=r,l=Is(r);return w.createElement(nne,{points:n,dot:s,className:"recharts-area-dots",dotClassName:"recharts-area-dot",dataKey:o,baseProps:l,needClip:a,clipPathId:e})}function d6e(t){var{showLabels:e,children:n,points:r}=t,a=r.map(s=>{var o,l,c={x:(o=s.x)!==null&&o!==void 0?o:0,y:(l=s.y)!==null&&l!==void 0?l:0,width:0,lowerWidth:0,upperWidth:0,height:0};return cb(cb({},c),{},{value:s.value,payload:s.payload,parentViewBox:void 0,viewBox:c,fill:void 0})});return w.createElement(p4,{value:e?a:void 0},n)}function eG(t){var{points:e,baseLine:n,needClip:r,clipPathId:a,props:s}=t,{layout:o,type:l,stroke:c,connectNulls:d,isRange:u}=s,{id:m}=s,p=Tne(s,t6e),f=Is(p),y=ns(p);return w.createElement(w.Fragment,null,e?.length>1&&w.createElement(_i,{clipPath:r?"url(#clipPath-".concat(a,")"):void 0},w.createElement(Sb,Dp({},y,{id:m,points:e,connectNulls:d,type:l,baseLine:n,layout:o,stroke:"none",className:"recharts-area-area"})),c!=="none"&&w.createElement(Sb,Dp({},f,{className:"recharts-area-curve",layout:o,type:l,connectNulls:d,fill:"none",points:e})),c!=="none"&&u&&w.createElement(Sb,Dp({},f,{className:"recharts-area-curve",layout:o,type:l,connectNulls:d,fill:"none",points:n}))),w.createElement(c6e,{points:e,props:p,clipPathId:a}))}function u6e(t){var e,n,{alpha:r,baseLine:a,points:s,strokeWidth:o}=t,l=(e=s[0])===null||e===void 0?void 0:e.y,c=(n=s[s.length-1])===null||n===void 0?void 0:n.y;if(!Ln(l)||!Ln(c))return null;var d=r*Math.abs(l-c),u=Math.max(...s.map(m=>m.x||0));return Gt(a)?u=Math.max(a,u):a&&Array.isArray(a)&&a.length&&(u=Math.max(...a.map(m=>m.x||0),u)),Gt(u)?w.createElement("rect",{x:0,y:l<c?l:l-d,width:u+(o?parseInt("".concat(o),10):1),height:Math.floor(d)}):null}function m6e(t){var e,n,{alpha:r,baseLine:a,points:s,strokeWidth:o}=t,l=(e=s[0])===null||e===void 0?void 0:e.x,c=(n=s[s.length-1])===null||n===void 0?void 0:n.x;if(!Ln(l)||!Ln(c))return null;var d=r*Math.abs(l-c),u=Math.max(...s.map(m=>m.y||0));return Gt(a)?u=Math.max(a,u):a&&Array.isArray(a)&&a.length&&(u=Math.max(...a.map(m=>m.y||0),u)),Gt(u)?w.createElement("rect",{x:l<c?l:l-d,y:0,width:d,height:Math.floor(u+(o?parseInt("".concat(o),10):1))}):null}function h6e(t){var{alpha:e,layout:n,points:r,baseLine:a,strokeWidth:s}=t;return n==="vertical"?w.createElement(u6e,{alpha:e,points:r,baseLine:a,strokeWidth:s}):w.createElement(m6e,{alpha:e,points:r,baseLine:a,strokeWidth:s})}function p6e(t){var{needClip:e,clipPathId:n,props:r,previousPointsRef:a,previousBaselineRef:s}=t,{points:o,baseLine:l,isAnimationActive:c,animationBegin:d,animationDuration:u,animationEasing:m,onAnimationStart:p,onAnimationEnd:f}=r,y=w.useMemo(()=>({points:o,baseLine:l}),[o,l]),x=bx(y,"recharts-area-"),b=tO(),[v,_]=w.useState(!1),k=!v,P=w.useCallback(()=>{typeof f=="function"&&f(),_(!1)},[f]),C=w.useCallback(()=>{typeof p=="function"&&p(),_(!0)},[p]);if(b==null)return null;var T=a.current,N=s.current;return w.createElement(d6e,{showLabels:k,points:o},r.children,w.createElement(gx,{animationId:x,begin:d,duration:u,isActive:c,easing:m,onAnimationEnd:P,onAnimationStart:C,key:x},R=>{if(T){var A=T.length/o.length,D=R===1?o:o.map((U,G)=>{var L=Math.floor(G*A);if(T[L]){var te=T[L];return cb(cb({},U),{},{x:Cr(te.x,U.x,R),y:Cr(te.y,U.y,R)})}return U}),$;return Gt(l)?$=Cr(N,l,R):fi(l)||ic(l)?$=Cr(N,0,R):$=l.map((U,G)=>{var L=Math.floor(G*A);if(Array.isArray(N)&&N[L]){var te=N[L];return cb(cb({},U),{},{x:Cr(te.x,U.x,R),y:Cr(te.y,U.y,R)})}return U}),R>0&&(a.current=D,s.current=$),w.createElement(eG,{points:D,baseLine:$,needClip:e,clipPathId:n,props:r})}return R>0&&(a.current=o,s.current=l),w.createElement(_i,null,c&&w.createElement("defs",null,w.createElement("clipPath",{id:"animationClipPath-".concat(n)},w.createElement(h6e,{alpha:R,points:o,baseLine:l,layout:b,strokeWidth:r.strokeWidth}))),w.createElement(_i,{clipPath:"url(#animationClipPath-".concat(n,")")},w.createElement(eG,{points:o,baseLine:l,needClip:e,clipPathId:n,props:r})))}),w.createElement(bT,{label:r.label}))}function f6e(t){var{needClip:e,clipPathId:n,props:r}=t,a=w.useRef(null),s=w.useRef();return w.createElement(p6e,{needClip:e,clipPathId:n,props:r,previousPointsRef:a,previousBaselineRef:s})}class g6e extends w.PureComponent{render(){var{hide:e,dot:n,points:r,className:a,top:s,left:o,needClip:l,xAxisId:c,yAxisId:d,width:u,height:m,id:p,baseLine:f,zIndex:y}=this.props;if(e)return null;var x=pr("recharts-area",a),b=p,{r:v,strokeWidth:_}=bne(n),k=x4(n),P=v*2+_,C=l?"url(#clipPath-".concat(k?"":"dots-").concat(b,")"):void 0;return w.createElement(vs,{zIndex:y},w.createElement(_i,{className:x},l&&w.createElement("defs",null,w.createElement(T4,{clipPathId:b,xAxisId:c,yAxisId:d}),!k&&w.createElement("clipPath",{id:"clipPath-dots-".concat(b)},w.createElement("rect",{x:o-P/2,y:s-P/2,width:u+P,height:m+P}))),w.createElement(f6e,{needClip:l,clipPathId:b,props:this.props})),w.createElement(MR,{points:r,mainColor:nN(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:C}),this.props.isRange&&Array.isArray(f)&&w.createElement(MR,{points:f,mainColor:nN(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:C}))}}var Pne={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:Oi.area};function b6e(t){var e,n=ki(t,Pne),{activeDot:r,animationBegin:a,animationDuration:s,animationEasing:o,connectNulls:l,dot:c,fill:d,fillOpacity:u,hide:m,isAnimationActive:p,legendType:f,stroke:y,xAxisId:x,yAxisId:b}=n,v=Tne(n,n6e),_=fh(),k=Cte(),{needClip:P}=kT(x,b),C=va(),{points:T,isRange:N,baseLine:R}=(e=Kt(L=>e6e(L,t.id,C)))!==null&&e!==void 0?e:{},A=_T();if(_!=="horizontal"&&_!=="vertical"||A==null||k!=="AreaChart"&&k!=="ComposedChart")return null;var{height:D,width:$,x:U,y:G}=A;return!T||!T.length?null:w.createElement(g6e,Dp({},v,{activeDot:r,animationBegin:a,animationDuration:s,animationEasing:o,baseLine:R,connectNulls:l,dot:c,fill:d,fillOpacity:u,height:D,hide:m,layout:_,isAnimationActive:p==="auto"?!K0.isSsr:p,isRange:N,legendType:f,needClip:P,points:T,stroke:y,width:$,left:U,top:G,xAxisId:x,yAxisId:b}))}var x6e=(t,e,n,r,a)=>{var s=n??e;if(Gt(s))return s;var o=t==="horizontal"?a:r,l=o.scale.domain();if(o.type==="number"){var c=Math.max(l[0],l[1]),d=Math.min(l[0],l[1]);return s==="dataMin"?d:s==="dataMax"||c<0?c:Math.max(Math.min(l[0],l[1]),0)}return s==="dataMin"?l[0]:s==="dataMax"?l[1]:l[0]};function y6e(t){var{areaSettings:{connectNulls:e,baseValue:n,dataKey:r},stackedData:a,layout:s,chartBaseValue:o,xAxis:l,yAxis:c,displayedData:d,dataStartIndex:u,xAxisTicks:m,yAxisTicks:p,bandSize:f}=t,y=a&&a.length,x=x6e(s,o,n,l,c),b=s==="horizontal",v=!1,_=d.map((P,C)=>{var T,N,R,A;if(y)A=a[u+C];else{var D=Tr(P,r);Array.isArray(D)?(A=D,v=!0):A=[x,D]}var $=(T=(N=A)===null||N===void 0?void 0:N[1])!==null&&T!==void 0?T:null,U=$==null||y&&!e&&Tr(P,r)==null;if(b){var G;return{x:kk({axis:l,ticks:m,bandSize:f,entry:P,index:C}),y:U?null:(G=c.scale.map($))!==null&&G!==void 0?G:null,value:A,payload:P}}return{x:U?null:(R=l.scale.map($))!==null&&R!==void 0?R:null,y:kk({axis:c,ticks:p,bandSize:f,entry:P,index:C}),value:A,payload:P}}),k;return y||v?k=_.map(P=>{var C,T=Array.isArray(P.value)?P.value[0]:null;if(b){var N;return{x:P.x,y:T!=null&&P.y!=null&&(N=c.scale.map(T))!==null&&N!==void 0?N:null,payload:P.payload}}return{x:T!=null&&(C=l.scale.map(T))!==null&&C!==void 0?C:null,y:P.y,payload:P.payload}}):k=b?c.scale.map(x):l.scale.map(x),{points:_,baseLine:k??0,isRange:v}}function v6e(t){var e=ki(t,Pne),n=va();return w.createElement(wT,{id:e.id,type:"area"},r=>w.createElement(w.Fragment,null,w.createElement(_4,{legendPayload:o6e(e)}),w.createElement(l6e,{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,id:r}),w.createElement(k4,{type:"area",id:r,data:e.data,dataKey:e.dataKey,xAxisId:e.xAxisId,yAxisId:e.yAxisId,zAxisId:0,stackId:tJ(e.stackId),hide:e.hide,barSize:void 0,baseValue:e.baseValue,isPanorama:n,connectNulls:e.connectNulls}),w.createElement(b6e,Dp({},e,{id:r}))))}var Ane=w.memo(v6e,ow);Ane.displayName="Area";var w6e="Invariant failed";function S6e(t,e){throw new Error(w6e)}function ER(){return ER=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},ER.apply(null,arguments)}function rN(t){return w.createElement(y4,ER({shapeType:"rectangle",activeClassName:"recharts-active-bar"},t))}var _6e=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return(r,a)=>{if(Gt(e))return e;var s=Gt(r)||fi(r);return s?e(r,a):(s||S6e(),n)}},k6e=(t,e,n)=>n,N6e=(t,e)=>e,lw=pt([tw,N6e],(t,e)=>t.filter(n=>n.type==="bar").find(n=>n.id===e)),C6e=pt([lw],t=>t?.maxBarSize),T6e=(t,e,n,r)=>r,P6e=pt([hr,tw,td,nd,k6e],(t,e,n,r,a)=>e.filter(s=>t==="horizontal"?s.xAxisId===n:s.yAxisId===r).filter(s=>s.isPanorama===a).filter(s=>s.hide===!1).filter(s=>s.type==="bar")),A6e=(t,e,n)=>{var r=hr(t),a=td(t,e),s=nd(t,e);if(!(a==null||s==null))return r==="horizontal"?Wk(t,"yAxis",s,n):Wk(t,"xAxis",a,n)},M6e=(t,e)=>{var n=hr(t),r=td(t,e),a=nd(t,e);if(!(r==null||a==null))return n==="horizontal"?D7(t,"xAxis",r):D7(t,"yAxis",a)},E6e=pt([P6e,dLe,M6e],jUe),j6e=(t,e,n)=>{var r,a,s=lw(t,e);if(s==null)return 0;var o=td(t,e),l=nd(t,e);if(o==null||l==null)return 0;var c=hr(t),d=_ee(t),{maxBarSize:u}=s,m=fi(u)?d:u,p,f;return c==="horizontal"?(p=Kc(t,"xAxis",o,n),f=Wc(t,"xAxis",o,n)):(p=Kc(t,"yAxis",l,n),f=Wc(t,"yAxis",l,n)),(r=(a=lh(p,f,!0))!==null&&a!==void 0?a:m)!==null&&r!==void 0?r:0},Mne=(t,e,n)=>{var r=hr(t),a=td(t,e),s=nd(t,e);if(!(a==null||s==null)){var o,l;return r==="horizontal"?(o=Kc(t,"xAxis",a,n),l=Wc(t,"xAxis",a,n)):(o=Kc(t,"yAxis",s,n),l=Wc(t,"yAxis",s,n)),lh(o,l)}},D6e=pt([E6e,_ee,cLe,kee,j6e,Mne,C6e],OUe),R6e=(t,e,n)=>{var r=td(t,e);if(r!=null)return Kc(t,"xAxis",r,n)},F6e=(t,e,n)=>{var r=nd(t,e);if(r!=null)return Kc(t,"yAxis",r,n)},L6e=(t,e,n)=>{var r=td(t,e);if(r!=null)return Wc(t,"xAxis",r,n)},O6e=(t,e,n)=>{var r=nd(t,e);if(r!=null)return Wc(t,"yAxis",r,n)},I6e=pt([D6e,lw],zUe),z6e=pt([A6e,lw],IUe),U6e=pt([ya,XL,R6e,F6e,L6e,O6e,I6e,hr,uee,Mne,z6e,lw,T6e],(t,e,n,r,a,s,o,l,c,d,u,m,p)=>{var{chartData:f,dataStartIndex:y,dataEndIndex:x}=c;if(!(m==null||o==null||e==null||l!=="horizontal"&&l!=="vertical"||n==null||r==null||a==null||s==null||d==null)){var{data:b}=m,v;if(b!=null&&b.length>0?v=b:v=f?.slice(y,x+1),v!=null)return pHe({layout:l,barSettings:m,pos:o,parentViewBox:e,bandSize:d,xAxis:n,yAxis:r,xAxisTicks:a,yAxisTicks:s,stackedData:u,displayedData:v,offset:t,cells:p,dataStartIndex:y})}}),B6e=["index"];function jR(){return jR=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},jR.apply(null,arguments)}function H6e(t,e){if(t==null)return{};var n,r,a=$6e(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(r=0;r<s.length;r++)n=s[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(a[n]=t[n])}return a}function $6e(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}var Ene=w.createContext(void 0),q6e=t=>{var e=w.useContext(Ene);if(e!=null)return e.stackId;if(t!=null)return tJ(t)},V6e=(t,e)=>"recharts-bar-stack-clip-path-".concat(t,"-").concat(e),G6e=t=>{var e=w.useContext(Ene);if(e!=null){var{stackId:n}=e;return"url(#".concat(V6e(n,t),")")}},jne=t=>{var{index:e}=t,n=H6e(t,B6e),r=G6e(e);return w.createElement(_i,jR({className:"recharts-bar-stack-layer",clipPath:r},n))},W6e=["onMouseEnter","onMouseLeave","onClick"],K6e=["value","background","tooltipPosition"],Y6e=["id"],X6e=["onMouseEnter","onClick","onMouseLeave"];function vu(){return vu=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},vu.apply(null,arguments)}function tG(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),n.push.apply(n,r)}return n}function As(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?tG(Object(n),!0).forEach(function(r){Q6e(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):tG(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Q6e(t,e,n){return(e=Z6e(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Z6e(t){var e=J6e(t,"string");return typeof e=="symbol"?e:e+""}function J6e(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function iN(t,e){if(t==null)return{};var n,r,a=eHe(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(r=0;r<s.length;r++)n=s[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(a[n]=t[n])}return a}function eHe(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}var tHe=t=>{var{dataKey:e,name:n,fill:r,legendType:a,hide:s}=t;return[{inactive:s,dataKey:e,type:a,color:r,value:ph(n,e),payload:t}]},nHe=w.memo(t=>{var{dataKey:e,stroke:n,strokeWidth:r,fill:a,name:s,hide:o,unit:l,tooltipType:c,id:d}=t,u={dataDefinedOnItem:void 0,getPosition:hh,settings:{stroke:n,strokeWidth:r,fill:a,dataKey:e,nameKey:void 0,name:ph(s,e),hide:o,type:c,color:a,unit:l,graphicalItemId:d}};return w.createElement(vT,{tooltipEntrySettings:u})});function rHe(t){var e=Kt(ch),{data:n,dataKey:r,background:a,allOtherBarProps:s}=t,{onMouseEnter:o,onMouseLeave:l,onClick:c}=s,d=iN(s,W6e),u=v4(o,r,s.id),m=w4(l),p=S4(c,r,s.id);if(!a||n==null)return null;var f=Jp(a);return w.createElement(vs,{zIndex:UUe(a,Oi.barBackground)},n.map((y,x)=>{var{value:b,background:v,tooltipPosition:_}=y,k=iN(y,K6e);if(!v)return null;var P=u(y,x),C=m(y,x),T=p(y,x),N=As(As(As(As(As({option:a,isActive:String(x)===e},k),{},{fill:"#eee"},v),f),B0(d,y,x)),{},{onMouseEnter:P,onMouseLeave:C,onClick:T,dataKey:r,index:x,className:"recharts-bar-background-rectangle"});return w.createElement(rN,vu({key:"background-bar-".concat(x)},N))}))}function iHe(t){var{showLabels:e,children:n,rects:r}=t,a=r?.map(s=>{var o={x:s.x,y:s.y,width:s.width,lowerWidth:s.width,upperWidth:s.width,height:s.height};return As(As({},o),{},{value:s.value,payload:s.payload,parentViewBox:s.parentViewBox,viewBox:o,fill:s.fill})});return w.createElement(p4,{value:e?a:void 0},n)}function aHe(t){var{shape:e,activeBar:n,baseProps:r,entry:a,index:s,dataKey:o}=t,l=Kt(ch),c=Kt(l4),d=n&&String(s)===l&&(c==null||o===c),u=d?n:e;return d?w.createElement(vs,{zIndex:Oi.activeBar},w.createElement(jne,{index:s},w.createElement(rN,vu({},r,{name:String(r.name)},a,{isActive:d,option:u,index:s,dataKey:o})))):w.createElement(rN,vu({},r,{name:String(r.name)},a,{isActive:d,option:u,index:s,dataKey:o}))}function sHe(t){var{shape:e,baseProps:n,entry:r,index:a,dataKey:s}=t;return w.createElement(rN,vu({},n,{name:String(n.name)},r,{isActive:!1,option:e,index:a,dataKey:s}))}function oHe(t){var e,{data:n,props:r}=t,a=(e=Is(r))!==null&&e!==void 0?e:{},{id:s}=a,o=iN(a,Y6e),{shape:l,dataKey:c,activeBar:d}=r,{onMouseEnter:u,onClick:m,onMouseLeave:p}=r,f=iN(r,X6e),y=v4(u,c,s),x=w4(p),b=S4(m,c,s);return n?w.createElement(w.Fragment,null,n.map((v,_)=>w.createElement(jne,vu({index:_,key:"rectangle-".concat(v?.x,"-").concat(v?.y,"-").concat(v?.value,"-").concat(_),className:"recharts-bar-rectangle"},B0(f,v,_),{onMouseEnter:y(v,_),onMouseLeave:x(v,_),onClick:b(v,_)}),d?w.createElement(aHe,{shape:l,activeBar:d,baseProps:o,entry:v,index:_,dataKey:c}):w.createElement(sHe,{shape:l,baseProps:o,entry:v,index:_,dataKey:c})))):null}function lHe(t){var{props:e,previousRectanglesRef:n}=t,{data:r,layout:a,isAnimationActive:s,animationBegin:o,animationDuration:l,animationEasing:c,onAnimationEnd:d,onAnimationStart:u}=e,m=n.current,p=bx(e,"recharts-bar-"),[f,y]=w.useState(!1),x=!f,b=w.useCallback(()=>{typeof d=="function"&&d(),y(!1)},[d]),v=w.useCallback(()=>{typeof u=="function"&&u(),y(!0)},[u]);return w.createElement(iHe,{showLabels:x,rects:r},w.createElement(gx,{animationId:p,begin:o,duration:l,isActive:s,easing:c,onAnimationEnd:b,onAnimationStart:v,key:p},_=>{var k=_===1?r:r?.map((P,C)=>{var T=m&&m[C];if(T)return As(As({},P),{},{x:Cr(T.x,P.x,_),y:Cr(T.y,P.y,_),width:Cr(T.width,P.width,_),height:Cr(T.height,P.height,_)});if(a==="horizontal"){var N=Cr(0,P.height,_),R=Cr(P.stackedBarStart,P.y,_);return As(As({},P),{},{y:R,height:N})}var A=Cr(0,P.width,_),D=Cr(P.stackedBarStart,P.x,_);return As(As({},P),{},{width:A,x:D})});return _>0&&(n.current=k??null),k==null?null:w.createElement(_i,null,w.createElement(oHe,{props:e,data:k}))}),w.createElement(bT,{label:e.label}),e.children)}function cHe(t){var e=w.useRef(null);return w.createElement(lHe,{previousRectanglesRef:e,props:t})}var Dne=0,dHe=(t,e)=>{var n=Array.isArray(t.value)?t.value[1]:t.value;return{x:t.x,y:t.y,value:n,errorVal:Tr(t,e)}};class uHe extends w.PureComponent{render(){var{hide:e,data:n,dataKey:r,className:a,xAxisId:s,yAxisId:o,needClip:l,background:c,id:d}=this.props;if(e||n==null)return null;var u=pr("recharts-bar",a),m=d;return w.createElement(_i,{className:u,id:d},l&&w.createElement("defs",null,w.createElement(T4,{clipPathId:m,xAxisId:s,yAxisId:o})),w.createElement(_i,{className:"recharts-bar-rectangles",clipPath:l?"url(#clipPath-".concat(m,")"):void 0},w.createElement(rHe,{data:n,dataKey:r,background:c,allOtherBarProps:this.props}),w.createElement(cHe,this.props)))}}var mHe={activeBar:!1,animationBegin:0,animationDuration:400,animationEasing:"ease",background:!1,hide:!1,isAnimationActive:"auto",label:!1,legendType:"rect",minPointSize:Dne,xAxisId:0,yAxisId:0,zIndex:Oi.bar};function hHe(t){var{xAxisId:e,yAxisId:n,hide:r,legendType:a,minPointSize:s,activeBar:o,animationBegin:l,animationDuration:c,animationEasing:d,isAnimationActive:u}=t,{needClip:m}=kT(e,n),p=fh(),f=va(),y=b4(t.children,Yb),x=Kt(_=>U6e(_,t.id,f,y));if(p!=="vertical"&&p!=="horizontal")return null;var b,v=x?.[0];return v==null||v.height==null||v.width==null?b=0:b=p==="vertical"?v.height/2:v.width/2,w.createElement(mne,{xAxisId:e,yAxisId:n,data:x,dataPointFormatter:dHe,errorBarOffset:b},w.createElement(uHe,vu({},t,{layout:p,needClip:m,data:x,xAxisId:e,yAxisId:n,hide:r,legendType:a,minPointSize:s,activeBar:o,animationBegin:l,animationDuration:c,animationEasing:d,isAnimationActive:u})))}function pHe(t){var{layout:e,barSettings:{dataKey:n,minPointSize:r},pos:a,bandSize:s,xAxis:o,yAxis:l,xAxisTicks:c,yAxisTicks:d,stackedData:u,displayedData:m,offset:p,cells:f,parentViewBox:y,dataStartIndex:x}=t,b=e==="horizontal"?l:o,v=u?b.scale.domain():null,_=QEe({numericAxis:b}),k=b.scale.map(_);return m.map((P,C)=>{var T,N,R,A,D,$;if(u){var U=u[C+x];if(U==null)return null;T=GEe(U,v)}else T=Tr(P,n),Array.isArray(T)||(T=[_,T]);var G=_6e(r,Dne)(T[1],C);if(e==="horizontal"){var L,te=l.scale.map(T[0]),re=l.scale.map(T[1]);if(te==null||re==null)return null;N=jq({axis:o,ticks:c,bandSize:s,offset:a.offset,entry:P,index:C}),R=(L=re??te)!==null&&L!==void 0?L:void 0,A=a.size;var J=te-re;if(D=ic(J)?0:J,$={x:N,y:p.top,width:A,height:p.height},Math.abs(G)>0&&Math.abs(D)<Math.abs(G)){var ue=Ra(D||G)*(Math.abs(G)-Math.abs(D));R-=ue,D+=ue}}else{var me=o.scale.map(T[0]),ge=o.scale.map(T[1]);if(me==null||ge==null)return null;if(N=me,R=jq({axis:l,ticks:d,bandSize:s,offset:a.offset,entry:P,index:C}),A=ge-me,D=a.size,$={x:p.left,y:R,width:p.width,height:D},Math.abs(G)>0&&Math.abs(A)<Math.abs(G)){var X=Ra(A||G)*(Math.abs(G)-Math.abs(A));A+=X}}if(N==null||R==null||A==null||D==null)return null;var ie=As(As({},P),{},{stackedBarStart:k,x:N,y:R,width:A,height:D,value:u?T:T[1],payload:P,background:$,tooltipPosition:{x:N+A/2,y:R+D/2},parentViewBox:y},f&&f[C]&&f[C].props);return ie}).filter(Boolean)}function fHe(t){var e=ki(t,mHe),n=q6e(e.stackId),r=va();return w.createElement(wT,{id:e.id,type:"bar"},a=>w.createElement(w.Fragment,null,w.createElement(_4,{legendPayload:tHe(e)}),w.createElement(nHe,{dataKey:e.dataKey,stroke:e.stroke,strokeWidth:e.strokeWidth,fill:e.fill,name:e.name,hide:e.hide,unit:e.unit,tooltipType:e.tooltipType,id:a}),w.createElement(k4,{type:"bar",id:a,data:void 0,xAxisId:e.xAxisId,yAxisId:e.yAxisId,zAxisId:0,dataKey:e.dataKey,stackId:n,hide:e.hide,barSize:e.barSize,minPointSize:e.minPointSize,maxBarSize:e.maxBarSize,isPanorama:r}),w.createElement(vs,{zIndex:e.zIndex},w.createElement(hHe,vu({},e,{id:a})))))}var Jg=w.memo(fHe,ow);Jg.displayName="Bar";var gHe=["domain","range"],bHe=["domain","range"];function nG(t,e){if(t==null)return{};var n,r,a=xHe(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(r=0;r<s.length;r++)n=s[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(a[n]=t[n])}return a}function xHe(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}function rG(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 Rne(t,e){if(t===e)return!0;var{domain:n,range:r}=t,a=nG(t,gHe),{domain:s,range:o}=e,l=nG(e,bHe);return!rG(n,s)||!rG(r,o)?!1:ow(a,l)}var yHe=["type"],vHe=["dangerouslySetInnerHTML","ticks","scale"],wHe=["id","scale"];function DR(){return DR=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},DR.apply(null,arguments)}function iG(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),n.push.apply(n,r)}return n}function aG(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?iG(Object(n),!0).forEach(function(r){SHe(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):iG(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function SHe(t,e,n){return(e=_He(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function _He(t){var e=kHe(t,"string");return typeof e=="symbol"?e:e+""}function kHe(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function RR(t,e){if(t==null)return{};var n,r,a=NHe(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(r=0;r<s.length;r++)n=s[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(a[n]=t[n])}return a}function NHe(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}function CHe(t){var e=Zr(),n=w.useRef(null),r=tO(),{type:a}=t,s=RR(t,yHe),o=aT(r,"xAxis",a),l=w.useMemo(()=>{if(o!=null)return aG(aG({},s),{},{type:o})},[s,o]);return w.useLayoutEffect(()=>{l!=null&&(n.current===null?e(bUe(l)):n.current!==l&&e(xUe({prev:n.current,next:l})),n.current=l)},[l,e]),w.useLayoutEffect(()=>()=>{n.current&&(e(yUe(n.current)),n.current=null)},[e]),null}var THe=t=>{var{xAxisId:e,className:n}=t,r=Kt(XL),a=va(),s="xAxis",o=Kt(v=>rte(v,s,e,a)),l=Kt(v=>Jee(v,e)),c=Kt(v=>uOe(v,e)),d=Kt(v=>Ree(v,e));if(l==null||c==null||d==null)return null;var{dangerouslySetInnerHTML:u,ticks:m,scale:p}=t,f=RR(t,vHe),{id:y,scale:x}=d,b=RR(d,wHe);return w.createElement(C4,DR({},f,b,{x:c.x,y:c.y,width:l.width,height:l.height,className:pr("recharts-".concat(s," ").concat(s),n),viewBox:r,ticks:o,axisType:s}))},PHe={allowDataOverflow:Aa.allowDataOverflow,allowDecimals:Aa.allowDecimals,allowDuplicatedCategory:Aa.allowDuplicatedCategory,angle:Aa.angle,axisLine:nu.axisLine,height:Aa.height,hide:!1,includeHidden:Aa.includeHidden,interval:Aa.interval,label:!1,minTickGap:Aa.minTickGap,mirror:Aa.mirror,orientation:Aa.orientation,padding:Aa.padding,reversed:Aa.reversed,scale:Aa.scale,tick:Aa.tick,tickCount:Aa.tickCount,tickLine:nu.tickLine,tickSize:nu.tickSize,type:Aa.type,xAxisId:0},AHe=t=>{var e=ki(t,PHe);return w.createElement(w.Fragment,null,w.createElement(CHe,{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}),w.createElement(THe,e))},yp=w.memo(AHe,Rne);yp.displayName="XAxis";var MHe=["type"],EHe=["dangerouslySetInnerHTML","ticks","scale"],jHe=["id","scale"];function FR(){return FR=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},FR.apply(null,arguments)}function sG(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),n.push.apply(n,r)}return n}function oG(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?sG(Object(n),!0).forEach(function(r){DHe(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):sG(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function DHe(t,e,n){return(e=RHe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function RHe(t){var e=FHe(t,"string");return typeof e=="symbol"?e:e+""}function FHe(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function LR(t,e){if(t==null)return{};var n,r,a=LHe(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(r=0;r<s.length;r++)n=s[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(a[n]=t[n])}return a}function LHe(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}function OHe(t){var e=Zr(),n=w.useRef(null),r=tO(),{type:a}=t,s=LR(t,MHe),o=aT(r,"yAxis",a),l=w.useMemo(()=>{if(o!=null)return oG(oG({},s),{},{type:o})},[o,s]);return w.useLayoutEffect(()=>{l!=null&&(n.current===null?e(vUe(l)):n.current!==l&&e(wUe({prev:n.current,next:l})),n.current=l)},[l,e]),w.useLayoutEffect(()=>()=>{n.current&&(e(SUe(n.current)),n.current=null)},[e]),null}function IHe(t){var{yAxisId:e,className:n,width:r,label:a}=t,s=w.useRef(null),o=w.useRef(null),l=Kt(XL),c=va(),d=Zr(),u="yAxis",m=Kt(T=>ete(T,e)),p=Kt(T=>hOe(T,e)),f=Kt(T=>rte(T,u,e,c)),y=Kt(T=>Fee(T,e));if(w.useLayoutEffect(()=>{if(!(r!=="auto"||!m||h4(a)||w.isValidElement(a)||y==null)){var T=s.current;if(T){var N=T.getCalculatedWidth();Math.round(m.width)!==Math.round(N)&&d(_Ue({id:e,width:N}))}}},[f,m,d,a,e,r,y]),m==null||p==null||y==null)return null;var{dangerouslySetInnerHTML:x,ticks:b,scale:v}=t,_=LR(t,EHe),{id:k,scale:P}=y,C=LR(y,jHe);return w.createElement(C4,FR({},_,C,{ref:s,labelRef:o,x:p.x,y:p.y,tickTextProps:r==="auto"?{width:void 0}:{width:r},width:m.width,height:m.height,className:pr("recharts-".concat(u," ").concat(u),n),viewBox:l,ticks:f,axisType:u}))}var zHe={allowDataOverflow:Ma.allowDataOverflow,allowDecimals:Ma.allowDecimals,allowDuplicatedCategory:Ma.allowDuplicatedCategory,angle:Ma.angle,axisLine:nu.axisLine,hide:!1,includeHidden:Ma.includeHidden,interval:Ma.interval,label:!1,minTickGap:Ma.minTickGap,mirror:Ma.mirror,orientation:Ma.orientation,padding:Ma.padding,reversed:Ma.reversed,scale:Ma.scale,tick:Ma.tick,tickCount:Ma.tickCount,tickLine:nu.tickLine,tickSize:nu.tickSize,type:Ma.type,width:Ma.width,yAxisId:0},UHe=t=>{var e=ki(t,zHe);return w.createElement(w.Fragment,null,w.createElement(OHe,{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}),w.createElement(IHe,e))},vp=w.memo(UHe,Rne);vp.displayName="YAxis";var BHe=(t,e)=>e,A4=pt([BHe,hr,Eee,Ia,vte,Cu,P4e,ya],F4e),M4=t=>{var e=t.currentTarget.getBoundingClientRect(),n=e.width/t.currentTarget.offsetWidth,r=e.height/t.currentTarget.offsetHeight;return{chartX:Math.round((t.clientX-e.left)/n),chartY:Math.round((t.clientY-e.top)/r)}},Fne=Cl("mouseClick"),Lne=$0();Lne.startListening({actionCreator:Fne,effect:(t,e)=>{var n=t.payload,r=A4(e.getState(),M4(n));r?.activeIndex!=null&&e.dispatch(TOe({activeIndex:r.activeIndex,activeDataKey:void 0,activeCoordinate:r.activeCoordinate}))}});var OR=Cl("mouseMove"),One=$0(),U_=null;One.startListening({actionCreator:OR,effect:(t,e)=>{var n=t.payload;U_!==null&&cancelAnimationFrame(U_);var r=M4(n);U_=requestAnimationFrame(()=>{var a=e.getState(),s=n4(a,a.tooltip.settings.shared);if(s==="axis"){var o=A4(a,r);o?.activeIndex!=null?e.dispatch(ute({activeIndex:o.activeIndex,activeDataKey:void 0,activeCoordinate:o.activeCoordinate})):e.dispatch(dte())}U_=null})}});function HHe(t,e){return e instanceof HTMLElement?"HTMLElement <".concat(e.tagName,' class="').concat(e.className,'">'):e===window?"global.window":t==="children"&&typeof e=="object"&&e!==null?"<<CHILDREN>>":e}var lG={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},Ine=ho({name:"rootProps",initialState:lG,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:lG.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}}}),$He=Ine.reducer,{updateOptions:qHe}=Ine.actions,VHe=null,GHe={updatePolarOptions:(t,e)=>e.payload},zne=ho({name:"polarOptions",initialState:VHe,reducers:GHe}),{updatePolarOptions:WHe}=zne.actions,KHe=zne.reducer,Une=Cl("keyDown"),Bne=Cl("focus"),E4=$0();E4.startListening({actionCreator:Une,effect:(t,e)=>{var n=e.getState(),r=n.rootProps.accessibilityLayer!==!1;if(r){var{keyboardInteraction:a}=n.tooltip,s=t.payload;if(!(s!=="ArrowRight"&&s!=="ArrowLeft"&&s!=="Enter")){var o=r4(a,Cx(n),rw(n),aw(n)),l=o==null?-1:Number(o);if(!(!Number.isFinite(l)||l<0)){var c=Cu(n);if(s==="Enter"){var d=Yk(n,"axis","hover",String(a.index));e.dispatch(kR({active:!a.active,activeIndex:a.index,activeCoordinate:d}));return}var u=bOe(n),m=u==="left-to-right"?1:-1,p=s==="ArrowRight"?1:-1,f=l+p*m;if(!(c==null||f>=c.length||f<0)){var y=Yk(n,"axis","hover",String(f));e.dispatch(kR({active:!0,activeIndex:f.toString(),activeCoordinate:y}))}}}}}});E4.startListening({actionCreator:Bne,effect:(t,e)=>{var n=e.getState(),r=n.rootProps.accessibilityLayer!==!1;if(r){var{keyboardInteraction:a}=n.tooltip;if(!a.active&&a.index==null){var s="0",o=Yk(n,"axis","hover",String(s));e.dispatch(kR({active:!0,activeIndex:s,activeCoordinate:o}))}}}});var el=Cl("externalEvent"),Hne=$0(),rj=new Map;Hne.startListening({actionCreator:el,effect:(t,e)=>{var{handler:n,reactEvent:r}=t.payload;if(n!=null){r.persist();var a=r.type,s=rj.get(a);s!==void 0&&cancelAnimationFrame(s);var o=requestAnimationFrame(()=>{try{var l=e.getState(),c={activeCoordinate:h4e(l),activeDataKey:l4(l),activeIndex:ch(l),activeLabel:_te(l),activeTooltipIndex:ch(l),isTooltipActive:p4e(l)};n(c,r)}finally{rj.delete(a)}});rj.set(a,o)}}});var YHe=pt([kx],t=>t.tooltipItemPayloads),XHe=pt([YHe,(t,e)=>e,(t,e,n)=>n],(t,e,n)=>{if(e!=null){var r=t.find(s=>s.settings.graphicalItemId===n);if(r!=null){var{getPosition:a}=r;if(a!=null)return a(e)}}}),$ne=Cl("touchMove"),qne=$0();qne.startListening({actionCreator:$ne,effect:(t,e)=>{var n=t.payload;if(!(n.touches==null||n.touches.length===0)){var r=e.getState(),a=n4(r,r.tooltip.settings.shared);if(a==="axis"){var s=n.touches[0];if(s==null)return;var o=A4(r,M4({clientX:s.clientX,clientY:s.clientY,currentTarget:n.currentTarget}));o?.activeIndex!=null&&e.dispatch(ute({activeIndex:o.activeIndex,activeDataKey:void 0,activeCoordinate:o.activeCoordinate}))}else if(a==="item"){var l,c=n.touches[0];if(document.elementFromPoint==null||c==null)return;var d=document.elementFromPoint(c.clientX,c.clientY);if(!d||!d.getAttribute)return;var u=d.getAttribute(rJ),m=(l=d.getAttribute(iJ))!==null&&l!==void 0?l:void 0,p=Nx(r).find(x=>x.id===m);if(u==null||p==null||m==null)return;var{dataKey:f}=p,y=XHe(r,u,m);e.dispatch(cte({activeDataKey:f,activeIndex:u,activeCoordinate:y,activeGraphicalItemId:m}))}}}});var QHe=kZ({brush:BUe,cartesianAxis:kUe,chartData:mIe,errorBars:QBe,graphicalItems:jze,layout:BEe,legend:Wje,options:oIe,polarAxis:G5e,polarOptions:KHe,referenceElements:YUe,rootProps:$He,tooltip:POe,zIndex:Y4e}),ZHe=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"Chart";return mEe({reducer:QHe,preloadedState:e,middleware:r=>{var a;return r({serializableCheck:!1,immutableCheck:!["commonjs","es6","production"].includes((a="es6")!==null&&a!==void 0?a:"")}).concat([Lne.middleware,One.middleware,E4.middleware,Hne.middleware,qne.middleware])},enhancers:r=>{var a=r;return typeof r=="function"&&(a=r()),a.concat(zZ({type:"raf"}))},devTools:{serialize:{replacer:HHe},name:"recharts-".concat(n)}})};function Vne(t){var{preloadedState:e,children:n,reduxStoreName:r}=t,a=va(),s=w.useRef(null);if(a)return n;s.current==null&&(s.current=ZHe(e,r));var o=$L;return w.createElement(N8e,{context:o,store:s.current},n)}function JHe(t){var{layout:e,margin:n}=t,r=Zr(),a=va();return w.useEffect(()=>{a||(r(IEe(e)),r(OEe(n)))},[r,a,e,n]),null}var Gne=w.memo(JHe,ow);function Wne(t){var e=Zr();return w.useEffect(()=>{e(qHe(t))},[e,t]),null}function cG(t){var{zIndex:e,isPanorama:n}=t,r=w.useRef(null),a=Zr();return w.useLayoutEffect(()=>(r.current&&a(W4e({zIndex:e,element:r.current,isPanorama:n})),()=>{a(K4e({zIndex:e,isPanorama:n}))}),[a,e,n]),w.createElement("g",{tabIndex:-1,ref:r})}function dG(t){var{children:e,isPanorama:n}=t,r=Kt(O4e);if(!r||r.length===0)return e;var a=r.filter(o=>o<0),s=r.filter(o=>o>0);return w.createElement(w.Fragment,null,a.map(o=>w.createElement(cG,{key:o,zIndex:o,isPanorama:n})),e,s.map(o=>w.createElement(cG,{key:o,zIndex:o,isPanorama:n})))}var e$e=["children"];function t$e(t,e){if(t==null)return{};var n,r,a=n$e(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(r=0;r<s.length;r++)n=s[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(a[n]=t[n])}return a}function n$e(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}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 r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},aN.apply(null,arguments)}var r$e={width:"100%",height:"100%",display:"block"},i$e=w.forwardRef((t,e)=>{var n=JL(),r=eO(),a=wJ();if(!Vc(n)||!Vc(r))return null;var{children:s,otherAttributes:o,title:l,desc:c}=t,d,u;return o!=null&&(typeof o.tabIndex=="number"?d=o.tabIndex:d=a?0:void 0,typeof o.role=="string"?u=o.role:u=a?"application":void 0),w.createElement(jL,aN({},o,{title:l,desc:c,role:u,tabIndex:d,width:n,height:r,style:r$e,ref:e}),s)}),a$e=t=>{var{children:e}=t,n=Kt(WC);if(!n)return null;var{width:r,height:a,y:s,x:o}=n;return w.createElement(jL,{width:r,height:a,x:o,y:s},e)},uG=w.forwardRef((t,e)=>{var{children:n}=t,r=t$e(t,e$e),a=va();return a?w.createElement(a$e,null,w.createElement(dG,{isPanorama:!0},n)):w.createElement(i$e,aN({ref:e},r),w.createElement(dG,{isPanorama:!1},n))});function s$e(){var t=Zr(),[e,n]=w.useState(null),r=Kt(rje);return w.useEffect(()=>{if(e!=null){var a=e.getBoundingClientRect(),s=a.width/e.offsetWidth;Ln(s)&&s!==r&&t(UEe(s))}},[e,t,r]),n}function mG(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),n.push.apply(n,r)}return n}function o$e(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?mG(Object(n),!0).forEach(function(r){l$e(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):mG(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function l$e(t,e,n){return(e=c$e(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function c$e(t){var e=d$e(t,"string");return typeof e=="symbol"?e:e+""}function d$e(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Zm(){return Zm=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Zm.apply(null,arguments)}var u$e=()=>(wIe(),null);function sN(t){if(typeof t=="number")return t;if(typeof t=="string"){var e=parseFloat(t);if(!Number.isNaN(e))return e}return 0}var m$e=w.forwardRef((t,e)=>{var n,r,a=w.useRef(null),[s,o]=w.useState({containerWidth:sN((n=t.style)===null||n===void 0?void 0:n.width),containerHeight:sN((r=t.style)===null||r===void 0?void 0:r.height)}),l=w.useCallback((d,u)=>{o(m=>{var p=Math.round(d),f=Math.round(u);return m.containerWidth===p&&m.containerHeight===f?m:{containerWidth:p,containerHeight:f}})},[]),c=w.useCallback(d=>{if(typeof e=="function"&&e(d),d!=null&&typeof ResizeObserver<"u"){var{width:u,height:m}=d.getBoundingClientRect();l(u,m);var p=y=>{var x=y[0];if(x!=null){var{width:b,height:v}=x.contentRect;l(b,v)}},f=new ResizeObserver(p);f.observe(d),a.current=f}},[e,l]);return w.useEffect(()=>()=>{var d=a.current;d?.disconnect()},[l]),w.createElement(w.Fragment,null,w.createElement(G0,{width:s.containerWidth,height:s.containerHeight}),w.createElement("div",Zm({ref:c},t)))}),h$e=w.forwardRef((t,e)=>{var{width:n,height:r}=t,[a,s]=w.useState({containerWidth:sN(n),containerHeight:sN(r)}),o=w.useCallback((c,d)=>{s(u=>{var m=Math.round(c),p=Math.round(d);return u.containerWidth===m&&u.containerHeight===p?u:{containerWidth:m,containerHeight:p}})},[]),l=w.useCallback(c=>{if(typeof e=="function"&&e(c),c!=null){var{width:d,height:u}=c.getBoundingClientRect();o(d,u)}},[e,o]);return w.createElement(w.Fragment,null,w.createElement(G0,{width:a.containerWidth,height:a.containerHeight}),w.createElement("div",Zm({ref:l},t)))}),p$e=w.forwardRef((t,e)=>{var{width:n,height:r}=t;return w.createElement(w.Fragment,null,w.createElement(G0,{width:n,height:r}),w.createElement("div",Zm({ref:e},t)))}),f$e=w.forwardRef((t,e)=>{var{width:n,height:r}=t;return typeof n=="string"||typeof r=="string"?w.createElement(h$e,Zm({},t,{ref:e})):typeof n=="number"&&typeof r=="number"?w.createElement(p$e,Zm({},t,{width:n,height:r,ref:e})):w.createElement(w.Fragment,null,w.createElement(G0,{width:n,height:r}),w.createElement("div",Zm({ref:e},t)))});function g$e(t){return t?m$e:f$e}var b$e=w.forwardRef((t,e)=>{var{children:n,className:r,height:a,onClick:s,onContextMenu:o,onDoubleClick:l,onMouseDown:c,onMouseEnter:d,onMouseLeave:u,onMouseMove:m,onMouseUp:p,onTouchEnd:f,onTouchMove:y,onTouchStart:x,style:b,width:v,responsive:_,dispatchTouchEvents:k=!0}=t,P=w.useRef(null),C=Zr(),[T,N]=w.useState(null),[R,A]=w.useState(null),D=s$e(),$=QL(),U=$?.width>0?$.width:v,G=$?.height>0?$.height:a,L=w.useCallback(E=>{D(E),typeof e=="function"&&e(E),N(E),A(E),E!=null&&(P.current=E)},[D,e,N,A]),te=w.useCallback(E=>{C(Fne(E)),C(el({handler:s,reactEvent:E}))},[C,s]),re=w.useCallback(E=>{C(OR(E)),C(el({handler:d,reactEvent:E}))},[C,d]),J=w.useCallback(E=>{C(dte()),C(el({handler:u,reactEvent:E}))},[C,u]),ue=w.useCallback(E=>{C(OR(E)),C(el({handler:m,reactEvent:E}))},[C,m]),me=w.useCallback(()=>{C(Bne())},[C]),ge=w.useCallback(E=>{C(Une(E.key))},[C]),X=w.useCallback(E=>{C(el({handler:o,reactEvent:E}))},[C,o]),ie=w.useCallback(E=>{C(el({handler:l,reactEvent:E}))},[C,l]),le=w.useCallback(E=>{C(el({handler:c,reactEvent:E}))},[C,c]),pe=w.useCallback(E=>{C(el({handler:p,reactEvent:E}))},[C,p]),Ce=w.useCallback(E=>{C(el({handler:x,reactEvent:E}))},[C,x]),q=w.useCallback(E=>{k&&C($ne(E)),C(el({handler:y,reactEvent:E}))},[C,k,y]),Z=w.useCallback(E=>{C(el({handler:f,reactEvent:E}))},[C,f]),j=g$e(_);return w.createElement(Ete.Provider,{value:T},w.createElement(UQ.Provider,{value:R},w.createElement(j,{width:U??b?.width,height:G??b?.height,className:pr("recharts-wrapper",r),style:o$e({position:"relative",cursor:"default",width:U,height:G},b),onClick:te,onContextMenu:X,onDoubleClick:ie,onFocus:me,onKeyDown:ge,onMouseDown:le,onMouseEnter:re,onMouseLeave:J,onMouseMove:ue,onMouseUp:pe,onTouchEnd:Z,onTouchMove:q,onTouchStart:Ce,ref:L},w.createElement(u$e,null),n)))}),x$e=["width","height","responsive","children","className","style","compact","title","desc"];function y$e(t,e){if(t==null)return{};var n,r,a=v$e(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(r=0;r<s.length;r++)n=s[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(a[n]=t[n])}return a}function v$e(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}var Kne=w.forwardRef((t,e)=>{var{width:n,height:r,responsive:a,children:s,className:o,style:l,compact:c,title:d,desc:u}=t,m=y$e(t,x$e),p=Is(m);return c?w.createElement(w.Fragment,null,w.createElement(G0,{width:n,height:r}),w.createElement(uG,{otherAttributes:p,title:d,desc:u},s)):w.createElement(b$e,{className:o,style:l,width:n,height:r,responsive:a??!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},w.createElement(uG,{otherAttributes:p,title:d,desc:u,ref:e},w.createElement(XUe,null,s)))});function IR(){return IR=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},IR.apply(null,arguments)}var w$e={top:5,right:5,bottom:5,left:5},S$e={accessibilityLayer:!0,barCategoryGap:"10%",barGap:4,layout:"horizontal",margin:w$e,responsive:!1,reverseStackOrder:!1,stackOffset:"none",syncMethod:"index"},j4=w.forwardRef(function(e,n){var r,a=ki(e.categoricalChartProps,S$e),{chartName:s,defaultTooltipEventType:o,validateTooltipEventTypes:l,tooltipPayloadSearcher:c,categoricalChartProps:d}=e,u={chartName:s,defaultTooltipEventType:o,validateTooltipEventTypes:l,tooltipPayloadSearcher:c,eventEmitter:void 0};return w.createElement(Vne,{preloadedState:{options:u},reduxStoreName:(r=d.id)!==null&&r!==void 0?r:s},w.createElement(ane,{chartData:d.data}),w.createElement(Gne,{layout:a.layout,margin:a.margin}),w.createElement(Wne,{baseValue:a.baseValue,accessibilityLayer:a.accessibilityLayer,barCategoryGap:a.barCategoryGap,maxBarSize:a.maxBarSize,stackOffset:a.stackOffset,barGap:a.barGap,barSize:a.barSize,syncId:a.syncId,syncMethod:a.syncMethod,className:a.className,reverseStackOrder:a.reverseStackOrder}),w.createElement(Kne,IR({},a,{ref:n})))}),_$e=["axis"],k$e=w.forwardRef((t,e)=>w.createElement(j4,{chartName:"LineChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:_$e,tooltipPayloadSearcher:fT,categoricalChartProps:t,ref:e})),N$e=["axis","item"],B_=w.forwardRef((t,e)=>w.createElement(j4,{chartName:"BarChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:N$e,tooltipPayloadSearcher:fT,categoricalChartProps:t,ref:e}));function C$e(t){var e=Zr();return w.useEffect(()=>{e(WHe(t))},[e,t]),null}var T$e=["layout"];function zR(){return zR=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},zR.apply(null,arguments)}function P$e(t,e){if(t==null)return{};var n,r,a=A$e(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(r=0;r<s.length;r++)n=s[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(a[n]=t[n])}return a}function A$e(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}var M$e={top:5,right:5,bottom:5,left:5},Yne={accessibilityLayer:!0,stackOffset:"none",barCategoryGap:"10%",barGap:4,margin:M$e,reverseStackOrder:!1,syncMethod:"index",layout:"radial",responsive:!1,cx:"50%",cy:"50%",innerRadius:0,outerRadius:"80%"},E$e=w.forwardRef(function(e,n){var r,a=ki(e.categoricalChartProps,Yne),{layout:s}=a,o=P$e(a,T$e),{chartName:l,defaultTooltipEventType:c,validateTooltipEventTypes:d,tooltipPayloadSearcher:u}=e,m={chartName:l,defaultTooltipEventType:c,validateTooltipEventTypes:d,tooltipPayloadSearcher:u,eventEmitter:void 0};return w.createElement(Vne,{preloadedState:{options:m},reduxStoreName:(r=a.id)!==null&&r!==void 0?r:l},w.createElement(ane,{chartData:a.data}),w.createElement(Gne,{layout:s,margin:a.margin}),w.createElement(Wne,{baseValue:void 0,accessibilityLayer:a.accessibilityLayer,barCategoryGap:a.barCategoryGap,maxBarSize:a.maxBarSize,stackOffset:a.stackOffset,barGap:a.barGap,barSize:a.barSize,syncId:a.syncId,syncMethod:a.syncMethod,className:a.className,reverseStackOrder:a.reverseStackOrder}),w.createElement(C$e,{cx:a.cx,cy:a.cy,startAngle:a.startAngle,endAngle:a.endAngle,innerRadius:a.innerRadius,outerRadius:a.outerRadius}),w.createElement(Kne,zR({},o,{ref:n})))});function hG(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),n.push.apply(n,r)}return n}function pG(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?hG(Object(n),!0).forEach(function(r){j$e(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):hG(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function j$e(t,e,n){return(e=D$e(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function D$e(t){var e=R$e(t,"string");return typeof e=="symbol"?e:e+""}function R$e(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var F$e=["item"],L$e=pG(pG({},Yne),{},{layout:"centric",startAngle:0,endAngle:360}),fG=w.forwardRef((t,e)=>{var n=ki(t,L$e);return w.createElement(E$e,{chartName:"PieChart",defaultTooltipEventType:"item",validateTooltipEventTypes:F$e,tooltipPayloadSearcher:fT,categoricalChartProps:n,ref:e})}),O$e=["axis"],I$e=w.forwardRef((t,e)=>w.createElement(j4,{chartName:"AreaChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:O$e,tooltipPayloadSearcher:fT,categoricalChartProps:t,ref:e}));const gG=[{value:"6h",label:"6h",hours:6},{value:"24h",label:"24h",hours:24},{value:"48h",label:"48h",hours:48},{value:"7d",label:"7d",hours:168}];function z$e({isOpen:t,onClose:e,printerId:n,printerName:r,amsId:a,amsLabel:s,initialMode:o="humidity",thresholds:l}){const{t:c}=Mt(),{mode:d}=bf(),[u,m]=w.useState("24h"),[p,f]=w.useState(o),y=d==="dark",{data:x}=Je({queryKey:["settings"],queryFn:be.getSettings}),b=x?.time_format||"system";w.useEffect(()=>{if(!t)return;const Z=j=>{j.key==="Escape"&&e()};return window.addEventListener("keydown",Z),()=>window.removeEventListener("keydown",Z)},[t,e]);const v=gG.find(Z=>Z.value===u)?.hours||24,{data:_,isLoading:k,error:P}=Je({queryKey:["ams-history",n,a,v],queryFn:()=>be.getAMSHistory(n,a,v),enabled:t,refetchInterval:6e4});if(!t)return null;const C=_?.data.map(Z=>({time:(Jn(Z.recorded_at)||new Date).getTime(),humidity:Z.humidity,temperature:Z.temperature}))||[],T=Date.now()-v*60*60*1e3,N=Date.now(),R=[...C];if(R.length>0){const Z=R[0];Z.time>T&&R.unshift({...Z,time:T});const j=R[R.length-1];j.time<N&&R.push({...j,time:N})}const A=l?.humidityGood||40,D=l?.humidityFair||60,$=l?.tempGood||30,U=l?.tempFair||35,G=R[R.length-1],L=G?.humidity,te=G?.temperature,re=Z=>{const j=Z.filter(z=>z!=null);if(j.length<4)return"stable";const E=j.slice(0,Math.floor(j.length/4)),I=j.slice(-Math.floor(j.length/4)),W=E.reduce((z,V)=>z+V,0)/E.length,ae=I.reduce((z,V)=>z+V,0)/I.length-W;return Math.abs(ae)<2?"stable":ae>0?"up":"down"},J=re(R.map(Z=>Z.humidity)),ue=re(R.map(Z=>Z.temperature)),me=({trend:Z})=>Z==="up"?i.jsx(MD,{className:"w-4 h-4 text-red-400"}):Z==="down"?i.jsx(XF,{className:"w-4 h-4 text-green-400"}):i.jsx(V1,{className:"w-4 h-4 text-gray-400 dark:text-bambu-gray"}),ge=Z=>Z==null?"#9ca3af":Z<=A?"#22a352":Z<=D?"#d4a017":"#c62828",X=Z=>Z==null?"#9ca3af":Z<=$?"#22a352":Z<=U?"#d4a017":"#c62828",ie=y?"#2d2d2d":"#ffffff",le=y?"#1d1d1d":"#f3f4f6",pe=y?"#3d3d3d":"#e5e7eb",Ce=y?"#ffffff":"#111827",q=y?"#9ca3af":"#4b5563";return i.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",onClick:e,children:i.jsxs("div",{className:"rounded-xl w-full max-w-4xl max-h-[90vh] overflow-hidden shadow-xl",style:{backgroundColor:ie},onClick:Z=>Z.stopPropagation(),children:[i.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b",style:{borderColor:pe},children:[i.jsxs("div",{children:[i.jsxs("h2",{className:"text-lg font-semibold",style:{color:Ce},children:[s," ",c("common.history","History")]}),i.jsx("p",{className:"text-sm",style:{color:q},children:r})]}),i.jsx("button",{onClick:e,className:"p-2 rounded-lg transition-colors",style:{color:q},children:i.jsx(zt,{className:"w-5 h-5"})})]}),i.jsxs("div",{className:"p-6 space-y-6 overflow-y-auto max-h-[calc(90vh-80px)]",children:[i.jsxs("div",{className:"flex items-center justify-between max-[550px]:flex-col max-[550px]:items-start max-[550px]:gap-3",children:[i.jsxs("div",{className:"inline-flex gap-1 rounded-lg p-1 max-w-full flex-wrap w-fit",style:{backgroundColor:le},children:[i.jsxs("button",{onClick:()=>f("humidity"),className:`flex items-center gap-2 px-3 py-1.5 text-sm rounded-md transition-colors ${p==="humidity"?"bg-blue-600 text-white":""}`,style:p!=="humidity"?{color:q}:void 0,children:[i.jsx(GF,{className:"w-4 h-4"}),c("common.humidity","Humidity")]}),i.jsxs("button",{onClick:()=>f("temperature"),className:`flex items-center gap-2 px-3 py-1.5 text-sm rounded-md transition-colors ${p==="temperature"?"bg-orange-600 text-white":""}`,style:p!=="temperature"?{color:q}:void 0,children:[i.jsx(xC,{className:"w-4 h-4"}),c("common.temperature","Temperature")]})]}),i.jsx("div",{className:"inline-flex gap-1 rounded-lg p-1 max-w-full flex-wrap w-fit",style:{backgroundColor:le},children:gG.map(Z=>i.jsx("button",{onClick:()=>m(Z.value),className:`px-3 py-1 text-sm rounded-md transition-colors ${u===Z.value?"bg-bambu-green text-white":""}`,style:u!==Z.value?{color:q}:void 0,children:Z.label},Z.value))})]}),i.jsx("div",{className:"grid grid-cols-4 gap-4 max-[550px]:grid-cols-2",children:p==="humidity"?i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"rounded-lg p-4 max-[550px]:order-2",style:{backgroundColor:le},children:[i.jsx("p",{className:"text-xs",style:{color:q},children:c("common.current","Current")}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("p",{className:"text-2xl font-bold",style:{color:ge(L)},children:L!=null?`${L}%`:"—"}),i.jsx(me,{trend:J})]})]}),i.jsxs("div",{className:"rounded-lg p-4 max-[550px]:order-4",style:{backgroundColor:le},children:[i.jsx("p",{className:"text-xs",style:{color:q},children:c("common.average","Average")}),i.jsx("p",{className:"text-2xl font-bold",style:{color:Ce},children:_?.avg_humidity!=null?`${_.avg_humidity}%`:"—"})]}),i.jsxs("div",{className:"rounded-lg p-4 max-[550px]:order-1",style:{backgroundColor:le},children:[i.jsx("p",{className:"text-xs",style:{color:q},children:c("common.min","Min")}),i.jsx("p",{className:"text-2xl font-bold text-green-500",children:_?.min_humidity!=null?`${_.min_humidity}%`:"—"})]}),i.jsxs("div",{className:"rounded-lg p-4 max-[550px]:order-3",style:{backgroundColor:le},children:[i.jsx("p",{className:"text-xs",style:{color:q},children:c("common.max","Max")}),i.jsx("p",{className:"text-2xl font-bold text-red-500",children:_?.max_humidity!=null?`${_.max_humidity}%`:"—"})]})]}):i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"rounded-lg p-4 max-[550px]:order-2",style:{backgroundColor:le},children:[i.jsx("p",{className:"text-xs",style:{color:q},children:c("common.current","Current")}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("p",{className:"text-2xl font-bold",style:{color:X(te)},children:te!=null?`${te}°C`:"—"}),i.jsx(me,{trend:ue})]})]}),i.jsxs("div",{className:"rounded-lg p-4 max-[550px]:order-4",style:{backgroundColor:le},children:[i.jsx("p",{className:"text-xs",style:{color:q},children:c("common.average","Average")}),i.jsx("p",{className:"text-2xl font-bold",style:{color:Ce},children:_?.avg_temperature!=null?`${_.avg_temperature}°C`:"—"})]}),i.jsxs("div",{className:"rounded-lg p-4 max-[550px]:order-1",style:{backgroundColor:le},children:[i.jsx("p",{className:"text-xs",style:{color:q},children:c("common.min","Min")}),i.jsx("p",{className:"text-2xl font-bold text-blue-500",children:_?.min_temperature!=null?`${_.min_temperature}°C`:"—"})]}),i.jsxs("div",{className:"rounded-lg p-4 max-[550px]:order-3",style:{backgroundColor:le},children:[i.jsx("p",{className:"text-xs",style:{color:q},children:c("common.max","Max")}),i.jsx("p",{className:"text-2xl font-bold text-red-500",children:_?.max_temperature!=null?`${_.max_temperature}°C`:"—"})]})]})}),i.jsx("div",{className:"rounded-lg p-4",style:{backgroundColor:le},children:k?i.jsx("div",{className:"h-[300px] flex items-center justify-center",style:{color:q},children:c("common.loading","Loading...")}):P?i.jsx("div",{className:"h-[300px] flex items-center justify-center text-red-500",children:c("common.error","Error loading data")}):R.length===0?i.jsx("div",{className:"h-[300px] flex items-center justify-center",style:{color:q},children:c("common.noData","No data available for this time range")}):i.jsx(Fm,{width:"100%",height:300,children:i.jsxs(k$e,{data:R,children:[i.jsx(xp,{strokeDasharray:"3 3",stroke:y?"#3d3d3d":"#e5e7eb"}),i.jsx(yp,{dataKey:"time",type:"number",domain:[Date.now()-v*60*60*1e3,Date.now()],tickFormatter:Z=>{const j=new Date(Z);return v>24?j.toLocaleDateString([],{day:"numeric",month:"short"}):j.toLocaleTimeString([],Iv({hour:"2-digit",minute:"2-digit"},b))},stroke:y?"#9ca3af":"#6b7280",tick:{fontSize:12}}),i.jsx(vp,{stroke:y?"#9ca3af":"#6b7280",tick:{fontSize:12},domain:p==="humidity"?[0,100]:["auto","auto"],tickFormatter:Z=>p==="humidity"?`${Z}%`:`${Z}°C`}),i.jsx(Lm,{contentStyle:{backgroundColor:y?"#2d2d2d":"#ffffff",border:`1px solid ${y?"#3d3d3d":"#e5e7eb"}`,borderRadius:"8px",color:y?"#fff":"#000"},labelFormatter:Z=>new Date(Z).toLocaleString(void 0,Iv({year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"},b)),formatter:Z=>[p==="humidity"?`${Z??0}%`:`${Z??0}°C`,p==="humidity"?"Humidity":"Temperature"]}),i.jsx(vJ,{}),p==="humidity"?i.jsxs(i.Fragment,{children:[i.jsx(Qy,{y:A,stroke:"#22a352",strokeDasharray:"5 5",label:{value:"Good",fill:"#22a352",fontSize:10}}),i.jsx(Qy,{y:D,stroke:"#d4a017",strokeDasharray:"5 5",label:{value:"Fair",fill:"#d4a017",fontSize:10}})]}):i.jsxs(i.Fragment,{children:[i.jsx(Qy,{y:$,stroke:"#22a352",strokeDasharray:"5 5",label:{value:"Good",fill:"#22a352",fontSize:10}}),i.jsx(Qy,{y:U,stroke:"#d4a017",strokeDasharray:"5 5",label:{value:"Fair",fill:"#d4a017",fontSize:10}})]}),i.jsx(vne,{type:"monotone",dataKey:p,name:p==="humidity"?"Humidity":"Temperature",stroke:p==="humidity"?"#3b82f6":"#f97316",strokeWidth:2,dot:!1,activeDot:{r:4},connectNulls:!0})]})})}),i.jsx("div",{className:"text-xs text-center",style:{color:q},children:c("amsHistory.recordingInfo","Data is recorded every 5 minutes while the printer is connected")})]})]})})}const oN={"000000":"Black","001489":"Blue","002e96":"Blue","0047bb":"Blue","00482b":"Pine Green","004ea8":"Blue","0056b8":"Cobalt Blue","0069b1":"Lake Blue","0072ce":"Blue","0078bf":"Marine Blue","0085ad":"Light Blue","0086d6":"Cyan","008bda":"Blue","009639":"Green","009bd8":"Cyan","009fa1":"Teal","00a6a0":"Green","00ae42":"Bambu Green","00b1b7":"Turquoise","00bb31":"Green","018814":"Candy Green","042f56":"Dark Blue","0a2989":"Blue","0a2ca5":"Blue","0c2340":"Navy Blue","0c3b95":"Blue",101820:"Black","147bd1":"Blue","164b35":"Green","16b08e":"Malachite Green","1d7c6a":"Oxide Green Metallic","1f79e5":"Lake Blue","2140b4":"Blue","25282a":"Black","2842ad":"Royal Blue","2d2b28":"Onyx Black Sparkle",324585:"Indigo Blue",353533:"Gray","39541a":"Forest Green","39699e":"Cobalt Blue Metallic","3b665e":"Green","3f5443":"Alpine Green Sparkle","3f8e43":"Mistletoe Green",424379:"Nebulae","43403d":"Iron Gray Metallic",482960:"Indigo Purple","483d8b":"Royal Purple Sparkle","489fdf":"Azure","4c241c":"Rosewood","4ce4a0":"Green","4d3324":"Dark Chocolate","4d5054":"Lava Gray","4dafda":"Cyan","4f3f24":"Black Walnut",515151:"Dark Gray","515a6c":"Gray",545454:"Dark Gray",565656:"Titan Gray","56b7e6":"Sky Blue",583061:"Violet Purple","5898dd":"Blue",594177:"Purple","5b492f":"Brown","5b6579":"Blue Gray","5c9748":"Matcha Green","5e43b7":"Purple","5e4b3c":"Copper","5f6367":"Titan Gray","61b0ff":"Translucent Light Blue","61bf36":"Green","61c680":"Grass Green","6667ab":"Lavender Blue","684a43":"Brown",686865:"Black","68724d":"Dark Green",688197:"Blue Gray","69398e":"Iris Purple","6e88bc":"Jeans Blue","6ee53c":"Lime Green","6f5034":"Cocoa Brown","7248bd":"Lavender","748c45":"Translucent Olive",757575:"Nardo Gray","75aed8":"Blue","77edd7":"Translucent Teal","789d4a":"Olive","792b36":"Crimson Red Sparkle","7ac0e9":"Glow Blue","7ae1bf":"Mint","7cd82b":"Lime Green","7d6556":"Dark Brown","8344b0":"Purple","847d48":"Bronze","854ce4":"Purple","8671cb":"Purple",875718:"Peanut Brown","87909a":"Silver","898d8d":"Gray","8a949e":"Gray","8e8e8e":"Translucent Gray","8e9089":"Gray","90ff1a":"Neon Green",918669:"Classic Birch",939393:"Gray",950051:"Plum","951e23":"Burgundy Red",959698:"Silver","96d8af":"Light Jade","96dcb9":"Mint","995f11":"Clay Brown","999d9d":"Gray","9b9ea0":"Ash Gray","9d2235":"Maroon Red","9d432c":"Brown","9e007e":"Purple","9ea2a2":"Gray","9f332a":"Brick Red",a1ffac:"Glow Green",a3d8e1:"Ice Blue",a6a9aa:"Silver",a8a8aa:"Gray",a8c6ee:"Baby Blue",aa6443:"Copper Brown Metallic",ad4e38:"Red Granite",adb1b2:"Gray",ae835b:"Caramel",ae96d4:"Lilac Purple",af1685:"Purple",afb1ae:"Gray",b15533:"Terracotta",b28b33:"Gold",b39b84:"Iridium Gold Metallic",b50011:"Red",b8acd6:"Lavender",b8cde9:"Ice Blue",ba9594:"Rose Gold",bb3d43:"Dark Red",bc0900:"Red",becf00:"Bright Green",c0df16:"Green",c12e1f:"Red",c2e189:"Apple Green",c3e2d6:"Light Cyan",c5ed48:"Lime",c6001a:"Red",c6c6c6:"Gray",c8102e:"Red",c8c8c8:"Silver",c98935:"Ochre Yellow",c9a381:"Translucent Brown",cbc6b8:"Bone White",cdceca:"Gray",cea629:"Classic Gold Sparkle",d02727:"Candy Red",d1d3d5:"Light Gray",d32941:"Red",d3b7a7:"Latte Brown",d6001c:"Red",d6abff:"Translucent Purple",d6cca3:"White Oak",dc3a27:"Orange",dd3c22:"Vermilion Red",de4343:"Scarlet Red",dfd1a7:"Beige",e02928:"Red",e4bd68:"Gold",e5b03d:"Gold",e83100:"Red",e8afcf:"Sakura Pink",e8dbb7:"Desert Tan",eaeae4:"White",eaeceb:"Silver",ec008c:"Magenta",ed0000:"Red",eeb1c1:"Pink",efe255:"Yellow",f0f1a8:"Clear",f17b8f:"Glow Pink",f3cfb2:"Champagne",f3e600:"Yellow",f48438:"Orange",f4a925:"Gold",f4d53f:"Yellow",f4ee2a:"Yellow",f5547c:"Hot Pink",f55a74:"Pink",f5b6cd:"Cherry Pink",f5dbab:"Mellow Yellow",f5f1dd:"White",f68b1b:"Neon Orange",f74e02:"Orange",f75403:"Orange",f7ada6:"Pink",f7d959:"Lemon Yellow",f7e6de:"Beige",f7f3f0:"White Marble",f8ff80:"Glow Yellow",f99963:"Mandarin Orange",f9c1bd:"Translucent Pink",f9dfb9:"Cream",f9ef41:"Yellow",f9f7f2:"Nature",f9f7f4:"White",fce300:"Yellow",fce900:"Yellow",fec600:"Sunflower Yellow",fedb00:"Yellow",ff4800:"Orange",ff671f:"Orange",ff6a13:"Orange",ff7f41:"Orange",ff9016:"Pumpkin Orange",ff911a:"Translucent Orange",ff9d5b:"Glow Orange",ffb549:"Sunflower Yellow",ffc72c:"Tangerine Yellow",ffce00:"Yellow",ffd00b:"Yellow",ffe133:"Yellow",fffaf2:"White",ffffff:"White"};function C1(t){if(!t||t.length<6)return"Unknown";const e=t.replace("#",""),n=parseInt(e.substring(0,2),16),r=parseInt(e.substring(2,4),16),a=parseInt(e.substring(4,6),16),s=Math.max(n,r,a)/255,o=Math.min(n,r,a)/255,l=(s+o)/2;let c=0,d=0;if(s!==o){const u=s-o;d=l>.5?u/(2-s-o):u/(s+o);const m=n/255,p=r/255,f=a/255;s===m?c=((p-f)/u+(p<f?6:0))/6:s===p?c=((f-m)/u+2)/6:c=((m-p)/u+4)/6}return c=c*360,l<.15?"Black":l>.85?"White":d<.15?l<.4?"Dark Gray":l>.6?"Light Gray":"Gray":c>=15&&c<45&&l<.45||c>=45&&c<70&&l<.4?"Brown":c<15||c>=345?"Red":c<45?"Orange":c<70?"Yellow":c<150?"Green":c<200?"Cyan":c<260?"Blue":c<290?"Purple":"Pink"}function ru(t){const e=t.replace("#","").toLowerCase().substring(0,6);return oN[e]?oN[e]:C1(t)}function D4(t,e){if(t&&!/^[A-Z]\d+-[A-Z]\d+$/.test(t))return t;if(e&&e.length>=6){const n=e.substring(0,6).toLowerCase();if(oN[n])return oN[n]}return null}function R4(t){if(!t||t==="00000000"||t.length<6)return null;const e=t.slice(0,2),n=t.slice(2,4),r=t.slice(4,6),a=t.length>=8?parseInt(t.slice(6,8),16)/255:1;return a===0?null:`rgba(${parseInt(e,16)}, ${parseInt(n,16)}, ${parseInt(r,16)}, ${a})`}function Xne(t){if(!t||t.length<6)return!1;const e=t.replace("#",""),n=parseInt(e.slice(0,2),16),r=parseInt(e.slice(2,4),16),a=parseInt(e.slice(4,6),16);return(.299*n+.587*r+.114*a)/255>.6}function ij({data:t,children:e,disabled:n,className:r="",spoolman:a,inventory:s,configureSlot:o}){const{t:l}=Mt(),[c,d]=w.useState(!1),[u,m]=w.useState("top"),[p,f]=w.useState(!1),[y,x]=w.useState(!1),b=w.useRef(null),v=w.useRef(null),_=w.useRef(null),k=()=>{const D=t.trayUuid;D&&(navigator.clipboard&&window.isSecureContext?navigator.clipboard.writeText(D).then(()=>{f(!0),setTimeout(()=>f(!1),2e3)}).catch(()=>{P(D)}):P(D))},P=D=>{const $=document.createElement("textarea");$.value=D,$.style.position="fixed",$.style.opacity="0",document.body.appendChild($),$.select();try{document.execCommand("copy"),f(!0),setTimeout(()=>f(!1),2e3)}catch{console.error("Failed to copy to clipboard")}document.body.removeChild($)};w.useEffect(()=>{if(c&&b.current&&v.current){const D=b.current.getBoundingClientRect(),$=v.current.offsetHeight,G=D.top-56,L=window.innerHeight-D.bottom;G<$+12&&L>G?m("bottom"):m("top")}},[c]);const C=()=>{n||(_.current&&clearTimeout(_.current),_.current=setTimeout(()=>d(!0),80))},T=()=>{_.current&&clearTimeout(_.current),_.current=setTimeout(()=>d(!1),100)};w.useEffect(()=>()=>{_.current&&clearTimeout(_.current)},[]);const N=D=>D<=15?"#ef4444":D<=30?"#f97316":D<=50?"#eab308":"#22c55e",R=t.colorHex?`#${t.colorHex.replace("#","")}`:null,A=s?.assignedSpool?.remainingWeightGrams??null;return i.jsxs("div",{ref:b,className:`relative ${r}`,onMouseEnter:C,onMouseLeave:T,children:[e,c&&i.jsxs("div",{ref:v,className:`
- absolute left-1/2 -translate-x-1/2 z-50
- ${u==="top"?"bottom-full mb-2":"top-full mt-2"}
- animate-in fade-in-0 zoom-in-95 duration-150
- `,style:{maxWidth:"calc(100vw - 24px)"},children:[i.jsxs("div",{className:`
- w-52 bg-bambu-dark-secondary border border-bambu-dark-tertiary
- rounded-lg shadow-xl overflow-hidden
- backdrop-blur-sm
- `,children:[i.jsxs("div",{className:"h-12 relative overflow-hidden",style:{backgroundColor:R||"#3d3d3d"},children:[i.jsx("div",{className:"absolute inset-0 bg-gradient-to-b from-white/10 to-transparent"}),i.jsx("div",{className:`
- absolute inset-0 flex items-center justify-center
- font-semibold text-sm tracking-wide
- ${Xne(R)?"text-black/80":"text-white/90"}
- `,children:t.colorName}),i.jsx("div",{className:`
- absolute top-1.5 right-1.5 px-1.5 py-0.5 rounded text-[9px] font-bold uppercase tracking-wider
- ${t.vendor==="Bambu Lab"?"bg-black/60 text-white":"bg-black/50 text-white/90"}
- `,children:t.vendor==="Bambu Lab"?"BBL":"GEN"})]}),i.jsxs("div",{className:"p-3 space-y-2.5",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("span",{className:"text-[10px] uppercase tracking-wider text-bambu-gray font-medium",children:l("ams.profile")}),i.jsx("span",{className:"text-xs text-white font-semibold truncate max-w-[120px]",children:t.profile})]}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("span",{className:"text-[10px] uppercase tracking-wider text-bambu-gray font-medium",children:l("ams.kFactor")}),i.jsx("span",{className:"text-xs text-bambu-green font-mono font-bold",children:t.kFactor})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("span",{className:"text-[10px] uppercase tracking-wider text-bambu-gray font-medium flex items-center gap-1",children:[i.jsx(GF,{className:"w-3 h-3"}),l("ams.fill")]}),i.jsxs("span",{className:"text-xs text-white font-semibold flex items-center gap-1",children:[i.jsx("span",{children:t.fillLevel!==null?`${t.fillLevel}%`:"—"}),A!==null&&t.fillLevel!==null&&i.jsxs("span",{className:"text-[9px] text-bambu-gray font-normal",children:["• ",A,"g"]}),t.fillSource==="spoolman"&&t.fillLevel!==null&&i.jsx("span",{className:"text-[9px] text-bambu-gray font-normal",children:l("spoolman.fillSourceLabel")}),t.fillSource==="inventory"&&t.fillLevel!==null&&i.jsx("span",{className:"text-[9px] text-bambu-gray font-normal",children:l("inventory.fillSourceLabel")})]})]}),i.jsx("div",{className:"h-1.5 bg-black/40 rounded-full overflow-hidden",children:t.fillLevel!==null?i.jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${t.fillLevel}%`,backgroundColor:N(t.fillLevel)}}):i.jsx("div",{className:"h-full w-full bg-bambu-gray/30 rounded-full"})})]}),a?.enabled&&i.jsxs("div",{className:"pt-2 mt-2 border-t border-bambu-dark-tertiary space-y-2",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("span",{className:"text-[10px] uppercase tracking-wider text-bambu-gray font-medium",children:l("spoolman.spoolId")}),t.trayUuid?i.jsxs("button",{onClick:D=>{D.stopPropagation(),k()},className:"flex items-center gap-1 text-xs text-bambu-gray hover:text-white transition-colors",title:"Copy spool UUID",children:[i.jsxs("span",{className:"font-mono text-[10px] truncate max-w-[80px]",children:[t.trayUuid.slice(0,8),"..."]}),p?i.jsx(Vr,{className:"w-3 h-3 text-bambu-green"}):i.jsx(wl,{className:"w-3 h-3"})]}):i.jsx("span",{className:"text-[10px] text-bambu-gray",children:"—"})]}),a.linkedSpoolId&&a.spoolmanUrl&&i.jsxs(i.Fragment,{children:[i.jsxs("a",{href:`${a.spoolmanUrl.replace(/\/$/,"")}/spool/show/${a.linkedSpoolId}`,target:"_blank",rel:"noopener noreferrer",onClick:D=>D.stopPropagation(),className:"w-full flex items-center justify-center gap-1.5 px-2 py-1.5 text-xs font-medium rounded transition-colors bg-bambu-green/20 hover:bg-bambu-green/30 text-bambu-green",title:l("spoolman.openInSpoolman"),children:[i.jsx(ei,{className:"w-3.5 h-3.5"}),l("spoolman.openInSpoolman")]}),a.onUnlinkSpool&&t.vendor!=="Bambu Lab"&&i.jsxs("button",{onClick:D=>{D.stopPropagation(),x(!0)},className:"w-full flex items-center justify-center gap-1.5 px-2 py-1.5 text-xs font-medium rounded transition-colors bg-red-500/20 hover:bg-red-500/30 text-red-400",title:l("spoolman.unlinkSpool"),children:[i.jsx(Ov,{className:"w-3.5 h-3.5"}),l("spoolman.unlinkSpool")]})]}),!a.linkedSpoolId&&i.jsxs("button",{onClick:D=>{D.stopPropagation(),a.onLinkSpool&&a.onLinkSpool?.()},disabled:!a.onLinkSpool,className:`w-full flex items-center justify-center gap-1.5 px-2 py-1.5 text-xs font-medium rounded transition-colors ${a.onLinkSpool?"bg-bambu-green/20 hover:bg-bambu-green/30 text-bambu-green":"bg-bambu-gray/10 text-bambu-gray cursor-not-allowed"}`,children:[i.jsx(Vm,{className:"w-3.5 h-3.5"}),l("spoolman.linkToSpoolman")]})]}),s&&t.vendor!=="Bambu Lab"&&i.jsx("div",{className:"pt-2 mt-2 border-t border-bambu-dark-tertiary space-y-2",children:s.assignedSpool?i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx(sa,{className:"w-3 h-3 text-bambu-green"}),i.jsx("span",{className:"text-[10px] uppercase tracking-wider text-bambu-gray font-medium",children:l("inventory.assigned")})]}),i.jsxs("p",{className:"text-xs text-white truncate",children:[s.assignedSpool.brand?`${s.assignedSpool.brand} `:"",s.assignedSpool.material,s.assignedSpool.color_name?` - ${s.assignedSpool.color_name}`:""]}),s.onUnassignSpool&&i.jsxs("button",{onClick:D=>{D.stopPropagation(),s.onUnassignSpool?.()},className:"w-full flex items-center justify-center gap-1.5 px-2 py-1.5 text-xs font-medium rounded transition-colors bg-red-500/20 hover:bg-red-500/30 text-red-400",children:[i.jsx(Ov,{className:"w-3.5 h-3.5"}),l("inventory.unassignSpool")]})]}):s.onAssignSpool?i.jsxs("button",{onClick:D=>{D.stopPropagation(),s.onAssignSpool?.()},className:"w-full flex items-center justify-center gap-1.5 px-2 py-1.5 text-xs font-medium rounded transition-colors bg-bambu-blue/20 hover:bg-bambu-blue/30 text-bambu-blue",children:[i.jsx(sa,{className:"w-3.5 h-3.5"}),l("inventory.assignSpool")]}):null}),o?.enabled&&i.jsx("div",{className:`${a?.enabled&&t.trayUuid?"":"pt-2 mt-2 border-t border-bambu-dark-tertiary"}`,children:i.jsxs("button",{onClick:D=>{D.stopPropagation(),o.onConfigure?.()},className:"w-full flex items-center justify-center gap-1.5 px-2 py-1.5 text-xs font-medium rounded transition-colors bg-bambu-blue/20 hover:bg-bambu-blue/30 text-bambu-blue",title:l("ams.configureSlot"),children:[i.jsx(lu,{className:"w-3.5 h-3.5"}),l("ams.configure")]})})]})]}),i.jsx("div",{className:`
- absolute left-1/2 -translate-x-1/2 w-0 h-0
- border-l-[6px] border-l-transparent
- border-r-[6px] border-r-transparent
- ${u==="top"?"top-full border-t-[6px] border-t-bambu-dark-tertiary":"bottom-full border-b-[6px] border-b-bambu-dark-tertiary"}
- `})]}),y&&i.jsxs("div",{className:"fixed inset-0 z-[100] flex items-center justify-center",onClick:()=>x(!1),children:[i.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm"}),i.jsx("div",{className:"relative bg-bambu-dark-secondary rounded-lg shadow-xl w-full max-w-sm mx-4 border border-bambu-dark-tertiary",onClick:D=>D.stopPropagation(),children:i.jsxs("div",{className:"p-4 space-y-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("h3",{className:"text-base font-semibold text-white",children:l("spoolman.unlinkConfirmTitle")}),i.jsx("p",{className:"text-sm text-bambu-gray",children:l("spoolman.unlinkConfirmMessage")})]}),i.jsxs("div",{className:"flex gap-2",children:[i.jsx("button",{onClick:()=>x(!1),className:"flex-1 px-3 py-2 text-sm font-medium rounded transition-colors bg-bambu-dark hover:bg-bambu-dark-tertiary text-white",children:l("common.cancel")}),i.jsx("button",{onClick:()=>{a?.onUnlinkSpool?.(),x(!1)},className:"flex-1 px-3 py-2 text-sm font-medium rounded transition-colors bg-red-500/20 hover:bg-red-500/30 text-red-400",children:l("spoolman.unlinkSpool")})]})]})})]})]})}function aj({children:t,className:e="",configureSlot:n}){const{t:r}=Mt(),[a,s]=w.useState(!1),o=w.useRef(null),l=()=>{o.current&&clearTimeout(o.current),o.current=setTimeout(()=>s(!0),80)},c=()=>{o.current&&clearTimeout(o.current),o.current=setTimeout(()=>s(!1),100)};return w.useEffect(()=>()=>{o.current&&clearTimeout(o.current)},[]),i.jsxs("div",{className:`relative ${e}`,onMouseEnter:l,onMouseLeave:c,children:[t,a&&i.jsxs("div",{className:`
- absolute left-1/2 -translate-x-1/2 bottom-full mb-2 z-50
- animate-in fade-in-0 zoom-in-95 duration-150
- `,children:[i.jsxs("div",{className:`
- bg-bambu-dark-secondary border border-bambu-dark-tertiary
- rounded-md shadow-lg overflow-hidden
- `,children:[i.jsx("div",{className:"px-3 py-1.5 text-xs text-bambu-gray whitespace-nowrap",children:r("ams.emptySlot")}),n?.enabled&&i.jsx("div",{className:"px-2 pb-2",children:i.jsxs("button",{onClick:d=>{d.stopPropagation(),n.onConfigure?.()},className:"w-full flex items-center justify-center gap-1.5 px-2 py-1.5 text-xs font-medium rounded transition-colors bg-bambu-blue/20 hover:bg-bambu-blue/30 text-bambu-blue",title:r("ams.configureSlot"),children:[i.jsx(lu,{className:"w-3.5 h-3.5"}),r("ams.configure")]})})]}),i.jsx("div",{className:`
- absolute left-1/2 -translate-x-1/2 top-full w-0 h-0
- border-l-[5px] border-l-transparent
- border-r-[5px] border-r-transparent
- border-t-[5px] border-t-bambu-dark-tertiary
- `})]})]})}function U$e({isOpen:t,onClose:e,tagUid:n,trayUuid:r,printerId:a,amsId:s,trayId:o}){const{t:l}=Mt(),c=tn(),{showToast:d}=bn(),[u,m]=w.useState(""),p=n||r,{data:f,isLoading:y}=Je({queryKey:["unlinked-spools"],queryFn:be.getUnlinkedSpools,enabled:t}),x=w.useMemo(()=>f?f.filter(v=>{if(!u)return!0;const _=u.toLowerCase();return v.filament_name&&v.filament_name.toLowerCase().includes(_)||v.filament_material&&v.filament_material.toLowerCase().includes(_)||String(v.id).includes(_)}):[],[f,u]),b=ut({mutationFn:v=>be.linkSpool(v,{spoolTag:p,printerId:a,amsId:s,trayId:o}),onSuccess:()=>{c.invalidateQueries({queryKey:["unlinked-spools"]}),c.invalidateQueries({queryKey:["linked-spools"]}),d(l("spoolman.linkSuccess"),"success"),e()},onError:v=>{d(v.message||l("spoolman.linkFailed"),"error")}});return t?i.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[i.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:e}),i.jsxs("div",{className:"relative bg-bambu-dark-secondary rounded-xl shadow-xl w-full max-w-md mx-4 max-h-[80vh] flex flex-col border border-bambu-dark-tertiary",children:[i.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-white/10",children:[i.jsxs("div",{children:[i.jsxs("h3",{className:"text-lg font-semibold text-white flex items-center gap-2",children:[i.jsx(dx,{className:"w-5 h-5 text-bambu-green"}),l("spoolman.selectSpool")]}),i.jsxs("p",{className:"text-xs text-bambu-gray mt-1",children:["AMS ",s," T",o," · Printer #",a]})]}),i.jsx("button",{onClick:e,className:"p-1 text-bambu-gray hover:text-white rounded transition-colors",children:i.jsx(zt,{className:"w-5 h-5"})})]}),i.jsxs("div",{className:"p-4 border-b border-white/10",children:[i.jsxs("div",{className:"relative",children:[i.jsx(Dr,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray"}),i.jsx("input",{type:"text",value:u,onChange:v=>m(v.target.value),placeholder:l("inventory.searchSpools"),className:"w-full pl-9 pr-3 py-2 bg-bambu-dark rounded-lg border border-white/10 text-white text-sm placeholder:text-bambu-gray focus:outline-none focus:border-bambu-green"})]}),(n||r)&&i.jsxs("p",{className:"text-xs text-bambu-gray mt-2 font-mono truncate",title:n||r,children:["Tag: ",n||r]})]}),i.jsx("div",{className:"flex-1 overflow-y-auto p-2 min-h-0",children:y?i.jsx("div",{className:"flex justify-center py-8",children:i.jsx(ct,{className:"w-6 h-6 animate-spin text-bambu-green"})}):x.length===0?i.jsx("p",{className:"text-center text-bambu-gray py-8 text-sm",children:l("inventory.noSpoolsMatch")}):x.map(v=>i.jsxs("button",{onClick:()=>b.mutate(v.id),disabled:b.isPending||!p,className:"w-full flex items-center gap-3 p-3 rounded-lg hover:bg-white/5 transition-colors text-left",children:[i.jsx("span",{className:"w-6 h-6 rounded-full border border-white/20 flex-shrink-0",style:{backgroundColor:v.filament_color_hex?`#${v.filament_color_hex}`:"#808080"}}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsx("div",{className:"text-sm text-white font-medium truncate",children:v.filament_name||l("spoolman.spoolId")}),i.jsxs("div",{className:"text-xs text-bambu-gray truncate",children:[v.filament_material||"Unknown"," · #",v.id]})]}),i.jsx("span",{className:"text-xs text-bambu-gray",children:v.remaining_weight!=null?`${Math.round(v.remaining_weight)}g`:"—"})]},v.id))}),i.jsx("div",{className:"p-4 border-t border-white/10 flex justify-end",children:i.jsx(Fe,{variant:"ghost",onClick:e,children:l("inventory.cancel")||"Cancel"})})]})]}):null}function B$e({isOpen:t,onClose:e,printerId:n,amsId:r,trayId:a,trayInfo:s}){const{t:o}=Mt(),l=tn(),{showToast:c}=bn(),[d,u]=w.useState(null),[m,p]=w.useState(""),{data:f,isLoading:y}=Je({queryKey:["inventory-spools"],queryFn:()=>be.getSpools(),enabled:t}),{data:x}=Je({queryKey:["spool-assignments"],queryFn:()=>be.getAssignments(),enabled:t}),b=ut({mutationFn:T=>be.assignSpool({spool_id:T,printer_id:n,ams_id:r,tray_id:a}),onSuccess:T=>{l.setQueryData(["spool-assignments"],N=>{const R=(N||[]).filter(A=>!(A.printer_id===n&&A.ams_id===r&&A.tray_id===a));return R.push(T),R}),l.invalidateQueries({queryKey:["spool-assignments"]}),c(o("inventory.assignSuccess"),"success"),e()},onError:T=>{c(`${o("inventory.assignFailed")}: ${T.message}`,"error")}});if(!t)return null;const v=new Set((x||[]).filter(T=>!(T.printer_id===n&&T.ams_id===r&&T.tray_id===a)).map(T=>T.spool_id)),_=r===254||r===255,k=f?.filter(T=>!v.has(T.id)&&(_||!T.tag_uid&&!T.tray_uuid)),P=k?.filter(T=>{if(!m)return!0;const N=m.toLowerCase();return T.material.toLowerCase().includes(N)||(T.brand?.toLowerCase().includes(N)??!1)||(T.color_name?.toLowerCase().includes(N)??!1)||(T.subtype?.toLowerCase().includes(N)??!1)}),C=()=>{d&&b.mutate(d)};return i.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[i.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:e}),i.jsxs("div",{className:"relative w-full max-w-md mx-4 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-xl shadow-2xl",children:[i.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-bambu-dark-tertiary",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(sa,{className:"w-5 h-5 text-bambu-green"}),i.jsx("h2",{className:"text-lg font-semibold text-white",children:o("inventory.assignSpool")})]}),i.jsx("button",{onClick:e,className:"p-1 text-bambu-gray hover:text-white rounded transition-colors",children:i.jsx(zt,{className:"w-5 h-5"})})]}),i.jsxs("div",{className:"p-4 space-y-4",children:[s&&i.jsxs("div",{className:"p-3 bg-bambu-dark rounded-lg border border-bambu-dark-tertiary",children:[i.jsxs("p",{className:"text-xs text-bambu-gray mb-1",children:[o("inventory.selectSpool"),":"]}),i.jsxs("div",{className:"flex items-center gap-2",children:[s.color&&i.jsx("span",{className:"w-4 h-4 rounded-full border border-white/20",style:{backgroundColor:`#${s.color}`}}),i.jsx("span",{className:"text-white font-medium",children:s.type||o("ams.emptySlot")}),i.jsxs("span",{className:"text-bambu-gray",children:["(",s.location,")"]})]})]}),i.jsxs("div",{className:"relative",children:[i.jsx(Dr,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray"}),i.jsx("input",{type:"text",value:m,onChange:T=>p(T.target.value),placeholder:o("inventory.searchSpools"),className:"w-full pl-9 pr-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm placeholder:text-bambu-gray focus:outline-none focus:border-bambu-green"})]}),i.jsx("div",{children:y?i.jsx("div",{className:"flex justify-center py-8",children:i.jsx(ct,{className:"w-6 h-6 text-bambu-green animate-spin"})}):P&&P.length>0?i.jsx("div",{className:"max-h-64 overflow-y-auto space-y-2",children:P.map(T=>i.jsx("button",{onClick:()=>u(T.id),className:`w-full p-3 rounded-lg border text-left transition-colors ${d===T.id?"bg-bambu-green/20 border-bambu-green":"bg-bambu-dark border-bambu-dark-tertiary hover:border-bambu-gray"}`,children:i.jsxs("div",{className:"flex items-center gap-2",children:[T.rgba&&i.jsx("span",{className:"w-4 h-4 rounded-full border border-white/20 flex-shrink-0",style:{backgroundColor:`#${T.rgba.substring(0,6)}`}}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsxs("p",{className:"text-white font-medium truncate",children:[T.brand?`${T.brand} `:"",T.material,T.subtype?` ${T.subtype}`:""]}),i.jsxs("p",{className:"text-xs text-bambu-gray",children:[T.color_name||"",T.label_weight?` - ${T.label_weight}g`:"",T.label_weight?` (${Math.max(0,Math.round(T.label_weight-T.weight_used))}g ${o("ams.remainingUnit")})`:""]})]}),d===T.id&&i.jsx(Vr,{className:"w-4 h-4 text-bambu-green flex-shrink-0"})]})},T.id))}):k&&k.length===0?i.jsx("div",{className:"text-center py-8 text-bambu-gray",children:i.jsx("p",{children:o("inventory.noManualSpools")})}):i.jsx("div",{className:"text-center py-8 text-bambu-gray",children:i.jsx("p",{children:o("inventory.noSpoolsMatch")})})})]}),i.jsxs("div",{className:"flex justify-end gap-2 p-4 border-t border-bambu-dark-tertiary",children:[i.jsx(Fe,{variant:"secondary",onClick:e,children:o("common.cancel")}),i.jsx(Fe,{onClick:C,disabled:!d||b.isPending,children:b.isPending?i.jsxs(i.Fragment,{children:[i.jsx(ct,{className:"w-4 h-4 animate-spin"}),o("inventory.assigning")]}):i.jsxs(i.Fragment,{children:[i.jsx(sa,{className:"w-4 h-4"}),o("inventory.assignSpool")]})})]}),b.isError&&i.jsx("div",{className:"mx-4 mb-4 p-2 bg-red-500/20 border border-red-500/50 rounded text-sm text-red-400",children:b.error.message})]})]})}function bG(t,e){if(t===255)return"External";let n,r=!1;t>=128&&t<=135?(n=t-128,r=!0):t>=0&&t<=3?(n=t,r=e===1):n=0,n=Math.max(0,Math.min(n,7));const a=String.fromCharCode(65+n);return r?`HT-${a}`:`AMS-${a}`}function H_(t){const e=t.includes("_")?t.split("_")[0]:t;return e.startsWith("GFS")?"GF"+e.slice(3):(e.startsWith("PFUS")||e.startsWith("PFSP"),e)}const hv=["PLA","PETG","PCTG","ABS","ASA","TPU","PC","PA","NYLON","PVA","HIPS","PP","PET"];function xG(t){const e=t.replace(/@.+$/,"").trim(),n=e.toUpperCase(),r=n.match(/\bSUPPORT\s+FOR\s+/);if(r){const s=n.slice(r.index+r[0].length);for(const o of hv)if(new RegExp(`\\b${o}\\b`).test(s)){const c=e.slice(0,r.index).trim();return{material:o,brand:c,variant:"Support"}}}for(const s of hv){const o=new RegExp(`\\b${s}\\b`,"i");if(o.test(n)){const l=e.split(o),c=l[0]?.trim()||"",d=l[1]?.trim()||"";return{material:s,brand:c,variant:d}}}const a=e.split(/\s+/);return a.length>=2?{material:a[1],brand:a[0],variant:a.slice(2).join(" ")}:{material:e,brand:"",variant:""}}function H$e(t){return!t.startsWith("GF")&&!t.startsWith("P1")}const $$e={white:"FFFFFF",black:"000000",red:"FF0000",green:"00FF00",blue:"0000FF",yellow:"FFFF00",cyan:"00FFFF",magenta:"FF00FF",orange:"FFA500",purple:"800080",pink:"FFC0CB",brown:"8B4513",gray:"808080",grey:"808080","jade white":"FFFEF2",ivory:"FFFFF0",beige:"F5F5DC",cream:"FFFDD0",silver:"C0C0C0",gold:"FFD700",bronze:"CD7F32",copper:"B87333",navy:"000080",teal:"008080",olive:"808000",maroon:"800000",coral:"FF7F50",salmon:"FA8072",lime:"32CD32",mint:"98FF98","forest green":"228B22","sky blue":"87CEEB","royal blue":"4169E1",turquoise:"40E0D0",lavender:"E6E6FA",violet:"EE82EE",plum:"DDA0DD",tan:"D2B48C",chocolate:"D2691E",charcoal:"36454F",slate:"708090",transparent:"000000",natural:"F5F5DC",wood:"DEB887"},yG=[{name:"White",hex:"FFFFFF"},{name:"Black",hex:"000000"},{name:"Red",hex:"FF0000"},{name:"Blue",hex:"0000FF"},{name:"Green",hex:"00AA00"},{name:"Yellow",hex:"FFFF00"},{name:"Orange",hex:"FFA500"},{name:"Gray",hex:"808080"}],vG=[{name:"Cyan",hex:"00FFFF"},{name:"Magenta",hex:"FF00FF"},{name:"Purple",hex:"800080"},{name:"Pink",hex:"FFC0CB"},{name:"Brown",hex:"8B4513"},{name:"Beige",hex:"F5F5DC"},{name:"Navy",hex:"000080"},{name:"Teal",hex:"008080"},{name:"Lime",hex:"32CD32"},{name:"Gold",hex:"FFD700"},{name:"Silver",hex:"C0C0C0"},{name:"Maroon",hex:"800000"},{name:"Olive",hex:"808000"},{name:"Coral",hex:"FF7F50"},{name:"Salmon",hex:"FA8072"},{name:"Turquoise",hex:"40E0D0"},{name:"Violet",hex:"EE82EE"},{name:"Indigo",hex:"4B0082"},{name:"Chocolate",hex:"D2691E"},{name:"Tan",hex:"D2B48C"},{name:"Slate",hex:"708090"},{name:"Charcoal",hex:"36454F"},{name:"Ivory",hex:"FFFFF0"},{name:"Cream",hex:"FFFDD0"}];function wG(t){const e=t.toLowerCase().trim();return $$e[e]||null}function q$e(t){const e=t.indexOf("@");if(e<0)return null;const r=t.slice(e+1).trim().match(/^BBL\s+(.+?)(?:\s+[\d.]+\s*nozzle)?$/i);return r?r[1].trim():null}function Qne({isOpen:t,onClose:e,printerId:n,slotInfo:r,nozzleDiameter:a="0.4",printerModel:s,onSuccess:o,fullScreen:l}){const{t:c}=Mt(),[d,u]=w.useState(""),[m,p]=w.useState(null),[f,y]=w.useState(""),[x,b]=w.useState(""),[v,_]=w.useState(""),[k,P]=w.useState(!1),[C,T]=w.useState(!1),N=w.useRef(""),{data:R,isLoading:A,isError:D}=Je({queryKey:["cloudSettings"],queryFn:()=>be.getCloudSettings(),enabled:t,retry:!1}),{data:$,isLoading:U}=Je({queryKey:["localPresets"],queryFn:()=>be.getLocalPresets(),enabled:t}),{data:G,isLoading:L}=Je({queryKey:["builtinFilaments"],queryFn:()=>be.getBuiltinFilaments(),enabled:t,staleTime:1/0}),{data:te,isLoading:re}=Je({queryKey:["kprofiles",n,a],queryFn:()=>be.getKProfiles(n,a),enabled:t&&!!n}),{data:J}=Je({queryKey:["colorCatalog"],queryFn:()=>be.getColorCatalog(),enabled:t,staleTime:1/0}),ue=ut({mutationFn:async()=>{if(!d)throw new Error("No filament preset selected");const E=d.startsWith("local_"),I=d.startsWith("builtin_"),W=E?parseInt(d.replace("local_",""),10):null,B=I?d.replace("builtin_",""):null,ae=E?$?.filament.find(ze=>ze.id===W):null,z=I?G?.find(ze=>ze.filament_id===B):null,V=!E&&!I?R?.filament.find(ze=>ze.setting_id===d):null;if(!E&&!I&&!V)throw new Error("Selected preset not found");if(E&&!ae)throw new Error("Selected local preset not found");if(I&&!z)throw new Error("Selected builtin preset not found");const ee=E?ae.name:I?z.name:V.name,K=xG(ee),ne=m?.slot_id??-1,se=f||r.trayColor?.slice(0,6)||"FFFFFF",ce=ee.replace(/@.+$/,"").trim();let fe,oe;const O=K.material.toUpperCase();if(E){const ze=(hv.includes(O)?O:ae?.filament_type||K.material||"").toUpperCase(),Be={PLA:"GFL99","PLA-CF":"GFL98","PLA SILK":"GFL96","PLA HIGH SPEED":"GFL95",PETG:"GFG99","PETG HF":"GFG96","PETG-CF":"GFG98",PCTG:"GFG97",ABS:"GFB99",ASA:"GFB98",PC:"GFC99",PA:"GFN99","PA-CF":"GFN98",NYLON:"GFN99",TPU:"GFU99",PVA:"GFS99",HIPS:"GFS98",PE:"GFP99",PP:"GFP97"};fe=Be[ze]||Be[ze.replace(/[-\s]?CF$/,"")]||Be[ze.replace(/\+$/,"")]||Be[ze.split(/[-\s]/)[0]]||"",oe=""}else if(I)fe=B,oe="";else if(fe=H_(d),oe=d,!d.startsWith("GFS"))try{const ze=await be.getCloudSettingDetail(d);ze.filament_id?fe=ze.filament_id:ze.base_id&&(fe=H_(ze.base_id),console.log(`Derived tray_info_idx from base_id: ${ze.base_id} -> ${fe}`))}catch(ze){console.warn("Failed to fetch preset detail for filament_id:",ze)}let F=E&&ae?.nozzle_temp_min?ae.nozzle_temp_min:190,Q=E&&ae?.nozzle_temp_max?ae.nozzle_temp_max:230;if(!E||I||!ae?.nozzle_temp_min&&!ae?.nozzle_temp_max){const ze=(E?hv.includes(O)?O:ae?.filament_type||K.material||"":K.material).toUpperCase();ze.includes("PLA")?(F=190,Q=230):ze.includes("PETG")?(F=220,Q=260):ze.includes("ABS")||ze.includes("ASA")?(F=240,Q=280):ze.includes("TPU")?(F=200,Q=240):ze==="PCTG"?(F=220,Q=260):ze.includes("PC")?(F=260,Q=300):(ze.includes("PA")||ze.includes("NYLON"))&&(F=250,Q=290)}const ve=m?.k_value?parseFloat(m.k_value):0,he=E?hv.includes(O)?O:ae?.filament_type||K.material||"PLA":K.material||"PLA",de=await be.configureAmsSlot(n,r.amsId,r.trayId,{tray_info_idx:fe,tray_type:he,tray_sub_brands:ce,tray_color:se+"FF",nozzle_temp_min:F,nozzle_temp_max:Q,cali_idx:ne,nozzle_diameter:a,setting_id:oe,kprofile_filament_id:m?.filament_id,kprofile_setting_id:m?.setting_id||void 0,k_value:ve}),Ae=E?`local_${W}`:I?`builtin_${B}`:d,_e=E?"local":I?"builtin":"cloud";try{await be.saveSlotPreset(n,r.amsId,r.trayId,Ae,ce,_e)}catch(ze){console.warn("Failed to save slot preset mapping:",ze)}return de},onSuccess:()=>{P(!0),o?.(),setTimeout(()=>{P(!1),e()},1500)}}),me=ut({mutationFn:async()=>be.resetAmsSlot(n,r.amsId,r.trayId),onSuccess:()=>{P(!0),o?.(),setTimeout(()=>{P(!1),e()},1500)}}),ge=w.useMemo(()=>{const E=v.toLowerCase(),I=[],W=new Set,B=r.savedPresetId,ae=r.trayInfoIdx;if(R?.filament)for(const z of R.filament){W.add(z.setting_id);const V=B===z.setting_id||ae&&(z.setting_id===ae||H_(z.setting_id)===ae);if(!(!V&&E&&!z.name.toLowerCase().includes(E))){if(!V&&s){const ee=q$e(z.name);if(ee&&ee.toUpperCase()!==s.toUpperCase())continue}I.push({id:z.setting_id,name:z.name,source:"cloud",isUser:H$e(z.setting_id)})}}if($?.filament)for(const z of $.filament){const V=`local_${z.id}`,ee=B===V;if(!(!ee&&E&&!z.name.toLowerCase().includes(E))){if(!ee&&s&&z.compatible_printers){const K=z.compatible_printers.split(";").map(ne=>{const se=ne.trim(),ce=se.match(/^BBL\s+(.+)/i);return ce?ce[1].trim().toUpperCase():se.toUpperCase()}).filter(Boolean);if(K.length>0&&!K.includes(s.toUpperCase()))continue}I.push({id:V,name:z.name,source:"local",isUser:!1})}}if(G)for(const z of G){if(W.has(z.filament_id))continue;const V=z.filament_id.startsWith("GF")?"GFS"+z.filament_id.slice(2):z.filament_id;W.has(V)||(!E||z.name.toLowerCase().includes(E))&&I.push({id:`builtin_${z.filament_id}`,name:z.name,source:"builtin",isUser:!1})}return I.sort((z,V)=>{const ee={cloud:0,local:1,builtin:2};return z.source!==V.source?ee[z.source]-ee[V.source]:z.isUser&&!V.isUser?-1:!z.isUser&&V.isUser?1:z.name.localeCompare(V.name)})},[R?.filament,$?.filament,G,v,s,r.savedPresetId,r.trayInfoIdx]),X=w.useMemo(()=>{if(!d)return null;let E=null;if(d.startsWith("local_")){const B=parseInt(d.replace("local_",""),10);E=$?.filament.find(z=>z.id===B)?.name||null}else if(d.startsWith("builtin_")){const B=d.replace("builtin_","");E=G?.find(z=>z.filament_id===B)?.name||null}else R?.filament&&(E=R.filament.find(ae=>ae.setting_id===d)?.name||null);if(!E)return null;let I=E.replace(/@.+$/,"").trim();I.startsWith("# ")&&(I=I.slice(2).trim());const W=xG(I);return{fullName:I,material:W.material,brand:W.brand}},[d,R?.filament,$?.filament,G]),ie=X?.fullName||"",le=w.useMemo(()=>{if(!J||!X)return[];const{fullName:E,brand:I}=X,W=E.replace(/^(Bambu\s*(Lab)?|eSUN|Polymaker|Overture|Sunlu|Hatchbox)\s*/i,"").trim();return J.filter(B=>{const ae=(B.material||"").toUpperCase(),z=B.manufacturer.toUpperCase();if(!(ae===W.toUpperCase()||ae.includes(W.toUpperCase())||W.toUpperCase().includes(ae)))return!1;if(I){const ee=I.toUpperCase();if(!z.includes(ee)&&!ee.includes(z))return!1}return!0})},[J,X]),pe=w.useMemo(()=>{if(!te?.profiles||!X)return[];const{fullName:E,material:I,brand:W}=X,B=E.toUpperCase(),ae=I.toUpperCase(),z=W.toUpperCase();if(!ae||ae.length<2)return[];const V=te.profiles.filter(K=>{const ne=K.name.toUpperCase();if(z)return!(!ne.includes(z)||!ne.includes(ae));if(ne.includes(B)||ne.includes(ae))return!0;const ce={NYLON:["PA","PA-CF","PA6"],PA:["NYLON"]}[ae]||[];for(const fe of ce)if(ne.includes(fe))return!0;return!1}),ee=new Map;for(const K of V){const ne=`${K.name}|${K.k_value}`,se=ee.get(ne);se?r.extruderId!==void 0&&K.extruder_id===r.extruderId&&se.extruder_id!==r.extruderId&&ee.set(ne,K):ee.set(ne,K)}return Array.from(ee.values())},[te?.profiles,X,r.extruderId]);w.useEffect(()=>{if(t){if(r.savedPresetId)u(r.savedPresetId);else if(r.trayInfoIdx&&R?.filament){let E=R.filament.find(I=>I.setting_id===r.trayInfoIdx);E||(E=R.filament.find(I=>H_(I.setting_id)===r.trayInfoIdx)),E&&u(E.setting_id)}else if(r.trayInfoIdx&&G?.length){const E=r.trayInfoIdx,I=G.find(W=>W.filament_id===E);I&&u(`builtin_${I.filament_id}`)}if(r.trayColor){const E=r.trayColor.slice(0,6);E&&y(E)}}else u(""),p(null),y(""),b(""),_(""),P(!1),N.current=""},[t,r.savedPresetId,r.trayInfoIdx,r.trayColor,R?.filament,G]),w.useEffect(()=>{if(pe.length>0){if(r.caliIdx!=null&&r.caliIdx>0){const E=pe.find(I=>I.slot_id===r.caliIdx);if(E){p(E);return}}p(pe[0])}else p(null)},[d,pe,r.caliIdx]);const Ce=w.useCallback(E=>{E.key==="Escape"&&e()},[e]);w.useEffect(()=>{if(t)return document.addEventListener("keydown",Ce),()=>document.removeEventListener("keydown",Ce)},[t,Ce]);const q=A&&!D||U||L||re;if(w.useEffect(()=>{if(!q&&d&&d!==N.current){const E=requestAnimationFrame(()=>{const W=document.querySelector('[class*="fixed inset-0 z-50"]')?.querySelector(`[data-preset-id="${CSS.escape(d)}"]`);W&&(N.current=d,W.scrollIntoView({block:"nearest"}))});return()=>cancelAnimationFrame(E)}},[d,q]),!t)return null;const Z=d&&!ue.isPending,j=f||r.trayColor?.slice(0,6)||"FFFFFF";return i.jsxs("div",{className:`fixed inset-0 z-50 flex ${l?"":"items-center justify-center"}`,children:[!l&&i.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:e}),i.jsxs("div",{className:l?"relative w-full h-full bg-bambu-dark-secondary flex flex-col":"relative w-full max-w-lg mx-4 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-xl shadow-2xl",children:[i.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-bambu-dark-tertiary shrink-0",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(lu,{className:"w-5 h-5 text-bambu-blue"}),i.jsx("h2",{className:"text-lg font-semibold text-white",children:c("configureAmsSlot.title")}),l&&i.jsxs("div",{className:"flex items-center gap-2 ml-4 text-sm text-bambu-gray",children:[i.jsx("span",{className:"text-white/30",children:"|"}),r.trayColor&&i.jsx("span",{className:"w-4 h-4 rounded-full border border-white/20",style:{backgroundColor:`#${r.trayColor.slice(0,6)}`}}),i.jsx("span",{className:"text-white/70",children:c("configureAmsSlot.slotLabel",{ams:bG(r.amsId,r.trayCount),slot:r.trayId+1})}),r.traySubBrands&&i.jsxs("span",{children:["(",r.traySubBrands,")"]})]})]}),i.jsx("button",{onClick:e,className:"p-1 text-bambu-gray hover:text-white rounded transition-colors",children:i.jsx(zt,{className:"w-5 h-5"})})]}),i.jsxs("div",{className:`p-4 overflow-y-auto ${l?"flex-1 min-h-0":"space-y-4 max-h-[60vh]"}`,children:[k&&i.jsx("div",{className:"absolute inset-0 bg-bambu-dark-secondary/95 z-10 flex items-center justify-center rounded-xl",children:i.jsxs("div",{className:"text-center space-y-3",children:[i.jsx(Eb,{className:"w-16 h-16 text-bambu-green mx-auto"}),i.jsx("p",{className:"text-lg font-semibold text-white",children:c("configureAmsSlot.slotConfigured")}),i.jsx("p",{className:"text-sm text-bambu-gray",children:c("configureAmsSlot.settingsSentToPrinter")})]})}),!l&&i.jsxs("div",{className:"p-3 bg-bambu-dark rounded-lg border border-bambu-dark-tertiary",children:[i.jsx("p",{className:"text-xs text-bambu-gray mb-1",children:c("configureAmsSlot.configuringSlot")}),i.jsxs("div",{className:"flex items-center gap-2",children:[r.trayColor&&i.jsx("span",{className:"w-4 h-4 rounded-full border border-white/20",style:{backgroundColor:`#${r.trayColor.slice(0,6)}`}}),i.jsx("span",{className:"text-white font-medium",children:c("configureAmsSlot.slotLabel",{ams:bG(r.amsId,r.trayCount),slot:r.trayId+1})}),r.traySubBrands&&i.jsxs("span",{className:"text-bambu-gray",children:["(",r.traySubBrands,")"]})]})]}),q?i.jsx("div",{className:"flex justify-center py-8",children:i.jsx(ct,{className:"w-6 h-6 text-bambu-green animate-spin"})}):l?i.jsxs("div",{className:"flex gap-4 h-full",children:[i.jsxs("div",{className:"w-1/2 flex flex-col min-h-0",children:[i.jsxs("label",{className:"block text-sm text-bambu-gray mb-2",children:[c("configureAmsSlot.filamentProfile")," ",i.jsx("span",{className:"text-red-400",children:"*"})]}),i.jsx("input",{type:"text",placeholder:c("configureAmsSlot.searchPresets"),value:v,onChange:E=>_(E.target.value),className:"w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white placeholder:text-bambu-gray focus:border-bambu-green focus:outline-none mb-2 shrink-0"}),i.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto space-y-1",children:ge.length===0?i.jsx("p",{className:"text-center py-4 text-bambu-gray",children:R?.filament?.length===0&&!$?.filament?.length?c("configureAmsSlot.noPresetsAvailable"):c("configureAmsSlot.noMatchingPresets")}):ge.map(E=>i.jsx("button",{"data-preset-id":E.id,onClick:()=>u(E.id),className:`w-full p-2 rounded-lg border text-left transition-colors ${d===E.id?"bg-bambu-green/20 border-bambu-green":"bg-bambu-dark border-bambu-dark-tertiary hover:border-bambu-gray"}`,children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("span",{className:"text-white text-sm truncate",children:E.name}),i.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[E.source==="local"&&i.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-green-500/20 text-green-400",children:c("profiles.localProfiles.badge")}),E.source==="builtin"&&i.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-amber-500/20 text-amber-400",children:c("configureAmsSlot.builtin")}),E.isUser&&i.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-bambu-blue/20 text-bambu-blue",children:c("configureAmsSlot.custom")})]})]})},E.id))})]}),i.jsxs("div",{className:"w-1/2 flex flex-col gap-4 min-h-0 overflow-y-auto",children:[i.jsxs("div",{children:[i.jsxs("label",{className:"block text-sm text-bambu-gray mb-2",children:[c("configureAmsSlot.kProfileLabel"),ie&&i.jsx("span",{className:"ml-2 text-xs text-bambu-blue",children:c("configureAmsSlot.filteringFor",{material:ie})})]}),pe.length>0?i.jsxs("div",{className:"relative",children:[i.jsxs("select",{value:m?.name||"",onChange:E=>{const I=pe.find(W=>W.name===E.target.value);p(I||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 appearance-none pr-10",children:[i.jsx("option",{value:"",children:c("configureAmsSlot.noKProfile")}),pe.map(E=>i.jsxs("option",{value:E.name,children:[E.name," (K=",E.k_value,")"]},`${E.name}-${E.extruder_id}`))]}),i.jsx(In,{className:"absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray pointer-events-none"})]}):d?i.jsx("p",{className:"text-sm text-bambu-gray italic py-2",children:c("configureAmsSlot.noMatchingKProfiles")}):i.jsx("span",{className:"inline-block text-xs px-2 py-1 rounded bg-amber-500/20 text-amber-400 border border-amber-500/30",children:c("configureAmsSlot.selectFilamentFirst")}),m&&i.jsx("p",{className:"text-xs text-bambu-green mt-1",children:c("configureAmsSlot.kFromCalibration",{value:m.k_value})})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm text-bambu-gray mb-2",children:c("configureAmsSlot.customColorLabel")}),le.length>0&&i.jsxs("div",{className:"mb-3",children:[i.jsx("p",{className:"text-xs text-bambu-gray mb-1.5",children:c("configureAmsSlot.presetColors",{name:X?.fullName})}),i.jsx("div",{className:"flex flex-wrap gap-1.5",children:le.map(E=>i.jsxs("button",{onClick:()=>{const I=E.hex_color.replace("#","").toUpperCase();y(I),b(E.color_name)},className:`h-7 px-2 rounded-md border-2 transition-all flex items-center gap-1.5 ${f===E.hex_color.replace("#","").toUpperCase()?"border-bambu-green scale-105":"border-white/20 hover:border-white/40"}`,title:E.color_name,children:[i.jsx("span",{className:"w-4 h-4 rounded-full border border-white/30 flex-shrink-0",style:{backgroundColor:E.hex_color}}),i.jsx("span",{className:"text-xs text-white/80 whitespace-nowrap",children:E.color_name})]},E.id))})]}),i.jsxs("div",{className:"flex flex-wrap gap-1.5 mb-2",children:[yG.map(E=>i.jsx("button",{onClick:()=>{y(E.hex),b(E.name)},className:`w-7 h-7 rounded-md border-2 transition-all ${f===E.hex?"border-bambu-green scale-110":"border-white/20 hover:border-white/40"}`,style:{backgroundColor:`#${E.hex}`},title:E.name},E.hex)),i.jsx("button",{onClick:()=>T(!C),className:"w-7 h-7 rounded-md border-2 border-white/20 hover:border-white/40 flex items-center justify-center text-white/60 hover:text-white/80 transition-all text-xs",title:c(C?"configureAmsSlot.showLessColors":"configureAmsSlot.showMoreColors"),children:C?"−":"+"})]}),C&&i.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:vG.map(E=>i.jsx("button",{onClick:()=>{y(E.hex),b(E.name)},className:`w-7 h-7 rounded-md border-2 transition-all ${f===E.hex?"border-bambu-green scale-110":"border-white/20 hover:border-white/40"}`,style:{backgroundColor:`#${E.hex}`},title:E.name},E.hex))}),i.jsxs("div",{className:"flex gap-2 items-center",children:[i.jsx("div",{className:"w-10 h-10 rounded-lg border-2 border-white/20 flex-shrink-0",style:{backgroundColor:`#${j}`}}),i.jsx("input",{type:"text",placeholder:c("configureAmsSlot.colorPlaceholder"),value:x,onChange:E=>{const I=E.target.value;b(I);const W=wG(I);if(W)y(W);else{const B=I.replace(/[^0-9A-Fa-f]/g,"").toUpperCase();B.length===6?y(B):B.length===3&&y(B.split("").map(ae=>ae+ae).join(""))}},className:"flex-1 px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white placeholder:text-bambu-gray focus:border-bambu-green focus:outline-none text-sm"}),f&&i.jsx("button",{onClick:()=>{y(""),b("")},className:"px-2 py-1 text-xs text-bambu-gray hover:text-white bg-bambu-dark-tertiary rounded",title:c("configureAmsSlot.clearCustomColor"),children:c("configureAmsSlot.clear")})]}),f&&i.jsx("p",{className:"text-xs text-bambu-gray mt-1.5",children:c("configureAmsSlot.hexLabel",{hex:f})})]})]})]}):i.jsxs(i.Fragment,{children:[i.jsxs("div",{children:[i.jsxs("label",{className:"block text-sm text-bambu-gray mb-2",children:[c("configureAmsSlot.filamentProfile")," ",i.jsx("span",{className:"text-red-400",children:"*"})]}),i.jsxs("div",{className:"relative",children:[i.jsx("input",{type:"text",placeholder:c("configureAmsSlot.searchPresets"),value:v,onChange:E=>_(E.target.value),className:"w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white placeholder:text-bambu-gray focus:border-bambu-green focus:outline-none mb-2"}),i.jsx("div",{className:"max-h-48 overflow-y-auto space-y-1",children:ge.length===0?i.jsx("p",{className:"text-center py-4 text-bambu-gray",children:R?.filament?.length===0&&!$?.filament?.length?c("configureAmsSlot.noPresetsAvailable"):c("configureAmsSlot.noMatchingPresets")}):ge.map(E=>i.jsx("button",{"data-preset-id":E.id,onClick:()=>u(E.id),className:`w-full p-2 rounded-lg border text-left transition-colors ${d===E.id?"bg-bambu-green/20 border-bambu-green":"bg-bambu-dark border-bambu-dark-tertiary hover:border-bambu-gray"}`,children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("span",{className:"text-white text-sm truncate",children:E.name}),i.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[E.source==="local"&&i.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-green-500/20 text-green-400",children:c("profiles.localProfiles.badge")}),E.source==="builtin"&&i.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-amber-500/20 text-amber-400",children:c("configureAmsSlot.builtin")}),E.isUser&&i.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-bambu-blue/20 text-bambu-blue",children:c("configureAmsSlot.custom")})]})]})},E.id))})]})]}),i.jsxs("div",{children:[i.jsxs("label",{className:"block text-sm text-bambu-gray mb-2",children:[c("configureAmsSlot.kProfileLabel"),ie&&i.jsx("span",{className:"ml-2 text-xs text-bambu-blue",children:c("configureAmsSlot.filteringFor",{material:ie})})]}),pe.length>0?i.jsxs("div",{className:"relative",children:[i.jsxs("select",{value:m?.name||"",onChange:E=>{const I=pe.find(W=>W.name===E.target.value);p(I||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 appearance-none pr-10",children:[i.jsx("option",{value:"",children:c("configureAmsSlot.noKProfile")}),pe.map(E=>i.jsxs("option",{value:E.name,children:[E.name," (K=",E.k_value,")"]},`${E.name}-${E.extruder_id}`))]}),i.jsx(In,{className:"absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray pointer-events-none"})]}):d?i.jsx("p",{className:"text-sm text-bambu-gray italic py-2",children:c("configureAmsSlot.noMatchingKProfiles")}):i.jsx("span",{className:"inline-block text-xs px-2 py-1 rounded bg-amber-500/20 text-amber-400 border border-amber-500/30",children:c("configureAmsSlot.selectFilamentFirst")}),m&&i.jsx("p",{className:"text-xs text-bambu-green mt-1",children:c("configureAmsSlot.kFromCalibration",{value:m.k_value})})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm text-bambu-gray mb-2",children:c("configureAmsSlot.customColorLabel")}),le.length>0&&i.jsxs("div",{className:"mb-3",children:[i.jsx("p",{className:"text-xs text-bambu-gray mb-1.5",children:c("configureAmsSlot.presetColors",{name:X?.fullName})}),i.jsx("div",{className:"flex flex-wrap gap-1.5",children:le.map(E=>i.jsxs("button",{onClick:()=>{const I=E.hex_color.replace("#","").toUpperCase();y(I),b(E.color_name)},className:`h-7 px-2 rounded-md border-2 transition-all flex items-center gap-1.5 ${f===E.hex_color.replace("#","").toUpperCase()?"border-bambu-green scale-105":"border-white/20 hover:border-white/40"}`,title:E.color_name,children:[i.jsx("span",{className:"w-4 h-4 rounded-full border border-white/30 flex-shrink-0",style:{backgroundColor:E.hex_color}}),i.jsx("span",{className:"text-xs text-white/80 whitespace-nowrap",children:E.color_name})]},E.id))})]}),i.jsxs("div",{className:"flex flex-wrap gap-1.5 mb-2",children:[yG.map(E=>i.jsx("button",{onClick:()=>{y(E.hex),b(E.name)},className:`w-7 h-7 rounded-md border-2 transition-all ${f===E.hex?"border-bambu-green scale-110":"border-white/20 hover:border-white/40"}`,style:{backgroundColor:`#${E.hex}`},title:E.name},E.hex)),i.jsx("button",{onClick:()=>T(!C),className:"w-7 h-7 rounded-md border-2 border-white/20 hover:border-white/40 flex items-center justify-center text-white/60 hover:text-white/80 transition-all text-xs",title:c(C?"configureAmsSlot.showLessColors":"configureAmsSlot.showMoreColors"),children:C?"−":"+"})]}),C&&i.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:vG.map(E=>i.jsx("button",{onClick:()=>{y(E.hex),b(E.name)},className:`w-7 h-7 rounded-md border-2 transition-all ${f===E.hex?"border-bambu-green scale-110":"border-white/20 hover:border-white/40"}`,style:{backgroundColor:`#${E.hex}`},title:E.name},E.hex))}),i.jsxs("div",{className:"flex gap-2 items-center",children:[i.jsx("div",{className:"w-10 h-10 rounded-lg border-2 border-white/20 flex-shrink-0",style:{backgroundColor:`#${j}`}}),i.jsx("input",{type:"text",placeholder:c("configureAmsSlot.colorPlaceholder"),value:x,onChange:E=>{const I=E.target.value;b(I);const W=wG(I);if(W)y(W);else{const B=I.replace(/[^0-9A-Fa-f]/g,"").toUpperCase();B.length===6?y(B):B.length===3&&y(B.split("").map(ae=>ae+ae).join(""))}},className:"flex-1 px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white placeholder:text-bambu-gray focus:border-bambu-green focus:outline-none text-sm"}),f&&i.jsx("button",{onClick:()=>{y(""),b("")},className:"px-2 py-1 text-xs text-bambu-gray hover:text-white bg-bambu-dark-tertiary rounded",title:c("configureAmsSlot.clearCustomColor"),children:c("configureAmsSlot.clear")})]}),f&&i.jsx("p",{className:"text-xs text-bambu-gray mt-1.5",children:c("configureAmsSlot.hexLabel",{hex:f})})]})]})]}),i.jsxs("div",{className:"flex justify-between p-4 border-t border-bambu-dark-tertiary shrink-0",children:[i.jsx(Fe,{variant:"secondary",onClick:()=>me.mutate(),disabled:me.isPending||ue.isPending,className:"text-red-400 hover:text-red-300 hover:bg-red-500/10",children:me.isPending?i.jsxs(i.Fragment,{children:[i.jsx(ct,{className:"w-4 h-4 animate-spin"}),c("configureAmsSlot.resetting")]}):i.jsxs(i.Fragment,{children:[i.jsx(uo,{className:"w-4 h-4"}),c("configureAmsSlot.resetSlot")]})}),i.jsxs("div",{className:"flex gap-2",children:[i.jsx(Fe,{variant:"secondary",onClick:e,children:c("configureAmsSlot.cancel")}),i.jsx(Fe,{onClick:()=>ue.mutate(),disabled:!Z,children:ue.isPending?i.jsxs(i.Fragment,{children:[i.jsx(ct,{className:"w-4 h-4 animate-spin"}),c("configureAmsSlot.configuring")]}):i.jsxs(i.Fragment,{children:[i.jsx(lu,{className:"w-4 h-4"}),c("configureAmsSlot.configureSlot")]})})]})]}),(ue.isError||me.isError)&&i.jsx("div",{className:"mx-4 mb-4 p-2 bg-red-500/20 border border-red-500/50 rounded text-sm text-red-400",children:ue.error?.message||me.error?.message})]})]})}function Zne({folderId:t,onClose:e,onUploadComplete:n,onFileUploaded:r,autoUpload:a,validateFile:s,accept:o}){const{t:l}=Mt(),[c,d]=w.useState([]),[u,m]=w.useState(!1),[p,f]=w.useState(!1),[y,x]=w.useState(!0),[b,v]=w.useState(!1),[_,k]=w.useState(!0),[P,C]=w.useState(null),T=w.useRef(null),N=ge=>{ge.preventDefault(),m(!0)},R=ge=>{ge.preventDefault(),m(!1)},A=ge=>{ge.preventDefault(),m(!1),G(Array.from(ge.dataTransfer.files))},D=ge=>{ge.target.files&&G(Array.from(ge.target.files))},$=(ge,X)=>{d(ie=>ie.map(le=>le.file===ge?{...le,...X}:le))},U=async ge=>{f(!0);for(const X of ge)if(X.status==="pending"){$(X.file,{status:"uploading"});try{if(X.isZip){const ie=await be.extractZipFile(X.file,t,y,b,_);$(X.file,{status:ie.errors.length>0&&ie.extracted===0?"error":"success",extractedCount:ie.extracted,error:ie.errors.length>0?l("fileManager.zipFilesFailed","{{count}} files failed",{count:ie.errors.length}):void 0})}else{const ie=await be.uploadLibraryFile(X.file,t,_);$(X.file,{status:"success"});const le=r?.(ie);if(le){C(le),d([]),f(!1);return}}}catch(ie){$(X.file,{status:"error",error:ie instanceof Error?ie.message:l("fileManager.uploadFailed","Upload failed")})}}f(!1),n(),e()},G=ge=>{if(C(null),s)for(const ie of ge){const le=s(ie);if(le){C(le);return}}const X=ge.map(ie=>({file:ie,status:"pending",isZip:ie.name.toLowerCase().endsWith(".zip"),is3mf:ie.name.toLowerCase().endsWith(".3mf")}));d(ie=>[...ie,...X]),a&&ge.length>0&&U(X)},L=ge=>{d(X=>X.filter((ie,le)=>le!==ge))},te=c.some(ge=>ge.isZip&&ge.status==="pending"),re=c.some(ge=>ge.file.name.toLowerCase().endsWith(".stl")&&ge.status==="pending"),J=c.some(ge=>ge.is3mf&&ge.status==="pending"),ue=c.filter(ge=>ge.status==="pending").length,me=c.length>0&&ue===0&&!p;return i.jsx("div",{className:"fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-4",children:i.jsxs("div",{className:"bg-bambu-dark-secondary rounded-lg w-full max-w-lg border border-bambu-dark-tertiary",children:[i.jsxs("div",{className:"p-4 border-b border-bambu-dark-tertiary flex items-center justify-between",children:[i.jsx("h2",{className:"text-lg font-semibold text-white",children:l("fileManager.uploadFiles")}),i.jsx("button",{onClick:e,className:"p-1 hover:bg-bambu-dark rounded",children:i.jsx(zt,{className:"w-5 h-5 text-bambu-gray"})})]}),i.jsxs("div",{className:"p-4 space-y-4",children:[i.jsxs("div",{onDragOver:N,onDragLeave:R,onDrop:A,onClick:()=>T.current?.click(),className:`border-2 border-dashed rounded-lg p-8 text-center cursor-pointer transition-colors ${u?"border-bambu-green bg-bambu-green/10":"border-bambu-dark-tertiary hover:border-bambu-green/50"}`,children:[i.jsx(Si,{className:`w-10 h-10 mx-auto mb-3 ${u?"text-bambu-green":"text-bambu-gray"}`}),i.jsx("p",{className:"text-white font-medium",children:l(u?"fileManager.dropFilesHere":"fileManager.dragDropFiles")}),i.jsx("p",{className:"text-sm text-bambu-gray mt-1",children:l("fileManager.orClickToBrowse")}),i.jsx("p",{className:"text-xs text-bambu-gray/70 mt-2",children:l("fileManager.allFileTypesSupported")})]}),i.jsx("input",{ref:T,type:"file",multiple:!0,accept:o,className:"hidden",onChange:D}),te&&i.jsx("div",{className:"p-3 bg-blue-500/10 border border-blue-500/30 rounded-lg",children:i.jsxs("div",{className:"flex items-start gap-3",children:[i.jsx(Fs,{className:"w-5 h-5 text-blue-400 mt-0.5 flex-shrink-0"}),i.jsxs("div",{className:"flex-1",children:[i.jsx("p",{className:"text-sm text-blue-300 font-medium",children:l("fileManager.zipFilesDetected")}),i.jsx("p",{className:"text-xs text-blue-300/70 mt-1",children:l("fileManager.zipExtractOptions")}),i.jsxs("label",{className:"flex items-center gap-2 mt-2 cursor-pointer",children:[i.jsx("input",{type:"checkbox",checked:y,onChange:ge=>x(ge.target.checked),className:"w-4 h-4 rounded border-bambu-dark-tertiary bg-bambu-dark text-bambu-green focus:ring-bambu-green"}),i.jsx("span",{className:"text-sm text-white",children:l("fileManager.preserveZipStructure")})]}),i.jsxs("label",{className:"flex items-center gap-2 mt-2 cursor-pointer",children:[i.jsx("input",{type:"checkbox",checked:b,onChange:ge=>v(ge.target.checked),className:"w-4 h-4 rounded border-bambu-dark-tertiary bg-bambu-dark text-bambu-green focus:ring-bambu-green"}),i.jsx("span",{className:"text-sm text-white",children:l("fileManager.createFolderFromZip")})]})]})]})}),J&&i.jsx("div",{className:"p-3 bg-purple-500/10 border border-purple-500/30 rounded-lg",children:i.jsxs("div",{className:"flex items-start gap-3",children:[i.jsx(kr,{className:"w-5 h-5 text-purple-400 mt-0.5 flex-shrink-0"}),i.jsxs("div",{className:"flex-1",children:[i.jsx("p",{className:"text-sm text-purple-300 font-medium",children:l("fileManager.threemfDetected")}),i.jsx("p",{className:"text-xs text-purple-300/70 mt-1",children:l("fileManager.threemfExtractionInfo")})]})]})}),(re||te)&&i.jsx("div",{className:"p-3 bg-bambu-green/10 border border-bambu-green/30 rounded-lg",children:i.jsxs("div",{className:"flex items-start gap-3",children:[i.jsx(ou,{className:"w-5 h-5 text-bambu-green mt-0.5 flex-shrink-0"}),i.jsxs("div",{className:"flex-1",children:[i.jsx("p",{className:"text-sm text-bambu-green font-medium",children:l("fileManager.stlThumbnailGeneration")}),i.jsx("p",{className:"text-xs text-bambu-green/70 mt-1",children:l(te&&!re?"fileManager.zipMayContainStl":"fileManager.thumbnailsCanBeGenerated")}),i.jsxs("label",{className:"flex items-center gap-2 mt-2 cursor-pointer",children:[i.jsx("input",{type:"checkbox",checked:_,onChange:ge=>k(ge.target.checked),className:"w-4 h-4 rounded border-bambu-dark-tertiary bg-bambu-dark text-bambu-green focus:ring-bambu-green"}),i.jsx("span",{className:"text-sm text-white",children:l("fileManager.generateThumbnailsForStl")})]})]})]})}),c.length>0&&i.jsx("div",{className:"max-h-48 overflow-y-auto space-y-2",children:c.map((ge,X)=>i.jsxs("div",{className:"flex items-center gap-3 p-2 bg-bambu-dark rounded-lg",children:[ge.isZip?i.jsx(Fs,{className:"w-4 h-4 text-blue-400 flex-shrink-0"}):i.jsx(cC,{className:"w-4 h-4 text-bambu-gray flex-shrink-0"}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsx("p",{className:"text-sm text-white truncate",children:ge.file.name}),i.jsxs("p",{className:"text-xs text-bambu-gray",children:[(ge.file.size/1024/1024).toFixed(2)," MB",ge.isZip&&ge.status==="pending"&&i.jsxs("span",{className:"text-blue-400 ml-2",children:["• ",l("fileManager.willBeExtracted")]}),ge.extractedCount!==void 0&&i.jsxs("span",{className:"text-green-400 ml-2",children:["• ",l("fileManager.filesExtracted",{count:ge.extractedCount})]})]})]}),ge.status==="pending"&&i.jsx("button",{onClick:()=>L(X),className:"p-1 hover:bg-bambu-dark-tertiary rounded",children:i.jsx(zt,{className:"w-4 h-4 text-bambu-gray"})}),ge.status==="uploading"&&i.jsx(ct,{className:"w-4 h-4 text-bambu-green animate-spin"}),ge.status==="success"&&i.jsx(fr,{className:"w-4 h-4 text-green-500"}),ge.status==="error"&&i.jsx("span",{title:ge.error,children:i.jsx(qi,{className:"w-4 h-4 text-red-500"})})]},X))}),P&&i.jsx("div",{className:"p-3 bg-red-500/10 border border-red-500/30 rounded-lg",children:i.jsxs("div",{className:"flex items-start gap-3",children:[i.jsx(qi,{className:"w-5 h-5 text-red-400 mt-0.5 flex-shrink-0"}),i.jsx("p",{className:"text-sm text-red-300",children:P})]})})]}),i.jsxs("div",{className:"p-4 border-t border-bambu-dark-tertiary flex justify-end gap-2",children:[i.jsx(Fe,{variant:"secondary",onClick:e,children:l("common.cancel")}),!me&&i.jsx(Fe,{onClick:()=>U(c),disabled:ue===0||p,children:p?i.jsxs(i.Fragment,{children:[i.jsx(ct,{className:"w-4 h-4 mr-2 animate-spin"}),l("fileManager.uploading")]}):i.jsxs(i.Fragment,{children:[i.jsx(Si,{className:"w-4 h-4 mr-2"}),l("common.upload")," ",ue>0?`(${ue})`:""]})})]})]})})}function SG(t){return t?`#${t.replace("#","").substring(0,6)}`:"#808080"}function Li(t){return t?t.replace("#","").toLowerCase().substring(0,6):""}function Hc(t,e,n=40){const r=Li(t),a=Li(e);if(!r||!a||r.length<6||a.length<6)return!1;const s=parseInt(r.substring(0,2),16),o=parseInt(r.substring(2,4),16),l=parseInt(r.substring(4,6),16),c=parseInt(a.substring(0,2),16),d=parseInt(a.substring(2,4),16),u=parseInt(a.substring(4,6),16);return Math.abs(s-c)<=n&&Math.abs(o-d)<=n&&Math.abs(l-u)<=n}function F4(t,e,n,r){if(r)return"Ext";const a=String.fromCharCode(65+(t>=128?t-128:t));return n?`HT-${a}`:`${a}${e+1}`}function lN(t,e,n){return n?254+e:t>=128?t:t*4+e}function _G(t){if(!t)return!1;const e=Date.now()+4320*60*60*1e3;return(Jn(t)?.getTime()??0)>e}function V$e(t,e,n){const r=Jne(e,t.nozzle_id),a=r.find(l=>!n.has(l.globalTrayId)&&l.type?.toUpperCase()===t.type?.toUpperCase()&&Li(l.color)===Li(t.color)),s=a?void 0:r.find(l=>!n.has(l.globalTrayId)&&l.type?.toUpperCase()===t.type?.toUpperCase()&&Hc(l.color,t.color)),o=a||s?void 0:r.find(l=>!n.has(l.globalTrayId)&&l.type?.toUpperCase()===t.type?.toUpperCase());return a??s??o}function Jne(t,e){return t.filter(n=>e==null||n.extruderId===e)}function NT(t){const e=[],n=t?.ams_extruder_map,r=n&&Object.keys(n).length>0;t?.ams?.forEach(a=>{const s=a.tray.length===1;a.tray.forEach(o=>{if(o.tray_type){const l=SG(o.tray_color);e.push({type:o.tray_type,color:l,colorName:ru(l),amsId:a.id,trayId:o.id,isHt:s,isExternal:!1,label:F4(a.id,o.id,s,!1),globalTrayId:lN(a.id,o.id,!1),trayInfoIdx:o.tray_info_idx||"",traySubBrands:o.tray_sub_brands||"",extruderId:n?.[String(a.id)]})}})});for(const a of t?.vt_tray??[])if(a.tray_type){const s=SG(a.tray_color),o=a.id??254,l=(t?.vt_tray?.length??0)>1;e.push({type:a.tray_type,color:s,colorName:ru(s),amsId:-1,trayId:o-254,isHt:!1,isExternal:!0,label:l?o===254?"Ext-L":"Ext-R":"External",globalTrayId:o,trayInfoIdx:a.tray_info_idx||"",traySubBrands:a.tray_sub_brands||"",extruderId:r?255-o:void 0})}return e}function kG(t,e){if(!t?.filaments||t.filaments.length===0)return;const n=NT(e);if(n.length===0)return;const r=new Set,a=t.filaments.map(l=>{const c=l.tray_info_idx||"";let d=n.filter(x=>!r.has(x.globalTrayId));l.nozzle_id!=null&&(d=d.filter(x=>x.extruderId===l.nozzle_id));let u,m,p,f;if(c){const x=d.filter(b=>b.trayInfoIdx===c);x.length===1?u=x[0]:x.length>1&&(m=x.find(b=>b.type?.toUpperCase()===l.type?.toUpperCase()&&Li(b.color)===Li(l.color)),m||(p=x.find(b=>b.type?.toUpperCase()===l.type?.toUpperCase()&&Hc(b.color,l.color))),!m&&!p&&(f=x.find(b=>b.type?.toUpperCase()===l.type?.toUpperCase())))}!u&&!m&&!p&&!f&&(m=d.find(x=>x.type?.toUpperCase()===l.type?.toUpperCase()&&Li(x.color)===Li(l.color)),m||(p=d.find(x=>x.type?.toUpperCase()===l.type?.toUpperCase()&&Hc(x.color,l.color))),!m&&!p&&(f=d.find(x=>x.type?.toUpperCase()===l.type?.toUpperCase())));const y=u||m||p||f||void 0;return y&&r.add(y.globalTrayId),{slot_id:l.slot_id,globalTrayId:y?.globalTrayId??-1}}),s=Math.max(...a.map(l=>l.slot_id||0));if(s<=0)return;const o=new Array(s).fill(-1);return a.forEach(l=>{l.slot_id&&l.slot_id>0&&(o[l.slot_id-1]=l.globalTrayId)}),o}function G$e(t){return w.useMemo(()=>NT(t),[t])}function ere(t,e,n){const r=G$e(e),a=w.useMemo(()=>{if(!t?.filaments||t.filaments.length===0)return[];const c=new Set(Object.values(n));return t.filaments.map(d=>{const u=d.slot_id||0;if(u>0&&n[u]!==void 0){const T=n[u],N=r.find(R=>R.globalTrayId===T);if(N){const R=N.type?.toUpperCase()===d.type?.toUpperCase(),A=Li(N.color)===Li(d.color)||Hc(N.color,d.color);let D;return R&&A?D="match":R?D="type_only":D="mismatch",{...d,loaded:N,hasFilament:!0,typeMatch:R,colorMatch:A,status:D,isManual:!0}}}const m=d.tray_info_idx||"";let p=r.filter(T=>!c.has(T.globalTrayId));d.nozzle_id!=null&&(p=p.filter(T=>T.extruderId===d.nozzle_id));let f,y,x,b;if(m){const T=p.filter(N=>N.trayInfoIdx===m);T.length===1?f=T[0]:T.length>1&&(y=T.find(N=>N.type?.toUpperCase()===d.type?.toUpperCase()&&Li(N.color)===Li(d.color)),y||(x=T.find(N=>N.type?.toUpperCase()===d.type?.toUpperCase()&&Hc(N.color,d.color))),!y&&!x&&(b=T.find(N=>N.type?.toUpperCase()===d.type?.toUpperCase())))}!f&&!y&&!x&&!b&&(y=p.find(T=>T.type?.toUpperCase()===d.type?.toUpperCase()&&Li(T.color)===Li(d.color)),y||(x=p.find(T=>T.type?.toUpperCase()===d.type?.toUpperCase()&&Hc(T.color,d.color))),!y&&!x&&(b=p.find(T=>T.type?.toUpperCase()===d.type?.toUpperCase())));const v=f||y||x||b||void 0;v&&c.add(v.globalTrayId);const _=!!v,k=_,P=!!f||!!y||!!x;let C;return f||y||x?C="match":b?C="type_only":C="mismatch",{...d,loaded:v,hasFilament:_,typeMatch:k,colorMatch:P,status:C,isManual:!1}})},[t,r,n]),s=w.useMemo(()=>{if(a.length===0)return;const c=Math.max(...a.map(u=>u.slot_id||0));if(c<=0)return;const d=new Array(c).fill(-1);return a.forEach(u=>{u.slot_id&&u.slot_id>0&&(d[u.slot_id-1]=u.loaded?.globalTrayId??-1)}),d},[a]),o=a.some(c=>c.status==="mismatch"),l=a.some(c=>c.status==="type_only");return{loadedFilaments:r,filamentComparison:a,amsMapping:s,hasTypeMismatch:o,hasColorMismatch:l}}function W$e(t,e,n){if(!t||t.length===0)return{exactMatches:0,typeOnlyMatches:0,missingTypes:0,totalSlots:0,status:"full"};let r=0,a=0,s=0;const o=new Set(Object.values(n));for(const d of t){const u=d.slot_id||0;if(u>0&&n[u]!==void 0){const b=n[u],v=e.find(_=>_.globalTrayId===b);if(v){const _=v.type?.toUpperCase()===d.type?.toUpperCase(),k=Li(v.color)===Li(d.color)||Hc(v.color,d.color);_&&k?r++:_?a++:s++;continue}}let m=e.filter(b=>!o.has(b.globalTrayId));if(d.nozzle_id!=null){const b=m.filter(v=>v.extruderId===d.nozzle_id);b.length>0&&(m=b)}const p=m.find(b=>b.type?.toUpperCase()===d.type?.toUpperCase()&&Li(b.color)===Li(d.color)),f=p?void 0:m.find(b=>b.type?.toUpperCase()===d.type?.toUpperCase()&&Hc(b.color,d.color)),y=p||f?void 0:m.find(b=>b.type?.toUpperCase()===d.type?.toUpperCase()),x=p??f??y;x&&o.add(x.globalTrayId),p||f?r++:y?a++:s++}const l=t.length;let c="full";return s>0?c="missing":a>0&&(c="partial"),{exactMatches:r,typeOnlyMatches:a,missingTypes:s,totalSlots:l,status:c}}function K$e(t,e,n){if(!t?.filaments||t.filaments.length===0)return;const r=NT(e);if(r.length===0)return;const a=new Set(Object.values(n)),s=[];for(const c of t.filaments){const d=c.slot_id||0;if(d>0&&n[d]!==void 0){s.push({slot_id:d,globalTrayId:n[d]});continue}let u=r.filter(x=>!a.has(x.globalTrayId));if(c.nozzle_id!=null){const x=u.filter(b=>b.extruderId===c.nozzle_id);x.length>0&&(u=x)}const m=u.find(x=>x.type?.toUpperCase()===c.type?.toUpperCase()&&Li(x.color)===Li(c.color)),p=m?void 0:u.find(x=>x.type?.toUpperCase()===c.type?.toUpperCase()&&Hc(x.color,c.color)),f=m||p?void 0:u.find(x=>x.type?.toUpperCase()===c.type?.toUpperCase()),y=m??p??f;y&&a.add(y.globalTrayId),s.push({slot_id:d,globalTrayId:y?.globalTrayId??-1})}const o=Math.max(...s.map(c=>c.slot_id||0));if(o<=0)return;const l=new Array(o).fill(-1);return s.forEach(c=>{c.slot_id&&c.slot_id>0&&(l[c.slot_id-1]=c.globalTrayId)}),l}const NG={useDefault:!0,manualMappings:{},autoConfigured:!1};function Y$e(t,e,n,r,a,s){const o=gf({queries:t.map(y=>({queryKey:["printer-status",y],queryFn:()=>be.getPrinterStatus(y),enabled:t.length>0,staleTime:5e3}))}),l=w.useMemo(()=>t.map((y,x)=>{const b=o[x],v=b?.data,k=e?.find(D=>D.id===y)?.name||`Printer ${y}`,P=NT(v),C=a[y]||NG,T=kG(n,v),N=C.useDefault?r:C.manualMappings,R=K$e(n,v,N),A=W$e(n?.filaments,P,N);return{printerId:y,printerName:k,status:v,isLoading:b?.isLoading??!1,loadedFilaments:P,autoMapping:T,finalMapping:R,matchStatus:A.status,exactMatches:A.exactMatches,typeOnlyMatches:A.typeOnlyMatches,missingTypes:A.missingTypes,totalSlots:A.totalSlots,config:C}}),[t,o,e,n,a,r]),c=o.some(y=>y.isLoading),d=(y,x)=>{s(b=>({...b,[y]:{...b[y]||NG,...x}}))},u=y=>{const x=l.find(_=>_.printerId===y);if(!x||!x.status||!n?.filaments)return;const b=kG(n,x.status);if(!b)return;const v={};b.forEach((_,k)=>{_!==-1&&(v[k+1]=_)}),d(y,{useDefault:!1,manualMappings:v,autoConfigured:!0})},m=()=>{for(const y of t)u(y)},p=y=>l.find(b=>b.printerId===y)?.finalMapping,f=l.every(y=>y.matchStatus!=="missing");return{printerResults:l,isLoading:c,perPrinterConfigs:a,updatePrinterConfig:d,autoConfigureAll:m,autoConfigurePrinter:u,getFinalMapping:p,allPrintersReady:f}}const tre={USD:"$",EUR:"€",GBP:"£",CHF:"Fr.",JPY:"¥",CNY:"¥",CAD:"$",AUD:"$",INR:"₹",HKD:"HK$",KRW:"₩",SEK:"kr",NOK:"kr",DKK:"kr",PLN:"zł",BRL:"R$",TWD:"NT$",SGD:"S$",NZD:"NZ$",MXN:"MX$",MYR:"RM",CZK:"Kč",THB:"฿",ZAR:"R",TRY:"₺",RUB:"₽",HUF:"Ft",ILS:"₪"};function al(t){return tre[t.toUpperCase()]||t}const X$e=Object.entries(tre).map(([t,e])=>({code:t,label:`${t} (${e})`}));function Q$e({printerId:t,filamentReqs:e,manualMappings:n,onManualMappingChange:r,currencySymbol:a,defaultCostPerKg:s,defaultExpanded:o=!1}){const{t:l}=Mt(),c=tn(),[d,u]=w.useState(!1),[m,p]=w.useState(o),{data:f}=Je({queryKey:["printer-status",t],queryFn:()=>be.getPrinterStatus(t),enabled:!!t}),{data:y}=Je({queryKey:["spool-assignments",t],queryFn:()=>be.getAssignments(t),enabled:!!t}),{loadedFilaments:x,filamentComparison:b,hasTypeMismatch:v,hasColorMismatch:_}=ere(e,f,n),k=w.useMemo(()=>{const U=new Map;for(const G of y||[]){const L=G.ams_id===255,te=lN(G.ams_id,G.tray_id,L);U.set(te,G.spool?.cost_per_kg??null)}return U},[y]),P=w.useMemo(()=>{const U=new Map;for(const G of y||[]){const L=G.ams_id===255,te=lN(G.ams_id,G.tray_id,L),re=G.spool;if(!re){U.set(te,null);continue}U.set(te,Math.max(0,Math.round((re.label_weight??0)-(re.weight_used??0))))}return U},[y]),C=w.useMemo(()=>{let U=0;for(const G of b){const L=G.loaded?.globalTrayId;if(L==null)continue;const re=k.get(L)??null??s;re>0&&(U+=G.used_grams/1e3*re)}return U},[b,k,s]),T=w.useMemo(()=>Array.from(k.values()).some(U=>U!=null&&U>0),[k]),N=e?.filaments&&e.filaments.length>0,R=e?.filaments?.some(U=>U.nozzle_id!=null)??!1;if(!N||!f)return null;const A=v?"#f97316":_?"#facc15":"#00ae42",D=(U,G)=>{if(U>0)if(G===""){const L={...n};delete L[U],r(L)}else r({...n,[U]:parseInt(G,10)})},$=async()=>{u(!0);try{await be.refreshPrinterStatus(t),await new Promise(U=>setTimeout(U,500)),await c.refetchQueries({queryKey:["printer-status",t]})}finally{u(!1)}};return i.jsxs("div",{className:"mb-4",children:[i.jsxs("button",{type:"button",onClick:()=>p(!m),className:"flex items-center gap-2 text-sm text-bambu-gray hover:text-white transition-colors w-full",children:[i.jsx(B1,{className:"w-4 h-4",fill:A,stroke:"none"}),i.jsx("span",{children:l("printModal.filamentMapping")}),v?i.jsx("span",{className:"text-xs text-orange-400",children:"(Type not found)"}):_?i.jsx("span",{className:"text-xs text-yellow-400",children:"(Color mismatch)"}):i.jsx("span",{className:"text-xs text-bambu-green",children:"(Ready)"}),m?i.jsx(vl,{className:"w-4 h-4 ml-auto"}):i.jsx(In,{className:"w-4 h-4 ml-auto"})]}),m&&i.jsxs("div",{className:"mt-2 bg-bambu-dark rounded-lg p-3 space-y-2",children:[i.jsxs("div",{className:"flex items-center justify-between mb-2",children:[i.jsx("span",{className:"text-xs text-bambu-gray",children:"Click to change slot assignment"}),i.jsxs("button",{type:"button",onClick:$,className:"flex items-center gap-1 px-2 py-0.5 text-xs rounded border border-bambu-gray/30 hover:border-bambu-gray hover:bg-bambu-dark-tertiary transition-colors text-bambu-gray hover:text-white",disabled:d,children:[i.jsx(_r,{className:`w-3 h-3 ${d?"animate-spin":""}`}),i.jsx("span",{children:"Re-read"})]})]}),b.map((U,G)=>i.jsxs("div",{className:"grid items-center gap-2 text-xs",style:{gridTemplateColumns:"16px minmax(70px, 1fr) auto 2fr 16px"},children:[i.jsx("span",{title:`Required: ${U.type} - ${ru(U.color)}`,children:i.jsx(B1,{className:"w-3 h-3",fill:U.color,stroke:U.color})}),i.jsxs("span",{className:"text-white truncate flex items-center gap-1",children:[R&&U.nozzle_id!=null&&i.jsx("span",{className:"inline-flex items-center justify-center w-3.5 h-3.5 rounded text-[9px] font-bold leading-none bg-bambu-gray/20 text-bambu-gray shrink-0",title:U.nozzle_id===1?l("printModal.leftNozzleTooltip"):l("printModal.rightNozzleTooltip"),children:U.nozzle_id===1?l("printModal.leftNozzle"):l("printModal.rightNozzle")}),U.type," ",i.jsxs("span",{className:"text-bambu-gray",children:["(",U.used_grams,"g)"]})]}),i.jsx("span",{className:"text-bambu-gray",children:"→"}),i.jsxs("select",{value:U.loaded?.globalTrayId??"",onChange:L=>D(U.slot_id||0,L.target.value),className:`flex-1 px-2 py-1 rounded border text-xs bg-bambu-dark-secondary focus:outline-none focus:ring-1 focus:ring-bambu-green ${U.status==="match"?"border-bambu-green/50 text-bambu-green":U.status==="type_only"?"border-yellow-400/50 text-yellow-400":"border-orange-400/50 text-orange-400"} ${U.isManual?"ring-1 ring-blue-400/50":""}`,title:U.isManual?"Manually selected":"Auto-matched",children:[i.jsx("option",{value:"",className:"bg-bambu-dark text-bambu-gray",children:"-- Select slot --"}),x.filter(L=>U.nozzle_id==null||L.extruderId===U.nozzle_id).map(L=>{const te=P.get(L.globalTrayId),re=te!=null?l("printModal.slotRemainingShort",{grams:te,defaultValue:` - ${te}g left`}):"";return i.jsxs("option",{value:L.globalTrayId,className:"bg-bambu-dark text-white",children:[L.label,": ",L.traySubBrands||L.type," (",L.colorName,")",re]},L.globalTrayId)})]}),U.status==="match"?i.jsx(Vr,{className:"w-3 h-3 text-bambu-green"}):U.status==="type_only"?i.jsx("span",{title:"Same type, different color",children:i.jsx(En,{className:"w-3 h-3 text-yellow-400"})}):i.jsx("span",{title:"Filament type not loaded",children:i.jsx(En,{className:"w-3 h-3 text-orange-400"})})]},G)),i.jsxs("div",{className:"text-xs text-bambu-gray",children:[l("printModal.totalCost")," ",i.jsx("span",{className:"text-white",children:C>0||T?`${a}${C.toFixed(2)}`:"N/A"})]}),v&&i.jsx("p",{className:"text-xs text-orange-400 mt-2",children:"Required filament type not found in printer."})]})]})}function Z$e({filamentReqs:t,availableFilaments:e,overrides:n,onChange:r,forceColorMatch:a,onForceColorMatchChange:s}){const{t:o}=Mt(),l=w.useMemo(()=>{const u={};for(const m of e){const p=m.type.toUpperCase();u[p]||(u[p]=[]),u[p].push(m)}return u},[e]),c=t?.filaments;if(!c||c.length===0||e.length===0)return null;const d=(u,m)=>{if(m===""){const p={...n};delete p[u],r(p)}else{const[p,f]=m.split("|");r({...n,[u]:{type:p,color:f}})}};return i.jsxs("div",{className:"mb-4",children:[i.jsx("div",{className:"flex items-center gap-2 text-sm text-bambu-gray mb-2",children:i.jsx("span",{children:o("printModal.filamentOverride")})}),i.jsx("p",{className:"text-xs text-bambu-gray mb-2",children:o("printModal.filamentOverrideHint")}),i.jsx("div",{className:"bg-bambu-dark rounded-lg p-3 space-y-2",children:c.map(u=>{const m=n[u.slot_id],p=!!m,f=l[u.type.toUpperCase()]||[],y=u.nozzle_id!=null?f.filter(x=>x.extruder_id==null||x.extruder_id===u.nozzle_id):f;return i.jsxs("div",{className:"space-y-1",children:[i.jsxs("div",{className:"grid items-center gap-2 text-xs",style:{gridTemplateColumns:"16px minmax(70px, 1fr) auto 2fr 20px"},children:[i.jsx("span",{title:`${o("printModal.originalFilament")}: ${u.type} - ${ru(u.color)}`,children:i.jsx(B1,{className:"w-3 h-3",fill:u.color,stroke:u.color})}),i.jsxs("span",{className:"text-white truncate",children:[u.type," ",i.jsxs("span",{className:"text-bambu-gray",children:["(",u.used_grams,"g)"]})]}),i.jsx("span",{className:"text-bambu-gray",children:"→"}),i.jsxs("select",{value:p?`${m.type}|${m.color}`:"",onChange:x=>d(u.slot_id,x.target.value),disabled:y.length===0,className:`flex-1 px-2 py-1 rounded border text-xs bg-bambu-dark-secondary focus:outline-none focus:ring-1 focus:ring-bambu-green ${p?"border-blue-400/50 text-blue-400":"border-bambu-gray/30 text-bambu-gray"}`,children:[i.jsxs("option",{value:"",className:"bg-bambu-dark text-bambu-gray",children:[o("printModal.originalFilament"),": ",u.type," (",ru(u.color),")"]}),y.map((x,b)=>i.jsxs("option",{value:`${x.type}|${x.color}`,className:"bg-bambu-dark text-white",children:[x.tray_sub_brands||x.type," (",ru(x.color),")"]},`${x.type}-${x.color}-${x.tray_sub_brands}-${b}`))]}),p?i.jsx("button",{type:"button",onClick:()=>d(u.slot_id,""),className:"text-bambu-gray hover:text-white transition-colors",title:o("printModal.resetToOriginal"),children:i.jsx(uo,{className:"w-3 h-3"})}):i.jsx("span",{className:"w-3"})]}),i.jsxs("label",{className:"flex items-center gap-1.5 text-xs text-bambu-gray cursor-pointer select-none pl-5",children:[i.jsx("input",{type:"checkbox",checked:a?.[u.slot_id]??!1,onChange:x=>s?.(u.slot_id,x.target.checked),className:"accent-bambu-green w-3 h-3"}),i.jsx(F0,{className:"w-3 h-3"}),o("printModal.forceColorMatch")]})]},u.slot_id)})})]})}function J$e({plates:t,isMultiPlate:e,selectedPlate:n,onSelect:r,queueAll:a,onQueueAllChange:s}){const{t:o}=Mt();return!e||t.length<=1?null:i.jsxs("div",{className:"mb-4",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[i.jsx(Vi,{className:"w-4 h-4 text-bambu-gray"}),i.jsx("span",{className:"text-sm text-bambu-gray",children:"Select Plate to Print"}),!n&&!a&&i.jsxs("span",{className:"text-xs text-orange-400 flex items-center gap-1",children:[i.jsx(En,{className:"w-3 h-3"}),"Selection required"]}),s&&i.jsx("button",{type:"button",onClick:()=>s(!a),className:`ml-auto text-xs px-2 py-0.5 rounded-full border transition-colors ${a?"border-bambu-green bg-bambu-green/10 text-bambu-green":"border-bambu-dark-tertiary text-bambu-gray hover:border-bambu-gray"}`,children:o("queue.queueAllPlates",{count:t.length})})]}),i.jsx("div",{className:"grid grid-cols-2 gap-2",children:t.map(l=>i.jsxs("button",{type:"button",onClick:()=>{a&&s&&s(!1),r(l.index)},className:`flex items-center gap-2 p-2 rounded-lg border transition-colors text-left ${a||n===l.index?"border-bambu-green bg-bambu-green/10":"border-bambu-dark-tertiary bg-bambu-dark hover:border-bambu-gray"}`,children:[l.has_thumbnail&&l.thumbnail_url!=null?i.jsx("img",{src:l.thumbnail_url,alt:`Plate ${l.index}`,className:"w-10 h-10 rounded object-cover bg-bambu-dark-tertiary"}):i.jsx("div",{className:"w-10 h-10 rounded bg-bambu-dark-tertiary flex items-center justify-center",children:i.jsx(Vi,{className:"w-5 h-5 text-bambu-gray"})}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsx("p",{className:"text-sm text-white font-medium truncate",children:l.name||`Plate ${l.index}`}),i.jsxs("p",{className:"text-xs text-bambu-gray truncate",children:[l.objects.length>0?l.objects.slice(0,3).join(", ")+(l.objects.length>3?"...":""):`${l.filaments.length} filament${l.filaments.length!==1?"s":""}`,l.print_time_seconds!=null?` • ${Ms(l.print_time_seconds)}`:""]})]}),(a||n===l.index)&&i.jsx(Vr,{className:"w-4 h-4 text-bambu-green flex-shrink-0"})]},l.index))})]})}const eqe=new Set(["IDLE","FINISH","FAILED"]);function tqe({printerResult:t,filamentReqs:e,onUpdateConfig:n}){const r=tn(),[a,s]=w.useState(!1),o=(d,u)=>{if(d<=0)return;const m={...t.config.manualMappings};u===""?delete m[d]:m[d]=parseInt(u,10),n({useDefault:!1,manualMappings:m,autoConfigured:!1})},l=async()=>{s(!0);try{await be.refreshPrinterStatus(t.printerId),await new Promise(d=>setTimeout(d,500)),await r.refetchQueries({queryKey:["printer-status",t.printerId]})}finally{s(!1)}},c=e.map(d=>{const u=d.slot_id||0,m=t.config.manualMappings[u];let p,f=!1;if(m!==void 0)p=t.loadedFilaments.find(x=>x.globalTrayId===m),f=!0;else{const x=new Set(Object.values(t.config.manualMappings));p=V$e(d,t.loadedFilaments,x)}let y="mismatch";if(p){const x=p.type?.toUpperCase()===d.type?.toUpperCase(),b=Li(p.color)===Li(d.color)||Hc(p.color,d.color);x&&b?y="match":x&&(y="type_only")}return{req:d,loaded:p,status:y,isManual:f}});return i.jsxs("div",{className:"mt-2 bg-bambu-dark rounded-lg p-3 space-y-2",children:[i.jsxs("div",{className:"flex items-center justify-between mb-2",children:[i.jsx("span",{className:"text-xs text-bambu-gray",children:"Custom slot mapping"}),i.jsxs("button",{type:"button",onClick:l,className:"flex items-center gap-1 px-2 py-0.5 text-xs rounded border border-bambu-gray/30 hover:border-bambu-gray hover:bg-bambu-dark-tertiary transition-colors text-bambu-gray hover:text-white",disabled:a,children:[i.jsx(_r,{className:`w-3 h-3 ${a?"animate-spin":""}`}),i.jsx("span",{children:"Re-read"})]})]}),c.map(({req:d,loaded:u,status:m,isManual:p},f)=>i.jsxs("div",{className:"grid items-center gap-2 text-xs",style:{gridTemplateColumns:"16px minmax(70px, 1fr) auto 2fr 16px"},children:[i.jsx("span",{title:`Required: ${d.type} - ${ru(d.color)}`,children:i.jsx(B1,{className:"w-3 h-3",fill:d.color,stroke:d.color})}),i.jsxs("span",{className:"text-white truncate",children:[d.type," ",i.jsxs("span",{className:"text-bambu-gray",children:["(",d.used_grams,"g)"]})]}),i.jsx("span",{className:"text-bambu-gray",children:"→"}),i.jsxs("select",{value:u?.globalTrayId??"",onChange:y=>o(d.slot_id||0,y.target.value),className:`flex-1 px-2 py-1 rounded border text-xs bg-bambu-dark-secondary focus:outline-none focus:ring-1 focus:ring-bambu-green ${m==="match"?"border-bambu-green/50 text-bambu-green":m==="type_only"?"border-yellow-400/50 text-yellow-400":"border-orange-400/50 text-orange-400"} ${p?"ring-1 ring-blue-400/50":""}`,title:p?"Manually selected":"Auto-matched",children:[i.jsx("option",{value:"",className:"bg-bambu-dark text-bambu-gray",children:"-- Select slot --"}),Jne(t.loadedFilaments,d.nozzle_id).map(y=>i.jsxs("option",{value:y.globalTrayId,className:"bg-bambu-dark text-white",children:[y.label,": ",y.traySubBrands||y.type," (",y.colorName,")"]},y.globalTrayId))]}),m==="match"?i.jsx(Vr,{className:"w-3 h-3 text-bambu-green"}):m==="type_only"?i.jsx("span",{title:"Same type, different color",children:i.jsx(En,{className:"w-3 h-3 text-yellow-400"})}):i.jsx("span",{title:"Filament type not loaded",children:i.jsx(En,{className:"w-3 h-3 text-orange-400"})})]},f))]})}function nqe({printers:t,selectedPrinterIds:e,onMultiSelect:n,isLoading:r=!1,allowMultiple:a=!1,showInactive:s=!1,disableBusy:o=!1,printerMappingResults:l,filamentReqs:c,onAutoConfigurePrinter:d,onUpdatePrinterConfig:u,assignmentMode:m="printer",onAssignmentModeChange:p,targetModel:f,onTargetModelChange:y,targetLocation:x,onTargetLocationChange:b,slicedForModel:v}){const[_,k]=w.useState(!1),P=s?t:t.filter(ie=>ie.is_active),C=gf({queries:P.map(ie=>({queryKey:["printerStatus",ie.id],queryFn:()=>be.getPrinterStatus(ie.id),staleTime:5e3}))}),T=w.useMemo(()=>{const ie=new Map;return P.forEach((le,pe)=>{const Ce=C[pe];Ce?.data&&ie.set(le.id,Ce.data)}),ie},[P,C]),N=ie=>{const le=T.get(ie);return le?le.connected?!eqe.has(le.state??""):!0:!1},R=ie=>{const le=T.get(ie);if(!le)return null;if(!le.connected)return"Offline";const pe=le.state;return pe?pe==="RUNNING"?le.stg_cur_name||"Printing":pe==="PREPARE"?"Preparing":pe==="PAUSE"?"Paused":pe==="IDLE"?"Idle":pe==="FINISH"?"Finished":pe==="FAILED"?"Failed":pe:null},A=w.useMemo(()=>{if(m!=="printer"||!v||_)return P;const ie=P.filter(le=>le.model===v);return ie.length>0?ie:P},[P,m,v,_]),D=P.length-A.length,$=w.useMemo(()=>{const ie=P.map(le=>le.model).filter(le=>!!le);return[...new Set(ie)].sort()},[P]),U=w.useMemo(()=>{if(!f)return[];const ie=P.filter(le=>le.model===f&&le.location).map(le=>le.location).filter(le=>!!le);return[...new Set(ie)].sort()},[P,f]),G=p&&y&&$.length>0,L=a&&e.length>1&&l&&c?.filaments&&c.filaments.length>0&&d&&u;if(r)return i.jsx("div",{className:"flex justify-center py-8",children:i.jsx(ct,{className:"w-6 h-6 text-bambu-green animate-spin"})});if(A.length===0)return i.jsxs("div",{className:"flex items-center gap-2 text-red-400 text-sm mb-4",children:[i.jsx(Ii,{className:"w-4 h-4"}),"No ",s?"":"active ","printers available"]});const te=ie=>{o&&N(ie)||(a?e.includes(ie)?n(e.filter(le=>le!==ie)):n([...e,ie]):n([ie]))},re=()=>{const ie=o?A.filter(le=>!N(le.id)):A;n(ie.map(le=>le.id))},J=()=>{n([])},ue=(ie,le,pe)=>{pe.stopPropagation(),!(!d||!u)&&(le?d(ie):u(ie,{useDefault:!0,manualMappings:{},autoConfigured:!1}))},me=ie=>e.includes(ie),ge=e.length,X=ie=>l?.find(le=>le.printerId===ie);return i.jsxs("div",{className:"space-y-2 mb-6",children:[G&&i.jsxs("div",{className:"flex gap-2 mb-4",children:[i.jsxs("button",{type:"button",onClick:()=>{p("printer"),y(null)},className:`flex-1 flex items-center justify-center gap-2 px-3 py-2 rounded-lg border transition-colors ${m==="printer"?"border-bambu-green bg-bambu-green/10 text-white":"border-bambu-dark-tertiary bg-bambu-dark text-bambu-gray hover:border-bambu-gray"}`,children:[i.jsx(kr,{className:"w-4 h-4"}),i.jsx("span",{className:"text-sm",children:"Specific Printer"})]}),i.jsxs("button",{type:"button",onClick:()=>{p("model"),n([]);const ie=v&&$.includes(v)?v:$[0];y(ie)},className:`flex-1 flex items-center justify-center gap-2 px-3 py-2 rounded-lg border transition-colors ${m==="model"?"border-bambu-green bg-bambu-green/10 text-white":"border-bambu-dark-tertiary bg-bambu-dark text-bambu-gray hover:border-bambu-gray"}`,children:[i.jsx(Sm,{className:"w-4 h-4"}),i.jsxs("span",{className:"text-sm",children:["Any ",v||"Model"]})]})]}),m==="model"&&G&&i.jsxs("div",{className:"space-y-3 mb-4",children:[!v&&i.jsxs("div",{children:[i.jsx("label",{className:"block text-xs text-bambu-gray mb-1",children:"Target Model"}),i.jsxs("select",{value:f||"",onChange:ie=>{y(ie.target.value||null),b&&b(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 text-sm",children:[i.jsx("option",{value:"",children:"Select a model..."}),$.map(ie=>i.jsx("option",{value:ie,children:ie},ie))]})]}),f&&U.length>0&&b&&i.jsxs("div",{children:[i.jsx("label",{className:"block text-xs text-bambu-gray mb-1",children:"Location Filter (optional)"}),i.jsxs("select",{value:x||"",onChange:ie=>b(ie.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 text-sm",children:[i.jsx("option",{value:"",children:"Any location"}),U.map(ie=>i.jsx("option",{value:ie,children:ie},ie))]})]}),f&&i.jsxs("p",{className:"text-xs text-bambu-gray",children:["Scheduler will assign to first available idle ",f," printer",x?` in ${x}`:""]})]}),m==="printer"&&a&&A.length>1&&i.jsxs("div",{className:"flex items-center justify-between text-xs text-bambu-gray mb-2",children:[i.jsx("span",{children:ge===0?"Select printers":`${ge} printer${ge!==1?"s":""} selected`}),i.jsxs("div",{className:"flex gap-2",children:[ge<A.length&&i.jsx("button",{type:"button",onClick:re,className:"text-bambu-green hover:text-bambu-green/80 transition-colors",children:"Select all"}),ge>0&&i.jsx("button",{type:"button",onClick:J,className:"text-bambu-gray hover:text-white transition-colors",children:"Clear"})]})]}),m==="printer"&&A.map(ie=>{const le=me(ie.id),pe=X(ie.id),Ce=pe&&!pe.config.useDefault,q=N(ie.id),Z=o&&q,j=R(ie.id);return i.jsxs("div",{children:[i.jsxs("button",{type:"button",onClick:()=>te(ie.id),disabled:Z,className:`w-full flex items-center gap-3 p-3 rounded-lg border transition-colors ${Z?"border-bambu-dark-tertiary bg-bambu-dark opacity-50 cursor-not-allowed":le?"border-bambu-green bg-bambu-green/10":"border-bambu-dark-tertiary bg-bambu-dark hover:border-bambu-gray"} ${ie.is_active?"":"opacity-60"}`,children:[i.jsx("div",{className:`p-2 rounded-lg ${Z?"bg-bambu-dark-tertiary":le?"bg-bambu-green/20":"bg-bambu-dark-tertiary"}`,children:i.jsx(kr,{className:`w-5 h-5 ${Z?"text-bambu-gray/50":le?"text-bambu-green":"text-bambu-gray"}`})}),i.jsxs("div",{className:"text-left flex-1",children:[i.jsxs("p",{className:`font-medium ${Z?"text-bambu-gray":"text-white"}`,children:[ie.name,!ie.is_active&&i.jsx("span",{className:"text-bambu-gray text-xs ml-2",children:"(inactive)"})]}),i.jsxs("p",{className:"text-xs text-bambu-gray",children:[ie.model||"Unknown model"," • ",ie.ip_address]})]}),j&&i.jsx("span",{className:`text-xs px-2 py-0.5 rounded-full ${q?"bg-yellow-500/20 text-yellow-400":"bg-bambu-green/20 text-bambu-green"}`,children:j}),a&&i.jsx("div",{className:`w-5 h-5 rounded border-2 flex items-center justify-center transition-colors ${Z?"border-bambu-gray/30":le?"bg-bambu-green border-bambu-green":"border-bambu-gray/50"}`,children:le&&i.jsx(Vr,{className:"w-3 h-3 text-white"})})]}),le&&L&&pe&&i.jsxs("div",{className:"ml-4 mt-2 mb-3",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",onClick:E=>E.stopPropagation(),children:[i.jsx("input",{type:"checkbox",checked:Ce,onChange:E=>ue(ie.id,E.target.checked,E),className:"w-3.5 h-3.5 rounded border-bambu-gray/30 bg-bambu-dark-secondary text-bambu-green focus:ring-bambu-green focus:ring-offset-0"}),i.jsx("span",{className:"text-xs text-bambu-gray",children:"Custom mapping"})]}),i.jsxs("span",{className:`text-xs ml-2 ${pe.matchStatus==="full"?"text-bambu-green":pe.matchStatus==="partial"?"text-yellow-400":"text-orange-400"}`,children:["(",pe.exactMatches,"/",pe.totalSlots," matched)"]}),pe.isLoading&&i.jsx(_r,{className:"w-3 h-3 text-bambu-gray animate-spin"}),Ce&&i.jsxs("button",{type:"button",onClick:E=>{E.stopPropagation(),d(ie.id)},className:"ml-auto flex items-center gap-1 px-2 py-0.5 text-xs rounded border border-bambu-gray/30 hover:border-bambu-gray hover:bg-bambu-dark-tertiary transition-colors text-bambu-gray hover:text-white",children:[i.jsx($ge,{className:"w-3 h-3"}),"Auto"]})]}),Ce&&i.jsx(tqe,{printerResult:pe,filamentReqs:c.filaments,onUpdateConfig:E=>u(ie.id,E)})]})]},ie.id)}),m==="printer"&&D>0&&!_&&i.jsxs("button",{type:"button",onClick:()=>k(!0),className:"text-xs text-bambu-gray hover:text-white transition-colors mt-2 flex items-center gap-1",children:[i.jsx(En,{className:"w-3 h-3 text-yellow-400"}),D," other printer",D>1?"s":""," hidden (different model) —",i.jsx("span",{className:"underline",children:"show all"})]}),m==="printer"&&_&&v&&i.jsx("button",{type:"button",onClick:()=>k(!1),className:"text-xs text-bambu-gray hover:text-white transition-colors mt-2",children:i.jsxs("span",{className:"underline",children:["Show only ",v," printers"]})}),m==="printer"&&ge===0&&i.jsxs("p",{className:"text-xs text-orange-400 mt-1 flex items-center gap-1",children:[i.jsx(Ii,{className:"w-3 h-3"}),"Select at least one printer"]}),m==="model"&&!f&&i.jsxs("p",{className:"text-xs text-orange-400 mt-1 flex items-center gap-1",children:[i.jsx(Ii,{className:"w-3 h-3"}),"Select a target printer model"]})]})}const rqe=[{key:"bed_levelling",label:"Bed Levelling",desc:"Auto-level bed before print"},{key:"flow_cali",label:"Flow Calibration",desc:"Calibrate extrusion flow"},{key:"vibration_cali",label:"Vibration Calibration",desc:"Reduce ringing artifacts"},{key:"layer_inspect",label:"First Layer Inspection",desc:"AI inspection of first layer"},{key:"timelapse",label:"Timelapse",desc:"Record timelapse video"}];function iqe({options:t,onChange:e,defaultExpanded:n=!1}){const[r,a]=w.useState(n),s=o=>{e({...t,[o]:!t[o]})};return i.jsxs("div",{className:"mb-4",children:[i.jsxs("button",{type:"button",onClick:()=>a(!r),className:"flex items-center gap-2 text-sm text-bambu-gray hover:text-white transition-colors w-full",children:[i.jsx(bC,{className:"w-4 h-4"}),i.jsx("span",{children:"Print Options"}),r?i.jsx(vl,{className:"w-4 h-4 ml-auto"}):i.jsx(In,{className:"w-4 h-4 ml-auto"})]}),r&&i.jsx("div",{className:"mt-2 bg-bambu-dark rounded-lg p-3 space-y-2",children:rqe.map(({key:o,label:l,desc:c})=>i.jsxs("label",{className:"flex items-center justify-between cursor-pointer group",children:[i.jsxs("div",{children:[i.jsx("span",{className:"text-sm text-white",children:l}),i.jsx("p",{className:"text-xs text-bambu-gray",children:c})]}),i.jsx("div",{className:`relative w-10 h-5 rounded-full transition-colors ${t[o]?"bg-bambu-green":"bg-bambu-dark-tertiary"}`,onClick:()=>s(o),children:i.jsx("div",{className:`absolute top-0.5 w-4 h-4 rounded-full bg-white transition-transform ${t[o]?"translate-x-5":"translate-x-0.5"}`})})]},o))})]})}function aqe({options:t,onChange:e,dateFormat:n="system",timeFormat:r="system",canControlPrinter:a=!0}){const[s,o]=w.useState(""),[l,c]=w.useState(""),[d,u]=w.useState(!0),[m,p]=w.useState(!0),f=w.useRef(null),y=w.useRef(!1);w.useEffect(()=>{if(t.scheduleType!=="scheduled"){y.current=!1;return}if(!y.current){y.current=!0;let C;t.scheduledTime?(C=new Date(t.scheduledTime),isNaN(C.getTime())&&(C=new Date,C.setHours(C.getHours()+1,0,0,0))):(C=new Date,C.setHours(C.getHours()+1,0,0,0),e({...t,scheduledTime:jD(C)})),o(ED(C,n)),c(l8(C,r)),u(!0),p(!0)}},[t.scheduleType,t.scheduledTime,n,r,e,t]);const x=C=>{e({...t,scheduleType:C})},b=(C,T)=>{const N=hbe(C,n),R=pbe(T);u(!!N),p(!!R),N&&R&&(N.setHours(R.hours,R.minutes,0,0),N>new Date&&e({...t,scheduledTime:jD(N)}))},v=C=>{o(C),b(C,l)},_=C=>{c(C),b(s,C)},k=C=>{const T=C.target.value;if(T){const N=new Date(T);isNaN(N.getTime())||(o(ED(N,n)),c(l8(N,r)),u(!0),p(!0),e({...t,scheduledTime:T}))}},P=()=>{f.current?.showPicker()};return i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm text-bambu-gray mb-2",children:"When to print"}),i.jsxs("div",{className:"flex gap-2",children:[i.jsxs("button",{type:"button",className:`flex-1 px-2 py-2 rounded-lg border text-sm flex items-center justify-center gap-1.5 transition-colors ${t.scheduleType==="asap"?"bg-bambu-green border-bambu-green text-white":"bg-bambu-dark border-bambu-dark-tertiary text-bambu-gray hover:text-white"}`,onClick:()=>x("asap"),children:[i.jsx(er,{className:"w-4 h-4"}),"ASAP"]}),i.jsxs("button",{type:"button",className:`flex-1 px-2 py-2 rounded-lg border text-sm flex items-center justify-center gap-1.5 transition-colors ${t.scheduleType==="scheduled"?"bg-bambu-green border-bambu-green text-white":"bg-bambu-dark border-bambu-dark-tertiary text-bambu-gray hover:text-white"}`,onClick:()=>x("scheduled"),children:[i.jsx(Xr,{className:"w-4 h-4"}),"Scheduled"]}),i.jsxs("button",{type:"button",className:`flex-1 px-2 py-2 rounded-lg border text-sm flex items-center justify-center gap-1.5 transition-colors ${t.scheduleType==="manual"?"bg-bambu-green border-bambu-green text-white":"bg-bambu-dark border-bambu-dark-tertiary text-bambu-gray hover:text-white"}`,onClick:()=>x("manual"),children:[i.jsx(WY,{className:"w-4 h-4"}),"Queue Only"]})]})]}),t.scheduleType==="scheduled"&&i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Date & Time"}),i.jsxs("div",{className:"flex gap-2",children:[i.jsxs("div",{className:"flex-1 relative",children:[i.jsx("input",{type:"text",className:`w-full px-3 py-2 pr-10 bg-bambu-dark border rounded-lg text-white focus:outline-none ${d?"border-bambu-dark-tertiary focus:border-bambu-green":"border-red-500"}`,value:s,onChange:C=>v(C.target.value),placeholder:dbe(n)}),i.jsx("button",{type:"button",onClick:P,className:"absolute right-2 top-1/2 -translate-y-1/2 text-bambu-gray hover:text-white",title:"Open calendar",children:i.jsx(Xr,{className:"w-4 h-4"})})]}),i.jsx("div",{className:"w-32",children:i.jsx("input",{type:"text",className:`w-full px-3 py-2 bg-bambu-dark border rounded-lg text-white focus:outline-none ${m?"border-bambu-dark-tertiary focus:border-bambu-green":"border-red-500"}`,value:l,onChange:C=>_(C.target.value),placeholder:ube(r)})})]}),i.jsx("input",{ref:f,type:"datetime-local",className:"sr-only",value:t.scheduledTime,onChange:k,tabIndex:-1}),(!d||!m)&&i.jsx("p",{className:"mt-1 text-xs text-red-400",children:"Please enter a valid date and time"})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("input",{type:"checkbox",id:"requirePrevious",checked:t.requirePreviousSuccess,onChange:C=>e({...t,requirePreviousSuccess:C.target.checked}),className:"rounded border-bambu-dark-tertiary bg-bambu-dark text-bambu-green focus:ring-bambu-green"}),i.jsx("label",{htmlFor:"requirePrevious",className:"text-sm text-bambu-gray",children:"Only start if previous print succeeded"})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("input",{type:"checkbox",id:"autoOffAfter",checked:t.autoOffAfter,onChange:C=>e({...t,autoOffAfter:C.target.checked}),disabled:!a,className:"rounded border-bambu-dark-tertiary bg-bambu-dark text-bambu-green focus:ring-bambu-green disabled:opacity-50"}),i.jsxs("label",{htmlFor:"autoOffAfter",className:`text-sm flex items-center gap-1 ${a?"text-bambu-gray":"text-bambu-gray/50"}`,children:[i.jsx(wu,{className:"w-3.5 h-3.5"}),"Power off printer when done"]})]}),i.jsx("p",{className:"text-xs text-bambu-gray",children:t.scheduleType==="asap"?"Print will start as soon as the printer is idle.":t.scheduleType==="scheduled"?"Print will start at the scheduled time if the printer is idle. If busy, it will wait until the printer becomes available.":"Print will be staged but won't start automatically. Use the Start button to release it to the queue."})]})}const $g={bed_levelling:!0,flow_cali:!1,vibration_cali:!0,layer_inspect:!1,timelapse:!1},sqe={scheduleType:"asap",scheduledTime:"",requirePreviousSuccess:!1,autoOffAfter:!1};function $c({mode:t,archiveId:e,libraryFileId:n,archiveName:r,queueItem:a,initialSelectedPrinterIds:s,onClose:o,onSuccess:l}){const{t:c}=Mt(),d=tn(),{showToast:u}=bn(),{hasPermission:m}=Rr(),p=!!n&&!e,[f,y]=w.useState(()=>t==="edit-queue-item"&&a?.printer_id?[a.printer_id]:s?.length?s:[]),[x,b]=w.useState(()=>t==="edit-queue-item"&&a?a.plate_id:null),[v,_]=w.useState(!1),[k,P]=w.useState(()=>t==="edit-queue-item"&&a?{bed_levelling:a.bed_levelling??$g.bed_levelling,flow_cali:a.flow_cali??$g.flow_cali,vibration_cali:a.vibration_cali??$g.vibration_cali,layer_inspect:a.layer_inspect??$g.layer_inspect,timelapse:a.timelapse??$g.timelapse}:$g),[C,T]=w.useState(()=>{if(t==="edit-queue-item"&&a){let ot="asap";a.manual_start?ot="manual":a.scheduled_time&&!_G(a.scheduled_time)&&(ot="scheduled");let ft="";if(a.scheduled_time&&!_G(a.scheduled_time)){const qe=Jn(a.scheduled_time)??new Date;ft=jD(qe)}return{scheduleType:ot,scheduledTime:ft,requirePreviousSuccess:a.require_previous_success,autoOffAfter:a.auto_off_after}}return sqe}),[N,R]=w.useState(()=>{if(t==="edit-queue-item"&&a?.ams_mapping&&Array.isArray(a.ams_mapping)){const ot={};return a.ams_mapping.forEach((ft,qe)=>{ft!==-1&&(ot[qe+1]=ft)}),ot}return{}}),[A,D]=w.useState({}),[$,U]=w.useState(()=>t==="edit-queue-item"&&a?.target_model?"model":"printer"),[G,L]=w.useState(()=>t==="edit-queue-item"&&a?.target_model?a.target_model:null),[te,re]=w.useState(()=>t==="edit-queue-item"&&a?.target_location?a.target_location:null),[J,ue]=w.useState(()=>{if(t==="edit-queue-item"&&a?.filament_overrides){const ot={};for(const ft of a.filament_overrides)ot[ft.slot_id]={type:ft.type,color:ft.color};return ot}return{}}),[me,ge]=w.useState(()=>{if(t==="edit-queue-item"&&a?.filament_overrides){const ot={};for(const ft of a.filament_overrides)ot[ft.slot_id]=ft.force_color_match===!0;return ot}return{}}),[X]=w.useState(()=>t==="edit-queue-item"&&a?.printer_id?[a.printer_id]:[]),[ie]=w.useState(()=>t==="edit-queue-item"&&a?a.plate_id:null),[le,pe]=w.useState(!1),[Ce,q]=w.useState({current:0,total:0}),[Z,j]=w.useState(new Set),E=f.length,I=f.length>0?f[0]:null,{data:W}=Je({queryKey:["settings"],queryFn:be.getSettings}),B=al(W?.currency||"USD"),ae=W?.default_filament_cost??0,{data:z,isLoading:V}=Je({queryKey:["printers"],queryFn:be.getPrinters}),{data:ee}=Je({queryKey:["archive",e],queryFn:()=>be.getArchive(e),enabled:!!e&&!p}),{data:K}=Je({queryKey:["library-file",n],queryFn:()=>be.getLibraryFile(n),enabled:p&&!!n}),ne=ee?.sliced_for_model||K?.sliced_for_model||null,{data:se,isError:ce}=Je({queryKey:["archive-plates",e],queryFn:()=>be.getArchivePlates(e),enabled:!!e&&!p,retry:!1}),{data:fe}=Je({queryKey:["library-file-plates",n],queryFn:()=>be.getLibraryFilePlates(n),enabled:p&&!!n}),oe=p?fe:se,{data:O,isError:F}=Je({queryKey:["archive-filaments",e,x],queryFn:()=>be.getArchiveFilamentRequirements(e,x??void 0),enabled:!!e&&!p&&(x!==null||!oe?.is_multi_plate),retry:!1}),{data:Q}=Je({queryKey:["library-file-filaments",n,x],queryFn:()=>be.getLibraryFileFilamentRequirements(n,x??void 0),enabled:p&&!!n&&(x!==null||!oe?.is_multi_plate)}),ve=!p&&(ce||F),he=p?Q:O,de=w.useMemo(()=>{if(!(x===null||!oe?.plates?.length))return oe.plates.find(ot=>ot.index===x)?.name||void 0},[oe,x]),{data:Ae}=Je({queryKey:["available-filaments",G,te],queryFn:()=>be.getAvailableFilaments(G,te??void 0),enabled:$==="model"&&!!G}),{data:_e}=Je({queryKey:["printer-status",I],queryFn:()=>be.getPrinterStatus(I),enabled:!!I}),{amsMapping:ze}=ere(he,_e,N),Be=Y$e(f,z,he,N,A,D);w.useEffect(()=>{oe?.plates&&oe.plates.length>=1&&!x&&b(oe.plates[0].index)},[oe,x]),w.useEffect(()=>{if(t==="edit-queue-item")return;const ot=z?.filter(ft=>ft.is_active)||[];ot.length===1&&f.length===0&&y([ot[0].id])},[t,z,f.length]),w.useEffect(()=>{t==="edit-queue-item"?(JSON.stringify(f.sort())!==JSON.stringify(X.sort())||x!==ie)&&(R({}),D({}),j(new Set)):(R({}),D({}),j(new Set))},[t,f,x,X,ie]);const[Ue,Ne]=w.useState(G),[Ee,ke]=w.useState(x);w.useEffect(()=>{(G!==Ue||x!==Ee)&&(Ne(G),ke(x),(t!=="edit-queue-item"||Ue!==null)&&(ue({}),ge({})))},[G,x,Ue,Ee,t]),w.useEffect(()=>{if(!W?.per_printer_mapping_expanded||f.length<=1)return;const ot=f.filter(ft=>{if(Z.has(ft))return!1;const qe=Be.printerResults.find(ht=>ht.printerId===ft);return qe&&qe.status&&!qe.isLoading});ot.length>0&&(j(ft=>{const qe=new Set(ft);return ot.forEach(ht=>qe.add(ht)),qe}),ot.forEach(ft=>{Be.autoConfigurePrinter(ft)}))},[W?.per_printer_mapping_expanded,f,Z,Be]),w.useEffect(()=>{const ot=ft=>{ft.key==="Escape"&&!le&&o()};return window.addEventListener("keydown",ot),()=>window.removeEventListener("keydown",ot)},[o,le]);const Me=oe?.is_multi_plate??!1,Ge=oe?.plates??[],xe=ut({mutationFn:ot=>be.addToQueue(ot)}),He=ut({mutationFn:ot=>be.updateQueueItem(a.id,ot),onSuccess:()=>{d.invalidateQueries({queryKey:["queue"]}),u("Queue item updated"),l?.(),o()},onError:ot=>{u(ot.message||"Failed to update queue item","error")}}),Pe=async ot=>{if(ot?.preventDefault(),$==="printer"&&f.length===0){u("Please select at least one printer","error");return}if($==="model"&&!G){u("Please select a target printer model","error");return}pe(!0);const ft=v?Ge:[null],qe=$==="model"?ft.length:f.length*ft.length;q({current:0,total:qe});const ht={success:0,failed:0,errors:[]},yt=Xt=>{if(f.length>1){const $t=A[Xt];if($t&&!$t.useDefault)return Be.getFinalMapping(Xt)}return ze},Yt=(()=>{const Xt=[];if(he?.filaments)for(const $t of he.filaments){const nn=J[$t.slot_id],on=me[$t.slot_id]??!1,cn=nn?.type??$t.type,pn=nn?.color??$t.color;(nn||on)&&Xt.push({slot_id:$t.slot_id,type:cn,color:pn,color_name:ru(pn),force_color_match:on})}else for(const[$t,{type:nn,color:on}]of Object.entries(J)){const cn=parseInt($t,10),pn=me[cn]??!1;Xt.push({slot_id:cn,type:nn,color:on,color_name:ru(on),force_color_match:pn})}return Xt.length>0?Xt:void 0})(),xn=(Xt,$t)=>({printer_id:$==="printer"?Xt:null,target_model:$==="model"?G:null,target_location:$==="model"?te:null,filament_overrides:$==="model"?Yt:void 0,archive_id:p?void 0:e,library_file_id:p?n:void 0,require_previous_success:C.requirePreviousSuccess,auto_off_after:C.autoOffAfter,manual_start:C.scheduleType==="manual",ams_mapping:Xt?yt(Xt):void 0,plate_id:$t!==void 0?$t:x,scheduled_time:C.scheduleType==="scheduled"&&C.scheduledTime?new Date(C.scheduledTime).toISOString():void 0,...k});if($==="model"){if(t==="reprint"){u("Model-based assignment only works with queue mode","error"),pe(!1);return}let Xt=0;for(const $t of ft){Xt++,q({current:Xt,total:qe});const nn=$t?$t.index:x;try{if(t==="edit-queue-item"&&!$t){const on={printer_id:null,target_model:G,target_location:te,filament_overrides:Yt||null,require_previous_success:C.requirePreviousSuccess,auto_off_after:C.autoOffAfter,manual_start:C.scheduleType==="manual",ams_mapping:void 0,plate_id:nn,scheduled_time:C.scheduleType==="scheduled"&&C.scheduledTime?new Date(C.scheduledTime).toISOString():null,...k};await He.mutateAsync(on)}else await xe.mutateAsync(xn(null,nn));ht.success++}catch(on){ht.failed++;const cn=$t?$t.name||`Plate ${$t.index}`:"";ht.errors.push(cn?`${cn}: ${on.message}`:on.message)}}}else{let Xt=0;for(const $t of ft){const nn=$t?$t.index:x;for(let on=0;on<f.length;on++){const cn=f[on];Xt++,q({current:Xt,total:qe});try{if(t==="reprint"){const pn=yt(cn);p?await be.printLibraryFile(n,cn,{plate_id:x??void 0,plate_name:de,ams_mapping:pn,...k}):await be.reprintArchive(e,cn,{plate_id:x??void 0,plate_name:de,ams_mapping:pn,...k})}else if(t==="edit-queue-item"&&Xt===1){const pn=yt(cn),Ie={printer_id:cn,target_model:null,target_location:null,require_previous_success:C.requirePreviousSuccess,auto_off_after:C.autoOffAfter,manual_start:C.scheduleType==="manual",ams_mapping:pn,plate_id:nn,scheduled_time:C.scheduleType==="scheduled"&&C.scheduledTime?new Date(C.scheduledTime).toISOString():null,...k};await He.mutateAsync(Ie)}else await xe.mutateAsync(xn(cn,nn));ht.success++}catch(pn){ht.failed++;const Ie=z?.find(at=>at.id===cn)?.name||`Printer ${cn}`,De=$t?$t.name||`Plate ${$t.index}`:"",Xe=De?`${Ie} (${De})`:Ie;ht.errors.push(`${Xe}: ${pn.message}`)}}}}pe(!1),ht.failed===0?(t!=="reprint"&&(t==="edit-queue-item"?u("Queue item updated"):ht.success===1?u($==="model"?`Queued for any ${G}`:c("queue.printQueued")):u(c("queue.itemsQueued",{count:ht.success}))),d.invalidateQueries({queryKey:["queue"]}),l?.(),o()):ht.success===0?u(`Failed: ${ht.errors[0]}`,"error"):(u(`${ht.success} succeeded, ${ht.failed} failed`,"error"),d.invalidateQueries({queryKey:["queue"]}))},Ve=le||He.isPending,je=w.useMemo(()=>!(Ve||$==="printer"&&f.length===0||$==="model"&&!G||$==="model"&&t==="reprint"||Me&&!x&&!v),[f.length,$,G,t,Me,x,v,Ve]),$e=(()=>{const ot=f.length;if(t==="reprint")return{title:c(p?"queue.print":"queue.reprint"),icon:kr,submitText:ot>1?c("queue.printToPrinters",{count:ot}):c("queue.print"),submitIcon:kr,loadingText:Ce.total>1?c("queue.sendingProgress",{current:Ce.current,total:Ce.total}):c("queue.sending")};if(t==="add-to-queue"){let ft=c("queue.addToQueue");return v&&Ge.length>1?ft=c("queue.queueAllPlates",{count:Ge.length}):ot>1&&(ft=c("queue.queueToPrinters",{count:ot})),{title:c("queue.schedulePrint"),icon:Xr,submitText:ft,submitIcon:Xr,loadingText:Ce.total>1?c("queue.addingProgress",{current:Ce.current,total:Ce.total}):c("queue.adding")}}return{title:c("queue.editQueueItem"),icon:Wi,submitText:c("common.save"),submitIcon:Wi,loadingText:Ce.total>1?c("queue.savingProgress",{current:Ce.current,total:Ce.total}):c("common.saving")}})(),Ye=$e.icon,lt=$e.submitIcon,St=I&&!v&&(p||(Me?x!==null:!0));return i.jsx("div",{className:"fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-4",onClick:le?void 0:o,children:i.jsx(Tt,{className:"w-full max-w-2xl max-h-[90vh] overflow-y-auto",onClick:ot=>ot.stopPropagation(),children:i.jsxs(Pt,{className:t==="reprint"?"":"p-0",children:[i.jsxs("div",{className:`flex items-center justify-between ${t==="reprint"?"mb-4":"p-4 border-b border-bambu-dark-tertiary"}`,children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(Ye,{className:"w-5 h-5 text-bambu-green"}),i.jsx("h2",{className:"text-lg font-semibold text-white",children:$e.title})]}),i.jsx(Fe,{variant:"ghost",size:"sm",onClick:o,disabled:le,children:i.jsx(zt,{className:"w-5 h-5"})})]}),i.jsxs("form",{onSubmit:Pe,className:t==="reprint"?"":"p-4 space-y-4",children:[i.jsx("p",{className:`text-sm text-bambu-gray ${t==="reprint"?"mb-4":""}`,children:t==="reprint"?i.jsxs(i.Fragment,{children:["Send ",i.jsx("span",{className:"text-white",children:r})," to"," ",s?.length===1&&z?i.jsx("span",{className:"text-white",children:z.find(ot=>ot.id===s[0])?.name??"printer(s)"}):"printer(s)"]}):i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"block text-bambu-gray mb-1",children:"Print Job"}),i.jsx("span",{className:"text-white font-medium truncate block",children:r})]})}),i.jsx(J$e,{plates:Ge,isMultiPlate:Me,selectedPlate:x,onSelect:b,queueAll:v,onQueueAllChange:t==="add-to-queue"?_:void 0}),!s?.length&&i.jsx(nqe,{printers:z||[],selectedPrinterIds:f,onMultiSelect:y,isLoading:V,allowMultiple:!0,showInactive:t==="edit-queue-item",disableBusy:t==="reprint",printerMappingResults:Be.printerResults,filamentReqs:he,onAutoConfigurePrinter:Be.autoConfigurePrinter,onUpdatePrinterConfig:Be.updatePrinterConfig,assignmentMode:t==="reprint"?"printer":$,onAssignmentModeChange:t!=="reprint"?U:void 0,targetModel:G,onTargetModelChange:t!=="reprint"?L:void 0,targetLocation:te,onTargetLocationChange:t!=="reprint"?re:void 0,slicedForModel:ne}),$==="model"&&G&&he&&Ae&&Ae.length>0&&i.jsx(Z$e,{filamentReqs:he,availableFilaments:Ae,overrides:J,onChange:ue,forceColorMatch:me,onForceColorMatchChange:(ot,ft)=>ge(qe=>({...qe,[ot]:ft}))}),ne&&$==="printer"&&f.length===1&&(()=>{const ot=z?.find(ft=>ft.id===f[0]);return ot&&ot.model&&ne!==ot.model?i.jsxs("div",{className:"p-3 mb-2 bg-yellow-500/10 border border-yellow-500/30 rounded-lg flex items-center gap-2",children:[i.jsx(En,{className:"w-4 h-4 text-yellow-400 flex-shrink-0"}),i.jsxs("span",{className:"text-sm text-yellow-400",children:["File was sliced for ",ne,", but printing on ",ot.model]})]}):null})(),ve&&i.jsxs("div",{className:"flex items-start gap-2 p-3 mb-2 bg-orange-500/10 border border-orange-500/30 rounded-lg text-sm",children:[i.jsx(Ii,{className:"w-4 h-4 text-orange-400 mt-0.5 flex-shrink-0"}),i.jsx("p",{className:"text-orange-400",children:"Archive data unavailable. The source file may have been deleted. Filament mapping is disabled."})]}),St&&!ve&&f.length===1&&i.jsx(Q$e,{printerId:I,filamentReqs:he,manualMappings:N,onManualMappingChange:R,defaultExpanded:!!s?.length||(W?.per_printer_mapping_expanded??!1),currencySymbol:B,defaultCostPerKg:ae}),(t==="reprint"||E>0||$==="model"&&G)&&i.jsx(iqe,{options:k,onChange:P,defaultExpanded:!!s?.length}),t!=="reprint"&&i.jsx(aqe,{options:C,onChange:T,dateFormat:W?.date_format||"system",timeFormat:W?.time_format||"system",canControlPrinter:m("printers:control")}),He.isError&&i.jsx("div",{className:"mb-4 p-3 bg-red-500/20 border border-red-500/50 rounded-lg text-sm text-red-400",children:He.error?.message||"Failed to complete operation"}),i.jsxs("div",{className:`flex gap-3 ${t==="reprint"?"":"pt-2"}`,children:[i.jsx(Fe,{type:"button",variant:"secondary",onClick:o,className:"flex-1",disabled:le,children:"Cancel"}),i.jsx(Fe,{type:"submit",disabled:!je,className:"flex-1",children:Ve?i.jsxs(i.Fragment,{children:[i.jsx(ct,{className:"w-4 h-4 animate-spin"}),$e.loadingText]}):i.jsxs(i.Fragment,{children:[i.jsx(lt,{className:"w-4 h-4"}),$e.submitText]})})]})]})]})})})}function CG({value:t}){const{t:e}=Mt(),[n,r]=w.useState(!1),a=async()=>{try{await navigator.clipboard.writeText(t),r(!0),setTimeout(()=>r(!1),2e3)}catch{}};return i.jsx("button",{onClick:a,className:"ml-2 p-1 rounded hover:bg-bambu-dark-tertiary text-bambu-gray hover:text-white transition-colors",title:e(n?"printers.copied":"printers.copyToClipboard"),children:n?i.jsx(Vr,{className:"w-3.5 h-3.5 text-bambu-green"}):i.jsx(wl,{className:"w-3.5 h-3.5"})})}function oqe({printer:t,status:e,totalPrintHours:n,onClose:r}){const{t:a}=Mt();w.useEffect(()=>{const o=l=>{l.key==="Escape"&&r()};return window.addEventListener("keydown",o),()=>window.removeEventListener("keydown",o)},[r]);const s=[];if(s.push({label:a("printers.model"),value:t.model??"—"}),s.push({label:a("common.status"),value:i.jsxs("span",{className:`inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium ${e?.connected?"bg-bambu-green/20 text-bambu-green":"bg-red-500/20 text-red-400"}`,children:[i.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${e?.connected?"bg-bambu-green":"bg-red-400"}`}),e?.connected?a("printers.status.available"):a("printers.status.offline")]})}),e?.state){const o={IDLE:"printers.status.idle",RUNNING:"printers.status.printing",PAUSE:"printers.status.paused",FINISH:"printers.status.finished",FAILED:"printers.status.error"};s.push({label:a("printers.state"),value:a(o[e.state]??"printers.status.unknown")})}if(s.push({label:a("printers.ipAddress"),value:i.jsxs("span",{className:"flex items-center",children:[i.jsx("span",{className:"font-mono",children:t.ip_address}),i.jsx(CG,{value:t.ip_address})]})}),s.push({label:a("printers.serialNumber"),value:i.jsxs("span",{className:"flex items-center",children:[i.jsx("span",{className:"font-mono truncate",children:t.serial_number}),i.jsx(CG,{value:t.serial_number})]})}),e?.wifi_signal!=null){const o=FQ(e.wifi_signal);s.push({label:a("printers.wifiSignalLabel"),value:i.jsxs("span",{className:"flex items-center gap-2",children:[i.jsx(ZY,{className:`w-4 h-4 ${o.color}`}),i.jsx("span",{className:o.color,children:a(o.labelKey)}),i.jsxs("span",{className:"text-bambu-gray text-xs",children:["(",e.wifi_signal," dBm)"]})]})})}return s.push({label:a("printers.firmware"),value:e?.firmware_version??"—"}),e?.developer_mode!=null&&s.push({label:a("printers.developerMode"),value:i.jsx("span",{className:`inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium ${e.developer_mode?"bg-bambu-green/20 text-bambu-green":"bg-bambu-dark-tertiary text-bambu-gray"}`,children:e.developer_mode?a("printers.enabled"):a("printers.disabled")})}),s.push({label:a("printers.nozzleCount"),value:t.nozzle_count}),e?.sdcard!=null&&s.push({label:a("printers.sdCard"),value:i.jsx("span",{className:`inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium ${e.sdcard?"bg-bambu-green/20 text-bambu-green":"bg-bambu-dark-tertiary text-bambu-gray"}`,children:e.sdcard?a("printers.inserted"):a("printers.notInserted")})}),s.push({label:a("printers.autoArchive"),value:i.jsx("span",{className:`inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium ${t.auto_archive?"bg-bambu-green/20 text-bambu-green":"bg-bambu-dark-tertiary text-bambu-gray"}`,children:t.auto_archive?a("printers.enabled"):a("printers.disabled")})}),n!=null&&n>0&&s.push({label:a("printers.totalPrintHours"),value:`${Math.round(n)}h`}),t.location&&s.push({label:a("printers.sort.location"),value:t.location}),s.push({label:a("printers.addedOn"),value:Gp(t.created_at)}),i.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",role:"dialog","aria-modal":"true",onClick:r,children:i.jsx(Tt,{className:"w-full max-w-md",onClick:o=>o.stopPropagation(),children:i.jsxs(Pt,{children:[i.jsxs("div",{className:"flex items-center justify-between mb-4",children:[i.jsx("h2",{className:"text-lg font-semibold text-white",children:t.name}),i.jsx("button",{onClick:r,className:"p-1 hover:bg-bambu-dark rounded flex-shrink-0",children:i.jsx(zt,{className:"w-5 h-5 text-bambu-gray"})})]}),i.jsx("div",{className:"flex justify-center mb-4",children:i.jsx("img",{src:RQ(t.model),alt:t.model??t.name,className:"h-24 object-contain"})}),i.jsx("div",{className:"space-y-0",children:s.map((o,l)=>i.jsxs("div",{className:"flex items-center justify-between gap-4 py-2.5 border-b border-bambu-dark-tertiary last:border-0",children:[i.jsx("span",{className:"text-sm text-bambu-gray whitespace-nowrap",children:o.label}),i.jsx("span",{className:"text-sm text-white text-right",children:o.value})]},l))})]})})})}function lqe(t){if(!t||t.length<6)return!1;const e=parseInt(t.slice(0,2),16),n=parseInt(t.slice(2,4),16),r=parseInt(t.slice(4,6),16);return(.299*e+.587*n+.114*r)/255>.6}function sj({trayColor:t,trayType:e,isEmpty:n,slotNumber:r}){return i.jsx("div",{className:"w-3.5 h-3.5 rounded-full mx-auto mb-0.5 border-2 flex items-center justify-center",style:{backgroundColor:t?`#${t}`:e?"#333":"transparent",borderColor:n?"#666":"rgba(255,255,255,0.1)",borderStyle:n?"dashed":"solid"},children:i.jsx("span",{className:"text-[6px] font-bold leading-none select-none",style:{color:t&&lqe(t)?"#000":"#fff"},children:r})})}const TG={"A00-W1":"Jade White","A00-P0":"Beige","A00-D2":"Light Gray","A00-Y0":"Yellow","A00-Y2":"Sunflower Yellow","A00-A1":"Pumpkin Orange","A00-A0":"Orange","A00-Y4":"Gold","A00-G3":"Bright Green","A00-G1":"Bambu Green","A00-G2":"Mistletoe Green","A00-R3":"Hot Pink","A00-P6":"Magenta","A00-R0":"Red","A00-R2":"Maroon Red","A00-P5":"Purple","A00-P2":"Indigo Purple","A00-B5":"Turquoise","A00-B8":"Cyan","A00-B3":"Cobalt Blue","A00-N0":"Brown","A00-N1":"Cocoa Brown","A00-Y3":"Bronze","A00-D0":"Gray","A00-D1":"Silver","A00-B1":"Blue Grey","A00-D3":"Dark Gray","A00-K0":"Black","A00-M3":"Pink Citrus","A00-M6":"Dusk Glare","A00-M0":"Arctic Whisper","A00-M1":"Solar Breeze","A00-M5":"Blueberry Bubblegum","A00-M4":"Mint Lime","A00-M2":"Ocean to Meadow","A00-M7":"Cotton Candy Cloud","A18-K0":"Black","A18-D0":"Gray","A18-W0":"White","A18-R0":"Red","A18-Y0":"Yellow","A18-B0":"Cyan","A18-B1":"Blue","A18-P0":"Matte Beige","A01-W2":"Ivory White","A01-W3":"Bone White","A01-Y2":"Lemon Yellow","A01-A2":"Mandarin Orange","A01-P3":"Sakura Pink","A01-P4":"Lilac Purple","A01-R3":"Plum","A01-R1":"Scarlet Red","A01-R4":"Dark Red","A01-G0":"Apple Green","A01-G1":"Grass Green","A01-G7":"Dark Green","A01-B4":"Ice Blue","A01-B0":"Sky Blue","A01-B3":"Marine Blue","A01-B6":"Dark Blue","A01-Y3":"Desert Tan","A01-N1":"Latte Brown","A01-N3":"Caramel","A01-R2":"Terracotta","A01-N2":"Dark Brown","A01-N0":"Dark Chocolate","A01-D3":"Ash Gray","A01-D0":"Nardo Gray","A01-K1":"Charcoal","A12-G0":"Green","A12-R0":"Pink","A12-A0":"Orange","A12-Y0":"Yellow","A12-B0":"Blue","A07-R5":"Red Granite","A07-D4":"White Marble","A11-W0":"White","A11-K0":"Black","A08-G3":"Alpine Green Sparkle","A08-D5":"Slate Gray Sparkle","A08-B7":"Royal Purple Sparkle","A08-R2":"Crimson Red Sparkle","A08-K2":"Onyx Black Sparkle","A08-Y1":"Classic Gold Sparkle","A02-B2":"Cobalt Blue Metallic","A02-G2":"Oxide Green Metallic","A02-Y1":"Iridium Gold Metallic","A02-D2":"Iron Gray Metallic","A17-B1":"Blue","A17-A0":"Orange","A17-P0":"Purple","A06-Y1":"Gold","A06-D0":"Titan Gray","A06-D1":"Silver","A06-W0":"White","A06-R0":"Candy Red","A06-G0":"Candy Green","A06-G1":"Mint","A06-B1":"Blue","A06-B0":"Baby Blue","A06-P0":"Purple","A06-R1":"Rose Gold","A06-R2":"Pink","A06-Y0":"Champagne","A05-M8":"Dawn Radiance","A05-M4":"Aurora Purple","A05-M1":"South Beach","A05-T3":"Neon City","A05-T2":"Midnight Blaze","A05-T1":"Gilded Rose","A05-T4":"Blue Hawaii","A05-T5":"Velvet Eclipse","A15-B0":"Purple","A15-G0":"Green","A15-G1":"Nebulae","A15-R0":"Brown","A16-K0":"Black Walnut","A16-R0":"Rosewood","A16-N0":"Clay Brown","A16-G0":"Classic Birch","A16-W0":"White Oak","A16-Y0":"Ochre Yellow","A50-D6":"Lava Gray","A50-K0":"Black","A50-B6":"Royal Blue","A10-W0":"White","A10-D0":"Gray","A09-B5":"Lavender Blue","A09-B4":"Light Blue","A09-A0":"Orange","A09-D1":"Silver","A09-R3":"Vermilion Red","A09-Y0":"Yellow","G02-K0":"Black","G02-W0":"White","G02-R0":"Red","G02-D0":"Gray","G02-D1":"Dark Gray","G02-Y1":"Cream","G02-Y0":"Yellow","G02-A0":"Orange","G02-N1":"Peanut Brown","G02-G1":"Lime Green","G02-G0":"Green","G02-G2":"Forest Green","G02-B1":"Lake Blue","G02-B0":"Blue","G01-G1":"Translucent Teal","G01-B0":"Translucent Light Blue","G01-C0":"Clear","G01-D0":"Translucent Gray","G01-G0":"Translucent Olive","G01-N0":"Translucent Brown","G01-A0":"Translucent Orange","G01-P1":"Translucent Pink","G01-P0":"Translucent Purple","G50-P7":"Violet Purple","G50-K0":"Black","B00-D1":"Silver","B00-K0":"Black","B00-W0":"White","B00-G6":"Bambu Green","B00-G7":"Olive","B00-Y1":"Tangerine Yellow","B00-A0":"Orange","B00-R0":"Red","B00-B4":"Azure","B00-B0":"Blue","B00-B6":"Navy Blue","B50-A0":"Orange","B50-K0":"Black","B01-W0":"White","B01-K0":"Black","B01-D0":"Gray","B02-W0":"White","C00-C1":"Transparent","C00-C0":"Clear Black","C00-K0":"Black","C00-W0":"White","C01-K0":"Black","U02-B0":"Blue","U02-D0":"Gray","U02-K0":"Black","N04-K0":"Black","N08-K0":"Black","S02-W0":"Nature","S02-W1":"White","S05-C0":"Black","S06-W0":"White","S03-G1":"Green","S04-Y0":"Clear"},cqe={W0:"White",W1:"Jade White",W2:"Ivory White",W3:"Bone White",Y0:"Yellow",Y1:"Gold",Y2:"Sunflower Yellow",Y3:"Bronze",Y4:"Gold",A0:"Orange",A1:"Pumpkin Orange",A2:"Mandarin Orange",R0:"Red",R1:"Scarlet Red",R2:"Maroon Red",R3:"Hot Pink",R4:"Dark Red",R5:"Red Granite",P0:"Beige",P1:"Pink",P2:"Indigo Purple",P3:"Sakura Pink",P4:"Lilac Purple",P5:"Purple",P6:"Magenta",P7:"Violet Purple",B0:"Blue",B1:"Blue Grey",B2:"Cobalt Blue",B3:"Cobalt Blue",B4:"Ice Blue",B5:"Turquoise",B6:"Navy Blue",B7:"Royal Purple",B8:"Cyan",G0:"Green",G1:"Grass Green",G2:"Mistletoe Green",G3:"Bright Green",G6:"Bambu Green",G7:"Dark Green",N0:"Brown",N1:"Peanut Brown",N2:"Dark Brown",N3:"Caramel",D0:"Gray",D1:"Silver",D2:"Light Gray",D3:"Dark Gray",D4:"White Marble",D5:"Slate Gray",D6:"Lava Gray",K0:"Black",K1:"Charcoal",K2:"Onyx Black",C0:"Clear Black",C1:"Transparent",M0:"Arctic Whisper",M1:"Solar Breeze",M2:"Ocean to Meadow",M3:"Pink Citrus",M4:"Aurora Purple",M5:"Blueberry Bubblegum",M6:"Dusk Glare",M7:"Cotton Candy Cloud",M8:"Dawn Radiance",T1:"Gilded Rose",T2:"Midnight Blaze",T3:"Neon City",T4:"Blue Hawaii",T5:"Velvet Eclipse"};function oj(t){if(!t)return null;if(TG[t])return TG[t];const e=t.split("-");if(e.length<2)return null;const n=e[1];return cqe[n]||null}function lj(t){return(t??.02).toFixed(3)}function PG({side:t}){const{mode:e}=bf(),n=e==="dark"?"#1a4d2e":"#e7f5e9";return i.jsx("span",{className:"inline-flex items-center justify-center w-4 h-4 text-[10px] font-bold rounded",style:{backgroundColor:n,color:"#00ae42"},children:t})}function nre(t,e){if(!t)return"";if(t.includes("hardened"))return e("printers.nozzleHardenedSteel");if(t.includes("stainless"))return e("printers.nozzleStainlessSteel");if(t.includes("tungsten"))return e("printers.nozzleTungstenCarbide");if(t.length>=4){const n=t.slice(2,4);if(n==="00")return e("printers.nozzleStainlessSteel");if(n==="01")return e("printers.nozzleHardenedSteel");if(n==="05")return e("printers.nozzleTungstenCarbide")}return t==="00"?e("printers.nozzleStainlessSteel"):t==="01"?e("printers.nozzleHardenedSteel"):t==="05"?e("printers.nozzleTungstenCarbide"):t.startsWith("H")?e("printers.nozzleHardenedSteel"):t}function rre(t,e){return t?t.startsWith("HH")?e("printers.nozzleHighFlow"):t.startsWith("HS")?e("printers.nozzleStandardFlow"):"":""}function ire({slot:t,index:e,activeStatus:n,filamentName:r,children:a}){const{t:s}=Mt(),[o,l]=w.useState(!1),[c,d]=w.useState("top"),u=w.useRef(null),m=w.useRef(null),p=w.useRef(null),f=!t.nozzle_diameter&&!t.nozzle_type,y=t.stat===1;w.useEffect(()=>{if(o&&u.current&&m.current){const P=u.current.getBoundingClientRect(),C=m.current.offsetHeight,N=P.top-56,R=window.innerHeight-P.bottom;N<C+12&&R>N?d("bottom"):d("top")}},[o]);const x=()=>{p.current&&clearTimeout(p.current),p.current=setTimeout(()=>l(!0),80)},b=()=>{p.current&&clearTimeout(p.current),p.current=setTimeout(()=>l(!1),100)};w.useEffect(()=>()=>{p.current&&clearTimeout(p.current)},[]);const v=R4(t.filament_color),_=nre(t.nozzle_type,s),k=rre(t.nozzle_type,s);return i.jsxs("div",{ref:u,className:"relative",onMouseEnter:x,onMouseLeave:b,children:[a,o&&i.jsxs("div",{ref:m,className:`
- absolute left-1/2 -translate-x-1/2 z-50
- ${c==="top"?"bottom-full mb-2":"top-full mt-2"}
- animate-in fade-in-0 zoom-in-95 duration-150
- `,style:{maxWidth:"calc(100vw - 24px)"},children:[i.jsx("div",{className:"w-44 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg shadow-xl overflow-hidden backdrop-blur-sm",children:f?i.jsxs("div",{className:"px-3 py-2 text-xs text-bambu-gray text-center whitespace-nowrap",children:["Slot ",e+1," — Empty"]}):i.jsxs("div",{className:"p-2.5 space-y-1.5",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("span",{className:"text-[10px] uppercase tracking-wider text-bambu-gray font-medium",children:s("printers.nozzleDiameter")}),i.jsxs("span",{className:"text-xs text-white font-semibold",children:[t.nozzle_diameter," mm"]})]}),_&&i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("span",{className:"text-[10px] uppercase tracking-wider text-bambu-gray font-medium",children:s("printers.nozzleType")}),i.jsx("span",{className:"text-xs text-white font-semibold truncate max-w-[100px]",children:_})]}),k&&i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("span",{className:"text-[10px] uppercase tracking-wider text-bambu-gray font-medium",children:s("printers.nozzleFlow")}),i.jsx("span",{className:"text-xs text-white font-semibold",children:k})]}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("span",{className:"text-[10px] uppercase tracking-wider text-bambu-gray font-medium",children:s("printers.nozzleStatus")}),i.jsx("span",{className:`text-[10px] font-bold px-1.5 py-0.5 rounded ${n||y?"bg-green-900/50 text-green-400":"bg-bambu-dark-tertiary text-bambu-gray"}`,children:s(n?"printers.nozzleActive":y?"printers.nozzleMounted":"printers.nozzleDocked")})]}),t.wear!=null&&i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("span",{className:"text-[10px] uppercase tracking-wider text-bambu-gray font-medium",children:s("printers.nozzleWear")}),i.jsxs("span",{className:"text-xs text-white font-semibold",children:[t.wear,"%"]})]}),t.max_temp>0&&i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("span",{className:"text-[10px] uppercase tracking-wider text-bambu-gray font-medium",children:s("printers.nozzleMaxTemp")}),i.jsxs("span",{className:"text-xs text-white font-semibold",children:[t.max_temp,"°C"]})]}),t.serial_number&&i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("span",{className:"text-[10px] uppercase tracking-wider text-bambu-gray font-medium",children:s("printers.nozzleSerial")}),i.jsx("span",{className:"text-[10px] text-white font-mono truncate max-w-[80px]",children:t.serial_number})]}),(v||t.filament_type)&&i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("span",{className:"text-[10px] uppercase tracking-wider text-bambu-gray font-medium",children:s("printers.nozzleFilament")}),i.jsxs("div",{className:"flex items-center gap-1",children:[v&&i.jsx("div",{className:"w-3 h-3 rounded-sm border border-white/20",style:{backgroundColor:v}}),i.jsx("span",{className:"text-[10px] text-white font-semibold truncate max-w-[100px]",children:r||t.filament_type||t.filament_id||""})]})]})]})}),i.jsx("div",{className:`
- absolute left-1/2 -translate-x-1/2 w-0 h-0
- border-l-[6px] border-l-transparent
- border-r-[6px] border-r-transparent
- ${c==="top"?"top-full border-t-[6px] border-t-bambu-dark-tertiary":"bottom-full border-b-[6px] border-b-bambu-dark-tertiary"}
- `})]})]})}function dqe({leftSlot:t,rightSlot:e,activeNozzle:n,filamentInfo:r,children:a}){const{t:s}=Mt(),[o,l]=w.useState(!1),[c,d]=w.useState("top"),u=w.useRef(null),m=w.useRef(null),p=w.useRef(null);w.useEffect(()=>{if(o&&u.current&&m.current){const b=u.current.getBoundingClientRect(),v=m.current.offsetHeight,k=b.top-56,P=window.innerHeight-b.bottom;k<v+12&&P>k?d("bottom"):d("top")}},[o]);const f=()=>{p.current&&clearTimeout(p.current),p.current=setTimeout(()=>l(!0),80)},y=()=>{p.current&&clearTimeout(p.current),p.current=setTimeout(()=>l(!1),100)};if(w.useEffect(()=>()=>{p.current&&clearTimeout(p.current)},[]),!t&&!e)return i.jsx(i.Fragment,{children:a});const x=(b,v)=>{const _=n===v,k=nre(b.nozzle_type,s),P=rre(b.nozzle_type,s),C=R4(b.filament_color),T=b.filament_id?r?.[b.filament_id]?.name:void 0;return i.jsxs("div",{className:"flex-1 space-y-1.5",children:[i.jsx("div",{className:`text-[10px] font-bold pb-1 border-b border-bambu-dark-tertiary/50 ${_?"text-amber-400":"text-bambu-gray"}`,children:s(v==="L"?"common.left":"common.right")}),b.nozzle_diameter&&i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("span",{className:"text-[10px] text-bambu-gray",children:s("printers.nozzleDiameter")}),i.jsxs("span",{className:"text-xs text-white font-semibold",children:[b.nozzle_diameter," mm"]})]}),k&&i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("span",{className:"text-[10px] text-bambu-gray",children:s("printers.nozzleType")}),i.jsx("span",{className:"text-[10px] text-white font-semibold",children:k})]}),P&&i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("span",{className:"text-[10px] text-bambu-gray",children:s("printers.nozzleFlow")}),i.jsx("span",{className:"text-[10px] text-white font-semibold",children:P})]}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("span",{className:"text-[10px] text-bambu-gray",children:s("printers.nozzleStatus")}),i.jsx("span",{className:`text-[10px] font-bold px-1.5 py-0.5 rounded ${_?"bg-green-900/50 text-green-400":"bg-bambu-dark-tertiary text-bambu-gray"}`,children:s(_?"printers.nozzleActive":"printers.nozzleIdle")})]}),b.wear!=null&&i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("span",{className:"text-[10px] text-bambu-gray",children:s("printers.nozzleWear")}),i.jsxs("span",{className:"text-xs text-white font-semibold",children:[b.wear,"%"]})]}),v==="R"&&b.max_temp>0&&i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("span",{className:"text-[10px] text-bambu-gray",children:s("printers.nozzleMaxTemp")}),i.jsxs("span",{className:"text-xs text-white font-semibold",children:[b.max_temp,"°C"]})]}),v==="R"&&b.serial_number&&i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("span",{className:"text-[10px] text-bambu-gray",children:s("printers.nozzleSerial")}),i.jsx("span",{className:"text-[10px] text-white font-mono",children:b.serial_number})]}),(C||b.filament_type||b.filament_id)&&i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("span",{className:"text-[10px] text-bambu-gray",children:s("printers.nozzleFilament")}),i.jsxs("div",{className:"flex items-center gap-1",children:[C&&i.jsx("div",{className:"w-3 h-3 rounded-sm border border-white/20",style:{backgroundColor:C}}),i.jsx("span",{className:"text-[10px] text-white font-semibold truncate max-w-[100px]",children:T||b.filament_type||b.filament_id||""})]})]})]})};return i.jsxs("div",{ref:u,className:"relative flex-1",onMouseEnter:f,onMouseLeave:y,children:[a,o&&i.jsxs("div",{ref:m,className:`
- absolute left-1/2 -translate-x-1/2 z-50
- ${c==="top"?"bottom-full mb-2":"top-full mt-2"}
- animate-in fade-in-0 zoom-in-95 duration-150
- `,style:{maxWidth:"calc(100vw - 24px)"},children:[i.jsx("div",{className:"w-96 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg shadow-xl overflow-hidden backdrop-blur-sm",children:i.jsxs("div",{className:"p-2.5 flex gap-3",children:[t&&x(t,"L"),t&&e&&i.jsx("div",{className:"w-px bg-bambu-dark-tertiary/50"}),e&&x(e,"R")]})}),i.jsx("div",{className:`
- absolute left-1/2 -translate-x-1/2 w-0 h-0
- border-l-[6px] border-l-transparent
- border-r-[6px] border-r-transparent
- ${c==="top"?"top-full border-t-[6px] border-t-bambu-dark-tertiary":"bottom-full border-b-[6px] border-b-bambu-dark-tertiary"}
- `})]})]})}function uqe({slots:t,filamentInfo:e}){const{t:n}=Mt(),r=t.filter(l=>l.id>=2),a=6,s=r.length>0?Math.min(...r.map(l=>l.id)):16,o=Array.from({length:a},(l,c)=>r.find(d=>d.id===s+c)??{id:-(c+1),nozzle_type:"",nozzle_diameter:"",wear:null,stat:null,max_temp:0,serial_number:"",filament_color:"",filament_id:"",filament_type:""});return i.jsxs("div",{className:"text-center px-2.5 py-1.5 bg-bambu-dark rounded-lg flex-[2_1_190px] flex flex-col justify-center",children:[i.jsx("p",{className:"text-[9px] text-bambu-gray mb-1",children:n("printers.nozzleRack")}),i.jsx("div",{className:"flex gap-[3px] justify-center",children:o.map((l,c)=>{const d=!l.nozzle_diameter&&!l.nozzle_type,u=d?null:R4(l.filament_color),m=u?Xne(l.filament_color):!1;return i.jsx(ire,{slot:l,index:c,filamentName:l.filament_id?e?.[l.filament_id]?.name:void 0,children:i.jsx("div",{className:`w-7 h-7 rounded flex items-center justify-center cursor-default transition-colors border-b-2 ${d?"bg-bambu-dark-tertiary/20 border-bambu-dark-tertiary/20":"bg-bambu-dark-tertiary/40 border-bambu-dark-tertiary/40"}`,style:u?{backgroundColor:u}:void 0,children:i.jsx("span",{className:`text-[10px] font-semibold ${d?"text-bambu-gray/30":m?"text-black/80":"text-white"}`,style:u&&!m?{textShadow:"0 1px 3px rgba(0,0,0,0.9)"}:void 0,children:d?"—":l.nozzle_diameter||"?"})})},l.id>=0?l.id:`empty-${c}`)})})]})}function AG({className:t}){return i.jsx("svg",{className:t,viewBox:"0 0 36 54",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:i.jsx("path",{d:"M17.8131 0.00538C18.4463 -0.15091 20.3648 3.14642 20.8264 3.84781C25.4187 10.816 35.3089 26.9368 35.9383 34.8694C37.4182 53.5822 11.882 61.3357 2.53721 45.3789C-1.73471 38.0791 0.016 32.2049 3.178 25.0232C6.99221 16.3662 12.6411 7.90372 17.8131 0.00538ZM18.3738 7.24807L17.5881 7.48441C14.4452 12.9431 10.917 18.2341 8.19369 23.9368C4.6808 31.29 1.18317 38.5479 7.69403 45.5657C17.3058 55.9228 34.9847 46.8808 31.4604 32.8681C29.2558 24.0969 22.4207 15.2913 18.3776 7.24807H18.3738Z",fill:"#C3C2C1"})})}function mqe({className:t}){return i.jsxs("svg",{className:t,viewBox:"0 0 35 53",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[i.jsx("path",{d:"M17.3165 0.0038C17.932 -0.14959 19.7971 3.08645 20.2458 3.77481C24.7103 10.6135 34.3251 26.4346 34.937 34.2198C36.3757 52.5848 11.5505 60.1942 2.46584 44.534C-1.68714 37.3735 0.0148 31.6085 3.08879 24.5603C6.79681 16.0605 12.2884 7.75907 17.3165 0.0038ZM17.8615 7.11561L17.0977 7.34755C14.0423 12.7048 10.6124 17.8974 7.96483 23.4941C4.54975 30.7107 1.14949 37.8337 7.47908 44.721C16.8233 54.8856 34.01 46.0117 30.5838 32.2595C28.4405 23.6512 21.7957 15.0093 17.8652 7.11561H17.8615Z",fill:"#C3C2C1"}),i.jsx("path",{d:"M5.03547 30.112C9.64453 30.4936 11.632 35.7985 16.4154 35.791C19.6339 35.7873 20.2161 33.2283 22.3853 31.6197C31.6776 24.7286 33.5835 37.4894 27.9881 44.4254C18.1878 56.5653 -1.16063 44.6013 5.03917 30.1158L5.03547 30.112Z",fill:"#1F8FEB"})]})}function hqe({className:t}){return i.jsxs("svg",{className:t,viewBox:"0 0 36 54",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[i.jsx("path",{d:"M17.9625 4.48059L4.77216 26.3154L2.08228 40.2175L10.0224 50.8414H23.1594L33.3246 42.1693V30.2455L17.9625 4.48059Z",fill:"#1F8FEB"}),i.jsx("path",{d:"M17.7948 0.00538C18.4273 -0.15091 20.3438 3.14642 20.8048 3.84781C25.3921 10.816 35.2715 26.9368 35.9001 34.8694C37.3784 53.5822 11.8702 61.3357 2.53562 45.3789C-1.73163 38.0829 0.0134 32.2087 3.1757 25.027C6.98574 16.3662 12.6284 7.90372 17.7948 0.00538ZM18.3549 7.24807L17.57 7.48441C14.4306 12.9431 10.9063 18.2341 8.1859 23.9368C4.67686 31.29 1.18305 38.5479 7.68679 45.5657C17.2881 55.9228 34.9476 46.8808 31.4271 32.8681C29.2249 24.0969 22.3974 15.2913 18.3587 7.24807H18.3549Z",fill:"#C3C2C1"})]})}function pqe({className:t}){return i.jsxs("svg",{className:t,viewBox:"0 0 12 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[i.jsx("path",{d:"M6 0.5C4.6 0.5 3.5 1.6 3.5 3V12.1C2.6 12.8 2 13.9 2 15C2 17.2 3.8 19 6 19C8.2 19 10 17.2 10 15C10 13.9 9.4 12.8 8.5 12.1V3C8.5 1.6 7.4 0.5 6 0.5Z",stroke:"#C3C2C1",strokeWidth:"1",fill:"none"}),i.jsx("circle",{cx:"6",cy:"15",r:"2.5",stroke:"#C3C2C1",strokeWidth:"1",fill:"none"})]})}function fqe({className:t}){return i.jsxs("svg",{className:t,viewBox:"0 0 12 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[i.jsx("rect",{x:"4.5",y:"8",width:"3",height:"4.5",fill:"#d4a017",rx:"0.5"}),i.jsx("circle",{cx:"6",cy:"15",r:"2",fill:"#d4a017"}),i.jsx("path",{d:"M6 0.5C4.6 0.5 3.5 1.6 3.5 3V12.1C2.6 12.8 2 13.9 2 15C2 17.2 3.8 19 6 19C8.2 19 10 17.2 10 15C10 13.9 9.4 12.8 8.5 12.1V3C8.5 1.6 7.4 0.5 6 0.5Z",stroke:"#C3C2C1",strokeWidth:"1",fill:"none"})]})}function gqe({className:t}){return i.jsxs("svg",{className:t,viewBox:"0 0 12 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[i.jsx("rect",{x:"4.5",y:"3",width:"3",height:"9.5",fill:"#c62828",rx:"0.5"}),i.jsx("circle",{cx:"6",cy:"15",r:"2",fill:"#c62828"}),i.jsx("path",{d:"M6 0.5C4.6 0.5 3.5 1.6 3.5 3V12.1C2.6 12.8 2 13.9 2 15C2 17.2 3.8 19 6 19C8.2 19 10 17.2 10 15C10 13.9 9.4 12.8 8.5 12.1V3C8.5 1.6 7.4 0.5 6 0.5Z",stroke:"#C3C2C1",strokeWidth:"1",fill:"none"})]})}function cj({className:t,color:e,isHeating:n}){const a={"text-orange-400":"#fb923c","text-blue-400":"#60a5fa","text-green-400":"#4ade80"}[e]||"#888",s=n?{filter:`drop-shadow(0 0 4px ${a}) drop-shadow(0 0 8px ${a})`}:{};return n?i.jsxs("svg",{className:t,style:s,viewBox:"0 0 12 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[i.jsx("rect",{x:"4.5",y:"3",width:"3",height:"9.5",fill:a,rx:"0.5"}),i.jsx("circle",{cx:"6",cy:"15",r:"2",fill:a}),i.jsx("path",{d:"M6 0.5C4.6 0.5 3.5 1.6 3.5 3V12.1C2.6 12.8 2 13.9 2 15C2 17.2 3.8 19 6 19C8.2 19 10 17.2 10 15C10 13.9 9.4 12.8 8.5 12.1V3C8.5 1.6 7.4 0.5 6 0.5Z",stroke:a,strokeWidth:"1",fill:"none"})]}):i.jsxs("svg",{className:t,viewBox:"0 0 12 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[i.jsx("path",{d:"M6 0.5C4.6 0.5 3.5 1.6 3.5 3V12.1C2.6 12.8 2 13.9 2 15C2 17.2 3.8 19 6 19C8.2 19 10 17.2 10 15C10 13.9 9.4 12.8 8.5 12.1V3C8.5 1.6 7.4 0.5 6 0.5Z",stroke:a,strokeWidth:"1",fill:"none"}),i.jsx("circle",{cx:"6",cy:"15",r:"2.5",stroke:a,strokeWidth:"1",fill:"none"})]})}function MG({humidity:t,goodThreshold:e=40,fairThreshold:n=60,onClick:r,compact:a}){const s=typeof t=="string"?parseInt(t,10):t,o=typeof e=="number"?e:40,l=typeof n=="number"?n:60;let c,d;isNaN(s)?(c="#C3C2C1",d="Unknown"):s<=o?(c="#22a352",d="Good"):s<=l?(c="#d4a017",d="Fair"):(c="#c62828",d="Bad");let u;return isNaN(s)||s<=o?u=AG:s<=l?u=mqe:u=hqe,i.jsxs("button",{type:"button",onClick:r,className:`flex items-center gap-1 ${r?"cursor-pointer hover:opacity-80 transition-opacity":""}`,title:`Humidity: ${s}% - ${d}${r?" (click for history)":""}`,children:[i.jsx(u,{className:a?"w-2.5 h-3":"w-3 h-4"}),i.jsxs("span",{className:`font-medium tabular-nums ${a?"text-[10px]":"text-xs"}`,style:{color:c},children:[s,"%"]})]})}function EG({temp:t,goodThreshold:e=28,fairThreshold:n=35,onClick:r,compact:a}){const s=typeof e=="number"?e:28,o=typeof n=="number"?n:35;let l,c,d;return t<=s?(l="#22a352",c="Good",d=pqe):t<=o?(l="#d4a017",c="Fair",d=fqe):(l="#c62828",c="Bad",d=gqe),i.jsxs("button",{type:"button",onClick:r,className:`flex items-center gap-1 ${r?"cursor-pointer hover:opacity-80 transition-opacity":""}`,title:`Temperature: ${t}°C - ${c}${r?" (click for history)":""}`,children:[i.jsx(d,{className:a?"w-2.5 h-3":"w-3 h-4"}),i.jsxs("span",{className:`tabular-nums text-right ${a?"text-[10px] w-8":"w-12"}`,style:{color:l},children:[t,"°C"]})]})}function kc(t,e){const n=typeof t=="string"?parseInt(t,10):t,r=isNaN(n)?0:n,a=e===1,s=r>=128?r-128:r,o=String.fromCharCode(65+s);return a?`HT-${o}`:`AMS-${o}`}function dj(t){return t>50?"#00ae42":t>=15?"#f59e0b":"#ef4444"}function uj(t){return!t?.remaining_weight||!t?.filament_weight||t.filament_weight<=0?null:Math.min(100,Math.round(t.remaining_weight/t.filament_weight*100))}function mj(t){return t?!!(t.tray_uuid&&t.tray_uuid!=="00000000000000000000000000000000"||t.tag_uid&&t.tag_uid!=="0000000000000000"):!1}function jG(t,e){return(Number.isFinite(t)?Math.max(0,Math.trunc(t)):0).toString(16).toUpperCase().padStart(e,"0").slice(-e)}function bqe(t){const e=(t||"").trim().toUpperCase();let n=2166136261;for(let r=0;r<e.length;r++)n^=e.charCodeAt(r),n=Math.imul(n,16777619);return(n>>>0).toString(16).toUpperCase().padStart(8,"0")}function qg(t,e,n){return`${bqe(t)}${jG(e,4)}${jG(n,4)}`}function xqe({url:t,printName:e}){const{t:n}=Mt(),[r,a]=w.useState(!1),[s,o]=w.useState(!1),[l,c]=w.useState(!1),d=w.useMemo(()=>{if(!t)return null;const u=t.includes("?")?"&":"?";return`${t}${u}v=${encodeURIComponent(e||Date.now().toString())}`},[t,e]);return w.useEffect(()=>{a(!1),o(!1)},[d]),i.jsxs(i.Fragment,{children:[i.jsx("div",{className:`w-20 h-20 flex-shrink-0 rounded-lg overflow-hidden bg-bambu-dark-tertiary flex items-center justify-center ${d&&r?"cursor-pointer":""}`,onClick:()=>d&&r&&c(!0),children:d&&!s?i.jsxs(i.Fragment,{children:[i.jsx("img",{src:d,alt:n("printers.printPreview"),className:`w-full h-full object-cover ${r?"block":"hidden"}`,onLoad:()=>a(!0),onError:()=>o(!0)}),!r&&i.jsx(ra,{className:"w-8 h-8 text-bambu-gray"})]}):i.jsx(ra,{className:"w-8 h-8 text-bambu-gray"})}),l&&d&&i.jsx("div",{className:"fixed inset-0 bg-black/80 flex items-center justify-center z-50 p-8",onClick:()=>c(!1),children:i.jsxs("div",{className:"relative max-w-2xl max-h-full",children:[i.jsx("img",{src:d,alt:n("printers.printPreview"),className:"max-w-full max-h-[80vh] rounded-lg shadow-2xl"}),e&&i.jsx("p",{className:"text-white text-center mt-4 text-lg",children:e})]})})]})}function yqe({printers:t}){const{t:e}=Mt(),n=tn(),[r,a]=w.useState(0);w.useEffect(()=>{let l=!1;const c=n.getQueryCache().subscribe(()=>{l||(l=!0,requestAnimationFrame(()=>{a(d=>d+1),l=!1}))});return()=>c()},[n]);const{counts:s,nextFinish:o}=w.useMemo(()=>{let l=0,c=0,d=0,u=0,m=null,p=null,f=0;return t?.forEach(y=>{const x=n.getQueryData(["printerStatus",y.id]);x===void 0?u++:x.connected?x.state==="RUNNING"?(l++,x.remaining_time!=null&&x.remaining_time>0&&(p===null||x.remaining_time<p)&&(p=x.remaining_time,m=y.name,f=x.progress||0)):c++:d++}),{counts:{printing:l,idle:c,offline:d,loading:u,total:t?.length||0},nextFinish:m&&p?{name:m,remainingMin:p,progress:f}:null}},[t,n,r]);return t?.length?i.jsxs("div",{className:"flex flex-wrap items-center gap-4 gap-y-2 text-sm",children:[i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx("div",{className:`w-2 h-2 rounded-full ${s.idle>0?"bg-bambu-green":"bg-gray-500"}`}),i.jsxs("span",{className:"text-bambu-gray",children:[i.jsx("span",{className:"text-white font-medium",children:s.idle})," ",e("printers.status.available").toLowerCase()]})]}),s.printing>0&&i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx("div",{className:"w-2 h-2 rounded-full bg-bambu-green animate-pulse"}),i.jsxs("span",{className:"text-bambu-gray",children:[i.jsx("span",{className:"text-white font-medium",children:s.printing})," ",e("printers.status.printing").toLowerCase()]})]}),s.offline>0&&i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx("div",{className:"w-2 h-2 rounded-full bg-gray-400"}),i.jsxs("span",{className:"text-bambu-gray",children:[i.jsx("span",{className:"text-white font-medium",children:s.offline})," ",e("printers.status.offline").toLowerCase()]})]}),o&&i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"w-px h-4 bg-bambu-dark-tertiary"}),i.jsxs("div",{className:"flex flex-col gap-1 sm:flex-row sm:items-center sm:gap-2",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs("span",{className:"text-bambu-green font-medium",children:[e("printers.nextAvailable"),":"]}),i.jsx("span",{className:"text-white font-medium",children:o.name})]}),i.jsxs("div",{className:"flex items-center gap-2 w-full sm:w-auto",children:[i.jsx("div",{className:"w-full sm:w-16 bg-bambu-dark-tertiary rounded-full h-1.5",children:i.jsx("div",{className:"bg-bambu-green h-1.5 rounded-full transition-all",style:{width:`${o.progress}%`}})}),i.jsxs("span",{className:"text-white font-medium",children:[Math.round(o.progress),"%"]}),i.jsxs("span",{className:"text-bambu-gray",children:["(",Ms(o.remainingMin*60),")"]})]})]})]})]}):null}function hj(t,e){if(e)return e;switch(t){case"RUNNING":return"Printing";case"PAUSE":return"Paused";case"FINISH":return"Finished";case"FAILED":return"Failed";case"IDLE":return"Idle";default:return t?t.charAt(0)+t.slice(1).toLowerCase():"Idle"}}function pv(t){return t?{O1D:"H2D",O1E:"H2D Pro",O2D:"H2D Pro",O1C:"H2C",O1C2:"H2C",O1S:"H2S","BL-P001":"X1C","BL-P002":"X1","BL-P003":"X1E",C11:"P1S",C12:"P1P",C13:"P2S",N2S:"A1",N1:"A1 Mini",X1C:"X1C",X1:"X1",X1E:"X1E",P1S:"P1S",P1P:"P1P",P2S:"P2S",A1:"A1","A1 Mini":"A1 Mini",H2D:"H2D","H2D Pro":"H2D Pro",H2C:"H2C",H2S:"H2S"}[t]||t:""}function DG({ams:t,printerId:e,label:n,amsLabels:r,canEdit:a,onSaved:s,children:o}){const{t:l}=Mt(),[c,d]=w.useState(!1),[u,m]=w.useState("top"),[p,f]=w.useState(""),[y,x]=w.useState(!1),[b,v]=w.useState(null),[_,k]=w.useState(!1),P=w.useRef(null),C=w.useRef(null),T=w.useRef(null);w.useEffect(()=>{c&&(f(r?.[t.id]??""),v(null),requestAnimationFrame(()=>{if(P.current&&C.current){const $=P.current.getBoundingClientRect(),U=$.top-56,G=window.innerHeight-$.bottom;m(U<C.current.offsetHeight+12&&G>U?"bottom":"top")}}))},[c,r,t.id]);const N=()=>{T.current&&clearTimeout(T.current),T.current=setTimeout(()=>d(!0),80)},R=()=>{T.current&&clearTimeout(T.current),_||(T.current=setTimeout(()=>d(!1),200))};w.useEffect(()=>()=>{T.current&&clearTimeout(T.current)},[]);const A=async()=>{if(a){x(!0),v(null);try{const $=p.trim();$?await be.saveAmsLabel(e,t.id,$,t.serial_number):await be.deleteAmsLabel(e,t.id,t.serial_number),s(),d(!1)}catch($){v($ instanceof Error?$.message:String($))}finally{x(!1)}}},D=async()=>{if(a){x(!0),v(null);try{await be.deleteAmsLabel(e,t.id,t.serial_number),s(),d(!1)}catch($){v($ instanceof Error?$.message:String($))}finally{x(!1)}}};return i.jsxs("div",{ref:P,className:"relative inline-block",onMouseEnter:N,onMouseLeave:R,children:[o,c&&i.jsx("div",{ref:C,className:`
- absolute left-0 z-50
- ${u==="top"?"bottom-full mb-2":"top-full mt-2"}
- animate-in fade-in-0 zoom-in-95 duration-150
- `,style:{maxWidth:"calc(100vw - 24px)"},onMouseEnter:N,onMouseLeave:R,children:i.jsxs("div",{className:"w-52 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg shadow-xl overflow-hidden backdrop-blur-sm p-2.5 space-y-2",children:[i.jsx("div",{className:"text-[10px] uppercase tracking-wider text-bambu-gray font-medium",children:n}),i.jsxs("div",{className:"flex items-center justify-between gap-2",children:[i.jsx("span",{className:"text-[10px] tracking-wide text-bambu-gray font-medium shrink-0",children:l("printers.amsPopup.serialNumber")}),i.jsx("span",{className:"text-[10px] text-white font-mono truncate",children:t.serial_number||"—"})]}),i.jsxs("div",{className:"flex items-center justify-between gap-2",children:[i.jsx("span",{className:"text-[10px] tracking-wide text-bambu-gray font-medium shrink-0",children:l("printers.amsPopup.firmwareVersion")}),i.jsx("span",{className:"text-[10px] text-white font-mono truncate",children:t.sw_ver||"—"})]}),i.jsx("div",{className:"h-px bg-bambu-dark-tertiary/50"}),i.jsxs("div",{className:"space-y-1",children:[i.jsx("span",{className:"text-[10px] text-bambu-gray font-medium block",children:l("printers.amsPopup.friendlyName")}),i.jsx("input",{type:"text",value:p,onChange:$=>a&&f($.target.value),onKeyDown:$=>$.key==="Enter"&&A(),onFocus:()=>k(!0),onBlur:()=>{k(!1),T.current&&clearTimeout(T.current),T.current=setTimeout(()=>d(!1),200)},placeholder:a?l("printers.amsPopup.friendlyNamePlaceholder"):r?.[t.id]||"—",disabled:!a,title:a?void 0:l("printers.amsPopup.noEditPermission"),className:"w-full bg-bambu-dark border border-bambu-dark-tertiary rounded px-2 py-1 text-xs text-white placeholder-bambu-gray/60 focus:outline-none focus:border-bambu-green disabled:opacity-50 disabled:cursor-not-allowed",maxLength:100}),a&&i.jsxs("div",{className:"space-y-1",children:[b&&i.jsx("p",{className:"text-[10px] text-red-400 break-words",children:b}),i.jsxs("div",{className:"flex gap-1 justify-end",children:[i.jsx("button",{onClick:A,disabled:y,className:"px-2 py-0.5 text-[10px] bg-bambu-green text-white rounded hover:bg-bambu-green/80 disabled:opacity-50",children:l("printers.amsPopup.save")}),r?.[t.id]&&i.jsx("button",{onClick:D,disabled:y,className:"px-2 py-0.5 text-[10px] bg-bambu-dark-tertiary text-bambu-gray rounded hover:bg-bambu-dark-tertiary/70 disabled:opacity-50",children:l("printers.amsPopup.clear")})]})]})]})]})})]})}function RG({printer:t,hideIfDisconnected:e,maintenanceInfo:n,viewMode:r="expanded",cardSize:a=2,amsThresholds:s,spoolmanEnabled:o=!1,linkedSpools:l,spoolmanUrl:c,onGetAssignment:d,onUnassignSpool:u,timeFormat:m="system",cameraViewMode:p="window",onOpenEmbeddedCamera:f,checkPrinterFirmware:y=!0}){const{t:x}=Mt(),b=tn(),v=Ml(),{showToast:_}=bn(),{hasPermission:k}=Rr(),[P,C]=w.useState(!1),[T,N]=w.useState(!1),[R,A]=w.useState(!0),[D,$]=w.useState(!1),[U,G]=w.useState(!1),[L,te]=w.useState(!1),[re,J]=w.useState(!1),[ue,me]=w.useState(!1),[ge,X]=w.useState(!1),[ie,le]=w.useState(!1),[pe,Ce]=w.useState(!1),[q,Z]=w.useState(!1),[j,E]=w.useState(!1),[I,W]=w.useState(!1),[B,ae]=w.useState(!1),z=w.useCallback(()=>ae(!1),[]),[V,ee]=w.useState(null),[K,ne]=w.useState(!1),[se,ce]=w.useState(!1),fe=w.useRef(0),[oe,O]=w.useState(null),[F,Q]=w.useState(null),[ve,he]=w.useState(null),[de,Ae]=w.useState(null),[_e,ze]=w.useState(!1),[Be,Ue]=w.useState(null),[Ne,Ee]=w.useState(!1),[ke,Me]=w.useState(!1),[Ge,xe]=w.useState(null),[He,Pe]=w.useState(!1),[Ve,je]=w.useState(!1),{data:ye}=Je({queryKey:["printerStatus",t.id],queryFn:()=>be.getPrinterStatus(t.id),refetchInterval:3e4}),{data:$e}=Je({queryKey:["firmwareUpdate",t.id],queryFn:()=>d1.checkPrinterUpdate(t.id),staleTime:300*1e3,refetchInterval:300*1e3,enabled:y&&k("firmware:read")}),Ye=w.useMemo(()=>{const bt=new Set;if(ye?.ams)for(const Ot of ye.ams)for(const dn of Ot.tray||[])dn.tray_info_idx&&bt.add(dn.tray_info_idx);for(const Ot of ye?.vt_tray??[])Ot.tray_info_idx&&bt.add(Ot.tray_info_idx);if(ye?.nozzle_rack)for(const Ot of ye.nozzle_rack)Ot.filament_id&&bt.add(Ot.filament_id);return Array.from(bt)},[ye?.ams,ye?.vt_tray,ye?.nozzle_rack]),lt=w.useMemo(()=>{const bt=new Set;if(ye?.ams)for(const Ot of ye.ams)for(const dn of Ot.tray||[])dn.tray_type&&bt.add(dn.tray_type.toUpperCase());for(const Ot of ye?.vt_tray??[])Ot.tray_type&&bt.add(Ot.tray_type.toUpperCase());return bt},[ye?.ams,ye?.vt_tray]),St=w.useMemo(()=>{const bt=new Set;if(ye?.ams){for(const Ot of ye.ams)for(const dn of Ot.tray||[])if(dn.tray_type&&dn.tray_color){const kt=dn.tray_color.replace("#","").toLowerCase().slice(0,6);bt.add(`${dn.tray_type.toUpperCase()}:${kt}`)}}for(const Ot of ye?.vt_tray??[])if(Ot.tray_type&&Ot.tray_color){const dn=Ot.tray_color.replace("#","").toLowerCase().slice(0,6);bt.add(`${Ot.tray_type.toUpperCase()}:${dn}`)}return bt},[ye?.ams,ye?.vt_tray]),{data:ot}=Je({queryKey:["filamentInfo",Ye],queryFn:()=>be.getFilamentInfo(Ye),enabled:Ye.length>0,staleTime:300*1e3}),{data:ft}=Je({queryKey:["slotPresets",t.id],queryFn:()=>be.getSlotPresets(t.id),staleTime:120*1e3}),{data:qe,refetch:ht}=Je({queryKey:["amsLabels",t.id],queryFn:()=>be.getAmsLabels(t.id),staleTime:300*1e3}),[yt,Bt]=w.useState(null);w.useEffect(()=>{ye?.wifi_signal!=null&&Bt(ye.wifi_signal)},[ye?.wifi_signal]);const Yt=ye?.wifi_signal??yt,xn=w.useRef(void 0);w.useEffect(()=>{ye?.connected!==void 0&&(xn.current=ye.connected)},[ye?.connected]);const Xt=ye?.connected??xn.current,$t=w.useRef({});w.useEffect(()=>{ye?.ams_extruder_map&&Object.keys(ye.ams_extruder_map).length>0&&($t.current=ye.ams_extruder_map)},[ye?.ams_extruder_map]);const nn=ye?.ams_extruder_map&&Object.keys(ye.ams_extruder_map).length>0?ye.ams_extruder_map:$t.current,on=w.useRef([]);w.useEffect(()=>{ye?.ams&&ye.ams.length>0&&(on.current=ye.ams)},[ye?.ams]);const cn=ye?.ams&&ye.ams.length>0?ye.ams:on.current,pn=w.useRef(void 0),Ie=ye?.tray_now;Ie!==void 0&&Ie!==255?pn.current=Ie:Ie===255&&(pn.current=void 0);const De=Ie!==void 0&&Ie!==255?Ie:pn.current,{data:Xe}=Je({queryKey:["smartPlugByPrinter",t.id],queryFn:()=>be.getSmartPlugByPrinter(t.id)}),{data:at}=Je({queryKey:["scriptPlugsByPrinter",t.id],queryFn:()=>be.getScriptPlugsByPrinter(t.id)}),{data:Ke}=Je({queryKey:["smartPlugStatus",Xe?.id],queryFn:()=>Xe?be.getSmartPlugStatus(Xe.id):null,enabled:!!Xe,refetchInterval:1e4}),{data:It}=Je({queryKey:["queue",t.id,"pending"],queryFn:()=>be.getQueue(t.id,"pending")}),Te=w.useMemo(()=>It?.length?LQ(It,lt,St).length:0,[It,lt,St]),{data:We}=Je({queryKey:["queue",t.id,"printing"],queryFn:()=>be.getQueue(t.id,"printing"),enabled:ye?.state==="RUNNING"}),{data:et}=Je({queryKey:["currentPrintUser",t.id],queryFn:()=>be.getCurrentPrintUser(t.id),enabled:ye?.state==="RUNNING"}),Ze=We?.[0]?.created_by_username||et?.username,{data:Le}=Je({queryKey:["archives",t.id,"last"],queryFn:()=>be.getArchives(t.id,1,0),enabled:ye?.connected&&ye?.state!=="RUNNING"}),mt=Le?.[0],st=e&&Xt===!1,tt=ut({mutationFn:bt=>be.deletePrinter(t.id,bt.deleteArchives),onSuccess:()=>{b.invalidateQueries({queryKey:["printers"]}),b.invalidateQueries({queryKey:["archives"]}),b.invalidateQueries({queryKey:["maintenanceOverview"]})},onError:bt=>_(bt.message||x("printers.toast.failedToDelete"),"error")}),Nt=ut({mutationFn:()=>be.connectPrinter(t.id),onSuccess:()=>{b.invalidateQueries({queryKey:["printerStatus",t.id]})}}),Rt=ut({mutationFn:bt=>be.unlinkSpool(bt),onSuccess:bt=>{_(x("spoolman.unlinkSuccess")||bt?.message,"success"),b.invalidateQueries({queryKey:["linked-spools"]}),b.invalidateQueries({queryKey:["unlinked-spools"]})},onError:bt=>{_(bt.message||x("spoolman.unlinkFailed"),"error")}}),jt=ut({mutationFn:bt=>Xe?be.controlSmartPlug(Xe.id,bt):Promise.reject("No plug"),onSuccess:()=>{b.invalidateQueries({queryKey:["smartPlugStatus",Xe?.id]})}}),Ft=ut({mutationFn:bt=>Xe?be.updateSmartPlug(Xe.id,{auto_off:bt}):Promise.reject("No plug"),onSuccess:()=>{b.invalidateQueries({queryKey:["smartPlugByPrinter",t.id]}),b.invalidateQueries({queryKey:["smart-plugs"]})}}),mn=ut({mutationFn:bt=>be.controlSmartPlug(bt,"on"),onSuccess:()=>{_(x("printers.toast.scriptTriggered"))},onError:bt=>_(bt.message||x("printers.toast.failedToRunScript"),"error")}),rn=ut({mutationFn:()=>be.stopPrint(t.id),onSuccess:()=>{_(x("printers.toast.printStopped")),b.invalidateQueries({queryKey:["printerStatus",t.id]})},onError:bt=>_(bt.message||x("printers.toast.failedToStopPrint"),"error")}),vn=ut({mutationFn:()=>be.pausePrint(t.id),onSuccess:()=>{_(x("printers.toast.printPaused")),b.invalidateQueries({queryKey:["printerStatus",t.id]})},onError:bt=>_(bt.message||x("printers.toast.failedToPausePrint"),"error")}),Dn=ut({mutationFn:()=>be.resumePrint(t.id),onSuccess:()=>{_(x("printers.toast.printResumed")),b.invalidateQueries({queryKey:["printerStatus",t.id]})},onError:bt=>_(bt.message||x("printers.toast.failedToResumePrint"),"error")}),Bn=ut({mutationFn:bt=>be.setChamberLight(t.id,bt),onMutate:async bt=>{await b.cancelQueries({queryKey:["printerStatus",t.id]});const Ot=b.getQueryData(["printerStatus",t.id]);return b.setQueryData(["printerStatus",t.id],dn=>({...dn,chamber_light:bt})),{previousStatus:Ot}},onSuccess:(bt,Ot)=>{_(`Chamber light ${Ot?"on":"off"}`)},onError:(bt,Ot,dn)=>{dn?.previousStatus&&b.setQueryData(["printerStatus",t.id],dn.previousStatus),_(bt.message||x("printers.toast.failedToControlChamberLight"),"error")}}),en=ut({mutationFn:bt=>be.updatePrinter(t.id,{plate_detection_enabled:bt}),onSuccess:()=>{b.invalidateQueries({queryKey:["printers"]}),_(en.variables?x("printers.toast.plateCheckEnabled"):x("printers.toast.plateCheckDisabled"))},onError:bt=>_(bt.message||x("printers.toast.failedToUpdateSetting"),"error")}),kn=(ye?.state==="RUNNING"||ye?.state==="PAUSE")&&(ye?.printable_objects_count??0)>=2,{data:_n}=Je({queryKey:["printableObjects",t.id],queryFn:()=>be.getPrintableObjects(t.id),enabled:j||kn,refetchInterval:j?5e3:kn?3e4:!1}),[vr,wn]=w.useState(null),lr=w.useRef(!1),ci=w.useRef(null),zn=w.useRef(!1),gi=ut({mutationFn:({amsId:bt,slotId:Ot})=>be.refreshAmsSlot(t.id,bt,Ot),onMutate:({amsId:bt,slotId:Ot})=>{ci.current&&clearTimeout(ci.current),lr.current=!1,zn.current=!1,wn({amsId:bt,slotId:Ot}),setTimeout(()=>{zn.current=!0},2e3),ci.current=setTimeout(()=>{wn(null)},3e4)},onSuccess:bt=>{_(bt.message||x("printers.toast.rfidRereadInitiated"))},onError:bt=>{_(bt.message||x("printers.toast.failedToRereadRfid"),"error"),ci.current&&clearTimeout(ci.current),wn(null)}}),[tr,bi]=w.useState(null),[ni,Fr]=w.useState(null),xi=async()=>{try{const bt=await be.getPlateReferences(t.id);bi(bt)}catch{}},_h=()=>{en.mutate(!t.plate_detection_enabled)},kf=async()=>{Ee(!0),Ue(null);const bt=ye?.chamber_light===!1;je(bt),bt&&(await be.setChamberLight(t.id,!0),await new Promise(Ot=>setTimeout(Ot,2500)));try{const Ot=await be.checkPlateEmpty(t.id,{includeDebugImage:!0});Ue(Ot),xi()}catch(Ot){_(Ot instanceof Error?Ot.message:x("printers.toast.failedToCheckPlate"),"error"),bt&&(await be.setChamberLight(t.id,!1),je(!1))}finally{Ee(!1)}},za=w.useCallback(async()=>{Ue(null),Ve&&(await be.setChamberLight(t.id,!1),je(!1))},[Ve,t.id]),Nf=async bt=>{Me(!0);try{const Ot=await be.calibratePlateDetection(t.id,{label:bt});if(Ot.success){_(Ot.message||x("printers.toast.calibrationSaved"),"success"),xi();const dn=await be.checkPlateEmpty(t.id,{includeDebugImage:!0});Ue(dn)}else _(Ot.message||x("printers.toast.calibrationFailed"),"error")}catch(Ot){_(Ot instanceof Error?Ot.message:x("printers.toast.calibrationFailed"),"error")}finally{Me(!1)}},dc=async(bt,Ot)=>{try{await be.updatePlateReferenceLabel(t.id,bt,Ot),Fr(null),xi()}catch(dn){_(dn instanceof Error?dn.message:x("printers.toast.failedToUpdateLabel"),"error")}},uc=async bt=>{try{await be.deletePlateReference(t.id,bt),_(x("printers.toast.referenceDeleted"),"success"),xi();const Ot=await be.checkPlateEmpty(t.id,{includeDebugImage:!0});Ue(Ot)}catch(Ot){_(Ot instanceof Error?Ot.message:x("printers.toast.failedToDeleteReference"),"error")}},Ki=async()=>{if(Ge){Pe(!0);try{await be.updatePrinter(t.id,{plate_detection_roi:Ge}),_(x("printers.toast.detectionAreaSaved"),"success"),xe(null);const bt=await be.checkPlateEmpty(t.id,{includeDebugImage:!0});Ue(bt)}catch(bt){_(bt instanceof Error?bt.message:x("printers.toast.failedToSaveDetectionArea"),"error")}finally{Pe(!1)}}};w.useEffect(()=>{const bt=Ot=>{Ot.key==="Escape"&&Be&&za()};return window.addEventListener("keydown",bt),()=>window.removeEventListener("keydown",bt)},[Be,za]);const Ss=w.useRef(null);w.useEffect(()=>{if(!vr)return;const bt=ye?.ams_status_main??0;return bt!==0&&(lr.current=!0,Ss.current&&(clearTimeout(Ss.current),Ss.current=null)),lr.current&&bt===0&&(zn.current?(ci.current&&clearTimeout(ci.current),wn(null)):Ss.current||(Ss.current=setTimeout(()=>{ci.current&&clearTimeout(ci.current),wn(null)},2e3))),()=>{Ss.current&&clearTimeout(Ss.current)}},[ye?.ams_status_main,vr]);const[_s,$s]=w.useState(null);if(st)return null;const jl=()=>{switch(a){case 1:return"w-10 h-10";case 2:return"w-14 h-14";case 3:return"w-16 h-16";case 4:return"w-20 h-20";default:return"w-14 h-14"}},Cf=()=>{switch(a){case 1:return"text-base truncate";case 2:return"text-lg";case 3:return"text-xl";case 4:return"text-2xl";default:return"text-lg"}},kh=()=>{switch(a){case 1:return"mb-2";case 2:return"mb-4";case 3:return"mb-5";case 4:return"mb-6";default:return"mb-4"}},mc=Xt&&ye?.state!=="RUNNING"&&ye?.state!=="PAUSE"&&k("printers:control"),Dl=bt=>{bt.preventDefault(),fe.current++,fe.current===1&&ne(!0)},ka=bt=>{bt.preventDefault(),bt.dataTransfer.dropEffect=mc?"copy":"none"},rd=bt=>{bt.preventDefault(),fe.current--,fe.current===0&&ne(!1)},Rl=async bt=>{if(bt.preventDefault(),fe.current=0,ne(!1),!mc)return;const dn=Array.from(bt.dataTransfer.files)[0];if(!dn)return;const kt=dn.name.toLowerCase();if(!kt.endsWith(".gcode")&&!kt.includes(".gcode.")){_(x("printers.dropNotPrintable","Only .gcode and .gcode.3mf files can be printed"),"error");return}ce(!0);try{const Pn=await be.uploadLibraryFile(dn,null),Nr=Pn.metadata?.sliced_for_model,Ht=pv(t.model);if(Nr&&Ht&&Nr.toLowerCase()!==Ht.toLowerCase()){await be.deleteLibraryFile(Pn.id).catch(()=>{}),_(x("printers.incompatibleFile","This file was sliced for {{slicedFor}}, but this printer is a {{printerModel}}",{slicedFor:Nr,printerModel:Ht}),"error");return}ee({id:Pn.id,filename:Pn.filename})}catch{_(x("common.uploadFailed","Upload failed"),"error")}finally{ce(!1)}};return i.jsxs(Tt,{className:"relative",onDragEnter:Dl,onDragOver:ka,onDragLeave:rd,onDrop:Rl,children:[(K||se)&&i.jsx("div",{className:`absolute inset-0 z-10 rounded-xl border-2 border-dashed flex items-center justify-center transition-colors ${se?"bg-bambu-green/10 border-bambu-green/50":mc?"bg-bambu-green/10 border-bambu-green":"bg-red-500/10 border-red-500/50"}`,children:i.jsx("div",{className:"text-center",children:se?i.jsxs(i.Fragment,{children:[i.jsx(ct,{className:"w-8 h-8 mx-auto mb-2 text-bambu-green animate-spin"}),i.jsx("p",{className:"text-sm font-medium text-bambu-green",children:x("common.uploading","Uploading...")})]}):mc?i.jsxs(i.Fragment,{children:[i.jsx(kr,{className:"w-8 h-8 mx-auto mb-2 text-bambu-green"}),i.jsx("p",{className:"text-sm font-medium text-bambu-green",children:x("printers.dropToPrint","Drop to print")})]}):i.jsxs(i.Fragment,{children:[i.jsx(zt,{className:"w-8 h-8 mx-auto mb-2 text-red-400"}),i.jsx("p",{className:"text-sm font-medium text-red-400",children:x("printers.cannotPrint","Printer busy")})]})})}),i.jsxs(Pt,{className:a>=3?"p-5":"",children:[i.jsxs("div",{className:kh(),children:[i.jsxs("div",{className:"flex items-start justify-between gap-2",children:[i.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[i.jsx("img",{src:RQ(t.model),alt:t.model||x("common.printer"),className:`object-contain rounded-lg bg-bambu-dark flex-shrink-0 ${jl()}`}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("h3",{className:`font-semibold text-white ${Cf()}`,children:t.name}),r==="compact"&&i.jsx("div",{className:`w-2 h-2 rounded-full flex-shrink-0 ${ye?.connected?"bg-status-ok":"bg-status-error"}`,title:ye?.connected?x("printers.connection.connected"):x("printers.connection.offline")})]}),i.jsxs("p",{className:"text-sm text-bambu-gray",children:[t.model||"Unknown Model",r==="expanded"&&ye?.nozzles&&ye.nozzles[0]?.nozzle_diameter&&i.jsxs("span",{className:"ml-1.5 text-bambu-gray",title:ye.nozzles[0].nozzle_type||"Nozzle",children:["• ",ye.nozzles[0].nozzle_diameter,"mm"]}),r==="expanded"&&n&&n.total_print_hours>0&&i.jsxs("span",{className:"ml-2 text-bambu-gray",children:[i.jsx(er,{className:"w-3 h-3 inline-block mr-1"}),Math.round(n.total_print_hours),"h"]})]})]})]}),i.jsxs("div",{className:"relative flex-shrink-0",children:[i.jsx(Fe,{variant:"ghost",size:"sm",onClick:()=>C(!P),children:i.jsx(Bm,{className:"w-4 h-4"})}),P&&i.jsxs("div",{className:"absolute right-0 mt-2 w-48 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg shadow-lg z-20",children:[i.jsxs("button",{className:`w-full px-4 py-2 text-left text-sm flex items-center gap-2 ${k("printers:update")?"hover:bg-bambu-dark-tertiary":"opacity-50 cursor-not-allowed"}`,onClick:()=>{k("printers:update")&&($(!0),C(!1))},title:k("printers:update")?void 0:x("printers.permission.noEdit"),children:[i.jsx(Wi,{className:"w-4 h-4"}),x("common.edit")]}),i.jsxs("button",{className:"w-full px-4 py-2 text-left text-sm hover:bg-bambu-dark-tertiary flex items-center gap-2",onClick:()=>{ae(!0),C(!1)},children:[i.jsx(js,{className:"w-4 h-4"}),x("printers.printerInformation")]}),i.jsxs("button",{className:"w-full px-4 py-2 text-left text-sm hover:bg-bambu-dark-tertiary flex items-center gap-2",onClick:()=>{Nt.mutate(),C(!1)},children:[i.jsx(_r,{className:"w-4 h-4"}),x("printers.reconnect")]}),i.jsxs("button",{className:"w-full px-4 py-2 text-left text-sm hover:bg-bambu-dark-tertiary flex items-center gap-2",onClick:()=>{te(!0),C(!1)},children:[i.jsx(tX,{className:"w-4 h-4"}),x("printers.mqttDebug")]}),i.jsxs("button",{className:`w-full px-4 py-2 text-left text-sm flex items-center gap-2 ${k("printers:delete")?"text-red-400 hover:bg-bambu-dark-tertiary":"text-red-400/50 cursor-not-allowed"}`,onClick:()=>{k("printers:delete")&&(N(!0),C(!1))},title:k("printers:delete")?void 0:x("printers.permission.noDelete"),children:[i.jsx(Qt,{className:"w-4 h-4"}),x("common.delete")]})]})]})]}),r==="expanded"&&i.jsxs("div",{className:"flex flex-wrap items-center gap-2 mt-2",children:[i.jsxs("span",{className:`flex items-center gap-1.5 px-2 py-1 rounded-full text-xs ${ye?.connected?"bg-status-ok/20 text-status-ok":"bg-status-error/20 text-status-error"}`,children:[ye?.connected?i.jsx(dx,{className:"w-3 h-3"}):i.jsx(Ov,{className:"w-3 h-3"}),ye?.connected?x("printers.connection.connected"):x("printers.connection.offline")]}),ye?.connected&&Yt!=null&&i.jsxs("span",{className:`flex items-center gap-1 px-2 py-1 rounded-full text-xs ${Yt>=-50||Yt>=-60?"bg-status-ok/20 text-status-ok":Yt>=-70?"bg-status-warning/20 text-status-warning":Yt>=-80?"bg-orange-500/20 text-orange-600":"bg-status-error/20 text-status-error"}`,title:`WiFi: ${Yt} dBm - ${x(FQ(Yt).labelKey)}`,children:[i.jsx(ZY,{className:"w-3 h-3"}),Yt,"dBm"]}),ye?.connected&&(()=>{const bt=ye.hms_errors?TAe(ye.hms_errors):[];return i.jsxs("button",{onClick:()=>X(!0),className:`flex items-center gap-1 px-2 py-1 rounded-full text-xs cursor-pointer hover:opacity-80 transition-opacity ${bt.length>0?bt.some(Ot=>Ot.severity<=2)?"bg-status-error/20 text-status-error":"bg-status-warning/20 text-status-warning":"bg-status-ok/20 text-status-ok"}`,title:x("printers.clickToViewHmsErrors"),children:[i.jsx(En,{className:"w-3 h-3"}),bt.length>0?bt.length:"OK"]})})(),n&&i.jsxs("button",{onClick:()=>v("/maintenance"),className:`flex items-center gap-1 px-2 py-1 rounded-full text-xs cursor-pointer hover:opacity-80 transition-opacity ${n.due_count>0?"bg-status-error/20 text-status-error":n.warning_count>0?"bg-status-warning/20 text-status-warning":"bg-status-ok/20 text-status-ok"}`,title:n.due_count>0||n.warning_count>0?`${n.due_count>0?`${n.due_count} maintenance due`:""}${n.due_count>0&&n.warning_count>0?", ":""}${n.warning_count>0?`${n.warning_count} due soon`:""} - Click to view`:x("printers.maintenanceUpToDate"),children:[i.jsx(Vp,{className:"w-3 h-3"}),n.due_count>0||n.warning_count>0?n.due_count+n.warning_count:"OK"]}),Te>0&&i.jsxs("button",{onClick:()=>v("/queue"),className:"flex items-center gap-1 px-2 py-1 rounded-full text-xs bg-purple-500/20 text-purple-400 hover:opacity-80 transition-opacity",title:x("printers.queue.inQueue",{count:Te}),children:[i.jsx(Vi,{className:"w-3 h-3"}),Te]}),y&&$e?.current_version&&$e?.latest_version?i.jsxs("button",{onClick:()=>ze(!0),className:`flex items-center gap-1 px-2 py-1 rounded-full text-xs hover:opacity-80 transition-opacity ${$e.update_available?"bg-orange-500/20 text-orange-400":"bg-status-ok/20 text-status-ok"}`,title:$e.update_available?x("printers.firmwareUpdateAvailable",{current:$e.current_version,latest:$e.latest_version}):x("printers.firmwareUpToDate",{version:$e.current_version}),children:[$e.update_available?i.jsx(pi,{className:"w-3 h-3"}):i.jsx(fr,{className:"w-3 h-3"}),$e.current_version]}):ye?.firmware_version?i.jsx("span",{className:"flex items-center gap-1 px-2 py-1 rounded-full text-xs bg-bambu-dark-tertiary/50 text-bambu-gray",children:ye.firmware_version}):null]})]}),T&&i.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:i.jsx(Tt,{className:"w-full max-w-md mx-4",children:i.jsxs(Pt,{children:[i.jsxs("div",{className:"flex items-start gap-3 mb-4",children:[i.jsx("div",{className:"p-2 rounded-full bg-red-500/20",children:i.jsx(En,{className:"w-5 h-5 text-red-400"})}),i.jsxs("div",{children:[i.jsx("h3",{className:"text-lg font-semibold text-white",children:x("printers.confirm.deleteTitle")}),i.jsx("p",{className:"text-sm text-bambu-gray mt-1",children:x("printers.confirm.deleteMessage",{name:t.name})})]})]}),i.jsx("div",{className:"bg-bambu-dark rounded-lg p-3 mb-4",children:i.jsxs("label",{className:"flex items-start gap-3 cursor-pointer",children:[i.jsx("input",{type:"checkbox",checked:R,onChange:bt=>A(bt.target.checked),className:"mt-0.5 w-4 h-4 rounded border-bambu-gray bg-bambu-dark-secondary text-bambu-green focus:ring-bambu-green focus:ring-offset-0"}),i.jsxs("div",{children:[i.jsx("span",{className:"text-sm text-white",children:x("printers.deleteArchives")}),i.jsx("p",{className:"text-xs text-bambu-gray mt-0.5",children:x(R?"printers.confirm.deleteArchivesNote":"printers.confirm.keepArchivesNote")})]})]})}),i.jsxs("div",{className:"flex justify-end gap-2",children:[i.jsx(Fe,{variant:"secondary",onClick:()=>{N(!1),A(!0)},children:x("common.cancel")}),i.jsx(Fe,{variant:"danger",onClick:()=>{tt.mutate({deleteArchives:R}),N(!1),A(!0)},children:"Delete"})]})]})})}),ye?.connected&&i.jsxs(i.Fragment,{children:[r==="compact"?i.jsx("div",{className:"mt-2",children:ye.state==="RUNNING"||ye.state==="PAUSE"?i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("div",{className:"flex-1 bg-bambu-dark-tertiary rounded-full h-1.5",children:i.jsx("div",{className:"bg-bambu-green h-1.5 rounded-full transition-all",style:{width:`${ye.progress||0}%`}})}),i.jsxs("span",{className:"text-xs text-white",children:[Math.round(ye.progress||0),"%"]})]}):i.jsx("p",{className:"text-xs text-bambu-gray",children:hj(ye.state,ye.stg_cur_name)})}):i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"mb-4 p-3 bg-bambu-dark rounded-lg relative",children:[i.jsxs("button",{onClick:()=>E(!0),disabled:!(ye.state==="RUNNING"||ye.state==="PAUSE")||(ye.printable_objects_count??0)<2||!k("printers:control"),className:`absolute top-2 right-2 p-1.5 rounded transition-colors z-10 ${(ye.state==="RUNNING"||ye.state==="PAUSE")&&(ye.printable_objects_count??0)>=2&&k("printers:control")?"text-bambu-gray hover:text-white hover:bg-white/10":"text-bambu-gray/30 cursor-not-allowed"}`,title:k("printers:control")?ye.state==="RUNNING"||ye.state==="PAUSE"?(ye.printable_objects_count??0)>=2?x("printers.skipObjects.tooltip"):x("printers.skipObjects.requiresMultiple"):x("printers.skipObjects.onlyWhilePrinting"):x("printers.permission.noControl"),children:[i.jsx(MC,{className:"w-4 h-4"}),_n&&_n.skipped_count>0&&i.jsx("span",{className:"absolute -top-1 -right-1 min-w-[16px] h-4 px-1 flex items-center justify-center text-[10px] font-bold bg-red-500 text-white rounded-full",children:_n.skipped_count})]}),i.jsxs("div",{className:"flex gap-3",children:[i.jsx(xqe,{url:ye.state==="RUNNING"||ye.state==="PAUSE"?ye.cover_url:null,printName:(ye.state==="RUNNING"||ye.state==="PAUSE")&&(ye.subtask_name||ye.current_print)||void 0}),i.jsx("div",{className:"flex-1 min-w-0",children:ye.current_print&&(ye.state==="RUNNING"||ye.state==="PAUSE")?i.jsxs(i.Fragment,{children:[i.jsx("p",{className:"text-sm text-bambu-gray mb-1",children:hj(ye.state,ye.stg_cur_name)}),i.jsx("p",{className:"text-white text-sm mb-2 truncate",children:ye.subtask_name||ye.current_print}),i.jsxs("div",{className:"flex items-center justify-between text-sm",children:[i.jsx("div",{className:"flex-1 bg-bambu-dark-tertiary rounded-full h-2 mr-3",children:i.jsx("div",{className:"bg-bambu-green h-2 rounded-full transition-all",style:{width:`${ye.progress||0}%`}})}),i.jsxs("span",{className:"text-white",children:[Math.round(ye.progress||0),"%"]})]}),i.jsxs("div",{className:"flex items-center gap-3 mt-2 text-xs text-bambu-gray",children:[ye.remaining_time!=null&&ye.remaining_time>0&&i.jsxs(i.Fragment,{children:[i.jsxs("span",{className:"flex items-center gap-1",children:[i.jsx(er,{className:"w-3 h-3"}),Ms(ye.remaining_time*60)]}),i.jsxs("span",{className:"text-bambu-green font-medium",title:x("printers.estimatedCompletion"),children:["ETA ",eL(ye.remaining_time,m,x)]})]}),ye.layer_num!=null&&ye.total_layers!=null&&ye.total_layers>0&&i.jsxs("span",{className:"flex items-center gap-1",children:[i.jsx(Vi,{className:"w-3 h-3"}),ye.layer_num,"/",ye.total_layers]}),Ze&&i.jsxs("span",{className:"flex items-center gap-1",title:`Started by ${Ze}`,children:[i.jsx(du,{className:"w-3 h-3"}),Ze]})]})]}):i.jsxs(i.Fragment,{children:[i.jsx("p",{className:"text-sm text-bambu-gray mb-1",children:x("printers.sort.status")}),i.jsx("p",{className:"text-white text-sm mb-2",children:hj(ye.state,ye.stg_cur_name)}),i.jsxs("div",{className:"flex items-center justify-between text-sm",children:[i.jsx("div",{className:"flex-1 bg-bambu-dark-tertiary rounded-full h-2 mr-3",children:i.jsx("div",{className:"bg-bambu-dark-tertiary h-2 rounded-full"})}),i.jsx("span",{className:"text-bambu-gray",children:"—"})]}),mt?i.jsxs("p",{className:"text-xs text-bambu-gray mt-2 truncate",title:mt.print_name||mt.filename,children:["Last: ",mt.print_name||mt.filename,mt.completed_at&&i.jsxs("span",{className:"ml-1 text-bambu-gray/60",children:["• ",Gp(mt.completed_at,{month:"short",day:"numeric"})]})]}):i.jsx("p",{className:"text-xs text-bambu-gray mt-2",children:x("printers.readyToPrint")})]})})]})]}),i.jsx(MAe,{printerId:t.id,printerModel:t.model,printerState:ye.state,plateCleared:ye.plate_cleared,loadedFilamentTypes:lt,loadedFilaments:St})]}),ye.temperatures&&r==="expanded"&&(()=>{const bt=ye.temperatures.nozzle_heating||ye.temperatures.nozzle_2_heating||!1,Ot=ye.temperatures.bed_heating||!1,dn=ye.temperatures.chamber_heating||!1,kt=t.nozzle_count===2||ye.temperatures.nozzle_2!==void 0,Pn=ye.active_extruder===1?"L":"R",Nr=ye.nozzle_rack?.find(yi=>yi.id===1),Ht=ye.nozzle_rack?.find(yi=>yi.id===0),wr=Ht||Nr;return i.jsxs("div",{className:"flex items-stretch gap-1.5 flex-wrap",children:[i.jsxs("div",{className:"text-center px-2 py-1.5 bg-bambu-dark rounded-lg flex-1 flex flex-col justify-center items-center",children:[i.jsx(cj,{className:"w-3.5 h-3.5 mb-0.5",color:"text-orange-400",isHeating:bt}),ye.temperatures.nozzle_2!==void 0?i.jsxs(i.Fragment,{children:[i.jsx("p",{className:"text-[9px] text-bambu-gray",children:"L / R"}),i.jsxs("p",{className:"text-[11px] text-white",children:[Math.round(ye.temperatures.nozzle||0),"° / ",Math.round(ye.temperatures.nozzle_2||0),"°"]})]}):wr?i.jsx(ire,{slot:wr,index:0,activeStatus:!0,filamentName:wr.filament_id?ot?.[wr.filament_id]?.name:void 0,children:i.jsxs("div",{className:"cursor-default",children:[i.jsx("p",{className:"text-[9px] text-bambu-gray",children:x("printers.temperatures.nozzle")}),i.jsxs("p",{className:"text-[11px] text-white",children:[Math.round(ye.temperatures.nozzle||0),"°C"]})]})}):i.jsxs(i.Fragment,{children:[i.jsx("p",{className:"text-[9px] text-bambu-gray",children:x("printers.temperatures.nozzle")}),i.jsxs("p",{className:"text-[11px] text-white",children:[Math.round(ye.temperatures.nozzle||0),"°C"]})]})]}),i.jsxs("div",{className:"text-center px-2 py-1.5 bg-bambu-dark rounded-lg flex-1 flex flex-col justify-center items-center",children:[i.jsx(cj,{className:"w-3.5 h-3.5 mb-0.5",color:"text-blue-400",isHeating:Ot}),i.jsx("p",{className:"text-[9px] text-bambu-gray",children:x("printers.temperatures.bed")}),i.jsxs("p",{className:"text-[11px] text-white",children:[Math.round(ye.temperatures.bed||0),"°C"]})]}),ye.temperatures.chamber!==void 0&&i.jsxs("div",{className:"text-center px-2 py-1.5 bg-bambu-dark rounded-lg flex-1 flex flex-col justify-center items-center",children:[i.jsx(cj,{className:"w-3.5 h-3.5 mb-0.5",color:"text-green-400",isHeating:dn}),i.jsx("p",{className:"text-[9px] text-bambu-gray",children:x("printers.temperatures.chamber")}),i.jsxs("p",{className:"text-[11px] text-white",children:[Math.round(ye.temperatures.chamber||0),"°C"]})]}),kt&&i.jsx(dqe,{leftSlot:Nr,rightSlot:Ht,activeNozzle:Pn,filamentInfo:ot,children:i.jsxs("div",{className:"text-center px-3 py-1.5 bg-bambu-dark rounded-lg h-full flex flex-col justify-center items-center cursor-default",title:x("printers.activeNozzle",{nozzle:x(Pn==="L"?"common.left":"common.right")}),children:[i.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[i.jsxs("span",{className:`text-[11px] font-bold ${Pn==="L"?"text-amber-400":"text-gray-500"}`,children:["L",Nr?.nozzle_diameter?` ${Nr.nozzle_diameter}`:""]}),i.jsx("span",{className:"text-[9px] text-bambu-gray/40",children:"·"}),i.jsxs("span",{className:`text-[11px] font-bold ${Pn==="R"?"text-amber-400":"text-gray-500"}`,children:["R",Ht?.nozzle_diameter?` ${Ht.nozzle_diameter}`:""]})]}),i.jsx("p",{className:"text-[9px] text-bambu-gray",children:x("printers.temperatures.nozzle")})]})}),ye.nozzle_rack&&ye.nozzle_rack.some(yi=>yi.id>=2)&&i.jsx(uqe,{slots:ye.nozzle_rack,filamentInfo:ot})]})})(),r==="expanded"&&(()=>{const bt=ye.state==="RUNNING",Ot=ye.state==="PAUSE",dn=bt||Ot,kt=rn.isPending||vn.isPending||Dn.isPending,Pn=ye.cooling_fan_speed,Nr=ye.big_fan1_speed,Ht=ye.big_fan2_speed;return i.jsxs("div",{className:"mt-3",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[i.jsx("span",{className:"text-[10px] uppercase tracking-wider text-bambu-gray font-medium",children:x("printers.controls")}),i.jsx("div",{className:"flex-1 h-px bg-bambu-dark-tertiary/30"})]}),i.jsxs("div",{className:"flex items-center justify-between gap-2 max-[550px]:items-start",children:[i.jsxs("div",{className:"flex items-center gap-2 min-w-0 max-[550px]:flex-wrap max-[550px]:items-start max-[550px]:gap-1.5",children:[i.jsxs("div",{className:`flex items-center gap-1 px-1.5 py-1 rounded ${Pn&&Pn>0?"bg-cyan-500/10":"bg-bambu-dark"}`,title:x("printers.fans.partCooling"),children:[i.jsx(VY,{className:`w-3.5 h-3.5 ${Pn&&Pn>0?"text-cyan-400":"text-bambu-gray/50"}`}),i.jsxs("span",{className:`text-[10px] ${Pn&&Pn>0?"text-cyan-400":"text-bambu-gray/50"}`,children:[Pn??0,"%"]})]}),i.jsxs("div",{className:`flex items-center gap-1 px-1.5 py-1 rounded ${Nr&&Nr>0?"bg-blue-500/10":"bg-bambu-dark"}`,title:x("printers.fans.auxiliary"),children:[i.jsx(rX,{className:`w-3.5 h-3.5 ${Nr&&Nr>0?"text-blue-400":"text-bambu-gray/50"}`}),i.jsxs("span",{className:`text-[10px] ${Nr&&Nr>0?"text-blue-400":"text-bambu-gray/50"}`,children:[Nr??0,"%"]})]}),i.jsxs("div",{className:`flex items-center gap-1 px-1.5 py-1 rounded ${Ht&&Ht>0?"bg-green-500/10":"bg-bambu-dark"}`,title:x("printers.fans.chamber"),children:[i.jsx(bme,{className:`w-3.5 h-3.5 ${Ht&&Ht>0?"text-green-400":"text-bambu-gray/50"}`}),i.jsxs("span",{className:`text-[10px] ${Ht&&Ht>0?"text-green-400":"text-bambu-gray/50"}`,children:[Ht??0,"%"]})]})]}),i.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0 max-[550px]:self-start",children:[i.jsxs("button",{onClick:()=>le(!0),disabled:!dn||kt||!k("printers:control"),className:`
- flex items-center justify-center gap-1 px-3 py-1.5 rounded-lg text-xs font-medium
- transition-colors
- ${dn&&k("printers:control")?"bg-red-500/20 text-red-400 hover:bg-red-500/30":"bg-bambu-dark text-bambu-gray/50 cursor-not-allowed"}
- `,title:k("printers:control")?x("printers.stop"):x("printers.permission.noControl"),children:[i.jsx(Sl,{className:"w-3 h-3"}),x("printers.stop")]}),i.jsxs("button",{onClick:()=>Ot?Z(!0):Ce(!0),disabled:!dn||kt||!k("printers:control"),className:`
- flex items-center justify-center gap-1 px-3 py-1.5 rounded-lg text-xs font-medium
- transition-colors
- ${dn&&k("printers:control")?Ot?"bg-bambu-green/20 text-bambu-green hover:bg-bambu-green/30":"bg-yellow-500/20 text-yellow-400 hover:bg-yellow-500/30":"bg-bambu-dark text-bambu-gray/50 cursor-not-allowed"}
- `,title:k("printers:control")?x(Ot?"printers.resume":"printers.pause"):x("printers.permission.noControl"),children:[Ot?i.jsx(co,{className:"w-3 h-3"}):i.jsx(pC,{className:"w-3 h-3"}),x(Ot?"printers.resume":"printers.pause")]})]})]})]})})(),(cn?.length>0||ye.vt_tray.length>0)&&r==="expanded"&&(()=>{const bt=cn.filter(kt=>kt.tray.length>1),Ot=cn.filter(kt=>kt.tray.length===1),dn=t.nozzle_count===2||ye?.temperatures?.nozzle_2!==void 0;return i.jsxs("div",{className:"mt-3",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[i.jsx("span",{className:"text-[10px] uppercase tracking-wider text-bambu-gray font-medium",children:x("printers.filaments")}),i.jsx("div",{className:"flex-1 h-px bg-bambu-dark-tertiary/30"})]}),i.jsxs("div",{className:"space-y-3",children:[bt.length>0&&i.jsx("div",{className:"grid grid-cols-2 gap-3",children:bt.map(kt=>{const Pn=nn[String(kt.id)],Nr=kt.id>=128?kt.id-128:kt.id,Ht=Pn!==void 0?Pn:Nr,wr=Ht===1,yi=Ht===0;return i.jsxs("div",{className:"p-2.5 bg-bambu-dark rounded-lg border border-bambu-dark-tertiary/30",children:[i.jsxs("div",{className:"flex items-center justify-between mb-2",children:[i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx(DG,{ams:kt,printerId:t.id,label:kc(kt.id,kt.tray.length),amsLabels:qe,canEdit:k("printers:update"),onSaved:ht,children:i.jsx("span",{className:"text-[10px] text-white font-medium cursor-default select-none",children:qe?.[kt.id]||kc(kt.id,kt.tray.length)})}),dn&&(wr||yi)&&i.jsx(PG,{side:wr?"L":"R"})]}),(kt.humidity!=null||kt.temp!=null)&&i.jsxs("div",{className:"flex items-center gap-1.5 max-[550px]:flex-col max-[550px]:items-start",children:[kt.humidity!=null&&i.jsx(MG,{humidity:kt.humidity,goodThreshold:s?.humidityGood,fairThreshold:s?.humidityFair,onClick:()=>O({amsId:kt.id,amsLabel:kc(kt.id,kt.tray.length),mode:"humidity"}),compact:!0}),kt.temp!=null&&i.jsx(EG,{temp:kt.temp,goodThreshold:s?.tempGood,fairThreshold:s?.tempFair,onClick:()=>O({amsId:kt.id,amsLabel:kc(kt.id,kt.tray.length),mode:"temperature"}),compact:!0})]})]}),i.jsx("div",{className:"grid grid-cols-4 gap-1.5",children:[0,1,2,3].map(sn=>{const Rn=kt.tray[sn]||kt.tray.find(Tn=>Tn.id===sn),qs=Rn?.tray_type&&Rn.remain>=0,Vs=!Rn?.tray_type,go=kt.id*4+sn,Se=De===go,Dt=Rn?.tray_info_idx?ot?.[Rn.tray_info_idx]:null,Cn=ft?.[go],nr=(Rn?.tag_uid||Rn?.tray_uuid||qg(t.serial_number,kt.id,sn))?.toUpperCase(),ri=nr?l?.[nr]:void 0,Na=uj(ri),Yi=d?.(t.id,kt.id,sn),Xn=(()=>{const Tn=Yi?.spool;return Tn&&Tn.label_weight>0&&Tn.weight_used!=null?Math.round(Math.max(0,Tn.label_weight-Tn.weight_used)/Tn.label_weight*100):null})(),ks=Na??Xn??(qs?Rn.remain:null),Tf=Na!==null?"spoolman":Xn!==null?"inventory":qs?"ams":void 0,vi=Rn?.tray_type?{vendor:mj(Rn)?"Bambu Lab":"Generic",profile:Dt?.name||Cn?.preset_name||Rn.tray_sub_brands||Rn.tray_type,colorName:oj(Rn.tray_id_name)||C1(Rn.tray_color),colorHex:Rn.tray_color||null,kFactor:lj(Rn.k),fillLevel:ks,trayUuid:Rn.tray_uuid||null,tagUid:Rn.tag_uid||null,fillSource:Tf}:null,id=vr?.amsId===kt.id&&vr?.slotId===sn,Pu=i.jsxs("div",{className:`bg-bambu-dark-tertiary rounded p-1 text-center ${Vs?"opacity-50":""} ${Se?"ring-2 ring-bambu-green ring-offset-1 ring-offset-bambu-dark":""}`,children:[i.jsx(sj,{trayColor:Rn?.tray_color,trayType:Rn?.tray_type,isEmpty:Vs,slotNumber:sn+1}),i.jsx("div",{className:"text-[9px] text-white font-bold truncate",children:Rn?.tray_type||"—"}),i.jsx("div",{className:"mt-1 h-1.5 bg-black/30 rounded-full overflow-hidden",children:ks!==null&&ks>=0&&Rn&&i.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${ks}%`,backgroundColor:dj(ks)}})})]});return i.jsxs("div",{className:"relative group",children:[id&&i.jsx("div",{className:"absolute inset-0 bg-bambu-dark-tertiary/80 rounded flex items-center justify-center z-20",children:i.jsx(_r,{className:"w-4 h-4 text-bambu-green animate-spin"})}),ye?.state!=="RUNNING"&&i.jsx("button",{onClick:Tn=>{Tn.stopPropagation(),$s(_s?.amsId===kt.id&&_s?.slotId===sn?null:{amsId:kt.id,slotId:sn})},className:"absolute -top-1 -right-1 w-4 h-4 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-full flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity z-10 hover:bg-bambu-dark-tertiary",title:x("printers.slotOptions"),children:i.jsx(Bm,{className:"w-2.5 h-2.5 text-bambu-gray"})}),ye?.state!=="RUNNING"&&_s?.amsId===kt.id&&_s?.slotId===sn&&i.jsx("div",{className:"absolute top-full left-0 mt-1 z-50 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg shadow-xl py-1 min-w-[120px]",children:i.jsxs("button",{className:`w-full px-3 py-1.5 text-left text-xs flex items-center gap-2 ${k("printers:ams_rfid")?"text-white hover:bg-bambu-dark-tertiary":"text-bambu-gray/50 cursor-not-allowed"}`,onClick:Tn=>{Tn.stopPropagation(),k("printers:ams_rfid")&&(gi.mutate({amsId:kt.id,slotId:sn}),$s(null))},disabled:id||!k("printers:ams_rfid"),title:k("printers:ams_rfid")?void 0:x("printers.permission.noAmsRfid"),children:[i.jsx(_r,{className:`w-3 h-3 ${id?"animate-spin":""}`}),x("printers.rfid.reread")]})}),vi?i.jsx(ij,{data:vi,spoolman:{enabled:o,linkedSpoolId:nr?l?.[nr]?.id:void 0,spoolmanUrl:c,onLinkSpool:o?()=>{const Tn=(vi.trayUuid||vi.tagUid||qg(t.serial_number,kt.id,sn)).toUpperCase();Q({tagUid:vi.tagUid||Tn,trayUuid:vi.trayUuid||"",printerId:t.id,amsId:kt.id,trayId:sn})}:void 0,onUnlinkSpool:ri?.id?()=>Rt.mutate(ri.id):void 0},inventory:o?void 0:(()=>{const Tn=d?.(t.id,kt.id,sn);return{assignedSpool:Tn?.spool?{id:Tn.spool.id,material:Tn.spool.material,brand:Tn.spool.brand,color_name:Tn.spool.color_name,remainingWeightGrams:Math.max(0,Math.round(Tn.spool.label_weight-Tn.spool.weight_used))}:null,onAssignSpool:vi.vendor!=="Bambu Lab"?()=>he({printerId:t.id,amsId:kt.id,trayId:sn,trayInfo:{type:vi.profile,color:vi.colorHex||"",location:`${kc(kt.id,kt.tray.length)} Slot ${sn+1}`}}):void 0,onUnassignSpool:Tn&&vi.vendor!=="Bambu Lab"?()=>u?.(t.id,kt.id,sn):void 0}})(),configureSlot:{enabled:k("printers:control"),onConfigure:()=>Ae({amsId:kt.id,trayId:sn,trayCount:kt.tray.length,trayType:Rn?.tray_type||void 0,trayColor:Rn?.tray_color||void 0,traySubBrands:Rn?.tray_sub_brands||void 0,trayInfoIdx:Rn?.tray_info_idx||void 0,extruderId:Pn,caliIdx:Rn?.cali_idx,savedPresetId:Cn?.preset_id})},children:Pu}):i.jsx(aj,{configureSlot:{enabled:k("printers:control"),onConfigure:()=>Ae({amsId:kt.id,trayId:sn,trayCount:kt.tray.length,extruderId:Pn})},children:Pu})]},sn)})})]},kt.id)})}),(Ot.length>0||ye.vt_tray.length>0)&&i.jsxs("div",{className:"grid grid-cols-4 gap-3",children:[Ot.map(kt=>{const Pn=nn[String(kt.id)],Nr=kt.id>=128?kt.id-128:kt.id,Ht=Pn!==void 0?Pn:Nr,wr=Ht===1,yi=Ht===0,sn=kt.tray[0],Rn=sn?.tray_type&&sn.remain>=0,qs=!sn?.tray_type,Vs=lN(kt.id,sn?.id??0,!1),go=De===Vs,Se=sn?.tray_info_idx?ot?.[sn.tray_info_idx]:null,Dt=ft?.[Vs],Cn=sn?.id??0,nr=(sn?.tray_uuid||sn?.tag_uid||qg(t.serial_number,kt.id,Cn))?.toUpperCase(),ri=nr?l?.[nr]:void 0,Na=uj(ri),Yi=d?.(t.id,kt.id,Cn),Xn=(()=>{const Tn=Yi?.spool;return Tn&&Tn.label_weight>0&&Tn.weight_used!=null?Math.round(Math.max(0,Tn.label_weight-Tn.weight_used)/Tn.label_weight*100):null})(),ks=Na??Xn??(Rn?sn.remain:null),Tf=Na!==null?"spoolman":Xn!==null?"inventory":Rn?"ams":void 0,vi=sn?.tray_type?{vendor:mj(sn)?"Bambu Lab":"Generic",profile:Se?.name||Dt?.preset_name||sn.tray_sub_brands||sn.tray_type,colorName:oj(sn.tray_id_name)||C1(sn.tray_color),colorHex:sn.tray_color||null,kFactor:lj(sn.k),fillLevel:ks,trayUuid:sn.tray_uuid||null,tagUid:sn.tag_uid||null,fillSource:Tf}:null,id=vr?.amsId===kt.id&&vr?.slotId===Cn,Pu=i.jsxs("div",{className:`bg-bambu-dark-tertiary rounded p-1 text-center ${qs?"opacity-50":""} ${go?"ring-2 ring-bambu-green ring-offset-1 ring-offset-bambu-dark":""}`,children:[i.jsx(sj,{trayColor:sn?.tray_color,trayType:sn?.tray_type,isEmpty:qs,slotNumber:1}),i.jsx("div",{className:"text-[9px] text-white font-bold truncate",children:sn?.tray_type||"—"}),i.jsx("div",{className:"mt-1 h-1.5 bg-black/30 rounded-full overflow-hidden",children:ks!==null&&ks>=0&&i.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${ks}%`,backgroundColor:dj(ks)}})})]});return i.jsxs("div",{className:"p-2.5 bg-bambu-dark rounded-lg border border-bambu-dark-tertiary/30",children:[i.jsxs("div",{className:"flex items-center gap-1 mb-2",children:[i.jsx(DG,{ams:kt,printerId:t.id,label:kc(kt.id,kt.tray.length),amsLabels:qe,canEdit:k("printers:update"),onSaved:ht,children:i.jsx("span",{className:"text-[10px] text-white font-medium cursor-default select-none",children:qe?.[kt.id]||kc(kt.id,kt.tray.length)})}),dn&&(wr||yi)&&i.jsx(PG,{side:wr?"L":"R"})]}),i.jsxs("div",{className:"flex gap-1.5 max-[550px]:flex-col max-[550px]:items-start",children:[i.jsxs("div",{className:"relative group flex-1 max-[550px]:w-full",children:[id&&i.jsx("div",{className:"absolute inset-0 bg-bambu-dark-tertiary/80 rounded flex items-center justify-center z-20",children:i.jsx(_r,{className:"w-4 h-4 text-bambu-green animate-spin"})}),ye?.state!=="RUNNING"&&i.jsx("button",{onClick:Tn=>{Tn.stopPropagation(),$s(_s?.amsId===kt.id&&_s?.slotId===Cn?null:{amsId:kt.id,slotId:Cn})},className:"absolute -top-1 -right-1 w-4 h-4 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-full flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity z-10 hover:bg-bambu-dark-tertiary",title:x("printers.slotOptions"),children:i.jsx(Bm,{className:"w-2.5 h-2.5 text-bambu-gray"})}),ye?.state!=="RUNNING"&&_s?.amsId===kt.id&&_s?.slotId===Cn&&i.jsx("div",{className:"absolute top-full left-0 mt-1 z-50 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg shadow-xl py-1 min-w-[120px]",children:i.jsxs("button",{className:`w-full px-3 py-1.5 text-left text-xs flex items-center gap-2 ${k("printers:ams_rfid")?"text-white hover:bg-bambu-dark-tertiary":"text-bambu-gray/50 cursor-not-allowed"}`,onClick:Tn=>{Tn.stopPropagation(),k("printers:ams_rfid")&&(gi.mutate({amsId:kt.id,slotId:Cn}),$s(null))},disabled:id||!k("printers:ams_rfid"),title:k("printers:ams_rfid")?void 0:x("printers.permission.noAmsRfid"),children:[i.jsx(_r,{className:`w-3 h-3 ${id?"animate-spin":""}`}),x("printers.rfid.reread")]})}),vi?i.jsx(ij,{data:vi,spoolman:{enabled:o,linkedSpoolId:nr?l?.[nr]?.id:void 0,spoolmanUrl:c,onLinkSpool:o?()=>{const Tn=(vi.trayUuid||vi.tagUid||qg(t.serial_number,kt.id,Cn)).toUpperCase();Q({tagUid:vi.tagUid||Tn,trayUuid:vi.trayUuid||"",printerId:t.id,amsId:kt.id,trayId:Cn})}:void 0,onUnlinkSpool:ri?.id?()=>Rt.mutate(ri.id):void 0},inventory:o?void 0:(()=>{const Tn=d?.(t.id,kt.id,Cn);return{assignedSpool:Tn?.spool?{id:Tn.spool.id,material:Tn.spool.material,brand:Tn.spool.brand,color_name:Tn.spool.color_name,remainingWeightGrams:Math.max(0,Math.round(Tn.spool.label_weight-Tn.spool.weight_used))}:null,onAssignSpool:vi.vendor!=="Bambu Lab"?()=>he({printerId:t.id,amsId:kt.id,trayId:Cn,trayInfo:{type:vi.profile,color:vi.colorHex||"",location:kc(kt.id,kt.tray.length)}}):void 0,onUnassignSpool:Tn&&vi.vendor!=="Bambu Lab"?()=>u?.(t.id,kt.id,Cn):void 0}})(),configureSlot:{enabled:k("printers:control"),onConfigure:()=>Ae({amsId:kt.id,trayId:Cn,trayCount:kt.tray.length,trayType:sn?.tray_type||void 0,trayColor:sn?.tray_color||void 0,traySubBrands:sn?.tray_sub_brands||void 0,trayInfoIdx:sn?.tray_info_idx||void 0,extruderId:Pn,caliIdx:sn?.cali_idx,savedPresetId:Dt?.preset_id})},children:Pu}):i.jsx(aj,{configureSlot:{enabled:k("printers:control"),onConfigure:()=>Ae({amsId:kt.id,trayId:Cn,trayCount:kt.tray.length,extruderId:Pn})},children:Pu})]}),(kt.humidity!=null||kt.temp!=null)&&i.jsxs("div",{className:"flex flex-col justify-center gap-1 shrink-0 max-[550px]:w-full",children:[kt.temp!=null&&i.jsx(EG,{temp:kt.temp,goodThreshold:s?.tempGood,fairThreshold:s?.tempFair,onClick:()=>O({amsId:kt.id,amsLabel:kc(kt.id,kt.tray.length),mode:"temperature"}),compact:!0}),kt.humidity!=null&&i.jsx(MG,{humidity:kt.humidity,goodThreshold:s?.humidityGood,fairThreshold:s?.humidityFair,onClick:()=>O({amsId:kt.id,amsLabel:kc(kt.id,kt.tray.length),mode:"humidity"}),compact:!0})]})]})]},kt.id)}),ye.vt_tray.length>0&&i.jsxs("div",{className:`p-2.5 bg-bambu-dark rounded-lg border border-bambu-dark-tertiary/30 ${ye.vt_tray.length===1?"max-w-[50%]":""}`,children:[i.jsx("div",{className:"flex items-center gap-1 mb-2",children:i.jsx("span",{className:"text-[10px] text-white font-medium",children:x("printers.external")})}),i.jsx("div",{className:`grid ${ye.vt_tray.length>1?"grid-cols-2":"grid-cols-1"} gap-1.5`,children:[...ye.vt_tray].sort((kt,Pn)=>(kt.id??254)-(Pn.id??254)).map(kt=>{const Pn=kt.id??254,Nr=dn&&De===254?Pn===254&&ye.active_extruder===1||Pn===255&&ye.active_extruder===0:De===Pn,Ht=Pn-254,wr=dn?x(Pn===254?"printers.extL":"printers.extR"):"",yi=kt.tray_info_idx?ot?.[kt.tray_info_idx]:null,sn=ft?.[1020+Ht],Rn=(kt.tray_uuid||kt.tag_uid||qg(t.serial_number,255,Ht))?.toUpperCase(),qs=Rn?l?.[Rn]:void 0,Vs=uj(qs),go=d?.(t.id,255,Ht),Se=(()=>{const Xn=go?.spool;return Xn&&Xn.label_weight>0&&Xn.weight_used!=null?Math.round(Math.max(0,Xn.label_weight-Xn.weight_used)/Xn.label_weight*100):null})(),Dt=kt.tray_type&&kt.remain>=0,Cn=Vs??Se??(Dt?kt.remain:null),nr=Vs!==null?"spoolman":Se!==null?"inventory":Dt?"ams":void 0,ri={vendor:mj(kt)?"Bambu Lab":"Generic",profile:yi?.name||sn?.preset_name||kt.tray_sub_brands||kt.tray_type||"Unknown",colorName:oj(kt.tray_id_name)||C1(kt.tray_color),colorHex:kt.tray_color||null,kFactor:lj(kt.k),fillLevel:Cn,trayUuid:kt.tray_uuid||null,tagUid:kt.tag_uid||null,fillSource:nr},Na=!kt.tray_type,Yi=i.jsxs("div",{className:`bg-bambu-dark-tertiary rounded p-1 text-center ${Na?"opacity-50":""} ${Nr?"ring-2 ring-bambu-green ring-offset-1 ring-offset-bambu-dark":""}`,children:[i.jsx(sj,{trayColor:kt.tray_color,trayType:kt.tray_type,isEmpty:Na,slotNumber:Ht+1}),i.jsx("div",{className:`text-[9px] font-bold truncate ${Na?"text-white/40":"text-white"}`,children:kt.tray_type||"—"}),i.jsx("div",{className:"mt-1 h-1.5 bg-black/30 rounded-full overflow-hidden",children:Cn!==null&&Cn>=0&&!Na&&i.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${Cn}%`,backgroundColor:dj(Cn)}})}),wr&&i.jsx("div",{className:"text-[7px] text-white/40 mt-0.5 truncate",children:wr})]});return i.jsx("div",{className:"relative group",children:Na?i.jsx(aj,{configureSlot:{enabled:k("printers:control"),onConfigure:()=>Ae({amsId:255,trayId:Ht,trayCount:1,extruderId:dn?Pn===254?1:0:void 0})},children:Yi}):i.jsx(ij,{data:ri,spoolman:{enabled:o,linkedSpoolId:Rn?l?.[Rn]?.id:void 0,spoolmanUrl:c,onLinkSpool:o?()=>{const Xn=(ri.trayUuid||ri.tagUid||qg(t.serial_number,255,Ht)).toUpperCase();Q({tagUid:ri.tagUid||Xn,trayUuid:ri.trayUuid||"",printerId:t.id,amsId:255,trayId:Ht})}:void 0,onUnlinkSpool:qs?.id?()=>Rt.mutate(qs.id):void 0},inventory:o?void 0:(()=>{const Xn=d?.(t.id,255,Ht);return{assignedSpool:Xn?.spool?{id:Xn.spool.id,material:Xn.spool.material,brand:Xn.spool.brand,color_name:Xn.spool.color_name,remainingWeightGrams:Math.max(0,Math.round(Xn.spool.label_weight-Xn.spool.weight_used))}:null,onAssignSpool:()=>he({printerId:t.id,amsId:255,trayId:Ht,trayInfo:{type:ri.profile,color:ri.colorHex||"",location:wr||x("printers.external")}}),onUnassignSpool:Xn?()=>u?.(t.id,255,Ht):void 0}})(),configureSlot:{enabled:k("printers:control"),onConfigure:()=>Ae({amsId:255,trayId:Ht,trayCount:1,trayType:kt.tray_type||void 0,trayColor:kt.tray_color||void 0,traySubBrands:kt.tray_sub_brands||void 0,trayInfoIdx:kt.tray_info_idx||void 0,extruderId:dn?Pn===254?1:0:void 0,caliIdx:kt.cali_idx,savedPresetId:sn?.preset_id})},children:Yi})},Pn)})})]})]})]})]})})()]}),Xe&&r==="expanded"&&i.jsxs("div",{className:"mt-4 pt-4 border-t border-bambu-dark-tertiary",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[i.jsx(rc,{className:"w-4 h-4 text-bambu-gray flex-shrink-0"}),i.jsx("span",{className:"text-sm text-white truncate",children:Xe.name}),Ke&&i.jsxs("span",{className:`text-xs px-1.5 py-0.5 rounded flex-shrink-0 ${Ke.state==="ON"?"bg-bambu-green/20 text-bambu-green":Ke.state==="OFF"?"bg-red-500/20 text-red-400":"bg-bambu-gray/20 text-bambu-gray"}`,children:[Ke.state||"?",Ke.state==="ON"&&Ke.energy?.power!=null&&i.jsxs("span",{className:"text-yellow-400 ml-1.5",children:["· ",Ke.energy.power,"W"]})]})]}),i.jsx("div",{className:"flex-1"}),i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsxs("button",{onClick:()=>J(!0),disabled:jt.isPending||Ke?.state==="ON"||!k("smart_plugs:control"),className:`px-2 py-1 text-xs rounded transition-colors flex items-center gap-1 ${k("smart_plugs:control")?Ke?.state==="ON"?"bg-bambu-green text-white":"bg-bambu-dark text-bambu-gray hover:text-white hover:bg-bambu-dark-tertiary":"bg-bambu-dark text-bambu-gray/50 cursor-not-allowed"}`,title:k("smart_plugs:control")?void 0:x("printers.permission.noSmartPlugControl"),children:[i.jsx(wu,{className:"w-3 h-3"}),"On"]}),i.jsxs("button",{onClick:()=>me(!0),disabled:jt.isPending||Ke?.state==="OFF"||!k("smart_plugs:control"),className:`px-2 py-1 text-xs rounded transition-colors flex items-center gap-1 ${k("smart_plugs:control")?Ke?.state==="OFF"?"bg-red-500/30 text-red-400":"bg-bambu-dark text-bambu-gray hover:text-white hover:bg-bambu-dark-tertiary":"bg-bambu-dark text-bambu-gray/50 cursor-not-allowed"}`,title:k("smart_plugs:control")?void 0:x("printers.permission.noSmartPlugControl"),children:[i.jsx(fC,{className:"w-3 h-3"}),"Off"]})]}),i.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[i.jsx("span",{className:`text-xs hidden sm:inline ${Xe.auto_off_executed?"text-bambu-green":"text-bambu-gray"}`,children:Xe.auto_off_executed?"Auto-off done":"Auto-off"}),i.jsx("button",{onClick:()=>Ft.mutate(!Xe.auto_off),disabled:Ft.isPending||Xe.auto_off_executed||!k("smart_plugs:control"),title:k("smart_plugs:control")?Xe.auto_off_executed?x("printers.autoOffExecuted"):x("printers.autoOffAfterPrint"):x("printers.permission.noSmartPlugControl"),className:`relative w-9 h-5 rounded-full transition-colors flex-shrink-0 ${k("smart_plugs:control")?Xe.auto_off_executed?"bg-bambu-green/50 cursor-not-allowed":Xe.auto_off?"bg-bambu-green":"bg-bambu-dark-tertiary":"bg-bambu-dark-tertiary/50 cursor-not-allowed"}`,children:i.jsx("span",{className:`absolute top-[2px] left-[2px] w-4 h-4 bg-white rounded-full transition-transform ${Xe.auto_off||Xe.auto_off_executed?"translate-x-4":"translate-x-0"}`})})]})]}),at&&at.length>0&&i.jsxs("div",{className:"flex items-center gap-2 mt-2 pt-2 border-t border-bambu-dark-tertiary/50",children:[i.jsx(D0,{className:"w-3.5 h-3.5 text-blue-400 flex-shrink-0"}),i.jsx("span",{className:"text-xs text-bambu-gray",children:"HA:"}),i.jsx("div",{className:"flex flex-wrap gap-1",children:at.map(bt=>i.jsxs("button",{onClick:()=>mn.mutate(bt.id),disabled:mn.isPending,title:`Run ${bt.ha_entity_id}`,className:"px-2 py-0.5 text-xs bg-blue-500/20 text-blue-400 hover:bg-blue-500/30 rounded transition-colors flex items-center gap-1",children:[i.jsx(co,{className:"w-2.5 h-2.5"}),bt.name]},bt.id))})]})]}),r==="expanded"&&i.jsxs("div",{className:"mt-4 pt-4 border-t border-bambu-dark-tertiary flex items-center justify-end gap-2 flex-wrap",children:[i.jsx(Fe,{variant:"secondary",size:"sm",onClick:()=>Bn.mutate(!ye?.chamber_light),disabled:!ye?.connected||Bn.isPending||!k("printers:control"),title:k("printers:control")?ye?.chamber_light?x("printers.chamberLightOff"):x("printers.chamberLightOn"):x("printers.permission.noControl"),className:ye?.chamber_light?"!border-yellow-500 !text-yellow-400 hover:!bg-yellow-500/20":"",children:i.jsx(AL,{on:ye?.chamber_light??!1,className:`w-4 h-4 ${ye?.chamber_light?"text-yellow-400":""}`})}),i.jsx(Fe,{variant:"secondary",size:"sm",onClick:()=>{if(p==="embedded"&&f)f(t.id,t.name);else{const bt=localStorage.getItem("cameraWindowState"),Ot=bt?JSON.parse(bt):{width:640,height:400},dn=[`width=${Ot.width}`,`height=${Ot.height}`,Ot.left!==void 0?`left=${Ot.left}`:"",Ot.top!==void 0?`top=${Ot.top}`:"","menubar=no,toolbar=no,location=no,status=no,noopener"].filter(Boolean).join(",");window.open(`/camera/${t.id}`,`camera-${t.id}`,dn)}},disabled:!ye?.connected||!k("camera:view"),title:k("camera:view")?x(p==="embedded"?"printers.openCameraOverlay":"printers.openCameraWindow"):x("printers.permission.noCamera"),children:i.jsx(QF,{className:"w-4 h-4"})}),i.jsxs("div",{className:`inline-flex rounded-md ${t.plate_detection_enabled?"ring-1 ring-green-500":""}`,children:[i.jsx(Fe,{variant:"secondary",size:"sm",onClick:_h,disabled:!ye?.connected||en.isPending||!k("printers:update"),title:k("printers:update")?t.plate_detection_enabled?x("printers.plateDetection.enabledClick"):x("printers.plateDetection.disabledClick"):x("printers.plateDetection.noPermission"),className:`!rounded-r-none !border-r-0 ${t.plate_detection_enabled?"!border-green-500 !text-green-400 hover:!bg-green-500/20":""}`,children:en.isPending?i.jsx(ct,{className:"w-4 h-4 animate-spin"}):i.jsx(W1,{className:"w-4 h-4"})}),i.jsx(Fe,{variant:"secondary",size:"sm",onClick:kf,disabled:!ye?.connected||Ne||!k("printers:update"),title:k("printers:update")?x("printers.plateDetection.manageCalibration"):x("printers.plateDetection.noPermission"),className:`!rounded-l-none !px-1.5 ${t.plate_detection_enabled?"!border-green-500 !text-green-400 hover:!bg-green-500/20":""}`,children:Ne?i.jsx(ct,{className:"w-3 h-3 animate-spin"}):i.jsx(In,{className:"w-3 h-3"})})]}),i.jsxs(Fe,{variant:"secondary",size:"sm",onClick:()=>G(!0),disabled:!Xt||!k("printers:files"),title:k("printers:files")?x("printers.browseFiles"):x("printers.permission.noFiles"),children:[i.jsx(cx,{className:"w-4 h-4"}),x("printers.files")]}),Xt&&ye?.state!=="RUNNING"&&ye?.state!=="PAUSE"&&i.jsxs(Fe,{size:"sm",onClick:()=>W(!0),disabled:!k("printers:control"),title:k("printers:control")?x("common.print"):x("printers.permission.noControl"),className:"!bg-bambu-green hover:!bg-bambu-green/80 !text-white",children:[i.jsx(kr,{className:"w-4 h-4"}),x("common.print")]})]})]}),U&&i.jsx(yAe,{printerId:t.id,printerName:t.name,onClose:()=>G(!1)}),I&&i.jsx(Zne,{folderId:null,onClose:()=>W(!1),onUploadComplete:()=>{},autoUpload:!0,accept:".gcode,.3mf",validateFile:bt=>{const Ot=bt.name.toLowerCase();if(!Ot.endsWith(".gcode")&&!Ot.includes(".gcode."))return x("printers.dropNotPrintable","Only .gcode and .gcode.3mf files can be printed")},onFileUploaded:bt=>{const Ot=bt.metadata?.sliced_for_model,dn=pv(t.model);if(Ot&&dn&&Ot.toLowerCase()!==dn.toLowerCase())return be.deleteLibraryFile(bt.id).catch(()=>{}),x("printers.incompatibleFile","This file was sliced for {{slicedFor}}, but this printer is a {{printerModel}}",{slicedFor:Ot,printerModel:dn});ee({id:bt.id,filename:bt.filename})}}),V&&i.jsx($c,{mode:"reprint",libraryFileId:V.id,archiveName:V.filename,initialSelectedPrinterIds:[t.id],onClose:()=>ee(null),onSuccess:()=>ee(null)}),L&&i.jsx(NAe,{printerId:t.id,printerName:t.name,onClose:()=>te(!1)}),B&&i.jsx(oqe,{printer:t,status:ye,totalPrintHours:n?.total_print_hours,onClose:z}),Be&&i.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",onClick:()=>za(),children:i.jsxs("div",{className:"bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-xl shadow-2xl max-w-lg w-full",onClick:bt=>bt.stopPropagation(),children:[i.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-bambu-dark-tertiary",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[Be.needs_calibration?i.jsx(W1,{className:"w-5 h-5 text-blue-500"}):Be.is_empty?i.jsx(fr,{className:"w-5 h-5 text-green-500"}):i.jsx(qi,{className:"w-5 h-5 text-yellow-500"}),i.jsx("h2",{className:"text-lg font-semibold text-white",children:"Build Plate Check"}),Be.reference_count!==void 0&&Be.max_references&&i.jsxs("span",{className:"text-xs text-bambu-gray bg-bambu-dark-tertiary px-2 py-1 rounded",children:[Be.reference_count,"/",Be.max_references," refs"]})]}),i.jsx("button",{onClick:()=>za(),className:"p-1 text-bambu-gray hover:text-white rounded transition-colors",children:i.jsx(zt,{className:"w-5 h-5"})})]}),i.jsxs("div",{className:"p-4 space-y-4",children:[Be.needs_calibration?i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"p-3 rounded-lg bg-blue-500/20 border border-blue-500/50",children:[i.jsx("p",{className:"font-medium text-blue-400",children:x("printers.plateDetection.calibrationRequired")}),i.jsx("p",{className:"text-sm text-bambu-gray mt-1",dangerouslySetInnerHTML:{__html:x("printers.plateDetection.calibrationInstructions")}})]}),i.jsxs("div",{className:"text-sm text-bambu-gray space-y-2",children:[i.jsx("p",{children:x("printers.plateDetection.calibrationDescription")}),i.jsx("p",{dangerouslySetInnerHTML:{__html:x("printers.plateDetection.calibrationTip")}})]})]}):i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:`p-3 rounded-lg ${Be.is_empty?"bg-green-500/20 border border-green-500/50":"bg-yellow-500/20 border border-yellow-500/50"}`,children:[i.jsx("p",{className:`font-medium ${Be.is_empty?"text-green-400":"text-yellow-400"}`,children:Be.is_empty?x("printers.plateDetection.plateEmpty"):x("printers.plateDetection.objectsDetected")}),i.jsxs("p",{className:"text-sm text-bambu-gray mt-1",children:[x("printers.plateDetection.confidence"),": ",Math.round(Be.confidence*100),"% | ",x("printers.plateDetection.difference"),": ",Be.difference_percent.toFixed(1),"%"]})]}),Be.debug_image_url&&i.jsxs("div",{children:[i.jsx("p",{className:"text-sm text-bambu-gray mb-2",children:x("printers.plateDetection.analysisPreview")}),i.jsx("img",{src:Be.debug_image_url,alt:x("printers.plateDetection.analysisPreview"),className:"w-full rounded-lg border border-bambu-dark-tertiary"}),i.jsx("p",{className:"text-xs text-bambu-gray mt-2",children:x("printers.plateDetection.analysisLegend")})]}),i.jsx("p",{className:"text-xs text-bambu-gray",children:Be.message})]}),tr&&tr.references.length>0&&i.jsxs("div",{className:"mt-4 pt-4 border-t border-bambu-dark-tertiary",children:[i.jsx("p",{className:"text-sm font-medium text-white mb-2",children:x("printers.plateDetection.savedReferences",{count:tr.references.length,max:tr.max_references})}),i.jsx("div",{className:"grid grid-cols-5 gap-2",children:tr.references.map(bt=>i.jsxs("div",{className:"relative group",children:[i.jsx("img",{src:be.getPlateReferenceThumbnailUrl(t.id,bt.index),alt:bt.label||`Reference ${bt.index+1}`,className:"w-full aspect-video object-cover rounded border border-bambu-dark-tertiary"}),i.jsx("button",{onClick:()=>uc(bt.index),className:"absolute top-1 right-1 p-0.5 bg-red-500/80 rounded opacity-0 group-hover:opacity-100 transition-opacity",title:x("printers.plateDetection.deleteReference"),children:i.jsx(zt,{className:"w-3 h-3 text-white"})}),ni?.index===bt.index?i.jsx("input",{type:"text",value:ni.label,onChange:Ot=>Fr({...ni,label:Ot.target.value}),onBlur:()=>dc(bt.index,ni.label),onKeyDown:Ot=>{Ot.key==="Enter"&&dc(bt.index,ni.label),Ot.key==="Escape"&&Fr(null)},className:"w-full mt-1 px-1 py-0.5 text-xs bg-bambu-dark-tertiary border border-bambu-green rounded text-white",autoFocus:!0,placeholder:x("printers.plateDetection.labelPlaceholder")}):i.jsx("p",{className:"text-xs text-bambu-gray mt-1 truncate cursor-pointer hover:text-white",onClick:()=>Fr({index:bt.index,label:bt.label}),title:bt.label?x("printers.plateDetection.clickToEdit",{label:bt.label}):x("printers.plateDetection.clickToAddLabel"),children:bt.label||i.jsx("span",{className:"italic opacity-50",children:x("printers.noLabel")})}),i.jsx("p",{className:"text-[10px] text-bambu-gray/60",children:bt.timestamp?Jn(bt.timestamp)?.toLocaleDateString()??"":""})]},bt.index))})]}),!Be.needs_calibration&&i.jsxs("div",{className:"mt-4 pt-4 border-t border-bambu-dark-tertiary",children:[i.jsxs("div",{className:"flex items-center justify-between mb-2",children:[i.jsx("p",{className:"text-sm font-medium text-white",children:x("printers.roi.title")}),Ge?i.jsxs("div",{className:"flex gap-1",children:[i.jsx(Fe,{variant:"ghost",size:"sm",onClick:()=>xe(null),disabled:He,children:x("common.cancel")}),i.jsx(Fe,{size:"sm",onClick:Ki,disabled:He,children:He?i.jsx(ct,{className:"w-3 h-3 animate-spin"}):x("common.save")})]}):i.jsxs(Fe,{variant:"ghost",size:"sm",onClick:()=>xe(Be.roi||{x:.15,y:.35,w:.7,h:.55}),children:[i.jsx(Wi,{className:"w-3 h-3 mr-1"}),x("common.edit")]})]}),Ge?i.jsxs("div",{className:"space-y-3 bg-bambu-dark-tertiary/50 p-3 rounded-lg",children:[i.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-bambu-gray",children:x("printers.roi.xStart")}),i.jsx("input",{type:"range",min:"0",max:"0.9",step:"0.01",value:Ge.x,onChange:bt=>xe({...Ge,x:parseFloat(bt.target.value)}),className:"w-full h-1.5 bg-bambu-dark-tertiary rounded-lg cursor-pointer accent-green-500"}),i.jsxs("span",{className:"text-xs text-bambu-gray",children:[Math.round(Ge.x*100),"%"]})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-bambu-gray",children:x("printers.roi.yStart")}),i.jsx("input",{type:"range",min:"0",max:"0.9",step:"0.01",value:Ge.y,onChange:bt=>xe({...Ge,y:parseFloat(bt.target.value)}),className:"w-full h-1.5 bg-bambu-dark-tertiary rounded-lg cursor-pointer accent-green-500"}),i.jsxs("span",{className:"text-xs text-bambu-gray",children:[Math.round(Ge.y*100),"%"]})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-bambu-gray",children:x("printers.width")}),i.jsx("input",{type:"range",min:"0.1",max:"1",step:"0.01",value:Ge.w,onChange:bt=>xe({...Ge,w:parseFloat(bt.target.value)}),className:"w-full h-1.5 bg-bambu-dark-tertiary rounded-lg cursor-pointer accent-green-500"}),i.jsxs("span",{className:"text-xs text-bambu-gray",children:[Math.round(Ge.w*100),"%"]})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-bambu-gray",children:x("printers.height")}),i.jsx("input",{type:"range",min:"0.1",max:"1",step:"0.01",value:Ge.h,onChange:bt=>xe({...Ge,h:parseFloat(bt.target.value)}),className:"w-full h-1.5 bg-bambu-dark-tertiary rounded-lg cursor-pointer accent-green-500"}),i.jsxs("span",{className:"text-xs text-bambu-gray",children:[Math.round(Ge.h*100),"%"]})]})]}),i.jsx("p",{className:"text-xs text-bambu-gray",children:x("printers.roi.instruction")})]}):i.jsxs("p",{className:"text-xs text-bambu-gray",children:["Current: X=",Math.round((Be.roi?.x||.15)*100),"%, Y=",Math.round((Be.roi?.y||.35)*100),"%, W=",Math.round((Be.roi?.w||.7)*100),"%, H=",Math.round((Be.roi?.h||.55)*100),"%"]})]})]}),i.jsx("div",{className:"flex justify-end gap-2 p-4 border-t border-bambu-dark-tertiary",children:Be.needs_calibration?i.jsxs(i.Fragment,{children:[i.jsx(Fe,{variant:"ghost",onClick:()=>za(),children:x("common.cancel")}),i.jsx(Fe,{onClick:()=>Nf(),disabled:ke,children:ke?i.jsxs(i.Fragment,{children:[i.jsx(ct,{className:"w-4 h-4 mr-2 animate-spin"}),"Calibrating..."]}):"Calibrate Empty Plate"})]}):i.jsxs(i.Fragment,{children:[i.jsx(Fe,{variant:"ghost",onClick:()=>Nf(),disabled:ke,children:ke?"Adding...":`Add Reference (${tr?.references.length||0}/${tr?.max_references||5})`}),i.jsx(Fe,{onClick:()=>za(),children:"Close"})]})})]})}),re&&Xe&&i.jsx(Nn,{title:x("printers.confirm.powerOnTitle"),message:x("printers.confirm.powerOnMessage",{name:t.name}),confirmText:x("printers.confirm.powerOnButton"),variant:"default",onConfirm:()=>{jt.mutate("on"),J(!1)},onCancel:()=>J(!1)}),ue&&Xe&&i.jsx(Nn,{title:x("printers.confirm.powerOffTitle"),message:ye?.state==="RUNNING"?x("printers.confirm.powerOffWarning",{name:t.name}):x("printers.confirm.powerOffMessage",{name:t.name}),confirmText:x("printers.confirm.powerOffButton"),variant:"danger",onConfirm:()=>{jt.mutate("off"),me(!1)},onCancel:()=>me(!1)}),ie&&i.jsx(Nn,{title:x("printers.confirm.stopTitle"),message:x("printers.confirm.stopMessage",{name:t.name}),confirmText:x("printers.confirm.stopButton"),variant:"danger",onConfirm:()=>{rn.mutate(),le(!1)},onCancel:()=>le(!1)}),pe&&i.jsx(Nn,{title:x("printers.confirm.pauseTitle"),message:x("printers.confirm.pauseMessage",{name:t.name}),confirmText:x("printers.confirm.pauseButton"),variant:"default",onConfirm:()=>{vn.mutate(),Ce(!1)},onCancel:()=>Ce(!1)}),q&&i.jsx(Nn,{title:x("printers.confirm.resumeTitle"),message:x("printers.confirm.resumeMessage",{name:t.name}),confirmText:x("printers.confirm.resumeButton"),variant:"default",onConfirm:()=>{Dn.mutate(),Z(!1)},onCancel:()=>Z(!1)}),i.jsx(ML,{printerId:t.id,isOpen:j,onClose:()=>E(!1)}),ge&&i.jsx(AAe,{printerName:t.name,errors:ye?.hms_errors||[],onClose:()=>X(!1),printerId:t.id,hasPermission:k}),oe&&i.jsx(z$e,{isOpen:!!oe,onClose:()=>O(null),printerId:t.id,printerName:t.name,amsId:oe.amsId,amsLabel:oe.amsLabel,initialMode:oe.mode,thresholds:s}),F&&i.jsx(U$e,{isOpen:!!F,onClose:()=>Q(null),tagUid:F.tagUid,trayUuid:F.trayUuid,printerId:F.printerId,amsId:F.amsId,trayId:F.trayId}),ve&&i.jsx(B$e,{isOpen:!!ve,onClose:()=>he(null),printerId:ve.printerId,amsId:ve.amsId,trayId:ve.trayId,trayInfo:ve.trayInfo}),de&&i.jsx(Qne,{isOpen:!!de,onClose:()=>Ae(null),printerId:t.id,slotInfo:de,printerModel:pv(t.model)||void 0,onSuccess:()=>{b.invalidateQueries({queryKey:["slotPresets",t.id]}),b.invalidateQueries({queryKey:["printerStatus",t.id]})}}),D&&i.jsx(Sqe,{printer:t,onClose:()=>$(!1)}),_e&&$e&&i.jsx(wqe,{printer:t,firmwareInfo:$e,onClose:()=>ze(!1)}),_s&&i.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>$s(null)})]})}function vqe({onClose:t,onAdd:e,existingSerials:n}){const{t:r}=Mt(),[a,s]=w.useState({name:"",serial_number:"",ip_address:"",access_code:"",model:"",location:"",auto_archive:!0}),[o,l]=w.useState(!1),[c,d]=w.useState([]),[u,m]=w.useState(""),[p,f]=w.useState(!1),[y,x]=w.useState(!1),[b,v]=w.useState([]),[_,k]=w.useState(""),[P,C]=w.useState({scanned:0,total:0});w.useEffect(()=>{bc.getInfo().then(A=>{x(A.is_docker),A.subnets.length>0&&(v(A.subnets),k(A.subnets[0]))}).catch(()=>{})},[]);const T=c.filter(A=>!n.includes(A.serial)),N=async()=>{m(""),d([]),l(!0),f(!1),C({scanned:0,total:0});try{if(y){await bc.startSubnetScan(_);const A=setInterval(async()=>{try{const D=await bc.getScanStatus();C({scanned:D.scanned,total:D.total});const $=await bc.getDiscoveredPrinters();d($),D.running||(clearInterval(A),l(!1),f(!0))}catch(D){console.error("Failed to get scan status:",D)}},500)}else{await bc.startDiscovery(10);const A=setInterval(async()=>{try{const D=await bc.getDiscoveredPrinters();d(D)}catch(D){console.error("Failed to get discovered printers:",D)}},1e3);setTimeout(async()=>{clearInterval(A);try{await bc.stopDiscovery()}catch{}l(!1),f(!0);try{const D=await bc.getDiscoveredPrinters();d(D)}catch(D){console.error("Failed to get final discovered printers:",D)}},1e4)}}catch(A){console.error("Failed to start discovery:",A),m(A instanceof Error?A.message:r("printers.discovery.failedToStart")),l(!1),f(!0)}},R=A=>{const D=A.serial.startsWith("unknown-")?"":A.serial;s({...a,name:A.name||"",serial_number:D,ip_address:A.ip_address,model:pv(A.model)}),d([])};return w.useEffect(()=>()=>{bc.stopDiscovery().catch(()=>{}),bc.stopSubnetScan().catch(()=>{})},[]),w.useEffect(()=>{const A=D=>{D.key==="Escape"&&t()};return window.addEventListener("keydown",A),()=>window.removeEventListener("keydown",A)},[t]),i.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",onClick:t,children:i.jsx(Tt,{className:"w-full max-w-md",onClick:A=>A.stopPropagation(),children:i.jsxs(Pt,{children:[i.jsx("h2",{className:"text-xl font-semibold mb-4",children:r("printers.addPrinter")}),i.jsxs("div",{className:"mb-4 pb-4 border-b border-bambu-dark-tertiary",children:[y&&i.jsxs("div",{className:"mb-3",children:[i.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:r("printers.discovery.subnetToScan")}),b.length>0?i.jsx("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 text-sm",value:_,onChange:A=>k(A.target.value),disabled:o,children:b.map(A=>i.jsx("option",{value:A,children:A},A))}):i.jsx("input",{type:"text",className:"w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none text-sm",value:_,onChange:A=>k(A.target.value),placeholder:"192.168.1.0/24",disabled:o}),i.jsx("p",{className:"mt-1 text-xs text-bambu-gray",children:r("printers.discovery.dockerNote")})]}),i.jsx(Fe,{type:"button",variant:"secondary",onClick:N,disabled:o,className:"w-full",children:o?i.jsxs(i.Fragment,{children:[i.jsx(ct,{className:"w-4 h-4 animate-spin"}),y&&P.total>0?r("printers.discovery.scanProgress",{scanned:P.scanned,total:P.total}):r("printers.discovery.scanning")]}):i.jsxs(i.Fragment,{children:[i.jsx(Dr,{className:"w-4 h-4"}),r(y?"printers.discovery.scanSubnet":"printers.discovery.discoverNetwork")]})}),u&&i.jsx("div",{className:"mt-2 text-sm text-red-400",children:u}),T.length>0&&i.jsx("div",{className:"mt-3 space-y-2 max-h-40 overflow-y-auto",children:T.map(A=>i.jsxs("div",{className:"flex items-center justify-between p-2 bg-bambu-dark rounded-lg hover:bg-bambu-dark-secondary cursor-pointer transition-colors",onClick:()=>R(A),children:[i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsx("p",{className:"font-medium text-white text-sm truncate",children:A.name||A.serial}),i.jsxs("p",{className:"text-xs text-bambu-gray truncate",children:[pv(A.model)||r("printers.discovery.unknown")," • ",A.ip_address,A.serial.startsWith("unknown-")&&i.jsxs("span",{className:"text-yellow-500",children:[" • ",r("printers.discovery.serialRequired")]})]})]}),i.jsx(In,{className:"w-4 h-4 text-bambu-gray -rotate-90 flex-shrink-0 ml-2"})]},A.serial))}),o&&i.jsx("p",{className:"mt-2 text-sm text-bambu-gray text-center",children:r(y?"printers.discovery.scanningSubnet":"printers.discovery.scanningNetwork")}),p&&!o&&c.length===0&&i.jsx("p",{className:"mt-2 text-sm text-bambu-gray text-center",children:r(y?"printers.discovery.noPrintersFoundSubnet":"printers.discovery.noPrintersFoundNetwork")}),p&&!o&&c.length>0&&T.length===0&&i.jsx("p",{className:"mt-2 text-sm text-bambu-gray text-center",children:r("printers.discovery.allConfigured")})]}),i.jsxs("form",{onSubmit:A=>{A.preventDefault(),e(a)},className:"space-y-4",children:[i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:r("printers.name")}),i.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:a.name,onChange:A=>s({...a,name:A.target.value}),placeholder:r("printers.modal.myPrinter")})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:r("printers.ipAddress")}),i.jsx("input",{type:"text",required:!0,pattern:"(\\d{1,3}(\\.\\d{1,3}){3}|[a-zA-Z0-9]([a-zA-Z0-9\\-]{0,61}[a-zA-Z0-9])?(\\.[a-zA-Z0-9]([a-zA-Z0-9\\-]{0,61}[a-zA-Z0-9])?)*)",className:"w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none",value:a.ip_address,onChange:A=>s({...a,ip_address:A.target.value}),placeholder:"192.168.1.100 or printer.local"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:r("printers.serialNumber")}),i.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:a.serial_number,onChange:A=>s({...a,serial_number:A.target.value}),placeholder:"01P00A000000000"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:r("printers.accessCode")}),i.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:a.access_code,onChange:A=>s({...a,access_code:A.target.value}),placeholder:r("printers.modal.fromPrinterSettings")})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:r("printers.modal.modelOptional")}),i.jsxs("select",{className:"w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none",value:a.model||"",onChange:A=>s({...a,model:A.target.value}),children:[i.jsx("option",{value:"",children:r("printers.modal.selectModel")}),i.jsxs("optgroup",{label:"H2 Series",children:[i.jsx("option",{value:"H2C",children:"H2C"}),i.jsx("option",{value:"H2D",children:"H2D"}),i.jsx("option",{value:"H2D Pro",children:"H2D Pro"}),i.jsx("option",{value:"H2S",children:"H2S"})]}),i.jsxs("optgroup",{label:"X1 Series",children:[i.jsx("option",{value:"X1E",children:"X1E"}),i.jsx("option",{value:"X1C",children:"X1 Carbon"}),i.jsx("option",{value:"X1",children:"X1"})]}),i.jsxs("optgroup",{label:"P Series",children:[i.jsx("option",{value:"P2S",children:"P2S"}),i.jsx("option",{value:"P1S",children:"P1S"}),i.jsx("option",{value:"P1P",children:"P1P"})]}),i.jsxs("optgroup",{label:"A1 Series",children:[i.jsx("option",{value:"A1",children:"A1"}),i.jsx("option",{value:"A1 Mini",children:"A1 Mini"})]})]})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:r("printers.modal.locationGroup")}),i.jsx("input",{type:"text",className:"w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none",value:a.location||"",onChange:A=>s({...a,location:A.target.value}),placeholder:r("printers.modal.locationPlaceholder")}),i.jsx("p",{className:"text-xs text-bambu-gray mt-1",children:r("printers.locationHelp")})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("input",{type:"checkbox",id:"auto_archive",checked:a.auto_archive,onChange:A=>s({...a,auto_archive:A.target.checked}),className:"rounded border-bambu-dark-tertiary bg-bambu-dark text-bambu-green focus:ring-bambu-green"}),i.jsx("label",{htmlFor:"auto_archive",className:"text-sm text-bambu-gray",children:r("printers.modal.autoArchiveLabel")})]}),i.jsxs("div",{className:"flex gap-3 pt-4",children:[i.jsx(Fe,{type:"button",variant:"secondary",onClick:t,className:"flex-1",children:r("common.cancel")}),i.jsx(Fe,{type:"submit",className:"flex-1",children:r("printers.addPrinter")})]})]})]})})})}function wqe({printer:t,firmwareInfo:e,onClose:n}){const{t:r}=Mt(),a=tn(),{showToast:s}=bn(),{hasPermission:o}=Rr(),l=o("firmware:update"),[c,d]=w.useState(null),[u,m]=w.useState(!1),[p,f]=w.useState(null),{data:y,isLoading:x}=Je({queryKey:["firmwarePrepare",t.id],queryFn:()=>d1.prepareUpload(t.id),staleTime:3e4,enabled:e.update_available&&l}),b=ut({mutationFn:()=>d1.startUpload(t.id),onSuccess:()=>{m(!0);const _=setInterval(async()=>{try{const k=await d1.getUploadStatus(t.id);d(k),(k.status==="complete"||k.status==="error")&&(clearInterval(_),f(null),m(!1),k.status==="complete"&&(s(r("printers.firmwareModal.uploadedToast"),"success"),a.invalidateQueries({queryKey:["firmwareUpdate",t.id]})))}catch{}},2e3);f(_)},onError:_=>{s(r("printers.firmwareModal.uploadFailed",{error:_.message}),"error"),m(!1)}});w.useEffect(()=>()=>{p&&clearInterval(p)},[p]);const v=()=>{d(null),b.mutate()};return i.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:i.jsx(Tt,{className:"w-full max-w-md mx-4",children:i.jsxs(Pt,{children:[i.jsxs("div",{className:"flex items-start gap-3 mb-4",children:[i.jsx("div",{className:`p-2 rounded-full ${e.update_available?"bg-orange-500/20":"bg-status-ok/20"}`,children:e.update_available?i.jsx(pi,{className:"w-5 h-5 text-orange-400"}):i.jsx(fr,{className:"w-5 h-5 text-status-ok"})}),i.jsxs("div",{className:"flex-1",children:[i.jsx("h3",{className:"text-lg font-semibold text-white",children:e.update_available?r("printers.firmwareModal.title"):r("printers.firmwareModal.titleUpToDate")}),i.jsx("p",{className:"text-sm text-bambu-gray mt-1",children:t.name})]})]}),i.jsxs("div",{className:"bg-bambu-dark rounded-lg p-3 mb-4",children:[i.jsxs("div",{className:"flex justify-between items-center text-sm",children:[i.jsx("span",{className:"text-bambu-gray",children:r("printers.firmwareModal.currentVersion")}),i.jsx("span",{className:`font-mono ${e.update_available?"text-white":"text-status-ok"}`,children:e.current_version||r("common.unknown")})]}),e.update_available&&i.jsxs("div",{className:"flex justify-between items-center text-sm mt-1",children:[i.jsx("span",{className:"text-bambu-gray",children:r("printers.firmwareModal.latestVersion")}),i.jsx("span",{className:"text-orange-400 font-mono",children:e.latest_version})]}),e.release_notes&&i.jsxs("details",{className:"mt-3 text-sm",open:!e.update_available,children:[i.jsx("summary",{className:`cursor-pointer hover:underline ${e.update_available?"text-orange-400":"text-status-ok"}`,children:r("printers.firmwareModal.releaseNotes")}),i.jsx("div",{className:"mt-2 text-bambu-gray text-xs max-h-40 overflow-y-auto whitespace-pre-wrap",children:e.release_notes})]})]}),e.update_available?x?i.jsxs("div",{className:"flex items-center gap-2 text-bambu-gray text-sm mb-4",children:[i.jsx(ct,{className:"w-4 h-4 animate-spin"}),r("printers.firmwareModal.checkingPrereqs")]}):y&&!u&&!c?i.jsx("div",{className:"mb-4",children:y.can_proceed?i.jsxs("div",{className:"flex items-center gap-2 text-bambu-green text-sm",children:[i.jsx(ra,{className:"w-4 h-4"}),r("printers.firmwareModal.sdCardReady")]}):i.jsx("div",{className:"space-y-1",children:y.errors.map((_,k)=>i.jsxs("div",{className:"flex items-center gap-2 text-red-400 text-sm",children:[i.jsx(Ii,{className:"w-4 h-4 flex-shrink-0"}),_]},k))})}):null:null,(u||c)&&c&&i.jsxs("div",{className:"mb-4",children:[i.jsxs("div",{className:"flex items-center justify-between text-sm mb-1",children:[i.jsx("span",{className:"text-bambu-gray capitalize",children:c.status}),i.jsxs("span",{className:"text-white",children:[c.progress,"%"]})]}),i.jsx("div",{className:"w-full bg-bambu-dark-tertiary rounded-full h-2",children:i.jsx("div",{className:`h-2 rounded-full transition-all ${c.status==="error"?"bg-status-error":c.status==="complete"?"bg-status-ok":"bg-orange-500"} ${c.status==="uploading"?"animate-pulse":""}`,style:{width:`${c.progress}%`}})}),i.jsx("p",{className:"text-xs text-bambu-gray mt-1",children:c.message}),c.error&&i.jsx("p",{className:"text-xs text-red-400 mt-1",children:c.error})]}),c?.status==="complete"&&i.jsxs("div",{className:"bg-bambu-green/10 border border-bambu-green/30 rounded-lg p-3 mb-4",children:[i.jsx("p",{className:"text-sm text-bambu-green font-medium mb-2",children:r("printers.firmwareModal.uploadedSuccess")}),i.jsx("p",{className:"text-xs text-bambu-gray",children:r("printers.firmwareModal.applyInstructions")}),i.jsxs("ol",{className:"text-xs text-bambu-gray mt-1 list-decimal list-inside space-y-1",children:[i.jsx("li",{dangerouslySetInnerHTML:{__html:r("printers.firmwareModal.step1")}}),i.jsx("li",{dangerouslySetInnerHTML:{__html:r("printers.firmwareModal.step2")}}),i.jsx("li",{dangerouslySetInnerHTML:{__html:r("printers.firmwareModal.step3")}}),i.jsx("li",{children:r("printers.firmwareModal.step4")})]})]}),i.jsxs("div",{className:"flex gap-2 justify-end",children:[i.jsx(Fe,{variant:"secondary",onClick:n,children:c?.status==="complete"?r("printers.firmwareModal.done"):r("common.cancel")}),y?.can_proceed&&!u&&c?.status!=="complete"&&l&&i.jsx(Fe,{onClick:v,disabled:b.isPending,children:b.isPending?i.jsxs(i.Fragment,{children:[i.jsx(ct,{className:"w-4 h-4 animate-spin mr-2"}),r("printers.firmwareModal.starting")]}):i.jsxs(i.Fragment,{children:[i.jsx(pi,{className:"w-4 h-4 mr-2"}),r("printers.firmwareModal.uploadFirmware")]})})]})]})})})}function Sqe({printer:t,onClose:e}){const{t:n}=Mt(),r=tn(),{showToast:a}=bn(),[s,o]=w.useState({name:t.name,ip_address:t.ip_address,access_code:"",model:t.model||"",location:t.location||"",auto_archive:t.auto_archive}),l=ut({mutationFn:d=>be.updatePrinter(t.id,d),onSuccess:()=>{r.invalidateQueries({queryKey:["printers"]}),r.invalidateQueries({queryKey:["printerStatus",t.id]}),e()},onError:d=>a(d.message||n("printers.toast.failedToUpdate"),"error")});w.useEffect(()=>{const d=u=>{u.key==="Escape"&&e()};return window.addEventListener("keydown",d),()=>window.removeEventListener("keydown",d)},[e]);const c=d=>{d.preventDefault();const u={name:s.name,ip_address:s.ip_address,model:s.model||void 0,location:s.location||void 0,auto_archive:s.auto_archive};s.access_code&&(u.access_code=s.access_code),l.mutate(u)};return i.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",onClick:e,children:i.jsx(Tt,{className:"w-full max-w-md",onClick:d=>d.stopPropagation(),children:i.jsxs(Pt,{children:[i.jsx("h2",{className:"text-xl font-semibold mb-4",children:n("printers.editPrinter")}),i.jsxs("form",{onSubmit:c,className:"space-y-4",children:[i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:n("printers.name")}),i.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:s.name,onChange:d=>o({...s,name:d.target.value}),placeholder:n("printers.modal.myPrinter")})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:n("printers.ipAddress")}),i.jsx("input",{type:"text",required:!0,pattern:"(\\d{1,3}(\\.\\d{1,3}){3}|[a-zA-Z0-9]([a-zA-Z0-9\\-]{0,61}[a-zA-Z0-9])?(\\.[a-zA-Z0-9]([a-zA-Z0-9\\-]{0,61}[a-zA-Z0-9])?)*)",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:s.ip_address,onChange:d=>o({...s,ip_address:d.target.value}),placeholder:"192.168.1.100 or printer.local"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:n("printers.serialNumber")}),i.jsx("input",{type:"text",disabled:!0,className:"w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-bambu-gray cursor-not-allowed",value:t.serial_number}),i.jsx("p",{className:"text-xs text-bambu-gray mt-1",children:n("printers.serialCannotBeChanged")})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:n("printers.accessCode")}),i.jsx("input",{type:"password",className:"w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none",value:s.access_code,onChange:d=>o({...s,access_code:d.target.value}),placeholder:n("printers.accessCodePlaceholder")})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:n("printers.model")}),i.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:s.model,onChange:d=>o({...s,model:d.target.value}),children:[i.jsx("option",{value:"",children:n("printers.modal.selectModel")}),i.jsxs("optgroup",{label:"H2 Series",children:[i.jsx("option",{value:"H2C",children:"H2C"}),i.jsx("option",{value:"H2D",children:"H2D"}),i.jsx("option",{value:"H2D Pro",children:"H2D Pro"}),i.jsx("option",{value:"H2S",children:"H2S"})]}),i.jsxs("optgroup",{label:"X1 Series",children:[i.jsx("option",{value:"X1E",children:"X1E"}),i.jsx("option",{value:"X1C",children:"X1 Carbon"}),i.jsx("option",{value:"X1",children:"X1"})]}),i.jsxs("optgroup",{label:"P Series",children:[i.jsx("option",{value:"P2S",children:"P2S"}),i.jsx("option",{value:"P1S",children:"P1S"}),i.jsx("option",{value:"P1P",children:"P1P"})]}),i.jsxs("optgroup",{label:"A1 Series",children:[i.jsx("option",{value:"A1",children:"A1"}),i.jsx("option",{value:"A1 Mini",children:"A1 Mini"})]})]})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Location / Group"}),i.jsx("input",{type:"text",className:"w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none",value:s.location,onChange:d=>o({...s,location:d.target.value}),placeholder:n("printers.modal.locationPlaceholder")}),i.jsx("p",{className:"text-xs text-bambu-gray mt-1",children:n("printers.locationHelp")})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("input",{type:"checkbox",id:"edit_auto_archive",checked:s.auto_archive,onChange:d=>o({...s,auto_archive:d.target.checked}),className:"rounded border-bambu-dark-tertiary bg-bambu-dark text-bambu-green focus:ring-bambu-green"}),i.jsx("label",{htmlFor:"edit_auto_archive",className:"text-sm text-bambu-gray",children:n("printers.modal.autoArchiveLabel")})]}),i.jsxs("div",{className:"flex gap-3 pt-4",children:[i.jsx(Fe,{type:"button",variant:"secondary",onClick:e,className:"flex-1",children:n("common.cancel")}),i.jsx(Fe,{type:"submit",className:"flex-1",disabled:l.isPending,children:l.isPending?n("common.saving"):n("printers.modal.saveChanges")})]})]})]})})})}function _qe(t){const{data:e}=Je({queryKey:["printerStatus",t],queryFn:()=>be.getPrinterStatus(t),refetchInterval:3e4});return!e?.connected}function kqe({printer:t,plug:e,onPowerOn:n,isPowering:r}){const a=_qe(t.id),{data:s}=Je({queryKey:["smartPlugStatus",e.id],queryFn:()=>be.getSmartPlugStatus(e.id),refetchInterval:1e4});return a?i.jsxs("div",{className:"flex items-center justify-between px-3 py-2 hover:bg-gray-100 dark:hover:bg-bambu-dark-tertiary",children:[i.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[i.jsx("span",{className:"text-sm text-gray-900 dark:text-white truncate",children:t.name}),s&&i.jsx("span",{className:`text-xs px-1.5 py-0.5 rounded ${s.state==="ON"?"bg-bambu-green/20 text-bambu-green":"bg-red-500/20 text-red-400"}`,children:s.state||"?"})]}),i.jsxs("button",{onClick:()=>n(e.id),disabled:r||s?.state==="ON",className:`px-2 py-1 text-xs rounded transition-colors flex items-center gap-1 ${s?.state==="ON"?"bg-bambu-green/20 text-bambu-green cursor-default":"bg-bambu-green/20 text-bambu-green hover:bg-bambu-green hover:text-white"}`,children:[i.jsx(wu,{className:"w-3 h-3"}),r?"...":"On"]})]}):null}function Nqe(){const{t}=Mt(),[e,n]=w.useState(!1),[r,a]=w.useState(()=>localStorage.getItem("hideDisconnectedPrinters")==="true"),[s,o]=w.useState(!1),[l,c]=w.useState(null),[d,u]=w.useState(()=>localStorage.getItem("printerSortBy")||"name"),[m,p]=w.useState(()=>localStorage.getItem("printerSortAsc")!=="false"),[f,y]=w.useState(()=>{const I=localStorage.getItem("printerCardSize");return I?parseInt(I,10):2}),x=f===1?"compact":"expanded",b=tn(),{showToast:v}=bn(),{hasPermission:_}=Rr(),[k,P]=w.useState(()=>{const I=localStorage.getItem("openEmbeddedCameras");if(I)try{const W=JSON.parse(I);return new Map(W.map(B=>[B.id,B]))}catch{return new Map}return new Map});w.useEffect(()=>{const I=Array.from(k.values());I.length>0?localStorage.setItem("openEmbeddedCameras",JSON.stringify(I)):localStorage.removeItem("openEmbeddedCameras")},[k]);const{data:C,isLoading:T}=Je({queryKey:["printers"],queryFn:be.getPrinters}),{data:N}=Je({queryKey:["settings"],queryFn:be.getSettings});w.useEffect(()=>{N?.camera_view_mode==="window"&&k.size>0&&P(new Map)},[N?.camera_view_mode,k.size]);const{data:R}=Je({queryKey:["smart-plugs"],queryFn:be.getSmartPlugs}),{data:A}=Je({queryKey:["maintenanceOverview"],queryFn:be.getMaintenanceOverview,staleTime:60*1e3}),{data:D}=Je({queryKey:["spoolman-status"],queryFn:be.getSpoolmanStatus,staleTime:60*1e3}),$=D?.enabled&&D?.connected,{data:U}=Je({queryKey:["unlinked-spools"],queryFn:be.getUnlinkedSpools,enabled:!!$,staleTime:30*1e3}),G=U&&U.length>0,{data:L}=Je({queryKey:["linked-spools"],queryFn:be.getLinkedSpools,enabled:!!$,staleTime:30*1e3}),te=L?.linked,{data:re}=Je({queryKey:["spool-assignments"],queryFn:()=>be.getAssignments(),enabled:_("inventory:view_assignments"),staleTime:30*1e3}),J=ut({mutationFn:({printerId:I,amsId:W,trayId:B})=>be.unassignSpool(I,W,B),onSuccess:()=>{b.invalidateQueries({queryKey:["spool-assignments"]})}}),ue=(I,W,B)=>re?.find(ae=>ae.printer_id===I&&ae.ams_id===Number(W)&&ae.tray_id===Number(B)),me=A?.reduce((I,W)=>(I[W.printer_id]={due_count:W.due_count,warning_count:W.warning_count,total_print_hours:W.total_print_hours},I),{})||{},ge=R?.reduce((I,W)=>(W.printer_id&&(I[W.printer_id]=W),I),{})||{},X=ut({mutationFn:be.createPrinter,onSuccess:()=>{b.invalidateQueries({queryKey:["printers"]}),b.invalidateQueries({queryKey:["maintenanceOverview"]}),n(!1)},onError:I=>v(I.message||t("printers.toast.failedToAdd"),"error")}),ie=ut({mutationFn:I=>be.controlSmartPlug(I,"on"),onSuccess:()=>{b.invalidateQueries({queryKey:["smart-plugs"]}),c(null)},onError:()=>{c(null)}}),le=()=>{const I=!r;a(I),localStorage.setItem("hideDisconnectedPrinters",String(I))},pe=I=>{u(I),localStorage.setItem("printerSortBy",I)},Ce=()=>{const I=!m;p(I),localStorage.setItem("printerSortAsc",String(I))},q=()=>{switch(f){case 1:return"grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5";case 2:return"grid-cols-1 md:grid-cols-2 xl:grid-cols-3";case 3:return"grid-cols-1 lg:grid-cols-2";case 4:return"grid-cols-1";default:return"grid-cols-1 md:grid-cols-2 xl:grid-cols-3"}},Z=["S","M","L","XL"],j=w.useMemo(()=>{if(!C)return[];const I=[...C];switch(d){case"name":I.sort((W,B)=>W.name.localeCompare(B.name));break;case"model":I.sort((W,B)=>(W.model||"").localeCompare(B.model||""));break;case"location":I.sort((W,B)=>{const ae=W.location||"",z=B.location||"";return!ae&&z?1:ae&&!z?-1:ae.localeCompare(z)||W.name.localeCompare(B.name)});break;case"status":I.sort((W,B)=>{const ae=b.getQueryData(["printerStatus",W.id]),z=b.getQueryData(["printerStatus",B.id]),V=ee=>ee?.connected?ee.state==="RUNNING"?0:1:2;return V(ae)-V(z)});break}return m||I.reverse(),I},[C,d,m,b]),E=w.useMemo(()=>{if(d!=="location")return null;const I={};return j.forEach(W=>{const B=W.location||"Ungrouped";I[B]||(I[B]=[]),I[B].push(W)}),I},[d,j]);return i.jsxs("div",{className:"p-4 md:p-8",children:[i.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4 mb-6",children:[i.jsxs("div",{children:[i.jsx("h1",{className:"text-2xl font-bold text-white",children:t("printers.title")}),i.jsx(yqe,{printers:C})]}),i.jsxs("div",{className:"flex items-center gap-2 sm:gap-3 flex-wrap",children:[i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsxs("select",{value:d,onChange:I=>pe(I.target.value),className:"text-sm bg-bambu-dark border border-bambu-dark-tertiary rounded-lg px-2 py-1.5 text-white focus:border-bambu-green focus:outline-none",children:[i.jsx("option",{value:"name",children:t("printers.sort.name")}),i.jsx("option",{value:"status",children:t("printers.sort.status")}),i.jsx("option",{value:"model",children:t("printers.sort.model")}),i.jsx("option",{value:"location",children:t("printers.sort.location")})]}),i.jsx("button",{onClick:Ce,className:"p-1.5 rounded-lg hover:bg-bambu-dark-tertiary transition-colors",title:t(m?"printers.sort.descending":"printers.sort.ascending"),children:m?i.jsx(Hp,{className:"w-4 h-4 text-bambu-gray"}):i.jsx(Pb,{className:"w-4 h-4 text-bambu-gray"})})]}),i.jsx("div",{className:"flex items-center bg-bambu-dark rounded-lg border border-bambu-dark-tertiary",children:Z.map((I,W)=>{const B=W+1,ae=f===B;return i.jsx("button",{onClick:()=>{y(B),localStorage.setItem("printerCardSize",String(B))},className:`px-2 py-1.5 text-xs font-medium transition-colors ${W===0?"rounded-l-lg":""} ${W===Z.length-1?"rounded-r-lg":""} ${ae?"bg-bambu-green text-white":"text-bambu-gray hover:bg-bambu-dark-tertiary hover:text-white"}`,title:t(I==="S"?"printers.cardSize.small":I==="M"?"printers.cardSize.medium":I==="L"?"printers.cardSize.large":"printers.cardSize.extraLarge"),children:I},I)})}),i.jsx("div",{className:"w-px h-6 bg-bambu-dark-tertiary"}),i.jsxs("label",{className:"flex items-center gap-2 text-sm text-bambu-gray cursor-pointer",children:[i.jsx("input",{type:"checkbox",checked:r,onChange:le,className:"rounded border-bambu-dark-tertiary bg-bambu-dark text-bambu-green focus:ring-bambu-green"}),t("printers.hideOffline")]}),r&&Object.keys(ge).length>0&&i.jsxs("div",{className:"relative",children:[i.jsxs("button",{onClick:()=>o(!s),className:"flex items-center gap-1.5 px-3 py-1.5 text-sm bg-white dark:bg-bambu-dark-secondary border border-gray-200 dark:border-bambu-dark-tertiary rounded-lg text-gray-600 dark:text-bambu-gray hover:text-gray-900 dark:hover:text-white hover:border-bambu-green transition-colors",children:[i.jsx(wu,{className:"w-4 h-4"}),t("printers.powerOn"),i.jsx(In,{className:`w-3 h-3 transition-transform ${s?"rotate-180":""}`})]}),s&&i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"fixed inset-0 z-10",onClick:()=>o(!1)}),i.jsxs("div",{className:"absolute right-0 mt-2 w-56 bg-white dark:bg-bambu-dark-secondary border border-gray-200 dark:border-bambu-dark-tertiary rounded-lg shadow-lg z-20 py-1",children:[i.jsx("div",{className:"px-3 py-2 text-xs text-gray-500 dark:text-bambu-gray border-b border-gray-200 dark:border-bambu-dark-tertiary",children:t("printers.offlinePrintersWithPlugs")}),C?.filter(I=>ge[I.id]).map(I=>i.jsx(kqe,{printer:I,plug:ge[I.id],onPowerOn:W=>{c(W),ie.mutate(W)},isPowering:l===ge[I.id]?.id},I.id)),C?.filter(I=>ge[I.id]).length===0&&i.jsx("div",{className:"px-3 py-2 text-sm text-bambu-gray",children:"No printers with smart plugs"})]})]})]}),i.jsxs(Fe,{onClick:()=>n(!0),disabled:!_("printers:create"),title:_("printers:create")?void 0:t("printers.permission.noAdd"),children:[i.jsx(sr,{className:"w-4 h-4"}),t("printers.addPrinter")]})]})]}),T?i.jsx("div",{className:"text-center py-12 text-bambu-gray",children:t("common.loading")}):C?.length===0?i.jsx(Tt,{children:i.jsxs(Pt,{className:"text-center py-12",children:[i.jsx("p",{className:"text-bambu-gray mb-4",children:t("printers.noPrintersConfigured")}),i.jsxs(Fe,{onClick:()=>n(!0),disabled:!_("printers:create"),title:_("printers:create")?void 0:t("printers.permission.noAdd"),children:[i.jsx(sr,{className:"w-4 h-4"}),t("printers.addPrinter")]})]})}):E?i.jsx("div",{className:"space-y-6",children:Object.entries(E).map(([I,W])=>i.jsxs("div",{children:[i.jsxs("h2",{className:"text-lg font-semibold text-white mb-3 flex items-center gap-2",children:[i.jsx("span",{className:"w-2 h-2 rounded-full bg-bambu-green"}),I,i.jsxs("span",{className:"text-sm font-normal text-bambu-gray",children:["(",W.length,")"]})]}),i.jsx("div",{className:`grid gap-4 ${f>=3?"gap-6":""} ${q()}`,children:W.map(B=>i.jsx(RG,{printer:B,hideIfDisconnected:r,maintenanceInfo:me[B.id],viewMode:x,cardSize:f,amsThresholds:N?{humidityGood:Number(N.ams_humidity_good)||40,humidityFair:Number(N.ams_humidity_fair)||60,tempGood:Number(N.ams_temp_good)||28,tempFair:Number(N.ams_temp_fair)||35}:void 0,spoolmanEnabled:$,hasUnlinkedSpools:G,linkedSpools:te,spoolmanUrl:D?.url,onGetAssignment:ue,onUnassignSpool:(ae,z,V)=>J.mutate({printerId:ae,amsId:z,trayId:V}),timeFormat:N?.time_format||"system",cameraViewMode:N?.camera_view_mode||"window",onOpenEmbeddedCamera:(ae,z)=>P(V=>new Map(V).set(ae,{id:ae,name:z})),checkPrinterFirmware:N?.check_printer_firmware!==!1},B.id))})]},I))}):i.jsx("div",{className:`grid gap-4 ${f>=3?"gap-6":""} ${q()}`,children:j.map(I=>i.jsx(RG,{printer:I,hideIfDisconnected:r,maintenanceInfo:me[I.id],viewMode:x,cardSize:f,spoolmanEnabled:$,hasUnlinkedSpools:G,linkedSpools:te,spoolmanUrl:D?.url,onGetAssignment:ue,onUnassignSpool:(W,B,ae)=>J.mutate({printerId:W,amsId:B,trayId:ae}),amsThresholds:N?{humidityGood:Number(N.ams_humidity_good)||40,humidityFair:Number(N.ams_humidity_fair)||60,tempGood:Number(N.ams_temp_good)||28,tempFair:Number(N.ams_temp_fair)||35}:void 0,timeFormat:N?.time_format||"system",cameraViewMode:N?.camera_view_mode||"window",onOpenEmbeddedCamera:(W,B)=>P(ae=>new Map(ae).set(W,{id:W,name:B})),checkPrinterFirmware:N?.check_printer_firmware!==!1},I.id))}),e&&i.jsx(vqe,{onClose:()=>n(!1),onAdd:I=>X.mutate(I),existingSerials:C?.map(I=>I.serial_number)||[]}),Array.from(k.values()).map((I,W)=>i.jsx(kAe,{printerId:I.id,printerName:I.name,viewerIndex:W,onClose:()=>P(B=>{const ae=new Map(B);return ae.delete(I.id),ae})},I.id))]})}function Cqe(){const t=navigator.userAgent.toLowerCase(),e=navigator.platform?.toLowerCase()||"";return t.includes("win")||e.includes("win")?"windows":t.includes("mac")||e.includes("mac")?"macos":t.includes("linux")||e.includes("linux")?"linux":"unknown"}function wp(t,e="bambu_studio"){let n;e==="orcaslicer"?n=`orcaslicer://open?file=${t}`:Cqe()==="macos"?n=`bambustudioopen://${encodeURIComponent(t)}`:n=`bambustudio://open?file=${t}`;const r=document.createElement("a");r.href=n,r.style.display="none",document.body.appendChild(r),r.click(),document.body.removeChild(r)}const FG=768;function are(){const[t,e]=w.useState(()=>typeof window<"u"?window.innerWidth<FG:!1);return w.useEffect(()=>{const n=window.matchMedia(`(max-width: ${FG-1}px)`),r=a=>{e(a.matches)};return e(n.matches),n.addEventListener("change",r),()=>n.removeEventListener("change",r)},[]),t}function L4({archiveId:t,libraryFileId:e,title:n,fileType:r,onClose:a}){const{t:s}=Mt(),{data:o}=Je({queryKey:["settings"],queryFn:be.getSettings}),l=o?.preferred_slicer||"bambu_studio",c=e!=null,[d,u]=w.useState(null),[m,p]=w.useState(null),[f,y]=w.useState(!0),[x,b]=w.useState(null),[v,_]=w.useState(!1),[k,P]=w.useState(null),[C,T]=w.useState(0),[N,R]=w.useState(!1),[A,D]=w.useState(null),[$,U]=w.useState(!1),[G,L]=w.useState(!1),te=w.useRef(null),re=w.useRef(null),J=10,ue=160,me=240,ge=.35;w.useEffect(()=>{const fe=oe=>{oe.key==="Escape"&&a()};return window.addEventListener("keydown",fe),()=>window.removeEventListener("keydown",fe)},[a]),w.useEffect(()=>{if(y(!0),c){const fe=(r||"").toLowerCase(),oe=fe==="3mf"||fe==="stl",O=fe==="gcode"||fe==="3mf";p({has_model:oe,has_gcode:O,has_source:!1,build_volume:{x:256,y:256,z:256},filament_colors:[]}),u(oe?"3d":O?"gcode":null),y(!1);return}if(!t){p(null),u(null),y(!1);return}be.getArchiveCapabilities(t).then(fe=>{p(fe),fe.has_model?u("3d"):fe.has_gcode&&u("gcode"),y(!1)}).catch(()=>{p({has_model:!0,has_gcode:!1,has_source:!1,build_volume:{x:256,y:256,z:256},filament_colors:[]}),u("3d"),y(!1)})},[t,r,c]),w.useEffect(()=>{if(_(!0),P(null),T(0),c){const fe=(r||"").toLowerCase();if(!e||fe!=="3mf"){b(null),_(!1);return}be.getLibraryFilePlates(e).then(oe=>b(oe)).catch(()=>b(null)).finally(()=>_(!1));return}if(!t){b(null),_(!1);return}be.getArchivePlates(t).then(fe=>b(fe)).catch(()=>b(null)).finally(()=>_(!1))},[t,r,c,e]);const X=w.useMemo(()=>x?.plates??[],[x]),ie=(x?.is_multi_plate??!1)&&X.length>1,le=N&&ie,pe=k==null?null:X.find(fe=>fe.index===k)??null,Ce=fe=>fe.object_count??fe.objects?.length??0,q=X.reduce((fe,oe)=>fe+Ce(oe),0),Z=pe?Ce(pe):q,j=pe?s("modelViewer.plateNumber",{number:pe.index}):s("modelViewer.allPlates"),E=X.length>0,I=w.useRef(null),W=w.useRef(null),[B,ae]=w.useState(10),[z,V]=w.useState(3),ee=X.length>B,K=Math.max(1,Math.ceil(X.length/B)),ne=ee?X.slice(C*B,(C+1)*B):X;w.useEffect(()=>{if(!le){ae(10),V(3);return}const fe=I.current,oe=W.current;if(!fe||!oe)return;let O=0;const F=()=>{const he=oe.clientWidth,Ae=Math.floor(he/210),_e=Math.max(3,Math.min(5,Ae||3));V(xe=>xe===_e?xe:_e);const ze=window.getComputedStyle(fe),Be=Number.parseFloat(ze.rowGap||"0"),Ne=fe.querySelector("button")?.getBoundingClientRect().height??44,Ee=oe.clientHeight,Me=Math.max(1,Math.floor((Ee+Be)/(Ne+Be)))*_e,Ge=Math.max(1,Me-1);ae(xe=>xe===Ge?xe:Ge)},Q=()=>{O&&cancelAnimationFrame(O),O=requestAnimationFrame(F)};Q();const ve=new ResizeObserver(Q);return ve.observe(oe),ve.observe(fe),()=>{O&&cancelAnimationFrame(O),ve.disconnect()}},[le,X.length]),w.useEffect(()=>{if(!ee){T(0);return}T(fe=>Math.min(fe,K-1))},[X.length,ee,K]),w.useEffect(()=>{if(!ee||k==null)return;const fe=X.findIndex(O=>O.index===k);if(fe<0)return;const oe=Math.floor(fe/B);T(O=>O===oe?O:oe)},[X,B,k,ee]),w.useEffect(()=>{if(!le){D(null),L(!1);return}if(G)return;const fe=te.current,oe=re.current;if(!fe||!oe)return;const O=fe.clientHeight;if(!O)return;const F=Math.max(me,O*ge),Q=Math.max(ue,O-J-F),ve=Math.min(oe.scrollHeight,Q);D(Math.max(ue,ve))},[le,G,X.length,C,J,ue,me,ge]),w.useEffect(()=>{if(!$)return;const fe=O=>{const F=te.current;if(!F)return;const Q=F.getBoundingClientRect(),ve=Q.height;if(!ve)return;const he=Math.max(me,ve*ge),de=Math.max(ue,ve-J-he),Ae=Math.min(de,Math.max(ue,O.clientY-Q.top));D(Ae)},oe=()=>{U(!1),L(!0)};return document.addEventListener("mousemove",fe),document.addEventListener("mouseup",oe),document.body.style.cursor="row-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",fe),document.removeEventListener("mouseup",oe),document.body.style.cursor="",document.body.style.userSelect=""}},[$,J,ue,me,ge]);const se=c?(r||"").toLowerCase()==="3mf":!0,ce=async()=>{if(!se)return;const fe=n||"model";try{if(c){const{token:oe}=await be.createLibrarySlicerToken(e),O=be.getLibrarySlicerDownloadUrl(e,oe,fe);wp(`${window.location.origin}${O}`,l)}else{const{token:oe}=await be.createArchiveSlicerToken(t),O=be.getArchiveSlicerDownloadUrl(t,oe,fe);wp(`${window.location.origin}${O}`,l)}}catch{if(c){const oe=`${window.location.origin}${be.getLibraryFileDownloadUrl(e)}`;wp(oe,l)}else{const oe=`${window.location.origin}${be.getArchiveForSlicer(t,fe)}`;wp(oe,l)}}};return i.jsx("div",{className:`fixed inset-0 bg-black/70 flex items-center justify-center z-50 ${N?"p-0":"p-8"}`,onClick:a,children:i.jsxs("div",{className:`bg-bambu-dark-secondary border border-bambu-dark-tertiary w-full flex flex-col ${N?"h-full max-w-none rounded-none":"h-[80vh] max-w-4xl rounded-xl"}`,onClick:fe=>fe.stopPropagation(),children:[i.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-bambu-dark-tertiary",children:[i.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1 mr-4",children:[i.jsx("h2",{className:"text-lg font-semibold text-white truncate",children:n}),E&&i.jsxs("span",{className:"text-xs text-bambu-gray bg-bambu-dark-tertiary/70 px-2 py-1 rounded whitespace-nowrap",children:[j,": ",s("modelViewer.objectCount",{count:Z})]})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs(Fe,{variant:"secondary",size:"sm",onClick:ce,disabled:!se,children:[i.jsx(ei,{className:"w-4 h-4"}),s("modelViewer.openInSlicer")]}),i.jsx(Fe,{variant:"secondary",size:"sm",onClick:()=>R(fe=>!fe),title:N?"Exit fullscreen":"Enter fullscreen",children:N?i.jsx(WF,{className:"w-4 h-4"}):i.jsx(hC,{className:"w-4 h-4"})}),i.jsx(Fe,{variant:"ghost",size:"sm",onClick:a,children:i.jsx(zt,{className:"w-5 h-5"})})]})]}),m&&i.jsxs("div",{className:"flex border-b border-bambu-dark-tertiary",children:[i.jsxs("button",{onClick:()=>m.has_model&&u("3d"),disabled:!m.has_model,className:`flex items-center gap-2 px-6 py-3 text-sm font-medium transition-colors ${d==="3d"?"text-bambu-green border-b-2 border-bambu-green":m.has_model?"text-bambu-gray hover:text-white":"text-bambu-gray/30 cursor-not-allowed"}`,children:[i.jsx(ra,{className:"w-4 h-4"}),s("modelViewer.tabs.model"),!m.has_model&&i.jsxs("span",{className:"text-xs",children:["(",s("modelViewer.notAvailable"),")"]})]}),i.jsxs("button",{onClick:()=>m.has_gcode&&u("gcode"),disabled:!m.has_gcode,className:`flex items-center gap-2 px-6 py-3 text-sm font-medium transition-colors ${d==="gcode"?"text-bambu-green border-b-2 border-bambu-green":m.has_gcode?"text-bambu-gray hover:text-white":"text-bambu-gray/30 cursor-not-allowed"}`,children:[i.jsx(whe,{className:"w-4 h-4"}),s("modelViewer.tabs.gcode"),!m.has_gcode&&i.jsxs("span",{className:"text-xs",children:["(",s("modelViewer.notSliced"),")"]})]})]}),i.jsx("div",{className:"flex-1 overflow-hidden p-4",children:f?i.jsx("div",{className:"w-full h-full flex items-center justify-center",children:i.jsx(ct,{className:"w-8 h-8 animate-spin text-bambu-green"})}):d==="3d"&&m?i.jsxs("div",{ref:te,className:`w-full h-full flex flex-col ${le?"gap-0 min-h-0":"gap-3"}`,children:[ie&&i.jsxs("div",{ref:re,style:le&&A!=null?{height:A}:void 0,className:`rounded-lg border border-bambu-dark-tertiary bg-bambu-dark p-3 ${le?"flex flex-col shrink-0":""}`,children:[i.jsxs("div",{className:"flex items-center gap-2 text-sm text-bambu-gray mb-2",children:[i.jsx(Vi,{className:"w-4 h-4"}),s("modelViewer.plates"),v&&i.jsx(ct,{className:"w-3 h-3 animate-spin"})]}),i.jsxs("div",{className:le?"flex flex-col min-h-0 flex-1":void 0,children:[i.jsx("div",{ref:W,className:le?"min-h-0 overflow-hidden pr-1 flex-1":void 0,children:i.jsxs("div",{ref:I,className:le?"grid gap-2":"grid grid-cols-2 md:grid-cols-3 gap-2",style:le?{gridTemplateColumns:`repeat(${z}, minmax(0, 1fr))`}:void 0,children:[i.jsxs("button",{type:"button",onClick:()=>P(null),className:`flex items-center rounded-lg border text-left transition-colors ${le?"gap-1.5 p-1.5 w-full":"gap-2 p-2"} ${k==null?"border-bambu-green bg-bambu-green/10":"border-bambu-dark-tertiary bg-bambu-dark-secondary hover:border-bambu-gray"}`,children:[i.jsx("div",{className:`rounded bg-bambu-dark-tertiary flex items-center justify-center ${le?"w-8 h-8":"w-10 h-10"}`,children:i.jsx(Vi,{className:`${le?"w-4 h-4":"w-5 h-5"} text-bambu-gray`})}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsx("p",{className:`${le?"text-xs":"text-sm"} text-white font-medium truncate`,children:s("modelViewer.allPlates")}),i.jsx("p",{className:`${le?"text-[10px]":"text-xs"} text-bambu-gray truncate`,children:s("modelViewer.plateCount",{count:X.length})})]}),k==null&&i.jsx(Vr,{className:`${le?"w-3.5 h-3.5":"w-4 h-4"} text-bambu-green flex-shrink-0`})]}),ne.map(fe=>i.jsxs("button",{type:"button",onClick:()=>P(fe.index),className:`flex items-center rounded-lg border text-left transition-colors ${le?"gap-1.5 p-1.5 w-full":"gap-2 p-2"} ${k===fe.index?"border-bambu-green bg-bambu-green/10":"border-bambu-dark-tertiary bg-bambu-dark-secondary hover:border-bambu-gray"}`,children:[fe.has_thumbnail&&fe.thumbnail_url?i.jsx("img",{src:fe.thumbnail_url,alt:`Plate ${fe.index}`,className:`${le?"w-8 h-8":"w-10 h-10"} rounded object-cover bg-bambu-dark-tertiary`}):i.jsx("div",{className:`rounded bg-bambu-dark-tertiary flex items-center justify-center ${le?"w-8 h-8":"w-10 h-10"}`,children:i.jsx(Vi,{className:`${le?"w-4 h-4":"w-5 h-5"} text-bambu-gray`})}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsx("p",{className:`${le?"text-xs":"text-sm"} text-white font-medium truncate`,children:fe.name||s("modelViewer.plateNumber",{number:fe.index})}),i.jsx("p",{className:`${le?"text-[10px]":"text-xs"} text-bambu-gray truncate`,children:s("modelViewer.objectCount",{count:fe.object_count??fe.objects?.length??0})})]}),k===fe.index&&i.jsx(Vr,{className:`${le?"w-3.5 h-3.5":"w-4 h-4"} text-bambu-green flex-shrink-0`})]},fe.index))]})}),(pe||ee)&&i.jsxs("div",{className:"mt-auto pt-3 flex items-center gap-4 text-xs text-bambu-gray overflow-x-auto",children:[pe&&i.jsxs("div",{className:"flex items-center gap-3 whitespace-nowrap",children:[i.jsx("span",{children:s("modelViewer.plateNumber",{number:pe.index})}),pe.print_time_seconds!=null&&i.jsx("span",{children:s("modelViewer.eta",{minutes:Math.round(pe.print_time_seconds/60)})}),pe.filament_used_grams!=null&&i.jsxs("span",{children:[pe.filament_used_grams.toFixed(1)," g"]}),pe.filaments.length>0&&i.jsx("span",{children:s("modelViewer.filamentCount",{count:pe.filaments.length})})]}),ee&&i.jsxs("div",{className:`flex items-center gap-2 whitespace-nowrap ${pe?"ml-auto":""}`,children:[i.jsx("span",{children:s("modelViewer.pagination.pageOf",{current:C+1,total:K})}),i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx("button",{type:"button",onClick:()=>T(fe=>Math.max(fe-1,0)),disabled:C===0,className:`px-2 py-1 rounded border text-xs ${C===0?"border-bambu-dark-tertiary text-bambu-gray/40 cursor-not-allowed":"border-bambu-dark-tertiary text-bambu-gray hover:text-white hover:border-bambu-gray"}`,children:s("modelViewer.pagination.prev")}),(()=>{let oe=Math.max(0,C-Math.floor(2.5));const O=Math.min(K,oe+5);O-oe<5&&(oe=Math.max(0,O-5));const F=Array.from({length:O-oe},(Q,ve)=>oe+ve);return i.jsxs(i.Fragment,{children:[oe>0&&i.jsx("button",{type:"button",onClick:()=>T(0),className:`px-2 py-1 rounded border text-xs ${C===0?"border-bambu-green text-bambu-green":"border-bambu-dark-tertiary text-bambu-gray hover:text-white hover:border-bambu-gray"}`,children:"1"}),oe>1&&i.jsx("span",{className:"px-1",children:"…"}),F.map(Q=>i.jsx("button",{type:"button",onClick:()=>T(Q),className:`px-2 py-1 rounded border text-xs ${C===Q?"border-bambu-green text-bambu-green":"border-bambu-dark-tertiary text-bambu-gray hover:text-white hover:border-bambu-gray"}`,children:Q+1},Q)),O<K-1&&i.jsx("span",{className:"px-1",children:"…"}),O<K&&i.jsx("button",{type:"button",onClick:()=>T(K-1),className:`px-2 py-1 rounded border text-xs ${C===K-1?"border-bambu-green text-bambu-green":"border-bambu-dark-tertiary text-bambu-gray hover:text-white hover:border-bambu-gray"}`,children:K})]})})(),i.jsx("button",{type:"button",onClick:()=>T(fe=>Math.min(fe+1,K-1)),disabled:C>=K-1,className:`px-2 py-1 rounded border text-xs ${C>=K-1?"border-bambu-dark-tertiary text-bambu-gray/40 cursor-not-allowed":"border-bambu-dark-tertiary text-bambu-gray hover:text-white hover:border-bambu-gray"}`,children:s("modelViewer.pagination.next")})]})]})]})]})]}),le&&i.jsx("div",{role:"separator","aria-orientation":"horizontal",onMouseDown:fe=>{fe.preventDefault(),U(!0),L(!0)},className:`h-2 cursor-row-resize flex items-center justify-center ${$?"bg-bambu-dark-tertiary":"bg-bambu-dark-secondary/60 hover:bg-bambu-dark-tertiary"}`,children:i.jsx("div",{className:"w-12 h-1 rounded-full bg-bambu-gray/50"})}),i.jsx("div",{className:`flex-1 ${le?"min-h-0":""}`,children:i.jsx(QX,{url:c?be.getLibraryFileDownloadUrl(e):m.has_source?be.getSource3mfDownloadUrl(t):be.getArchiveDownload(t),fileType:r,buildVolume:m.build_volume,filamentColors:m.filament_colors,selectedPlateId:k,className:"w-full h-full"})})]}):d==="gcode"&&m?i.jsx(DQ,{gcodeUrl:c?be.getLibraryFileGcodeUrl(e):be.getArchiveGcode(t),filamentColors:m.filament_colors,className:"w-full h-full"}):i.jsx("div",{className:"w-full h-full flex items-center justify-center text-bambu-gray",children:s("modelViewer.noPreview")})})]})})}function Tqe({onClose:t,initialFiles:e}){const{t:n}=Mt(),r=tn(),{showToast:a}=bn(),s=w.useRef(null),[o,l]=w.useState(()=>e?.filter(C=>C.name.endsWith(".3mf")).map(C=>({file:C,status:"pending"}))||[]),[c,d]=w.useState(!1),[u,m]=w.useState(null);w.useEffect(()=>{const C=T=>{T.key==="Escape"&&t()};return window.addEventListener("keydown",C),()=>window.removeEventListener("keydown",C)},[t]);const p=ut({mutationFn:C=>be.uploadArchivesBulk(C),onSuccess:C=>{m(C),r.invalidateQueries({queryKey:["archives"]}),r.invalidateQueries({queryKey:["archiveStats"]}),l(T=>T.map(N=>{const R=C.results.find(D=>D.filename===N.file.name),A=C.errors.find(D=>D.filename===N.file.name);return R?{...N,status:"success",archiveId:R.id}:A?{...N,status:"error",error:A.error}:N})),C.failed===0?a(`${C.uploaded} file${C.uploaded!==1?"s":""} uploaded`):C.uploaded===0?a(`Failed to upload ${C.failed} file${C.failed!==1?"s":""}`,"error"):a(`${C.uploaded} uploaded, ${C.failed} failed`,"warning")},onError:()=>{l(C=>C.map(T=>({...T,status:"error",error:"Upload failed"}))),a("Upload failed","error")}}),f=w.useCallback(C=>{C.preventDefault(),d(!0)},[]),y=w.useCallback(C=>{C.preventDefault(),d(!1)},[]),x=w.useCallback(C=>{C.preventDefault(),d(!1);const T=Array.from(C.dataTransfer.files).filter(N=>N.name.endsWith(".3mf"));T.length>0&&l(N=>[...N,...T.map(R=>({file:R,status:"pending"}))])},[]),b=w.useCallback(C=>{const T=Array.from(C.target.files||[]).filter(N=>N.name.endsWith(".3mf"));T.length>0&&l(N=>[...N,...T.map(R=>({file:R,status:"pending"}))]),s.current&&(s.current.value="")},[]),v=w.useCallback(C=>{l(T=>T.filter((N,R)=>R!==C))},[]),_=()=>{if(o.length===0)return;const C=o.filter(T=>T.status==="pending");C.length!==0&&(l(T=>T.map(N=>N.status==="pending"?{...N,status:"uploading"}:N)),p.mutate(C.map(T=>T.file)))},k=o.filter(C=>C.status==="pending").length,P=p.isPending;return i.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",children:i.jsx(Tt,{className:"w-full max-w-2xl max-h-[90vh] flex flex-col",children:i.jsxs(Pt,{className:"p-0 flex flex-col h-full",children:[i.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-bambu-dark-tertiary",children:[i.jsx("h2",{className:"text-xl font-semibold text-white",children:n("uploadModal.title")}),i.jsx("button",{onClick:t,className:"text-bambu-gray hover:text-white transition-colors",children:i.jsx(zt,{className:"w-5 h-5"})})]}),i.jsx("div",{className:"p-4",children:i.jsxs("div",{className:`border-2 border-dashed rounded-lg p-8 text-center transition-colors ${c?"border-bambu-green bg-bambu-green/10":"border-bambu-dark-tertiary hover:border-bambu-gray"}`,onDragOver:f,onDragLeave:y,onDrop:x,children:[i.jsx(Si,{className:"w-12 h-12 mx-auto mb-4 text-bambu-gray"}),i.jsx("p",{className:"text-white mb-2",children:n("uploadModal.dragDrop")}),i.jsx("p",{className:"text-bambu-gray text-sm mb-4",children:n("uploadModal.or")}),i.jsx(Fe,{variant:"secondary",onClick:()=>s.current?.click(),disabled:P,children:n("uploadModal.browseFiles")}),i.jsx("input",{ref:s,type:"file",accept:".3mf",multiple:!0,className:"hidden",onChange:b})]})}),i.jsx("div",{className:"px-4 pb-4",children:i.jsx("p",{className:"text-xs text-bambu-gray",children:n("uploadModal.extractionInfo")})}),o.length>0&&i.jsx("div",{className:"px-4 pb-4 max-h-60 overflow-y-auto",children:i.jsx("div",{className:"space-y-2",children:o.map((C,T)=>i.jsxs("div",{className:"flex items-center gap-3 p-3 bg-bambu-dark rounded-lg",children:[i.jsx(cC,{className:"w-5 h-5 text-bambu-gray flex-shrink-0"}),i.jsx("span",{className:"flex-1 text-white text-sm truncate",children:C.file.name}),i.jsxs("span",{className:"text-xs text-bambu-gray",children:[(C.file.size/(1024*1024)).toFixed(1)," MB"]}),C.status==="pending"&&i.jsx("button",{onClick:()=>v(T),className:"text-bambu-gray hover:text-red-400 transition-colors",disabled:P,children:i.jsx(zt,{className:"w-4 h-4"})}),C.status==="uploading"&&i.jsx(ct,{className:"w-4 h-4 text-bambu-green animate-spin"}),C.status==="success"&&i.jsx(fr,{className:"w-4 h-4 text-bambu-green"}),C.status==="error"&&i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"text-xs text-red-400",children:C.error}),i.jsx(Ii,{className:"w-4 h-4 text-red-400"})]})]},`${C.file.name}-${T}`))})}),u&&i.jsx("div",{className:"px-4 pb-4",children:i.jsx("div",{className:"p-3 bg-bambu-dark rounded-lg",children:i.jsxs("p",{className:"text-sm text-white",children:[i.jsx("span",{className:"text-bambu-green",children:u.uploaded})," ",n("uploadModal.uploaded"),u.failed>0&&i.jsxs(i.Fragment,{children:[", ",i.jsx("span",{className:"text-red-400",children:u.failed})," ",n("uploadModal.failed")]})]})})}),i.jsxs("div",{className:"flex gap-3 p-4 border-t border-bambu-dark-tertiary",children:[i.jsx(Fe,{variant:"secondary",onClick:t,className:"flex-1",children:n(u?"common.close":"common.cancel")}),!u&&i.jsx(Fe,{onClick:_,disabled:k===0||P,className:"flex-1",children:P?i.jsxs(i.Fragment,{children:[i.jsx(ct,{className:"w-4 h-4 animate-spin"}),n("uploadModal.uploading")]}):i.jsxs(i.Fragment,{children:[i.jsx(Si,{className:"w-4 h-4"}),n("uploadModal.upload")," ",k>0&&`(${k})`]})})]})]})})})}const Pqe=["adhesionFailure","spaghettiDetached","layerShift","cloggedNozzle","filamentRunout","warping","stringing","underExtrusion","powerFailure","userCancelled","other"],Aqe=["completed","failed","aborted","printing"];function sre({archive:t,onClose:e,existingTags:n=[]}){const{t:r}=Mt();w.useEffect(()=>{const E=I=>{I.key==="Escape"&&e()};return window.addEventListener("keydown",E),()=>window.removeEventListener("keydown",E)},[e]);const a=tn(),[s,o]=w.useState(t.print_name||""),[l,c]=w.useState(t.printer_id),[d,u]=w.useState(t.project_id??null),[m,p]=w.useState(t.notes||""),[f,y]=w.useState(t.tags||""),[x,b]=w.useState(t.failure_reason||""),[v,_]=w.useState(t.status),[k,P]=w.useState(t.quantity??1),[C,T]=w.useState(t.photos||[]),[N,R]=w.useState(t.external_url||""),[A,D]=w.useState(!1),[$,U]=w.useState(!1),G=w.useRef(null),L=w.useRef(null),te=w.useRef(null),{data:re}=Je({queryKey:["printers"],queryFn:be.getPrinters}),{data:J}=Je({queryKey:["projects"],queryFn:()=>be.getProjects()}),{data:ue}=Je({queryKey:["tags"],queryFn:be.getTags,enabled:n.length===0}),me=n.length>0?n:ue?.map(E=>E.name)||[],ge=f.split(",").map(E=>E.trim()).filter(Boolean),X=f.includes(",")?f.substring(f.lastIndexOf(",")+1).trim().toLowerCase():f.trim().toLowerCase(),ie=me.filter(E=>!ge.includes(E)&&(X===""||E.toLowerCase().includes(X))),le=E=>{let I;if(X&&!me.includes(X)?I=f.includes(",")?f.substring(0,f.lastIndexOf(",")).split(",").map(W=>W.trim()).filter(Boolean):[]:I=ge,!I.includes(E)){const W=[...I,E].join(", ");y(W)}te.current!==null&&clearTimeout(te.current),G.current?.focus()},pe=E=>{const I=ge.filter(W=>W!==E).join(", ");y(I)},Ce=ut({mutationFn:E=>be.updateArchive(t.id,E),onSuccess:()=>{a.invalidateQueries({queryKey:["archives"]}),a.invalidateQueries({queryKey:["projects"]}),e()}}),q=async E=>{const I=E.target.files?.[0];if(I){D(!0);try{const W=await be.uploadArchivePhoto(t.id,I);T(W.photos),a.invalidateQueries({queryKey:["archives"]})}catch(W){console.error("Failed to upload photo:",W)}finally{D(!1),L.current&&(L.current.value="")}}},Z=async E=>{try{const I=await be.deleteArchivePhoto(t.id,E);T(I.photos||[]),a.invalidateQueries({queryKey:["archives"]})}catch(I){console.error("Failed to delete photo:",I)}},j=E=>{E.preventDefault();const I={print_name:s||void 0,printer_id:l,project_id:d,notes:m||void 0,tags:f||void 0,quantity:k,external_url:N||null};v!==t.status&&(I.status=v),v==="failed"||v==="aborted"?I.failure_reason=x||void 0:(t.status==="failed"||t.status==="aborted")&&(I.failure_reason=null),Ce.mutate(I)};return i.jsx("div",{className:"fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-4",onClick:e,children:i.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:E=>E.stopPropagation(),children:[i.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-bambu-dark-tertiary",children:[i.jsx("h2",{className:"text-lg font-semibold text-white",children:r("editArchive.title")}),i.jsx("button",{onClick:e,className:"text-bambu-gray hover:text-white transition-colors",children:i.jsx(zt,{className:"w-5 h-5"})})]}),i.jsxs("form",{onSubmit:j,className:"p-6 space-y-4 overflow-y-auto flex-1",children:[i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:r("editArchive.name")}),i.jsx("input",{type:"text",value:s,onChange:E=>o(E.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:r("editArchive.namePlaceholder")})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:r("editArchive.printer")}),i.jsxs("select",{value:l??"",onChange:E=>c(E.target.value?Number(E.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:[i.jsx("option",{value:"",children:r("editArchive.noPrinter")}),re?.map(E=>i.jsx("option",{value:E.id,children:E.name},E.id))]})]}),i.jsxs("div",{children:[i.jsxs("label",{className:"block text-sm text-bambu-gray mb-1",children:[i.jsx(fs,{className:"w-4 h-4 inline mr-1"}),r("editArchive.project")]}),i.jsxs("select",{value:d??"",onChange:E=>u(E.target.value?Number(E.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:[i.jsx("option",{value:"",children:r("editArchive.noProject")}),J?.map(E=>i.jsx("option",{value:E.id,children:E.name},E.id))]})]}),i.jsxs("div",{children:[i.jsxs("label",{className:"block text-sm text-bambu-gray mb-1",children:[i.jsx(Ppe,{className:"w-4 h-4 inline mr-1"}),r("editArchive.itemsPrinted")]}),i.jsx("input",{type:"number",min:1,value:k,onChange:E=>P(Math.max(1,parseInt(E.target.value)||1)),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:"1"}),i.jsx("p",{className:"text-xs text-bambu-gray mt-1",children:r("editArchive.itemsPrintedHelp")})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:r("editArchive.notes")}),i.jsx("textarea",{value:m,onChange:E=>p(E.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:r("editArchive.notesPlaceholder")})]}),i.jsxs("div",{children:[i.jsxs("label",{className:"block text-sm text-bambu-gray mb-1",children:[i.jsx(dx,{className:"w-4 h-4 inline mr-1"}),r("editArchive.externalLink")]}),i.jsx("input",{type:"url",value:N,onChange:E=>R(E.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:"https://printables.com/model/..."}),i.jsx("p",{className:"text-xs text-bambu-gray mt-1",children:r("editArchive.externalLinkHelp")})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:r("editArchive.tags")}),ge.length>0&&i.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:ge.map(E=>i.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 bg-bambu-dark-tertiary rounded text-sm text-white",children:[i.jsx(cu,{className:"w-3 h-3"}),E,i.jsx("button",{type:"button",onClick:()=>pe(E),className:"ml-0.5 text-bambu-gray hover:text-white",children:i.jsx(zt,{className:"w-3 h-3"})})]},E))}),i.jsxs("div",{className:"relative",children:[i.jsx("input",{ref:G,type:"text",value:f,onChange:E=>y(E.target.value),onFocus:()=>{te.current!==null&&clearTimeout(te.current),U(!0)},onBlur:()=>{te.current=window.setTimeout(()=>U(!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:ge.length>0?r("editArchive.addMoreTags"):r("editArchive.tagsPlaceholder")}),$&&ie.length>0&&i.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:[i.jsxs("div",{className:"p-2 text-xs text-bambu-gray border-b border-bambu-dark-tertiary",children:[X?r("editArchive.matchingTags",{query:X}):r("editArchive.existingTags")," ",r("editArchive.clickToAdd")]}),i.jsx("div",{className:"p-2 flex flex-wrap gap-1.5",children:ie.map(E=>i.jsx("button",{type:"button",onClick:()=>le(E),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:E},E))})]})]})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:r("editArchive.status")}),i.jsx("select",{value:v,onChange:E=>{_(E.target.value),E.target.value==="completed"&&b("")},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:Aqe.map(E=>i.jsx("option",{value:E,children:r(`editArchive.statuses.${E}`)},E))})]}),(v==="failed"||v==="aborted")&&i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:r("editArchive.failureReason")}),i.jsxs("select",{value:x,onChange:E=>b(E.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:[i.jsx("option",{value:"",children:r("editArchive.selectReason")}),Pqe.map(E=>i.jsx("option",{value:r(`editArchive.failureReasons.${E}`),children:r(`editArchive.failureReasons.${E}`)},E))]})]}),i.jsxs("div",{children:[i.jsxs("label",{className:"block text-sm text-bambu-gray mb-1",children:[i.jsx(Mb,{className:"w-4 h-4 inline mr-1"}),r("editArchive.photos")]}),i.jsxs("div",{className:"flex flex-wrap gap-2 mb-2",children:[C.map(E=>i.jsxs("div",{className:"relative group",children:[i.jsx("img",{src:be.getArchivePhotoUrl(t.id,E),alt:r("editArchive.printResult"),className:"w-20 h-20 object-cover rounded-lg border border-bambu-dark-tertiary"}),i.jsx("button",{type:"button",onClick:()=>Z(E),className:"absolute -top-1 -right-1 p-1 bg-red-500 rounded-full opacity-0 group-hover:opacity-100 transition-opacity",children:i.jsx(Qt,{className:"w-3 h-3 text-white"})})]},E)),i.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:[i.jsx("input",{ref:L,type:"file",accept:"image/jpeg,image/png,image/webp",onChange:q,className:"hidden",disabled:A}),A?i.jsx(ct,{className:"w-6 h-6 text-bambu-gray animate-spin"}):i.jsx(sr,{className:"w-6 h-6 text-bambu-gray"})]})]}),i.jsx("p",{className:"text-xs text-bambu-gray",children:r("editArchive.photosHelp")})]}),i.jsxs("div",{className:"flex gap-3 pt-2",children:[i.jsx(Fe,{type:"button",variant:"secondary",onClick:e,className:"flex-1",children:r("common.cancel")}),i.jsxs(Fe,{type:"submit",disabled:Ce.isPending,className:"flex-1",children:[i.jsx(ps,{className:"w-4 h-4"}),Ce.isPending?r("common.saving"):r("common.save")]})]})]})]})})}function ore({x:t,y:e,items:n,onClose:r}){const a=w.useRef(null),[s,o]=w.useState(null),l=w.useRef(null),[c,d]=w.useState({x:t,y:e,visible:!1}),[u,m]=w.useState(!1),[p,f]=w.useState({});w.useEffect(()=>{const b=k=>{a.current&&!a.current.contains(k.target)&&r()},v=k=>{k.key==="Escape"&&r()},_=()=>{r()};return document.addEventListener("mousedown",b),document.addEventListener("keydown",v),document.addEventListener("scroll",_,!0),()=>{document.removeEventListener("mousedown",b),document.removeEventListener("keydown",v),document.removeEventListener("scroll",_,!0),l.current&&clearTimeout(l.current)}},[r]),w.useLayoutEffect(()=>{if(a.current){a.current.style.visibility="hidden",a.current.style.display="block";const b=a.current.getBoundingClientRect(),v=window.innerWidth,_=window.innerHeight,k=8;let P=t,C=e;t+b.width>v-k&&(P=Math.max(k,v-b.width-k)),P<k&&(P=k),e+b.height>_-k&&(C=Math.max(k,_-b.height-k)),C<k&&(C=k);const T=180,N=v-P-b.width,R=P;m(N<T&&R>T),d({x:P,y:C,visible:!0})}},[t,e]);const y=(b,v)=>{l.current&&(clearTimeout(l.current),l.current=null);const _=v.getBoundingClientRect(),k=window.innerHeight,P=300,N=k-_.top-8<P&&_.top>P;f(R=>({...R,[b]:N?"bottom":"top"})),o(b)},x=()=>{l.current=window.setTimeout(()=>{o(null)},150)};return i.jsx("div",{ref:a,className:"fixed z-50 min-w-[180px] max-w-[280px] bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg shadow-xl py-1",style:{left:c.x,top:c.y,visibility:c.visible?"visible":"hidden"},children:n.map((b,v)=>{if(b.divider)return i.jsx("div",{className:"my-1 border-t border-bambu-dark-tertiary"},v);const _=b.submenu&&b.submenu.length>0;return i.jsxs("div",{className:"relative",onMouseEnter:k=>_&&y(v,k.currentTarget),onMouseLeave:()=>_&&x(),children:[i.jsxs("button",{onMouseEnter:k=>_&&y(v,k.currentTarget.parentElement),onClick:()=>{_?o(s===v?null:v):b.disabled||(b.onClick(),r())},disabled:b.disabled,title:b.title,className:`w-full flex items-center gap-2 px-3 py-2 text-sm text-left transition-colors ${b.disabled?"text-bambu-gray cursor-not-allowed":b.danger?"text-red-400 hover:bg-red-400/10":"text-white hover:bg-bambu-dark-tertiary"} ${_&&s===v?"bg-bambu-dark-tertiary":""}`,children:[b.icon&&i.jsx("span",{className:"w-4 h-4 flex-shrink-0 flex items-center justify-center",children:b.icon}),i.jsx("span",{className:"flex-1",children:b.label}),_&&i.jsx(pa,{className:"w-4 h-4 text-bambu-gray"})]}),_&&s===v&&i.jsx("div",{className:`absolute min-w-[160px] bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg shadow-xl py-1 overflow-hidden max-h-[300px] overflow-y-auto z-[60] ${u?"right-full mr-1":"left-full ml-1"} ${p[v]==="bottom"?"bottom-0":"top-0"}`,onMouseEnter:()=>{l.current&&(clearTimeout(l.current),l.current=null)},onMouseLeave:()=>x(),children:b.submenu.map((k,P)=>i.jsxs("button",{onClick:()=>{k.disabled||(k.onClick(),r())},disabled:k.disabled,className:`w-full flex items-center gap-2 px-3 py-2 text-sm text-left transition-colors ${k.disabled?"text-bambu-gray cursor-not-allowed":k.danger?"text-red-400 hover:bg-red-400/10":"text-white hover:bg-bambu-dark-tertiary"}`,children:[k.icon&&i.jsx("span",{className:"w-4 h-4 flex-shrink-0 flex items-center justify-center",children:k.icon}),k.label]},P))})]},v)})})}function Mqe({selectedIds:t,existingTags:e,onClose:n}){const r=tn(),{showToast:a}=bn(),[s,o]=w.useState(""),[l,c]=w.useState(new Set),[d,u]=w.useState("add");w.useEffect(()=>{const x=b=>{b.key==="Escape"&&n()};return window.addEventListener("keydown",x),()=>window.removeEventListener("keydown",x)},[n]);const m=ut({mutationFn:async()=>{const x=Array.from(l);let b=0;for(const v of t)try{const _=await be.getArchive(v),k=_.tags?_.tags.split(",").map(C=>C.trim()).filter(Boolean):[];let P;d==="add"?P=[...new Set([...k,...x])]:P=k.filter(C=>!l.has(C)),await be.updateArchive(v,{tags:P.join(", ")}),b++}catch(_){throw console.error(`Failed to update archive ${v}:`,_),new Error(`Failed on archive ${v}: ${_ instanceof Error?_.message:"Unknown error"}`)}return{count:b,mode:d,tags:x}},onSuccess:({count:x,mode:b,tags:v})=>{r.invalidateQueries({queryKey:["archives"]}),a(`${b==="add"?"Added":"Removed"} ${v.length} tag${v.length!==1?"s":""} ${b==="add"?"to":"from"} ${x} archive${x!==1?"s":""}`),n()},onError:x=>{a(x.message||"Failed to update tags","error")}}),p=x=>{c(b=>{const v=new Set(b);return v.has(x)?v.delete(x):v.add(x),v})},f=()=>{s.trim()&&!l.has(s.trim())&&(c(x=>new Set([...x,s.trim()])),o(""))},y=x=>{x.key==="Enter"&&(x.preventDefault(),f())};return i.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",children:i.jsx(Tt,{className:"w-full max-w-md",children:i.jsxs(Pt,{className:"p-0",children:[i.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-bambu-dark-tertiary",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(cu,{className:"w-5 h-5 text-bambu-green"}),i.jsx("h2",{className:"text-xl font-semibold text-white",children:d==="add"?"Add Tags":"Remove Tags"})]}),i.jsx("button",{onClick:n,className:"text-bambu-gray hover:text-white transition-colors",children:i.jsx(zt,{className:"w-5 h-5"})})]}),i.jsxs("div",{className:"p-4 space-y-4",children:[i.jsxs("p",{className:"text-sm text-bambu-gray",children:[d==="add"?"Add":"Remove"," tags for ",t.length," selected archive",t.length!==1?"s":""]}),i.jsxs("div",{className:"flex gap-2",children:[i.jsx(Fe,{size:"sm",variant:d==="add"?"primary":"secondary",onClick:()=>u("add"),children:"Add Tags"}),i.jsx(Fe,{size:"sm",variant:d==="remove"?"primary":"secondary",onClick:()=>u("remove"),children:"Remove Tags"})]}),d==="add"&&i.jsxs("div",{className:"flex gap-2",children:[i.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:s,onChange:x=>o(x.target.value),onKeyDown:y}),i.jsx(Fe,{size:"sm",variant:"secondary",onClick:f,disabled:!s.trim(),children:i.jsx(sr,{className:"w-4 h-4"})})]}),e.length>0&&i.jsxs("div",{children:[i.jsx("p",{className:"text-xs text-bambu-gray mb-2",children:"Existing tags:"}),i.jsx("div",{className:"flex flex-wrap gap-2",children:e.map(x=>i.jsx("button",{onClick:()=>p(x),className:`px-2 py-1 rounded text-sm transition-colors ${l.has(x)?"bg-bambu-green text-white":"bg-bambu-dark-tertiary text-bambu-gray-light hover:bg-bambu-dark"}`,children:x},x))})]}),l.size>0&&i.jsxs("div",{children:[i.jsxs("p",{className:"text-xs text-bambu-gray mb-2",children:["Tags to ",d==="add"?"add":"remove",":"]}),i.jsx("div",{className:"flex flex-wrap gap-2",children:Array.from(l).map(x=>i.jsxs("span",{className:`px-2 py-1 rounded text-sm flex items-center gap-1 ${d==="add"?"bg-green-500/20 text-green-400":"bg-red-500/20 text-red-400"}`,children:[x,i.jsx("button",{onClick:()=>p(x),className:"hover:opacity-70",children:i.jsx(zt,{className:"w-3 h-3"})})]},x))})]})]}),i.jsxs("div",{className:"flex gap-3 p-4 border-t border-bambu-dark-tertiary",children:[i.jsx(Fe,{variant:"secondary",onClick:n,className:"flex-1",children:"Cancel"}),i.jsx(Fe,{onClick:()=>m.mutate(),disabled:l.size===0||m.isPending,className:"flex-1",children:m.isPending?i.jsxs(i.Fragment,{children:[i.jsx(ct,{className:"w-4 h-4 animate-spin"}),"Processing..."]}):i.jsxs(i.Fragment,{children:[i.jsx(cu,{className:"w-4 h-4"}),d==="add"?"Add Tags":"Remove Tags"]})})]})]})})})}function Eqe({selectedIds:t,onClose:e}){const n=tn(),{showToast:r}=bn(),{data:a,isLoading:s}=Je({queryKey:["projects"],queryFn:()=>be.getProjects()});w.useEffect(()=>{const u=m=>{m.key==="Escape"&&e()};return window.addEventListener("keydown",u),()=>window.removeEventListener("keydown",u)},[e]);const o=()=>{n.invalidateQueries({queryKey:["archives"]}),n.invalidateQueries({queryKey:["projects"]}),n.invalidateQueries({queryKey:["project"]}),n.invalidateQueries({queryKey:["project-archives"]})},l=ut({mutationFn:async u=>(await be.addArchivesToProject(u,t),u),onSuccess:u=>{const m=a?.find(p=>p.id===u);o(),r(`Added ${t.length} archive${t.length!==1?"s":""} to "${m?.name}"`),e()},onError:()=>{r("Failed to assign project","error")}}),c=ut({mutationFn:async()=>{for(const u of t)await be.updateArchive(u,{project_id:null});return t.length},onSuccess:u=>{o(),r(`Removed ${u} archive${u!==1?"s":""} from project`),e()},onError:()=>{r("Failed to remove from project","error")}}),d=l.isPending||c.isPending;return i.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",children:i.jsx(Tt,{className:"w-full max-w-md max-h-[80vh] flex flex-col",children:i.jsxs(Pt,{className:"p-0 flex flex-col min-h-0",children:[i.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-bambu-dark-tertiary shrink-0",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(fs,{className:"w-5 h-5 text-bambu-green"}),i.jsx("h2",{className:"text-xl font-semibold text-white",children:"Assign to Project"})]}),i.jsx("button",{onClick:e,className:"text-bambu-gray hover:text-white transition-colors",disabled:d,children:i.jsx(zt,{className:"w-5 h-5"})})]}),i.jsxs("div",{className:"p-4 space-y-3 overflow-y-auto min-h-0",children:[i.jsxs("p",{className:"text-sm text-bambu-gray",children:["Assign ",t.length," selected archive",t.length!==1?"s":""," to a project"]}),s?i.jsx("div",{className:"flex items-center justify-center py-8",children:i.jsx(ct,{className:"w-6 h-6 animate-spin text-bambu-gray"})}):i.jsxs("div",{className:"space-y-2",children:[i.jsxs("button",{onClick:()=>c.mutate(),disabled:d,className:"w-full flex items-center gap-3 p-3 rounded-lg bg-bambu-dark hover:bg-bambu-dark-tertiary border border-bambu-dark-tertiary transition-colors text-left disabled:opacity-50",children:[i.jsx("div",{className:"w-8 h-8 rounded-full bg-red-500/20 flex items-center justify-center shrink-0",children:i.jsx(qi,{className:"w-4 h-4 text-red-400"})}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsx("p",{className:"text-white font-medium",children:"Remove from project"}),i.jsx("p",{className:"text-sm text-bambu-gray truncate",children:"Clear project assignment"})]}),c.isPending&&i.jsx(ct,{className:"w-4 h-4 animate-spin text-bambu-gray shrink-0"})]}),a&&a.length>0&&i.jsxs("div",{className:"flex items-center gap-2 py-2",children:[i.jsx("div",{className:"flex-1 h-px bg-bambu-dark-tertiary"}),i.jsx("span",{className:"text-xs text-bambu-gray",children:"or assign to"}),i.jsx("div",{className:"flex-1 h-px bg-bambu-dark-tertiary"})]}),a?.map(u=>i.jsxs("button",{onClick:()=>l.mutate(u.id),disabled:d,className:"w-full flex items-center gap-3 p-3 rounded-lg bg-bambu-dark hover:bg-bambu-dark-tertiary border border-bambu-dark-tertiary transition-colors text-left disabled:opacity-50",children:[i.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center shrink-0",style:{backgroundColor:u.color?`${u.color}20`:"rgb(var(--bambu-green) / 0.2)"},children:i.jsx(fs,{className:"w-4 h-4",style:{color:u.color||"rgb(var(--bambu-green))"}})}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsx("p",{className:"text-white font-medium truncate",children:u.name}),i.jsxs("p",{className:"text-sm text-bambu-gray truncate",children:[u.archive_count," archive",u.archive_count!==1?"s":"",u.status&&` • ${u.status}`]})]}),l.isPending&&l.variables===u.id&&i.jsx(ct,{className:"w-4 h-4 animate-spin text-bambu-gray shrink-0"})]},u.id)),(!a||a.length===0)&&i.jsx("p",{className:"text-center text-bambu-gray py-4",children:"No projects yet. Create one from the Projects page."})]})]}),i.jsx("div",{className:"flex gap-3 p-4 border-t border-bambu-dark-tertiary shrink-0",children:i.jsx(Fe,{variant:"secondary",onClick:e,className:"flex-1",disabled:d,children:"Cancel"})})]})})})}function jqe(t,e){return new Date(t,e+1,0).getDate()}function Dqe(t,e){return new Date(t,e,1).getDay()}const Rqe=["January","February","March","April","May","June","July","August","September","October","November","December"],Fqe=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];function Lqe({archives:t,onArchiveClick:e,highlightedArchiveId:n}){const r=new Date,[a,s]=w.useState(r.getMonth()),[o,l]=w.useState(r.getFullYear()),[c,d]=w.useState(null),[u,m]=w.useState(null),p=w.useMemo(()=>{const C=new Map;return t.forEach(T=>{const N=Jn(T.completed_at||T.created_at)||new Date,R=`${N.getFullYear()}-${String(N.getMonth()+1).padStart(2,"0")}-${String(N.getDate()).padStart(2,"0")}`,A=C.get(R)||[];A.push(T),C.set(R,A)}),C},[t]),f=jqe(o,a),y=Dqe(o,a),x=()=>{a===0?(s(11),l(o-1)):s(a-1)},b=()=>{a===11?(s(0),l(o+1)):s(a+1)},v=()=>{s(r.getMonth()),l(r.getFullYear())},_=[];for(let C=0;C<y;C++)_.push(null);for(let C=1;C<=f;C++)_.push(C);const k=c?p.get(c)||[]:[],P=C=>{C!==c&&m(null),d(C)};return i.jsxs("div",{className:"flex flex-col lg:flex-row gap-6",children:[i.jsxs("div",{className:"flex-1",children:[i.jsxs("div",{className:"flex items-center justify-between mb-4",children:[i.jsx("button",{onClick:x,className:"p-2 hover:bg-bambu-dark-tertiary rounded-lg transition-colors",children:i.jsx(ec,{className:"w-5 h-5 text-bambu-gray"})}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsxs("h2",{className:"text-lg font-semibold text-white",children:[Rqe[a]," ",o]}),i.jsx("button",{onClick:v,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"})]}),i.jsx("button",{onClick:b,className:"p-2 hover:bg-bambu-dark-tertiary rounded-lg transition-colors",children:i.jsx(pa,{className:"w-5 h-5 text-bambu-gray"})})]}),i.jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:Fqe.map(C=>i.jsx("div",{className:"text-center text-xs text-bambu-gray py-2",children:C},C))}),i.jsx("div",{className:"grid grid-cols-7 gap-1",children:_.map((C,T)=>{if(C===null)return i.jsx("div",{className:"aspect-square"},`empty-${T}`);const N=`${o}-${String(a+1).padStart(2,"0")}-${String(C).padStart(2,"0")}`,R=p.get(N)||[],A=R.length>0,D=C===r.getDate()&&a===r.getMonth()&&o===r.getFullYear(),$=N===c,U=R.filter(L=>L.status==="completed").length,G=R.filter(L=>L.status==="failed").length;return i.jsxs("button",{onClick:()=>P($?null:N),className:`aspect-square rounded-lg p-1 flex flex-col items-center justify-center transition-colors relative ${$?"bg-bambu-green text-white":D?"bg-bambu-green/20 text-white ring-2 ring-bambu-green":A?"bg-bambu-dark-tertiary hover:bg-bambu-dark-tertiary/70 text-white":"hover:bg-bambu-dark-tertiary/50 text-bambu-gray"}`,children:[i.jsx("span",{className:`text-sm font-medium ${D&&!$?"text-bambu-green":""}`,children:C}),A&&i.jsxs("div",{className:"absolute bottom-1 left-1/2 -translate-x-1/2 flex items-center gap-1",children:[i.jsx("div",{className:`w-2 h-2 rounded-full ${G>0&&U===0?"bg-red-400":G>0?"bg-yellow-400":"bg-green-400"}`}),i.jsx("span",{className:"text-xs font-medium",children:R.length})]})]},C)})}),i.jsx("div",{className:"mt-4 pt-4 border-t border-bambu-dark-tertiary",children:i.jsxs("div",{className:"grid grid-cols-3 gap-4 text-center",children:[i.jsxs("div",{children:[i.jsx("div",{className:"text-2xl font-bold text-white",children:t.filter(C=>{const T=Jn(C.completed_at||C.created_at)||new Date;return T.getMonth()===a&&T.getFullYear()===o}).length}),i.jsx("div",{className:"text-xs text-bambu-gray",children:"Prints this month"})]}),i.jsxs("div",{children:[i.jsx("div",{className:"text-2xl font-bold text-green-400",children:t.filter(C=>{const T=Jn(C.completed_at||C.created_at)||new Date;return T.getMonth()===a&&T.getFullYear()===o&&C.status==="completed"}).length}),i.jsx("div",{className:"text-xs text-bambu-gray",children:"Successful"})]}),i.jsxs("div",{children:[i.jsx("div",{className:"text-2xl font-bold text-red-400",children:t.filter(C=>{const T=Jn(C.completed_at||C.created_at)||new Date;return T.getMonth()===a&&T.getFullYear()===o&&C.status==="failed"}).length}),i.jsx("div",{className:"text-xs text-bambu-gray",children:"Failed"})]})]})})]}),i.jsx("div",{className:"lg:w-80 bg-bambu-dark rounded-xl p-4",children:c?i.jsxs(i.Fragment,{children:[i.jsx("h3",{className:"text-sm font-medium text-bambu-gray mb-3",children:new Date(c+"T12:00:00").toLocaleDateString("en-US",{weekday:"long",month:"long",day:"numeric",year:"numeric"})}),k.length>0?i.jsx("div",{className:"calendar-scroll space-y-2 max-h-96 overflow-y-auto",children:k.map(C=>{const T=C.id===u||C.id===n;return i.jsxs("button",{onClick:()=>{m(C.id),e?.(C)},className:`w-full flex items-center gap-3 p-2 rounded-lg transition-colors text-left ${T?"":"hover:bg-bambu-dark-tertiary"}`,style:T?{outline:"4px solid #facc15",outlineOffset:"2px"}:void 0,children:[C.thumbnail_path?i.jsx("img",{src:be.getArchiveThumbnail(C.id),alt:"",className:"w-12 h-12 rounded object-cover"}):i.jsx("div",{className:"w-12 h-12 rounded bg-bambu-dark-tertiary flex items-center justify-center",children:i.jsx("span",{className:"text-xs text-bambu-gray",children:"3MF"})}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsx("p",{className:"text-sm text-white truncate",children:C.print_name||C.filename}),i.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[i.jsx("span",{className:C.status==="failed"?"text-red-400":"text-green-400",children:C.status==="failed"?"Failed":"Completed"}),C.filament_color&&i.jsx("div",{className:"flex gap-0.5",children:C.filament_color.split(",").map((N,R)=>i.jsx("div",{className:"w-3 h-3 rounded-full border border-white/20",style:{backgroundColor:N}},R))})]})]})]},C.id)})}):i.jsx("p",{className:"text-sm text-bambu-gray",children:"No prints on this day"})]}):i.jsx("div",{className:"text-center py-8",children:i.jsx("p",{className:"text-sm text-bambu-gray",children:"Select a day to see prints"})})})]})}function lre({archiveId:t,archiveName:e,onClose:n}){const r=be.getArchiveQRCodeUrl(t,300);w.useEffect(()=>{const s=o=>{o.key==="Escape"&&n()};return window.addEventListener("keydown",s),()=>window.removeEventListener("keydown",s)},[n]);const a=()=>{const s=document.createElement("a");s.href=r,s.download=`${e}_qrcode.png`,s.click()};return i.jsx("div",{className:"fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-4",onClick:n,children:i.jsxs("div",{className:"bg-bambu-dark-secondary rounded-xl border border-bambu-dark-tertiary w-full max-w-sm",onClick:s=>s.stopPropagation(),children:[i.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-bambu-dark-tertiary",children:[i.jsx("h2",{className:"text-lg font-semibold text-white",children:"QR Code"}),i.jsx("button",{onClick:n,className:"text-bambu-gray hover:text-white transition-colors",children:i.jsx(zt,{className:"w-5 h-5"})})]}),i.jsxs("div",{className:"p-6 flex flex-col items-center",children:[i.jsx("p",{className:"text-sm text-bambu-gray mb-4 text-center truncate max-w-full",children:e}),i.jsx("div",{className:"bg-white p-4 rounded-lg mb-4",children:i.jsx("img",{src:r,alt:"QR Code",className:"w-64 h-64"})}),i.jsx("p",{className:"text-xs text-bambu-gray mb-4 text-center",children:"Scan to open this archive"}),i.jsxs(Fe,{onClick:a,className:"w-full",children:[i.jsx(pi,{className:"w-4 h-4"}),"Download QR Code"]})]})]})})}function cre({archiveId:t,archiveName:e,photos:n,onClose:r,onDelete:a}){const[s,o]=w.useState(0),[l,c]=w.useState(!1);if(w.useEffect(()=>{const f=y=>{y.key==="Escape"&&r(),y.key==="ArrowLeft"&&o(x=>Math.max(0,x-1)),y.key==="ArrowRight"&&o(x=>Math.min(n.length-1,x+1))};return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[r,n.length]),w.useEffect(()=>{s>=n.length&&o(Math.max(0,n.length-1))},[n.length,s]),n.length===0)return r(),null;const d=n[s],u=be.getArchivePhotoUrl(t,d),m=()=>{const f=document.createElement("a");f.href=u,f.download=`${e}_photo_${s+1}.jpg`,f.click()},p=()=>{a&&c(!0)};return i.jsxs("div",{className:"fixed inset-0 bg-black/90 flex items-center justify-center z-50",onClick:r,children:[i.jsxs("div",{className:"relative w-full h-full flex flex-col",onClick:f=>f.stopPropagation(),children:[i.jsxs("div",{className:"flex items-center justify-between px-6 py-4 bg-black/50",children:[i.jsxs("div",{children:[i.jsx("h2",{className:"text-lg font-semibold text-white",children:e}),i.jsxs("p",{className:"text-sm text-bambu-gray",children:["Photo ",s+1," of ",n.length]})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs(Fe,{variant:"secondary",size:"sm",onClick:m,children:[i.jsx(pi,{className:"w-4 h-4"}),"Download"]}),a&&i.jsx(Fe,{variant:"secondary",size:"sm",onClick:p,className:"text-red-400 hover:text-red-300",children:i.jsx(Qt,{className:"w-4 h-4"})}),i.jsx("button",{onClick:r,className:"p-2 text-bambu-gray hover:text-white transition-colors",children:i.jsx(zt,{className:"w-6 h-6"})})]})]}),i.jsxs("div",{className:"flex-1 min-h-0 flex items-center justify-center p-4 relative overflow-hidden",children:[s>0&&i.jsx("button",{onClick:()=>o(f=>f-1),className:"absolute left-4 z-10 p-3 bg-black/50 hover:bg-black/70 rounded-full transition-colors",children:i.jsx(ec,{className:"w-8 h-8 text-white"})}),i.jsx("img",{src:u,alt:`Photo ${s+1}`,className:"max-w-full max-h-full object-contain rounded-lg",style:{maxHeight:"calc(100vh - 200px)"}}),s<n.length-1&&i.jsx("button",{onClick:()=>o(f=>f+1),className:"absolute right-4 z-10 p-3 bg-black/50 hover:bg-black/70 rounded-full transition-colors",children:i.jsx(pa,{className:"w-8 h-8 text-white"})})]}),n.length>1&&i.jsx("div",{className:"flex justify-center gap-2 p-4 bg-black/50",children:n.map((f,y)=>i.jsx("button",{onClick:()=>o(y),className:`w-16 h-16 rounded-lg overflow-hidden border-2 transition-colors ${y===s?"border-bambu-green":"border-transparent hover:border-bambu-gray"}`,children:i.jsx("img",{src:be.getArchivePhotoUrl(t,f),alt:`Thumbnail ${y+1}`,className:"w-full h-full object-cover"})},f))})]}),l&&i.jsx(Nn,{title:"Delete Photo",message:"Delete this photo? This cannot be undone.",confirmText:"Delete",variant:"danger",onConfirm:()=>{a?.(d),c(!1)},onCancel:()=>c(!1)})]})}function Ka(t){this.content=t}Ka.prototype={constructor:Ka,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 r=n&&n!=t?this.remove(n):this,a=r.find(t),s=r.content.slice();return a==-1?s.push(n||t,e):(s[a+1]=e,n&&(s[a]=n)),new Ka(s)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new Ka(n)},addToStart:function(t,e){return new Ka([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new Ka(n)},addBefore:function(t,e,n){var r=this.remove(e),a=r.content.slice(),s=r.find(t);return a.splice(s==-1?a.length:s,0,e,n),new Ka(a)},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=Ka.from(t),t.size?new Ka(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=Ka.from(t),t.size?new Ka(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=Ka.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}};Ka.from=function(t){if(t instanceof Ka)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new Ka(e)};function dre(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let a=t.child(r),s=e.child(r);if(a==s){n+=a.nodeSize;continue}if(!a.sameMarkup(s))return n;if(a.isText&&a.text!=s.text){for(let o=0;a.text[o]==s.text[o];o++)n++;return n}if(a.content.size||s.content.size){let o=dre(a.content,s.content,n+1);if(o!=null)return o}n+=a.nodeSize}}function ure(t,e,n,r){for(let a=t.childCount,s=e.childCount;;){if(a==0||s==0)return a==s?null:{a:n,b:r};let o=t.child(--a),l=e.child(--s),c=o.nodeSize;if(o==l){n-=c,r-=c;continue}if(!o.sameMarkup(l))return{a:n,b:r};if(o.isText&&o.text!=l.text){let d=0,u=Math.min(o.text.length,l.text.length);for(;d<u&&o.text[o.text.length-d-1]==l.text[l.text.length-d-1];)d++,n--,r--;return{a:n,b:r}}if(o.content.size||l.content.size){let d=ure(o.content,l.content,n-1,r-1);if(d)return d}n-=c,r-=c}}class Lt{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,n,r,a=0,s){for(let o=0,l=0;l<n;o++){let c=this.content[o],d=l+c.nodeSize;if(d>e&&r(c,a+l,s||null,o)!==!1&&c.content.size){let u=l+1;c.nodesBetween(Math.max(0,e-u),Math.min(c.content.size,n-u),r,a+u)}l=d}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,a){let s="",o=!0;return this.nodesBetween(e,n,(l,c)=>{let d=l.isText?l.text.slice(Math.max(e,c)-c,n-c):l.isLeaf?a?typeof a=="function"?a(l):a:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&d||l.isTextblock)&&r&&(o?o=!1:s+=r),s+=d},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,a=this.content.slice(),s=0;for(n.isText&&n.sameMarkup(r)&&(a[a.length-1]=n.withText(n.text+r.text),s=1);s<e.content.length;s++)a.push(e.content[s]);return new Lt(a,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],a=0;if(n>e)for(let s=0,o=0;o<n;s++){let l=this.content[s],c=o+l.nodeSize;c>e&&((o<e||c>n)&&(l.isText?l=l.cut(Math.max(0,e-o),Math.min(l.text.length,n-o)):l=l.cut(Math.max(0,e-o-1),Math.min(l.content.size,n-o-1))),r.push(l),a+=l.nodeSize),o=c}return new Lt(r,a)}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 r=this.content[e];if(r==n)return this;let a=this.content.slice(),s=this.size+n.nodeSize-r.nodeSize;return a[e]=n,new Lt(a,s)}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,r=0;n<this.content.length;n++){let a=this.content[n];e(a,r,n),r+=a.nodeSize}}findDiffStart(e,n=0){return dre(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return ure(this,e,n,r)}findIndex(e){if(e==0)return $_(0,e);if(e==this.size)return $_(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,r=0;;n++){let a=this.child(n),s=r+a.nodeSize;if(s>=e)return s==e?$_(n+1,s):$_(n,r);r=s}}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,r=0;for(let a=0;a<e.length;a++){let s=e[a];r+=s.nodeSize,a&&s.isText&&e[a-1].sameMarkup(s)?(n||(n=e.slice(0,a)),n[n.length-1]=s.withText(n[n.length-1].text+s.text)):n&&n.push(s)}return new Lt(n||e,r)}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 pj={index:0,offset:0};function $_(t,e){return pj.index=t,pj.offset=e,pj}function cN(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 r=0;r<t.length;r++)if(!cN(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!cN(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}let Yr=class UR{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let a=0;a<e.length;a++){let s=e[a];if(this.eq(s))return e;if(this.type.excludes(s.type))n||(n=e.slice(0,a));else{if(s.type.excludes(this.type))return e;!r&&s.type.rank>this.type.rank&&(n||(n=e.slice(0,a)),n.push(this),r=!0),n&&n.push(s)}}return n||(n=e.slice()),r||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&&cN(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 r=e.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);let a=r.create(n.attrs);return r.checkAttrs(a.attrs),a}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(n[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return UR.none;if(e instanceof UR)return[e];let n=e.slice();return n.sort((r,a)=>r.type.rank-a.type.rank),n}};Yr.none=[];class dN extends Error{}class Wt{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=hre(this.content,e+this.openStart,n);return r&&new Wt(r,this.openStart,this.openEnd)}removeBetween(e,n){return new Wt(mre(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 r=n.openStart||0,a=n.openEnd||0;if(typeof r!="number"||typeof a!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new Wt(Lt.fromJSON(e,n.content),r,a)}static maxOpen(e,n=!0){let r=0,a=0;for(let s=e.firstChild;s&&!s.isLeaf&&(n||!s.type.spec.isolating);s=s.firstChild)r++;for(let s=e.lastChild;s&&!s.isLeaf&&(n||!s.type.spec.isolating);s=s.lastChild)a++;return new Wt(e,r,a)}}Wt.empty=new Wt(Lt.empty,0,0);function mre(t,e,n){let{index:r,offset:a}=t.findIndex(e),s=t.maybeChild(r),{index:o,offset:l}=t.findIndex(n);if(a==e||s.isText){if(l!=n&&!t.child(o).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=o)throw new RangeError("Removing non-flat range");return t.replaceChild(r,s.copy(mre(s.content,e-a-1,n-a-1)))}function hre(t,e,n,r){let{index:a,offset:s}=t.findIndex(e),o=t.maybeChild(a);if(s==e||o.isText)return r&&!r.canReplace(a,a,n)?null:t.cut(0,e).append(n).append(t.cut(e));let l=hre(o.content,e-s-1,n,o);return l&&t.replaceChild(a,o.copy(l))}function Oqe(t,e,n){if(n.openStart>t.depth)throw new dN("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new dN("Inconsistent open depths");return pre(t,e,n,0)}function pre(t,e,n,r){let a=t.index(r),s=t.node(r);if(a==e.index(r)&&r<t.depth-n.openStart){let o=pre(t,e,n,r+1);return s.copy(s.content.replaceChild(a,o))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let o=t.parent,l=o.content;return Fp(o,l.cut(0,t.parentOffset).append(n.content).append(l.cut(e.parentOffset)))}else{let{start:o,end:l}=Iqe(n,t);return Fp(s,gre(t,o,l,e,r))}else return Fp(s,uN(t,e,r))}function fre(t,e){if(!e.type.compatibleContent(t.type))throw new dN("Cannot join "+e.type.name+" onto "+t.type.name)}function BR(t,e,n){let r=t.node(n);return fre(r,e.node(n)),r}function Rp(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 fv(t,e,n,r){let a=(e||t).node(n),s=0,o=e?e.index(n):a.childCount;t&&(s=t.index(n),t.depth>n?s++:t.textOffset&&(Rp(t.nodeAfter,r),s++));for(let l=s;l<o;l++)Rp(a.child(l),r);e&&e.depth==n&&e.textOffset&&Rp(e.nodeBefore,r)}function Fp(t,e){return t.type.checkContent(e),t.copy(e)}function gre(t,e,n,r,a){let s=t.depth>a&&BR(t,e,a+1),o=r.depth>a&&BR(n,r,a+1),l=[];return fv(null,t,a,l),s&&o&&e.index(a)==n.index(a)?(fre(s,o),Rp(Fp(s,gre(t,e,n,r,a+1)),l)):(s&&Rp(Fp(s,uN(t,e,a+1)),l),fv(e,n,a,l),o&&Rp(Fp(o,uN(n,r,a+1)),l)),fv(r,null,a,l),new Lt(l)}function uN(t,e,n){let r=[];if(fv(null,t,n,r),t.depth>n){let a=BR(t,e,n+1);Rp(Fp(a,uN(t,e,n+1)),r)}return fv(e,null,n,r),new Lt(r)}function Iqe(t,e){let n=e.depth-t.openStart,a=e.node(n).copy(t.content);for(let s=n-1;s>=0;s--)a=e.node(s).copy(Lt.from(a));return{start:a.resolveNoCache(t.openStart+n),end:a.resolveNoCache(a.content.size-t.openEnd-n)}}class h0{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,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 r=this.pos-this.path[this.path.length-1],a=e.child(n);return r?e.child(n).cut(r):a}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 r=this.path[n*3],a=n==0?0:this.path[n*3-1]+1;for(let s=0;s<e;s++)a+=r.child(s).nodeSize;return a}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return Yr.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),a=e.maybeChild(n);if(!r){let l=r;r=a,a=l}let s=r.marks;for(var o=0;o<s.length;o++)s[o].type.spec.inclusive===!1&&(!a||!s[o].isInSet(a.marks))&&(s=s[o--].removeFromSet(s));return s}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,a=e.parent.maybeChild(e.index());for(var s=0;s<r.length;s++)r[s].type.spec.inclusive===!1&&(!a||!r[s].isInSet(a.marks))&&(r=r[s--].removeFromSet(r));return r}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 r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!n||n(this.node(r))))return new mN(this,e,r);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 r=[],a=0,s=n;for(let o=e;;){let{index:l,offset:c}=o.content.findIndex(s),d=s-c;if(r.push(o,l,a+c),!d||(o=o.child(l),o.isText))break;s=d-1,a+=c+1}return new h0(n,r,s)}static resolveCached(e,n){let r=LG.get(e);if(r)for(let s=0;s<r.elts.length;s++){let o=r.elts[s];if(o.pos==n)return o}else LG.set(e,r=new zqe);let a=r.elts[r.i]=h0.resolve(e,n);return r.i=(r.i+1)%Uqe,a}}class zqe{constructor(){this.elts=[],this.i=0}}const Uqe=12,LG=new WeakMap;class mN{constructor(e,n,r){this.$from=e,this.$to=n,this.depth=r}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 Bqe=Object.create(null);let Jm=class HR{constructor(e,n,r,a=Yr.none){this.type=e,this.attrs=n,this.marks=a,this.content=r||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,r,a=0){this.content.nodesBetween(e,n,r,a,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,r,a){return this.content.textBetween(e,n,r,a)}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,r){return this.type==e&&cN(this.attrs,n||e.defaultAttrs||Bqe)&&Yr.sameSet(this.marks,r||Yr.none)}copy(e=null){return e==this.content?this:new HR(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new HR(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,r=!1){if(e==n)return Wt.empty;let a=this.resolve(e),s=this.resolve(n),o=r?0:a.sharedDepth(n),l=a.start(o),d=a.node(o).content.cut(a.pos-l,s.pos-l);return new Wt(d,a.depth-o,s.depth-o)}replace(e,n,r){return Oqe(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:a}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(a==e||n.isText)return n;e-=a+1}}childAfter(e){let{index:n,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(n),index:n,offset:r};let a=this.content.child(n-1);return{node:a,index:n-1,offset:r-a.nodeSize}}resolve(e){return h0.resolveCached(this,e)}resolveNoCache(e){return h0.resolve(this,e)}rangeHasMark(e,n,r){let a=!1;return n>e&&this.nodesBetween(e,n,s=>(r.isInSet(s.marks)&&(a=!0),!a)),a}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()+")"),bre(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,r=Lt.empty,a=0,s=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,a,s),l=o&&o.matchFragment(this.content,n);if(!l||!l.validEnd)return!1;for(let c=a;c<s;c++)if(!this.type.allowsMarks(r.child(c).marks))return!1;return!0}canReplaceWith(e,n,r,a){if(a&&!this.type.allowsMarks(a))return!1;let s=this.contentMatchAt(e).matchType(r),o=s&&s.matchFragment(this.content,n);return o?o.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=Yr.none;for(let n=0;n<this.marks.length;n++){let r=this.marks[n];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!Yr.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 r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=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,r)}let a=Lt.fromJSON(e,n.content),s=e.nodeType(n.type).create(n.attrs,a,r);return s.type.checkAttrs(s.attrs),s}};Jm.prototype.text=void 0;class hN extends Jm{constructor(e,n,r,a){if(super(e,n,null,a),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):bre(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 hN(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new hN(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 bre(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class cf{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new Hqe(e,n);if(r.next==null)return cf.empty;let a=xre(r);r.next&&r.err("Unexpected trailing text");let s=Yqe(Kqe(a));return Xqe(s,r),s}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,r=e.childCount){let a=this;for(let s=n;a&&s<r;s++)a=a.matchType(e.child(s).type);return a}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 r=0;r<e.next.length;r++)if(this.next[n].type==e.next[r].type)return!0;return!1}fillBefore(e,n=!1,r=0){let a=[this];function s(o,l){let c=o.matchFragment(e,r);if(c&&(!n||c.validEnd))return Lt.from(l.map(d=>d.createAndFill()));for(let d=0;d<o.next.length;d++){let{type:u,next:m}=o.next[d];if(!(u.isText||u.hasRequiredAttrs())&&a.indexOf(m)==-1){a.push(m);let p=s(m,l.concat(u));if(p)return p}}return null}return s(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let a=r.shift(),s=a.match;if(s.matchType(e)){let o=[];for(let l=a;l.type;l=l.via)o.push(l.type);return o.reverse()}for(let o=0;o<s.next.length;o++){let{type:l,next:c}=s.next[o];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in n)&&(!a.type||c.validEnd)&&(r.push({match:l.contentMatch,type:l,via:a}),n[l.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(r){e.push(r);for(let a=0;a<r.next.length;a++)e.indexOf(r.next[a].next)==-1&&n(r.next[a].next)}return n(this),e.map((r,a)=>{let s=a+(r.validEnd?"*":" ")+" ";for(let o=0;o<r.next.length;o++)s+=(o?", ":"")+r.next[o].type.name+"->"+e.indexOf(r.next[o].next);return s}).join(`
- `)}}cf.empty=new cf(!0);class Hqe{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 xre(t){let e=[];do e.push($qe(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function $qe(t){let e=[];do e.push(qqe(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function qqe(t){let e=Wqe(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=Vqe(t,e);else break;return e}function OG(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function Vqe(t,e){let n=OG(t),r=n;return t.eat(",")&&(t.next!="}"?r=OG(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function Gqe(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let a=[];for(let s in n){let o=n[s];o.isInGroup(e)&&a.push(o)}return a.length==0&&t.err("No node type or group '"+e+"' found"),a}function Wqe(t){if(t.eat("(")){let e=xre(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=Gqe(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 Kqe(t){let e=[[]];return a(s(t,0),n()),e;function n(){return e.push([])-1}function r(o,l,c){let d={term:c,to:l};return e[o].push(d),d}function a(o,l){o.forEach(c=>c.to=l)}function s(o,l){if(o.type=="choice")return o.exprs.reduce((c,d)=>c.concat(s(d,l)),[]);if(o.type=="seq")for(let c=0;;c++){let d=s(o.exprs[c],l);if(c==o.exprs.length-1)return d;a(d,l=n())}else if(o.type=="star"){let c=n();return r(l,c),a(s(o.expr,c),c),[r(c)]}else if(o.type=="plus"){let c=n();return a(s(o.expr,l),c),a(s(o.expr,c),c),[r(c)]}else{if(o.type=="opt")return[r(l)].concat(s(o.expr,l));if(o.type=="range"){let c=l;for(let d=0;d<o.min;d++){let u=n();a(s(o.expr,c),u),c=u}if(o.max==-1)a(s(o.expr,c),c);else for(let d=o.min;d<o.max;d++){let u=n();r(c,u),a(s(o.expr,c),u),c=u}return[r(c)]}else{if(o.type=="name")return[r(l,void 0,o.value)];throw new Error("Unknown expr type")}}}}function yre(t,e){return e-t}function IG(t,e){let n=[];return r(e),n.sort(yre);function r(a){let s=t[a];if(s.length==1&&!s[0].term)return r(s[0].to);n.push(a);for(let o=0;o<s.length;o++){let{term:l,to:c}=s[o];!l&&n.indexOf(c)==-1&&r(c)}}}function Yqe(t){let e=Object.create(null);return n(IG(t,0));function n(r){let a=[];r.forEach(o=>{t[o].forEach(({term:l,to:c})=>{if(!l)return;let d;for(let u=0;u<a.length;u++)a[u][0]==l&&(d=a[u][1]);IG(t,c).forEach(u=>{d||a.push([l,d=[]]),d.indexOf(u)==-1&&d.push(u)})})});let s=e[r.join(",")]=new cf(r.indexOf(t.length-1)>-1);for(let o=0;o<a.length;o++){let l=a[o][1].sort(yre);s.next.push({type:a[o][0],next:e[l.join(",")]||n(l)})}return s}}function Xqe(t,e){for(let n=0,r=[t];n<r.length;n++){let a=r[n],s=!a.validEnd,o=[];for(let l=0;l<a.next.length;l++){let{type:c,next:d}=a.next[l];o.push(c.name),s&&!(c.isText||c.hasRequiredAttrs())&&(s=!1),r.indexOf(d)==-1&&r.push(d)}s&&e.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function vre(t){let e=Object.create(null);for(let n in t){let r=t[n];if(!r.hasDefault)return null;e[n]=r.default}return e}function wre(t,e){let n=Object.create(null);for(let r in t){let a=e&&e[r];if(a===void 0){let s=t[r];if(s.hasDefault)a=s.default;else throw new RangeError("No value supplied for attribute "+r)}n[r]=a}return n}function Sre(t,e,n,r){for(let a in e)if(!(a in t))throw new RangeError(`Unsupported attribute ${a} for ${n} of type ${a}`);for(let a in t){let s=t[a];s.validate&&s.validate(e[a])}}function _re(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new Zqe(t,r,e[r]);return n}let zG=class kre{constructor(e,n,r){this.name=e,this.schema=n,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=_re(e,r.attrs),this.defaultAttrs=vre(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==cf.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:wre(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Jm(this,this.computeAttrs(e),Lt.from(n),Yr.setFrom(r))}createChecked(e=null,n,r){return n=Lt.from(n),this.checkContent(n),new Jm(this,this.computeAttrs(e),n,Yr.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=Lt.from(n),n.size){let o=this.contentMatch.fillBefore(n);if(!o)return null;n=o.append(n)}let a=this.contentMatch.matchFragment(n),s=a&&a.fillBefore(Lt.empty,!0);return s?new Jm(this,e,n.append(s),Yr.setFrom(r)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.validEnd)return!1;for(let r=0;r<e.childCount;r++)if(!this.allowsMarks(e.child(r).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){Sre(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 r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?n&&n.push(e[r]):n||(n=e.slice(0,r));return n?n.length?n:Yr.none:e}static compile(e,n){let r=Object.create(null);e.forEach((s,o)=>r[s]=new kre(s,n,o));let a=n.spec.topNode||"doc";if(!r[a])throw new RangeError("Schema is missing its top node type ('"+a+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let s in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function Qqe(t,e,n){let r=n.split("|");return a=>{let s=a===null?"null":typeof a;if(r.indexOf(s)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${s}`)}}class Zqe{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?Qqe(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class CT{constructor(e,n,r,a){this.name=e,this.rank=n,this.schema=r,this.spec=a,this.attrs=_re(e,a.attrs),this.excluded=null;let s=vre(this.attrs);this.instance=s?new Yr(this,s):null}create(e=null){return!e&&this.instance?this.instance:new Yr(this,wre(this.attrs,e))}static compile(e,n){let r=Object.create(null),a=0;return e.forEach((s,o)=>r[s]=new CT(s,a++,n,o)),r}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){Sre(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class Nre{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let a in e)n[a]=e[a];n.nodes=Ka.from(e.nodes),n.marks=Ka.from(e.marks||{}),this.nodes=zG.compile(this.spec.nodes,this),this.marks=CT.compile(this.spec.marks,this);let r=Object.create(null);for(let a in this.nodes){if(a in this.marks)throw new RangeError(a+" can not be both a node and a mark");let s=this.nodes[a],o=s.spec.content||"",l=s.spec.marks;if(s.contentMatch=r[o]||(r[o]=cf.parse(o,this.nodes)),s.inlineContent=s.contentMatch.inlineContent,s.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!s.isInline||!s.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=s}s.markSet=l=="_"?null:l?UG(this,l.split(" ")):l==""||!s.inlineContent?[]:null}for(let a in this.marks){let s=this.marks[a],o=s.spec.excludes;s.excluded=o==null?[s]:o==""?[]:UG(this,o.split(" "))}this.nodeFromJSON=a=>Jm.fromJSON(this,a),this.markFromJSON=a=>Yr.fromJSON(this,a),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,a){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof zG){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,r,a)}text(e,n){let r=this.nodes.text;return new hN(r,r.defaultAttrs,e,Yr.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 UG(t,e){let n=[];for(let r=0;r<e.length;r++){let a=e[r],s=t.marks[a],o=s;if(s)n.push(s);else for(let l in t.marks){let c=t.marks[l];(a=="_"||c.spec.group&&c.spec.group.split(" ").indexOf(a)>-1)&&n.push(o=c)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function Jqe(t){return t.tag!=null}function eVe(t){return t.style!=null}let gv=class $R{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(a=>{if(Jqe(a))this.tags.push(a);else if(eVe(a)){let s=/[^=]*/.exec(a.style)[0];r.indexOf(s)<0&&r.push(s),this.styles.push(a)}}),this.normalizeLists=!this.tags.some(a=>{if(!/^(ul|ol)\b/.test(a.tag)||!a.node)return!1;let s=e.nodes[a.node];return s.contentMatch.matchType(s)})}parse(e,n={}){let r=new HG(this,n,!1);return r.addAll(e,Yr.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new HG(this,n,!0);return r.addAll(e,Yr.none,n.from,n.to),Wt.maxOpen(r.finish())}matchTag(e,n,r){for(let a=r?this.tags.indexOf(r)+1:0;a<this.tags.length;a++){let s=this.tags[a];if(rVe(e,s.tag)&&(s.namespace===void 0||e.namespaceURI==s.namespace)&&(!s.context||n.matchesContext(s.context))){if(s.getAttrs){let o=s.getAttrs(e);if(o===!1)continue;s.attrs=o||void 0}return s}}}matchStyle(e,n,r,a){for(let s=a?this.styles.indexOf(a)+1:0;s<this.styles.length;s++){let o=this.styles[s],l=o.style;if(!(l.indexOf(e)!=0||o.context&&!r.matchesContext(o.context)||l.length>e.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=n))){if(o.getAttrs){let c=o.getAttrs(n);if(c===!1)continue;o.attrs=c||void 0}return o}}}static schemaRules(e){let n=[];function r(a){let s=a.priority==null?50:a.priority,o=0;for(;o<n.length;o++){let l=n[o];if((l.priority==null?50:l.priority)<s)break}n.splice(o,0,a)}for(let a in e.marks){let s=e.marks[a].spec.parseDOM;s&&s.forEach(o=>{r(o=$G(o)),o.mark||o.ignore||o.clearMark||(o.mark=a)})}for(let a in e.nodes){let s=e.nodes[a].spec.parseDOM;s&&s.forEach(o=>{r(o=$G(o)),o.node||o.ignore||o.mark||(o.node=a)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new $R(e,$R.schemaRules(e)))}};const Cre={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},tVe={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Tre={ol:!0,ul:!0},p0=1,qR=2,bv=4;function BG(t,e,n){return e!=null?(e?p0:0)|(e==="full"?qR:0):t&&t.whitespace=="pre"?p0|qR:n&~bv}class q_{constructor(e,n,r,a,s,o){this.type=e,this.attrs=n,this.marks=r,this.solid=a,this.options=o,this.content=[],this.activeMarks=Yr.none,this.match=s||(o&bv?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 r=this.type.contentMatch,a;return(a=r.findWrapping(e.type))?(this.match=r,a):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&p0)){let r=this.content[this.content.length-1],a;if(r&&r.isText&&(a=/[ \t\r\n\u000c]+$/.exec(r.text))){let s=r;r.text.length==a[0].length?this.content.pop():this.content[this.content.length-1]=s.withText(s.text.slice(0,s.text.length-a[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&&!Cre.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class HG{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let a=n.topNode,s,o=BG(null,n.preserveWhitespace,0)|(r?bv:0);a?s=new q_(a.type,a.attrs,Yr.none,!0,n.topMatch||a.type.contentMatch,o):r?s=new q_(null,null,Yr.none,!0,null,o):s=new q_(e.schema.topNodeType,null,Yr.none,!0,null,o),this.nodes=[s],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 r=e.nodeValue,a=this.top,s=a.options&qR?"full":this.localPreserveWS||(a.options&p0)>0,{schema:o}=this.parser;if(s==="full"||a.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(s)if(s==="full")r=r.replace(/\r\n?/g,`
- `);else if(o.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(o.linebreakReplacement.create())){let l=r.split(/\r?\n|\r/);for(let c=0;c<l.length;c++)c&&this.insertNode(o.linebreakReplacement.create(),n,!0),l[c]&&this.insertNode(o.text(l[c]),n,!/\S/.test(l[c]));r=""}else r=r.replace(/\r?\n|\r/g," ");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let l=a.content[a.content.length-1],c=e.previousSibling;(!l||c&&c.nodeName=="BR"||l.isText&&/[ \t\r\n\u000c]$/.test(l.text))&&(r=r.slice(1))}r&&this.insertNode(o.text(r),n,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,n,r){let a=this.localPreserveWS,s=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let o=e.nodeName.toLowerCase(),l;Tre.hasOwnProperty(o)&&this.parser.normalizeLists&&nVe(e);let c=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(l=this.parser.matchTag(e,this,r));e:if(c?c.ignore:tVe.hasOwnProperty(o))this.findInside(e),this.ignoreFallback(e,n);else if(!c||c.skip||c.closeParent){c&&c.closeParent?this.open=Math.max(0,this.open-1):c&&c.skip.nodeType&&(e=c.skip);let d,u=this.needsBlock;if(Cre.hasOwnProperty(o))s.content.length&&s.content[0].isInline&&this.open&&(this.open--,s=this.top),d=!0,s.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,n);break e}let m=c&&c.skip?n:this.readStyles(e,n);m&&this.addAll(e,m),d&&this.sync(s),this.needsBlock=u}else{let d=this.readStyles(e,n);d&&this.addElementByRule(e,c,d,c.consuming===!1?l:void 0)}this.localPreserveWS=a}leafFallback(e,n){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
- `),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 r=e.style;if(r&&r.length)for(let a=0;a<this.parser.matchedStyles.length;a++){let s=this.parser.matchedStyles[a],o=r.getPropertyValue(s);if(o)for(let l=void 0;;){let c=this.parser.matchStyle(s,o,this,l);if(!c)break;if(c.ignore)return null;if(c.clearMark?n=n.filter(d=>!c.clearMark(d)):n=n.concat(this.parser.schema.marks[c.mark].create(c.attrs)),c.consuming===!1)l=c;else break}}return n}addElementByRule(e,n,r,a){let s,o;if(n.node)if(o=this.parser.schema.nodes[n.node],o.isLeaf)this.insertNode(o.create(n.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let c=this.enter(o,n.attrs||null,r,n.preserveWhitespace);c&&(s=!0,r=c)}else{let c=this.parser.schema.marks[n.mark];r=r.concat(c.create(n.attrs))}let l=this.top;if(o&&o.isLeaf)this.findInside(e);else if(a)this.addElement(e,r,a);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(c=>this.insertNode(c,r,!1));else{let c=e;typeof n.contentElement=="string"?c=e.querySelector(n.contentElement):typeof n.contentElement=="function"?c=n.contentElement(e):n.contentElement&&(c=n.contentElement),this.findAround(e,c,!0),this.addAll(c,r),this.findAround(e,c,!1)}s&&this.sync(l)&&this.open--}addAll(e,n,r,a){let s=r||0;for(let o=r?e.childNodes[r]:e.firstChild,l=a==null?null:e.childNodes[a];o!=l;o=o.nextSibling,++s)this.findAtPoint(e,s),this.addDOM(o,n);this.findAtPoint(e,s)}findPlace(e,n,r){let a,s;for(let o=this.open,l=0;o>=0;o--){let c=this.nodes[o],d=c.findWrapping(e);if(d&&(!a||a.length>d.length+l)&&(a=d,s=c,!d.length))break;if(c.solid){if(r)break;l+=2}}if(!a)return null;this.sync(s);for(let o=0;o<a.length;o++)n=this.enterInner(a[o],null,n,!1);return n}insertNode(e,n,r){if(e.isInline&&this.needsBlock&&!this.top.type){let s=this.textblockFromContext();s&&(n=this.enterInner(s,null,n))}let a=this.findPlace(e,n,r);if(a){this.closeExtra();let s=this.top;s.match&&(s.match=s.match.matchType(e.type));let o=Yr.none;for(let l of a.concat(e.marks))(s.type?s.type.allowsMarkType(l.type):qG(l.type,e.type))&&(o=l.addToSet(o));return s.content.push(e.mark(o)),!0}return!1}enter(e,n,r,a){let s=this.findPlace(e.create(n),r,!1);return s&&(s=this.enterInner(e,n,r,!0,a)),s}enterInner(e,n,r,a=!1,s){this.closeExtra();let o=this.top;o.match=o.match&&o.match.matchType(e);let l=BG(e,s,o.options);o.options&bv&&o.content.length==0&&(l|=bv);let c=Yr.none;return r=r.filter(d=>(o.type?o.type.allowsMarkType(d.type):qG(d.type,e))?(c=d.addToSet(c),!1):!0),this.nodes.push(new q_(e,n,c,a,null,l)),this.open++,r}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|=p0)}return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let a=r.length-1;a>=0;a--)e+=r[a].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==n&&(this.find[r].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,r){if(e!=n&&this.find)for(let a=0;a<this.find.length;a++)this.find[a].pos==null&&e.nodeType==1&&e.contains(this.find[a].node)&&n.compareDocumentPosition(this.find[a].node)&(r?2:4)&&(this.find[a].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("/"),r=this.options.context,a=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),s=-(r?r.depth+1:0)+(a?0:1),o=(l,c)=>{for(;l>=0;l--){let d=n[l];if(d==""){if(l==n.length-1||l==0)continue;for(;c>=s;c--)if(o(l-1,c))return!0;return!1}else{let u=c>0||c==0&&a?this.nodes[c].type:r&&c>=s?r.node(c-s).type:null;if(!u||u.name!=d&&!u.isInGroup(d))return!1;c--}}return!0};return o(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}}function nVe(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&Tre.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function rVe(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function $G(t){let e={};for(let n in t)e[n]=t[n];return e}function qG(t,e){let n=e.schema.nodes;for(let r in n){let a=n[r];if(!a.allowsMarkType(t))continue;let s=[],o=l=>{s.push(l);for(let c=0;c<l.edgeCount;c++){let{type:d,next:u}=l.edge(c);if(d==e||s.indexOf(u)<0&&o(u))return!0}};if(o(a.contentMatch))return!0}}class Sf{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=fj(n).createDocumentFragment());let a=r,s=[];return e.forEach(o=>{if(s.length||o.marks.length){let l=0,c=0;for(;l<s.length&&c<o.marks.length;){let d=o.marks[c];if(!this.marks[d.type.name]){c++;continue}if(!d.eq(s[l][0])||d.type.spec.spanning===!1)break;l++,c++}for(;l<s.length;)a=s.pop()[1];for(;c<o.marks.length;){let d=o.marks[c++],u=this.serializeMark(d,o.isInline,n);u&&(s.push([d,a]),a.appendChild(u.dom),a=u.contentDOM||u.dom)}}a.appendChild(this.serializeNodeInner(o,n))}),r}serializeNodeInner(e,n){let{dom:r,contentDOM:a}=T1(fj(n),this.nodes[e.type.name](e),null,e.attrs);if(a){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,n,a)}return r}serializeNode(e,n={}){let r=this.serializeNodeInner(e,n);for(let a=e.marks.length-1;a>=0;a--){let s=this.serializeMark(e.marks[a],e.isInline,n);s&&((s.contentDOM||s.dom).appendChild(r),r=s.dom)}return r}serializeMark(e,n,r={}){let a=this.marks[e.type.name];return a&&T1(fj(r),a(e,n),null,e.attrs)}static renderSpec(e,n,r=null,a){return T1(e,n,r,a)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Sf(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=VG(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return VG(e.marks)}}function VG(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function fj(t){return t.document||window.document}const GG=new WeakMap;function iVe(t){let e=GG.get(t);return e===void 0&&GG.set(t,e=aVe(t)),e}function aVe(t){let e=null;function n(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let a=0;a<r.length;a++)n(r[a]);else for(let a in r)n(r[a])}return n(t),e}function T1(t,e,n,r){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 a=e[0],s;if(typeof a!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(s=iVe(r))&&s.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 o=a.indexOf(" ");o>0&&(n=a.slice(0,o),a=a.slice(o+1));let l,c=n?t.createElementNS(n,a):t.createElement(a),d=e[1],u=1;if(d&&typeof d=="object"&&d.nodeType==null&&!Array.isArray(d)){u=2;for(let m in d)if(d[m]!=null){let p=m.indexOf(" ");p>0?c.setAttributeNS(m.slice(0,p),m.slice(p+1),d[m]):m=="style"&&c.style?c.style.cssText=d[m]:c.setAttribute(m,d[m])}}for(let m=u;m<e.length;m++){let p=e[m];if(p===0){if(m<e.length-1||m>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:c,contentDOM:c}}else{let{dom:f,contentDOM:y}=T1(t,p,n,r);if(c.appendChild(f),y){if(l)throw new RangeError("Multiple content holes");l=y}}}return{dom:c,contentDOM:l}}const Pre=65535,Are=Math.pow(2,16);function sVe(t,e){return t+e*Are}function WG(t){return t&Pre}function oVe(t){return(t-(t&Pre))/Are}const Mre=1,Ere=2,P1=4,jre=8;class VR{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&jre)>0}get deletedBefore(){return(this.delInfo&(Mre|P1))>0}get deletedAfter(){return(this.delInfo&(Ere|P1))>0}get deletedAcross(){return(this.delInfo&P1)>0}}class Eo{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&Eo.empty)return Eo.empty}recover(e){let n=0,r=WG(e);if(!this.inverted)for(let a=0;a<r;a++)n+=this.ranges[a*3+2]-this.ranges[a*3+1];return this.ranges[r*3]+n+oVe(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,r){let a=0,s=this.inverted?2:1,o=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let c=this.ranges[l]-(this.inverted?a:0);if(c>e)break;let d=this.ranges[l+s],u=this.ranges[l+o],m=c+d;if(e<=m){let p=d?e==c?-1:e==m?1:n:n,f=c+a+(p<0?0:u);if(r)return f;let y=e==(n<0?c:m)?null:sVe(l/3,e-c),x=e==c?Ere:e==m?Mre:P1;return(n<0?e!=c:e!=m)&&(x|=jre),new VR(f,x,y)}a+=u-d}return r?e+a:new VR(e+a,0,null)}touches(e,n){let r=0,a=WG(n),s=this.inverted?2:1,o=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let c=this.ranges[l]-(this.inverted?r:0);if(c>e)break;let d=this.ranges[l+s],u=c+d;if(e<=u&&l==a*3)return!0;r+=this.ranges[l+o]-d}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let a=0,s=0;a<this.ranges.length;a+=3){let o=this.ranges[a],l=o-(this.inverted?s:0),c=o+(this.inverted?0:s),d=this.ranges[a+n],u=this.ranges[a+r];e(l,l+d,c,c+u),s+=u-d}}invert(){return new Eo(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Eo.empty:new Eo(e<0?[0,-e,0]:[0,0,e])}}Eo.empty=new Eo([]);class f0{constructor(e,n,r=0,a=e?e.length:0){this.mirror=n,this.from=r,this.to=a,this._maps=e||[],this.ownData=!(e||n)}get maps(){return this._maps}slice(e=0,n=this.maps.length){return new f0(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,r=this._maps.length;n<e._maps.length;n++){let a=e.getMirror(n);this.appendMap(e._maps[n],a!=null&&a<n?r+a: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,r=this._maps.length+e._maps.length;n>=0;n--){let a=e.getMirror(n);this.appendMap(e._maps[n].invert(),a!=null&&a>n?r-a-1:void 0)}}invert(){let e=new f0;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,n);return e}mapResult(e,n=1){return this._map(e,n,!1)}_map(e,n,r){let a=0;for(let s=this.from;s<this.to;s++){let o=this._maps[s],l=o.mapResult(e,n);if(l.recover!=null){let c=this.getMirror(s);if(c!=null&&c>s&&c<this.to){s=c,e=this._maps[c].recover(l.recover);continue}}a|=l.delInfo,e=l.pos}return r?e:new VR(e,a,null)}}const gj=Object.create(null);class ws{getMap(){return Eo.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=gj[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in gj)throw new RangeError("Duplicate use of step JSON ID "+e);return gj[e]=n,n.prototype.jsonID=e,n}}class aa{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new aa(e,null)}static fail(e){return new aa(null,e)}static fromReplace(e,n,r,a){try{return aa.ok(e.replace(n,r,a))}catch(s){if(s instanceof dN)return aa.fail(s.message);throw s}}}function O4(t,e,n){let r=[];for(let a=0;a<t.childCount;a++){let s=t.child(a);s.content.size&&(s=s.copy(O4(s.content,e,s))),s.isInline&&(s=e(s,n,a)),r.push(s)}return Lt.fromArray(r)}class Om extends ws{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=e.resolve(this.from),a=r.node(r.sharedDepth(this.to)),s=new Wt(O4(n.content,(o,l)=>!o.isAtom||!l.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),a),n.openStart,n.openEnd);return aa.fromReplace(e,this.from,this.to,s)}invert(){return new Zl(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Om(n.pos,r.pos,this.mark)}merge(e){return e instanceof Om&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Om(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 Om(n.from,n.to,e.markFromJSON(n.mark))}}ws.jsonID("addMark",Om);class Zl extends ws{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new Wt(O4(n.content,a=>a.mark(this.mark.removeFromSet(a.marks)),e),n.openStart,n.openEnd);return aa.fromReplace(e,this.from,this.to,r)}invert(){return new Om(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Zl(n.pos,r.pos,this.mark)}merge(e){return e instanceof Zl&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Zl(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 Zl(n.from,n.to,e.markFromJSON(n.mark))}}ws.jsonID("removeMark",Zl);class Im extends ws{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return aa.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return aa.fromReplace(e,this.pos,this.pos+1,new Wt(Lt.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let a=0;a<n.marks.length;a++)if(!n.marks[a].isInSet(r))return new Im(this.pos,n.marks[a]);return new Im(this.pos,this.mark)}}return new df(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Im(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 Im(n.pos,e.markFromJSON(n.mark))}}ws.jsonID("addNodeMark",Im);class df extends ws{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return aa.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return aa.fromReplace(e,this.pos,this.pos+1,new Wt(Lt.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new Im(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new df(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 df(n.pos,e.markFromJSON(n.mark))}}ws.jsonID("removeNodeMark",df);class Da extends ws{constructor(e,n,r,a=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=a}apply(e){return this.structure&&GR(e,this.from,this.to)?aa.fail("Structure replace would overwrite content"):aa.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Eo([this.from,this.to-this.from,this.slice.size])}invert(e){return new Da(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deletedAcross&&r.deletedAcross?null:new Da(n.pos,Math.max(n.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof Da)||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 Da(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 Da(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 Da(n.from,n.to,Wt.fromJSON(e,n.slice),!!n.structure)}}ws.jsonID("replace",Da);class Fa extends ws{constructor(e,n,r,a,s,o,l=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=a,this.slice=s,this.insert=o,this.structure=l}apply(e){if(this.structure&&(GR(e,this.from,this.gapFrom)||GR(e,this.gapTo,this.to)))return aa.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return aa.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?aa.fromReplace(e,this.from,this.to,r):aa.fail("Content does not fit in gap")}getMap(){return new Eo([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 Fa(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),r=e.mapResult(this.to,-1),a=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),s=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||a<n.pos||s>r.pos?null:new Fa(n.pos,r.pos,a,s,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 Fa(n.from,n.to,n.gapFrom,n.gapTo,Wt.fromJSON(e,n.slice),n.insert,!!n.structure)}}ws.jsonID("replaceAround",Fa);function GR(t,e,n){let r=t.resolve(e),a=n-e,s=r.depth;for(;a>0&&s>0&&r.indexAfter(s)==r.node(s).childCount;)s--,a--;if(a>0){let o=r.node(s).maybeChild(r.indexAfter(s));for(;a>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,a--}}return!1}function lVe(t,e,n,r){let a=[],s=[],o,l;t.doc.nodesBetween(e,n,(c,d,u)=>{if(!c.isInline)return;let m=c.marks;if(!r.isInSet(m)&&u.type.allowsMarkType(r.type)){let p=Math.max(d,e),f=Math.min(d+c.nodeSize,n),y=r.addToSet(m);for(let x=0;x<m.length;x++)m[x].isInSet(y)||(o&&o.to==p&&o.mark.eq(m[x])?o.to=f:a.push(o=new Zl(p,f,m[x])));l&&l.to==p?l.to=f:s.push(l=new Om(p,f,r))}}),a.forEach(c=>t.step(c)),s.forEach(c=>t.step(c))}function cVe(t,e,n,r){let a=[],s=0;t.doc.nodesBetween(e,n,(o,l)=>{if(!o.isInline)return;s++;let c=null;if(r instanceof CT){let d=o.marks,u;for(;u=r.isInSet(d);)(c||(c=[])).push(u),d=u.removeFromSet(d)}else r?r.isInSet(o.marks)&&(c=[r]):c=o.marks;if(c&&c.length){let d=Math.min(l+o.nodeSize,n);for(let u=0;u<c.length;u++){let m=c[u],p;for(let f=0;f<a.length;f++){let y=a[f];y.step==s-1&&m.eq(a[f].style)&&(p=y)}p?(p.to=d,p.step=s):a.push({style:m,from:Math.max(l,e),to:d,step:s})}}}),a.forEach(o=>t.step(new Zl(o.from,o.to,o.style)))}function I4(t,e,n,r=n.contentMatch,a=!0){let s=t.doc.nodeAt(e),o=[],l=e+1;for(let c=0;c<s.childCount;c++){let d=s.child(c),u=l+d.nodeSize,m=r.matchType(d.type);if(!m)o.push(new Da(l,u,Wt.empty));else{r=m;for(let p=0;p<d.marks.length;p++)n.allowsMarkType(d.marks[p].type)||t.step(new Zl(l,u,d.marks[p]));if(a&&d.isText&&n.whitespace!="pre"){let p,f=/\r?\n|\r/g,y;for(;p=f.exec(d.text);)y||(y=new Wt(Lt.from(n.schema.text(" ",n.allowedMarks(d.marks))),0,0)),o.push(new Da(l+p.index,l+p.index+p[0].length,y))}}l=u}if(!r.validEnd){let c=r.fillBefore(Lt.empty,!0);t.replace(l,l,new Wt(c,0,0))}for(let c=o.length-1;c>=0;c--)t.step(o[c])}function dVe(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function Tx(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth,a=0,s=0;;--r){let o=t.$from.node(r),l=t.$from.index(r)+a,c=t.$to.indexAfter(r)-s;if(r<t.depth&&o.canReplace(l,c,n))return r;if(r==0||o.type.spec.isolating||!dVe(o,l,c))break;l&&(a=1),c<o.childCount&&(s=1)}return null}function uVe(t,e,n){let{$from:r,$to:a,depth:s}=e,o=r.before(s+1),l=a.after(s+1),c=o,d=l,u=Lt.empty,m=0;for(let y=s,x=!1;y>n;y--)x||r.index(y)>0?(x=!0,u=Lt.from(r.node(y).copy(u)),m++):c--;let p=Lt.empty,f=0;for(let y=s,x=!1;y>n;y--)x||a.after(y+1)<a.end(y)?(x=!0,p=Lt.from(a.node(y).copy(p)),f++):d++;t.step(new Fa(c,d,o,l,new Wt(u.append(p),m,f),u.size-m,!0))}function z4(t,e,n=null,r=t){let a=mVe(t,e),s=a&&hVe(r,e);return s?a.map(KG).concat({type:e,attrs:n}).concat(s.map(KG)):null}function KG(t){return{type:t,attrs:null}}function mVe(t,e){let{parent:n,startIndex:r,endIndex:a}=t,s=n.contentMatchAt(r).findWrapping(e);if(!s)return null;let o=s.length?s[0]:e;return n.canReplaceWith(r,a,o)?s:null}function hVe(t,e){let{parent:n,startIndex:r,endIndex:a}=t,s=n.child(r),o=e.contentMatch.findWrapping(s.type);if(!o)return null;let c=(o.length?o[o.length-1]:e).contentMatch;for(let d=r;c&&d<a;d++)c=c.matchType(n.child(d).type);return!c||!c.validEnd?null:o}function pVe(t,e,n){let r=Lt.empty;for(let o=n.length-1;o>=0;o--){if(r.size){let l=n[o].type.contentMatch.matchFragment(r);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=Lt.from(n[o].type.create(n[o].attrs,r))}let a=e.start,s=e.end;t.step(new Fa(a,s,a,s,new Wt(r,0,0),n.length,!0))}function fVe(t,e,n,r,a){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=t.steps.length;t.doc.nodesBetween(e,n,(o,l)=>{let c=typeof a=="function"?a(o):a;if(o.isTextblock&&!o.hasMarkup(r,c)&&gVe(t.doc,t.mapping.slice(s).map(l),r)){let d=null;if(r.schema.linebreakReplacement){let f=r.whitespace=="pre",y=!!r.contentMatch.matchType(r.schema.linebreakReplacement);f&&!y?d=!1:!f&&y&&(d=!0)}d===!1&&Rre(t,o,l,s),I4(t,t.mapping.slice(s).map(l,1),r,void 0,d===null);let u=t.mapping.slice(s),m=u.map(l,1),p=u.map(l+o.nodeSize,1);return t.step(new Fa(m,p,m+1,p-1,new Wt(Lt.from(r.create(c,null,o.marks)),0,0),1,!0)),d===!0&&Dre(t,o,l,s),!1}})}function Dre(t,e,n,r){e.forEach((a,s)=>{if(a.isText){let o,l=/\r?\n|\r/g;for(;o=l.exec(a.text);){let c=t.mapping.slice(r).map(n+1+s+o.index);t.replaceWith(c,c+1,e.type.schema.linebreakReplacement.create())}}})}function Rre(t,e,n,r){e.forEach((a,s)=>{if(a.type==a.type.schema.linebreakReplacement){let o=t.mapping.slice(r).map(n+1+s);t.replaceWith(o,o+1,e.type.schema.text(`
- `))}})}function gVe(t,e,n){let r=t.resolve(e),a=r.index();return r.parent.canReplaceWith(a,a+1,n)}function bVe(t,e,n,r,a){let s=t.doc.nodeAt(e);if(!s)throw new RangeError("No node at given position");n||(n=s.type);let o=n.create(r,null,a||s.marks);if(s.isLeaf)return t.replaceWith(e,e+s.nodeSize,o);if(!n.validContent(s.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new Fa(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new Wt(Lt.from(o),0,0),1,!0))}function iu(t,e,n=1,r){let a=t.resolve(e),s=a.depth-n,o=r&&r[r.length-1]||a.parent;if(s<0||a.parent.type.spec.isolating||!a.parent.canReplace(a.index(),a.parent.childCount)||!o.type.validContent(a.parent.content.cutByIndex(a.index(),a.parent.childCount)))return!1;for(let d=a.depth-1,u=n-2;d>s;d--,u--){let m=a.node(d),p=a.index(d);if(m.type.spec.isolating)return!1;let f=m.content.cutByIndex(p,m.childCount),y=r&&r[u+1];y&&(f=f.replaceChild(0,y.type.create(y.attrs)));let x=r&&r[u]||m;if(!m.canReplace(p+1,m.childCount)||!x.type.validContent(f))return!1}let l=a.indexAfter(s),c=r&&r[0];return a.node(s).canReplaceWith(l,l,c?c.type:a.node(s+1).type)}function xVe(t,e,n=1,r){let a=t.doc.resolve(e),s=Lt.empty,o=Lt.empty;for(let l=a.depth,c=a.depth-n,d=n-1;l>c;l--,d--){s=Lt.from(a.node(l).copy(s));let u=r&&r[d];o=Lt.from(u?u.type.create(u.attrs,o):a.node(l).copy(o))}t.step(new Da(e,e,new Wt(s.append(o),n,n),!0))}function yh(t,e){let n=t.resolve(e),r=n.index();return Fre(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function yVe(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:r}=t.type.schema;for(let a=0;a<e.childCount;a++){let s=e.child(a),o=s.type==r?t.type.schema.nodes.text:s.type;if(n=n.matchType(o),!n||!t.type.allowsMarks(s.marks))return!1}return n.validEnd}function Fre(t,e){return!!(t&&e&&!t.isLeaf&&yVe(t,e))}function TT(t,e,n=-1){let r=t.resolve(e);for(let a=r.depth;;a--){let s,o,l=r.index(a);if(a==r.depth?(s=r.nodeBefore,o=r.nodeAfter):n>0?(s=r.node(a+1),l++,o=r.node(a).maybeChild(l)):(s=r.node(a).maybeChild(l-1),o=r.node(a+1)),s&&!s.isTextblock&&Fre(s,o)&&r.node(a).canReplace(l,l+1))return e;if(a==0)break;e=n<0?r.before(a):r.after(a)}}function vVe(t,e,n){let r=null,{linebreakReplacement:a}=t.doc.type.schema,s=t.doc.resolve(e-n),o=s.node().type;if(a&&o.inlineContent){let u=o.whitespace=="pre",m=!!o.contentMatch.matchType(a);u&&!m?r=!1:!u&&m&&(r=!0)}let l=t.steps.length;if(r===!1){let u=t.doc.resolve(e+n);Rre(t,u.node(),u.before(),l)}o.inlineContent&&I4(t,e+n-1,o,s.node().contentMatchAt(s.index()),r==null);let c=t.mapping.slice(l),d=c.map(e-n);if(t.step(new Da(d,c.map(e+n,-1),Wt.empty,!0)),r===!0){let u=t.doc.resolve(d);Dre(t,u.node(),u.before(),t.steps.length)}return t}function wVe(t,e,n){let r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))return e;if(r.parentOffset==0)for(let a=r.depth-1;a>=0;a--){let s=r.index(a);if(r.node(a).canReplaceWith(s,s,n))return r.before(a+1);if(s>0)return null}if(r.parentOffset==r.parent.content.size)for(let a=r.depth-1;a>=0;a--){let s=r.indexAfter(a);if(r.node(a).canReplaceWith(s,s,n))return r.after(a+1);if(s<r.node(a).childCount)return null}return null}function Lre(t,e,n){let r=t.resolve(e);if(!n.content.size)return e;let a=n.content;for(let s=0;s<n.openStart;s++)a=a.firstChild.content;for(let s=1;s<=(n.openStart==0&&n.size?2:1);s++)for(let o=r.depth;o>=0;o--){let l=o==r.depth?0:r.pos<=(r.start(o+1)+r.end(o+1))/2?-1:1,c=r.index(o)+(l>0?1:0),d=r.node(o),u=!1;if(s==1)u=d.canReplace(c,c,a);else{let m=d.contentMatchAt(c).findWrapping(a.firstChild.type);u=m&&d.canReplaceWith(c,c,m[0])}if(u)return l==0?r.pos:l<0?r.before(o+1):r.after(o+1)}return null}function PT(t,e,n=e,r=Wt.empty){if(e==n&&!r.size)return null;let a=t.resolve(e),s=t.resolve(n);return Ore(a,s,r)?new Da(e,n,r):new SVe(a,s,r).fit()}function Ore(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class SVe{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=Lt.empty;for(let a=0;a<=e.depth;a++){let s=e.node(a);this.frontier.push({type:s.type,match:s.contentMatchAt(e.indexAfter(a))})}for(let a=e.depth;a>0;a--)this.placed=Lt.from(e.node(a).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let d=this.findFittable();d?this.placeNodes(d):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,a=this.close(e<0?this.$to:r.doc.resolve(e));if(!a)return null;let s=this.placed,o=r.depth,l=a.depth;for(;o&&l&&s.childCount==1;)s=s.firstChild.content,o--,l--;let c=new Wt(s,o,l);return e>-1?new Fa(r.pos,e,this.$to.pos,this.$to.end(),c,n):c.size||r.pos!=this.$to.pos?new Da(r.pos,a.pos,c):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,a=this.unplaced.openEnd;r<e;r++){let s=n.firstChild;if(n.childCount>1&&(a=0),s.type.spec.isolating&&a<=r){e=r;break}n=s.content}for(let n=1;n<=2;n++)for(let r=n==1?e:this.unplaced.openStart;r>=0;r--){let a,s=null;r?(s=bj(this.unplaced.content,r-1).firstChild,a=s.content):a=this.unplaced.content;let o=a.firstChild;for(let l=this.depth;l>=0;l--){let{type:c,match:d}=this.frontier[l],u,m=null;if(n==1&&(o?d.matchType(o.type)||(m=d.fillBefore(Lt.from(o),!1)):s&&c.compatibleContent(s.type)))return{sliceDepth:r,frontierDepth:l,parent:s,inject:m};if(n==2&&o&&(u=d.findWrapping(o.type)))return{sliceDepth:r,frontierDepth:l,parent:s,wrap:u};if(s&&d.matchType(s.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,a=bj(e,n);return!a.childCount||a.firstChild.isLeaf?!1:(this.unplaced=new Wt(e,n+1,Math.max(r,a.size+n>=e.size-r?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:r}=this.unplaced,a=bj(e,n);if(a.childCount<=1&&n>0){let s=e.size-n<=n+a.size;this.unplaced=new Wt(Zy(e,n-1,1),n-1,s?n-1:r)}else this.unplaced=new Wt(Zy(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:a,wrap:s}){for(;this.depth>n;)this.closeFrontierNode();if(s)for(let x=0;x<s.length;x++)this.openFrontierNode(s[x]);let o=this.unplaced,l=r?r.content:o.content,c=o.openStart-e,d=0,u=[],{match:m,type:p}=this.frontier[n];if(a){for(let x=0;x<a.childCount;x++)u.push(a.child(x));m=m.matchFragment(a)}let f=l.size+e-(o.content.size-o.openEnd);for(;d<l.childCount;){let x=l.child(d),b=m.matchType(x.type);if(!b)break;d++,(d>1||c==0||x.content.size)&&(m=b,u.push(Ire(x.mark(p.allowedMarks(x.marks)),d==1?c:0,d==l.childCount?f:-1)))}let y=d==l.childCount;y||(f=-1),this.placed=Jy(this.placed,n,Lt.from(u)),this.frontier[n].match=m,y&&f<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let x=0,b=l;x<f;x++){let v=b.lastChild;this.frontier.push({type:v.type,match:v.contentMatchAt(v.childCount)}),b=v.content}this.unplaced=y?e==0?Wt.empty:new Wt(Zy(o.content,e-1,1),e-1,f<0?o.openEnd:e-1):new Wt(Zy(o.content,e,d),o.openStart,o.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!xj(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:r}=this.$to,a=this.$to.after(r);for(;r>1&&a==this.$to.end(--r);)++a;return a}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:a}=this.frontier[n],s=n<e.depth&&e.end(n+1)==e.pos+(e.depth-(n+1)),o=xj(e,n,a,r,s);if(o){for(let l=n-1;l>=0;l--){let{match:c,type:d}=this.frontier[l],u=xj(e,l,d,c,!0);if(!u||u.childCount)continue e}return{depth:n,fit:o,move:s?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=Jy(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.depth+1;r<=e.depth;r++){let a=e.node(r),s=a.type.contentMatch.fillBefore(a.content,!0,e.index(r));this.openFrontierNode(a.type,a.attrs,s)}return e}openFrontierNode(e,n=null,r){let a=this.frontier[this.depth];a.match=a.match.matchType(e),this.placed=Jy(this.placed,this.depth,Lt.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(Lt.empty,!0);n.childCount&&(this.placed=Jy(this.placed,this.frontier.length,n))}}function Zy(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(Zy(t.firstChild.content,e-1,n)))}function Jy(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(Jy(t.lastChild.content,e-1,n)))}function bj(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function Ire(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,Ire(r.firstChild,e-1,r.childCount==1?n-1:0))),e>0&&(r=t.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(t.type.contentMatch.matchFragment(r).fillBefore(Lt.empty,!0)))),t.copy(r)}function xj(t,e,n,r,a){let s=t.node(e),o=a?t.indexAfter(e):t.index(e);if(o==s.childCount&&!n.compatibleContent(s.type))return null;let l=r.fillBefore(s.content,!0,o);return l&&!_Ve(n,s.content,o)?l:null}function _Ve(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function kVe(t){return t.spec.defining||t.spec.definingForContent}function NVe(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let a=t.doc.resolve(e),s=t.doc.resolve(n);if(Ore(a,s,r))return t.step(new Da(e,n,r));let o=Ure(a,s);o[o.length-1]==0&&o.pop();let l=-(a.depth+1);o.unshift(l);for(let p=a.depth,f=a.pos-1;p>0;p--,f--){let y=a.node(p).type.spec;if(y.defining||y.definingAsContext||y.isolating)break;o.indexOf(p)>-1?l=p:a.before(p)==f&&o.splice(1,0,-p)}let c=o.indexOf(l),d=[],u=r.openStart;for(let p=r.content,f=0;;f++){let y=p.firstChild;if(d.push(y),f==r.openStart)break;p=y.content}for(let p=u-1;p>=0;p--){let f=d[p],y=kVe(f.type);if(y&&!f.sameMarkup(a.node(Math.abs(l)-1)))u=p;else if(y||!f.type.isTextblock)break}for(let p=r.openStart;p>=0;p--){let f=(p+u+1)%(r.openStart+1),y=d[f];if(y)for(let x=0;x<o.length;x++){let b=o[(x+c)%o.length],v=!0;b<0&&(v=!1,b=-b);let _=a.node(b-1),k=a.index(b-1);if(_.canReplaceWith(k,k,y.type,y.marks))return t.replace(a.before(b),v?s.after(b):n,new Wt(zre(r.content,0,r.openStart,f),f,r.openEnd))}}let m=t.steps.length;for(let p=o.length-1;p>=0&&(t.replace(e,n,r),!(t.steps.length>m));p--){let f=o[p];f<0||(e=a.before(f),n=s.after(f))}}function zre(t,e,n,r,a){if(e<n){let s=t.firstChild;t=t.replaceChild(0,s.copy(zre(s.content,e+1,n,r,s)))}if(e>r){let s=a.contentMatchAt(0),o=s.fillBefore(t).append(t);t=o.append(s.matchFragment(o).fillBefore(Lt.empty,!0))}return t}function CVe(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let a=wVe(t.doc,e,r.type);a!=null&&(e=n=a)}t.replaceRange(e,n,new Wt(Lt.from(r),0,0))}function TVe(t,e,n){let r=t.doc.resolve(e),a=t.doc.resolve(n),s=Ure(r,a);for(let o=0;o<s.length;o++){let l=s[o],c=o==s.length-1;if(c&&l==0||r.node(l).type.contentMatch.validEnd)return t.delete(r.start(l),a.end(l));if(l>0&&(c||r.node(l-1).canReplace(r.index(l-1),a.indexAfter(l-1))))return t.delete(r.before(l),a.after(l))}for(let o=1;o<=r.depth&&o<=a.depth;o++)if(e-r.start(o)==r.depth-o&&n>r.end(o)&&a.end(o)-n!=a.depth-o&&r.start(o-1)==a.start(o-1)&&r.node(o-1).canReplace(r.index(o-1),a.index(o-1)))return t.delete(r.before(o),n);t.delete(e,n)}function Ure(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let a=r;a>=0;a--){let s=t.start(a);if(s<t.pos-(t.depth-a)||e.end(a)>e.pos+(e.depth-a)||t.node(a).type.spec.isolating||e.node(a).type.spec.isolating)break;(s==e.start(a)||a==t.depth&&a==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&a&&e.start(a-1)==s-1)&&n.push(a)}return n}class kb extends ws{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return aa.fail("No node at attribute step's position");let r=Object.create(null);for(let s in n.attrs)r[s]=n.attrs[s];r[this.attr]=this.value;let a=n.type.create(r,null,n.marks);return aa.fromReplace(e,this.pos,this.pos+1,new Wt(Lt.from(a),0,n.isLeaf?0:1))}getMap(){return Eo.empty}invert(e){return new kb(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 kb(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 kb(n.pos,n.attr,n.value)}}ws.jsonID("attr",kb);class g0 extends ws{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let a in e.attrs)n[a]=e.attrs[a];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return aa.ok(r)}getMap(){return Eo.empty}invert(e){return new g0(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 g0(n.attr,n.value)}}ws.jsonID("docAttr",g0);let Xb=class extends Error{};Xb=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};Xb.prototype=Object.create(Error.prototype);Xb.prototype.constructor=Xb;Xb.prototype.name="TransformError";class Bre{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new f0}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new Xb(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}changedRange(){let e=1e9,n=-1e9;for(let r=0;r<this.mapping.maps.length;r++){let a=this.mapping.maps[r];r&&(e=a.map(e,1),n=a.map(n,-1)),a.forEach((s,o,l,c)=>{e=Math.min(e,l),n=Math.max(n,c)})}return e==1e9?null:{from:e,to:n}}addStep(e,n){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=n}replace(e,n=e,r=Wt.empty){let a=PT(this.doc,e,n,r);return a&&this.step(a),this}replaceWith(e,n,r){return this.replace(e,n,new Wt(Lt.from(r),0,0))}delete(e,n){return this.replace(e,n,Wt.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return NVe(this,e,n,r),this}replaceRangeWith(e,n,r){return CVe(this,e,n,r),this}deleteRange(e,n){return TVe(this,e,n),this}lift(e,n){return uVe(this,e,n),this}join(e,n=1){return vVe(this,e,n),this}wrap(e,n){return pVe(this,e,n),this}setBlockType(e,n=e,r,a=null){return fVe(this,e,n,r,a),this}setNodeMarkup(e,n,r=null,a){return bVe(this,e,n,r,a),this}setNodeAttribute(e,n,r){return this.step(new kb(e,n,r)),this}setDocAttribute(e,n){return this.step(new g0(e,n)),this}addNodeMark(e,n){return this.step(new Im(e,n)),this}removeNodeMark(e,n){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(n instanceof Yr)n.isInSet(r.marks)&&this.step(new df(e,n));else{let a=r.marks,s,o=[];for(;s=n.isInSet(a);)o.push(new df(e,s)),a=s.removeFromSet(a);for(let l=o.length-1;l>=0;l--)this.step(o[l])}return this}split(e,n=1,r){return xVe(this,e,n,r),this}addMark(e,n,r){return lVe(this,e,n,r),this}removeMark(e,n,r){return cVe(this,e,n,r),this}clearIncompatible(e,n,r){return I4(this,e,n,r),this}}const yj=Object.create(null);class Yn{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new PVe(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 r=n.content.lastChild,a=null;for(let l=0;l<n.openEnd;l++)a=r,r=r.lastChild;let s=e.steps.length,o=this.ranges;for(let l=0;l<o.length;l++){let{$from:c,$to:d}=o[l],u=e.mapping.slice(s);e.replaceRange(u.map(c.pos),u.map(d.pos),l?Wt.empty:n),l==0&&QG(e,s,(r?r.isInline:a&&a.isTextblock)?-1:1)}}replaceWith(e,n){let r=e.steps.length,a=this.ranges;for(let s=0;s<a.length;s++){let{$from:o,$to:l}=a[s],c=e.mapping.slice(r),d=c.map(o.pos),u=c.map(l.pos);s?e.deleteRange(d,u):(e.replaceRangeWith(d,u,n),QG(e,r,n.isInline?-1:1))}}static findFrom(e,n,r=!1){let a=e.parent.inlineContent?new jn(e):eb(e.node(0),e.parent,e.pos,e.index(),n,r);if(a)return a;for(let s=e.depth-1;s>=0;s--){let o=n<0?eb(e.node(0),e.node(s),e.before(s+1),e.index(s),n,r):eb(e.node(0),e.node(s),e.after(s+1),e.index(s)+1,n,r);if(o)return o}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new Oo(e.node(0))}static atStart(e){return eb(e,e,0,0,1)||new Oo(e)}static atEnd(e){return eb(e,e,e.content.size,e.childCount,-1)||new Oo(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=yj[n.type];if(!r)throw new RangeError(`No selection type ${n.type} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in yj)throw new RangeError("Duplicate use of selection JSON ID "+e);return yj[e]=n,n.prototype.jsonID=e,n}getBookmark(){return jn.between(this.$anchor,this.$head).getBookmark()}}Yn.prototype.visible=!0;class PVe{constructor(e,n){this.$from=e,this.$to=n}}let YG=!1;function XG(t){!YG&&!t.parent.inlineContent&&(YG=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class jn extends Yn{constructor(e,n=e){XG(e),XG(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let r=e.resolve(n.map(this.head));if(!r.parent.inlineContent)return Yn.near(r);let a=e.resolve(n.map(this.anchor));return new jn(a.parent.inlineContent?a:r,r)}replace(e,n=Wt.empty){if(super.replace(e,n),n==Wt.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof jn&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new AT(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 jn(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let a=e.resolve(n);return new this(a,r==n?a:e.resolve(r))}static between(e,n,r){let a=e.pos-n.pos;if((!r||a)&&(r=a>=0?1:-1),!n.parent.inlineContent){let s=Yn.findFrom(n,r,!0)||Yn.findFrom(n,-r,!0);if(s)n=s.$head;else return Yn.near(n,r)}return e.parent.inlineContent||(a==0?e=n:(e=(Yn.findFrom(e,-r,!0)||Yn.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=a<0&&(e=n))),new jn(e,n)}}Yn.jsonID("text",jn);class AT{constructor(e,n){this.anchor=e,this.head=n}map(e){return new AT(e.map(this.anchor),e.map(this.head))}resolve(e){return jn.between(e.resolve(this.anchor),e.resolve(this.head))}}class gn extends Yn{constructor(e){let n=e.nodeAfter,r=e.node(0).resolve(e.pos+n.nodeSize);super(e,r),this.node=n}map(e,n){let{deleted:r,pos:a}=n.mapResult(this.anchor),s=e.resolve(a);return r?Yn.near(s):new gn(s)}content(){return new Wt(Lt.from(this.node),0,0)}eq(e){return e instanceof gn&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new U4(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new gn(e.resolve(n.anchor))}static create(e,n){return new gn(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}gn.prototype.visible=!1;Yn.jsonID("node",gn);class U4{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new AT(r,r):new U4(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&gn.isSelectable(r)?new gn(n):Yn.near(n)}}class Oo extends Yn{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 r=Yn.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new Oo(e)}map(e){return new Oo(e)}eq(e){return e instanceof Oo}getBookmark(){return AVe}}Yn.jsonID("all",Oo);const AVe={map(){return this},resolve(t){return new Oo(t)}};function eb(t,e,n,r,a,s=!1){if(e.inlineContent)return jn.create(t,n);for(let o=r-(a>0?0:1);a>0?o<e.childCount:o>=0;o+=a){let l=e.child(o);if(l.isAtom){if(!s&&gn.isSelectable(l))return gn.create(t,n-(a<0?l.nodeSize:0))}else{let c=eb(t,l,n+a,a<0?l.childCount:0,a,s);if(c)return c}n+=l.nodeSize*a}return null}function QG(t,e,n){let r=t.steps.length-1;if(r<e)return;let a=t.steps[r];if(!(a instanceof Da||a instanceof Fa))return;let s=t.mapping.maps[r],o;s.forEach((l,c,d,u)=>{o==null&&(o=u)}),t.setSelection(Yn.near(t.doc.resolve(o),n))}const ZG=1,V_=2,JG=4;class MVe extends Bre{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|ZG)&~V_,this.storedMarks=null,this}get selectionSet(){return(this.updated&ZG)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=V_,this}ensureMarks(e){return Yr.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&V_)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~V_,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,n=!0){let r=this.selection;return n&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||Yr.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,r){let a=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(a.text(e),!0):this.deleteSelection();{if(r==null&&(r=n),!e)return this.deleteRange(n,r);let s=this.storedMarks;if(!s){let o=this.doc.resolve(n);s=r==n?o.marks():o.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,a.text(e,s)),!this.selection.empty&&this.selection.to==n+e.length&&this.setSelection(Yn.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|=JG,this}get scrolledIntoView(){return(this.updated&JG)>0}}function eW(t,e){return!e||!t?t:t.bind(e)}class ev{constructor(e,n,r){this.name=e,this.init=eW(n.init,r),this.apply=eW(n.apply,r)}}const EVe=[new ev("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new ev("selection",{init(t,e){return t.selection||Yn.atStart(e.doc)},apply(t){return t.selection}}),new ev("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new ev("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class vj{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=EVe.slice(),n&&n.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new ev(r.key,r.spec.state,r))})}}class db{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 r=0;r<this.config.plugins.length;r++)if(r!=n){let a=this.config.plugins[r];if(a.spec.filterTransaction&&!a.spec.filterTransaction.call(a,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let n=[e],r=this.applyInner(e),a=null;for(;;){let s=!1;for(let o=0;o<this.config.plugins.length;o++){let l=this.config.plugins[o];if(l.spec.appendTransaction){let c=a?a[o].n:0,d=a?a[o].state:this,u=c<n.length&&l.spec.appendTransaction.call(l,c?n.slice(c):n,d,r);if(u&&r.filterTransaction(u,o)){if(u.setMeta("appendedTransaction",e),!a){a=[];for(let m=0;m<this.config.plugins.length;m++)a.push(m<o?{state:r,n:n.length}:{state:this,n:0})}n.push(u),r=r.applyInner(u),s=!0}a&&(a[o]={state:r,n:n.length})}}if(!s)return{state:r,transactions:n}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new db(this.config),r=this.config.fields;for(let a=0;a<r.length;a++){let s=r[a];n[s.name]=s.apply(e,this[s.name],this,n)}return n}get tr(){return new MVe(this)}static create(e){let n=new vj(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new db(n);for(let a=0;a<n.fields.length;a++)r[n.fields[a].name]=n.fields[a].init(e,r);return r}reconfigure(e){let n=new vj(this.schema,e.plugins),r=n.fields,a=new db(n);for(let s=0;s<r.length;s++){let o=r[s].name;a[o]=this.hasOwnProperty(o)?this[o]:r[s].init(e,a)}return a}toJSON(e){let n={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(n.storedMarks=this.storedMarks.map(r=>r.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let a=e[r],s=a.spec.state;s&&s.toJSON&&(n[r]=s.toJSON.call(a,this[a.key]))}return n}static fromJSON(e,n,r){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let a=new vj(e.schema,e.plugins),s=new db(a);return a.fields.forEach(o=>{if(o.name=="doc")s.doc=Jm.fromJSON(e.schema,n.doc);else if(o.name=="selection")s.selection=Yn.fromJSON(s.doc,n.selection);else if(o.name=="storedMarks")n.storedMarks&&(s.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let l in r){let c=r[l],d=c.spec.state;if(c.key==o.name&&d&&d.fromJSON&&Object.prototype.hasOwnProperty.call(n,l)){s[o.name]=d.fromJSON.call(c,e,n[l],s);return}}s[o.name]=o.init(e,s)}}),s}}function Hre(t,e,n){for(let r in t){let a=t[r];a instanceof Function?a=a.bind(e):r=="handleDOMEvents"&&(a=Hre(a,e,{})),n[r]=a}return n}class Ci{constructor(e){this.spec=e,this.props={},e.props&&Hre(e.props,this,this.props),this.key=e.key?e.key.key:$re("plugin")}getState(e){return e[this.key]}}const wj=Object.create(null);function $re(t){return t in wj?t+"$"+ ++wj[t]:(wj[t]=0,t+"$")}class _a{constructor(e="key"){this.key=$re(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const B4=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function qre(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const Vre=(t,e,n)=>{let r=qre(t,n);if(!r)return!1;let a=H4(r);if(!a){let o=r.blockRange(),l=o&&Tx(o);return l==null?!1:(e&&e(t.tr.lift(o,l).scrollIntoView()),!0)}let s=a.nodeBefore;if(eie(t,a,e,-1))return!0;if(r.parent.content.size==0&&(Qb(s,"end")||gn.isSelectable(s)))for(let o=r.depth;;o--){let l=PT(t.doc,r.before(o),r.after(o),Wt.empty);if(l&&l.slice.size<l.to-l.from){if(e){let c=t.tr.step(l);c.setSelection(Qb(s,"end")?Yn.findFrom(c.doc.resolve(c.mapping.map(a.pos,-1)),-1):gn.create(c.doc,a.pos-s.nodeSize)),e(c.scrollIntoView())}return!0}if(o==1||r.node(o-1).childCount>1)break}return s.isAtom&&a.depth==r.depth-1?(e&&e(t.tr.delete(a.pos-s.nodeSize,a.pos).scrollIntoView()),!0):!1},jVe=(t,e,n)=>{let r=qre(t,n);if(!r)return!1;let a=H4(r);return a?Gre(t,a,e):!1},DVe=(t,e,n)=>{let r=Kre(t,n);if(!r)return!1;let a=$4(r);return a?Gre(t,a,e):!1};function Gre(t,e,n){let r=e.nodeBefore,a=r,s=e.pos-1;for(;!a.isTextblock;s--){if(a.type.spec.isolating)return!1;let u=a.lastChild;if(!u)return!1;a=u}let o=e.nodeAfter,l=o,c=e.pos+1;for(;!l.isTextblock;c++){if(l.type.spec.isolating)return!1;let u=l.firstChild;if(!u)return!1;l=u}let d=PT(t.doc,s,c,Wt.empty);if(!d||d.from!=s||d instanceof Da&&d.slice.size>=c-s)return!1;if(n){let u=t.tr.step(d);u.setSelection(jn.create(u.doc,s)),n(u.scrollIntoView())}return!0}function Qb(t,e,n=!1){for(let r=t;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}const Wre=(t,e,n)=>{let{$head:r,empty:a}=t.selection,s=r;if(!a)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;s=H4(r)}let o=s&&s.nodeBefore;return!o||!gn.isSelectable(o)?!1:(e&&e(t.tr.setSelection(gn.create(t.doc,s.pos-o.nodeSize)).scrollIntoView()),!0)};function H4(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 Kre(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}const Yre=(t,e,n)=>{let r=Kre(t,n);if(!r)return!1;let a=$4(r);if(!a)return!1;let s=a.nodeAfter;if(eie(t,a,e,1))return!0;if(r.parent.content.size==0&&(Qb(s,"start")||gn.isSelectable(s))){let o=PT(t.doc,r.before(),r.after(),Wt.empty);if(o&&o.slice.size<o.to-o.from){if(e){let l=t.tr.step(o);l.setSelection(Qb(s,"start")?Yn.findFrom(l.doc.resolve(l.mapping.map(a.pos)),1):gn.create(l.doc,l.mapping.map(a.pos))),e(l.scrollIntoView())}return!0}}return s.isAtom&&a.depth==r.depth-1?(e&&e(t.tr.delete(a.pos,a.pos+s.nodeSize).scrollIntoView()),!0):!1},Xre=(t,e,n)=>{let{$head:r,empty:a}=t.selection,s=r;if(!a)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset<r.parent.content.size)return!1;s=$4(r)}let o=s&&s.nodeAfter;return!o||!gn.isSelectable(o)?!1:(e&&e(t.tr.setSelection(gn.create(t.doc,s.pos)).scrollIntoView()),!0)};function $4(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 RVe=(t,e)=>{let n=t.selection,r=n instanceof gn,a;if(r){if(n.node.isTextblock||!yh(t.doc,n.from))return!1;a=n.from}else if(a=TT(t.doc,n.from,-1),a==null)return!1;if(e){let s=t.tr.join(a);r&&s.setSelection(gn.create(s.doc,a-t.doc.resolve(a).nodeBefore.nodeSize)),e(s.scrollIntoView())}return!0},FVe=(t,e)=>{let n=t.selection,r;if(n instanceof gn){if(n.node.isTextblock||!yh(t.doc,n.to))return!1;r=n.to}else if(r=TT(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},LVe=(t,e)=>{let{$from:n,$to:r}=t.selection,a=n.blockRange(r),s=a&&Tx(a);return s==null?!1:(e&&e(t.tr.lift(a,s).scrollIntoView()),!0)},Qre=(t,e)=>{let{$head:n,$anchor:r}=t.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(e&&e(t.tr.insertText(`
- `).scrollIntoView()),!0)};function q4(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 OVe=(t,e)=>{let{$head:n,$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let a=n.node(-1),s=n.indexAfter(-1),o=q4(a.contentMatchAt(s));if(!o||!a.canReplaceWith(s,s,o))return!1;if(e){let l=n.after(),c=t.tr.replaceWith(l,l,o.createAndFill());c.setSelection(Yn.near(c.doc.resolve(l),1)),e(c.scrollIntoView())}return!0},Zre=(t,e)=>{let n=t.selection,{$from:r,$to:a}=n;if(n instanceof Oo||r.parent.inlineContent||a.parent.inlineContent)return!1;let s=q4(a.parent.contentMatchAt(a.indexAfter()));if(!s||!s.isTextblock)return!1;if(e){let o=(!r.parentOffset&&a.index()<a.parent.childCount?r:a).pos,l=t.tr.insert(o,s.createAndFill());l.setSelection(jn.create(l.doc,o+1)),e(l.scrollIntoView())}return!0},Jre=(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 s=n.before();if(iu(t.doc,s))return e&&e(t.tr.split(s).scrollIntoView()),!0}let r=n.blockRange(),a=r&&Tx(r);return a==null?!1:(e&&e(t.tr.lift(r,a).scrollIntoView()),!0)};function IVe(t){return(e,n)=>{let{$from:r,$to:a}=e.selection;if(e.selection instanceof gn&&e.selection.node.isBlock)return!r.parentOffset||!iu(e.doc,r.pos)?!1:(n&&n(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let s=[],o,l,c=!1,d=!1;for(let f=r.depth;;f--)if(r.node(f).isBlock){c=r.end(f)==r.pos+(r.depth-f),d=r.start(f)==r.pos-(r.depth-f),l=q4(r.node(f-1).contentMatchAt(r.indexAfter(f-1))),s.unshift(c&&l?{type:l}:null),o=f;break}else{if(f==1)return!1;s.unshift(null)}let u=e.tr;(e.selection instanceof jn||e.selection instanceof Oo)&&u.deleteSelection();let m=u.mapping.map(r.pos),p=iu(u.doc,m,s.length,s);if(p||(s[0]=l?{type:l}:null,p=iu(u.doc,m,s.length,s)),!p)return!1;if(u.split(m,s.length,s),!c&&d&&r.node(o).type!=l){let f=u.mapping.map(r.before(o)),y=u.doc.resolve(f);l&&r.node(o-1).canReplaceWith(y.index(),y.index()+1,l)&&u.setNodeMarkup(u.mapping.map(r.before(o)),l)}return n&&n(u.scrollIntoView()),!0}}const zVe=IVe(),UVe=(t,e)=>{let{$from:n,to:r}=t.selection,a,s=n.sharedDepth(r);return s==0?!1:(a=n.before(s),e&&e(t.tr.setSelection(gn.create(t.doc,a))),!0)};function BVe(t,e,n){let r=e.nodeBefore,a=e.nodeAfter,s=e.index();return!r||!a||!r.type.compatibleContent(a.type)?!1:!r.content.size&&e.parent.canReplace(s-1,s)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(s,s+1)||!(a.isTextblock||yh(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function eie(t,e,n,r){let a=e.nodeBefore,s=e.nodeAfter,o,l,c=a.type.spec.isolating||s.type.spec.isolating;if(!c&&BVe(t,e,n))return!0;let d=!c&&e.parent.canReplace(e.index(),e.index()+1);if(d&&(o=(l=a.contentMatchAt(a.childCount)).findWrapping(s.type))&&l.matchType(o[0]||s.type).validEnd){if(n){let f=e.pos+s.nodeSize,y=Lt.empty;for(let v=o.length-1;v>=0;v--)y=Lt.from(o[v].create(null,y));y=Lt.from(a.copy(y));let x=t.tr.step(new Fa(e.pos-1,f,e.pos,f,new Wt(y,1,0),o.length,!0)),b=x.doc.resolve(f+2*o.length);b.nodeAfter&&b.nodeAfter.type==a.type&&yh(x.doc,b.pos)&&x.join(b.pos),n(x.scrollIntoView())}return!0}let u=s.type.spec.isolating||r>0&&c?null:Yn.findFrom(e,1),m=u&&u.$from.blockRange(u.$to),p=m&&Tx(m);if(p!=null&&p>=e.depth)return n&&n(t.tr.lift(m,p).scrollIntoView()),!0;if(d&&Qb(s,"start",!0)&&Qb(a,"end")){let f=a,y=[];for(;y.push(f),!f.isTextblock;)f=f.lastChild;let x=s,b=1;for(;!x.isTextblock;x=x.firstChild)b++;if(f.canReplace(f.childCount,f.childCount,x.content)){if(n){let v=Lt.empty;for(let k=y.length-1;k>=0;k--)v=Lt.from(y[k].copy(v));let _=t.tr.step(new Fa(e.pos-y.length,e.pos+s.nodeSize,e.pos+b,e.pos+s.nodeSize-b,new Wt(v,y.length,0),0,!0));n(_.scrollIntoView())}return!0}}return!1}function tie(t){return function(e,n){let r=e.selection,a=t<0?r.$from:r.$to,s=a.depth;for(;a.node(s).isInline;){if(!s)return!1;s--}return a.node(s).isTextblock?(n&&n(e.tr.setSelection(jn.create(e.doc,t<0?a.start(s):a.end(s)))),!0):!1}}const HVe=tie(-1),$Ve=tie(1);function qVe(t,e=null){return function(n,r){let{$from:a,$to:s}=n.selection,o=a.blockRange(s),l=o&&z4(o,t,e);return l?(r&&r(n.tr.wrap(o,l).scrollIntoView()),!0):!1}}function tW(t,e=null){return function(n,r){let a=!1;for(let s=0;s<n.selection.ranges.length&&!a;s++){let{$from:{pos:o},$to:{pos:l}}=n.selection.ranges[s];n.doc.nodesBetween(o,l,(c,d)=>{if(a)return!1;if(!(!c.isTextblock||c.hasMarkup(t,e)))if(c.type==t)a=!0;else{let u=n.doc.resolve(d),m=u.index();a=u.parent.canReplaceWith(m,m+1,t)}})}if(!a)return!1;if(r){let s=n.tr;for(let o=0;o<n.selection.ranges.length;o++){let{$from:{pos:l},$to:{pos:c}}=n.selection.ranges[o];s.setBlockType(l,c,t,e)}r(s.scrollIntoView())}return!0}}function V4(...t){return function(e,n,r){for(let a=0;a<t.length;a++)if(t[a](e,n,r))return!0;return!1}}V4(B4,Vre,Wre);V4(B4,Yre,Xre);V4(Qre,Zre,Jre,zVe);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function VVe(t,e=null){return function(n,r){let{$from:a,$to:s}=n.selection,o=a.blockRange(s);if(!o)return!1;let l=r?n.tr:null;return GVe(l,o,t,e)?(r&&r(l.scrollIntoView()),!0):!1}}function GVe(t,e,n,r=null){let a=!1,s=e,o=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 c=o.resolve(e.start-2);s=new mN(c,c,e.depth),e.endIndex<e.parent.childCount&&(e=new mN(e.$from,o.resolve(e.$to.end(e.depth)),e.depth)),a=!0}let l=z4(s,n,r,e);return l?(t&&WVe(t,e,l,a,n),!0):!1}function WVe(t,e,n,r,a){let s=Lt.empty;for(let u=n.length-1;u>=0;u--)s=Lt.from(n[u].type.create(n[u].attrs,s));t.step(new Fa(e.start-(r?2:0),e.end,e.start,e.end,new Wt(s,0,0),n.length,!0));let o=0;for(let u=0;u<n.length;u++)n[u].type==a&&(o=u+1);let l=n.length-o,c=e.start+n.length-(r?2:0),d=e.parent;for(let u=e.startIndex,m=e.endIndex,p=!0;u<m;u++,p=!1)!p&&iu(t.doc,c,l)&&(t.split(c,l),c+=2*l),c+=d.child(u).nodeSize;return t}function KVe(t){return function(e,n){let{$from:r,$to:a}=e.selection,s=r.blockRange(a,o=>o.childCount>0&&o.firstChild.type==t);return s?n?r.node(s.depth-1).type==t?YVe(e,n,t,s):XVe(e,n,s):!0:!1}}function YVe(t,e,n,r){let a=t.tr,s=r.end,o=r.$to.end(r.depth);s<o&&(a.step(new Fa(s-1,o,s,o,new Wt(Lt.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new mN(a.doc.resolve(r.$from.pos),a.doc.resolve(o),r.depth));const l=Tx(r);if(l==null)return!1;a.lift(r,l);let c=a.doc.resolve(a.mapping.map(s,-1)-1);return yh(a.doc,c.pos)&&c.nodeBefore.type==c.nodeAfter.type&&a.join(c.pos),e(a.scrollIntoView()),!0}function XVe(t,e,n){let r=t.tr,a=n.parent;for(let f=n.end,y=n.endIndex-1,x=n.startIndex;y>x;y--)f-=a.child(y).nodeSize,r.delete(f-1,f+1);let s=r.doc.resolve(n.start),o=s.nodeAfter;if(r.mapping.map(n.end)!=n.start+s.nodeAfter.nodeSize)return!1;let l=n.startIndex==0,c=n.endIndex==a.childCount,d=s.node(-1),u=s.index(-1);if(!d.canReplace(u+(l?0:1),u+1,o.content.append(c?Lt.empty:Lt.from(a))))return!1;let m=s.pos,p=m+o.nodeSize;return r.step(new Fa(m-(l?1:0),p+(c?1:0),m+1,p-1,new Wt((l?Lt.empty:Lt.from(a.copy(Lt.empty))).append(c?Lt.empty:Lt.from(a.copy(Lt.empty))),l?0:1,c?0:1),l?0:1)),e(r.scrollIntoView()),!0}function QVe(t){return function(e,n){let{$from:r,$to:a}=e.selection,s=r.blockRange(a,d=>d.childCount>0&&d.firstChild.type==t);if(!s)return!1;let o=s.startIndex;if(o==0)return!1;let l=s.parent,c=l.child(o-1);if(c.type!=t)return!1;if(n){let d=c.lastChild&&c.lastChild.type==l.type,u=Lt.from(d?t.create():null),m=new Wt(Lt.from(t.create(null,Lt.from(l.type.create(null,u)))),d?3:1,0),p=s.start,f=s.end;n(e.tr.step(new Fa(p-(d?3:1),f,p,f,m,1,!0)).scrollIntoView())}return!0}}const Ja=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},Zb=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let WR=null;const zd=function(t,e,n){let r=WR||(WR=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},ZVe=function(){WR=null},uf=function(t,e,n,r){return n&&(nW(t,e,n,r,-1)||nW(t,e,n,r,1))},JVe=/^(img|br|input|textarea|hr)$/i;function nW(t,e,n,r,a){for(var s;;){if(t==n&&e==r)return!0;if(e==(a<0?0:ml(t))){let o=t.parentNode;if(!o||o.nodeType!=1||cw(t)||JVe.test(t.nodeName)||t.contentEditable=="false")return!1;e=Ja(t)+(a<0?0:1),t=o}else if(t.nodeType==1){let o=t.childNodes[e+(a<0?-1:0)];if(o.nodeType==1&&o.contentEditable=="false")if(!((s=o.pmViewDesc)===null||s===void 0)&&s.ignoreForSelection)e+=a;else return!1;else t=o,e=a<0?ml(t):0}else return!1}}function ml(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function e7e(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=ml(t)}else if(t.parentNode&&!cw(t))e=Ja(t),t=t.parentNode;else return null}}function t7e(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&&!cw(t))e=Ja(t)+1,t=t.parentNode;else return null}}function n7e(t,e,n){for(let r=e==0,a=e==ml(t);r||a;){if(t==n)return!0;let s=Ja(t);if(t=t.parentNode,!t)return!1;r=r&&s==0,a=a&&s==ml(t)}}function cw(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 MT=function(t){return t.focusNode&&uf(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function up(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function r7e(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function i7e(t,e,n){if(t.caretPositionFromPoint)try{let r=t.caretPositionFromPoint(e,n);if(r)return{node:r.offsetNode,offset:Math.min(ml(r.offsetNode),r.offset)}}catch{}if(t.caretRangeFromPoint){let r=t.caretRangeFromPoint(e,n);if(r)return{node:r.startContainer,offset:Math.min(ml(r.startContainer),r.startOffset)}}}const Yc=typeof navigator<"u"?navigator:null,rW=typeof document<"u"?document:null,vh=Yc&&Yc.userAgent||"",KR=/Edge\/(\d+)/.exec(vh),nie=/MSIE \d/.exec(vh),YR=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(vh),lo=!!(nie||YR||KR),eh=nie?document.documentMode:YR?+YR[1]:KR?+KR[1]:0,bl=!lo&&/gecko\/(\d+)/i.test(vh);bl&&+(/Firefox\/(\d+)/.exec(vh)||[0,0])[1];const XR=!lo&&/Chrome\/(\d+)/.exec(vh),ts=!!XR,rie=XR?+XR[1]:0,xs=!lo&&!!Yc&&/Apple Computer/.test(Yc.vendor),Jb=xs&&(/Mobile\/\w+/.test(vh)||!!Yc&&Yc.maxTouchPoints>2),sl=Jb||(Yc?/Mac/.test(Yc.platform):!1),iie=Yc?/Win/.test(Yc.platform):!1,Xd=/Android \d/.test(vh),dw=!!rW&&"webkitFontSmoothing"in rW.documentElement.style,a7e=dw?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function s7e(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 jd(t,e){return typeof t=="number"?t:t[e]}function o7e(t){let e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,r=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*r}}function iW(t,e,n){let r=t.someProp("scrollThreshold")||0,a=t.someProp("scrollMargin")||5,s=t.dom.ownerDocument;for(let o=n||t.dom;o;){if(o.nodeType!=1){o=Zb(o);continue}let l=o,c=l==s.body,d=c?s7e(s):o7e(l),u=0,m=0;if(e.top<d.top+jd(r,"top")?m=-(d.top-e.top+jd(a,"top")):e.bottom>d.bottom-jd(r,"bottom")&&(m=e.bottom-e.top>d.bottom-d.top?e.top+jd(a,"top")-d.top:e.bottom-d.bottom+jd(a,"bottom")),e.left<d.left+jd(r,"left")?u=-(d.left-e.left+jd(a,"left")):e.right>d.right-jd(r,"right")&&(u=e.right-d.right+jd(a,"right")),u||m)if(c)s.defaultView.scrollBy(u,m);else{let f=l.scrollLeft,y=l.scrollTop;m&&(l.scrollTop+=m),u&&(l.scrollLeft+=u);let x=l.scrollLeft-f,b=l.scrollTop-y;e={left:e.left-x,top:e.top-b,right:e.right-x,bottom:e.bottom-b}}let p=c?"fixed":getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(p))break;o=p=="absolute"?o.offsetParent:Zb(o)}}function l7e(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,a;for(let s=(e.left+e.right)/2,o=n+1;o<Math.min(innerHeight,e.bottom);o+=5){let l=t.root.elementFromPoint(s,o);if(!l||l==t.dom||!t.dom.contains(l))continue;let c=l.getBoundingClientRect();if(c.top>=n-20){r=l,a=c.top;break}}return{refDOM:r,refTop:a,stack:aie(t.dom)}}function aie(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=Zb(r));return e}function c7e({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;sie(n,r==0?0:r-e)}function sie(t,e){for(let n=0;n<t.length;n++){let{dom:r,top:a,left:s}=t[n];r.scrollTop!=a+e&&(r.scrollTop=a+e),r.scrollLeft!=s&&(r.scrollLeft=s)}}let Vg=null;function d7e(t){if(t.setActive)return t.setActive();if(Vg)return t.focus(Vg);let e=aie(t);t.focus(Vg==null?{get preventScroll(){return Vg={preventScroll:!0},!0}}:void 0),Vg||(Vg=!1,sie(e,0))}function oie(t,e){let n,r=2e8,a,s=0,o=e.top,l=e.top,c,d;for(let u=t.firstChild,m=0;u;u=u.nextSibling,m++){let p;if(u.nodeType==1)p=u.getClientRects();else if(u.nodeType==3)p=zd(u).getClientRects();else continue;for(let f=0;f<p.length;f++){let y=p[f];if(y.top<=o&&y.bottom>=l){o=Math.max(y.bottom,o),l=Math.min(y.top,l);let x=y.left>e.left?y.left-e.left:y.right<e.left?e.left-y.right:0;if(x<r){n=u,r=x,a=x&&n.nodeType==3?{left:y.right<e.left?y.right:y.left,top:e.top}:e,u.nodeType==1&&x&&(s=m+(e.left>=(y.left+y.right)/2?1:0));continue}}else y.top>e.top&&!c&&y.left<=e.left&&y.right>=e.left&&(c=u,d={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)&&(s=m+1)}}return!n&&c&&(n=c,a=d,r=0),n&&n.nodeType==3?u7e(n,a):!n||r&&n.nodeType==1?{node:t,offset:s}:oie(n,a)}function u7e(t,e){let n=t.nodeValue.length,r=document.createRange(),a;for(let s=0;s<n;s++){r.setEnd(t,s+1),r.setStart(t,s);let o=mm(r,1);if(o.top!=o.bottom&&G4(e,o)){a={node:t,offset:s+(e.left>=(o.left+o.right)/2?1:0)};break}}return r.detach(),a||{node:t,offset:0}}function G4(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function m7e(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function h7e(t,e,n){let{node:r,offset:a}=oie(e,n),s=-1;if(r.nodeType==1&&!r.firstChild){let o=r.getBoundingClientRect();s=o.left!=o.right&&n.left>(o.left+o.right)/2?1:-1}return t.docView.posFromDOM(r,a,s)}function p7e(t,e,n,r){let a=-1;for(let s=e,o=!1;s!=t.dom;){let l=t.docView.nearestDesc(s,!0),c;if(!l)return null;if(l.dom.nodeType==1&&(l.node.isBlock&&l.parent||!l.contentDOM)&&((c=l.dom.getBoundingClientRect()).width||c.height)&&(l.node.isBlock&&l.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(l.dom.nodeName)&&(!o&&c.left>r.left||c.top>r.top?a=l.posBefore:(!o&&c.right<r.left||c.bottom<r.top)&&(a=l.posAfter),o=!0),!l.contentDOM&&a<0&&!l.node.isText))return(l.node.isBlock?r.top<(c.top+c.bottom)/2:r.left<(c.left+c.right)/2)?l.posBefore:l.posAfter;s=l.dom.parentNode}return a>-1?a:t.docView.posFromDOM(e,n,-1)}function lie(t,e,n){let r=t.childNodes.length;if(r&&n.top<n.bottom)for(let a=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-n.top)/(n.bottom-n.top))-2)),s=a;;){let o=t.childNodes[s];if(o.nodeType==1){let l=o.getClientRects();for(let c=0;c<l.length;c++){let d=l[c];if(G4(e,d))return lie(o,e,d)}}if((s=(s+1)%r)==a)break}return t}function f7e(t,e){let n=t.dom.ownerDocument,r,a=0,s=i7e(n,e.left,e.top);s&&({node:r,offset:a}=s);let o=(t.root.elementFromPoint?t.root:n).elementFromPoint(e.left,e.top),l;if(!o||!t.dom.contains(o.nodeType!=1?o.parentNode:o)){let d=t.dom.getBoundingClientRect();if(!G4(e,d)||(o=lie(t.dom,e,d),!o))return null}if(xs)for(let d=o;r&&d;d=Zb(d))d.draggable&&(r=void 0);if(o=m7e(o,e),r){if(bl&&r.nodeType==1&&(a=Math.min(a,r.childNodes.length),a<r.childNodes.length)){let u=r.childNodes[a],m;u.nodeName=="IMG"&&(m=u.getBoundingClientRect()).right<=e.left&&m.bottom>e.top&&a++}let d;dw&&a&&r.nodeType==1&&(d=r.childNodes[a-1]).nodeType==1&&d.contentEditable=="false"&&d.getBoundingClientRect().top>=e.top&&a--,r==t.dom&&a==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?l=t.state.doc.content.size:(a==0||r.nodeType!=1||r.childNodes[a-1].nodeName!="BR")&&(l=p7e(t,r,a,e))}l==null&&(l=h7e(t,o,e));let c=t.docView.nearestDesc(o,!0);return{pos:l,inside:c?c.posAtStart-c.border:-1}}function aW(t){return t.top<t.bottom||t.left<t.right}function mm(t,e){let n=t.getClientRects();if(n.length){let r=n[e<0?0:n.length-1];if(aW(r))return r}return Array.prototype.find.call(n,aW)||t.getBoundingClientRect()}const g7e=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function cie(t,e,n){let{node:r,offset:a,atom:s}=t.docView.domFromPos(e,n<0?-1:1),o=dw||bl;if(r.nodeType==3)if(o&&(g7e.test(r.nodeValue)||(n<0?!a:a==r.nodeValue.length))){let c=mm(zd(r,a,a),n);if(bl&&a&&/\s/.test(r.nodeValue[a-1])&&a<r.nodeValue.length){let d=mm(zd(r,a-1,a-1),-1);if(d.top==c.top){let u=mm(zd(r,a,a+1),-1);if(u.top!=c.top)return By(u,u.left<d.left)}}return c}else{let c=a,d=a,u=n<0?1:-1;return n<0&&!a?(d++,u=-1):n>=0&&a==r.nodeValue.length?(c--,u=1):n<0?c--:d++,By(mm(zd(r,c,d),u),u<0)}if(!t.state.doc.resolve(e-(s||0)).parent.inlineContent){if(s==null&&a&&(n<0||a==ml(r))){let c=r.childNodes[a-1];if(c.nodeType==1)return Sj(c.getBoundingClientRect(),!1)}if(s==null&&a<ml(r)){let c=r.childNodes[a];if(c.nodeType==1)return Sj(c.getBoundingClientRect(),!0)}return Sj(r.getBoundingClientRect(),n>=0)}if(s==null&&a&&(n<0||a==ml(r))){let c=r.childNodes[a-1],d=c.nodeType==3?zd(c,ml(c)-(o?0:1)):c.nodeType==1&&(c.nodeName!="BR"||!c.nextSibling)?c:null;if(d)return By(mm(d,1),!1)}if(s==null&&a<ml(r)){let c=r.childNodes[a];for(;c.pmViewDesc&&c.pmViewDesc.ignoreForCoords;)c=c.nextSibling;let d=c?c.nodeType==3?zd(c,0,o?0:1):c.nodeType==1?c:null:null;if(d)return By(mm(d,-1),!0)}return By(mm(r.nodeType==3?zd(r):r,-n),n>=0)}function By(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 Sj(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 die(t,e,n){let r=t.state,a=t.root.activeElement;r!=e&&t.updateState(e),a!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),a!=t.dom&&a&&a.focus()}}function b7e(t,e,n){let r=e.selection,a=n=="up"?r.$from:r.$to;return die(t,e,()=>{let{node:s}=t.docView.domFromPos(a.pos,n=="up"?-1:1);for(;;){let l=t.docView.nearestDesc(s,!0);if(!l)break;if(l.node.isBlock){s=l.contentDOM||l.dom;break}s=l.dom.parentNode}let o=cie(t,a.pos,1);for(let l=s.firstChild;l;l=l.nextSibling){let c;if(l.nodeType==1)c=l.getClientRects();else if(l.nodeType==3)c=zd(l,0,l.nodeValue.length).getClientRects();else continue;for(let d=0;d<c.length;d++){let u=c[d];if(u.bottom>u.top+1&&(n=="up"?o.top-u.top>(u.bottom-o.top)*2:u.bottom-o.bottom>(o.bottom-u.top)*2))return!1}}return!0})}const x7e=/[\u0590-\u08ac]/;function y7e(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let a=r.parentOffset,s=!a,o=a==r.parent.content.size,l=t.domSelection();return l?!x7e.test(r.parent.textContent)||!l.modify?n=="left"||n=="backward"?s:o:die(t,e,()=>{let{focusNode:c,focusOffset:d,anchorNode:u,anchorOffset:m}=t.domSelectionRange(),p=l.caretBidiLevel;l.modify("move",n,"character");let f=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:y,focusOffset:x}=t.domSelectionRange(),b=y&&!f.contains(y.nodeType==1?y:y.parentNode)||c==y&&d==x;try{l.collapse(u,m),c&&(c!=u||d!=m)&&l.extend&&l.extend(c,d)}catch{}return p!=null&&(l.caretBidiLevel=p),b}):r.pos==r.start()||r.pos==r.end()}let sW=null,oW=null,lW=!1;function v7e(t,e,n){return sW==e&&oW==n?lW:(sW=e,oW=n,lW=n=="up"||n=="down"?b7e(t,e,n):y7e(t,e,n))}const xl=0,cW=1,Sp=2,Xc=3;class uw{constructor(e,n,r,a){this.parent=e,this.children=n,this.dom=r,this.contentDOM=a,this.dirty=xl,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,r){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,r=this.posAtStart;;n++){let a=this.children[n];if(a==e)return r;r+=a.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,r){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(r<0){let s,o;if(e==this.contentDOM)s=e.childNodes[n-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.previousSibling}for(;s&&!((o=s.pmViewDesc)&&o.parent==this);)s=s.previousSibling;return s?this.posBeforeChild(o)+o.size:this.posAtStart}else{let s,o;if(e==this.contentDOM)s=e.childNodes[n];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.nextSibling}for(;s&&!((o=s.pmViewDesc)&&o.parent==this);)s=s.nextSibling;return s?this.posBeforeChild(o):this.posAtEnd}let a;if(e==this.dom&&this.contentDOM)a=n>Ja(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))a=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let s=e;;s=s.parentNode){if(s==this.dom){a=!1;break}if(s.previousSibling)break}if(a==null&&n==e.childNodes.length)for(let s=e;;s=s.parentNode){if(s==this.dom){a=!0;break}if(s.nextSibling)break}}return a??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let r=!0,a=e;a;a=a.parentNode){let s=this.getDesc(a),o;if(s&&(!n||s.node))if(r&&(o=s.nodeDOM)&&!(o.nodeType==1?o.contains(e.nodeType==1?e:e.parentNode):o==e))r=!1;else return s}}getDesc(e){let n=e.pmViewDesc;for(let r=n;r;r=r.parent)if(r==this)return n}posFromDOM(e,n,r){for(let a=e;a;a=a.parentNode){let s=this.getDesc(a);if(s)return s.localPosFromDOM(e,n,r)}return-1}descAt(e){for(let n=0,r=0;n<this.children.length;n++){let a=this.children[n],s=r+a.size;if(r==e&&s!=r){for(;!a.border&&a.children.length;)for(let o=0;o<a.children.length;o++){let l=a.children[o];if(l.size){a=l;break}}return a}if(e<s)return a.descAt(e-r-a.border);r=s}}domFromPos(e,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,a=0;for(let s=0;r<this.children.length;r++){let o=this.children[r],l=s+o.size;if(l>e||o instanceof mie){a=e-s;break}s=l}if(a)return this.children[r].domFromPos(a-this.children[r].border,n);for(let s;r&&!(s=this.children[r-1]).size&&s instanceof uie&&s.side>=0;r--);if(n<=0){let s,o=!0;for(;s=r?this.children[r-1]:null,!(!s||s.dom.parentNode==this.contentDOM);r--,o=!1);return s&&n&&o&&!s.border&&!s.domAtom?s.domFromPos(s.size,n):{node:this.contentDOM,offset:s?Ja(s.dom)+1:0}}else{let s,o=!0;for(;s=r<this.children.length?this.children[r]:null,!(!s||s.dom.parentNode==this.contentDOM);r++,o=!1);return s&&o&&!s.border&&!s.domAtom?s.domFromPos(0,n):{node:this.contentDOM,offset:s?Ja(s.dom):this.contentDOM.childNodes.length}}}parseRange(e,n,r=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:n,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let a=-1,s=-1;for(let o=r,l=0;;l++){let c=this.children[l],d=o+c.size;if(a==-1&&e<=d){let u=o+c.border;if(e>=u&&n<=d-c.border&&c.node&&c.contentDOM&&this.contentDOM.contains(c.contentDOM))return c.parseRange(e,n,u);e=o;for(let m=l;m>0;m--){let p=this.children[m-1];if(p.size&&p.dom.parentNode==this.contentDOM&&!p.emptyChildAt(1)){a=Ja(p.dom)+1;break}e-=p.size}a==-1&&(a=0)}if(a>-1&&(d>n||l==this.children.length-1)){n=d;for(let u=l+1;u<this.children.length;u++){let m=this.children[u];if(m.size&&m.dom.parentNode==this.contentDOM&&!m.emptyChildAt(-1)){s=Ja(m.dom);break}n+=m.size}s==-1&&(s=this.contentDOM.childNodes.length);break}o=d}return{node:this.contentDOM,from:e,to:n,fromOffset:a,toOffset:s}}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:r}=this.domFromPos(e,0);if(n.nodeType!=1||r==n.childNodes.length)throw new RangeError("No node after pos "+e);return n.childNodes[r]}setSelection(e,n,r,a=!1){let s=Math.min(e,n),o=Math.max(e,n);for(let f=0,y=0;f<this.children.length;f++){let x=this.children[f],b=y+x.size;if(s>y&&o<b)return x.setSelection(e-y-x.border,n-y-x.border,r,a);y=b}let l=this.domFromPos(e,e?-1:1),c=n==e?l:this.domFromPos(n,n?-1:1),d=r.root.getSelection(),u=r.domSelectionRange(),m=!1;if((bl||xs)&&e==n){let{node:f,offset:y}=l;if(f.nodeType==3){if(m=!!(y&&f.nodeValue[y-1]==`
- `),m&&y==f.nodeValue.length)for(let x=f,b;x;x=x.parentNode){if(b=x.nextSibling){b.nodeName=="BR"&&(l=c={node:b.parentNode,offset:Ja(b)+1});break}let v=x.pmViewDesc;if(v&&v.node&&v.node.isBlock)break}}else{let x=f.childNodes[y-1];m=x&&(x.nodeName=="BR"||x.contentEditable=="false")}}if(bl&&u.focusNode&&u.focusNode!=c.node&&u.focusNode.nodeType==1){let f=u.focusNode.childNodes[u.focusOffset];f&&f.contentEditable=="false"&&(a=!0)}if(!(a||m&&xs)&&uf(l.node,l.offset,u.anchorNode,u.anchorOffset)&&uf(c.node,c.offset,u.focusNode,u.focusOffset))return;let p=!1;if((d.extend||e==n)&&!(m&&bl)){d.collapse(l.node,l.offset);try{e!=n&&d.extend(c.node,c.offset),p=!0}catch{}}if(!p){if(e>n){let y=l;l=c,c=y}let f=document.createRange();f.setEnd(c.node,c.offset),f.setStart(l.node,l.offset),d.removeAllRanges(),d.addRange(f)}}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 r=0,a=0;a<this.children.length;a++){let s=this.children[a],o=r+s.size;if(r==o?e<=o&&n>=r:e<o&&n>r){let l=r+s.border,c=o-s.border;if(e>=l&&n<=c){this.dirty=e==r||n==o?Sp:cW,e==l&&n==c&&(s.contentLost||s.dom.parentNode!=this.contentDOM)?s.dirty=Xc:s.markDirty(e-l,n-l);return}else s.dirty=s.dom==s.contentDOM&&s.dom.parentNode==this.contentDOM&&!s.children.length?Sp:Xc}r=o}this.dirty=Sp}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?Sp:cW;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class uie extends uw{constructor(e,n,r,a){let s,o=n.type.toDOM;if(typeof o=="function"&&(o=o(r,()=>{if(!s)return a;if(s.parent)return s.parent.posBeforeChild(s)})),!n.type.spec.raw){if(o.nodeType!=1){let l=document.createElement("span");l.appendChild(o),o=l}o.contentEditable="false",o.classList.add("ProseMirror-widget")}super(e,[],o,null),this.widget=n,this.widget=n,s=this}matchesWidget(e){return this.dirty==xl&&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 w7e extends uw{constructor(e,n,r,a){super(e,[],n,null),this.textDOM=r,this.text=a}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 mf extends uw{constructor(e,n,r,a,s){super(e,[],r,a),this.mark=n,this.spec=s}static create(e,n,r,a){let s=a.nodeViews[n.type.name],o=s&&s(n,a,r);return(!o||!o.dom)&&(o=Sf.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new mf(e,n,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&Xc||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Xc&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=xl){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=xl}}slice(e,n,r){let a=mf.create(this.parent,this.mark,!0,r),s=this.children,o=this.size;n<o&&(s=ZR(s,n,o,r)),e>0&&(s=ZR(s,0,e,r));for(let l=0;l<s.length;l++)s[l].parent=a;return a.children=s,a}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class th extends uw{constructor(e,n,r,a,s,o,l,c,d){super(e,[],s,o),this.node=n,this.outerDeco=r,this.innerDeco=a,this.nodeDOM=l}static create(e,n,r,a,s,o){let l=s.nodeViews[n.type.name],c,d=l&&l(n,s,()=>{if(!c)return o;if(c.parent)return c.parent.posBeforeChild(c)},r,a),u=d&&d.dom,m=d&&d.contentDOM;if(n.isText){if(!u)u=document.createTextNode(n.text);else if(u.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else u||({dom:u,contentDOM:m}=Sf.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!m&&!n.isText&&u.nodeName!="BR"&&(u.hasAttribute("contenteditable")||(u.contentEditable="false"),n.type.spec.draggable&&(u.draggable=!0));let p=u;return u=fie(u,r,n),d?c=new S7e(e,n,r,a,u,m||null,p,d,s,o+1):n.isText?new ET(e,n,r,a,u,p,s):new th(e,n,r,a,u,m||null,p,s,o+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 r=this.children[n];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>Lt.empty)}return e}matchesNode(e,n,r){return this.dirty==xl&&e.eq(this.node)&&pN(n,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,n){let r=this.node.inlineContent,a=n,s=e.composing?this.localCompositionInfo(e,n):null,o=s&&s.pos>-1?s:null,l=s&&s.pos<0,c=new k7e(this,o&&o.node,e);T7e(this.node,this.innerDeco,(d,u,m)=>{d.spec.marks?c.syncToMarks(d.spec.marks,r,e,u):d.type.side>=0&&!m&&c.syncToMarks(u==this.node.childCount?Yr.none:this.node.child(u).marks,r,e,u),c.placeWidget(d,e,a)},(d,u,m,p)=>{c.syncToMarks(d.marks,r,e,p);let f;c.findNodeMatch(d,u,m,p)||l&&e.state.selection.from>a&&e.state.selection.to<a+d.nodeSize&&(f=c.findIndexWithChild(s.node))>-1&&c.updateNodeAt(d,u,m,f,e)||c.updateNextNode(d,u,m,e,p,a)||c.addNode(d,u,m,e,a),a+=d.nodeSize}),c.syncToMarks([],r,e,0),this.node.isTextblock&&c.addTextblockHacks(),c.destroyRest(),(c.changed||this.dirty==Sp)&&(o&&this.protectLocalComposition(e,o),hie(this.contentDOM,this.children,e),Jb&&P7e(this.dom))}localCompositionInfo(e,n){let{from:r,to:a}=e.state.selection;if(!(e.state.selection instanceof jn)||r<n||a>n+this.node.content.size)return null;let s=e.input.compositionNode;if(!s||!this.dom.contains(s.parentNode))return null;if(this.node.inlineContent){let o=s.nodeValue,l=A7e(this.node.content,o,r-n,a-n);return l<0?null:{node:s,pos:l,text:o}}else return{node:s,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:r,text:a}){if(this.getDesc(n))return;let s=n;for(;s.parentNode!=this.contentDOM;s=s.parentNode){for(;s.previousSibling;)s.parentNode.removeChild(s.previousSibling);for(;s.nextSibling;)s.parentNode.removeChild(s.nextSibling);s.pmViewDesc&&(s.pmViewDesc=void 0)}let o=new w7e(this,s,n,a);e.input.compositionNodes.push(o),this.children=ZR(this.children,r,r+a.length,e,o)}update(e,n,r,a){return this.dirty==Xc||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,r,a),!0)}updateInner(e,n,r,a){this.updateOuterDeco(n),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(a,this.posAtStart),this.dirty=xl}updateOuterDeco(e){if(pN(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=pie(this.dom,this.nodeDOM,QR(this.outerDeco,this.node,n),QR(e,this.node,n)),this.dom!=r&&(r.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 dW(t,e,n,r,a){fie(r,e,t);let s=new th(void 0,t,e,n,r,r,r,a,0);return s.contentDOM&&s.updateChildren(a,0),s}class ET extends th{constructor(e,n,r,a,s,o,l){super(e,n,r,a,s,null,o,l,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,n,r,a){return this.dirty==Xc||this.dirty!=xl&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=xl||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,a.trackWrites==this.nodeDOM&&(a.trackWrites=null)),this.node=e,this.dirty=xl,!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,r){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(e,n,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,n,r){let a=this.node.cut(e,n),s=document.createTextNode(a.text);return new ET(this.parent,a,this.outerDeco,this.innerDeco,s,s,r)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=Xc)}get domAtom(){return!1}isText(e){return this.node.text==e}}class mie extends uw{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==xl&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class S7e extends th{constructor(e,n,r,a,s,o,l,c,d,u){super(e,n,r,a,s,o,l,d,u),this.spec=c}update(e,n,r,a){if(this.dirty==Xc)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let s=this.spec.update(e,n,r);return s&&this.updateInner(e,n,r,a),s}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,r,a)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,r,a){this.spec.setSelection?this.spec.setSelection(e,n,r.root):super.setSelection(e,n,r,a)}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 hie(t,e,n){let r=t.firstChild,a=!1;for(let s=0;s<e.length;s++){let o=e[s],l=o.dom;if(l.parentNode==t){for(;l!=r;)r=uW(r),a=!0;r=r.nextSibling}else a=!0,t.insertBefore(l,r);if(o instanceof mf){let c=r?r.previousSibling:t.lastChild;hie(o.contentDOM,o.children,n),r=c?c.nextSibling:t.firstChild}}for(;r;)r=uW(r),a=!0;a&&n.trackWrites==t&&(n.trackWrites=null)}const xv=function(t){t&&(this.nodeName=t)};xv.prototype=Object.create(null);const _p=[new xv];function QR(t,e,n){if(t.length==0)return _p;let r=n?_p[0]:new xv,a=[r];for(let s=0;s<t.length;s++){let o=t[s].type.attrs;if(o){o.nodeName&&a.push(r=new xv(o.nodeName));for(let l in o){let c=o[l];c!=null&&(n&&a.length==1&&a.push(r=new xv(e.isInline?"span":"div")),l=="class"?r.class=(r.class?r.class+" ":"")+c:l=="style"?r.style=(r.style?r.style+";":"")+c:l!="nodeName"&&(r[l]=c))}}}return a}function pie(t,e,n,r){if(n==_p&&r==_p)return e;let a=e;for(let s=0;s<r.length;s++){let o=r[s],l=n[s];if(s){let c;l&&l.nodeName==o.nodeName&&a!=t&&(c=a.parentNode)&&c.nodeName.toLowerCase()==o.nodeName||(c=document.createElement(o.nodeName),c.pmIsDeco=!0,c.appendChild(a),l=_p[0]),a=c}_7e(a,l||_p[0],o)}return a}function _7e(t,e,n){for(let r in e)r!="class"&&r!="style"&&r!="nodeName"&&!(r in n)&&t.removeAttribute(r);for(let r in n)r!="class"&&r!="style"&&r!="nodeName"&&n[r]!=e[r]&&t.setAttribute(r,n[r]);if(e.class!=n.class){let r=e.class?e.class.split(" ").filter(Boolean):[],a=n.class?n.class.split(" ").filter(Boolean):[];for(let s=0;s<r.length;s++)a.indexOf(r[s])==-1&&t.classList.remove(r[s]);for(let s=0;s<a.length;s++)r.indexOf(a[s])==-1&&t.classList.add(a[s]);t.classList.length==0&&t.removeAttribute("class")}if(e.style!=n.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,a;for(;a=r.exec(e.style);)t.style.removeProperty(a[1])}n.style&&(t.style.cssText+=n.style)}}function fie(t,e,n){return pie(t,t,_p,QR(e,n,t.nodeType!=1))}function pN(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 uW(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class k7e{constructor(e,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=N7e(e.node.content,e)}destroyBetween(e,n){if(e!=n){for(let r=e;r<n;r++)this.top.children[r].destroy();this.top.children.splice(e,n-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,n,r,a){let s=0,o=this.stack.length>>1,l=Math.min(o,e.length);for(;s<l&&(s==o-1?this.top:this.stack[s+1<<1]).matchesMark(e[s])&&e[s].type.spec.spanning!==!1;)s++;for(;s<o;)this.destroyRest(),this.top.dirty=xl,this.index=this.stack.pop(),this.top=this.stack.pop(),o--;for(;o<e.length;){this.stack.push(this.top,this.index+1);let c=-1,d=this.top.children.length;a<this.preMatch.index&&(d=Math.min(this.index+3,d));for(let u=this.index;u<d;u++){let m=this.top.children[u];if(m.matchesMark(e[o])&&!this.isLocked(m.dom)){c=u;break}}if(c>-1)c>this.index&&(this.changed=!0,this.destroyBetween(this.index,c)),this.top=this.top.children[this.index];else{let u=mf.create(this.top,e[o],n,r);this.top.children.splice(this.index,0,u),this.top=u,this.changed=!0}this.index=0,o++}}findNodeMatch(e,n,r,a){let s=-1,o;if(a>=this.preMatch.index&&(o=this.preMatch.matches[a-this.preMatch.index]).parent==this.top&&o.matchesNode(e,n,r))s=this.top.children.indexOf(o,this.index);else for(let l=this.index,c=Math.min(this.top.children.length,l+5);l<c;l++){let d=this.top.children[l];if(d.matchesNode(e,n,r)&&!this.preMatch.matched.has(d)){s=l;break}}return s<0?!1:(this.destroyBetween(this.index,s),this.index++,!0)}updateNodeAt(e,n,r,a,s){let o=this.top.children[a];return o.dirty==Xc&&o.dom==o.contentDOM&&(o.dirty=Sp),o.update(e,n,r,s)?(this.destroyBetween(this.index,a),this.index++,!0):!1}findIndexWithChild(e){for(;;){let n=e.parentNode;if(!n)return-1;if(n==this.top.contentDOM){let r=e.pmViewDesc;if(r){for(let a=this.index;a<this.top.children.length;a++)if(this.top.children[a]==r)return a}return-1}e=n}}updateNextNode(e,n,r,a,s,o){for(let l=this.index;l<this.top.children.length;l++){let c=this.top.children[l];if(c instanceof th){let d=this.preMatch.matched.get(c);if(d!=null&&d!=s)return!1;let u=c.dom,m,p=this.isLocked(u)&&!(e.isText&&c.node&&c.node.isText&&c.nodeDOM.nodeValue==e.text&&c.dirty!=Xc&&pN(n,c.outerDeco));if(!p&&c.update(e,n,r,a))return this.destroyBetween(this.index,l),c.dom!=u&&(this.changed=!0),this.index++,!0;if(!p&&(m=this.recreateWrapper(c,e,n,r,a,o)))return this.destroyBetween(this.index,l),this.top.children[this.index]=m,m.contentDOM&&(m.dirty=Sp,m.updateChildren(a,o+1),m.dirty=xl),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,n,r,a,s,o){if(e.dirty||n.isAtom||!e.children.length||!e.node.content.eq(n.content)||!pN(r,e.outerDeco)||!a.eq(e.innerDeco))return null;let l=th.create(this.top,n,r,a,s,o);if(l.contentDOM){l.children=e.children,e.children=[];for(let c of l.children)c.parent=l}return e.destroy(),l}addNode(e,n,r,a,s){let o=th.create(this.top,e,n,r,a,s);o.contentDOM&&o.updateChildren(a,s+1),this.top.children.splice(this.index++,0,o),this.changed=!0}placeWidget(e,n,r){let a=this.index<this.top.children.length?this.top.children[this.index]:null;if(a&&a.matchesWidget(e)&&(e==a.widget||!a.widget.type.toDOM.parentNode))this.index++;else{let s=new uie(this.top,e,n,r);this.top.children.splice(this.index++,0,s),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],n=this.top;for(;e instanceof mf;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof ET)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((xs||ts)&&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 r=document.createElement(e);e=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),e=="BR"&&(r.className="ProseMirror-trailingBreak");let a=new mie(this.top,[],r,null);n!=this.top?n.children.push(a):n.children.splice(this.index++,0,a),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function N7e(t,e){let n=e,r=n.children.length,a=t.childCount,s=new Map,o=[];e:for(;a>0;){let l;for(;;)if(r){let d=n.children[r-1];if(d instanceof mf)n=d,r=d.children.length;else{l=d,r--;break}}else{if(n==e)break e;r=n.parent.children.indexOf(n),n=n.parent}let c=l.node;if(c){if(c!=t.child(a-1))break;--a,s.set(l,a),o.push(l)}}return{index:a,matched:s,matches:o.reverse()}}function C7e(t,e){return t.type.side-e.type.side}function T7e(t,e,n,r){let a=e.locals(t),s=0;if(a.length==0){for(let d=0;d<t.childCount;d++){let u=t.child(d);r(u,a,e.forChild(s,u),d),s+=u.nodeSize}return}let o=0,l=[],c=null;for(let d=0;;){let u,m;for(;o<a.length&&a[o].to==s;){let b=a[o++];b.widget&&(u?(m||(m=[u])).push(b):u=b)}if(u)if(m){m.sort(C7e);for(let b=0;b<m.length;b++)n(m[b],d,!!c)}else n(u,d,!!c);let p,f;if(c)f=-1,p=c,c=null;else if(d<t.childCount)f=d,p=t.child(d++);else break;for(let b=0;b<l.length;b++)l[b].to<=s&&l.splice(b--,1);for(;o<a.length&&a[o].from<=s&&a[o].to>s;)l.push(a[o++]);let y=s+p.nodeSize;if(p.isText){let b=y;o<a.length&&a[o].from<b&&(b=a[o].from);for(let v=0;v<l.length;v++)l[v].to<b&&(b=l[v].to);b<y&&(c=p.cut(b-s),p=p.cut(0,b-s),y=b,f=-1)}else for(;o<a.length&&a[o].to<y;)o++;let x=p.isInline&&!p.isLeaf?l.filter(b=>!b.inline):l.slice();r(p,x,e.forChild(s,p),f),s=y}}function P7e(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 A7e(t,e,n,r){for(let a=0,s=0;a<t.childCount&&s<=r;){let o=t.child(a++),l=s;if(s+=o.nodeSize,!o.isText)continue;let c=o.text;for(;a<t.childCount;){let d=t.child(a++);if(s+=d.nodeSize,!d.isText)break;c+=d.text}if(s>=n){if(s>=r&&c.slice(r-e.length-l,r-l)==e)return r-e.length;let d=l<r?c.lastIndexOf(e,r-l-1):-1;if(d>=0&&d+e.length+l>=n)return l+d;if(n==r&&c.length>=r+e.length-l&&c.slice(r-l,r-l+e.length)==e)return r}}return-1}function ZR(t,e,n,r,a){let s=[];for(let o=0,l=0;o<t.length;o++){let c=t[o],d=l,u=l+=c.size;d>=n||u<=e?s.push(c):(d<e&&s.push(c.slice(0,e-d,r)),a&&(s.push(a),a=void 0),u>n&&s.push(c.slice(n-d,c.size,r)))}return s}function W4(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let a=t.docView.nearestDesc(n.focusNode),s=a&&a.size==0,o=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(o<0)return null;let l=r.resolve(o),c,d;if(MT(n)){for(c=o;a&&!a.node;)a=a.parent;let m=a.node;if(a&&m.isAtom&&gn.isSelectable(m)&&a.parent&&!(m.isInline&&n7e(n.focusNode,n.focusOffset,a.dom))){let p=a.posBefore;d=new gn(o==p?l:r.resolve(p))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let m=o,p=o;for(let f=0;f<n.rangeCount;f++){let y=n.getRangeAt(f);m=Math.min(m,t.docView.posFromDOM(y.startContainer,y.startOffset,1)),p=Math.max(p,t.docView.posFromDOM(y.endContainer,y.endOffset,-1))}if(m<0)return null;[c,o]=p==t.state.selection.anchor?[p,m]:[m,p],l=r.resolve(o)}else c=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(c<0)return null}let u=r.resolve(c);if(!d){let m=e=="pointer"||t.state.selection.head<l.pos&&!s?1:-1;d=K4(t,u,l,m)}return d}function gie(t){return t.editable?t.hasFocus():xie(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function au(t,e=!1){let n=t.state.selection;if(bie(t,n),!!gie(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&ts){let r=t.domSelectionRange(),a=t.domObserver.currentSelection;if(r.anchorNode&&a.anchorNode&&uf(r.anchorNode,r.anchorOffset,a.anchorNode,a.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)E7e(t);else{let{anchor:r,head:a}=n,s,o;mW&&!(n instanceof jn)&&(n.$from.parent.inlineContent||(s=hW(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(o=hW(t,n.to))),t.docView.setSelection(r,a,t,e),mW&&(s&&pW(s),o&&pW(o)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&M7e(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const mW=xs||ts&&rie<63;function hW(t,e){let{node:n,offset:r}=t.docView.domFromPos(e,0),a=r<n.childNodes.length?n.childNodes[r]:null,s=r?n.childNodes[r-1]:null;if(xs&&a&&a.contentEditable=="false")return _j(a);if((!a||a.contentEditable=="false")&&(!s||s.contentEditable=="false")){if(a)return _j(a);if(s)return _j(s)}}function _j(t){return t.contentEditable="true",xs&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function pW(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function M7e(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let n=t.domSelectionRange(),r=n.anchorNode,a=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=a)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!gie(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function E7e(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,Ja(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&lo&&eh<=11&&(n.disabled=!0,n.disabled=!1)}function bie(t,e){if(e instanceof gn){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(fW(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else fW(t)}function fW(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function K4(t,e,n,r){return t.someProp("createSelectionBetween",a=>a(t,e,n))||jn.between(e,n,r)}function gW(t){return t.editable&&!t.hasFocus()?!1:xie(t)}function xie(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 j7e(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return uf(e.node,e.offset,n.anchorNode,n.anchorOffset)}function JR(t,e){let{$anchor:n,$head:r}=t.selection,a=e>0?n.max(r):n.min(r),s=a.parent.inlineContent?a.depth?t.doc.resolve(e>0?a.after():a.before()):null:a;return s&&Yn.findFrom(s,e)}function xm(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function bW(t,e,n){let r=t.state.selection;if(r instanceof jn)if(n.indexOf("s")>-1){let{$head:a}=r,s=a.textOffset?null:e<0?a.nodeBefore:a.nodeAfter;if(!s||s.isText||!s.isLeaf)return!1;let o=t.state.doc.resolve(a.pos+s.nodeSize*(e<0?-1:1));return xm(t,new jn(r.$anchor,o))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let a=JR(t.state,e);return a&&a instanceof gn?xm(t,a):!1}else if(!(sl&&n.indexOf("m")>-1)){let a=r.$head,s=a.textOffset?null:e<0?a.nodeBefore:a.nodeAfter,o;if(!s||s.isText)return!1;let l=e<0?a.pos-s.nodeSize:a.pos;return s.isAtom||(o=t.docView.descAt(l))&&!o.contentDOM?gn.isSelectable(s)?xm(t,new gn(e<0?t.state.doc.resolve(a.pos-s.nodeSize):a)):dw?xm(t,new jn(t.state.doc.resolve(e<0?l:l+s.nodeSize))):!1:!1}}else return!1;else{if(r instanceof gn&&r.node.isInline)return xm(t,new jn(e>0?r.$to:r.$from));{let a=JR(t.state,e);return a?xm(t,a):!1}}}function fN(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function yv(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function Gg(t,e){return e<0?D7e(t):R7e(t)}function D7e(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let a,s,o=!1;for(bl&&n.nodeType==1&&r<fN(n)&&yv(n.childNodes[r],-1)&&(o=!0);;)if(r>0){if(n.nodeType!=1)break;{let l=n.childNodes[r-1];if(yv(l,-1))a=n,s=--r;else if(l.nodeType==3)n=l,r=n.nodeValue.length;else break}}else{if(yie(n))break;{let l=n.previousSibling;for(;l&&yv(l,-1);)a=n.parentNode,s=Ja(l),l=l.previousSibling;if(l)n=l,r=fN(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}o?eF(t,n,r):a&&eF(t,a,s)}function R7e(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let a=fN(n),s,o;for(;;)if(r<a){if(n.nodeType!=1)break;let l=n.childNodes[r];if(yv(l,1))s=n,o=++r;else break}else{if(yie(n))break;{let l=n.nextSibling;for(;l&&yv(l,1);)s=l.parentNode,o=Ja(l)+1,l=l.nextSibling;if(l)n=l,r=0,a=fN(n);else{if(n=n.parentNode,n==t.dom)break;r=a=0}}}s&&eF(t,s,o)}function yie(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function F7e(t,e){for(;t&&e==t.childNodes.length&&!cw(t);)e=Ja(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 L7e(t,e){for(;t&&!e&&!cw(t);)e=Ja(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 eF(t,e,n){if(e.nodeType!=3){let s,o;(o=F7e(e,n))?(e=o,n=0):(s=L7e(e,n))&&(e=s,n=s.nodeValue.length)}let r=t.domSelection();if(!r)return;if(MT(r)){let s=document.createRange();s.setEnd(e,n),s.setStart(e,n),r.removeAllRanges(),r.addRange(s)}else r.extend&&r.extend(e,n);t.domObserver.setCurSelection();let{state:a}=t;setTimeout(()=>{t.state==a&&au(t)},50)}function xW(t,e){let n=t.state.doc.resolve(e);if(!(ts||iie)&&n.parent.inlineContent){let a=t.coordsAtPos(e);if(e>n.start()){let s=t.coordsAtPos(e-1),o=(s.top+s.bottom)/2;if(o>a.top&&o<a.bottom&&Math.abs(s.left-a.left)>1)return s.left<a.left?"ltr":"rtl"}if(e<n.end()){let s=t.coordsAtPos(e+1),o=(s.top+s.bottom)/2;if(o>a.top&&o<a.bottom&&Math.abs(s.left-a.left)>1)return s.left>a.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function yW(t,e,n){let r=t.state.selection;if(r instanceof jn&&!r.empty||n.indexOf("s")>-1||sl&&n.indexOf("m")>-1)return!1;let{$from:a,$to:s}=r;if(!a.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let o=JR(t.state,e);if(o&&o instanceof gn)return xm(t,o)}if(!a.parent.inlineContent){let o=e<0?a:s,l=r instanceof Oo?Yn.near(o,e):Yn.findFrom(o,e);return l?xm(t,l):!1}return!1}function vW(t,e){if(!(t.state.selection instanceof jn))return!0;let{$head:n,$anchor:r,empty:a}=t.state.selection;if(!n.sameParent(r))return!0;if(!a)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let s=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(s&&!s.isText){let o=t.state.tr;return e<0?o.delete(n.pos-s.nodeSize,n.pos):o.delete(n.pos,n.pos+s.nodeSize),t.dispatch(o),!0}return!1}function wW(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function O7e(t){if(!xs||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 r=e.firstChild;wW(t,r,"true"),setTimeout(()=>wW(t,r,"false"),20)}return!1}function I7e(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function z7e(t,e){let n=e.keyCode,r=I7e(e);if(n==8||sl&&n==72&&r=="c")return vW(t,-1)||Gg(t,-1);if(n==46&&!e.shiftKey||sl&&n==68&&r=="c")return vW(t,1)||Gg(t,1);if(n==13||n==27)return!0;if(n==37||sl&&n==66&&r=="c"){let a=n==37?xW(t,t.state.selection.from)=="ltr"?-1:1:-1;return bW(t,a,r)||Gg(t,a)}else if(n==39||sl&&n==70&&r=="c"){let a=n==39?xW(t,t.state.selection.from)=="ltr"?1:-1:1;return bW(t,a,r)||Gg(t,a)}else{if(n==38||sl&&n==80&&r=="c")return yW(t,-1,r)||Gg(t,-1);if(n==40||sl&&n==78&&r=="c")return O7e(t)||yW(t,1,r)||Gg(t,1);if(r==(sl?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function Y4(t,e){t.someProp("transformCopied",f=>{e=f(e,t)});let n=[],{content:r,openStart:a,openEnd:s}=e;for(;a>1&&s>1&&r.childCount==1&&r.firstChild.childCount==1;){a--,s--;let f=r.firstChild;n.push(f.type.name,f.attrs!=f.type.defaultAttrs?f.attrs:null),r=f.content}let o=t.someProp("clipboardSerializer")||Sf.fromSchema(t.state.schema),l=Nie(),c=l.createElement("div");c.appendChild(o.serializeFragment(r,{document:l}));let d=c.firstChild,u,m=0;for(;d&&d.nodeType==1&&(u=kie[d.nodeName.toLowerCase()]);){for(let f=u.length-1;f>=0;f--){let y=l.createElement(u[f]);for(;c.firstChild;)y.appendChild(c.firstChild);c.appendChild(y),m++}d=c.firstChild}d&&d.nodeType==1&&d.setAttribute("data-pm-slice",`${a} ${s}${m?` -${m}`:""} ${JSON.stringify(n)}`);let p=t.someProp("clipboardTextSerializer",f=>f(e,t))||e.content.textBetween(0,e.content.size,`
- `);return{dom:c,text:p,slice:e}}function vie(t,e,n,r,a){let s=a.parent.type.spec.code,o,l;if(!n&&!e)return null;let c=!!e&&(r||s||!n);if(c){if(t.someProp("transformPastedText",p=>{e=p(e,s||r,t)}),s)return l=new Wt(Lt.from(t.state.schema.text(e.replace(/\r\n?/g,`
- `))),0,0),t.someProp("transformPasted",p=>{l=p(l,t,!0)}),l;let m=t.someProp("clipboardTextParser",p=>p(e,a,r,t));if(m)l=m;else{let p=a.marks(),{schema:f}=t.state,y=Sf.fromSchema(f);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(x=>{let b=o.appendChild(document.createElement("p"));x&&b.appendChild(y.serializeNode(f.text(x,p)))})}}else t.someProp("transformPastedHTML",m=>{n=m(n,t)}),o=$7e(n),dw&&q7e(o);let d=o&&o.querySelector("[data-pm-slice]"),u=d&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(d.getAttribute("data-pm-slice")||"");if(u&&u[3])for(let m=+u[3];m>0;m--){let p=o.firstChild;for(;p&&p.nodeType!=1;)p=p.nextSibling;if(!p)break;o=p}if(l||(l=(t.someProp("clipboardParser")||t.someProp("domParser")||gv.fromSchema(t.state.schema)).parseSlice(o,{preserveWhitespace:!!(c||u),context:a,ruleFromNode(p){return p.nodeName=="BR"&&!p.nextSibling&&p.parentNode&&!U7e.test(p.parentNode.nodeName)?{ignore:!0}:null}})),u)l=V7e(SW(l,+u[1],+u[2]),u[4]);else if(l=Wt.maxOpen(B7e(l.content,a),!0),l.openStart||l.openEnd){let m=0,p=0;for(let f=l.content.firstChild;m<l.openStart&&!f.type.spec.isolating;m++,f=f.firstChild);for(let f=l.content.lastChild;p<l.openEnd&&!f.type.spec.isolating;p++,f=f.lastChild);l=SW(l,m,p)}return t.someProp("transformPasted",m=>{l=m(l,t,c)}),l}const U7e=/^(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 B7e(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let a=e.node(n).contentMatchAt(e.index(n)),s,o=[];if(t.forEach(l=>{if(!o)return;let c=a.findWrapping(l.type),d;if(!c)return o=null;if(d=o.length&&s.length&&Sie(c,s,l,o[o.length-1],0))o[o.length-1]=d;else{o.length&&(o[o.length-1]=_ie(o[o.length-1],s.length));let u=wie(l,c);o.push(u),a=a.matchType(u.type),s=c}}),o)return Lt.from(o)}return t}function wie(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,Lt.from(t));return t}function Sie(t,e,n,r,a){if(a<t.length&&a<e.length&&t[a]==e[a]){let s=Sie(t,e,n,r.lastChild,a+1);if(s)return r.copy(r.content.replaceChild(r.childCount-1,s));if(r.contentMatchAt(r.childCount).matchType(a==t.length-1?n.type:t[a+1]))return r.copy(r.content.append(Lt.from(wie(n,t,a+1))))}}function _ie(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,_ie(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(Lt.empty,!0);return t.copy(n.append(r))}function tF(t,e,n,r,a,s){let o=e<0?t.firstChild:t.lastChild,l=o.content;return t.childCount>1&&(s=0),a<r-1&&(l=tF(l,e,n,r,a+1,s)),a>=n&&(l=e<0?o.contentMatchAt(0).fillBefore(l,s<=a).append(l):l.append(o.contentMatchAt(o.childCount).fillBefore(Lt.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,o.copy(l))}function SW(t,e,n){return e<t.openStart&&(t=new Wt(tF(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new Wt(tF(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const kie={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 _W=null;function Nie(){return _W||(_W=document.implementation.createHTMLDocument("title"))}let kj=null;function H7e(t){let e=window.trustedTypes;return e?(kj||(kj=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),kj.createHTML(t)):t}function $7e(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=Nie().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),a;if((a=r&&kie[r[1].toLowerCase()])&&(t=a.map(s=>"<"+s+">").join("")+t+a.map(s=>"</"+s+">").reverse().join("")),n.innerHTML=H7e(t),a)for(let s=0;s<a.length;s++)n=n.querySelector(a[s])||n;return n}function q7e(t){let e=t.querySelectorAll(ts?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<e.length;n++){let r=e[n];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),r)}}function V7e(t,e){if(!t.size)return t;let n=t.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return t}let{content:a,openStart:s,openEnd:o}=t;for(let l=r.length-2;l>=0;l-=2){let c=n.nodes[r[l]];if(!c||c.hasRequiredAttrs())break;a=Lt.from(c.create(r[l+1],a)),s++,o++}return new Wt(a,s,o)}const Us={},Bs={},G7e={touchstart:!0,touchmove:!0};class W7e{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.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function K7e(t){for(let e in Us){let n=Us[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{X7e(t,r)&&!X4(t,r)&&(t.editable||!(r.type in Bs))&&n(t,r)},G7e[e]?{passive:!0}:void 0)}xs&&t.dom.addEventListener("input",()=>null),nF(t)}function zm(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function Y7e(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 nF(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>X4(t,r))})}function X4(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function X7e(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 Q7e(t,e){!X4(t,e)&&Us[e.type]&&(t.editable||!(e.type in Bs))&&Us[e.type](t,e)}Bs.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!Tie(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(Xd&&ts&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),Jb&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();t.input.lastIOSEnter=r,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==r&&(t.someProp("handleKeyDown",a=>a(t,up(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||z7e(t,n)?n.preventDefault():zm(t,"key")};Bs.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};Bs.keypress=(t,e)=>{let n=e;if(Tie(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||sl&&n.metaKey)return;if(t.someProp("handleKeyPress",a=>a(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof jn)||!r.$from.sameParent(r.$to)){let a=String.fromCharCode(n.charCode),s=()=>t.state.tr.insertText(a).scrollIntoView();!/[\r\n]/.test(a)&&!t.someProp("handleTextInput",o=>o(t,r.$from.pos,r.$to.pos,a,s))&&t.dispatch(s()),n.preventDefault()}};function jT(t){return{left:t.clientX,top:t.clientY}}function Z7e(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function Q4(t,e,n,r,a){if(r==-1)return!1;let s=t.state.doc.resolve(r);for(let o=s.depth+1;o>0;o--)if(t.someProp(e,l=>o>s.depth?l(t,n,s.nodeAfter,s.before(o),a,!0):l(t,n,s.node(o),s.before(o),a,!1)))return!0;return!1}function Nb(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let r=t.state.tr.setSelection(e);r.setMeta("pointer",!0),t.dispatch(r)}function J7e(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&gn.isSelectable(r)?(Nb(t,new gn(n)),!0):!1}function e9e(t,e){if(e==-1)return!1;let n=t.state.selection,r,a;n instanceof gn&&(r=n.node);let s=t.state.doc.resolve(e);for(let o=s.depth+1;o>0;o--){let l=o>s.depth?s.nodeAfter:s.node(o);if(gn.isSelectable(l)){r&&n.$from.depth>0&&o>=n.$from.depth&&s.before(n.$from.depth+1)==n.$from.pos?a=s.before(n.$from.depth):a=s.before(o);break}}return a!=null?(Nb(t,gn.create(t.state.doc,a)),!0):!1}function t9e(t,e,n,r,a){return Q4(t,"handleClickOn",e,n,r)||t.someProp("handleClick",s=>s(t,e,r))||(a?e9e(t,n):J7e(t,n))}function n9e(t,e,n,r){return Q4(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",a=>a(t,e,r))}function r9e(t,e,n,r){return Q4(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",a=>a(t,e,r))||i9e(t,n,r)}function i9e(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(Nb(t,jn.create(r,0,r.content.size)),!0):!1;let a=r.resolve(e);for(let s=a.depth+1;s>0;s--){let o=s>a.depth?a.nodeAfter:a.node(s),l=a.before(s);if(o.inlineContent)Nb(t,jn.create(r,l+1,l+1+o.content.size));else if(gn.isSelectable(o))Nb(t,gn.create(r,l));else continue;return!0}}function Z4(t){return gN(t)}const Cie=sl?"metaKey":"ctrlKey";Us.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=Z4(t),a=Date.now(),s="singleClick";a-t.input.lastClick.time<500&&Z7e(n,t.input.lastClick)&&!n[Cie]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?s="doubleClick":t.input.lastClick.type=="doubleClick"&&(s="tripleClick")),t.input.lastClick={time:a,x:n.clientX,y:n.clientY,type:s,button:n.button};let o=t.posAtCoords(jT(n));o&&(s=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new a9e(t,o,n,!!r)):(s=="doubleClick"?n9e:r9e)(t,o.pos,o.inside,n)?n.preventDefault():zm(t,"pointer"))};class a9e{constructor(e,n,r,a){this.view=e,this.pos=n,this.event=r,this.flushed=a,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[Cie],this.allowDefault=r.shiftKey;let s,o;if(n.inside>-1)s=e.state.doc.nodeAt(n.inside),o=n.inside;else{let u=e.state.doc.resolve(n.pos);s=u.parent,o=u.depth?u.before():0}const l=a?null:r.target,c=l?e.docView.nearestDesc(l,!0):null;this.target=c&&c.nodeDOM.nodeType==1?c.nodeDOM:null;let{selection:d}=e.state;(r.button==0&&s.type.spec.draggable&&s.type.spec.selectable!==!1||d instanceof gn&&d.from<=o&&d.to>o)&&(this.mightDrag={node:s,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&bl&&!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)),zm(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(()=>au(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(jT(e))),this.updateAllowDefault(e),this.allowDefault||!n?zm(this.view,"pointer"):t9e(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||xs&&this.mightDrag&&!this.mightDrag.node.isAtom||ts&&!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)?(Nb(this.view,Yn.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):zm(this.view,"pointer")}move(e){this.updateAllowDefault(e),zm(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)}}Us.touchstart=t=>{t.input.lastTouch=Date.now(),Z4(t),zm(t,"pointer")};Us.touchmove=t=>{t.input.lastTouch=Date.now(),zm(t,"pointer")};Us.contextmenu=t=>Z4(t);function Tie(t,e){return t.composing?!0:xs&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const s9e=Xd?5e3:-1;Bs.compositionstart=Bs.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof jn&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||ts&&iie&&o9e(t)))t.markCursor=t.state.storedMarks||n.marks(),gN(t,!0),t.markCursor=null;else if(gN(t,!e.selection.empty),bl&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let a=r.focusNode,s=r.focusOffset;a&&a.nodeType==1&&s!=0;){let o=s<0?a.lastChild:a.childNodes[s-1];if(!o)break;if(o.nodeType==3){let l=t.domSelection();l&&l.collapse(o,o.nodeValue.length);break}else a=o,s=-1}}t.input.composing=!0}Pie(t,s9e)};function o9e(t){let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(!e||e.nodeType!=1||n>=e.childNodes.length)return!1;let r=e.childNodes[n];return r.nodeType==1&&r.contentEditable=="false"}Bs.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.badSafariComposition?t.domObserver.forceFlush():t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,Pie(t,20))};function Pie(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>gN(t),e))}function Aie(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=c9e());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function l9e(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=e7e(e.focusNode,e.focusOffset),r=t7e(e.focusNode,e.focusOffset);if(n&&r&&n!=r){let a=r.pmViewDesc,s=t.domObserver.lastChangedTextNode;if(n==s||r==s)return s;if(!a||!a.isText(r.nodeValue))return r;if(t.input.compositionNode==r){let o=n.pmViewDesc;if(!(!o||!o.isText(n.nodeValue)))return r}}return n||r}function c9e(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function gN(t,e=!1){if(!(Xd&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),Aie(t),e||t.docView&&t.docView.dirty){let n=W4(t),r=t.state.selection;return n&&!n.eq(r)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function d9e(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 r=getSelection(),a=document.createRange();a.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(a),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const b0=lo&&eh<15||Jb&&a7e<604;Us.copy=Bs.cut=(t,e)=>{let n=e,r=t.state.selection,a=n.type=="cut";if(r.empty)return;let s=b0?null:n.clipboardData,o=r.content(),{dom:l,text:c}=Y4(t,o);s?(n.preventDefault(),s.clearData(),s.setData("text/html",l.innerHTML),s.setData("text/plain",c)):d9e(t,l),a&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function u9e(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function m9e(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let a=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?x0(t,r.value,null,a,e):x0(t,r.textContent,r.innerHTML,a,e)},50)}function x0(t,e,n,r,a){let s=vie(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",c=>c(t,a,s||Wt.empty)))return!0;if(!s)return!1;let o=u9e(s),l=o?t.state.tr.replaceSelectionWith(o,r):t.state.tr.replaceSelection(s);return t.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Mie(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," "):""}Bs.paste=(t,e)=>{let n=e;if(t.composing&&!Xd)return;let r=b0?null:n.clipboardData,a=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&x0(t,Mie(r),r.getData("text/html"),a,n)?n.preventDefault():m9e(t,n)};class Eie{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const h9e=sl?"altKey":"ctrlKey";function jie(t,e){let n=t.someProp("dragCopies",r=>!r(e));return n??!e[h9e]}Us.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let a=t.state.selection,s=a.empty?null:t.posAtCoords(jT(n)),o;if(!(s&&s.pos>=a.from&&s.pos<=(a instanceof gn?a.to-1:a.to))){if(r&&r.mightDrag)o=gn.create(t.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let m=t.docView.nearestDesc(n.target,!0);m&&m.node.type.spec.draggable&&m!=t.docView&&(o=gn.create(t.state.doc,m.posBefore))}}let l=(o||t.state.selection).content(),{dom:c,text:d,slice:u}=Y4(t,l);(!n.dataTransfer.files.length||!ts||rie>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(b0?"Text":"text/html",c.innerHTML),n.dataTransfer.effectAllowed="copyMove",b0||n.dataTransfer.setData("text/plain",d),t.dragging=new Eie(u,jie(t,n),o)};Us.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};Bs.dragover=Bs.dragenter=(t,e)=>e.preventDefault();Bs.drop=(t,e)=>{try{p9e(t,e,t.dragging)}finally{t.dragging=null}};function p9e(t,e,n){if(!e.dataTransfer)return;let r=t.posAtCoords(jT(e));if(!r)return;let a=t.state.doc.resolve(r.pos),s=n&&n.slice;s?t.someProp("transformPasted",f=>{s=f(s,t,!1)}):s=vie(t,Mie(e.dataTransfer),b0?null:e.dataTransfer.getData("text/html"),!1,a);let o=!!(n&&jie(t,e));if(t.someProp("handleDrop",f=>f(t,e,s||Wt.empty,o))){e.preventDefault();return}if(!s)return;e.preventDefault();let l=s?Lre(t.state.doc,a.pos,s):a.pos;l==null&&(l=a.pos);let c=t.state.tr;if(o){let{node:f}=n;f?f.replace(c):c.deleteSelection()}let d=c.mapping.map(l),u=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,m=c.doc;if(u?c.replaceRangeWith(d,d,s.content.firstChild):c.replaceRange(d,d,s),c.doc.eq(m))return;let p=c.doc.resolve(d);if(u&&gn.isSelectable(s.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(s.content.firstChild))c.setSelection(new gn(p));else{let f=c.mapping.map(l);c.mapping.maps[c.mapping.maps.length-1].forEach((y,x,b,v)=>f=v),c.setSelection(K4(t,p,c.doc.resolve(f)))}t.focus(),t.dispatch(c.setMeta("uiEvent","drop"))}Us.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())&&au(t)},20))};Us.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)};Us.beforeinput=(t,e)=>{if(ts&&Xd&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:r}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=r||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",s=>s(t,up(8,"Backspace")))))return;let{$cursor:a}=t.state.selection;a&&a.pos>0&&t.dispatch(t.state.tr.delete(a.pos-1,a.pos).scrollIntoView())},50)}};for(let t in Bs)Us[t]=Bs[t];function y0(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 bN{constructor(e,n){this.toDOM=e,this.spec=n||Lp,this.side=this.spec.side||0}map(e,n,r,a){let{pos:s,deleted:o}=e.mapResult(n.from+a,this.side<0?-1:1);return o?null:new Rs(s-r,s-r,this)}valid(){return!0}eq(e){return this==e||e instanceof bN&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&y0(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class nh{constructor(e,n){this.attrs=e,this.spec=n||Lp}map(e,n,r,a){let s=e.map(n.from+a,this.spec.inclusiveStart?-1:1)-r,o=e.map(n.to+a,this.spec.inclusiveEnd?1:-1)-r;return s>=o?null:new Rs(s,o,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof nh&&y0(this.attrs,e.attrs)&&y0(this.spec,e.spec)}static is(e){return e.type instanceof nh}destroy(){}}class J4{constructor(e,n){this.attrs=e,this.spec=n||Lp}map(e,n,r,a){let s=e.mapResult(n.from+a,1);if(s.deleted)return null;let o=e.mapResult(n.to+a,-1);return o.deleted||o.pos<=s.pos?null:new Rs(s.pos-r,o.pos-r,this)}valid(e,n){let{index:r,offset:a}=e.content.findIndex(n.from),s;return a==n.from&&!(s=e.child(r)).isText&&a+s.nodeSize==n.to}eq(e){return this==e||e instanceof J4&&y0(this.attrs,e.attrs)&&y0(this.spec,e.spec)}destroy(){}}class Rs{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new Rs(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,r){return this.type.map(e,this,n,r)}static widget(e,n,r){return new Rs(e,e,new bN(n,r))}static inline(e,n,r,a){return new Rs(e,n,new nh(r,a))}static node(e,n,r,a){return new Rs(e,n,new J4(r,a))}get spec(){return this.type.spec}get inline(){return this.type instanceof nh}get widget(){return this.type instanceof bN}}const tb=[],Lp={};class wi{constructor(e,n){this.local=e.length?e:tb,this.children=n.length?n:tb}static create(e,n){return n.length?xN(n,e,0,Lp):us}find(e,n,r){let a=[];return this.findInner(e??0,n??1e9,a,0,r),a}findInner(e,n,r,a,s){for(let o=0;o<this.local.length;o++){let l=this.local[o];l.from<=n&&l.to>=e&&(!s||s(l.spec))&&r.push(l.copy(l.from+a,l.to+a))}for(let o=0;o<this.children.length;o+=3)if(this.children[o]<n&&this.children[o+1]>e){let l=this.children[o]+1;this.children[o+2].findInner(e-l,n-l,r,a+l,s)}}map(e,n,r){return this==us||e.maps.length==0?this:this.mapInner(e,n,0,0,r||Lp)}mapInner(e,n,r,a,s){let o;for(let l=0;l<this.local.length;l++){let c=this.local[l].map(e,r,a);c&&c.type.valid(n,c)?(o||(o=[])).push(c):s.onRemove&&s.onRemove(this.local[l].spec)}return this.children.length?f9e(this.children,o||[],e,n,r,a,s):o?new wi(o.sort(Op),tb):us}add(e,n){return n.length?this==us?wi.create(e,n):this.addInner(e,n,0):this}addInner(e,n,r){let a,s=0;e.forEach((l,c)=>{let d=c+r,u;if(u=Rie(n,l,d)){for(a||(a=this.children.slice());s<a.length&&a[s]<c;)s+=3;a[s]==c?a[s+2]=a[s+2].addInner(l,u,d+1):a.splice(s,0,c,c+l.nodeSize,xN(u,l,d+1,Lp)),s+=3}});let o=Die(s?Fie(n):n,-r);for(let l=0;l<o.length;l++)o[l].type.valid(e,o[l])||o.splice(l--,1);return new wi(o.length?this.local.concat(o).sort(Op):this.local,a||this.children)}remove(e){return e.length==0||this==us?this:this.removeInner(e,0)}removeInner(e,n){let r=this.children,a=this.local;for(let s=0;s<r.length;s+=3){let o,l=r[s]+n,c=r[s+1]+n;for(let u=0,m;u<e.length;u++)(m=e[u])&&m.from>l&&m.to<c&&(e[u]=null,(o||(o=[])).push(m));if(!o)continue;r==this.children&&(r=this.children.slice());let d=r[s+2].removeInner(o,l+1);d!=us?r[s+2]=d:(r.splice(s,3),s-=3)}if(a.length){for(let s=0,o;s<e.length;s++)if(o=e[s])for(let l=0;l<a.length;l++)a[l].eq(o,n)&&(a==this.local&&(a=this.local.slice()),a.splice(l--,1))}return r==this.children&&a==this.local?this:a.length||r.length?new wi(a,r):us}forChild(e,n){if(this==us)return this;if(n.isLeaf)return wi.empty;let r,a;for(let l=0;l<this.children.length;l+=3)if(this.children[l]>=e){this.children[l]==e&&(r=this.children[l+2]);break}let s=e+1,o=s+n.content.size;for(let l=0;l<this.local.length;l++){let c=this.local[l];if(c.from<o&&c.to>s&&c.type instanceof nh){let d=Math.max(s,c.from)-s,u=Math.min(o,c.to)-s;d<u&&(a||(a=[])).push(c.copy(d,u))}}if(a){let l=new wi(a.sort(Op),tb);return r?new Nm([l,r]):l}return r||us}eq(e){if(this==e)return!0;if(!(e instanceof wi)||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 eI(this.localsInner(e))}localsInner(e){if(this==us)return tb;if(e.inlineContent||!this.local.some(nh.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof nh||n.push(this.local[r]);return n}forEachSet(e){e(this)}}wi.empty=new wi([],[]);wi.removeOverlap=eI;const us=wi.empty;class Nm{constructor(e){this.members=e}map(e,n){const r=this.members.map(a=>a.map(e,n,Lp));return Nm.from(r)}forChild(e,n){if(n.isLeaf)return wi.empty;let r=[];for(let a=0;a<this.members.length;a++){let s=this.members[a].forChild(e,n);s!=us&&(s instanceof Nm?r=r.concat(s.members):r.push(s))}return Nm.from(r)}eq(e){if(!(e instanceof Nm)||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,r=!0;for(let a=0;a<this.members.length;a++){let s=this.members[a].localsInner(e);if(s.length)if(!n)n=s;else{r&&(n=n.slice(),r=!1);for(let o=0;o<s.length;o++)n.push(s[o])}}return n?eI(r?n:n.sort(Op)):tb}static from(e){switch(e.length){case 0:return us;case 1:return e[0];default:return new Nm(e.every(n=>n instanceof wi)?e:e.reduce((n,r)=>n.concat(r instanceof wi?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}}function f9e(t,e,n,r,a,s,o){let l=t.slice();for(let d=0,u=s;d<n.maps.length;d++){let m=0;n.maps[d].forEach((p,f,y,x)=>{let b=x-y-(f-p);for(let v=0;v<l.length;v+=3){let _=l[v+1];if(_<0||p>_+u-m)continue;let k=l[v]+u-m;f>=k?l[v+1]=p<=k?-2:-1:p>=u&&b&&(l[v]+=b,l[v+1]+=b)}m+=b}),u=n.maps[d].map(u,-1)}let c=!1;for(let d=0;d<l.length;d+=3)if(l[d+1]<0){if(l[d+1]==-2){c=!0,l[d+1]=-1;continue}let u=n.map(t[d]+s),m=u-a;if(m<0||m>=r.content.size){c=!0;continue}let p=n.map(t[d+1]+s,-1),f=p-a,{index:y,offset:x}=r.content.findIndex(m),b=r.maybeChild(y);if(b&&x==m&&x+b.nodeSize==f){let v=l[d+2].mapInner(n,b,u+1,t[d]+s+1,o);v!=us?(l[d]=m,l[d+1]=f,l[d+2]=v):(l[d+1]=-2,c=!0)}else c=!0}if(c){let d=g9e(l,t,e,n,a,s,o),u=xN(d,r,0,o);e=u.local;for(let m=0;m<l.length;m+=3)l[m+1]<0&&(l.splice(m,3),m-=3);for(let m=0,p=0;m<u.children.length;m+=3){let f=u.children[m];for(;p<l.length&&l[p]<f;)p+=3;l.splice(p,0,u.children[m],u.children[m+1],u.children[m+2])}}return new wi(e.sort(Op),l)}function Die(t,e){if(!e||!t.length)return t;let n=[];for(let r=0;r<t.length;r++){let a=t[r];n.push(new Rs(a.from+e,a.to+e,a.type))}return n}function g9e(t,e,n,r,a,s,o){function l(c,d){for(let u=0;u<c.local.length;u++){let m=c.local[u].map(r,a,d);m?n.push(m):o.onRemove&&o.onRemove(c.local[u].spec)}for(let u=0;u<c.children.length;u+=3)l(c.children[u+2],c.children[u]+d+1)}for(let c=0;c<t.length;c+=3)t[c+1]==-1&&l(t[c+2],e[c]+s+1);return n}function Rie(t,e,n){if(e.isLeaf)return null;let r=n+e.nodeSize,a=null;for(let s=0,o;s<t.length;s++)(o=t[s])&&o.from>n&&o.to<r&&((a||(a=[])).push(o),t[s]=null);return a}function Fie(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function xN(t,e,n,r){let a=[],s=!1;e.forEach((l,c)=>{let d=Rie(t,l,c+n);if(d){s=!0;let u=xN(d,l,n+c+1,r);u!=us&&a.push(c,c+l.nodeSize,u)}});let o=Die(s?Fie(t):t,-n).sort(Op);for(let l=0;l<o.length;l++)o[l].type.valid(e,o[l])||(r.onRemove&&r.onRemove(o[l].spec),o.splice(l--,1));return o.length||a.length?new wi(o,a):us}function Op(t,e){return t.from-e.from||t.to-e.to}function eI(t){let e=t;for(let n=0;n<e.length-1;n++){let r=e[n];if(r.from!=r.to)for(let a=n+1;a<e.length;a++){let s=e[a];if(s.from==r.from){s.to!=r.to&&(e==t&&(e=t.slice()),e[a]=s.copy(s.from,r.to),kW(e,a+1,s.copy(r.to,s.to)));continue}else{s.from<r.to&&(e==t&&(e=t.slice()),e[n]=r.copy(r.from,s.from),kW(e,a,r.copy(s.from,r.to)));break}}}return e}function kW(t,e,n){for(;e<t.length&&Op(n,t[e])>0;)e++;t.splice(e,0,n)}function Nj(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=us&&e.push(r)}),t.cursorWrapper&&e.push(wi.create(t.state.doc,[t.cursorWrapper.deco])),Nm.from(e)}const b9e={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},x9e=lo&&eh<=11;class y9e{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 v9e{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new y9e,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let a=0;a<r.length;a++)this.queue.push(r[a]);lo&&eh<=11&&r.some(a=>a.type=="childList"&&a.removedNodes.length||a.type=="characterData"&&a.oldValue.length>a.target.nodeValue.length)?this.flushSoon():xs&&e.composing&&r.some(a=>a.type=="childList"&&a.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),x9e&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.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,b9e)),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(gW(this.view)){if(this.suppressingSelectionUpdates)return au(this.view);if(lo&&eh<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&uf(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,r;for(let s=e.focusNode;s;s=Zb(s))n.add(s);for(let s=e.anchorNode;s;s=Zb(s))if(n.has(s)){r=s;break}let a=r&&this.view.docView.nearestDesc(r);if(a&&a.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))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 r=e.domSelectionRange(),a=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&gW(e)&&!this.ignoreSelectionChange(r),s=-1,o=-1,l=!1,c=[];if(e.editable)for(let u=0;u<n.length;u++){let m=this.registerMutation(n[u],c);m&&(s=s<0?m.from:Math.min(m.from,s),o=o<0?m.to:Math.max(m.to,o),m.typeOver&&(l=!0))}if(c.some(u=>u.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let u of c)if(u.nodeName=="BR"&&u.parentNode){let m=u.nextSibling;m&&m.nodeType==1&&m.contentEditable=="false"&&u.parentNode.removeChild(u)}}else if(bl&&c.length){let u=c.filter(m=>m.nodeName=="BR");if(u.length==2){let[m,p]=u;m.parentNode&&m.parentNode.parentNode==p.parentNode?p.remove():m.remove()}else{let{focusNode:m}=this.currentSelection;for(let p of u){let f=p.parentNode;f&&f.nodeName=="LI"&&(!m||_9e(e,m)!=f)&&p.remove()}}}let d=null;s<0&&a&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&MT(r)&&(d=W4(e))&&d.eq(Yn.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,au(e),this.currentSelection.set(r),e.scrollToSelection()):(s>-1||a)&&(s>-1&&(e.docView.markDirty(s,o),w9e(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,k9e(e,c)),this.handleDOMChange(s,o,l,c),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||au(e),this.currentSelection.set(r))}registerMutation(e,n){if(n.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let u=0;u<e.addedNodes.length;u++){let m=e.addedNodes[u];n.push(m),m.nodeType==3&&(this.lastChangedTextNode=m)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let a=e.previousSibling,s=e.nextSibling;if(lo&&eh<=11&&e.addedNodes.length)for(let u=0;u<e.addedNodes.length;u++){let{previousSibling:m,nextSibling:p}=e.addedNodes[u];(!m||Array.prototype.indexOf.call(e.addedNodes,m)<0)&&(a=m),(!p||Array.prototype.indexOf.call(e.addedNodes,p)<0)&&(s=p)}let o=a&&a.parentNode==e.target?Ja(a)+1:0,l=r.localPosFromDOM(e.target,o,-1),c=s&&s.parentNode==e.target?Ja(s):e.target.childNodes.length,d=r.localPosFromDOM(e.target,c,1);return{from:l,to:d}}else return e.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=e.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let NW=new WeakMap,CW=!1;function w9e(t){if(!NW.has(t)&&(NW.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=bl,CW)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."),CW=!0}}function TW(t,e){let n=e.startContainer,r=e.startOffset,a=e.endContainer,s=e.endOffset,o=t.domAtPos(t.state.selection.anchor);return uf(o.node,o.offset,a,s)&&([n,r,a,s]=[a,s,n,r]),{anchorNode:n,anchorOffset:r,focusNode:a,focusOffset:s}}function S9e(t,e){if(e.getComposedRanges){let a=e.getComposedRanges(t.root)[0];if(a)return TW(t,a)}let n;function r(a){a.preventDefault(),a.stopImmediatePropagation(),n=a.getTargetRanges()[0]}return t.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",r,!0),n?TW(t,n):null}function _9e(t,e){for(let n=e.parentNode;n&&n!=t.dom;n=n.parentNode){let r=t.docView.nearestDesc(n,!0);if(r&&r.node.isBlock)return n}return null}function k9e(t,e){var n;let{focusNode:r,focusOffset:a}=t.domSelectionRange();for(let s of e)if(((n=s.parentNode)===null||n===void 0?void 0:n.nodeName)=="TR"){let o=s.nextSibling;for(;o&&o.nodeName!="TD"&&o.nodeName!="TH";)o=o.nextSibling;if(o){let l=o;for(;;){let c=l.firstChild;if(!c||c.nodeType!=1||c.contentEditable=="false"||/^(BR|IMG)$/.test(c.nodeName))break;l=c}l.insertBefore(s,l.firstChild),r==s&&t.domSelection().collapse(s,a)}else s.parentNode.removeChild(s)}}function N9e(t,e,n){let{node:r,fromOffset:a,toOffset:s,from:o,to:l}=t.docView.parseRange(e,n),c=t.domSelectionRange(),d,u=c.anchorNode;if(u&&t.dom.contains(u.nodeType==1?u:u.parentNode)&&(d=[{node:u,offset:c.anchorOffset}],MT(c)||d.push({node:c.focusNode,offset:c.focusOffset})),ts&&t.input.lastKeyCode===8)for(let b=s;b>a;b--){let v=r.childNodes[b-1],_=v.pmViewDesc;if(v.nodeName=="BR"&&!_){s=b;break}if(!_||_.size)break}let m=t.state.doc,p=t.someProp("domParser")||gv.fromSchema(t.state.schema),f=m.resolve(o),y=null,x=p.parse(r,{topNode:f.parent,topMatch:f.parent.contentMatchAt(f.index()),topOpen:!0,from:a,to:s,preserveWhitespace:f.parent.type.whitespace=="pre"?"full":!0,findPositions:d,ruleFromNode:C9e,context:f});if(d&&d[0].pos!=null){let b=d[0].pos,v=d[1]&&d[1].pos;v==null&&(v=b),y={anchor:b+o,head:v+o}}return{doc:x,sel:y,from:o,to:l}}function C9e(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(xs&&/^(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||xs&&/^(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 T9e=/^(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 P9e(t,e,n,r,a){let s=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let N=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,R=W4(t,N);if(R&&!t.state.selection.eq(R)){if(ts&&Xd&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",D=>D(t,up(13,"Enter"))))return;let A=t.state.tr.setSelection(R);N=="pointer"?A.setMeta("pointer",!0):N=="key"&&A.scrollIntoView(),s&&A.setMeta("composition",s),t.dispatch(A)}return}let o=t.state.doc.resolve(e),l=o.sharedDepth(n);e=o.before(l+1),n=t.state.doc.resolve(n).after(l+1);let c=t.state.selection,d=N9e(t,e,n),u=t.state.doc,m=u.slice(d.from,d.to),p,f;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(p=t.state.selection.to,f="end"):(p=t.state.selection.from,f="start"),t.input.lastKeyCode=null;let y=E9e(m.content,d.doc.content,d.from,p,f);if(y&&t.input.domChangeCount++,(Jb&&t.input.lastIOSEnter>Date.now()-225||Xd)&&a.some(N=>N.nodeType==1&&!T9e.test(N.nodeName))&&(!y||y.endA>=y.endB)&&t.someProp("handleKeyDown",N=>N(t,up(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!y)if(r&&c instanceof jn&&!c.empty&&c.$head.sameParent(c.$anchor)&&!t.composing&&!(d.sel&&d.sel.anchor!=d.sel.head))y={start:c.from,endA:c.to,endB:c.to};else{if(d.sel){let N=PW(t,t.state.doc,d.sel);if(N&&!N.eq(t.state.selection)){let R=t.state.tr.setSelection(N);s&&R.setMeta("composition",s),t.dispatch(R)}}return}t.state.selection.from<t.state.selection.to&&y.start==y.endB&&t.state.selection instanceof jn&&(y.start>t.state.selection.from&&y.start<=t.state.selection.from+2&&t.state.selection.from>=d.from?y.start=t.state.selection.from:y.endA<t.state.selection.to&&y.endA>=t.state.selection.to-2&&t.state.selection.to<=d.to&&(y.endB+=t.state.selection.to-y.endA,y.endA=t.state.selection.to)),lo&&eh<=11&&y.endB==y.start+1&&y.endA==y.start&&y.start>d.from&&d.doc.textBetween(y.start-d.from-1,y.start-d.from+1)==" "&&(y.start--,y.endA--,y.endB--);let x=d.doc.resolveNoCache(y.start-d.from),b=d.doc.resolveNoCache(y.endB-d.from),v=u.resolve(y.start),_=x.sameParent(b)&&x.parent.inlineContent&&v.end()>=y.endA;if((Jb&&t.input.lastIOSEnter>Date.now()-225&&(!_||a.some(N=>N.nodeName=="DIV"||N.nodeName=="P"))||!_&&x.pos<d.doc.content.size&&(!x.sameParent(b)||!x.parent.inlineContent)&&x.pos<b.pos&&!/\S/.test(d.doc.textBetween(x.pos,b.pos,"","")))&&t.someProp("handleKeyDown",N=>N(t,up(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>y.start&&M9e(u,y.start,y.endA,x,b)&&t.someProp("handleKeyDown",N=>N(t,up(8,"Backspace")))){Xd&&ts&&t.domObserver.suppressSelectionUpdates();return}ts&&y.endB==y.start&&(t.input.lastChromeDelete=Date.now()),Xd&&!_&&x.start()!=b.start()&&b.parentOffset==0&&x.depth==b.depth&&d.sel&&d.sel.anchor==d.sel.head&&d.sel.head==y.endA&&(y.endB-=2,b=d.doc.resolveNoCache(y.endB-d.from),setTimeout(()=>{t.someProp("handleKeyDown",function(N){return N(t,up(13,"Enter"))})},20));let k=y.start,P=y.endA,C=N=>{let R=N||t.state.tr.replace(k,P,d.doc.slice(y.start-d.from,y.endB-d.from));if(d.sel){let A=PW(t,R.doc,d.sel);A&&!(ts&&t.composing&&A.empty&&(y.start!=y.endB||t.input.lastChromeDelete<Date.now()-100)&&(A.head==k||A.head==R.mapping.map(P)-1)||lo&&A.empty&&A.head==k)&&R.setSelection(A)}return s&&R.setMeta("composition",s),R.scrollIntoView()},T;if(_)if(x.pos==b.pos){lo&&eh<=11&&x.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>au(t),20));let N=C(t.state.tr.delete(k,P)),R=u.resolve(y.start).marksAcross(u.resolve(y.endA));R&&N.ensureMarks(R),t.dispatch(N)}else if(y.endA==y.endB&&(T=A9e(x.parent.content.cut(x.parentOffset,b.parentOffset),v.parent.content.cut(v.parentOffset,y.endA-v.start())))){let N=C(t.state.tr);T.type=="add"?N.addMark(k,P,T.mark):N.removeMark(k,P,T.mark),t.dispatch(N)}else if(x.parent.child(x.index()).isText&&x.index()==b.index()-(b.textOffset?0:1)){let N=x.parent.textBetween(x.parentOffset,b.parentOffset),R=()=>C(t.state.tr.insertText(N,k,P));t.someProp("handleTextInput",A=>A(t,k,P,N,R))||t.dispatch(R())}else t.dispatch(C());else t.dispatch(C())}function PW(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:K4(t,e.resolve(n.anchor),e.resolve(n.head))}function A9e(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,a=n,s=r,o,l,c;for(let u=0;u<r.length;u++)a=r[u].removeFromSet(a);for(let u=0;u<n.length;u++)s=n[u].removeFromSet(s);if(a.length==1&&s.length==0)l=a[0],o="add",c=u=>u.mark(l.addToSet(u.marks));else if(a.length==0&&s.length==1)l=s[0],o="remove",c=u=>u.mark(l.removeFromSet(u.marks));else return null;let d=[];for(let u=0;u<e.childCount;u++)d.push(c(e.child(u)));if(Lt.from(d).eq(t))return{mark:l,type:o}}function M9e(t,e,n,r,a){if(n-e<=a.pos-r.pos||Cj(r,!0,!1)<a.pos)return!1;let s=t.resolve(e);if(!r.parent.isTextblock){let l=s.nodeAfter;return l!=null&&n==e+l.nodeSize}if(s.parentOffset<s.parent.content.size||!s.parent.isTextblock)return!1;let o=t.resolve(Cj(s,!0,!0));return!o.parent.isTextblock||o.pos>n||Cj(o,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(o.parent.content)}function Cj(t,e,n){let r=t.depth,a=e?t.end():t.pos;for(;r>0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,a++,e=!1;if(n){let s=t.node(r).maybeChild(t.indexAfter(r));for(;s&&!s.isLeaf;)s=s.firstChild,a++}return a}function E9e(t,e,n,r,a){let s=t.findDiffStart(e,n);if(s==null)return null;let{a:o,b:l}=t.findDiffEnd(e,n+t.size,n+e.size);if(a=="end"){let c=Math.max(0,s-Math.min(o,l));r-=o+c-s}if(o<s&&t.size<e.size){let c=r<=s&&r>=o?s-r:0;s-=c,s&&s<e.size&&AW(e.textBetween(s-1,s+1))&&(s+=c?1:-1),l=s+(l-o),o=s}else if(l<s){let c=r<=s&&r>=l?s-r:0;s-=c,s&&s<t.size&&AW(t.textBetween(s-1,s+1))&&(s+=c?1:-1),o=s+(o-l),l=s}return{start:s,endA:o,endB:l}}function AW(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 Lie{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 W7e,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(RW),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=jW(this),EW(this),this.nodeViews=DW(this),this.docView=dW(this.state.doc,MW(this),Nj(this),this.dom,this),this.domObserver=new v9e(this,(r,a,s,o)=>P9e(this,r,a,s,o)),this.domObserver.start(),K7e(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&&nF(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(RW),this.directPlugins=e.plugins),this.updateStateInner(e.state,n)}setProps(e){let n={};for(let r in this._props)n[r]=this._props[r];n.state=this.state;for(let r in e)n[r]=e[r];this.update(n)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,n){var r;let a=this.state,s=!1,o=!1;e.storedMarks&&this.composing&&(Aie(this),o=!0),this.state=e;let l=a.plugins!=e.plugins||this._props.plugins!=n.plugins;if(l||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let f=DW(this);D9e(f,this.nodeViews)&&(this.nodeViews=f,s=!0)}(l||n.handleDOMEvents!=this._props.handleDOMEvents)&&nF(this),this.editable=jW(this),EW(this);let c=Nj(this),d=MW(this),u=a.plugins!=e.plugins&&!a.doc.eq(e.doc)?"reset":e.scrollToSelection>a.scrollToSelection?"to selection":"preserve",m=s||!this.docView.matchesNode(e.doc,d,c);(m||!e.selection.eq(a.selection))&&(o=!0);let p=u=="preserve"&&o&&this.dom.style.overflowAnchor==null&&l7e(this);if(o){this.domObserver.stop();let f=m&&(lo||ts)&&!this.composing&&!a.selection.empty&&!e.selection.empty&&j9e(a.selection,e.selection);if(m){let y=ts?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=l9e(this)),(s||!this.docView.update(e.doc,d,c,this))&&(this.docView.updateOuterDeco(d),this.docView.destroy(),this.docView=dW(e.doc,d,c,this.dom,this)),y&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(f=!0)}f||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&j7e(this))?au(this,f):(bie(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(a),!((r=this.dragging)===null||r===void 0)&&r.node&&!a.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,a),u=="reset"?this.dom.scrollTop=0:u=="to selection"?this.scrollToSelection():p&&c7e(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 gn){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&iW(this,n.getBoundingClientRect(),e)}else iW(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 r=this.directPlugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let n=0;n<this.state.plugins.length;n++){let r=this.state.plugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let n=0;n<this.pluginViews.length;n++){let r=this.pluginViews[n];r.update&&r.update(this,e)}}updateDraggedNode(e,n){let r=e.node,a=-1;if(this.state.doc.nodeAt(r.from)==r.node)a=r.from;else{let s=r.from+(this.state.doc.content.size-n.doc.content.size);(s>0&&this.state.doc.nodeAt(s))==r.node&&(a=s)}this.dragging=new Eie(e.slice,e.move,a<0?void 0:gn.create(this.state.doc,a))}someProp(e,n){let r=this._props&&this._props[e],a;if(r!=null&&(a=n?n(r):r))return a;for(let o=0;o<this.directPlugins.length;o++){let l=this.directPlugins[o].props[e];if(l!=null&&(a=n?n(l):l))return a}let s=this.state.plugins;if(s)for(let o=0;o<s.length;o++){let l=s[o].props[e];if(l!=null&&(a=n?n(l):l))return a}}hasFocus(){if(lo){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&&d7e(this.dom),au(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 f7e(this,e)}coordsAtPos(e,n=1){return cie(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,r=-1){let a=this.docView.posFromDOM(e,n,r);if(a==null)throw new RangeError("DOM position not inside the editor");return a}endOfTextblock(e,n){return v7e(this,n||this.state,e)}pasteHTML(e,n){return x0(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return x0(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return Y4(this,e)}destroy(){this.docView&&(Y7e(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Nj(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,ZVe())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return Q7e(this,e)}domSelectionRange(){let e=this.domSelection();return e?xs&&this.root.nodeType===11&&r7e(this.dom.ownerDocument)==this.dom&&S9e(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}Lie.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function MW(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 r in n)r=="class"?e.class+=" "+n[r]:r=="style"?e.style=(e.style?e.style+";":"")+n[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(n[r]))}),e.translate||(e.translate="no"),[Rs.node(0,t.state.doc.content.size,e)]}function EW(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:Rs.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function jW(t){return!t.someProp("editable",e=>e(t.state)===!1)}function j9e(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 DW(t){let e=Object.create(null);function n(r){for(let a in r)Object.prototype.hasOwnProperty.call(e,a)||(e[a]=r[a])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function D9e(t,e){let n=0,r=0;for(let a in t){if(t[a]!=e[a])return!0;n++}for(let a in e)r++;return n!=r}function RW(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 uh={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:"'"},yN={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},R9e=typeof navigator<"u"&&/Mac/.test(navigator.platform),F9e=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var es=0;es<10;es++)uh[48+es]=uh[96+es]=String(es);for(var es=1;es<=24;es++)uh[es+111]="F"+es;for(var es=65;es<=90;es++)uh[es]=String.fromCharCode(es+32),yN[es]=String.fromCharCode(es);for(var Tj in uh)yN.hasOwnProperty(Tj)||(yN[Tj]=uh[Tj]);function L9e(t){var e=R9e&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||F9e&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?yN:uh)[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 O9e=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),I9e=typeof navigator<"u"&&/Win/.test(navigator.platform);function z9e(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,a,s,o;for(let l=0;l<e.length-1;l++){let c=e[l];if(/^(cmd|meta|m)$/i.test(c))o=!0;else if(/^a(lt)?$/i.test(c))r=!0;else if(/^(c|ctrl|control)$/i.test(c))a=!0;else if(/^s(hift)?$/i.test(c))s=!0;else if(/^mod$/i.test(c))O9e?o=!0:a=!0;else throw new Error("Unrecognized modifier name: "+c)}return r&&(n="Alt-"+n),a&&(n="Ctrl-"+n),o&&(n="Meta-"+n),s&&(n="Shift-"+n),n}function U9e(t){let e=Object.create(null);for(let n in t)e[z9e(n)]=t[n];return e}function Pj(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 B9e(t){return new Ci({props:{handleKeyDown:Oie(t)}})}function Oie(t){let e=U9e(t);return function(n,r){let a=L9e(r),s,o=e[Pj(a,r)];if(o&&o(n.state,n.dispatch,n))return!0;if(a.length==1&&a!=" "){if(r.shiftKey){let l=e[Pj(a,r,!1)];if(l&&l(n.state,n.dispatch,n))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(I9e&&r.ctrlKey&&r.altKey)&&(s=uh[r.keyCode])&&s!=a){let l=e[Pj(s,r)];if(l&&l(n.state,n.dispatch,n))return!0}}return!1}}var H9e=Object.defineProperty,tI=(t,e)=>{for(var n in e)H9e(t,n,{get:e[n],enumerable:!0})};function DT(t){const{state:e,transaction:n}=t;let{selection:r}=n,{doc:a}=n,{storedMarks:s}=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 s},get selection(){return r},get doc(){return a},get tr(){return r=n.selection,a=n.doc,s=n.storedMarks,n}}}var RT=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:r}=e,{tr:a}=n,s=this.buildProps(a);return Object.fromEntries(Object.entries(t).map(([o,l])=>[o,(...d)=>{const u=l(...d)(s);return!a.getMeta("preventDispatch")&&!this.hasCustomState&&r.dispatch(a),u}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(t,e=!0){const{rawCommands:n,editor:r,state:a}=this,{view:s}=r,o=[],l=!!t,c=t||a.tr,d=()=>(!l&&e&&!c.getMeta("preventDispatch")&&!this.hasCustomState&&s.dispatch(c),o.every(m=>m===!0)),u={...Object.fromEntries(Object.entries(n).map(([m,p])=>[m,(...y)=>{const x=this.buildProps(c,e),b=p(...y)(x);return o.push(b),u}])),run:d};return u}createCan(t){const{rawCommands:e,state:n}=this,r=!1,a=t||n.tr,s=this.buildProps(a,r);return{...Object.fromEntries(Object.entries(e).map(([l,c])=>[l,(...d)=>c(...d)({...s,dispatch:void 0})])),chain:()=>this.createChain(a,r)}}buildProps(t,e=!0){const{rawCommands:n,editor:r,state:a}=this,{view:s}=r,o={tr:t,editor:r,view:s,state:DT({state:a,transaction:t}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(t,e),can:()=>this.createCan(t),get commands(){return Object.fromEntries(Object.entries(n).map(([l,c])=>[l,(...d)=>c(...d)(o)]))}};return o}},Iie={};tI(Iie,{blur:()=>$9e,clearContent:()=>q9e,clearNodes:()=>V9e,command:()=>G9e,createParagraphNear:()=>W9e,cut:()=>K9e,deleteCurrentNode:()=>Y9e,deleteNode:()=>X9e,deleteRange:()=>Q9e,deleteSelection:()=>Z9e,enter:()=>J9e,exitCode:()=>eGe,extendMarkRange:()=>tGe,first:()=>nGe,focus:()=>iGe,forEach:()=>aGe,insertContent:()=>sGe,insertContentAt:()=>cGe,joinBackward:()=>mGe,joinDown:()=>uGe,joinForward:()=>hGe,joinItemBackward:()=>pGe,joinItemForward:()=>fGe,joinTextblockBackward:()=>gGe,joinTextblockForward:()=>bGe,joinUp:()=>dGe,keyboardShortcut:()=>yGe,lift:()=>vGe,liftEmptyBlock:()=>wGe,liftListItem:()=>SGe,newlineInCode:()=>_Ge,resetAttributes:()=>kGe,scrollIntoView:()=>NGe,selectAll:()=>CGe,selectNodeBackward:()=>TGe,selectNodeForward:()=>PGe,selectParentNode:()=>AGe,selectTextblockEnd:()=>MGe,selectTextblockStart:()=>EGe,setContent:()=>jGe,setMark:()=>ZGe,setMeta:()=>JGe,setNode:()=>eWe,setNodeSelection:()=>tWe,setTextDirection:()=>nWe,setTextSelection:()=>rWe,sinkListItem:()=>iWe,splitBlock:()=>aWe,splitListItem:()=>sWe,toggleList:()=>oWe,toggleMark:()=>lWe,toggleNode:()=>cWe,toggleWrap:()=>dWe,undoInputRule:()=>uWe,unsetAllMarks:()=>mWe,unsetMark:()=>hWe,unsetTextDirection:()=>pWe,updateAttributes:()=>fWe,wrapIn:()=>gWe,wrapInList:()=>bWe});var $9e=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window?.getSelection())==null||n.removeAllRanges())}),!0),q9e=(t=!0)=>({commands:e})=>e.setContent("",{emitUpdate:t}),V9e=()=>({state:t,tr:e,dispatch:n})=>{const{selection:r}=e,{ranges:a}=r;return n&&a.forEach(({$from:s,$to:o})=>{t.doc.nodesBetween(s.pos,o.pos,(l,c)=>{if(l.type.isText)return;const{doc:d,mapping:u}=e,m=d.resolve(u.map(c)),p=d.resolve(u.map(c+l.nodeSize)),f=m.blockRange(p);if(!f)return;const y=Tx(f);if(l.type.isTextblock){const{defaultType:x}=m.parent.contentMatchAt(m.index());e.setNodeMarkup(f.start,x)}(y||y===0)&&e.lift(f,y)})}),!0},G9e=t=>e=>t(e),W9e=()=>({state:t,dispatch:e})=>Zre(t,e),K9e=(t,e)=>({editor:n,tr:r})=>{const{state:a}=n,s=a.doc.slice(t.from,t.to);r.deleteRange(t.from,t.to);const o=r.mapping.map(e);return r.insert(o,s.content),r.setSelection(new jn(r.doc.resolve(Math.max(o-1,0)))),!0},Y9e=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,r=n.$anchor.node();if(r.content.size>0)return!1;const a=t.selection.$anchor;for(let s=a.depth;s>0;s-=1)if(a.node(s).type===r.type){if(e){const l=a.before(s),c=a.after(s);t.delete(l,c).scrollIntoView()}return!0}return!1};function ca(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 X9e=t=>({tr:e,state:n,dispatch:r})=>{const a=ca(t,n.schema),s=e.selection.$anchor;for(let o=s.depth;o>0;o-=1)if(s.node(o).type===a){if(r){const c=s.before(o),d=s.after(o);e.delete(c,d).scrollIntoView()}return!0}return!1},Q9e=t=>({tr:e,dispatch:n})=>{const{from:r,to:a}=t;return n&&e.delete(r,a),!0},Z9e=()=>({state:t,dispatch:e})=>B4(t,e),J9e=()=>({commands:t})=>t.keyboardShortcut("Enter"),eGe=()=>({state:t,dispatch:e})=>OVe(t,e);function nI(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function vN(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(a=>n.strict?e[a]===t[a]:nI(e[a])?e[a].test(t[a]):e[a]===t[a]):!0}function zie(t,e,n={}){return t.find(r=>r.type===e&&vN(Object.fromEntries(Object.keys(n).map(a=>[a,r.attrs[a]])),n))}function FW(t,e,n={}){return!!zie(t,e,n)}function rI(t,e,n){var r;if(!t||!e)return;let a=t.parent.childAfter(t.parentOffset);if((!a.node||!a.node.marks.some(u=>u.type===e))&&(a=t.parent.childBefore(t.parentOffset)),!a.node||!a.node.marks.some(u=>u.type===e)||(n=n||((r=a.node.marks[0])==null?void 0:r.attrs),!zie([...a.node.marks],e,n)))return;let o=a.index,l=t.start()+a.offset,c=o+1,d=l+a.node.nodeSize;for(;o>0&&FW([...t.parent.child(o-1).marks],e,n);)o-=1,l-=t.parent.child(o).nodeSize;for(;c<t.parent.childCount&&FW([...t.parent.child(c).marks],e,n);)d+=t.parent.child(c).nodeSize,c+=1;return{from:l,to:d}}function Tu(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 tGe=(t,e={})=>({tr:n,state:r,dispatch:a})=>{const s=Tu(t,r.schema),{doc:o,selection:l}=n,{$from:c,from:d,to:u}=l;if(a){const m=rI(c,s,e);if(m&&m.from<=d&&m.to>=u){const p=jn.create(o,m.from,m.to);n.setSelection(p)}}return!0},nGe=t=>e=>{const n=typeof t=="function"?t(e):t;for(let r=0;r<n.length;r+=1)if(n[r](e))return!0;return!1};function Uie(t){return t instanceof jn}function kp(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function Bie(t,e=null){if(!e)return null;const n=Yn.atStart(t),r=Yn.atEnd(t);if(e==="start"||e===!0)return n;if(e==="end")return r;const a=n.from,s=r.to;return e==="all"?jn.create(t,kp(0,a,s),kp(t.content.size,a,s)):jn.create(t,kp(e,a,s),kp(e,a,s))}function LW(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function wN(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function rGe(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}var iGe=(t=null,e={})=>({editor:n,view:r,tr:a,dispatch:s})=>{e={scrollIntoView:!0,...e};const o=()=>{(wN()||LW())&&r.dom.focus(),rGe()&&!wN()&&!LW()&&r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),e?.scrollIntoView&&n.commands.scrollIntoView())})};try{if(r.hasFocus()&&t===null||t===!1)return!0}catch{return!1}if(s&&t===null&&!Uie(n.state.selection))return o(),!0;const l=Bie(a.doc,t)||n.state.selection,c=n.state.selection.eq(l);return s&&(c||a.setSelection(l),c&&a.storedMarks&&a.setStoredMarks(a.storedMarks),o()),!0},aGe=(t,e)=>n=>t.every((r,a)=>e(r,{...n,index:a})),sGe=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),Hie=t=>{const e=t.childNodes;for(let n=e.length-1;n>=0;n-=1){const r=e[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?t.removeChild(r):r.nodeType===1&&Hie(r)}return t};function G_(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 Hie(n)}function v0(t,e,n){if(t instanceof Jm||t instanceof Lt)return t;n={slice:!0,parseOptions:{},...n};const r=typeof t=="object"&&t!==null,a=typeof t=="string";if(r)try{if(Array.isArray(t)&&t.length>0)return Lt.fromArray(t.map(l=>e.nodeFromJSON(l)));const o=e.nodeFromJSON(t);return n.errorOnInvalidContent&&o.check(),o}catch(s){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:s});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",s),v0("",e,n)}if(a){if(n.errorOnInvalidContent){let o=!1,l="";const c=new Nre({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:d=>(o=!0,l=typeof d=="string"?d:d.outerHTML,null)}]}})});if(n.slice?gv.fromSchema(c).parseSlice(G_(t),n.parseOptions):gv.fromSchema(c).parse(G_(t),n.parseOptions),n.errorOnInvalidContent&&o)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${l}`)})}const s=gv.fromSchema(e);return n.slice?s.parseSlice(G_(t),n.parseOptions).content:s.parse(G_(t),n.parseOptions)}return v0("",e,n)}function oGe(t,e,n){const r=t.steps.length-1;if(r<e)return;const a=t.steps[r];if(!(a instanceof Da||a instanceof Fa))return;const s=t.mapping.maps[r];let o=0;s.forEach((l,c,d,u)=>{o===0&&(o=u)}),t.setSelection(Yn.near(t.doc.resolve(o),n))}var lGe=t=>!("type"in t),cGe=(t,e,n)=>({tr:r,dispatch:a,editor:s})=>{var o;if(a){n={parseOptions:s.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let l;const c=b=>{s.emit("contentError",{editor:s,error:b,disableCollaboration:()=>{"collaboration"in s.storage&&typeof s.storage.collaboration=="object"&&s.storage.collaboration&&(s.storage.collaboration.isDisabled=!0)}})},d={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!s.options.enableContentCheck&&s.options.emitContentError)try{v0(e,s.schema,{parseOptions:d,errorOnInvalidContent:!0})}catch(b){c(b)}try{l=v0(e,s.schema,{parseOptions:d,errorOnInvalidContent:(o=n.errorOnInvalidContent)!=null?o:s.options.enableContentCheck})}catch(b){return c(b),!1}let{from:u,to:m}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},p=!0,f=!0;if((lGe(l)?l:[l]).forEach(b=>{b.check(),p=p?b.isText&&b.marks.length===0:!1,f=f?b.isBlock:!1}),u===m&&f){const{parent:b}=r.doc.resolve(u);b.isTextblock&&!b.type.spec.code&&!b.childCount&&(u-=1,m+=1)}let x;if(p){if(Array.isArray(e))x=e.map(b=>b.text||"").join("");else if(e instanceof Lt){let b="";e.forEach(v=>{v.text&&(b+=v.text)}),x=b}else typeof e=="object"&&e&&e.text?x=e.text:x=e;r.insertText(x,u,m)}else{x=l;const b=r.doc.resolve(u),v=b.node(),_=b.parentOffset===0,k=v.isText||v.isTextblock,P=v.content.size>0;_&&k&&P&&(u=Math.max(0,u-1)),r.replaceWith(u,m,x)}n.updateSelection&&oGe(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:u,text:x}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:u,text:x})}return!0},dGe=()=>({state:t,dispatch:e})=>RVe(t,e),uGe=()=>({state:t,dispatch:e})=>FVe(t,e),mGe=()=>({state:t,dispatch:e})=>Vre(t,e),hGe=()=>({state:t,dispatch:e})=>Yre(t,e),pGe=()=>({state:t,dispatch:e,tr:n})=>{try{const r=TT(t.doc,t.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},fGe=()=>({state:t,dispatch:e,tr:n})=>{try{const r=TT(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},gGe=()=>({state:t,dispatch:e})=>jVe(t,e),bGe=()=>({state:t,dispatch:e})=>DVe(t,e);function $ie(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function xGe(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let r,a,s,o;for(let l=0;l<e.length-1;l+=1){const c=e[l];if(/^(cmd|meta|m)$/i.test(c))o=!0;else if(/^a(lt)?$/i.test(c))r=!0;else if(/^(c|ctrl|control)$/i.test(c))a=!0;else if(/^s(hift)?$/i.test(c))s=!0;else if(/^mod$/i.test(c))wN()||$ie()?o=!0:a=!0;else throw new Error(`Unrecognized modifier name: ${c}`)}return r&&(n=`Alt-${n}`),a&&(n=`Ctrl-${n}`),o&&(n=`Meta-${n}`),s&&(n=`Shift-${n}`),n}var yGe=t=>({editor:e,view:n,tr:r,dispatch:a})=>{const s=xGe(t).split(/-(?!$)/),o=s.find(d=>!["Alt","Ctrl","Meta","Shift"].includes(d)),l=new KeyboardEvent("keydown",{key:o==="Space"?" ":o,altKey:s.includes("Alt"),ctrlKey:s.includes("Ctrl"),metaKey:s.includes("Meta"),shiftKey:s.includes("Shift"),bubbles:!0,cancelable:!0}),c=e.captureTransaction(()=>{n.someProp("handleKeyDown",d=>d(n,l))});return c?.steps.forEach(d=>{const u=d.map(r.mapping);u&&a&&r.maybeStep(u)}),!0};function mh(t,e,n={}){const{from:r,to:a,empty:s}=t.selection,o=e?ca(e,t.schema):null,l=[];t.doc.nodesBetween(r,a,(m,p)=>{if(m.isText)return;const f=Math.max(r,p),y=Math.min(a,p+m.nodeSize);l.push({node:m,from:f,to:y})});const c=a-r,d=l.filter(m=>o?o.name===m.node.type.name:!0).filter(m=>vN(m.node.attrs,n,{strict:!1}));return s?!!d.length:d.reduce((m,p)=>m+p.to-p.from,0)>=c}var vGe=(t,e={})=>({state:n,dispatch:r})=>{const a=ca(t,n.schema);return mh(n,a,e)?LVe(n,r):!1},wGe=()=>({state:t,dispatch:e})=>Jre(t,e),SGe=t=>({state:e,dispatch:n})=>{const r=ca(t,e.schema);return KVe(r)(e,n)},_Ge=()=>({state:t,dispatch:e})=>Qre(t,e);function FT(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function OW(t,e){const n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((r,a)=>(n.includes(a)||(r[a]=t[a]),r),{})}var kGe=(t,e)=>({tr:n,state:r,dispatch:a})=>{let s=null,o=null;const l=FT(typeof t=="string"?t:t.name,r.schema);if(!l)return!1;l==="node"&&(s=ca(t,r.schema)),l==="mark"&&(o=Tu(t,r.schema));let c=!1;return n.selection.ranges.forEach(d=>{r.doc.nodesBetween(d.$from.pos,d.$to.pos,(u,m)=>{s&&s===u.type&&(c=!0,a&&n.setNodeMarkup(m,void 0,OW(u.attrs,e))),o&&u.marks.length&&u.marks.forEach(p=>{o===p.type&&(c=!0,a&&n.addMark(m,m+u.nodeSize,o.create(OW(p.attrs,e))))})})}),c},NGe=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),CGe=()=>({tr:t,dispatch:e})=>{if(e){const n=new Oo(t.doc);t.setSelection(n)}return!0},TGe=()=>({state:t,dispatch:e})=>Wre(t,e),PGe=()=>({state:t,dispatch:e})=>Xre(t,e),AGe=()=>({state:t,dispatch:e})=>UVe(t,e),MGe=()=>({state:t,dispatch:e})=>$Ve(t,e),EGe=()=>({state:t,dispatch:e})=>HVe(t,e);function rF(t,e,n={},r={}){return v0(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var jGe=(t,{errorOnInvalidContent:e,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:a,tr:s,dispatch:o,commands:l})=>{const{doc:c}=s;if(r.preserveWhitespace!=="full"){const d=rF(t,a.schema,r,{errorOnInvalidContent:e??a.options.enableContentCheck});return o&&s.replaceWith(0,c.content.size,d).setMeta("preventUpdate",!n),!0}return o&&s.setMeta("preventUpdate",!n),l.insertContentAt({from:0,to:c.content.size},t,{parseOptions:r,errorOnInvalidContent:e??a.options.enableContentCheck})};function qie(t,e){const n=Tu(e,t.schema),{from:r,to:a,empty:s}=t.selection,o=[];s?(t.storedMarks&&o.push(...t.storedMarks),o.push(...t.selection.$head.marks())):t.doc.nodesBetween(r,a,c=>{o.push(...c.marks)});const l=o.find(c=>c.type.name===n.name);return l?{...l.attrs}:{}}function Vie(t,e){const n=new Bre(t);return e.forEach(r=>{r.steps.forEach(a=>{n.step(a)})}),n}function DGe(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 RGe(t,e,n){const r=[];return t.nodesBetween(e.from,e.to,(a,s)=>{n(a)&&r.push({node:a,pos:s})}),r}function FGe(t,e){for(let n=t.depth;n>0;n-=1){const r=t.node(n);if(e(r))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:r}}}function LT(t){return e=>FGe(e.$from,t)}function un(t,e,n){return t.config[e]===void 0&&t.parent?un(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?un(t.parent,e,n):null}):t.config[e]}function iI(t){return t.map(e=>{const n={name:e.name,options:e.options,storage:e.storage},r=un(e,"addExtensions",n);return r?[e,...iI(r())]:e}).flat(10)}function aI(t,e){const n=Sf.fromSchema(e).serializeFragment(t),a=document.implementation.createHTMLDocument().createElement("div");return a.appendChild(n),a.innerHTML}function Gie(t){return typeof t=="function"}function Er(t,e=void 0,...n){return Gie(t)?e?t.bind(e)(...n):t(...n):t}function LGe(t={}){return Object.keys(t).length===0&&t.constructor===Object}function ex(t){const e=t.filter(a=>a.type==="extension"),n=t.filter(a=>a.type==="node"),r=t.filter(a=>a.type==="mark");return{baseExtensions:e,nodeExtensions:n,markExtensions:r}}function Wie(t){const e=[],{nodeExtensions:n,markExtensions:r}=ex(t),a=[...n,...r],s={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return t.forEach(o=>{const l={name:o.name,options:o.options,storage:o.storage,extensions:a},c=un(o,"addGlobalAttributes",l);if(!c)return;c().forEach(u=>{u.types.forEach(m=>{Object.entries(u.attributes).forEach(([p,f])=>{e.push({type:m,name:p,attribute:{...s,...f}})})})})}),a.forEach(o=>{const l={name:o.name,options:o.options,storage:o.storage},c=un(o,"addAttributes",l);if(!c)return;const d=c();Object.entries(d).forEach(([u,m])=>{const p={...s,...m};typeof p?.default=="function"&&(p.default=p.default()),p?.isRequired&&p?.default===void 0&&delete p.default,e.push({type:o.name,name:u,attribute:p})})}),e}function zi(...t){return t.filter(e=>!!e).reduce((e,n)=>{const r={...e};return Object.entries(n).forEach(([a,s])=>{if(!r[a]){r[a]=s;return}if(a==="class"){const l=s?String(s).split(" "):[],c=r[a]?r[a].split(" "):[],d=l.filter(u=>!c.includes(u));r[a]=[...c,...d].join(" ")}else if(a==="style"){const l=s?s.split(";").map(u=>u.trim()).filter(Boolean):[],c=r[a]?r[a].split(";").map(u=>u.trim()).filter(Boolean):[],d=new Map;c.forEach(u=>{const[m,p]=u.split(":").map(f=>f.trim());d.set(m,p)}),l.forEach(u=>{const[m,p]=u.split(":").map(f=>f.trim());d.set(m,p)}),r[a]=Array.from(d.entries()).map(([u,m])=>`${u}: ${m}`).join("; ")}else r[a]=s}),r},{})}function w0(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,r)=>zi(n,r),{})}function OGe(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function IW(t,e){return"style"in t?t:{...t,getAttrs:n=>{const r=t.getAttrs?t.getAttrs(n):t.attrs;if(r===!1)return!1;const a=e.reduce((s,o)=>{const l=o.attribute.parseHTML?o.attribute.parseHTML(n):OGe(n.getAttribute(o.name));return l==null?s:{...s,[o.name]:l}},{});return{...r,...a}}}}function zW(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&LGe(n)?!1:n!=null))}function UW(t){var e,n;const r={};return!((e=t?.attribute)!=null&&e.isRequired)&&"default"in(t?.attribute||{})&&(r.default=t.attribute.default),((n=t?.attribute)==null?void 0:n.validate)!==void 0&&(r.validate=t.attribute.validate),[t.name,r]}function IGe(t,e){var n;const r=Wie(t),{nodeExtensions:a,markExtensions:s}=ex(t),o=(n=a.find(d=>un(d,"topNode")))==null?void 0:n.name,l=Object.fromEntries(a.map(d=>{const u=r.filter(v=>v.type===d.name),m={name:d.name,options:d.options,storage:d.storage,editor:e},p=t.reduce((v,_)=>{const k=un(_,"extendNodeSchema",m);return{...v,...k?k(d):{}}},{}),f=zW({...p,content:Er(un(d,"content",m)),marks:Er(un(d,"marks",m)),group:Er(un(d,"group",m)),inline:Er(un(d,"inline",m)),atom:Er(un(d,"atom",m)),selectable:Er(un(d,"selectable",m)),draggable:Er(un(d,"draggable",m)),code:Er(un(d,"code",m)),whitespace:Er(un(d,"whitespace",m)),linebreakReplacement:Er(un(d,"linebreakReplacement",m)),defining:Er(un(d,"defining",m)),isolating:Er(un(d,"isolating",m)),attrs:Object.fromEntries(u.map(UW))}),y=Er(un(d,"parseHTML",m));y&&(f.parseDOM=y.map(v=>IW(v,u)));const x=un(d,"renderHTML",m);x&&(f.toDOM=v=>x({node:v,HTMLAttributes:w0(v,u)}));const b=un(d,"renderText",m);return b&&(f.toText=b),[d.name,f]})),c=Object.fromEntries(s.map(d=>{const u=r.filter(b=>b.type===d.name),m={name:d.name,options:d.options,storage:d.storage,editor:e},p=t.reduce((b,v)=>{const _=un(v,"extendMarkSchema",m);return{...b,..._?_(d):{}}},{}),f=zW({...p,inclusive:Er(un(d,"inclusive",m)),excludes:Er(un(d,"excludes",m)),group:Er(un(d,"group",m)),spanning:Er(un(d,"spanning",m)),code:Er(un(d,"code",m)),attrs:Object.fromEntries(u.map(UW))}),y=Er(un(d,"parseHTML",m));y&&(f.parseDOM=y.map(b=>IW(b,u)));const x=un(d,"renderHTML",m);return x&&(f.toDOM=b=>x({mark:b,HTMLAttributes:w0(b,u)})),[d.name,f]}));return new Nre({topNode:o,nodes:l,marks:c})}function zGe(t){const e=t.filter((n,r)=>t.indexOf(n)!==r);return Array.from(new Set(e))}function SN(t){return t.sort((n,r)=>{const a=un(n,"priority")||100,s=un(r,"priority")||100;return a>s?-1:a<s?1:0})}function Kie(t){const e=SN(iI(t)),n=zGe(e.map(r=>r.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(r=>`'${r}'`).join(", ")}]. This can lead to issues.`),e}function Yie(t,e,n){const{from:r,to:a}=e,{blockSeparator:s=`
- `,textSerializers:o={}}=n||{};let l="";return t.nodesBetween(r,a,(c,d,u,m)=>{var p;c.isBlock&&d>r&&(l+=s);const f=o?.[c.type.name];if(f)return u&&(l+=f({node:c,pos:d,parent:u,index:m,range:e})),!1;c.isText&&(l+=(p=c?.text)==null?void 0:p.slice(Math.max(r,d)-d,a-d))}),l}function UGe(t,e){const n={from:0,to:t.content.size};return Yie(t,n,e)}function Xie(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}function BGe(t,e){const n=ca(e,t.schema),{from:r,to:a}=t.selection,s=[];t.doc.nodesBetween(r,a,l=>{s.push(l)});const o=s.reverse().find(l=>l.type.name===n.name);return o?{...o.attrs}:{}}function Qie(t,e){const n=FT(typeof e=="string"?e:e.name,t.schema);return n==="node"?BGe(t,e):n==="mark"?qie(t,e):{}}function HGe(t,e=JSON.stringify){const n={};return t.filter(r=>{const a=e(r);return Object.prototype.hasOwnProperty.call(n,a)?!1:n[a]=!0})}function $Ge(t){const e=HGe(t);return e.length===1?e:e.filter((n,r)=>!e.filter((s,o)=>o!==r).some(s=>n.oldRange.from>=s.oldRange.from&&n.oldRange.to<=s.oldRange.to&&n.newRange.from>=s.newRange.from&&n.newRange.to<=s.newRange.to))}function Zie(t){const{mapping:e,steps:n}=t,r=[];return e.maps.forEach((a,s)=>{const o=[];if(a.ranges.length)a.forEach((l,c)=>{o.push({from:l,to:c})});else{const{from:l,to:c}=n[s];if(l===void 0||c===void 0)return;o.push({from:l,to:c})}o.forEach(({from:l,to:c})=>{const d=e.slice(s).map(l,-1),u=e.slice(s).map(c),m=e.invert().map(d,-1),p=e.invert().map(u);r.push({oldRange:{from:m,to:p},newRange:{from:d,to:u}})})}),$Ge(r)}function sI(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(a=>{const s=n.resolve(t),o=rI(s,a.type);o&&r.push({mark:a,...o})}):n.nodesBetween(t,e,(a,s)=>{!a||a?.nodeSize===void 0||r.push(...a.marks.map(o=>({from:s,to:s+a.nodeSize,mark:o})))}),r}var qGe=(t,e,n,r=20)=>{const a=t.doc.resolve(n);let s=r,o=null;for(;s>0&&o===null;){const l=a.node(s);l?.type.name===e?o=l:s-=1}return[o,s]};function W_(t,e){return e.nodes[t]||e.marks[t]||null}function A1(t,e,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{const a=t.find(s=>s.type===e&&s.name===r);return a?a.attribute.keepOnSplit:!1}))}var VGe=(t,e=500)=>{let n="";const r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(a,s,o,l)=>{var c,d;const u=((d=(c=a.type.spec).toText)==null?void 0:d.call(c,{node:a,pos:s,parent:o,index:l}))||a.textContent||"%leaf%";n+=a.isAtom&&!a.isText?u:u.slice(0,Math.max(0,r-s))}),n};function iF(t,e,n={}){const{empty:r,ranges:a}=t.selection,s=e?Tu(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(m=>s?s.name===m.type.name:!0).find(m=>vN(m.attrs,n,{strict:!1}));let o=0;const l=[];if(a.forEach(({$from:m,$to:p})=>{const f=m.pos,y=p.pos;t.doc.nodesBetween(f,y,(x,b)=>{if(!x.isText&&!x.marks.length)return;const v=Math.max(f,b),_=Math.min(y,b+x.nodeSize),k=_-v;o+=k,l.push(...x.marks.map(P=>({mark:P,from:v,to:_})))})}),o===0)return!1;const c=l.filter(m=>s?s.name===m.mark.type.name:!0).filter(m=>vN(m.mark.attrs,n,{strict:!1})).reduce((m,p)=>m+p.to-p.from,0),d=l.filter(m=>s?m.mark.type!==s&&m.mark.type.excludes(s):!0).reduce((m,p)=>m+p.to-p.from,0);return(c>0?c+d:c)>=o}function GGe(t,e,n={}){if(!e)return mh(t,null,n)||iF(t,null,n);const r=FT(e,t.schema);return r==="node"?mh(t,e,n):r==="mark"?iF(t,e,n):!1}var WGe=(t,e)=>{const{$from:n,$to:r,$anchor:a}=t.selection;if(e){const s=LT(l=>l.type.name===e)(t.selection);if(!s)return!1;const o=t.doc.resolve(s.pos+1);return a.pos+1===o.end()}return!(r.parentOffset<r.parent.nodeSize-2||n.pos!==r.pos)},KGe=t=>{const{$from:e,$to:n}=t.selection;return!(e.parentOffset>0||e.pos!==n.pos)};function BW(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function HW(t,e){const{nodeExtensions:n}=ex(e),r=n.find(o=>o.name===t);if(!r)return!1;const a={name:r.name,options:r.options,storage:r.storage},s=Er(un(r,"group",a));return typeof s!="string"?!1:s.split(" ").includes("list")}function OT(t,{checkChildren:e=!0,ignoreWhitespace:n=!1}={}){var r;if(n){if(t.type.name==="hardBreak")return!0;if(t.isText)return/^\s*$/m.test((r=t.text)!=null?r:"")}if(t.isText)return!t.text;if(t.isAtom||t.isLeaf)return!1;if(t.content.childCount===0)return!0;if(e){let a=!0;return t.content.forEach(s=>{a!==!1&&(OT(s,{ignoreWhitespace:n,checkChildren:e})||(a=!1))}),a}return!1}function Jie(t){return t instanceof gn}var eae=class tae{constructor(e){this.position=e}static fromJSON(e){return new tae(e.position)}toJSON(){return{position:this.position}}};function YGe(t,e){const n=e.mapping.mapResult(t.position);return{position:new eae(n.pos),mapResult:n}}function XGe(t){return new eae(t)}function QGe(t,e,n){var r;const{selection:a}=e;let s=null;if(Uie(a)&&(s=a.$cursor),s){const l=(r=t.storedMarks)!=null?r:s.marks();return s.parent.type.allowsMarkType(n)&&(!!n.isInSet(l)||!l.some(d=>d.type.excludes(n)))}const{ranges:o}=a;return o.some(({$from:l,$to:c})=>{let d=l.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(l.pos,c.pos,(u,m,p)=>{if(d)return!1;if(u.isInline){const f=!p||p.type.allowsMarkType(n),y=!!n.isInSet(u.marks)||!u.marks.some(x=>x.type.excludes(n));d=f&&y}return!d}),d})}var ZGe=(t,e={})=>({tr:n,state:r,dispatch:a})=>{const{selection:s}=n,{empty:o,ranges:l}=s,c=Tu(t,r.schema);if(a)if(o){const d=qie(r,c);n.addStoredMark(c.create({...d,...e}))}else l.forEach(d=>{const u=d.$from.pos,m=d.$to.pos;r.doc.nodesBetween(u,m,(p,f)=>{const y=Math.max(f,u),x=Math.min(f+p.nodeSize,m);p.marks.find(v=>v.type===c)?p.marks.forEach(v=>{c===v.type&&n.addMark(y,x,c.create({...v.attrs,...e}))}):n.addMark(y,x,c.create(e))})});return QGe(r,n,c)},JGe=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),eWe=(t,e={})=>({state:n,dispatch:r,chain:a})=>{const s=ca(t,n.schema);let o;return n.selection.$anchor.sameParent(n.selection.$head)&&(o=n.selection.$anchor.parent.attrs),s.isTextblock?a().command(({commands:l})=>tW(s,{...o,...e})(n)?!0:l.clearNodes()).command(({state:l})=>tW(s,{...o,...e})(l,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},tWe=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,a=kp(t,0,r.content.size),s=gn.create(r,a);e.setSelection(s)}return!0},nWe=(t,e)=>({tr:n,state:r,dispatch:a})=>{const{selection:s}=r;let o,l;return typeof e=="number"?(o=e,l=e):e&&"from"in e&&"to"in e?(o=e.from,l=e.to):(o=s.from,l=s.to),a&&n.doc.nodesBetween(o,l,(c,d)=>{c.isText||n.setNodeMarkup(d,void 0,{...c.attrs,dir:t})}),!0},rWe=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,{from:a,to:s}=typeof t=="number"?{from:t,to:t}:t,o=jn.atStart(r).from,l=jn.atEnd(r).to,c=kp(a,o,l),d=kp(s,o,l),u=jn.create(r,c,d);e.setSelection(u)}return!0},iWe=t=>({state:e,dispatch:n})=>{const r=ca(t,e.schema);return QVe(r)(e,n)};function $W(t,e){const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const r=n.filter(a=>e?.includes(a.type.name));t.tr.ensureMarks(r)}}var aWe=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:a})=>{const{selection:s,doc:o}=e,{$from:l,$to:c}=s,d=a.extensionManager.attributes,u=A1(d,l.node().type.name,l.node().attrs);if(s instanceof gn&&s.node.isBlock)return!l.parentOffset||!iu(o,l.pos)?!1:(r&&(t&&$W(n,a.extensionManager.splittableMarks),e.split(l.pos).scrollIntoView()),!0);if(!l.parent.isBlock)return!1;const m=c.parentOffset===c.parent.content.size,p=l.depth===0?void 0:DGe(l.node(-1).contentMatchAt(l.indexAfter(-1)));let f=m&&p?[{type:p,attrs:u}]:void 0,y=iu(e.doc,e.mapping.map(l.pos),1,f);if(!f&&!y&&iu(e.doc,e.mapping.map(l.pos),1,p?[{type:p}]:void 0)&&(y=!0,f=p?[{type:p,attrs:u}]:void 0),r){if(y&&(s instanceof jn&&e.deleteSelection(),e.split(e.mapping.map(l.pos),1,f),p&&!m&&!l.parentOffset&&l.parent.type!==p)){const x=e.mapping.map(l.before()),b=e.doc.resolve(x);l.node(-1).canReplaceWith(b.index(),b.index()+1,p)&&e.setNodeMarkup(e.mapping.map(l.before()),p)}t&&$W(n,a.extensionManager.splittableMarks),e.scrollIntoView()}return y},sWe=(t,e={})=>({tr:n,state:r,dispatch:a,editor:s})=>{var o;const l=ca(t,r.schema),{$from:c,$to:d}=r.selection,u=r.selection.node;if(u&&u.isBlock||c.depth<2||!c.sameParent(d))return!1;const m=c.node(-1);if(m.type!==l)return!1;const p=s.extensionManager.attributes;if(c.parent.content.size===0&&c.node(-1).childCount===c.indexAfter(-1)){if(c.depth===2||c.node(-3).type!==l||c.index(-2)!==c.node(-2).childCount-1)return!1;if(a){let v=Lt.empty;const _=c.index(-1)?1:c.index(-2)?2:3;for(let R=c.depth-_;R>=c.depth-3;R-=1)v=Lt.from(c.node(R).copy(v));const k=c.indexAfter(-1)<c.node(-2).childCount?1:c.indexAfter(-2)<c.node(-3).childCount?2:3,P={...A1(p,c.node().type.name,c.node().attrs),...e},C=((o=l.contentMatch.defaultType)==null?void 0:o.createAndFill(P))||void 0;v=v.append(Lt.from(l.createAndFill(null,C)||void 0));const T=c.before(c.depth-(_-1));n.replace(T,c.after(-k),new Wt(v,4-_,0));let N=-1;n.doc.nodesBetween(T,n.doc.content.size,(R,A)=>{if(N>-1)return!1;R.isTextblock&&R.content.size===0&&(N=A+1)}),N>-1&&n.setSelection(jn.near(n.doc.resolve(N))),n.scrollIntoView()}return!0}const f=d.pos===c.end()?m.contentMatchAt(0).defaultType:null,y={...A1(p,m.type.name,m.attrs),...e},x={...A1(p,c.node().type.name,c.node().attrs),...e};n.delete(c.pos,d.pos);const b=f?[{type:l,attrs:y},{type:f,attrs:x}]:[{type:l,attrs:y}];if(!iu(n.doc,c.pos,2))return!1;if(a){const{selection:v,storedMarks:_}=r,{splittableMarks:k}=s.extensionManager,P=_||v.$to.parentOffset&&v.$from.marks();if(n.split(c.pos,2,b).scrollIntoView(),!P||!a)return!0;const C=P.filter(T=>k.includes(T.type.name));n.ensureMarks(C)}return!0},Aj=(t,e)=>{const n=LT(o=>o.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;const a=t.doc.nodeAt(r);return n.node.type===a?.type&&yh(t.doc,n.pos)&&t.join(n.pos),!0},Mj=(t,e)=>{const n=LT(o=>o.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;const a=t.doc.nodeAt(r);return n.node.type===a?.type&&yh(t.doc,r)&&t.join(r),!0},oWe=(t,e,n,r={})=>({editor:a,tr:s,state:o,dispatch:l,chain:c,commands:d,can:u})=>{const{extensions:m,splittableMarks:p}=a.extensionManager,f=ca(t,o.schema),y=ca(e,o.schema),{selection:x,storedMarks:b}=o,{$from:v,$to:_}=x,k=v.blockRange(_),P=b||x.$to.parentOffset&&x.$from.marks();if(!k)return!1;const C=LT(T=>HW(T.type.name,m))(x);if(k.depth>=1&&C&&k.depth-C.depth<=1){if(C.node.type===f)return d.liftListItem(y);if(HW(C.node.type.name,m)&&f.validContent(C.node.content)&&l)return c().command(()=>(s.setNodeMarkup(C.pos,f),!0)).command(()=>Aj(s,f)).command(()=>Mj(s,f)).run()}return!n||!P||!l?c().command(()=>u().wrapInList(f,r)?!0:d.clearNodes()).wrapInList(f,r).command(()=>Aj(s,f)).command(()=>Mj(s,f)).run():c().command(()=>{const T=u().wrapInList(f,r),N=P.filter(R=>p.includes(R.type.name));return s.ensureMarks(N),T?!0:d.clearNodes()}).wrapInList(f,r).command(()=>Aj(s,f)).command(()=>Mj(s,f)).run()},lWe=(t,e={},n={})=>({state:r,commands:a})=>{const{extendEmptyMarkRange:s=!1}=n,o=Tu(t,r.schema);return iF(r,o,e)?a.unsetMark(o,{extendEmptyMarkRange:s}):a.setMark(o,e)},cWe=(t,e,n={})=>({state:r,commands:a})=>{const s=ca(t,r.schema),o=ca(e,r.schema),l=mh(r,s,n);let c;return r.selection.$anchor.sameParent(r.selection.$head)&&(c=r.selection.$anchor.parent.attrs),l?a.setNode(o,c):a.setNode(s,{...c,...n})},dWe=(t,e={})=>({state:n,commands:r})=>{const a=ca(t,n.schema);return mh(n,a,e)?r.lift(a):r.wrapIn(a,e)},uWe=()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let r=0;r<n.length;r+=1){const a=n[r];let s;if(a.spec.isInputRules&&(s=a.getState(t))){if(e){const o=t.tr,l=s.transform;for(let c=l.steps.length-1;c>=0;c-=1)o.step(l.steps[c].invert(l.docs[c]));if(s.text){const c=o.doc.resolve(s.from).marks();o.replaceWith(s.from,s.to,t.schema.text(s.text,c))}else o.delete(s.from,s.to)}return!0}}return!1},mWe=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,{empty:r,ranges:a}=n;return r||e&&a.forEach(s=>{t.removeMark(s.$from.pos,s.$to.pos)}),!0},hWe=(t,e={})=>({tr:n,state:r,dispatch:a})=>{var s;const{extendEmptyMarkRange:o=!1}=e,{selection:l}=n,c=Tu(t,r.schema),{$from:d,empty:u,ranges:m}=l;if(!a)return!0;if(u&&o){let{from:p,to:f}=l;const y=(s=d.marks().find(b=>b.type===c))==null?void 0:s.attrs,x=rI(d,c,y);x&&(p=x.from,f=x.to),n.removeMark(p,f,c)}else m.forEach(p=>{n.removeMark(p.$from.pos,p.$to.pos,c)});return n.removeStoredMark(c),!0},pWe=t=>({tr:e,state:n,dispatch:r})=>{const{selection:a}=n;let s,o;return typeof t=="number"?(s=t,o=t):t&&"from"in t&&"to"in t?(s=t.from,o=t.to):(s=a.from,o=a.to),r&&e.doc.nodesBetween(s,o,(l,c)=>{if(l.isText)return;const d={...l.attrs};delete d.dir,e.setNodeMarkup(c,void 0,d)}),!0},fWe=(t,e={})=>({tr:n,state:r,dispatch:a})=>{let s=null,o=null;const l=FT(typeof t=="string"?t:t.name,r.schema);if(!l)return!1;l==="node"&&(s=ca(t,r.schema)),l==="mark"&&(o=Tu(t,r.schema));let c=!1;return n.selection.ranges.forEach(d=>{const u=d.$from.pos,m=d.$to.pos;let p,f,y,x;n.selection.empty?r.doc.nodesBetween(u,m,(b,v)=>{s&&s===b.type&&(c=!0,y=Math.max(v,u),x=Math.min(v+b.nodeSize,m),p=v,f=b)}):r.doc.nodesBetween(u,m,(b,v)=>{v<u&&s&&s===b.type&&(c=!0,y=Math.max(v,u),x=Math.min(v+b.nodeSize,m),p=v,f=b),v>=u&&v<=m&&(s&&s===b.type&&(c=!0,a&&n.setNodeMarkup(v,void 0,{...b.attrs,...e})),o&&b.marks.length&&b.marks.forEach(_=>{if(o===_.type&&(c=!0,a)){const k=Math.max(v,u),P=Math.min(v+b.nodeSize,m);n.addMark(k,P,o.create({..._.attrs,...e}))}}))}),f&&(p!==void 0&&a&&n.setNodeMarkup(p,void 0,{...f.attrs,...e}),o&&f.marks.length&&f.marks.forEach(b=>{o===b.type&&a&&n.addMark(y,x,o.create({...b.attrs,...e}))}))}),c},gWe=(t,e={})=>({state:n,dispatch:r})=>{const a=ca(t,n.schema);return qVe(a,e)(n,r)},bWe=(t,e={})=>({state:n,dispatch:r})=>{const a=ca(t,n.schema);return VVe(a,e)(n,r)},xWe=class{constructor(){this.callbacks={}}on(t,e){return this.callbacks[t]||(this.callbacks[t]=[]),this.callbacks[t].push(e),this}emit(t,...e){const n=this.callbacks[t];return n&&n.forEach(r=>r.apply(this,e)),this}off(t,e){const n=this.callbacks[t];return n&&(e?this.callbacks[t]=n.filter(r=>r!==e):delete this.callbacks[t]),this}once(t,e){const n=(...r)=>{this.off(t,n),e.apply(this,r)};return this.on(t,n)}removeAllListeners(){this.callbacks={}}},IT=class{constructor(t){var e;this.find=t.find,this.handler=t.handler,this.undoable=(e=t.undoable)!=null?e:!0}},yWe=(t,e)=>{if(nI(e))return e.exec(t);const n=e(t);if(!n)return null;const r=[n.text];return r.index=n.index,r.input=t,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r};function K_(t){var e;const{editor:n,from:r,to:a,text:s,rules:o,plugin:l}=t,{view:c}=n;if(c.composing)return!1;const d=c.state.doc.resolve(r);if(d.parent.type.spec.code||(e=d.nodeBefore||d.nodeAfter)!=null&&e.marks.find(p=>p.type.spec.code))return!1;let u=!1;const m=VGe(d)+s;return o.forEach(p=>{if(u)return;const f=yWe(m,p.find);if(!f)return;const y=c.state.tr,x=DT({state:c.state,transaction:y}),b={from:r-(f[0].length-s.length),to:a},{commands:v,chain:_,can:k}=new RT({editor:n,state:x});p.handler({state:x,range:b,match:f,commands:v,chain:_,can:k})===null||!y.steps.length||(p.undoable&&y.setMeta(l,{transform:y,from:r,to:a,text:s}),c.dispatch(y),u=!0)}),u}function vWe(t){const{editor:e,rules:n}=t,r=new Ci({state:{init(){return null},apply(a,s,o){const l=a.getMeta(r);if(l)return l;const c=a.getMeta("applyInputRules");return c&&setTimeout(()=>{let{text:u}=c;typeof u=="string"?u=u:u=aI(Lt.from(u),o.schema);const{from:m}=c,p=m+u.length;K_({editor:e,from:m,to:p,text:u,rules:n,plugin:r})}),a.selectionSet||a.docChanged?null:s}},props:{handleTextInput(a,s,o,l){return K_({editor:e,from:s,to:o,text:l,rules:n,plugin:r})},handleDOMEvents:{compositionend:a=>(setTimeout(()=>{const{$cursor:s}=a.state.selection;s&&K_({editor:e,from:s.pos,to:s.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(a,s){if(s.key!=="Enter")return!1;const{$cursor:o}=a.state.selection;return o?K_({editor:e,from:o.pos,to:o.pos,text:`
- `,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function wWe(t){return Object.prototype.toString.call(t).slice(8,-1)}function Y_(t){return wWe(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function nae(t,e){const n={...t};return Y_(t)&&Y_(e)&&Object.keys(e).forEach(r=>{Y_(e[r])&&Y_(t[r])?n[r]=nae(t[r],e[r]):n[r]=e[r]}),n}var oI=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{...Er(un(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...Er(un(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(t={}){const e=this.extend({...this.config,addOptions:()=>nae(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}},wh=class rae extends oI{constructor(){super(...arguments),this.type="mark"}static create(e={}){const n=typeof e=="function"?e():e;return new rae(n)}static handleExit({editor:e,mark:n}){const{tr:r}=e.state,a=e.state.selection.$from;if(a.pos===a.end()){const o=a.marks();if(!!!o.find(d=>d?.type.name===n.name))return!1;const c=o.find(d=>d?.type.name===n.name);return c&&r.removeStoredMark(c),r.insertText(" ",a.pos),e.view.dispatch(r),!0}return!1}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}};function SWe(t){return typeof t=="number"}var _We=class{constructor(t){this.find=t.find,this.handler=t.handler}},kWe=(t,e,n)=>{if(nI(e))return[...t.matchAll(e)];const r=e(t,n);return r?r.map(a=>{const s=[a.text];return s.index=a.index,s.input=t,s.data=a.data,a.replaceWith&&(a.text.includes(a.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),s.push(a.replaceWith)),s}):[]};function NWe(t){const{editor:e,state:n,from:r,to:a,rule:s,pasteEvent:o,dropEvent:l}=t,{commands:c,chain:d,can:u}=new RT({editor:e,state:n}),m=[];return n.doc.nodesBetween(r,a,(f,y)=>{var x,b,v,_,k;if((b=(x=f.type)==null?void 0:x.spec)!=null&&b.code||!(f.isText||f.isTextblock||f.isInline))return;const P=(k=(_=(v=f.content)==null?void 0:v.size)!=null?_:f.nodeSize)!=null?k:0,C=Math.max(r,y),T=Math.min(a,y+P);if(C>=T)return;const N=f.isText?f.text||"":f.textBetween(C-y,T-y,void 0,"");kWe(N,s.find,o).forEach(A=>{if(A.index===void 0)return;const D=C+A.index+1,$=D+A[0].length,U={from:n.tr.mapping.map(D),to:n.tr.mapping.map($)},G=s.handler({state:n,range:U,match:A,commands:c,chain:d,can:u,pasteEvent:o,dropEvent:l});m.push(G)})}),m.every(f=>f!==null)}var X_=null,CWe=t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)==null||e.setData("text/html",t),n};function TWe(t){const{editor:e,rules:n}=t;let r=null,a=!1,s=!1,o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,l;try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}const c=({state:u,from:m,to:p,rule:f,pasteEvt:y})=>{const x=u.tr,b=DT({state:u,transaction:x});if(!(!NWe({editor:e,state:b,from:Math.max(m-1,0),to:p.b-1,rule:f,pasteEvent:y,dropEvent:l})||!x.steps.length)){try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}return o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,x}};return n.map(u=>new Ci({view(m){const p=y=>{var x;r=(x=m.dom.parentElement)!=null&&x.contains(y.target)?m.dom.parentElement:null,r&&(X_=e)},f=()=>{X_&&(X_=null)};return window.addEventListener("dragstart",p),window.addEventListener("dragend",f),{destroy(){window.removeEventListener("dragstart",p),window.removeEventListener("dragend",f)}}},props:{handleDOMEvents:{drop:(m,p)=>{if(s=r===m.dom.parentElement,l=p,!s){const f=X_;f?.isEditable&&setTimeout(()=>{const y=f.state.selection;y&&f.commands.deleteRange({from:y.from,to:y.to})},10)}return!1},paste:(m,p)=>{var f;const y=(f=p.clipboardData)==null?void 0:f.getData("text/html");return o=p,a=!!y?.includes("data-pm-slice"),!1}}},appendTransaction:(m,p,f)=>{const y=m[0],x=y.getMeta("uiEvent")==="paste"&&!a,b=y.getMeta("uiEvent")==="drop"&&!s,v=y.getMeta("applyPasteRules"),_=!!v;if(!x&&!b&&!_)return;if(_){let{text:C}=v;typeof C=="string"?C=C:C=aI(Lt.from(C),f.schema);const{from:T}=v,N=T+C.length,R=CWe(C);return c({rule:u,state:f,from:T,to:{b:N},pasteEvt:R})}const k=p.doc.content.findDiffStart(f.doc.content),P=p.doc.content.findDiffEnd(f.doc.content);if(!(!SWe(k)||!P||k===P.b))return c({rule:u,state:f,from:k,to:P,pasteEvt:o})}}))}var zT=class{constructor(t,e){this.splittableMarks=[],this.editor=e,this.baseExtensions=t,this.extensions=Kie(t),this.schema=IGe(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:W_(e.name,this.schema)},r=un(e,"addCommands",n);return r?{...t,...r()}:t},{})}get plugins(){const{editor:t}=this;return SN([...this.extensions].reverse()).flatMap(r=>{const a={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:t,type:W_(r.name,this.schema)},s=[],o=un(r,"addKeyboardShortcuts",a);let l={};if(r.type==="mark"&&un(r,"exitable",a)&&(l.ArrowRight=()=>wh.handleExit({editor:t,mark:r})),o){const p=Object.fromEntries(Object.entries(o()).map(([f,y])=>[f,()=>y({editor:t})]));l={...l,...p}}const c=B9e(l);s.push(c);const d=un(r,"addInputRules",a);if(BW(r,t.options.enableInputRules)&&d){const p=d();if(p&&p.length){const f=vWe({editor:t,rules:p}),y=Array.isArray(f)?f:[f];s.push(...y)}}const u=un(r,"addPasteRules",a);if(BW(r,t.options.enablePasteRules)&&u){const p=u();if(p&&p.length){const f=TWe({editor:t,rules:p});s.push(...f)}}const m=un(r,"addProseMirrorPlugins",a);if(m){const p=m();s.push(...p)}return s})}get attributes(){return Wie(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:e}=ex(this.extensions);return Object.fromEntries(e.filter(n=>!!un(n,"addNodeView")).map(n=>{const r=this.attributes.filter(c=>c.type===n.name),a={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:ca(n.name,this.schema)},s=un(n,"addNodeView",a);if(!s)return[];const o=s();if(!o)return[];const l=(c,d,u,m,p)=>{const f=w0(c,r);return o({node:c,view:d,getPos:u,decorations:m,innerDecorations:p,editor:t,extension:n,HTMLAttributes:f})};return[n.name,l]}))}dispatchTransaction(t){const{editor:e}=this;return SN([...this.extensions].reverse()).reduceRight((r,a)=>{const s={name:a.name,options:a.options,storage:this.editor.extensionStorage[a.name],editor:e,type:W_(a.name,this.schema)},o=un(a,"dispatchTransaction",s);return o?l=>{o.call(s,{transaction:l,next:r})}:r},t)}get markViews(){const{editor:t}=this,{markExtensions:e}=ex(this.extensions);return Object.fromEntries(e.filter(n=>!!un(n,"addMarkView")).map(n=>{const r=this.attributes.filter(l=>l.type===n.name),a={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:Tu(n.name,this.schema)},s=un(n,"addMarkView",a);if(!s)return[];const o=(l,c,d)=>{const u=w0(l,r);return s()({mark:l,view:c,inline:d,editor:t,extension:n,HTMLAttributes:u,updateAttributes:m=>{HWe(l,t,m)}})};return[n.name,o]}))}setupExtensions(){const t=this.extensions;this.editor.extensionStorage=Object.fromEntries(t.map(e=>[e.name,e.storage])),t.forEach(e=>{var n;const r={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:W_(e.name,this.schema)};e.type==="mark"&&((n=Er(un(e,"keepOnSplit",r)))==null||n)&&this.splittableMarks.push(e.name);const a=un(e,"onBeforeCreate",r),s=un(e,"onCreate",r),o=un(e,"onUpdate",r),l=un(e,"onSelectionUpdate",r),c=un(e,"onTransaction",r),d=un(e,"onFocus",r),u=un(e,"onBlur",r),m=un(e,"onDestroy",r);a&&this.editor.on("beforeCreate",a),s&&this.editor.on("create",s),o&&this.editor.on("update",o),l&&this.editor.on("selectionUpdate",l),c&&this.editor.on("transaction",c),d&&this.editor.on("focus",d),u&&this.editor.on("blur",u),m&&this.editor.on("destroy",m)})}};zT.resolve=Kie;zT.sort=SN;zT.flatten=iI;var PWe={};tI(PWe,{ClipboardTextSerializer:()=>aae,Commands:()=>sae,Delete:()=>oae,Drop:()=>lae,Editable:()=>cae,FocusEvents:()=>uae,Keymap:()=>mae,Paste:()=>hae,Tabindex:()=>pae,TextDirection:()=>fae,focusEventsPluginKey:()=>dae});var Gr=class iae extends oI{constructor(){super(...arguments),this.type="extension"}static create(e={}){const n=typeof e=="function"?e():e;return new iae(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},aae=Gr.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Ci({key:new _a("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:r,selection:a}=e,{ranges:s}=a,o=Math.min(...s.map(u=>u.$from.pos)),l=Math.max(...s.map(u=>u.$to.pos)),c=Xie(n);return Yie(r,{from:o,to:l},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:c})}}})]}}),sae=Gr.create({name:"commands",addCommands(){return{...Iie}}}),oae=Gr.create({name:"delete",onUpdate({transaction:t,appendedTransactions:e}){var n,r,a;const s=()=>{var o,l,c,d;if((d=(c=(l=(o=this.editor.options.coreExtensionOptions)==null?void 0:o.delete)==null?void 0:l.filterTransaction)==null?void 0:c.call(l,t))!=null?d:t.getMeta("y-sync$"))return;const u=Vie(t.before,[t,...e]);Zie(u).forEach(f=>{u.mapping.mapResult(f.oldRange.from).deletedAfter&&u.mapping.mapResult(f.oldRange.to).deletedBefore&&u.before.nodesBetween(f.oldRange.from,f.oldRange.to,(y,x)=>{const b=x+y.nodeSize-2,v=f.oldRange.from<=x&&b<=f.oldRange.to;this.editor.emit("delete",{type:"node",node:y,from:x,to:b,newFrom:u.mapping.map(x),newTo:u.mapping.map(b),deletedRange:f.oldRange,newRange:f.newRange,partial:!v,editor:this.editor,transaction:t,combinedTransform:u})})});const p=u.mapping;u.steps.forEach((f,y)=>{var x,b;if(f instanceof Zl){const v=p.slice(y).map(f.from,-1),_=p.slice(y).map(f.to),k=p.invert().map(v,-1),P=p.invert().map(_),C=(x=u.doc.nodeAt(v-1))==null?void 0:x.marks.some(N=>N.eq(f.mark)),T=(b=u.doc.nodeAt(_))==null?void 0:b.marks.some(N=>N.eq(f.mark));this.editor.emit("delete",{type:"mark",mark:f.mark,from:f.from,to:f.to,deletedRange:{from:k,to:P},newRange:{from:v,to:_},partial:!!(T||C),editor:this.editor,transaction:t,combinedTransform:u})}})};(a=(r=(n=this.editor.options.coreExtensionOptions)==null?void 0:n.delete)==null?void 0:r.async)==null||a?setTimeout(s,0):s()}}),lae=Gr.create({name:"drop",addProseMirrorPlugins(){return[new Ci({key:new _a("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}}),cae=Gr.create({name:"editable",addProseMirrorPlugins(){return[new Ci({key:new _a("editable"),props:{editable:()=>this.editor.options.editable}})]}}),dae=new _a("focusEvents"),uae=Gr.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new Ci({key:dae,props:{handleDOMEvents:{focus:(e,n)=>{t.isFocused=!0;const r=t.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,n)=>{t.isFocused=!1;const r=t.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),mae=Gr.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:o})=>[()=>o.undoInputRule(),()=>o.command(({tr:l})=>{const{selection:c,doc:d}=l,{empty:u,$anchor:m}=c,{pos:p,parent:f}=m,y=m.parent.isTextblock&&p>0?l.doc.resolve(p-1):m,x=y.parent.type.spec.isolating,b=m.pos-m.parentOffset,v=x&&y.parent.childCount===1?b===m.pos:Yn.atStart(d).from===p;return!u||!f.type.isTextblock||f.textContent.length||!v||v&&m.parent.type.name==="paragraph"?!1:o.clearNodes()}),()=>o.deleteSelection(),()=>o.joinBackward(),()=>o.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:o})=>[()=>o.deleteSelection(),()=>o.deleteCurrentNode(),()=>o.joinForward(),()=>o.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:o})=>[()=>o.newlineInCode(),()=>o.createParagraphNear(),()=>o.liftEmptyBlock(),()=>o.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()},a={...r},s={...r,"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 wN()||$ie()?s:a},addProseMirrorPlugins(){return[new Ci({key:new _a("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(x=>x.getMeta("composition")))return;const r=t.some(x=>x.docChanged)&&!e.doc.eq(n.doc),a=t.some(x=>x.getMeta("preventClearDocument"));if(!r||a)return;const{empty:s,from:o,to:l}=e.selection,c=Yn.atStart(e.doc).from,d=Yn.atEnd(e.doc).to;if(s||!(o===c&&l===d)||!OT(n.doc))return;const p=n.tr,f=DT({state:n,transaction:p}),{commands:y}=new RT({editor:this.editor,state:f});if(y.clearNodes(),!!p.steps.length)return p}})]}}),hae=Gr.create({name:"paste",addProseMirrorPlugins(){return[new Ci({key:new _a("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),pae=Gr.create({name:"tabindex",addProseMirrorPlugins(){return[new Ci({key:new _a("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),fae=Gr.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:t}=ex(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 Ci({key:new _a("textDirection"),props:{attributes:()=>{const t=this.options.direction;return t?{dir:t}:{}}}})]}}),AWe=class tv{constructor(e,n,r=!1,a=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=n,this.currentNode=a}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,r=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,r=this.to-1}this.editor.commands.insertContentAt({from:n,to:r},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 tv(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 tv(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 tv(e,this.editor)}get children(){const e=[];return this.node.content.forEach((n,r)=>{const a=n.isBlock&&!n.isTextblock,s=n.isAtom&&!n.isText,o=n.isInline,l=this.pos+r+(s?0:1);if(l<0||l>this.resolvedPos.doc.nodeSize-2)return;const c=this.resolvedPos.doc.resolve(l);if(!a&&!o&&c.depth<=this.depth)return;const d=new tv(c,this.editor,a,a||o?n:null);a&&(d.actualDepth=this.depth+1),e.push(d)}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,n={}){let r=null,a=this.parent;for(;a&&!r;){if(a.node.type.name===e)if(Object.keys(n).length>0){const s=a.node.attrs,o=Object.keys(n);for(let l=0;l<o.length;l+=1){const c=o[l];if(s[c]!==n[c])break}}else r=a;a=a.parent}return r}querySelector(e,n={}){return this.querySelectorAll(e,n,!0)[0]||null}querySelectorAll(e,n={},r=!1){let a=[];if(!this.children||this.children.length===0)return a;const s=Object.keys(n);return this.children.forEach(o=>{r&&a.length>0||(o.node.type.name===e&&s.every(c=>n[c]===o.node.attrs[c])&&a.push(o),!(r&&a.length>0)&&(a=a.concat(o.querySelectorAll(e,n,r))))}),a}setAttribute(e){const{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(n)}},MWe=`.ProseMirror {
- position: relative;
- }
- .ProseMirror {
- word-wrap: break-word;
- white-space: pre-wrap;
- white-space: break-spaces;
- -webkit-font-variant-ligatures: none;
- font-variant-ligatures: none;
- font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
- }
- .ProseMirror [contenteditable="false"] {
- white-space: normal;
- }
- .ProseMirror [contenteditable="false"] [contenteditable="true"] {
- white-space: pre-wrap;
- }
- .ProseMirror pre {
- white-space: pre-wrap;
- }
- img.ProseMirror-separator {
- display: inline !important;
- border: none !important;
- margin: 0 !important;
- width: 0 !important;
- height: 0 !important;
- }
- .ProseMirror-gapcursor {
- display: none;
- pointer-events: none;
- position: absolute;
- margin: 0;
- }
- .ProseMirror-gapcursor:after {
- content: "";
- display: block;
- position: absolute;
- top: -2px;
- width: 20px;
- border-top: 1px solid black;
- animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
- }
- @keyframes ProseMirror-cursor-blink {
- to {
- visibility: hidden;
- }
- }
- .ProseMirror-hideselection *::selection {
- background: transparent;
- }
- .ProseMirror-hideselection *::-moz-selection {
- background: transparent;
- }
- .ProseMirror-hideselection * {
- caret-color: transparent;
- }
- .ProseMirror-focused .ProseMirror-gapcursor {
- display: block;
- }`;function EWe(t,e,n){const r=document.querySelector("style[data-tiptap-style]");if(r!==null)return r;const a=document.createElement("style");return e&&a.setAttribute("nonce",e),a.setAttribute("data-tiptap-style",""),a.innerHTML=t,document.getElementsByTagName("head")[0].appendChild(a),a}var jWe=class extends xWe{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:r})=>{throw r},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:YGe,createMappablePosition:XGe},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:r,slice:a,moved:s})=>this.options.onDrop(r,a,s)),this.on("paste",({event:r,slice:a})=>this.options.onPaste(r,a)),this.on("delete",this.options.onDelete);const e=this.createDoc(),n=Bie(e,this.options.autofocus);this.editorState=db.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=EWe(MWe,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=Gie(e)?e(t,[...this.state.plugins]):[...this.state.plugins,t],r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}unregisterPlugin(t){if(this.isDestroyed)return;const e=this.state.plugins;let n=e;if([].concat(t).forEach(a=>{const s=typeof a=="string"?`${a}$`:a.key;n=n.filter(o=>!o.key.startsWith(s))}),e.length===n.length)return;const r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}createExtensionManager(){var t,e;const r=[...this.options.enableCoreExtensions?[cae,aae.configure({blockSeparator:(e=(t=this.options.coreExtensionOptions)==null?void 0:t.clipboardTextSerializer)==null?void 0:e.blockSeparator}),sae,uae,mae,pae,lae,hae,oae,fae.configure({direction:this.options.textDirection})].filter(a=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[a.name]!==!1:!0):[],...this.options.extensions].filter(a=>["extension","node","mark"].includes(a?.type));this.extensionManager=new zT(r,this)}createCommandManager(){this.commandManager=new RT({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let t;try{t=rF(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=rF(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return t}createView(t){const{editorProps:e,enableExtensionDispatchTransaction:n}=this.options,r=e.dispatchTransaction||this.dispatchTransaction.bind(this),a=n?this.extensionManager.dispatchTransaction(r):r;this.editorView=new Lie(t,{...e,attributes:{role:"textbox",...e?.attributes},dispatchTransaction:a,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const s=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(s),this.prependClass(),this.injectCSS();const o=this.view.dom;o.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(d=>{var u;return(u=this.capturedTransaction)==null?void 0:u.step(d)});return}const{state:e,transactions:n}=this.state.applyTransaction(t),r=!this.state.selection.eq(e.selection),a=n.includes(t),s=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:t,nextState:e}),!a)return;this.view.updateState(e),this.emit("transaction",{editor:this,transaction:t,appendedTransactions:n.slice(1)}),r&&this.emit("selectionUpdate",{editor:this,transaction:t});const o=n.findLast(d=>d.getMeta("focus")||d.getMeta("blur")),l=o?.getMeta("focus"),c=o?.getMeta("blur");l&&this.emit("focus",{editor:this,event:l.event,transaction:o}),c&&this.emit("blur",{editor:this,event:c.event,transaction:o}),!(t.getMeta("preventUpdate")||!n.some(d=>d.docChanged)||s.doc.eq(e.doc))&&this.emit("update",{editor:this,transaction:t,appendedTransactions:n.slice(1)})}getAttributes(t){return Qie(this.state,t)}isActive(t,e){const n=typeof t=="string"?t:null,r=typeof t=="string"?e:t;return GGe(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return aI(this.state.doc.content,this.schema)}getText(t){const{blockSeparator:e=`
- `,textSerializers:n={}}=t||{};return UGe(this.state.doc,{blockSeparator:e,textSerializers:{...Xie(this.schema),...n}})}get isEmpty(){return OT(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 AWe(e,this)}get $doc(){return this.$pos(0)}};function tx(t){return new IT({find:t.find,handler:({state:e,range:n,match:r})=>{const a=Er(t.getAttributes,void 0,r);if(a===!1||a===null)return null;const{tr:s}=e,o=r[r.length-1],l=r[0];if(o){const c=l.search(/\S/),d=n.from+l.indexOf(o),u=d+o.length;if(sI(n.from,n.to,e.doc).filter(f=>f.mark.type.excluded.find(x=>x===t.type&&x!==f.mark.type)).filter(f=>f.to>d).length)return null;u<n.to&&s.delete(u,n.to),d>n.from&&s.delete(n.from+c,d);const p=n.from+c+o.length;s.addMark(n.from+c,p,t.type.create(a||{})),s.removeStoredMark(t.type)}},undoable:t.undoable})}function gae(t){return new IT({find:t.find,handler:({state:e,range:n,match:r})=>{const a=Er(t.getAttributes,void 0,r)||{},{tr:s}=e,o=n.from;let l=n.to;const c=t.type.create(a);if(r[1]){const d=r[0].lastIndexOf(r[1]);let u=o+d;u>l?u=l:l=u+r[1].length;const m=r[0][r[0].length-1];s.insertText(m,o+r[0].length-1),s.replaceWith(u,l,c)}else if(r[0]){const d=t.type.isInline?o:o-1;s.insert(d,t.type.create(a)).delete(s.mapping.map(o),s.mapping.map(l))}s.scrollIntoView()},undoable:t.undoable})}function aF(t){return new IT({find:t.find,handler:({state:e,range:n,match:r})=>{const a=e.doc.resolve(n.from),s=Er(t.getAttributes,void 0,r)||{};if(!a.node(-1).canReplaceWith(a.index(-1),a.indexAfter(-1),t.type))return null;e.tr.delete(n.from,n.to).setBlockType(n.from,n.from,t.type,s)},undoable:t.undoable})}function nx(t){return new IT({find:t.find,handler:({state:e,range:n,match:r,chain:a})=>{const s=Er(t.getAttributes,void 0,r)||{},o=e.tr.delete(n.from,n.to),c=o.doc.resolve(n.from).blockRange(),d=c&&z4(c,t.type,s);if(!d)return null;if(o.wrap(c,d),t.keepMarks&&t.editor){const{selection:m,storedMarks:p}=e,{splittableMarks:f}=t.editor.extensionManager,y=p||m.$to.parentOffset&&m.$from.marks();if(y){const x=y.filter(b=>f.includes(b.type.name));o.ensureMarks(x)}}if(t.keepAttributes){const m=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";a().updateAttributes(m,s).run()}const u=o.doc.resolve(n.from-1).nodeBefore;u&&u.type===t.type&&yh(o.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,u))&&o.join(n.from-1)},undoable:t.undoable})}var DWe=t=>"touches"in t,RWe=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.lastEditableState=void 0,this.handleMap=new Map,this.handleMouseMove=l=>{if(!this.isResizing||!this.activeHandle)return;const c=l.clientX-this.startX,d=l.clientY-this.startY;this.handleResize(c,d)},this.handleTouchMove=l=>{if(!this.isResizing||!this.activeHandle)return;const c=l.touches[0];if(!c)return;const d=c.clientX-this.startX,u=c.clientY-this.startY;this.handleResize(d,u)},this.handleMouseUp=()=>{if(!this.isResizing)return;const l=this.element.offsetWidth,c=this.element.offsetHeight;this.onCommit(l,c),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=l=>{l.key==="Shift"&&(this.isShiftKeyPressed=!0)},this.handleKeyUp=l=>{l.key==="Shift"&&(this.isShiftKeyPressed=!1)};var e,n,r,a,s,o;this.node=t.node,this.editor=t.editor,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),(r=t?.options)!=null&&r.directions&&(this.directions=t.options.directions),(a=t.options)!=null&&a.preserveAspectRatio&&(this.preserveAspectRatio=t.options.preserveAspectRatio),(s=t.options)!=null&&s.className&&(this.classNames={container:t.options.className.container||"",wrapper:t.options.className.wrapper||"",handle:t.options.className.handle||"",resizing:t.options.className.resizing||""}),(o=t.options)!=null&&o.createCustomHandle&&(this.createCustomHandle=t.options.createCustomHandle),this.wrapper=this.createWrapper(),this.container=this.createContainer(),this.applyInitialSize(),this.attachHandles(),this.editor.on("update",this.handleEditorUpdate.bind(this))}get dom(){return this.container}get contentDOM(){var t;return(t=this.contentElement)!=null?t:null}handleEditorUpdate(){const t=this.editor.isEditable;t!==this.lastEditableState&&(this.lastEditableState=t,t?t&&this.handleMap.size===0&&this.attachHandles():this.removeHandles())}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.editor.off("update",this.handleEditorUpdate.bind(this)),this.container.remove()}createContainer(){const t=document.createElement("div");return t.dataset.resizeContainer="",t.dataset.node=this.node.type.name,t.style.display="flex",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"),r=e.includes("bottom"),a=e.includes("left"),s=e.includes("right");n&&(t.style.top="0"),r&&(t.style.bottom="0"),a&&(t.style.left="0"),s&&(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=>{let e;this.createCustomHandle?e=this.createCustomHandle(t):e=this.createHandle(t),e instanceof HTMLElement||(console.warn(`[ResizableNodeView] createCustomHandle("${t}") did not return an HTMLElement. Falling back to default handle.`),e=this.createHandle(t)),this.createCustomHandle||this.positionHandle(e,t),e.addEventListener("mousedown",n=>this.handleResizeStart(n,t)),e.addEventListener("touchstart",n=>this.handleResizeStart(n,t)),this.handleMap.set(t,e),this.wrapper.appendChild(e)})}removeHandles(){this.handleMap.forEach(t=>t.remove()),this.handleMap.clear()}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,DWe(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:r,height:a}=this.calculateNewDimensions(this.activeHandle,t,e),s=this.applyConstraints(r,a,n);this.element.style.width=`${s.width}px`,this.element.style.height=`${s.height}px`,this.onResize&&this.onResize(s.width,s.height)}calculateNewDimensions(t,e,n){let r=this.startWidth,a=this.startHeight;const s=t.includes("right"),o=t.includes("left"),l=t.includes("bottom"),c=t.includes("top");return s?r=this.startWidth+e:o&&(r=this.startWidth-e),l?a=this.startHeight+n:c&&(a=this.startHeight-n),(t==="right"||t==="left")&&(r=this.startWidth+(s?e:-e)),(t==="top"||t==="bottom")&&(a=this.startHeight+(l?n:-n)),this.preserveAspectRatio||this.isShiftKeyPressed?this.applyAspectRatio(r,a,t):{width:r,height:a}}applyConstraints(t,e,n){var r,a,s,o;if(!n){let d=Math.max(this.minSize.width,t),u=Math.max(this.minSize.height,e);return(r=this.maxSize)!=null&&r.width&&(d=Math.min(this.maxSize.width,d)),(a=this.maxSize)!=null&&a.height&&(u=Math.min(this.maxSize.height,u)),{width:d,height:u}}let l=t,c=e;return l<this.minSize.width&&(l=this.minSize.width,c=l/this.aspectRatio),c<this.minSize.height&&(c=this.minSize.height,l=c*this.aspectRatio),(s=this.maxSize)!=null&&s.width&&l>this.maxSize.width&&(l=this.maxSize.width,c=l/this.aspectRatio),(o=this.maxSize)!=null&&o.height&&c>this.maxSize.height&&(c=this.maxSize.height,l=c*this.aspectRatio),{width:l,height:c}}applyAspectRatio(t,e,n){const r=n==="left"||n==="right",a=n==="top"||n==="bottom";return r?{width:t,height:t/this.aspectRatio}:a?{width:e*this.aspectRatio,height:e}:{width:t,height:t/this.aspectRatio}}};function FWe(t,e){const{selection:n}=t,{$from:r}=n;if(n instanceof gn){const s=r.index();return r.parent.canReplaceWith(s,s+1,e)}let a=r.depth;for(;a>=0;){const s=r.index(a);if(r.node(a).contentMatchAt(s).matchType(e))return!0;a-=1}return!1}var LWe={};tI(LWe,{createAtomBlockMarkdownSpec:()=>OWe,createBlockMarkdownSpec:()=>IWe,createInlineMarkdownSpec:()=>BWe,parseAttributes:()=>lI,parseIndentedBlocks:()=>sF,renderNestedMarkdownContent:()=>dI,serializeAttributes:()=>cI});function lI(t){if(!t?.trim())return{};const e={},n=[],r=t.replace(/["']([^"']*)["']/g,d=>(n.push(d),`__QUOTED_${n.length-1}__`)),a=r.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(a){const d=a.map(u=>u.trim().slice(1));e.class=d.join(" ")}const s=r.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);s&&(e.id=s[1]);const o=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(r.matchAll(o)).forEach(([,d,u])=>{var m;const p=parseInt(((m=u.match(/__QUOTED_(\d+)__/))==null?void 0:m[1])||"0",10),f=n[p];f&&(e[d]=f.slice(1,-1))});const c=r.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 c&&c.split(/\s+/).filter(Boolean).forEach(u=>{u.match(/^[a-zA-Z][\w-]*$/)&&(e[u]=!0)}),e}function cI(t){if(!t||Object.keys(t).length===0)return"";const e=[];return t.class&&String(t.class).split(/\s+/).filter(Boolean).forEach(r=>e.push(`.${r}`)),t.id&&e.push(`#${t.id}`),Object.entries(t).forEach(([n,r])=>{n==="class"||n==="id"||(r===!0?e.push(n):r!==!1&&r!=null&&e.push(`${n}="${String(r)}"`))}),e.join(" ")}function OWe(t){const{nodeName:e,name:n,parseAttributes:r=lI,serializeAttributes:a=cI,defaultAttributes:s={},requiredAttributes:o=[],allowedAttributes:l}=t,c=n||e,d=u=>{if(!l)return u;const m={};return l.forEach(p=>{p in u&&(m[p]=u[p])}),m};return{parseMarkdown:(u,m)=>{const p={...s,...u.attributes};return m.createNode(e,p,[])},markdownTokenizer:{name:e,level:"block",start(u){var m;const p=new RegExp(`^:::${c}(?:\\s|$)`,"m"),f=(m=u.match(p))==null?void 0:m.index;return f!==void 0?f:-1},tokenize(u,m,p){const f=new RegExp(`^:::${c}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),y=u.match(f);if(!y)return;const x=y[1]||"",b=r(x);if(!o.find(_=>!(_ in b)))return{type:e,raw:y[0],attributes:b}}},renderMarkdown:u=>{const m=d(u.attrs||{}),p=a(m),f=p?` {${p}}`:"";return`:::${c}${f} :::`}}}function IWe(t){const{nodeName:e,name:n,getContent:r,parseAttributes:a=lI,serializeAttributes:s=cI,defaultAttributes:o={},content:l="block",allowedAttributes:c}=t,d=n||e,u=m=>{if(!c)return m;const p={};return c.forEach(f=>{f in m&&(p[f]=m[f])}),p};return{parseMarkdown:(m,p)=>{let f;if(r){const x=r(m);f=typeof x=="string"?[{type:"text",text:x}]:x}else l==="block"?f=p.parseChildren(m.tokens||[]):f=p.parseInline(m.tokens||[]);const y={...o,...m.attributes};return p.createNode(e,y,f)},markdownTokenizer:{name:e,level:"block",start(m){var p;const f=new RegExp(`^:::${d}`,"m"),y=(p=m.match(f))==null?void 0:p.index;return y!==void 0?y:-1},tokenize(m,p,f){var y;const x=new RegExp(`^:::${d}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),b=m.match(x);if(!b)return;const[v,_=""]=b,k=a(_);let P=1;const C=v.length;let T="";const N=/^:::([\w-]*)(\s.*)?/gm,R=m.slice(C);for(N.lastIndex=0;;){const A=N.exec(R);if(A===null)break;const D=A.index,$=A[1];if(!((y=A[2])!=null&&y.endsWith(":::"))){if($)P+=1;else if(P-=1,P===0){const U=R.slice(0,D);T=U.trim();const G=m.slice(0,C+D+A[0].length);let L=[];if(T)if(l==="block")for(L=f.blockTokens(U),L.forEach(te=>{te.text&&(!te.tokens||te.tokens.length===0)&&(te.tokens=f.inlineTokens(te.text))});L.length>0;){const te=L[L.length-1];if(te.type==="paragraph"&&(!te.text||te.text.trim()===""))L.pop();else break}else L=f.inlineTokens(T);return{type:e,raw:G,attributes:k,content:T,tokens:L}}}}}},renderMarkdown:(m,p)=>{const f=u(m.attrs||{}),y=s(f),x=y?` {${y}}`:"",b=p.renderChildren(m.content||[],`
- `);return`:::${d}${x}
- ${b}
- :::`}}}function zWe(t){if(!t.trim())return{};const e={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let r=n.exec(t);for(;r!==null;){const[,a,s,o]=r;e[a]=s||o,r=n.exec(t)}return e}function UWe(t){return Object.entries(t).filter(([,e])=>e!=null).map(([e,n])=>`${e}="${n}"`).join(" ")}function BWe(t){const{nodeName:e,name:n,getContent:r,parseAttributes:a=zWe,serializeAttributes:s=UWe,defaultAttributes:o={},selfClosing:l=!1,allowedAttributes:c}=t,d=n||e,u=p=>{if(!c)return p;const f={};return c.forEach(y=>{const x=typeof y=="string"?y:y.name,b=typeof y=="string"?void 0:y.skipIfDefault;if(x in p){const v=p[x];if(b!==void 0&&v===b)return;f[x]=v}}),f},m=d.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(p,f)=>{const y={...o,...p.attributes};if(l)return f.createNode(e,y);const x=r?r(p):p.content||"";return x?f.createNode(e,y,[f.createTextNode(x)]):f.createNode(e,y,[])},markdownTokenizer:{name:e,level:"inline",start(p){const f=l?new RegExp(`\\[${m}\\s*[^\\]]*\\]`):new RegExp(`\\[${m}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${m}\\]`),y=p.match(f),x=y?.index;return x!==void 0?x:-1},tokenize(p,f,y){const x=l?new RegExp(`^\\[${m}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${m}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${m}\\]`),b=p.match(x);if(!b)return;let v="",_="";if(l){const[,P]=b;_=P}else{const[,P,C]=b;_=P,v=C||""}const k=a(_.trim());return{type:e,raw:b[0],content:v.trim(),attributes:k}}},renderMarkdown:p=>{let f="";r?f=r(p):p.content&&p.content.length>0&&(f=p.content.filter(v=>v.type==="text").map(v=>v.text).join(""));const y=u(p.attrs||{}),x=s(y),b=x?` ${x}`:"";return l?`[${d}${b}]`:`[${d}${b}]${f}[/${d}]`}}}function sF(t,e,n){var r,a,s,o;const l=t.split(`
- `),c=[];let d="",u=0;const m=e.baseIndentSize||2;for(;u<l.length;){const p=l[u],f=p.match(e.itemPattern);if(!f){if(c.length>0)break;if(p.trim()===""){u+=1,d=`${d}${p}
- `;continue}else return}const y=e.extractItemData(f),{indentLevel:x,mainContent:b}=y;d=`${d}${p}
- `;const v=[b];for(u+=1;u<l.length;){const C=l[u];if(C.trim()===""){const N=l.slice(u+1).findIndex(D=>D.trim()!=="");if(N===-1)break;if((((a=(r=l[u+1+N].match(/^(\s*)/))==null?void 0:r[1])==null?void 0:a.length)||0)>x){v.push(C),d=`${d}${C}
- `,u+=1;continue}else break}if((((o=(s=C.match(/^(\s*)/))==null?void 0:s[1])==null?void 0:o.length)||0)>x)v.push(C),d=`${d}${C}
- `,u+=1;else break}let _;const k=v.slice(1);if(k.length>0){const C=k.map(T=>T.slice(x+m)).join(`
- `);C.trim()&&(e.customNestedParser?_=e.customNestedParser(C):_=n.blockTokens(C))}const P=e.createToken(y,_);c.push(P)}if(c.length!==0)return{items:c,raw:d}}function dI(t,e,n,r){if(!t||!Array.isArray(t.content))return"";const a=typeof n=="function"?n(r):n,[s,...o]=t.content,l=e.renderChildren([s]),c=[`${a}${l}`];return o&&o.length>0&&o.forEach(d=>{const u=e.renderChildren([d]);if(u){const m=u.split(`
- `).map(p=>p?e.indent(p):"").join(`
- `);c.push(m)}}),c.join(`
- `)}function HWe(t,e,n={}){const{state:r}=e,{doc:a,tr:s}=r,o=t;a.descendants((l,c)=>{const d=s.mapping.map(c),u=s.mapping.map(c)+l.nodeSize;let m=null;if(l.marks.forEach(f=>{if(f!==o)return!1;m=f}),!m)return;let p=!1;if(Object.keys(n).forEach(f=>{n[f]!==m.attrs[f]&&(p=!0)}),p){const f=t.type.create({...t.attrs,...n});s.removeMark(d,u,t.type),s.addMark(d,u,f)}}),s.docChanged&&e.view.dispatch(s)}var po=class bae extends oI{constructor(){super(...arguments),this.type="node"}static create(e={}){const n=typeof e=="function"?e():e;return new bae(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}};function hf(t){return new _We({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:a})=>{const s=Er(t.getAttributes,void 0,r,a);if(s===!1||s===null)return null;const{tr:o}=e,l=r[r.length-1],c=r[0];let d=n.to;if(l){const u=c.search(/\S/),m=n.from+c.indexOf(l),p=m+l.length;if(sI(n.from,n.to,e.doc).filter(y=>y.mark.type.excluded.find(b=>b===t.type&&b!==y.mark.type)).filter(y=>y.to>m).length)return null;p<n.to&&o.delete(p,n.to),m>n.from&&o.delete(n.from+u,m),d=n.from+u+l.length,o.addMark(n.from+u,d,t.type.create(s||{})),o.removeStoredMark(t.type)}}})}const{getOwnPropertyNames:$We,getOwnPropertySymbols:qWe}=Object,{hasOwnProperty:VWe}=Object.prototype;function Ej(t,e){return function(r,a,s){return t(r,a,s)&&e(r,a,s)}}function Q_(t){return function(n,r,a){if(!n||!r||typeof n!="object"||typeof r!="object")return t(n,r,a);const{cache:s}=a,o=s.get(n),l=s.get(r);if(o&&l)return o===r&&l===n;s.set(n,r),s.set(r,n);const c=t(n,r,a);return s.delete(n),s.delete(r),c}}function GWe(t){return t?.[Symbol.toStringTag]}function qW(t){return $We(t).concat(qWe(t))}const WWe=Object.hasOwn||((t,e)=>VWe.call(t,e));function _f(t,e){return t===e||!t&&!e&&t!==t&&e!==e}const KWe="__v",YWe="__o",XWe="_owner",{getOwnPropertyDescriptor:VW,keys:GW}=Object;function QWe(t,e){return t.byteLength===e.byteLength&&_N(new Uint8Array(t),new Uint8Array(e))}function ZWe(t,e,n){let r=t.length;if(e.length!==r)return!1;for(;r-- >0;)if(!n.equals(t[r],e[r],r,r,t,e,n))return!1;return!0}function JWe(t,e){return t.byteLength===e.byteLength&&_N(new Uint8Array(t.buffer,t.byteOffset,t.byteLength),new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}function eKe(t,e){return _f(t.getTime(),e.getTime())}function tKe(t,e){return t.name===e.name&&t.message===e.message&&t.cause===e.cause&&t.stack===e.stack}function nKe(t,e){return t===e}function WW(t,e,n){const r=t.size;if(r!==e.size)return!1;if(!r)return!0;const a=new Array(r),s=t.entries();let o,l,c=0;for(;(o=s.next())&&!o.done;){const d=e.entries();let u=!1,m=0;for(;(l=d.next())&&!l.done;){if(a[m]){m++;continue}const p=o.value,f=l.value;if(n.equals(p[0],f[0],c,m,t,e,n)&&n.equals(p[1],f[1],p[0],f[0],t,e,n)){u=a[m]=!0;break}m++}if(!u)return!1;c++}return!0}const rKe=_f;function iKe(t,e,n){const r=GW(t);let a=r.length;if(GW(e).length!==a)return!1;for(;a-- >0;)if(!xae(t,e,n,r[a]))return!1;return!0}function Hy(t,e,n){const r=qW(t);let a=r.length;if(qW(e).length!==a)return!1;let s,o,l;for(;a-- >0;)if(s=r[a],!xae(t,e,n,s)||(o=VW(t,s),l=VW(e,s),(o||l)&&(!o||!l||o.configurable!==l.configurable||o.enumerable!==l.enumerable||o.writable!==l.writable)))return!1;return!0}function aKe(t,e){return _f(t.valueOf(),e.valueOf())}function sKe(t,e){return t.source===e.source&&t.flags===e.flags}function KW(t,e,n){const r=t.size;if(r!==e.size)return!1;if(!r)return!0;const a=new Array(r),s=t.values();let o,l;for(;(o=s.next())&&!o.done;){const c=e.values();let d=!1,u=0;for(;(l=c.next())&&!l.done;){if(!a[u]&&n.equals(o.value,l.value,o.value,l.value,t,e,n)){d=a[u]=!0;break}u++}if(!d)return!1}return!0}function _N(t,e){let n=t.byteLength;if(e.byteLength!==n||t.byteOffset!==e.byteOffset)return!1;for(;n-- >0;)if(t[n]!==e[n])return!1;return!0}function oKe(t,e){return t.hostname===e.hostname&&t.pathname===e.pathname&&t.protocol===e.protocol&&t.port===e.port&&t.hash===e.hash&&t.username===e.username&&t.password===e.password}function xae(t,e,n,r){return(r===XWe||r===YWe||r===KWe)&&(t.$$typeof||e.$$typeof)?!0:WWe(e,r)&&n.equals(t[r],e[r],r,r,t,e,n)}const lKe="[object ArrayBuffer]",cKe="[object Arguments]",dKe="[object Boolean]",uKe="[object DataView]",mKe="[object Date]",hKe="[object Error]",pKe="[object Map]",fKe="[object Number]",gKe="[object Object]",bKe="[object RegExp]",xKe="[object Set]",yKe="[object String]",vKe={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},wKe="[object URL]",SKe=Object.prototype.toString;function _Ke({areArrayBuffersEqual:t,areArraysEqual:e,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:a,areFunctionsEqual:s,areMapsEqual:o,areNumbersEqual:l,areObjectsEqual:c,arePrimitiveWrappersEqual:d,areRegExpsEqual:u,areSetsEqual:m,areTypedArraysEqual:p,areUrlsEqual:f,unknownTagComparators:y}){return function(b,v,_){if(b===v)return!0;if(b==null||v==null)return!1;const k=typeof b;if(k!==typeof v)return!1;if(k!=="object")return k==="number"?l(b,v,_):k==="function"?s(b,v,_):!1;const P=b.constructor;if(P!==v.constructor)return!1;if(P===Object)return c(b,v,_);if(Array.isArray(b))return e(b,v,_);if(P===Date)return r(b,v,_);if(P===RegExp)return u(b,v,_);if(P===Map)return o(b,v,_);if(P===Set)return m(b,v,_);const C=SKe.call(b);if(C===mKe)return r(b,v,_);if(C===bKe)return u(b,v,_);if(C===pKe)return o(b,v,_);if(C===xKe)return m(b,v,_);if(C===gKe)return typeof b.then!="function"&&typeof v.then!="function"&&c(b,v,_);if(C===wKe)return f(b,v,_);if(C===hKe)return a(b,v,_);if(C===cKe)return c(b,v,_);if(vKe[C])return p(b,v,_);if(C===lKe)return t(b,v,_);if(C===uKe)return n(b,v,_);if(C===dKe||C===fKe||C===yKe)return d(b,v,_);if(y){let T=y[C];if(!T){const N=GWe(b);N&&(T=y[N])}if(T)return T(b,v,_)}return!1}}function kKe({circular:t,createCustomConfig:e,strict:n}){let r={areArrayBuffersEqual:QWe,areArraysEqual:n?Hy:ZWe,areDataViewsEqual:JWe,areDatesEqual:eKe,areErrorsEqual:tKe,areFunctionsEqual:nKe,areMapsEqual:n?Ej(WW,Hy):WW,areNumbersEqual:rKe,areObjectsEqual:n?Hy:iKe,arePrimitiveWrappersEqual:aKe,areRegExpsEqual:sKe,areSetsEqual:n?Ej(KW,Hy):KW,areTypedArraysEqual:n?Ej(_N,Hy):_N,areUrlsEqual:oKe,unknownTagComparators:void 0};if(e&&(r=Object.assign({},r,e(r))),t){const a=Q_(r.areArraysEqual),s=Q_(r.areMapsEqual),o=Q_(r.areObjectsEqual),l=Q_(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:a,areMapsEqual:s,areObjectsEqual:o,areSetsEqual:l})}return r}function NKe(t){return function(e,n,r,a,s,o,l){return t(e,n,l)}}function CKe({circular:t,comparator:e,createState:n,equals:r,strict:a}){if(n)return function(l,c){const{cache:d=t?new WeakMap:void 0,meta:u}=n();return e(l,c,{cache:d,equals:r,meta:u,strict:a})};if(t)return function(l,c){return e(l,c,{cache:new WeakMap,equals:r,meta:void 0,strict:a})};const s={cache:void 0,equals:r,meta:void 0,strict:a};return function(l,c){return e(l,c,s)}}const TKe=Sh();Sh({strict:!0});Sh({circular:!0});Sh({circular:!0,strict:!0});Sh({createInternalComparator:()=>_f});Sh({strict:!0,createInternalComparator:()=>_f});Sh({circular:!0,createInternalComparator:()=>_f});Sh({circular:!0,createInternalComparator:()=>_f,strict:!0});function Sh(t={}){const{circular:e=!1,createInternalComparator:n,createState:r,strict:a=!1}=t,s=kKe(t),o=_Ke(s),l=n?n(o):NKe(o);return CKe({circular:e,comparator:o,createState:r,equals:l,strict:a})}var PKe=(...t)=>e=>{t.forEach(n=>{typeof n=="function"?n(e):n&&(n.current=e)})},AKe=({contentComponent:t})=>{const e=AF.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getServerSnapshot);return i.jsx(i.Fragment,{children:Object.values(e)})};function MKe(){const t=new Set;let e={};return{subscribe(n){return t.add(n),()=>{t.delete(n)}},getSnapshot(){return e},getServerSnapshot(){return e},setRenderer(n,r){e={...e,[n]:Fue.createPortal(r.reactElement,r.element,n)},t.forEach(a=>a())},removeRenderer(n){const r={...e};delete r[n],e=r,t.forEach(a=>a())}}}var EKe=class extends Kr.Component{constructor(t){var e;super(t),this.editorContentRef=Kr.createRef(),this.initialized=!1,this.state={hasContentComponentInitialized:!!((e=t.editor)!=null&&e.contentComponent)}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){var t;const e=this.props.editor;if(e&&!e.isDestroyed&&((t=e.view.dom)!=null&&t.parentNode)){if(e.contentComponent)return;const n=this.editorContentRef.current;n.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:n}),e.contentComponent=MKe(),this.state.hasContentComponentInitialized||(this.unsubscribeToContentComponent=e.contentComponent.subscribe(()=>{this.setState(r=>r.hasContentComponentInitialized?r:{hasContentComponentInitialized:!0}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent()})),e.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.parentNode))return;const n=document.createElement("div");n.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:n})}catch{}}}render(){const{editor:t,innerRef:e,...n}=this.props;return i.jsxs(i.Fragment,{children:[i.jsx("div",{ref:PKe(e,this.editorContentRef),...n}),t?.contentComponent&&i.jsx(AKe,{contentComponent:t.contentComponent})]})}},jKe=w.forwardRef((t,e)=>{const n=Kr.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[t.editor]);return Kr.createElement(EKe,{key:n,innerRef:e,...t})}),yae=Kr.memo(jKe),DKe=typeof window<"u"?w.useLayoutEffect:w.useEffect,RKe=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(r=>r())},n=this.editor;return n.on("transaction",e),()=>{n.off("transaction",e)}}}};function FKe(t){var e;const[n]=w.useState(()=>new RKe(t.editor)),r=bZ.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getServerSnapshot,t.selector,(e=t.equalityFn)!=null?e:TKe);return DKe(()=>n.watch(t.editor),[t.editor,n]),w.useDebugValue(r),r}var LKe=!1,oF=typeof window>"u",OKe=oF||!!(typeof window<"u"&&window.next),IKe=class vae{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?oF||OKe?null:this.createEditor():(this.options.current.immediatelyRender,this.options.current.immediatelyRender?this.createEditor():null)}createEditor(){const e={...this.options.current,onBeforeCreate:(...r)=>{var a,s;return(s=(a=this.options.current).onBeforeCreate)==null?void 0:s.call(a,...r)},onBlur:(...r)=>{var a,s;return(s=(a=this.options.current).onBlur)==null?void 0:s.call(a,...r)},onCreate:(...r)=>{var a,s;return(s=(a=this.options.current).onCreate)==null?void 0:s.call(a,...r)},onDestroy:(...r)=>{var a,s;return(s=(a=this.options.current).onDestroy)==null?void 0:s.call(a,...r)},onFocus:(...r)=>{var a,s;return(s=(a=this.options.current).onFocus)==null?void 0:s.call(a,...r)},onSelectionUpdate:(...r)=>{var a,s;return(s=(a=this.options.current).onSelectionUpdate)==null?void 0:s.call(a,...r)},onTransaction:(...r)=>{var a,s;return(s=(a=this.options.current).onTransaction)==null?void 0:s.call(a,...r)},onUpdate:(...r)=>{var a,s;return(s=(a=this.options.current).onUpdate)==null?void 0:s.call(a,...r)},onContentError:(...r)=>{var a,s;return(s=(a=this.options.current).onContentError)==null?void 0:s.call(a,...r)},onDrop:(...r)=>{var a,s;return(s=(a=this.options.current).onDrop)==null?void 0:s.call(a,...r)},onPaste:(...r)=>{var a,s;return(s=(a=this.options.current).onPaste)==null?void 0:s.call(a,...r)},onDelete:(...r)=>{var a,s;return(s=(a=this.options.current).onDelete)==null?void 0:s.call(a,...r)}};return new jWe(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(r=>["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(r)?!0:r==="extensions"&&e.extensions&&n.extensions?e.extensions.length!==n.extensions.length?!1:e.extensions.every((a,s)=>{var o;return a===((o=n.extensions)==null?void 0:o[s])}):e[r]===n[r])}onRender(e){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&e.length===0?vae.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((r,a)=>r===e[a]))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 zKe(t={},e=[]){const n=w.useRef(t);n.current=t;const[r]=w.useState(()=>new IKe(n)),a=AF.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return w.useDebugValue(a),w.useEffect(r.onRender(e)),FKe({editor:a,selector:({transactionNumber:s})=>t.shouldRerenderOnTransaction===!1||t.shouldRerenderOnTransaction===void 0?null:t.immediatelyRender&&s===0?0:s+1}),a}var wae=w.createContext({editor:null});wae.Consumer;var UKe=w.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),BKe=()=>w.useContext(UKe);Kr.forwardRef((t,e)=>{const{onDragStart:n}=BKe(),r=t.as||"div";return i.jsx(r,{...t,ref:e,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...t.style}})});Kr.createContext({markViewContentRef:()=>{}});var uI=w.createContext({get editor(){throw new Error("useTiptap must be used within a <Tiptap> provider")}});uI.displayName="TiptapContext";var HKe=()=>w.useContext(uI);function Sae({editor:t,instance:e,children:n}){const r=t??e;if(!r)throw new Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");const a=w.useMemo(()=>({editor:r}),[r]),s=w.useMemo(()=>({editor:r}),[r]);return i.jsx(wae.Provider,{value:s,children:i.jsx(uI.Provider,{value:a,children:n})})}Sae.displayName="Tiptap";function _ae({...t}){const{editor:e}=HKe();return i.jsx(yae,{editor:e,...t})}_ae.displayName="Tiptap.Content";Object.assign(Sae,{Content:_ae});var kN=(t,e)=>{if(t==="slot")return 0;if(t instanceof Function)return t(e);const{children:n,...r}=e??{};if(t==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[t,r,n]},$Ke=/^\s*>\s$/,qKe=po.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return kN("blockquote",{...zi(this.options.HTMLAttributes,t),children:kN("slot",{})})},parseMarkdown:(t,e)=>e.createNode("blockquote",void 0,e.parseChildren(t.tokens||[])),renderMarkdown:(t,e)=>{if(!t.content)return"";const n=">",r=[];return t.content.forEach(a=>{const l=e.renderChildren([a]).split(`
- `).map(c=>c.trim()===""?n:`${n} ${c}`);r.push(l.join(`
- `))}),r.join(`
- ${n}
- `)},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[nx({find:$Ke,type:this.type})]}}),VKe=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,GKe=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,WKe=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,KKe=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,YKe=wh.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 kN("strong",{...zi(this.options.HTMLAttributes,t),children:kN("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[tx({find:VKe,type:this.type}),tx({find:WKe,type:this.type})]},addPasteRules(){return[hf({find:GKe,type:this.type}),hf({find:KKe,type:this.type})]}}),XKe=/(^|[^`])`([^`]+)`(?!`)$/,QKe=/(^|[^`])`([^`]+)`(?!`)/g,ZKe=wh.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",zi(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[tx({find:XKe,type:this.type})]},addPasteRules(){return[hf({find:QKe,type:this.type})]}}),jj=4,JKe=/^```([a-z]+)?[\s\n]$/,eYe=/^~~~([a-z]+)?[\s\n]$/,tYe=po.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:jj,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 s=[...((e=t.firstElementChild)==null?void 0:e.classList)||[]].filter(o=>o.startsWith(n)).map(o=>o.replace(n,""))[0];return s||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:t,HTMLAttributes:e}){return["pre",zi(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 r="";const a=((n=t.attrs)==null?void 0:n.language)||"";return t.content?r=[`\`\`\`${a}`,e.renderChildren(t.content),"```"].join(`
- `):r=`\`\`\`${a}
- \`\`\``,r},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:jj,{state:r}=t,{selection:a}=r,{$from:s,empty:o}=a;if(s.parent.type!==this.type)return!1;const l=" ".repeat(n);return o?t.commands.insertContent(l):t.commands.command(({tr:c})=>{const{from:d,to:u}=a,f=r.doc.textBetween(d,u,`
- `,`
- `).split(`
- `).map(y=>l+y).join(`
- `);return c.replaceWith(d,u,r.schema.text(f)),!0})},"Shift-Tab":({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;const n=(e=this.options.tabSize)!=null?e:jj,{state:r}=t,{selection:a}=r,{$from:s,empty:o}=a;return s.parent.type!==this.type?!1:o?t.commands.command(({tr:l})=>{var c;const{pos:d}=s,u=s.start(),m=s.end(),f=r.doc.textBetween(u,m,`
- `,`
- `).split(`
- `);let y=0,x=0;const b=d-u;for(let T=0;T<f.length;T+=1){if(x+f[T].length>=b){y=T;break}x+=f[T].length+1}const _=((c=f[y].match(/^ */))==null?void 0:c[0])||"",k=Math.min(_.length,n);if(k===0)return!0;let P=u;for(let T=0;T<y;T+=1)P+=f[T].length+1;return l.delete(P,P+k),d-P<=k&&l.setSelection(jn.create(l.doc,P)),!0}):t.commands.command(({tr:l})=>{const{from:c,to:d}=a,p=r.doc.textBetween(c,d,`
- `,`
- `).split(`
- `).map(f=>{var y;const x=((y=f.match(/^ */))==null?void 0:y[0])||"",b=Math.min(x.length,n);return f.slice(b)}).join(`
- `);return l.replaceWith(c,d,r.schema.text(p)),!0})},Enter:({editor:t})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=t,{selection:n}=e,{$from:r,empty:a}=n;if(!a||r.parent.type!==this.type)return!1;const s=r.parentOffset===r.parent.nodeSize-2,o=r.parent.textContent.endsWith(`
- `);return!s||!o?!1:t.chain().command(({tr:l})=>(l.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:t})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=t,{selection:n,doc:r}=e,{$from:a,empty:s}=n;if(!s||a.parent.type!==this.type||!(a.parentOffset===a.parent.nodeSize-2))return!1;const l=a.after();return l===void 0?!1:r.nodeAt(l)?t.commands.command(({tr:d})=>(d.setSelection(Yn.near(r.resolve(l))),!0)):t.commands.exitCode()}}},addInputRules(){return[aF({find:JKe,type:this.type,getAttributes:t=>({language:t[1]})}),aF({find:eYe,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new Ci({key:new _a("codeBlockVSCodeHandler"),props:{handlePaste:(t,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const n=e.clipboardData.getData("text/plain"),r=e.clipboardData.getData("vscode-editor-data"),a=r?JSON.parse(r):void 0,s=a?.mode;if(!n||!s)return!1;const{tr:o,schema:l}=t.state,c=l.text(n.replace(/\r\n?/g,`
- `));return o.replaceSelectionWith(this.type.create({language:s},c)),o.selection.$from.parent.type!==this.type&&o.setSelection(jn.near(o.doc.resolve(Math.max(0,o.selection.from-2)))),o.setMeta("paste",!0),t.dispatch(o),!0}}})]}}),nYe=po.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
- `):""}),rYe=po.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",zi(this.options.HTMLAttributes,t)]},renderText(){return`
- `},renderMarkdown:()=>`
- `,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:r})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:a,storedMarks:s}=n;if(a.$from.parent.type.spec.isolating)return!1;const{keepMarks:o}=this.options,{splittableMarks:l}=r.extensionManager,c=s||a.$to.parentOffset&&a.$from.marks();return e().insertContent({type:this.name}).command(({tr:d,dispatch:u})=>{if(u&&c&&o){const m=c.filter(p=>l.includes(p.type.name));d.ensureMarks(m)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),iYe=po.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]}`,zi(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 r=(n=t.attrs)!=null&&n.level?parseInt(t.attrs.level,10):1,a="#".repeat(r);return t.content?`${a} ${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=>aF({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}}),aYe=po.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",zi(this.options.HTMLAttributes,t)]},markdownTokenName:"hr",parseMarkdown:(t,e)=>e.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{if(!FWe(e,e.schema.nodes[this.name]))return!1;const{selection:n}=e,{$to:r}=n,a=t();return Jie(n)?a.insertContentAt(r.pos,{type:this.name}):a.insertContent({type:this.name}),a.command(({state:s,tr:o,dispatch:l})=>{if(l){const{$to:c}=o.selection,d=c.end();if(c.nodeAfter)c.nodeAfter.isTextblock?o.setSelection(jn.create(o.doc,c.pos+1)):c.nodeAfter.isBlock?o.setSelection(gn.create(o.doc,c.pos)):o.setSelection(jn.create(o.doc,c.pos));else{const u=s.schema.nodes[this.options.nextNodeType]||c.parent.type.contentMatch.defaultType,m=u?.create();m&&(o.insert(d,m),o.setSelection(jn.create(o.doc,d+1)))}o.scrollIntoView()}return!0}).run()}}},addInputRules(){return[gae({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),sYe=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,oYe=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,lYe=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,cYe=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,dYe=wh.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",zi(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[tx({find:sYe,type:this.type}),tx({find:lYe,type:this.type})]},addPasteRules(){return[hf({find:oYe,type:this.type}),hf({find:cYe,type:this.type})]}});const uYe="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",mYe="ελ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",lF="numeric",cF="ascii",dF="alpha",vv="asciinumeric",nv="alphanumeric",uF="domain",kae="emoji",hYe="scheme",pYe="slashscheme",Dj="whitespace";function fYe(t,e){return t in e||(e[t]=[]),e[t]}function Np(t,e,n){e[lF]&&(e[vv]=!0,e[nv]=!0),e[cF]&&(e[vv]=!0,e[dF]=!0),e[vv]&&(e[nv]=!0),e[dF]&&(e[nv]=!0),e[nv]&&(e[uF]=!0),e[kae]&&(e[uF]=!0);for(const r in e){const a=fYe(r,n);a.indexOf(t)<0&&a.push(t)}}function gYe(t,e){const n={};for(const r in e)e[r].indexOf(t)>=0&&(n[r]=!0);return n}function to(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}to.groups={};to.prototype={accepts(){return!!this.t},go(t){const e=this,n=e.j[t];if(n)return n;for(let r=0;r<e.jr.length;r++){const a=e.jr[r][0],s=e.jr[r][1];if(s&&a.test(t))return s}return e.jd},has(t,e=!1){return e?t in this.j:!!this.go(t)},ta(t,e,n,r){for(let a=0;a<t.length;a++)this.tt(t[a],e,n,r)},tr(t,e,n,r){r=r||to.groups;let a;return e&&e.j?a=e:(a=new to(e),n&&r&&Np(e,n,r)),this.jr.push([t,a]),a},ts(t,e,n,r){let a=this;const s=t.length;if(!s)return a;for(let o=0;o<s-1;o++)a=a.tt(t[o]);return a.tt(t[s-1],e,n,r)},tt(t,e,n,r){r=r||to.groups;const a=this;if(e&&e.j)return a.j[t]=e,e;const s=e;let o,l=a.go(t);if(l?(o=new to,Object.assign(o.j,l.j),o.jr.push.apply(o.jr,l.jr),o.jd=l.jd,o.t=l.t):o=new to,s){if(r)if(o.t&&typeof o.t=="string"){const c=Object.assign(gYe(o.t,r),n);Np(s,c,r)}else n&&Np(s,n,r);o.t=s}return a.j[t]=o,o}};const $n=(t,e,n,r,a)=>t.ta(e,n,r,a),Ai=(t,e,n,r,a)=>t.tr(e,n,r,a),YW=(t,e,n,r,a)=>t.ts(e,n,r,a),Ut=(t,e,n,r,a)=>t.tt(e,n,r,a),Id="WORD",mF="UWORD",Nae="ASCIINUMERICAL",Cae="ALPHANUMERICAL",S0="LOCALHOST",hF="TLD",pF="UTLD",M1="SCHEME",nb="SLASH_SCHEME",mI="NUM",fF="WS",hI="NL",wv="OPENBRACE",Sv="CLOSEBRACE",NN="OPENBRACKET",CN="CLOSEBRACKET",TN="OPENPAREN",PN="CLOSEPAREN",AN="OPENANGLEBRACKET",MN="CLOSEANGLEBRACKET",EN="FULLWIDTHLEFTPAREN",jN="FULLWIDTHRIGHTPAREN",DN="LEFTCORNERBRACKET",RN="RIGHTCORNERBRACKET",FN="LEFTWHITECORNERBRACKET",LN="RIGHTWHITECORNERBRACKET",ON="FULLWIDTHLESSTHAN",IN="FULLWIDTHGREATERTHAN",zN="AMPERSAND",UN="APOSTROPHE",BN="ASTERISK",ym="AT",HN="BACKSLASH",$N="BACKTICK",qN="CARET",Cm="COLON",pI="COMMA",VN="DOLLAR",Nc="DOT",GN="EQUALS",fI="EXCLAMATION",nl="HYPHEN",_v="PERCENT",WN="PIPE",KN="PLUS",YN="POUND",kv="QUERY",gI="QUOTE",Tae="FULLWIDTHMIDDLEDOT",bI="SEMI",Cc="SLASH",Nv="TILDE",XN="UNDERSCORE",Pae="EMOJI",QN="SYM";var Aae=Object.freeze({__proto__:null,ALPHANUMERICAL:Cae,AMPERSAND:zN,APOSTROPHE:UN,ASCIINUMERICAL:Nae,ASTERISK:BN,AT:ym,BACKSLASH:HN,BACKTICK:$N,CARET:qN,CLOSEANGLEBRACKET:MN,CLOSEBRACE:Sv,CLOSEBRACKET:CN,CLOSEPAREN:PN,COLON:Cm,COMMA:pI,DOLLAR:VN,DOT:Nc,EMOJI:Pae,EQUALS:GN,EXCLAMATION:fI,FULLWIDTHGREATERTHAN:IN,FULLWIDTHLEFTPAREN:EN,FULLWIDTHLESSTHAN:ON,FULLWIDTHMIDDLEDOT:Tae,FULLWIDTHRIGHTPAREN:jN,HYPHEN:nl,LEFTCORNERBRACKET:DN,LEFTWHITECORNERBRACKET:FN,LOCALHOST:S0,NL:hI,NUM:mI,OPENANGLEBRACKET:AN,OPENBRACE:wv,OPENBRACKET:NN,OPENPAREN:TN,PERCENT:_v,PIPE:WN,PLUS:KN,POUND:YN,QUERY:kv,QUOTE:gI,RIGHTCORNERBRACKET:RN,RIGHTWHITECORNERBRACKET:LN,SCHEME:M1,SEMI:bI,SLASH:Cc,SLASH_SCHEME:nb,SYM:QN,TILDE:Nv,TLD:hF,UNDERSCORE:XN,UTLD:pF,UWORD:mF,WORD:Id,WS:fF});const Dd=/[a-z]/,$y=new RegExp("\\p{L}","u"),Rj=new RegExp("\\p{Emoji}","u"),Rd=/\d/,Fj=/\s/,XW="\r",Lj=`
- `,bYe="️",xYe="",Oj="";let Z_=null,J_=null;function yYe(t=[]){const e={};to.groups=e;const n=new to;Z_==null&&(Z_=QW(uYe)),J_==null&&(J_=QW(mYe)),Ut(n,"'",UN),Ut(n,"{",wv),Ut(n,"}",Sv),Ut(n,"[",NN),Ut(n,"]",CN),Ut(n,"(",TN),Ut(n,")",PN),Ut(n,"<",AN),Ut(n,">",MN),Ut(n,"(",EN),Ut(n,")",jN),Ut(n,"「",DN),Ut(n,"」",RN),Ut(n,"『",FN),Ut(n,"』",LN),Ut(n,"<",ON),Ut(n,">",IN),Ut(n,"&",zN),Ut(n,"*",BN),Ut(n,"@",ym),Ut(n,"`",$N),Ut(n,"^",qN),Ut(n,":",Cm),Ut(n,",",pI),Ut(n,"$",VN),Ut(n,".",Nc),Ut(n,"=",GN),Ut(n,"!",fI),Ut(n,"-",nl),Ut(n,"%",_v),Ut(n,"|",WN),Ut(n,"+",KN),Ut(n,"#",YN),Ut(n,"?",kv),Ut(n,'"',gI),Ut(n,"/",Cc),Ut(n,";",bI),Ut(n,"~",Nv),Ut(n,"_",XN),Ut(n,"\\",HN),Ut(n,"・",Tae);const r=Ai(n,Rd,mI,{[lF]:!0});Ai(r,Rd,r);const a=Ai(r,Dd,Nae,{[vv]:!0}),s=Ai(r,$y,Cae,{[nv]:!0}),o=Ai(n,Dd,Id,{[cF]:!0});Ai(o,Rd,a),Ai(o,Dd,o),Ai(a,Rd,a),Ai(a,Dd,a);const l=Ai(n,$y,mF,{[dF]:!0});Ai(l,Dd),Ai(l,Rd,s),Ai(l,$y,l),Ai(s,Rd,s),Ai(s,Dd),Ai(s,$y,s);const c=Ut(n,Lj,hI,{[Dj]:!0}),d=Ut(n,XW,fF,{[Dj]:!0}),u=Ai(n,Fj,fF,{[Dj]:!0});Ut(n,Oj,u),Ut(d,Lj,c),Ut(d,Oj,u),Ai(d,Fj,u),Ut(u,XW),Ut(u,Lj),Ai(u,Fj,u),Ut(u,Oj,u);const m=Ai(n,Rj,Pae,{[kae]:!0});Ut(m,"#"),Ai(m,Rj,m),Ut(m,bYe,m);const p=Ut(m,xYe);Ut(p,"#"),Ai(p,Rj,m);const f=[[Dd,o],[Rd,a]],y=[[Dd,null],[$y,l],[Rd,s]];for(let x=0;x<Z_.length;x++)dm(n,Z_[x],hF,Id,f);for(let x=0;x<J_.length;x++)dm(n,J_[x],pF,mF,y);Np(hF,{tld:!0,ascii:!0},e),Np(pF,{utld:!0,alpha:!0},e),dm(n,"file",M1,Id,f),dm(n,"mailto",M1,Id,f),dm(n,"http",nb,Id,f),dm(n,"https",nb,Id,f),dm(n,"ftp",nb,Id,f),dm(n,"ftps",nb,Id,f),Np(M1,{scheme:!0,ascii:!0},e),Np(nb,{slashscheme:!0,ascii:!0},e),t=t.sort((x,b)=>x[0]>b[0]?1:-1);for(let x=0;x<t.length;x++){const b=t[x][0],_=t[x][1]?{[hYe]:!0}:{[pYe]:!0};b.indexOf("-")>=0?_[uF]=!0:Dd.test(b)?Rd.test(b)?_[vv]=!0:_[cF]=!0:_[lF]=!0,YW(n,b,b,_)}return YW(n,"localhost",S0,{ascii:!0}),n.jd=new to(QN),{start:n,tokens:Object.assign({groups:e},Aae)}}function Mae(t,e){const n=vYe(e.replace(/[A-Z]/g,l=>l.toLowerCase())),r=n.length,a=[];let s=0,o=0;for(;o<r;){let l=t,c=null,d=0,u=null,m=-1,p=-1;for(;o<r&&(c=l.go(n[o]));)l=c,l.accepts()?(m=0,p=0,u=l):m>=0&&(m+=n[o].length,p++),d+=n[o].length,s+=n[o].length,o++;s-=m,o-=p,d-=m,a.push({t:u.t,v:e.slice(s-d,s),s:s-d,e:s})}return a}function vYe(t){const e=[],n=t.length;let r=0;for(;r<n;){let a=t.charCodeAt(r),s,o=a<55296||a>56319||r+1===n||(s=t.charCodeAt(r+1))<56320||s>57343?t[r]:t.slice(r,r+2);e.push(o),r+=o.length}return e}function dm(t,e,n,r,a){let s;const o=e.length;for(let l=0;l<o-1;l++){const c=e[l];t.j[c]?s=t.j[c]:(s=new to(r),s.jr=a.slice(),t.j[c]=s),t=s}return s=new to(n),s.jr=a.slice(),t.j[e[o-1]]=s,s}function QW(t){const e=[],n=[];let r=0,a="0123456789";for(;r<t.length;){let s=0;for(;a.indexOf(t[r+s])>=0;)s++;if(s>0){e.push(n.join(""));for(let o=parseInt(t.substring(r,r+s),10);o>0;o--)n.pop();r+=s}else n.push(t[r]),r++}return e}const _0={defaultProtocol:"http",events:null,format:ZW,formatHref:ZW,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function xI(t,e=null){let n=Object.assign({},_0);t&&(n=Object.assign(n,t instanceof xI?t.o:t));const r=n.ignoreTags,a=[];for(let s=0;s<r.length;s++)a.push(r[s].toUpperCase());this.o=n,e&&(this.defaultRender=e),this.ignoreTags=a}xI.prototype={o:_0,ignoreTags:[],defaultRender(t){return t},check(t){return this.get("validate",t.toString(),t)},get(t,e,n){const r=e!=null;let a=this.o[t];return a&&(typeof a=="object"?(a=n.t in a?a[n.t]:_0[t],typeof a=="function"&&r&&(a=a(e,n))):typeof a=="function"&&r&&(a=a(e,n.t,n)),a)},getObj(t,e,n){let r=this.o[t];return typeof r=="function"&&e!=null&&(r=r(e,n.t,n)),r},render(t){const e=t.render(this);return(this.get("render",null,t)||this.defaultRender)(e,t.t,t)}};function ZW(t){return t}function Eae(t,e){this.t="token",this.v=t,this.tk=e}Eae.prototype={isLink:!1,toString(){return this.v},toHref(t){return this.toString()},toFormattedString(t){const e=this.toString(),n=t.get("truncate",e,this),r=t.get("format",e,this);return n&&r.length>n?r.substring(0,n)+"…":r},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=_0.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")),r=t.get("formatHref",n,this),a=t.get("tagName",n,e),s=this.toFormattedString(t),o={},l=t.get("className",n,e),c=t.get("target",n,e),d=t.get("rel",n,e),u=t.getObj("attributes",n,e),m=t.getObj("events",n,e);return o.href=r,l&&(o.class=l),c&&(o.target=c),d&&(o.rel=d),u&&Object.assign(o,u),{tagName:a,attributes:o,content:s,eventListeners:m}}};function UT(t,e){class n extends Eae{constructor(a,s){super(a,s),this.t=t}}for(const r in e)n.prototype[r]=e[r];return n.t=t,n}const JW=UT("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),eK=UT("text"),wYe=UT("nl"),e1=UT("url",{isLink:!0,toHref(t=_0.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==S0&&t[1].t===Cm}}),Jo=t=>new to(t);function SYe({groups:t}){const e=t.domain.concat([zN,BN,ym,HN,$N,qN,VN,GN,nl,mI,_v,WN,KN,YN,Cc,QN,Nv,XN]),n=[UN,Cm,pI,Nc,fI,_v,kv,gI,bI,AN,MN,wv,Sv,CN,NN,TN,PN,EN,jN,DN,RN,FN,LN,ON,IN],r=[zN,UN,BN,HN,$N,qN,VN,GN,nl,wv,Sv,_v,WN,KN,YN,kv,Cc,QN,Nv,XN],a=Jo(),s=Ut(a,Nv);$n(s,r,s),$n(s,t.domain,s);const o=Jo(),l=Jo(),c=Jo();$n(a,t.domain,o),$n(a,t.scheme,l),$n(a,t.slashscheme,c),$n(o,r,s),$n(o,t.domain,o);const d=Ut(o,ym);Ut(s,ym,d),Ut(l,ym,d),Ut(c,ym,d);const u=Ut(s,Nc);$n(u,r,s),$n(u,t.domain,s);const m=Jo();$n(d,t.domain,m),$n(m,t.domain,m);const p=Ut(m,Nc);$n(p,t.domain,m);const f=Jo(JW);$n(p,t.tld,f),$n(p,t.utld,f),Ut(d,S0,f);const y=Ut(m,nl);Ut(y,nl,y),$n(y,t.domain,m),$n(f,t.domain,m),Ut(f,Nc,p),Ut(f,nl,y);const x=Ut(f,Cm);$n(x,t.numeric,JW);const b=Ut(o,nl),v=Ut(o,Nc);Ut(b,nl,b),$n(b,t.domain,o),$n(v,r,s),$n(v,t.domain,o);const _=Jo(e1);$n(v,t.tld,_),$n(v,t.utld,_),$n(_,t.domain,o),$n(_,r,s),Ut(_,Nc,v),Ut(_,nl,b),Ut(_,ym,d);const k=Ut(_,Cm),P=Jo(e1);$n(k,t.numeric,P);const C=Jo(e1),T=Jo();$n(C,e,C),$n(C,n,T),$n(T,e,C),$n(T,n,T),Ut(_,Cc,C),Ut(P,Cc,C);const N=Ut(l,Cm),R=Ut(c,Cm),A=Ut(R,Cc),D=Ut(A,Cc);$n(l,t.domain,o),Ut(l,Nc,v),Ut(l,nl,b),$n(c,t.domain,o),Ut(c,Nc,v),Ut(c,nl,b),$n(N,t.domain,C),Ut(N,Cc,C),Ut(N,kv,C),$n(D,t.domain,C),$n(D,e,C),Ut(D,Cc,C);const $=[[wv,Sv],[NN,CN],[TN,PN],[AN,MN],[EN,jN],[DN,RN],[FN,LN],[ON,IN]];for(let U=0;U<$.length;U++){const[G,L]=$[U],te=Ut(C,G);Ut(T,G,te),Ut(te,L,C);const re=Jo(e1);$n(te,e,re);const J=Jo();$n(te,n),$n(re,e,re),$n(re,n,J),$n(J,e,re),$n(J,n,J),Ut(re,L,C),Ut(J,L,C)}return Ut(a,S0,_),Ut(a,hI,wYe),{start:a,tokens:Aae}}function _Ye(t,e,n){let r=n.length,a=0,s=[],o=[];for(;a<r;){let l=t,c=null,d=null,u=0,m=null,p=-1;for(;a<r&&!(c=l.go(n[a].t));)o.push(n[a++]);for(;a<r&&(d=c||l.go(n[a].t));)c=null,l=d,l.accepts()?(p=0,m=l):p>=0&&p++,a++,u++;if(p<0)a-=u,a<r&&(o.push(n[a]),a++);else{o.length>0&&(s.push(Ij(eK,e,o)),o=[]),a-=p,u-=p;const f=m.t,y=n.slice(a-u,a);s.push(Ij(f,e,y))}}return o.length>0&&s.push(Ij(eK,e,o)),s}function Ij(t,e,n){const r=n[0].s,a=n[n.length-1].e,s=e.slice(r,a);return new t(s,n)}const kYe=typeof console<"u"&&console&&console.warn||(()=>{}),NYe="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",oi={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function CYe(){return to.groups={},oi.scanner=null,oi.parser=null,oi.tokenQueue=[],oi.pluginQueue=[],oi.customSchemes=[],oi.initialized=!1,oi}function tK(t,e=!1){if(oi.initialized&&kYe(`linkifyjs: already initialized - will not register custom scheme "${t}" ${NYe}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format.
- 1. Must only contain digits, lowercase ASCII letters or "-"
- 2. Cannot start or end with "-"
- 3. "-" cannot repeat`);oi.customSchemes.push([t,e])}function TYe(){oi.scanner=yYe(oi.customSchemes);for(let t=0;t<oi.tokenQueue.length;t++)oi.tokenQueue[t][1]({scanner:oi.scanner});oi.parser=SYe(oi.scanner.tokens);for(let t=0;t<oi.pluginQueue.length;t++)oi.pluginQueue[t][1]({scanner:oi.scanner,parser:oi.parser});return oi.initialized=!0,oi}function yI(t){return oi.initialized||TYe(),_Ye(oi.parser.start,t,Mae(oi.scanner.start,t))}yI.scan=Mae;function jae(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 r=new xI(n),a=yI(t),s=[];for(let o=0;o<a.length;o++){const l=a[o];l.isLink&&(!e||l.t===e)&&r.check(l)&&s.push(l.toFormattedObject(r))}return s}var vI="[\0- -\u2029 ]",PYe=new RegExp(vI),AYe=new RegExp(`${vI}$`),MYe=new RegExp(vI,"g");function EYe(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function jYe(t){return new Ci({key:new _a("autolink"),appendTransaction:(e,n,r)=>{const a=e.some(d=>d.docChanged)&&!n.doc.eq(r.doc),s=e.some(d=>d.getMeta("preventAutolink"));if(!a||s)return;const{tr:o}=r,l=Vie(n.doc,[...e]);if(Zie(l).forEach(({newRange:d})=>{const u=RGe(r.doc,d,f=>f.isTextblock);let m,p;if(u.length>1)m=u[0],p=r.doc.textBetween(m.pos,m.pos+m.node.nodeSize,void 0," ");else if(u.length){const f=r.doc.textBetween(d.from,d.to," "," ");if(!AYe.test(f))return;m=u[0],p=r.doc.textBetween(m.pos,d.to,void 0," ")}if(m&&p){const f=p.split(PYe).filter(Boolean);if(f.length<=0)return!1;const y=f[f.length-1],x=m.pos+p.lastIndexOf(y);if(!y)return!1;const b=yI(y).map(v=>v.toObject(t.defaultProtocol));if(!EYe(b))return!1;b.filter(v=>v.isLink).map(v=>({...v,from:x+v.start+1,to:x+v.end+1})).filter(v=>r.schema.marks.code?!r.doc.rangeHasMark(v.from,v.to,r.schema.marks.code):!0).filter(v=>t.validate(v.value)).filter(v=>t.shouldAutoLink(v.value)).forEach(v=>{sI(v.from,v.to,r.doc).some(_=>_.mark.type===t.type)||o.addMark(v.from,v.to,t.type.create({href:v.href}))})}}),!!o.steps.length)return o}})}function DYe(t){return new Ci({key:new _a("handleClickLink"),props:{handleClick:(e,n,r)=>{var a,s;if(r.button!==0||!e.editable)return!1;let o=null;if(r.target instanceof HTMLAnchorElement)o=r.target;else{const c=r.target;if(!c)return!1;const d=t.editor.view.dom;o=c.closest("a"),o&&!d.contains(o)&&(o=null)}if(!o)return!1;let l=!1;if(t.enableClickSelection&&(l=t.editor.commands.extendMarkRange(t.type.name)),t.openOnClick){const c=Qie(e.state,t.type.name),d=(a=o.href)!=null?a:c.href,u=(s=o.target)!=null?s:c.target;d&&(window.open(d,u),l=!0)}return l}}})}function RYe(t){return new Ci({key:new _a("handlePasteLink"),props:{handlePaste:(e,n,r)=>{const{shouldAutoLink:a}=t,{state:s}=e,{selection:o}=s,{empty:l}=o;if(l)return!1;let c="";r.content.forEach(u=>{c+=u.textContent});const d=jae(c,{defaultProtocol:t.defaultProtocol}).find(u=>u.isLink&&u.value===c);return!c||!d||a!==void 0&&!a(d.value)?!1:t.editor.commands.setMark(t.type,{href:d.href})}}})}function Zh(t,e){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const a=typeof r=="string"?r:r.scheme;a&&n.push(a)}),!t||t.replace(MYe,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var Dae=wh.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"){tK(t);return}tK(t.scheme,t.optionalSlashes)})},onDestroy(){CYe()},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)=>!!Zh(t,e.protocols),validate:t=>!!t,shouldAutoLink:t=>{const e=/^[a-z][a-z0-9+.-]*:\/\//i.test(t),n=/^[a-z][a-z0-9+.-]*:/i.test(t);if(e||n&&!t.includes("@"))return!0;const a=(t.includes("@")?t.split("@").pop():t).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(a)||!/\./.test(a))}}},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},title:{default:null}}},parseHTML(){return[{tag:"a[href]",getAttrs:t=>{const e=t.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:n=>!!Zh(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=>!!Zh(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",zi(this.options.HTMLAttributes,t),0]:["a",zi(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,r,a,s;const o=(r=(n=t.attrs)==null?void 0:n.href)!=null?r:"",l=(s=(a=t.attrs)==null?void 0:a.title)!=null?s:"",c=e.renderChildren(t);return l?`[${c}](${o} "${l}")`:`[${c}](${o})`},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!Zh(r,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:r=>!!Zh(r,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[hf({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:r}=this.options,a=jae(t).filter(s=>s.isLink&&this.options.isAllowedUri(s.value,{defaultValidate:o=>!!Zh(o,n),protocols:n,defaultProtocol:r}));a.length&&a.forEach(s=>{this.options.shouldAutoLink(s.value)&&e.push({text:s.value,data:{href:s.href},index:s.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(jYe({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:a=>!!Zh(a,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),t.push(DYe({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&t.push(RYe({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),t}}),FYe=Dae,LYe=Object.defineProperty,OYe=(t,e)=>{for(var n in e)LYe(t,n,{get:e[n],enumerable:!0})},IYe="listItem",nK="textStyle",rK=/^\s*([-+*])\s$/,Rae=po.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",zi(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,`
- `):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(IYe,this.editor.getAttributes(nK)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=nx({find:rK,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=nx({find:rK,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(nK),editor:this.editor})),[t]}}),Fae=po.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",zi(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(a=>a.type==="paragraph"))n=e.parseChildren(t.tokens);else{const a=t.tokens[0];if(a&&a.type==="text"&&a.tokens&&a.tokens.length>0){if(n=[{type:"paragraph",content:e.parseInline(a.tokens)}],t.tokens.length>1){const o=t.tokens.slice(1),l=e.parseChildren(o);n.push(...l)}}else n=e.parseChildren(t.tokens)}return n.length===0&&(n=[{type:"paragraph",content:[]}]),{type:"listItem",content:n}},renderMarkdown:(t,e,n)=>dI(t,e,r=>{var a,s;return r.parentType==="bulletList"?"- ":r.parentType==="orderedList"?`${(((s=(a=r.meta)==null?void 0:a.parentAttrs)==null?void 0:s.start)||1)+r.index}. `:"- "},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)}}}),zYe={};OYe(zYe,{findListItemPos:()=>mw,getNextListDepth:()=>wI,handleBackspace:()=>gF,handleDelete:()=>bF,hasListBefore:()=>Lae,hasListItemAfter:()=>UYe,hasListItemBefore:()=>Oae,listItemHasSubList:()=>Iae,nextListIsDeeper:()=>zae,nextListIsHigher:()=>Uae});var mw=(t,e)=>{const{$from:n}=e.selection,r=ca(t,e.schema);let a=null,s=n.depth,o=n.pos,l=null;for(;s>0&&l===null;)a=n.node(s),a.type===r?l=s:(s-=1,o-=1);return l===null?null:{$pos:e.doc.resolve(o),depth:l}},wI=(t,e)=>{const n=mw(t,e);if(!n)return!1;const[,r]=qGe(e,t,n.$pos.pos+4);return r},Lae=(t,e,n)=>{const{$anchor:r}=t.selection,a=Math.max(0,r.pos-2),s=t.doc.resolve(a).node();return!(!s||!n.includes(s.type.name))},Oae=(t,e)=>{var n;const{$anchor:r}=e.selection,a=e.doc.resolve(r.pos-2);return!(a.index()===0||((n=a.nodeBefore)==null?void 0:n.type.name)!==t)},Iae=(t,e,n)=>{if(!n)return!1;const r=ca(t,e.schema);let a=!1;return n.descendants(s=>{s.type===r&&(a=!0)}),a},gF=(t,e,n)=>{if(t.commands.undoInputRule())return!0;if(t.state.selection.from!==t.state.selection.to)return!1;if(!mh(t.state,e)&&Lae(t.state,e,n)){const{$anchor:l}=t.state.selection,c=t.state.doc.resolve(l.before()-1),d=[];c.node().descendants((p,f)=>{p.type.name===e&&d.push({node:p,pos:f})});const u=d.at(-1);if(!u)return!1;const m=t.state.doc.resolve(c.start()+u.pos+1);return t.chain().cut({from:l.start()-1,to:l.end()+1},m.end()).joinForward().run()}if(!mh(t.state,e)||!KGe(t.state))return!1;const r=mw(e,t.state);if(!r)return!1;const s=t.state.doc.resolve(r.$pos.pos-2).node(r.depth),o=Iae(e,t.state,s);return Oae(e,t.state)&&!o?t.commands.joinItemBackward():t.chain().liftListItem(e).run()},zae=(t,e)=>{const n=wI(t,e),r=mw(t,e);return!r||!n?!1:n>r.depth},Uae=(t,e)=>{const n=wI(t,e),r=mw(t,e);return!r||!n?!1:n<r.depth},bF=(t,e)=>{if(!mh(t.state,e)||!WGe(t.state,e))return!1;const{selection:n}=t.state,{$from:r,$to:a}=n;return!n.empty&&r.sameParent(a)?!1:zae(e,t.state)?t.chain().focus(t.state.selection.from+4).lift(e).joinBackward().run():Uae(e,t.state)?t.chain().joinForward().joinBackward().run():t.commands.joinItemForward()},UYe=(t,e)=>{var n;const{$anchor:r}=e.selection,a=e.doc.resolve(r.pos-r.parentOffset-2);return!(a.index()===a.parent.childCount-1||((n=a.nodeAfter)==null?void 0:n.type.name)!==t)},Bae=Gr.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&&bF(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&&bF(t,n)&&(e=!0)}),e},Backspace:({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{t.state.schema.nodes[n]!==void 0&&gF(t,n,r)&&(e=!0)}),e},"Mod-Backspace":({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{t.state.schema.nodes[n]!==void 0&&gF(t,n,r)&&(e=!0)}),e}}}}),iK=/^(\s*)(\d+)\.\s+(.*)$/,BYe=/^\s/;function HYe(t){const e=[];let n=0,r=0;for(;n<t.length;){const a=t[n],s=a.match(iK);if(!s)break;const[,o,l,c]=s,d=o.length;let u=c,m=n+1;const p=[a];for(;m<t.length;){const f=t[m];if(f.match(iK))break;if(f.trim()==="")p.push(f),u+=`
- `,m+=1;else if(f.match(BYe))p.push(f),u+=`
- ${f.slice(d+2)}`,m+=1;else break}e.push({indent:d,number:parseInt(l,10),content:u.trim(),raw:p.join(`
- `)}),r=m,n=m}return[e,r]}function Hae(t,e,n){var r;const a=[];let s=0;for(;s<t.length;){const o=t[s];if(o.indent===e){const l=o.content.split(`
- `),c=((r=l[0])==null?void 0:r.trim())||"",d=[];c&&d.push({type:"paragraph",raw:c,tokens:n.inlineTokens(c)});const u=l.slice(1).join(`
- `).trim();if(u){const f=n.blockTokens(u);d.push(...f)}let m=s+1;const p=[];for(;m<t.length&&t[m].indent>e;)p.push(t[m]),m+=1;if(p.length>0){const f=Math.min(...p.map(x=>x.indent)),y=Hae(p,f,n);d.push({type:"list",ordered:!0,start:p[0].number,items:y,raw:p.map(x=>x.raw).join(`
- `)})}a.push({type:"list_item",raw:o.raw,tokens:d}),s=m}else s+=1}return a}function $Ye(t,e){return t.map(n=>{if(n.type!=="list_item")return e.parseChildren([n])[0];const r=[];return n.tokens&&n.tokens.length>0&&n.tokens.forEach(a=>{if(a.type==="paragraph"||a.type==="list"||a.type==="blockquote"||a.type==="code")r.push(...e.parseChildren([a]));else if(a.type==="text"&&a.tokens){const s=e.parseChildren([a]);r.push({type:"paragraph",content:s})}else{const s=e.parseChildren([a]);s.length>0&&r.push(...s)}}),{type:"listItem",content:r}})}var qYe="listItem",aK="textStyle",sK=/^(\d+)\.\s$/,$ae=po.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",zi(this.options.HTMLAttributes,n),0]:["ol",zi(this.options.HTMLAttributes,t),0]},markdownTokenName:"list",parseMarkdown:(t,e)=>{if(t.type!=="list"||!t.ordered)return[];const n=t.start||1,r=t.items?$Ye(t.items,e):[];return n!==1?{type:"orderedList",attrs:{start:n},content:r}:{type:"orderedList",content:r}},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
- `):"",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 r;const a=t.split(`
- `),[s,o]=HYe(a);if(s.length===0)return;const l=Hae(s,0,n);return l.length===0?void 0:{type:"list",ordered:!0,start:((r=s[0])==null?void 0:r.number)||1,items:l,raw:a.slice(0,o).join(`
- `)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(qYe,this.editor.getAttributes(aK)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=nx({find:sK,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=nx({find:sK,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(aK)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),VYe=/^\s*(\[([( |x])?\])\s$/,GYe=po.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",zi(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 r=e.parseChildren(t.nestedTokens);n.push(...r)}return e.createNode("taskItem",{checked:t.checked||!1},n)},renderMarkdown:(t,e)=>{var n;const a=`- [${(n=t.attrs)!=null&&n.checked?"x":" "}] `;return dI(t,e,a)},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:r})=>{const a=document.createElement("li"),s=document.createElement("label"),o=document.createElement("span"),l=document.createElement("input"),c=document.createElement("div"),d=m=>{var p,f;l.ariaLabel=((f=(p=this.options.a11y)==null?void 0:p.checkboxLabel)==null?void 0:f.call(p,m,l.checked))||`Task item checkbox for ${m.textContent||"empty task item"}`};d(t),s.contentEditable="false",l.type="checkbox",l.addEventListener("mousedown",m=>m.preventDefault()),l.addEventListener("change",m=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){l.checked=!l.checked;return}const{checked:p}=m.target;r.isEditable&&typeof n=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:f})=>{const y=n();if(typeof y!="number")return!1;const x=f.doc.nodeAt(y);return f.setNodeMarkup(y,void 0,{...x?.attrs,checked:p}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,p)||(l.checked=!l.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([m,p])=>{a.setAttribute(m,p)}),a.dataset.checked=t.attrs.checked,l.checked=t.attrs.checked,s.append(l,o),a.append(s,c),Object.entries(e).forEach(([m,p])=>{a.setAttribute(m,p)});let u=new Set(Object.keys(e));return{dom:a,contentDOM:c,update:m=>{if(m.type!==this.type)return!1;a.dataset.checked=m.attrs.checked,l.checked=m.attrs.checked,d(m);const p=r.extensionManager.attributes,f=w0(m,p),y=new Set(Object.keys(f)),x=this.options.HTMLAttributes;return u.forEach(b=>{y.has(b)||(b in x?a.setAttribute(b,x[b]):a.removeAttribute(b))}),Object.entries(f).forEach(([b,v])=>{v==null?b in x?a.setAttribute(b,x[b]):a.removeAttribute(b):a.setAttribute(b,v)}),u=y,!0}}}},addInputRules(){return[nx({find:VYe,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),WYe=po.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",zi(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,`
- `):"",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 r=s=>{const o=sF(s,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:l=>({indentLevel:l[1].length,mainContent:l[4],checked:l[3].toLowerCase()==="x"}),createToken:(l,c)=>({type:"taskItem",raw:"",mainContent:l.mainContent,indentLevel:l.indentLevel,checked:l.checked,text:l.mainContent,tokens:n.inlineTokens(l.mainContent),nestedTokens:c}),customNestedParser:r},n);return o?[{type:"taskList",raw:o.raw,items:o.items}]:n.blockTokens(s)},a=sF(t,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:s=>({indentLevel:s[1].length,mainContent:s[4],checked:s[3].toLowerCase()==="x"}),createToken:(s,o)=>({type:"taskItem",raw:"",mainContent:s.mainContent,indentLevel:s.indentLevel,checked:s.checked,text:s.mainContent,tokens:n.inlineTokens(s.mainContent),nestedTokens:o}),customNestedParser:r},n);if(a)return{type:"taskList",raw:a.raw,items:a.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()}}});Gr.create({name:"listKit",addExtensions(){const t=[];return this.options.bulletList!==!1&&t.push(Rae.configure(this.options.bulletList)),this.options.listItem!==!1&&t.push(Fae.configure(this.options.listItem)),this.options.listKeymap!==!1&&t.push(Bae.configure(this.options.listKeymap)),this.options.orderedList!==!1&&t.push($ae.configure(this.options.orderedList)),this.options.taskItem!==!1&&t.push(GYe.configure(this.options.taskItem)),this.options.taskList!==!1&&t.push(WYe.configure(this.options.taskList)),t}});var oK=" ",KYe=" ",YYe=po.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",zi(this.options.HTMLAttributes,t),0]},parseMarkdown:(t,e)=>{const n=t.tokens||[];if(n.length===1&&n[0].type==="image")return e.parseChildren([n[0]]);const r=e.parseInline(n);return r.length===1&&r[0].type==="text"&&(r[0].text===oK||r[0].text===KYe)?e.createNode("paragraph",void 0,[]):e.createNode("paragraph",void 0,r)},renderMarkdown:(t,e)=>{if(!t)return"";const n=Array.isArray(t.content)?t.content:[];return n.length===0?oK:e.renderChildren(n)},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),XYe=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,QYe=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,ZYe=wh.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",zi(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[tx({find:XYe,type:this.type})]},addPasteRules(){return[hf({find:QYe,type:this.type})]}}),JYe=po.create({name:"text",group:"inline",parseMarkdown:t=>({type:"text",text:t.text||""}),renderMarkdown:t=>t.text||""}),qae=wh.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",zi(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 a=/^(\+\+)([\s\S]+?)(\+\+)/.exec(t);if(!a)return;const s=a[2].trim();return{type:"underline",raw:a[0],text:s,tokens:n.inlineTokens(s)}}},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()}}}),eXe=qae;function tXe(t={}){return new Ci({view(e){return new nXe(e,t)}})}class nXe{constructor(e,n){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=n.width)!==null&&r!==void 0?r:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(a=>{let s=o=>{this[a](o)};return e.dom.addEventListener(a,s),{name:a,handler:s}})}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,r,a=this.editorView.dom,s=a.getBoundingClientRect(),o=s.width/a.offsetWidth,l=s.height/a.offsetHeight;if(n){let m=e.nodeBefore,p=e.nodeAfter;if(m||p){let f=this.editorView.nodeDOM(this.cursorPos-(m?m.nodeSize:0));if(f){let y=f.getBoundingClientRect(),x=m?y.bottom:y.top;m&&p&&(x=(x+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let b=this.width/2*l;r={left:y.left,right:y.right,top:x-b,bottom:x+b}}}}if(!r){let m=this.editorView.coordsAtPos(this.cursorPos),p=this.width/2*o;r={left:m.left-p,right:m.left+p,top:m.top,bottom:m.bottom}}let c=this.editorView.dom.offsetParent;this.element||(this.element=c.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 d,u;if(!c||c==document.body&&getComputedStyle(c).position=="static")d=-pageXOffset,u=-pageYOffset;else{let m=c.getBoundingClientRect(),p=m.width/c.offsetWidth,f=m.height/c.offsetHeight;d=m.left-c.scrollLeft*p,u=m.top-c.scrollTop*f}this.element.style.left=(r.left-d)/o+"px",this.element.style.top=(r.top-u)/l+"px",this.element.style.width=(r.right-r.left)/o+"px",this.element.style.height=(r.bottom-r.top)/l+"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}),r=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),a=r&&r.type.spec.disableDropCursor,s=typeof a=="function"?a(this.editorView,n,e):a;if(n&&!s){let o=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let l=Lre(this.editorView.state.doc,o,this.editorView.dragging.slice);l!=null&&(o=l)}this.setCursor(o),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class Ri extends Yn{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return Ri.valid(r)?new Ri(r):Yn.near(r)}content(){return Wt.empty}eq(e){return e instanceof Ri&&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 Ri(e.resolve(n.pos))}getBookmark(){return new SI(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!rXe(e)||!iXe(e))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let a=n.contentMatchAt(e.index()).defaultType;return a&&a.isTextblock}static findGapCursorFrom(e,n,r=!1){e:for(;;){if(!r&&Ri.valid(e))return e;let a=e.pos,s=null;for(let o=e.depth;;o--){let l=e.node(o);if(n>0?e.indexAfter(o)<l.childCount:e.index(o)>0){s=l.child(n>0?e.indexAfter(o):e.index(o)-1);break}else if(o==0)return null;a+=n;let c=e.doc.resolve(a);if(Ri.valid(c))return c}for(;;){let o=n>0?s.firstChild:s.lastChild;if(!o){if(s.isAtom&&!s.isText&&!gn.isSelectable(s)){e=e.doc.resolve(a+s.nodeSize*n),r=!1;continue e}break}s=o,a+=n;let l=e.doc.resolve(a);if(Ri.valid(l))return l}return null}}}Ri.prototype.visible=!1;Ri.findFrom=Ri.findGapCursorFrom;Yn.jsonID("gapcursor",Ri);class SI{constructor(e){this.pos=e}map(e){return new SI(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return Ri.valid(n)?new Ri(n):Yn.near(n)}}function Vae(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function rXe(t){for(let e=t.depth;e>=0;e--){let n=t.index(e),r=t.node(e);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let a=r.child(n-1);;a=a.lastChild){if(a.childCount==0&&!a.inlineContent||Vae(a.type))return!0;if(a.inlineContent)return!1}}return!0}function iXe(t){for(let e=t.depth;e>=0;e--){let n=t.indexAfter(e),r=t.node(e);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let a=r.child(n);;a=a.firstChild){if(a.childCount==0&&!a.inlineContent||Vae(a.type))return!0;if(a.inlineContent)return!1}}return!0}function aXe(){return new Ci({props:{decorations:cXe,createSelectionBetween(t,e,n){return e.pos==n.pos&&Ri.valid(n)?new Ri(n):null},handleClick:oXe,handleKeyDown:sXe,handleDOMEvents:{beforeinput:lXe}}})}const sXe=Oie({ArrowLeft:t1("horiz",-1),ArrowRight:t1("horiz",1),ArrowUp:t1("vert",-1),ArrowDown:t1("vert",1)});function t1(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,a,s){let o=r.selection,l=e>0?o.$to:o.$from,c=o.empty;if(o instanceof jn){if(!s.endOfTextblock(n)||l.depth==0)return!1;c=!1,l=r.doc.resolve(e>0?l.after():l.before())}let d=Ri.findGapCursorFrom(l,e,c);return d?(a&&a(r.tr.setSelection(new Ri(d))),!0):!1}}function oXe(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!Ri.valid(r))return!1;let a=t.posAtCoords({left:n.clientX,top:n.clientY});return a&&a.inside>-1&&gn.isSelectable(t.state.doc.nodeAt(a.inside))?!1:(t.dispatch(t.state.tr.setSelection(new Ri(r))),!0)}function lXe(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof Ri))return!1;let{$from:n}=t.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!r)return!1;let a=Lt.empty;for(let o=r.length-1;o>=0;o--)a=Lt.from(r[o].createAndFill(null,a));let s=t.state.tr.replace(n.pos,n.pos,new Wt(a,0,0));return s.setSelection(jn.near(s.doc.resolve(n.pos+1))),t.dispatch(s),!1}function cXe(t){if(!(t.selection instanceof Ri))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",wi.create(t.doc,[Rs.widget(t.selection.head,e,{key:"gapcursor"})])}var ZN=200,La=function(){};La.prototype.append=function(e){return e.length?(e=La.from(e),!this.length&&e||e.length<ZN&&this.leafAppend(e)||this.length<ZN&&e.leafPrepend(this)||this.appendInner(e)):this};La.prototype.prepend=function(e){return e.length?La.from(e).append(this):this};La.prototype.appendInner=function(e){return new dXe(this,e)};La.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?La.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};La.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};La.prototype.forEach=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length),n<=r?this.forEachInner(e,n,r,0):this.forEachInvertedInner(e,n,r,0)};La.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var a=[];return this.forEach(function(s,o){return a.push(e(s,o))},n,r),a};La.from=function(e){return e instanceof La?e:e&&e.length?new Gae(e):La.empty};var Gae=(function(t){function e(r){t.call(this),this.values=r}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(a,s){return a==0&&s==this.length?this:new e(this.values.slice(a,s))},e.prototype.getInner=function(a){return this.values[a]},e.prototype.forEachInner=function(a,s,o,l){for(var c=s;c<o;c++)if(a(this.values[c],l+c)===!1)return!1},e.prototype.forEachInvertedInner=function(a,s,o,l){for(var c=s-1;c>=o;c--)if(a(this.values[c],l+c)===!1)return!1},e.prototype.leafAppend=function(a){if(this.length+a.length<=ZN)return new e(this.values.concat(a.flatten()))},e.prototype.leafPrepend=function(a){if(this.length+a.length<=ZN)return new e(a.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e})(La);La.empty=new Gae([]);var dXe=(function(t){function e(n,r){t.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.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(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,a,s,o){var l=this.left.length;if(a<l&&this.left.forEachInner(r,a,Math.min(s,l),o)===!1||s>l&&this.right.forEachInner(r,Math.max(a-l,0),Math.min(this.length,s)-l,o+l)===!1)return!1},e.prototype.forEachInvertedInner=function(r,a,s,o){var l=this.left.length;if(a>l&&this.right.forEachInvertedInner(r,a-l,Math.max(s,l)-l,o+l)===!1||s<l&&this.left.forEachInvertedInner(r,Math.min(a,l),s,o)===!1)return!1},e.prototype.sliceInner=function(r,a){if(r==0&&a==this.length)return this;var s=this.left.length;return a<=s?this.left.slice(r,a):r>=s?this.right.slice(r-s,a-s):this.left.slice(r,s).append(this.right.slice(0,a-s))},e.prototype.leafAppend=function(r){var a=this.right.leafAppend(r);if(a)return new e(this.left,a)},e.prototype.leafPrepend=function(r){var a=this.left.leafPrepend(r);if(a)return new e(a,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e})(La);const uXe=500;class Yl{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let a,s;n&&(a=this.remapping(r,this.items.length),s=a.maps.length);let o=e.tr,l,c,d=[],u=[];return this.items.forEach((m,p)=>{if(!m.step){a||(a=this.remapping(r,p+1),s=a.maps.length),s--,u.push(m);return}if(a){u.push(new Tc(m.map));let f=m.step.map(a.slice(s)),y;f&&o.maybeStep(f).doc&&(y=o.mapping.maps[o.mapping.maps.length-1],d.push(new Tc(y,void 0,void 0,d.length+u.length))),s--,y&&a.appendMap(y,s)}else o.maybeStep(m.step);if(m.selection)return l=a?m.selection.map(a.slice(s)):m.selection,c=new Yl(this.items.slice(0,r).append(u.reverse().concat(d)),this.eventCount-1),!1},this.items.length,0),{remaining:c,transform:o,selection:l}}addTransform(e,n,r,a){let s=[],o=this.eventCount,l=this.items,c=!a&&l.length?l.get(l.length-1):null;for(let u=0;u<e.steps.length;u++){let m=e.steps[u].invert(e.docs[u]),p=new Tc(e.mapping.maps[u],m,n),f;(f=c&&c.merge(p))&&(p=f,u?s.pop():l=l.slice(0,l.length-1)),s.push(p),n&&(o++,n=void 0),a||(c=p)}let d=o-r.depth;return d>hXe&&(l=mXe(l,d),o-=d),new Yl(l.append(s),o)}remapping(e,n){let r=new f0;return this.items.forEach((a,s)=>{let o=a.mirrorOffset!=null&&s-a.mirrorOffset>=e?r.maps.length-a.mirrorOffset:void 0;r.appendMap(a.map,o)},e,n),r}addMaps(e){return this.eventCount==0?this:new Yl(this.items.append(e.map(n=>new Tc(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],a=Math.max(0,this.items.length-n),s=e.mapping,o=e.steps.length,l=this.eventCount;this.items.forEach(p=>{p.selection&&l--},a);let c=n;this.items.forEach(p=>{let f=s.getMirror(--c);if(f==null)return;o=Math.min(o,f);let y=s.maps[f];if(p.step){let x=e.steps[f].invert(e.docs[f]),b=p.selection&&p.selection.map(s.slice(c+1,f));b&&l++,r.push(new Tc(y,x,b))}else r.push(new Tc(y))},a);let d=[];for(let p=n;p<o;p++)d.push(new Tc(s.maps[p]));let u=this.items.slice(0,a).append(d).append(r),m=new Yl(u,l);return m.emptyItemCount()>uXe&&(m=m.compress(this.items.length-r.length)),m}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),r=n.maps.length,a=[],s=0;return this.items.forEach((o,l)=>{if(l>=e)a.push(o),o.selection&&s++;else if(o.step){let c=o.step.map(n.slice(r)),d=c&&c.getMap();if(r--,d&&n.appendMap(d,r),c){let u=o.selection&&o.selection.map(n.slice(r));u&&s++;let m=new Tc(d.invert(),c,u),p,f=a.length-1;(p=a.length&&a[f].merge(m))?a[f]=p:a.push(m)}}else o.map&&r--},this.items.length,0),new Yl(La.from(a.reverse()),s)}}Yl.empty=new Yl(La.empty,0);function mXe(t,e){let n;return t.forEach((r,a)=>{if(r.selection&&e--==0)return n=a,!1}),t.slice(n)}class Tc{constructor(e,n,r,a){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=a}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new Tc(n.getMap().invert(),n,this.selection)}}}class vm{constructor(e,n,r,a,s){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=a,this.prevComposition=s}}const hXe=20;function pXe(t,e,n,r){let a=n.getMeta(Ip),s;if(a)return a.historyState;n.getMeta(bXe)&&(t=new vm(t.done,t.undone,null,0,-1));let o=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(o&&o.getMeta(Ip))return o.getMeta(Ip).redo?new vm(t.done.addTransform(n,void 0,r,E1(e)),t.undone,lK(n.mapping.maps),t.prevTime,t.prevComposition):new vm(t.done,t.undone.addTransform(n,void 0,r,E1(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let l=n.getMeta("composition"),c=t.prevTime==0||!o&&t.prevComposition!=l&&(t.prevTime<(n.time||0)-r.newGroupDelay||!fXe(n,t.prevRanges)),d=o?zj(t.prevRanges,n.mapping):lK(n.mapping.maps);return new vm(t.done.addTransform(n,c?e.selection.getBookmark():void 0,r,E1(e)),Yl.empty,d,n.time,l??t.prevComposition)}else return(s=n.getMeta("rebased"))?new vm(t.done.rebased(n,s),t.undone.rebased(n,s),zj(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new vm(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),zj(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function fXe(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,a)=>{for(let s=0;s<e.length;s+=2)r<=e[s+1]&&a>=e[s]&&(n=!0)}),n}function lK(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((r,a,s,o)=>e.push(s,o));return e}function zj(t,e){if(!t)return null;let n=[];for(let r=0;r<t.length;r+=2){let a=e.map(t[r],1),s=e.map(t[r+1],-1);a<=s&&n.push(a,s)}return n}function gXe(t,e,n){let r=E1(e),a=Ip.get(e).spec.config,s=(n?t.undone:t.done).popEvent(e,r);if(!s)return null;let o=s.selection.resolve(s.transform.doc),l=(n?t.done:t.undone).addTransform(s.transform,e.selection.getBookmark(),a,r),c=new vm(n?l:s.remaining,n?s.remaining:l,null,0,-1);return s.transform.setSelection(o).setMeta(Ip,{redo:n,historyState:c})}let Uj=!1,cK=null;function E1(t){let e=t.plugins;if(cK!=e){Uj=!1,cK=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){Uj=!0;break}}return Uj}const Ip=new _a("history"),bXe=new _a("closeHistory");function xXe(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new Ci({key:Ip,state:{init(){return new vm(Yl.empty,Yl.empty,null,0,-1)},apply(e,n,r){return pXe(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,a=r=="historyUndo"?Kae:r=="historyRedo"?Yae:null;return!a||!e.editable?!1:(n.preventDefault(),a(e.state,e.dispatch))}}}})}function Wae(t,e){return(n,r)=>{let a=Ip.getState(n);if(!a||(t?a.undone:a.done).eventCount==0)return!1;if(r){let s=gXe(a,n,t);s&&r(e?s.scrollIntoView():s)}return!0}}const Kae=Wae(!1,!0),Yae=Wae(!0,!0);Gr.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 r=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(r)}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 Ci({key:new _a("characterCount"),appendTransaction:(e,n,r)=>{if(t)return;const a=this.options.limit;if(a==null||a===0){t=!0;return}const s=this.storage.characters({node:r.doc});if(s>a){const o=s-a,l=0,c=o;console.warn(`[CharacterCount] Initial content exceeded limit of ${a} characters. Content was automatically trimmed.`);const d=r.tr.deleteRange(l,c);return t=!0,d}t=!0},filterTransaction:(e,n)=>{const r=this.options.limit;if(!e.docChanged||r===0||r===null||r===void 0)return!0;const a=this.storage.characters({node:n.doc}),s=this.storage.characters({node:e.doc});if(s<=r||a>r&&s>r&&s<=a)return!0;if(a>r&&s>r&&s>a||!e.getMeta("paste"))return!1;const l=e.selection.$head.pos,c=s-r,d=l-c,u=l;return e.deleteRange(d,u),!(this.storage.characters({node:e.doc})>r)}})]}});var yXe=Gr.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[tXe(this.options)]}});Gr.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new Ci({key:new _a("focus"),props:{decorations:({doc:t,selection:e})=>{const{isEditable:n,isFocused:r}=this.editor,{anchor:a}=e,s=[];if(!n||!r)return wi.create(t,[]);let o=0;this.options.mode==="deepest"&&t.descendants((c,d)=>{if(c.isText)return;if(!(a>=d&&a<=d+c.nodeSize-1))return!1;o+=1});let l=0;return t.descendants((c,d)=>{if(c.isText||!(a>=d&&a<=d+c.nodeSize-1))return!1;if(l+=1,this.options.mode==="deepest"&&o-l>0||this.options.mode==="shallowest"&&l>1)return this.options.mode==="deepest";s.push(Rs.node(d,d+c.nodeSize,{class:this.options.className}))}),wi.create(t,s)}}})]}});var vXe=Gr.create({name:"gapCursor",addProseMirrorPlugins(){return[aXe()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=Er(un(t,"allowGapCursor",n)))!=null?e:null}}}),dK="placeholder";function wXe(t){return t.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}Gr.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:dK,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){const t=this.options.dataAttribute?`data-${wXe(this.options.dataAttribute)}`:`data-${dK}`;return[new Ci({key:new _a("placeholder"),props:{decorations:({doc:e,selection:n})=>{const r=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:a}=n,s=[];if(!r)return null;const o=this.editor.isEmpty;return e.descendants((l,c)=>{const d=a>=c&&a<=c+l.nodeSize,u=!l.isLeaf&&OT(l);if((d||!this.options.showOnlyCurrent)&&u){const m=[this.options.emptyNodeClass];o&&m.push(this.options.emptyEditorClass);const p=Rs.node(c,c+l.nodeSize,{class:m.join(" "),[t]:typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:l,pos:c,hasAnchor:d}):this.options.placeholder});s.push(p)}return this.options.includeChildren}),wi.create(e,s)}}})]}});Gr.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:t,options:e}=this;return[new Ci({key:new _a("selection"),props:{decorations(n){return n.selection.empty||t.isFocused||!t.isEditable||Jie(n.selection)||t.view.dragging?null:wi.create(n.doc,[Rs.inline(n.selection.from,n.selection.to,{class:e.className})])}}})]}});function uK({types:t,node:e}){return e&&Array.isArray(t)&&t.includes(e.type)||e?.type===t}var SXe=Gr.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var t;const e=new _a(this.name),n=this.options.node||((t=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:t.name)||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,a])=>a).filter(a=>(this.options.notAfter||[]).concat(n).includes(a.name));return[new Ci({key:e,appendTransaction:(a,s,o)=>{const{doc:l,tr:c,schema:d}=o,u=e.getState(o),m=l.content.size,p=d.nodes[n];if(u)return c.insert(m,p.create())},state:{init:(a,s)=>{const o=s.tr.doc.lastChild;return!uK({node:o,types:r})},apply:(a,s)=>{if(!a.docChanged||a.getMeta("__uniqueIDTransaction"))return s;const o=a.doc.lastChild;return!uK({node:o,types:r})}}})]}}),_Xe=Gr.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>Kae(t,e),redo:()=>({state:t,dispatch:e})=>Yae(t,e)}},addProseMirrorPlugins(){return[xXe(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()}}}),kXe=Gr.create({name:"starterKit",addExtensions(){var t,e,n,r;const a=[];return this.options.bold!==!1&&a.push(YKe.configure(this.options.bold)),this.options.blockquote!==!1&&a.push(qKe.configure(this.options.blockquote)),this.options.bulletList!==!1&&a.push(Rae.configure(this.options.bulletList)),this.options.code!==!1&&a.push(ZKe.configure(this.options.code)),this.options.codeBlock!==!1&&a.push(tYe.configure(this.options.codeBlock)),this.options.document!==!1&&a.push(nYe.configure(this.options.document)),this.options.dropcursor!==!1&&a.push(yXe.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&a.push(vXe.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&a.push(rYe.configure(this.options.hardBreak)),this.options.heading!==!1&&a.push(iYe.configure(this.options.heading)),this.options.undoRedo!==!1&&a.push(_Xe.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&a.push(aYe.configure(this.options.horizontalRule)),this.options.italic!==!1&&a.push(dYe.configure(this.options.italic)),this.options.listItem!==!1&&a.push(Fae.configure(this.options.listItem)),this.options.listKeymap!==!1&&a.push(Bae.configure((t=this.options)==null?void 0:t.listKeymap)),this.options.link!==!1&&a.push(Dae.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&a.push($ae.configure(this.options.orderedList)),this.options.paragraph!==!1&&a.push(YYe.configure(this.options.paragraph)),this.options.strike!==!1&&a.push(ZYe.configure(this.options.strike)),this.options.text!==!1&&a.push(JYe.configure(this.options.text)),this.options.underline!==!1&&a.push(qae.configure((n=this.options)==null?void 0:n.underline)),this.options.trailingNode!==!1&&a.push(SXe.configure((r=this.options)==null?void 0:r.trailingNode)),a}}),NXe=kXe,CXe=Gr.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")}}}),TXe=CXe,PXe=20,Xae=(t,e=0)=>{const n=[];return!t.children.length||e>PXe||Array.from(t.children).forEach(r=>{r.tagName==="SPAN"?n.push(r):r.children.length&&n.push(...Xae(r,e+1))}),n},AXe=t=>{if(!t.children.length)return;const e=Xae(t);e&&e.forEach(n=>{var r,a;const s=n.getAttribute("style"),o=(a=(r=n.parentElement)==null?void 0:r.closest("span"))==null?void 0:a.getAttribute("style");n.setAttribute("style",`${o};${s}`)})},Qae=wh.create({name:"textStyle",priority:101,addOptions(){return{HTMLAttributes:{},mergeNestedSpanStyles:!0}},parseHTML(){return[{tag:"span",consuming:!1,getAttrs:t=>t.hasAttribute("style")?(this.options.mergeNestedSpanStyles&&AXe(t),{}):!1}]},renderHTML({HTMLAttributes:t}){return["span",zi(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,r)=>{if(n.isTextblock)return!0;n.marks.filter(a=>a.type===this.type).some(a=>Object.values(a.attrs).some(s=>!!s))||t.removeMark(r,r+n.nodeSize,this.type)}),!0}}}}),MXe=Gr.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 r=n.split(";").map(a=>a.trim()).filter(Boolean);for(let a=r.length-1;a>=0;a-=1){const s=r[a].split(":");if(s.length>=2){const o=s[0].trim().toLowerCase(),l=s.slice(1).join(":").trim();if(o==="background-color")return l.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()}}}),Zae=Gr.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 r=n.split(";").map(a=>a.trim()).filter(Boolean);for(let a=r.length-1;a>=0;a-=1){const s=r[a].split(":");if(s.length>=2){const o=s[0].trim().toLowerCase(),l=s.slice(1).join(":").trim();if(o==="color")return l.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()}}}),EXe=Gr.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()}}}),jXe=Gr.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()}}}),DXe=Gr.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()}}});Gr.create({name:"textStyleKit",addExtensions(){const t=[];return this.options.backgroundColor!==!1&&t.push(MXe.configure(this.options.backgroundColor)),this.options.color!==!1&&t.push(Zae.configure(this.options.color)),this.options.fontFamily!==!1&&t.push(EXe.configure(this.options.fontFamily)),this.options.fontSize!==!1&&t.push(jXe.configure(this.options.fontSize)),this.options.lineHeight!==!1&&t.push(DXe.configure(this.options.lineHeight)),this.options.textStyle!==!1&&t.push(Qae.configure(this.options.textStyle)),t}});var RXe=Zae,FXe=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,LXe=po.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",zi(this.options.HTMLAttributes,t)]},parseMarkdown:(t,e)=>e.createNode("image",{src:t.href,title:t.title,alt:t.text}),renderMarkdown:t=>{var e,n,r,a,s,o;const l=(n=(e=t.attrs)==null?void 0:e.src)!=null?n:"",c=(a=(r=t.attrs)==null?void 0:r.alt)!=null?a:"",d=(o=(s=t.attrs)==null?void 0:s.title)!=null?o:"";return d?``:``},addNodeView(){if(!this.options.resize||!this.options.resize.enabled||typeof document>"u")return null;const{directions:t,minWidth:e,minHeight:n,alwaysPreserveAspectRatio:r}=this.options.resize;return({node:a,getPos:s,HTMLAttributes:o,editor:l})=>{const c=document.createElement("img");Object.entries(o).forEach(([m,p])=>{if(p!=null)switch(m){case"width":case"height":break;default:c.setAttribute(m,p);break}}),c.src=o.src;const d=new RWe({element:c,editor:l,node:a,getPos:s,onResize:(m,p)=>{c.style.width=`${m}px`,c.style.height=`${p}px`},onCommit:(m,p)=>{const f=s();f!==void 0&&this.editor.chain().setNodeSelection(f).updateAttributes(this.name,{width:m,height:p}).run()},onUpdate:(m,p,f)=>m.type===a.type,options:{directions:t,min:{width:e,height:n},preserveAspectRatio:r===!0}}),u=d.dom;return u.style.visibility="hidden",u.style.pointerEvents="none",c.onload=()=>{u.style.visibility="",u.style.pointerEvents=""},d}},addCommands(){return{setImage:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}},addInputRules(){return[gae({find:FXe,type:this.type,getAttributes:t=>{const[,,e,n,r]=t;return{src:n,alt:e,title:r}}})]}}),OXe=LXe;function xF({content:t,onChange:e,placeholder:n}){const{t:r}=Mt(),a=zKe({extensions:[NXe.configure({heading:!1,codeBlock:!1,code:!1}),eXe,FYe.configure({openOnClick:!1,HTMLAttributes:{target:"_blank",rel:"noopener noreferrer"}}),TXe.configure({types:["paragraph"]}),Qae,RXe,OXe.configure({HTMLAttributes:{style:"max-width: 100%; height: auto;"}})],content:t,onUpdate:({editor:l})=>{e(l.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(!a)return null;const s=({onClick:l,isActive:c=!1,children:d,title:u})=>i.jsx("button",{type:"button",onClick:l,title:u,className:`p-1.5 rounded hover:bg-bambu-dark-tertiary transition-colors ${c?"bg-bambu-dark-tertiary text-bambu-green":"text-bambu-gray"}`,children:d}),o=()=>{const l=window.prompt("Enter URL:");l&&a.chain().focus().setLink({href:l}).run()};return i.jsxs("div",{className:"border border-bambu-dark-tertiary rounded-lg overflow-hidden bg-bambu-dark",children:[i.jsxs("div",{className:"flex items-center gap-0.5 p-1.5 border-b border-bambu-dark-tertiary bg-bambu-dark-secondary",children:[i.jsx(s,{onClick:()=>a.chain().focus().toggleBold().run(),isActive:a.isActive("bold"),title:r("richTextEditor.bold"),children:i.jsx(Dme,{className:"w-4 h-4"})}),i.jsx(s,{onClick:()=>a.chain().focus().toggleItalic().run(),isActive:a.isActive("italic"),title:r("richTextEditor.italic"),children:i.jsx(Ipe,{className:"w-4 h-4"})}),i.jsx(s,{onClick:()=>a.chain().focus().toggleUnderline().run(),isActive:a.isActive("underline"),title:r("richTextEditor.underline"),children:i.jsx(jge,{className:"w-4 h-4"})}),i.jsx("div",{className:"w-px h-5 bg-bambu-dark-tertiary mx-1"}),i.jsx(s,{onClick:()=>a.chain().focus().toggleBulletList().run(),isActive:a.isActive("bulletList"),title:r("richTextEditor.bulletList"),children:i.jsx(mC,{className:"w-4 h-4"})}),i.jsx(s,{onClick:()=>a.chain().focus().toggleOrderedList().run(),isActive:a.isActive("orderedList"),title:r("richTextEditor.numberedList"),children:i.jsx(KY,{className:"w-4 h-4"})}),i.jsx("div",{className:"w-px h-5 bg-bambu-dark-tertiary mx-1"}),i.jsx(s,{onClick:()=>a.chain().focus().setTextAlign("left").run(),isActive:a.isActive({textAlign:"left"}),title:r("richTextEditor.alignLeft"),children:i.jsx(kge,{className:"w-4 h-4"})}),i.jsx(s,{onClick:()=>a.chain().focus().setTextAlign("center").run(),isActive:a.isActive({textAlign:"center"}),title:r("richTextEditor.alignCenter"),children:i.jsx(vge,{className:"w-4 h-4"})}),i.jsx(s,{onClick:()=>a.chain().focus().setTextAlign("right").run(),isActive:a.isActive({textAlign:"right"}),title:r("richTextEditor.alignRight"),children:i.jsx(Sge,{className:"w-4 h-4"})}),i.jsx("div",{className:"w-px h-5 bg-bambu-dark-tertiary mx-1"}),i.jsx(s,{onClick:o,isActive:a.isActive("link"),title:r("richTextEditor.addLink"),children:i.jsx(dx,{className:"w-4 h-4"})}),a.isActive("link")&&i.jsx(s,{onClick:()=>a.chain().focus().unsetLink().run(),title:r("richTextEditor.removeLink"),children:i.jsx(Ov,{className:"w-4 h-4"})})]}),i.jsx(yae,{editor:a})]})}function Jae({archiveId:t,archiveName:e,onClose:n}){const r=tn(),[a,s]=w.useState(!1),[o,l]=w.useState(null),[c,d]=w.useState({}),{data:u,isLoading:m,error:p}=Je({queryKey:["archive-project-page",t],queryFn:()=>be.getArchiveProjectPage(t)}),f=ut({mutationFn:C=>be.updateArchiveProjectPage(t,C),onSuccess:()=>{r.invalidateQueries({queryKey:["archive-project-page",t]}),s(!1),d({})}});w.useEffect(()=>{const C=T=>{T.key==="Escape"&&(o!==null?l(null):a?v():n())};return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[o,a,n]);const y=[...u?.model_pictures||[],...u?.profile_pictures||[]],x=()=>{d({title:u?.title||"",description:u?.description||"",designer:u?.designer||"",license:u?.license||"",profile_title:u?.profile_title||"",profile_description:u?.profile_description||""}),s(!0)},b=()=>{f.mutate(c)},v=()=>{s(!1),d({})},_=C=>{const T=["p","br","b","strong","i","em","u","a","ul","ol","li","figure","img"],N=new DOMParser().parseFromString(C,"text/html"),R=A=>{if(A.nodeType===Node.TEXT_NODE)return A.textContent||"";if(A.nodeType===Node.ELEMENT_NODE){const D=A,$=D.tagName.toLowerCase();if(!T.includes($))return Array.from(D.childNodes).map(R).join("");let U="";if($==="a"&&D.getAttribute("href")){const L=D.getAttribute("href");L?.toLowerCase().startsWith("http")&&(U=` href="${L}" target="_blank" rel="noopener noreferrer"`)}if($==="img"){const L=D.getAttribute("src");if(!L?.toLowerCase().startsWith("http"))return"";U=` src="${L}" style="max-width: 100%; height: auto;"`}const G=Array.from(D.childNodes).map(R).join("");return["br","img"].includes($)?`<${$}${U} />`:`<${$}${U}>${G}</${$}>`}return""};return Array.from(N.body.childNodes).map(R).join("")},k=u&&(u.title||u.description||u.designer||u.profile_title||y.length>0),P=C=>{C.target===C.currentTarget&&n()};return i.jsxs("div",{className:"fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-4",onClick:P,children:[i.jsxs("div",{className:"bg-bambu-dark-secondary rounded-xl max-w-4xl w-full max-h-[90vh] overflow-hidden flex flex-col",children:[i.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-bambu-dark-tertiary",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(Es,{className:"w-5 h-5 text-bambu-green"}),i.jsxs("h2",{className:"text-lg font-semibold text-white",children:["Project Page",e&&i.jsxs("span",{className:"text-bambu-gray ml-2",children:["- ",e]})]})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[!a&&k&&i.jsxs(Fe,{variant:"ghost",size:"sm",onClick:x,children:[i.jsx($p,{className:"w-4 h-4 mr-1"}),"Edit"]}),a&&i.jsxs(i.Fragment,{children:[i.jsx(Fe,{variant:"ghost",size:"sm",onClick:v,children:"Cancel"}),i.jsxs(Fe,{variant:"primary",size:"sm",onClick:b,disabled:f.isPending,children:[i.jsx(ps,{className:"w-4 h-4 mr-1"}),"Save"]})]}),i.jsx("button",{onClick:n,className:"p-2 hover:bg-bambu-dark-tertiary rounded-lg transition-colors",children:i.jsx(zt,{className:"w-5 h-5 text-bambu-gray"})})]})]}),i.jsxs("div",{className:"flex-1 overflow-y-auto p-6",children:[m&&i.jsx("div",{className:"flex items-center justify-center py-12",children:i.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-2 border-bambu-green border-t-transparent"})}),p&&i.jsx("div",{className:"text-red-400 text-center py-12",children:"Failed to load project page data"}),u&&!k&&i.jsxs("div",{className:"text-bambu-gray text-center py-12",children:[i.jsx(Es,{className:"w-12 h-12 mx-auto mb-4 opacity-50"}),i.jsx("p",{children:"No project page data found in this 3MF file."}),i.jsx("p",{className:"text-sm mt-2",children:"Project pages are typically included in files downloaded from MakerWorld."})]}),u&&k&&i.jsxs("div",{className:"space-y-6",children:[i.jsxs("div",{className:"space-y-4",children:[a?i.jsx("input",{type:"text",value:c.title||"",onChange:C=>d({...c,title:C.target.value}),placeholder:"Title",className:"w-full bg-bambu-dark border border-bambu-dark-tertiary rounded-lg px-4 py-2 text-white text-xl font-semibold"}):u.title&&i.jsx("h3",{className:"text-xl font-semibold text-white",children:u.title}),i.jsxs("div",{className:"flex flex-wrap gap-4 text-sm",children:[a?i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(du,{className:"w-4 h-4 text-bambu-gray"}),i.jsx("input",{type:"text",value:c.designer||"",onChange:C=>d({...c,designer:C.target.value}),placeholder:"Designer",className:"bg-bambu-dark border border-bambu-dark-tertiary rounded px-2 py-1 text-white"})]}):u.designer&&i.jsxs("div",{className:"flex items-center gap-2 text-bambu-gray",children:[i.jsx(du,{className:"w-4 h-4"}),i.jsx("span",{children:u.designer}),u.designer_user_id&&i.jsx("a",{href:`https://makerworld.com/en/@${u.designer_user_id}`,target:"_blank",rel:"noopener noreferrer",className:"text-bambu-green hover:underline",children:i.jsx(ei,{className:"w-3 h-3"})})]}),u.creation_date&&i.jsxs("div",{className:"flex items-center gap-2 text-bambu-gray",children:[i.jsx(Xr,{className:"w-4 h-4"}),i.jsx("span",{children:u.creation_date})]}),a?i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(Es,{className:"w-4 h-4 text-bambu-gray"}),i.jsx("input",{type:"text",value:c.license||"",onChange:C=>d({...c,license:C.target.value}),placeholder:"License",className:"bg-bambu-dark border border-bambu-dark-tertiary rounded px-2 py-1 text-white"})]}):u.license&&i.jsxs("div",{className:"flex items-center gap-2 text-bambu-gray",children:[i.jsx(Es,{className:"w-4 h-4"}),i.jsx("span",{children:u.license})]}),u.origin&&i.jsx("span",{className:"px-2 py-0.5 bg-bambu-dark rounded text-bambu-gray",children:u.origin})]})]}),(u.description||a)&&i.jsxs("div",{className:"space-y-2",children:[i.jsx("h4",{className:"text-sm font-medium text-bambu-gray uppercase tracking-wide",children:"Description"}),a?i.jsx(xF,{content:c.description||"",onChange:C=>d({...c,description:C}),placeholder:"Enter description..."}):i.jsx("div",{className:"prose prose-invert prose-sm max-w-none text-bambu-gray-light",dangerouslySetInnerHTML:{__html:_(u.description||"")}})]}),(u.profile_title||u.profile_description||a)&&i.jsxs("div",{className:"space-y-2 p-4 bg-bambu-dark rounded-lg",children:[i.jsx("h4",{className:"text-sm font-medium text-bambu-gray uppercase tracking-wide",children:"Print Profile"}),a?i.jsxs("div",{className:"space-y-2",children:[i.jsx("input",{type:"text",value:c.profile_title||"",onChange:C=>d({...c,profile_title:C.target.value}),placeholder:"Profile Title",className:"w-full bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded px-3 py-2 text-white"}),i.jsx(xF,{content:c.profile_description||"",onChange:C=>d({...c,profile_description:C}),placeholder:"Profile description..."})]}):i.jsxs(i.Fragment,{children:[u.profile_title&&i.jsx("p",{className:"text-white font-medium",children:u.profile_title}),u.profile_description&&i.jsx("div",{className:"prose prose-invert prose-sm max-w-none text-bambu-gray-light",dangerouslySetInnerHTML:{__html:_(u.profile_description)}}),u.profile_user_name&&i.jsxs("p",{className:"text-sm text-bambu-gray",children:["by ",u.profile_user_name]})]})]}),y.length>0&&i.jsxs("div",{className:"space-y-2",children:[i.jsxs("h4",{className:"text-sm font-medium text-bambu-gray uppercase tracking-wide flex items-center gap-2",children:[i.jsx(ou,{className:"w-4 h-4"}),"Images (",y.length,")"]}),i.jsx("div",{className:"grid grid-cols-3 sm:grid-cols-4 md:grid-cols-5 gap-2",children:y.map((C,T)=>i.jsx("button",{onClick:()=>l(T),className:"aspect-square rounded-lg overflow-hidden border border-bambu-dark-tertiary hover:border-bambu-green transition-colors",children:i.jsx("img",{src:C.url,alt:C.name,className:"w-full h-full object-cover"})},C.path))})]}),u.design_model_id&&i.jsx("div",{className:"pt-4 border-t border-bambu-dark-tertiary",children:i.jsxs("a",{href:`https://makerworld.com/en/models/${u.design_model_id}`,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 text-bambu-green hover:underline",children:[i.jsx(ei,{className:"w-4 h-4"}),"View on MakerWorld"]})})]})]})]}),o!==null&&y[o]&&i.jsxs("div",{className:"fixed inset-0 bg-black/90 flex items-center justify-center z-60",onClick:()=>l(null),children:[i.jsx("button",{onClick:C=>{C.stopPropagation(),l(Math.max(0,o-1))},disabled:o===0,className:"absolute left-4 p-2 bg-bambu-dark-secondary rounded-full hover:bg-bambu-dark-tertiary disabled:opacity-30",children:i.jsx(ec,{className:"w-6 h-6 text-white"})}),i.jsx("img",{src:y[o].url,alt:y[o].name,className:"max-w-[90vw] max-h-[90vh] object-contain",onClick:C=>C.stopPropagation()}),i.jsx("button",{onClick:C=>{C.stopPropagation(),l(Math.min(y.length-1,o+1))},disabled:o===y.length-1,className:"absolute right-4 p-2 bg-bambu-dark-secondary rounded-full hover:bg-bambu-dark-tertiary disabled:opacity-30",children:i.jsx(pa,{className:"w-6 h-6 text-white"})}),i.jsx("button",{onClick:()=>l(null),className:"absolute top-4 right-4 p-2 bg-bambu-dark-secondary rounded-full hover:bg-bambu-dark-tertiary",children:i.jsx(zt,{className:"w-6 h-6 text-white"})}),i.jsxs("div",{className:"absolute bottom-4 text-white text-sm",children:[o+1," / ",y.length]})]})]})}const IXe=[.25,.5,.75,1,1.5,2,3,4];function zXe({archiveId:t,timelapseSrc:e,onClose:n,onSave:r}){const{showToast:a}=bn(),s=w.useRef(null),o=w.useRef(null),[l,c]=w.useState(!1),[d,u]=w.useState(0),[m,p]=w.useState(0),[f,y]=w.useState(0),[x,b]=w.useState(0),[v,_]=w.useState(1),[k,P]=w.useState(null),[C,T]=w.useState(null),[N,R]=w.useState(.8),[A,D]=w.useState(!1),{data:$,isLoading:U}=Je({queryKey:["timelapse-info",t],queryFn:()=>be.getTimelapseInfo(t)}),{data:G}=Je({queryKey:["timelapse-thumbnails",t],queryFn:()=>be.getTimelapseThumbnails(t,15)}),L=ut({mutationFn:()=>be.processTimelapse(t,{trimStart:f,trimEnd:x,speed:v,saveMode:"replace"},k||void 0),onSuccess:X=>{a(X.message,"success"),r?.(),n()},onError:X=>{a(X.message||"Processing failed","error")}});w.useEffect(()=>{$?.duration&&x===0&&b($.duration)},[$?.duration,x]),w.useEffect(()=>{const X=ie=>{ie.key==="Escape"&&n()};return window.addEventListener("keydown",X),()=>window.removeEventListener("keydown",X)},[n]),w.useEffect(()=>{const X=s.current;if(!X)return;const ie=()=>{const q=X.currentTime;u(q),q>=x&&(X.currentTime=f)},le=()=>{p(X.duration),x===0&&b(X.duration)},pe=()=>c(!0),Ce=()=>c(!1);return X.addEventListener("timeupdate",ie),X.addEventListener("durationchange",le),X.addEventListener("play",pe),X.addEventListener("pause",Ce),()=>{X.removeEventListener("timeupdate",ie),X.removeEventListener("durationchange",le),X.removeEventListener("play",pe),X.removeEventListener("pause",Ce)}},[f,x]),w.useEffect(()=>{const X=o.current,ie=s.current;!X||!ie||!C||(X.currentTime=ie.currentTime,X.playbackRate=ie.playbackRate,l&&!A?X.play().catch(()=>{}):X.pause())},[l,C,A]),w.useEffect(()=>{o.current&&(o.current.volume=A?0:N)},[N,A]),w.useEffect(()=>{s.current&&(s.current.playbackRate=v),o.current&&(o.current.playbackRate=v)},[v]);const te=w.useCallback(()=>{const X=s.current;X&&(l?X.pause():(X.currentTime<f&&(X.currentTime=f),X.play()))},[l,f]),re=X=>{const ie=s.current;ie&&(ie.currentTime=Math.max(f,Math.min(x,X)))},J=X=>{const ie=X.target.files?.[0];ie&&(C&&URL.revokeObjectURL(C),P(ie),T(URL.createObjectURL(ie)))},ue=()=>{C&&URL.revokeObjectURL(C),P(null),T(null)};w.useEffect(()=>()=>{C&&URL.revokeObjectURL(C)},[C]);const me=x-f,ge=me/v;return U?i.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/80",children:i.jsxs("div",{className:"flex items-center gap-3 text-white",children:[i.jsx(ct,{className:"w-6 h-6 animate-spin"}),"Loading video info..."]})}):i.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/80",children:i.jsxs("div",{className:"relative bg-bambu-dark-secondary rounded-xl max-w-5xl w-full mx-4 max-h-[90vh] overflow-hidden flex flex-col",children:[i.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-bambu-dark-tertiary shrink-0",children:[i.jsxs("h3",{className:"text-lg font-semibold text-white flex items-center gap-2",children:[i.jsx(Hm,{className:"w-5 h-5 text-bambu-green"}),"Edit Timelapse"]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(Fe,{variant:"primary",size:"sm",onClick:()=>L.mutate(),disabled:L.isPending,children:L.isPending?i.jsxs(i.Fragment,{children:[i.jsx(ct,{className:"w-4 h-4 animate-spin"}),"Processing..."]}):i.jsxs(i.Fragment,{children:[i.jsx(ps,{className:"w-4 h-4"}),"Save"]})}),i.jsx("button",{onClick:n,className:"p-1 hover:bg-bambu-dark-tertiary rounded transition-colors",children:i.jsx(zt,{className:"w-5 h-5 text-bambu-gray"})})]})]}),i.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",children:[i.jsxs("div",{className:"relative",children:[i.jsx("video",{ref:s,src:e,className:"w-full rounded-lg bg-black",onClick:te,muted:!!C}),!l&&i.jsx("button",{onClick:te,className:"absolute inset-0 flex items-center justify-center bg-black/30 hover:bg-black/40 transition-colors",children:i.jsx("div",{className:"p-4 bg-bambu-green rounded-full",children:i.jsx(co,{className:"w-8 h-8 text-white"})})}),C&&i.jsx("audio",{ref:o,src:C,loop:!0})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex items-center gap-2 text-sm text-bambu-gray",children:[i.jsx(Vfe,{className:"w-4 h-4"}),i.jsx("span",{children:"Trim"}),i.jsxs("span",{className:"ml-auto",children:[hm(f)," - ",hm(x)," (",hm(me),")"]})]}),i.jsxs("div",{className:"relative h-16 bg-bambu-dark rounded-lg overflow-hidden",children:[i.jsx("div",{className:"absolute inset-0 flex",children:G?.thumbnails.map((X,ie)=>i.jsx("div",{className:"flex-1 bg-cover bg-center",style:{backgroundImage:`url(data:image/jpeg;base64,${X})`}},ie))}),i.jsx("div",{className:"absolute inset-y-0 left-0 bg-black/60",style:{width:`${f/m*100}%`}}),i.jsx("div",{className:"absolute inset-y-0 right-0 bg-black/60",style:{width:`${(m-x)/m*100}%`}}),i.jsx("div",{className:"absolute inset-y-0 border-2 border-bambu-green",style:{left:`${f/m*100}%`,right:`${(m-x)/m*100}%`}}),i.jsx("div",{className:"absolute top-0 bottom-0 w-0.5 bg-white shadow-lg",style:{left:`${d/m*100}%`}}),i.jsx("input",{type:"range",min:0,max:m,step:.1,value:f,onChange:X=>{const ie=parseFloat(X.target.value);ie<x-1&&(y(ie),s.current&&s.current.currentTime<ie&&(s.current.currentTime=ie))},className:"absolute inset-0 w-full opacity-0 cursor-ew-resize",style:{clipPath:"inset(0 50% 0 0)"}}),i.jsx("input",{type:"range",min:0,max:m,step:.1,value:x,onChange:X=>{const ie=parseFloat(X.target.value);ie>f+1&&b(ie)},className:"absolute inset-0 w-full opacity-0 cursor-ew-resize",style:{clipPath:"inset(0 0 0 50%)"}})]}),i.jsx("input",{type:"range",min:0,max:m,step:.1,value:d,onChange:X=>re(parseFloat(X.target.value)),className:`w-full h-1 bg-bambu-dark-tertiary rounded-lg appearance-none cursor-pointer
- [&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-3 [&::-webkit-slider-thumb]:h-3
- [&::-webkit-slider-thumb]:bg-bambu-green [&::-webkit-slider-thumb]:rounded-full
- [&::-webkit-slider-thumb]:cursor-pointer`}),i.jsx("div",{className:"flex items-center justify-center gap-2",children:i.jsx("button",{onClick:te,className:"p-2 bg-bambu-green hover:bg-bambu-green-dark rounded-lg transition-colors",children:l?i.jsx(pC,{className:"w-5 h-5 text-white"}):i.jsx(co,{className:"w-5 h-5 text-white"})})})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex items-center gap-2 text-sm text-bambu-gray",children:[i.jsx(uC,{className:"w-4 h-4"}),i.jsx("span",{children:"Speed"}),i.jsxs("span",{className:"ml-auto",children:[v,"x (output: ",hm(ge),")"]})]}),i.jsx("div",{className:"flex gap-1",children:IXe.map(X=>i.jsxs("button",{onClick:()=>_(X),className:`flex-1 px-2 py-2 text-sm rounded transition-colors ${v===X?"bg-bambu-green text-white":"bg-bambu-dark text-bambu-gray hover:bg-bambu-dark-tertiary"}`,children:[X,"x"]},X))})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex items-center gap-2 text-sm text-bambu-gray",children:[i.jsx(PD,{className:"w-4 h-4"}),i.jsx("span",{children:"Music Overlay"})]}),k?i.jsxs("div",{className:"flex items-center gap-3 p-3 bg-bambu-dark rounded-lg",children:[i.jsx(PD,{className:"w-5 h-5 text-bambu-green"}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsx("p",{className:"text-sm text-white truncate",children:k.name}),i.jsxs("p",{className:"text-xs text-bambu-gray",children:[(k.size/1024/1024).toFixed(1)," MB"]})]}),i.jsx("button",{onClick:()=>D(!A),className:"p-2 hover:bg-bambu-dark-tertiary rounded transition-colors",children:A?i.jsx(Bge,{className:"w-4 h-4 text-bambu-gray"}):i.jsx(zge,{className:"w-4 h-4 text-bambu-green"})}),i.jsx("input",{type:"range",min:0,max:1,step:.1,value:N,onChange:X=>R(parseFloat(X.target.value)),className:`w-20 h-1 bg-bambu-dark-tertiary rounded-lg appearance-none cursor-pointer
- [&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-3 [&::-webkit-slider-thumb]:h-3
- [&::-webkit-slider-thumb]:bg-bambu-green [&::-webkit-slider-thumb]:rounded-full`}),i.jsx("button",{onClick:ue,className:"p-2 hover:bg-red-500/20 rounded transition-colors",children:i.jsx(Qt,{className:"w-4 h-4 text-red-400"})})]}):i.jsxs("label",{className:"flex flex-col items-center justify-center gap-2 p-6 border-2 border-dashed border-bambu-dark-tertiary rounded-lg cursor-pointer hover:border-bambu-green/50 transition-colors",children:[i.jsx(Si,{className:"w-8 h-8 text-bambu-gray"}),i.jsx("span",{className:"text-sm text-bambu-gray",children:"Drop audio file or click to upload"}),i.jsx("span",{className:"text-xs text-bambu-gray/60",children:"MP3, WAV, M4A, AAC, OGG"}),i.jsx("input",{type:"file",accept:".mp3,.wav,.m4a,.aac,.ogg,audio/*",onChange:J,className:"hidden"})]})]}),i.jsxs("div",{className:"p-3 bg-bambu-dark rounded-lg text-sm space-y-1",children:[i.jsxs("p",{className:"text-bambu-gray",children:[i.jsx("span",{className:"text-white",children:"Original:"})," ",hm(m)," @ ",$?.width,"x",$?.height]}),i.jsxs("p",{className:"text-bambu-gray",children:[i.jsx("span",{className:"text-white",children:"Output:"})," ",hm(ge)," @ ",v,"x speed",k&&" + music overlay"]})]})]}),L.isPending&&i.jsxs("div",{className:"absolute inset-0 bg-black/80 flex flex-col items-center justify-center gap-4",children:[i.jsx(ct,{className:"w-12 h-12 text-bambu-green animate-spin"}),i.jsx("p",{className:"text-white text-lg",children:"Processing timelapse..."}),i.jsx("p",{className:"text-bambu-gray text-sm",children:"This may take a few moments"})]})]})})}const UXe=[.25,.5,.75,1,1.5,2,3,4];function ese({src:t,title:e,downloadFilename:n,archiveId:r,onClose:a,onEdit:s}){const o=w.useRef(null),[l,c]=w.useState(!0),[d,u]=w.useState(1),[m,p]=w.useState(0),[f,y]=w.useState(0),[x,b]=w.useState(!1);w.useEffect(()=>{const T=o.current;T&&(T.playbackRate=d)},[d]),w.useEffect(()=>{const T=N=>{N.key==="Escape"&&a()};return window.addEventListener("keydown",T),()=>window.removeEventListener("keydown",T)},[a]),w.useEffect(()=>{const T=o.current;if(!T)return;const N=()=>p(T.currentTime),R=()=>y(T.duration),A=()=>c(!0),D=()=>c(!1);return T.addEventListener("timeupdate",N),T.addEventListener("durationchange",R),T.addEventListener("play",A),T.addEventListener("pause",D),()=>{T.removeEventListener("timeupdate",N),T.removeEventListener("durationchange",R),T.removeEventListener("play",A),T.removeEventListener("pause",D)}},[]);const v=()=>{const T=o.current;T&&(l?T.pause():T.play())},_=T=>{const N=o.current;N&&(N.currentTime=parseFloat(T.target.value))},k=()=>{const T=o.current;T&&(T.currentTime=Math.max(0,T.currentTime-5))},P=()=>{const T=o.current;T&&(T.currentTime=Math.min(f,T.currentTime+5))},C=()=>{const T=document.createElement("a");T.href=t,T.download=n,T.click()};return i.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/80",children:[i.jsxs("div",{className:"relative bg-bambu-dark-secondary rounded-xl max-w-4xl w-full mx-4 overflow-hidden",children:[i.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-bambu-dark-tertiary",children:[i.jsxs("h3",{className:"text-lg font-semibold text-white flex items-center gap-2",children:[i.jsx(Hm,{className:"w-5 h-5 text-bambu-green"}),e]}),i.jsxs("div",{className:"flex items-center gap-2",children:[r&&i.jsxs(Fe,{variant:"secondary",size:"sm",onClick:()=>b(!0),children:[i.jsx(Wi,{className:"w-4 h-4"}),"Edit"]}),i.jsxs(Fe,{variant:"secondary",size:"sm",onClick:C,children:[i.jsx(pi,{className:"w-4 h-4"}),"Download"]}),i.jsx("button",{onClick:a,className:"p-1 hover:bg-bambu-dark-tertiary rounded transition-colors",children:i.jsx(zt,{className:"w-5 h-5 text-bambu-gray"})})]})]}),i.jsxs("div",{className:"p-4",children:[i.jsx("video",{ref:o,src:t,autoPlay:!0,className:"w-full rounded-lg",onClick:v}),i.jsxs("div",{className:"mt-4 space-y-3",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("span",{className:"text-xs text-bambu-gray w-12 text-right",children:hm(m)}),i.jsx("input",{type:"range",min:0,max:f||100,value:m,onChange:_,className:`flex-1 h-1 bg-bambu-dark-tertiary rounded-lg appearance-none cursor-pointer
- [&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-3 [&::-webkit-slider-thumb]:h-3
- [&::-webkit-slider-thumb]:bg-bambu-green [&::-webkit-slider-thumb]:rounded-full
- [&::-webkit-slider-thumb]:cursor-pointer`}),i.jsx("span",{className:"text-xs text-bambu-gray w-12",children:hm(f)})]}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("button",{onClick:k,className:"p-2 hover:bg-bambu-dark-tertiary rounded-lg transition-colors",title:"Skip back 5s",children:i.jsx(rge,{className:"w-5 h-5 text-bambu-gray"})}),i.jsx("button",{onClick:v,className:"p-2 bg-bambu-green hover:bg-bambu-green-dark rounded-lg transition-colors",children:l?i.jsx(pC,{className:"w-5 h-5 text-white"}):i.jsx(co,{className:"w-5 h-5 text-white"})}),i.jsx("button",{onClick:P,className:"p-2 hover:bg-bambu-dark-tertiary rounded-lg transition-colors",title:"Skip forward 5s",children:i.jsx(YF,{className:"w-5 h-5 text-bambu-gray"})})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"text-sm text-bambu-gray",children:"Speed:"}),i.jsx("div",{className:"flex gap-1",children:UXe.map(T=>i.jsxs("button",{onClick:()=>u(T),className:`px-2 py-1 text-xs rounded transition-colors ${d===T?"bg-bambu-green text-white":"bg-bambu-dark-tertiary text-bambu-gray hover:bg-bambu-dark-tertiary/80"}`,children:[T,"x"]},T))})]})]})]})]})]}),x&&r&&i.jsx(zXe,{archiveId:r,timelapseSrc:t,onClose:()=>b(!1),onSave:s})]})}function BXe({archiveIds:t,onClose:e}){w.useEffect(()=>{const s=o=>{o.key==="Escape"&&e()};return window.addEventListener("keydown",s),()=>window.removeEventListener("keydown",s)},[e]);const{data:n,isLoading:r,error:a}=Je({queryKey:["archive-comparison",t],queryFn:()=>be.compareArchives(t)});return i.jsx("div",{className:"fixed inset-0 bg-black/80 flex items-center justify-center z-50 p-4",onClick:e,children:i.jsxs("div",{className:"bg-bambu-dark-secondary rounded-lg max-w-4xl w-full max-h-[90vh] flex flex-col border border-bambu-dark-tertiary",onClick:s=>s.stopPropagation(),children:[i.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-bambu-dark-tertiary",children:[i.jsxs("h3",{className:"text-lg font-semibold text-white",children:["Compare Archives (",t.length,")"]}),i.jsx("button",{onClick:e,className:"text-bambu-gray hover:text-white p-1",children:i.jsx(zt,{className:"w-5 h-5"})})]}),i.jsx("div",{className:"flex-1 overflow-auto p-4 bg-bambu-dark-secondary",children:r?i.jsx("div",{className:"flex items-center justify-center py-12",children:i.jsx(ct,{className:"w-8 h-8 text-bambu-green animate-spin"})}):a?i.jsxs("div",{className:"text-center py-12 text-red-400",children:[i.jsx(En,{className:"w-12 h-12 mx-auto mb-4 opacity-50"}),i.jsx("p",{children:"Failed to load comparison"}),i.jsx("p",{className:"text-sm text-bambu-gray mt-2",children:a instanceof Error?a.message:"Unknown error"})]}):n?i.jsx(HXe,{comparison:n}):null}),i.jsx("div",{className:"p-4 border-t border-bambu-dark-tertiary",children:i.jsx(Fe,{variant:"secondary",onClick:e,className:"w-full",children:"Close"})})]})})}function HXe({comparison:t}){return i.jsxs("div",{className:"space-y-6",children:[i.jsx("div",{className:"overflow-x-auto",children:i.jsxs("table",{className:"w-full",children:[i.jsx("thead",{children:i.jsxs("tr",{children:[i.jsx("th",{className:"text-left text-sm text-bambu-gray font-medium pb-2 pr-4 min-w-[150px]",children:"Setting"}),t.archives.map(e=>i.jsxs("th",{className:"text-left text-sm font-medium pb-2 px-2 min-w-[120px]",children:[i.jsx("div",{className:"text-white truncate max-w-[150px]",title:e.print_name,children:e.print_name}),i.jsx("div",{className:`text-xs ${e.status==="completed"?"text-status-ok":e.status==="failed"?"text-status-error":"text-bambu-gray"}`,children:e.status})]},e.id))]})}),i.jsx("tbody",{className:"divide-y divide-bambu-gray/20",children:t.comparison.map(e=>i.jsxs("tr",{className:e.has_difference?"bg-yellow-500/5":"",children:[i.jsx("td",{className:"py-2 pr-4 text-sm",children:i.jsxs("div",{className:"flex items-center gap-2",children:[e.has_difference&&i.jsx(En,{className:"w-3 h-3 text-yellow-400 flex-shrink-0"}),i.jsx("span",{className:e.has_difference?"text-yellow-400":"text-bambu-gray",children:e.label})]})}),e.values.map((n,r)=>i.jsxs("td",{className:"py-2 px-2 text-sm text-white",children:[n??i.jsx("span",{className:"text-bambu-gray/50",children:"-"}),e.unit&&n!==null&&i.jsx("span",{className:"text-bambu-gray ml-1",children:e.unit})]},r))]},e.field))})]})}),t.differences.length>0&&i.jsxs("div",{className:"p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[i.jsxs("h4",{className:"text-sm font-medium text-yellow-400 mb-2 flex items-center gap-2",children:[i.jsx(En,{className:"w-4 h-4"}),t.differences.length," Difference",t.differences.length>1?"s":""," Found"]}),i.jsxs("ul",{className:"text-sm text-white/80 space-y-1",children:[t.differences.slice(0,5).map(e=>i.jsxs("li",{children:[i.jsx("span",{className:"text-yellow-400",children:e.label}),": ",e.values.join(" vs ")," ",e.unit||""]},e.field)),t.differences.length>5&&i.jsxs("li",{className:"text-bambu-gray",children:["...and ",t.differences.length-5," more"]})]})]}),t.success_correlation.has_both_outcomes?i.jsxs("div",{className:"p-4 bg-bambu-dark rounded-lg",children:[i.jsxs("h4",{className:"text-sm font-medium text-white mb-3 flex items-center gap-2",children:[i.jsx(Vr,{className:"w-4 h-4 text-bambu-green"}),"Success/Failure Analysis"]}),i.jsxs("div",{className:"flex items-center gap-4 text-sm mb-3",children:[i.jsxs("span",{className:"text-bambu-green",children:[t.success_correlation.successful_count," successful"]}),i.jsxs("span",{className:"text-red-400",children:[t.success_correlation.failed_count," failed"]})]}),t.success_correlation.insights&&t.success_correlation.insights.length>0?i.jsx("div",{className:"space-y-2",children:t.success_correlation.insights.map(e=>i.jsxs("div",{className:"text-sm p-2 bg-bambu-dark-secondary rounded",children:[i.jsxs("span",{className:"text-white font-medium",children:[e.label,":"]})," ",i.jsx("span",{className:"text-white/80",children:e.insight})]},e.field))}):i.jsx("p",{className:"text-sm text-bambu-gray",children:"No clear correlations found between settings and outcomes."})]}):i.jsx("div",{className:"p-4 bg-bambu-dark rounded-lg text-sm text-bambu-gray",children:i.jsx("p",{children:t.success_correlation.message||"Need both successful and failed prints for correlation analysis."})})]})}function $Xe(t){const e=new Date(t),r=new Date().getTime()-e.getTime(),a=Math.floor(r/6e4);if(a<1)return"Just now";if(a<60)return`${a}m ago`;const s=Math.floor(a/60);return s<24?`${s}h ago`:`${Math.floor(s/24)}d ago`}function qXe({upload:t,projects:e,onArchive:n,onDiscard:r,isArchiving:a,isDiscarding:s}){const[o,l]=w.useState(!1),[c,d]=w.useState(t.tags||""),[u,m]=w.useState(t.notes||""),[p,f]=w.useState(t.project_id),[y,x]=w.useState(!1);return i.jsx(Tt,{children:i.jsxs(Pt,{className:"py-3",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(Cp,{className:"w-8 h-8 text-bambu-green flex-shrink-0"}),i.jsxs("div",{children:[i.jsx("p",{className:"text-white font-medium",children:t.filename}),i.jsxs("div",{className:"flex items-center gap-2 text-xs text-bambu-gray",children:[i.jsx("span",{children:no(t.file_size)}),i.jsx("span",{children:"·"}),i.jsxs("span",{className:"flex items-center gap-1",children:[i.jsx(er,{className:"w-3 h-3"}),$Xe(t.uploaded_at)]}),t.source_ip&&i.jsxs(i.Fragment,{children:[i.jsx("span",{children:"·"}),i.jsxs("span",{children:["from ",t.source_ip]})]})]})]})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("button",{onClick:()=>l(!o),className:"p-1 text-bambu-gray hover:text-white transition-colors",children:o?i.jsx(vl,{className:"w-5 h-5"}):i.jsx(In,{className:"w-5 h-5"})}),i.jsx(Fe,{variant:"primary",size:"sm",onClick:()=>n(t.id,{tags:c,notes:u,project_id:p||void 0}),disabled:a,children:a?i.jsx(ct,{className:"w-4 h-4 animate-spin"}):i.jsxs(i.Fragment,{children:[i.jsx(Fs,{className:"w-4 h-4"}),"Archive"]})}),i.jsx(Fe,{variant:"secondary",size:"sm",onClick:()=>x(!0),disabled:s,children:s?i.jsx(ct,{className:"w-4 h-4 animate-spin"}):i.jsx(Qt,{className:"w-4 h-4 text-red-400"})})]})]}),y&&i.jsx(Nn,{title:"Discard Upload",message:`Are you sure you want to discard "${t.filename}"? This cannot be undone.`,confirmText:"Discard",variant:"danger",onConfirm:()=>{r(t.id),x(!1)},onCancel:()=>x(!1)}),o&&i.jsxs("div",{className:"mt-4 pt-4 border-t border-bambu-dark-tertiary space-y-3",children:[i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Tags"}),i.jsx("input",{type:"text",value:c,onChange:b=>d(b.target.value),placeholder:"e.g., functional, prototype, gift",className:"w-full bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-md px-3 py-2 text-white placeholder-bambu-gray text-sm"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Notes"}),i.jsx("textarea",{value:u,onChange:b=>m(b.target.value),placeholder:"Add notes about this print...",rows:2,className:"w-full bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-md px-3 py-2 text-white placeholder-bambu-gray text-sm resize-none"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Project"}),i.jsxs("select",{value:p||"",onChange:b=>f(b.target.value?Number(b.target.value):null),className:"w-full bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-md px-3 py-2 text-white text-sm",children:[i.jsx("option",{value:"",children:"No project"}),e.map(b=>i.jsx("option",{value:b.id,children:b.name},b.id))]})]})]})]})})}function VXe(){const t=tn(),{showToast:e}=bn(),[n,r]=w.useState(!1),[a,s]=w.useState(!1),[o,l]=w.useState(new Set),[c,d]=w.useState(new Set),{data:u,isLoading:m}=Je({queryKey:["pending-uploads"],queryFn:Xg.list,refetchInterval:1e4}),{data:p}=Je({queryKey:["projects"],queryFn:()=>be.getProjects()}),f=ut({mutationFn:({id:v,data:_})=>Xg.archive(v,_),onMutate:({id:v})=>{l(_=>new Set(_).add(v))},onSettled:(v,_,{id:k})=>{l(P=>{const C=new Set(P);return C.delete(k),C})},onSuccess:v=>{t.invalidateQueries({queryKey:["pending-uploads"]}),t.invalidateQueries({queryKey:["archives"]}),e(`Archived: ${v.print_name}`)},onError:v=>{e(v.message||"Failed to archive","error")}}),y=ut({mutationFn:v=>Xg.discard(v),onMutate:v=>{d(_=>new Set(_).add(v))},onSettled:(v,_,k)=>{d(P=>{const C=new Set(P);return C.delete(k),C})},onSuccess:()=>{t.invalidateQueries({queryKey:["pending-uploads"]}),e("Upload discarded")},onError:v=>{e(v.message||"Failed to discard","error")}}),x=ut({mutationFn:Xg.archiveAll,onSuccess:v=>{t.invalidateQueries({queryKey:["pending-uploads"]}),t.invalidateQueries({queryKey:["archives"]}),e(`Archived ${v.archived} files${v.failed>0?`, ${v.failed} failed`:""}`)},onError:v=>{e(v.message||"Failed to archive all","error")}}),b=ut({mutationFn:Xg.discardAll,onSuccess:v=>{t.invalidateQueries({queryKey:["pending-uploads"]}),e(`Discarded ${v.discarded} files`)},onError:v=>{e(v.message||"Failed to discard all","error")}});return m?i.jsx(Tt,{children:i.jsx(Pt,{className:"py-8 flex justify-center",children:i.jsx(ct,{className:"w-6 h-6 animate-spin text-bambu-green"})})}):!u||u.length===0?null:i.jsxs("div",{className:"mb-6",children:[i.jsxs(Tt,{className:"border-l-4 border-l-yellow-500",children:[i.jsx(Wn,{children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(Si,{className:"w-5 h-5 text-yellow-500"}),i.jsxs("h2",{className:"text-lg font-semibold text-white",children:["Pending Uploads (",u.length,")"]})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(Fe,{variant:"primary",size:"sm",onClick:()=>r(!0),disabled:x.isPending,children:x.isPending?i.jsx(ct,{className:"w-4 h-4 animate-spin"}):i.jsxs(i.Fragment,{children:[i.jsx(Fs,{className:"w-4 h-4"}),"Archive All"]})}),i.jsx(Fe,{variant:"secondary",size:"sm",onClick:()=>s(!0),disabled:b.isPending,children:b.isPending?i.jsx(ct,{className:"w-4 h-4 animate-spin"}):i.jsxs(i.Fragment,{children:[i.jsx(Qt,{className:"w-4 h-4"}),"Discard All"]})})]})]})}),i.jsxs(Pt,{children:[i.jsx("p",{className:"text-sm text-bambu-gray mb-4",children:"These files were uploaded via the virtual printer. Review and archive them to add to your collection."}),i.jsx("div",{className:"space-y-3",children:u.map(v=>i.jsx(qXe,{upload:v,projects:p||[],onArchive:(_,k)=>f.mutate({id:_,data:k}),onDiscard:_=>y.mutate(_),isArchiving:o.has(v.id),isDiscarding:c.has(v.id)},v.id))})]})]}),n&&i.jsx(Nn,{title:"Archive All Uploads",message:`Are you sure you want to archive all ${u.length} pending uploads?`,confirmText:"Archive All",onConfirm:()=>{x.mutate(),r(!1)},onCancel:()=>r(!1)}),a&&i.jsx(Nn,{title:"Discard All Uploads",message:`Are you sure you want to discard all ${u.length} pending uploads? This cannot be undone.`,confirmText:"Discard All",variant:"danger",onConfirm:()=>{b.mutate(),s(!1)},onCancel:()=>s(!1)})]})}function GXe({onClose:t}){const e=tn(),{showToast:n}=bn(),[r,a]=w.useState(""),[s,o]=w.useState(null),[l,c]=w.useState(""),[d,u]=w.useState(null),[m,p]=w.useState("count");w.useEffect(()=>{const A=D=>{D.key==="Escape"&&(s?o(null):d?u(null):t())};return window.addEventListener("keydown",A),()=>window.removeEventListener("keydown",A)},[t,s,d]);const{data:f,isLoading:y}=Je({queryKey:["tags"],queryFn:be.getTags}),x=ut({mutationFn:({oldName:A,newName:D})=>be.renameTag(A,D),onSuccess:(A,{oldName:D,newName:$})=>{e.invalidateQueries({queryKey:["tags"]}),e.invalidateQueries({queryKey:["archives"]}),n(`Renamed "${D}" to "${$}" in ${A.affected} archive${A.affected!==1?"s":""}`),o(null)},onError:A=>{n(A.message||"Failed to rename tag","error")}}),b=ut({mutationFn:A=>be.deleteTag(A),onSuccess:(A,D)=>{e.invalidateQueries({queryKey:["tags"]}),e.invalidateQueries({queryKey:["archives"]}),n(`Deleted "${D}" from ${A.affected} archive${A.affected!==1?"s":""}`),u(null)},onError:A=>{n(A.message||"Failed to delete tag","error")}}),v=A=>{o(A.name),c(A.name),u(null)},_=()=>{o(null),c("")},k=()=>{if(!s||!l.trim())return;const A=l.trim();if(A===s){_();return}x.mutate({oldName:s,newName:A})},P=A=>{A.key==="Enter"?(A.preventDefault(),k()):A.key==="Escape"&&(A.preventDefault(),_())},C=A=>{u(A),o(null)},T=()=>{d&&b.mutate(d)},N=f?.filter(A=>A.name.toLowerCase().includes(r.toLowerCase())).sort((A,D)=>m==="count"&&D.count-A.count||A.name.localeCompare(D.name)),R=f?.reduce((A,D)=>A+D.count,0)||0;return i.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",children:i.jsx(Tt,{className:"w-full max-w-lg max-h-[80vh] flex flex-col",children:i.jsxs(Pt,{className:"p-0 flex flex-col min-h-0",children:[i.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-bambu-dark-tertiary flex-shrink-0",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(cu,{className:"w-5 h-5 text-bambu-green"}),i.jsx("h2",{className:"text-xl font-semibold text-white",children:"Manage Tags"})]}),i.jsx("button",{onClick:t,className:"text-bambu-gray hover:text-white transition-colors",children:i.jsx(zt,{className:"w-5 h-5"})})]}),i.jsxs("div",{className:"p-4 border-b border-bambu-dark-tertiary flex-shrink-0",children:[i.jsxs("div",{className:"flex gap-2",children:[i.jsxs("div",{className:"relative flex-1",children:[i.jsx(Dr,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray"}),i.jsx("input",{type:"text",placeholder:"Search tags...",className:"w-full pl-9 pr-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:r,onChange:A=>a(A.target.value)})]}),i.jsxs("select",{className:"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:m,onChange:A=>p(A.target.value),children:[i.jsx("option",{value:"count",children:"Sort by Count"}),i.jsx("option",{value:"name",children:"Sort by Name"})]})]}),f&&i.jsxs("p",{className:"text-xs text-bambu-gray mt-2",children:[f.length," tag",f.length!==1?"s":""," across ",R," usage",R!==1?"s":""]})]}),i.jsx("div",{className:"flex-1 overflow-y-auto min-h-0 p-4",children:y?i.jsx("div",{className:"flex items-center justify-center py-8",children:i.jsx(ct,{className:"w-6 h-6 animate-spin text-bambu-gray"})}):N?.length?i.jsx("div",{className:"space-y-2",children:N.map(A=>i.jsx("div",{className:"flex items-center gap-2 p-2 rounded-lg bg-bambu-dark hover:bg-bambu-dark-tertiary transition-colors group",children:s===A.name?i.jsxs("div",{className:"flex-1 flex items-center gap-2",children:[i.jsx("input",{type:"text",className:"flex-1 px-2 py-1 bg-bambu-dark-tertiary border border-bambu-green rounded text-white text-sm focus:outline-none",value:l,onChange:D=>c(D.target.value),onKeyDown:P,autoFocus:!0}),i.jsx(Fe,{size:"sm",variant:"primary",onClick:k,disabled:!l.trim()||x.isPending,className:"p-1.5",children:x.isPending?i.jsx(ct,{className:"w-4 h-4 animate-spin"}):i.jsx(Vr,{className:"w-4 h-4"})}),i.jsx(Fe,{size:"sm",variant:"ghost",onClick:_,className:"p-1.5",children:i.jsx(zt,{className:"w-4 h-4"})})]}):d===A.name?i.jsxs("div",{className:"flex-1 flex items-center gap-2",children:[i.jsx(En,{className:"w-4 h-4 text-yellow-400 flex-shrink-0"}),i.jsxs("span",{className:"text-sm text-bambu-gray-light flex-1",children:['Delete "',A.name,'" from ',A.count," archive",A.count!==1?"s":"","?"]}),i.jsx(Fe,{size:"sm",variant:"danger",onClick:T,disabled:b.isPending,className:"p-1.5",children:b.isPending?i.jsx(ct,{className:"w-4 h-4 animate-spin"}):i.jsx(Qt,{className:"w-4 h-4"})}),i.jsx(Fe,{size:"sm",variant:"ghost",onClick:()=>u(null),className:"p-1.5",children:i.jsx(zt,{className:"w-4 h-4"})})]}):i.jsxs(i.Fragment,{children:[i.jsx(cu,{className:"w-4 h-4 text-bambu-gray flex-shrink-0"}),i.jsx("span",{className:"text-white flex-1 truncate",children:A.name}),i.jsx("span",{className:"px-2 py-0.5 rounded-full bg-bambu-dark-tertiary text-bambu-gray text-xs",children:A.count}),i.jsxs("div",{className:"flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[i.jsx("button",{onClick:()=>v(A),className:"p-1.5 rounded hover:bg-bambu-dark text-bambu-gray hover:text-white transition-colors",title:"Rename tag",children:i.jsx(Wi,{className:"w-4 h-4"})}),i.jsx("button",{onClick:()=>C(A.name),className:"p-1.5 rounded hover:bg-bambu-dark text-bambu-gray hover:text-red-400 transition-colors",title:"Delete tag",children:i.jsx(Qt,{className:"w-4 h-4"})})]})]})},A.name))}):i.jsx("div",{className:"text-center py-8 text-bambu-gray",children:r?"No tags match your search":"No tags found"})}),i.jsx("div",{className:"flex gap-3 p-4 border-t border-bambu-dark-tertiary flex-shrink-0",children:i.jsx(Fe,{variant:"secondary",onClick:t,className:"flex-1",children:"Close"})})]})})})}function Tm(t){const e=t.filename;if(e){const n=e.toLowerCase();if(n.endsWith(".gcode")||n.includes(".gcode."))return!0}return!!(t.total_layers||t.print_time_seconds)}function tse(t){if(!t)return;const e=t.toLowerCase();return e.endsWith(".3mf")?"3mf":e.endsWith(".stl")?"stl":e.endsWith(".gcode")||e.includes(".gcode.")?"gcode":e.split(".").pop()}async function Pm(t,e,n,r){try{if(n==="source"){const{token:a}=await be.createSourceSlicerToken(t),s=be.getSourceSlicerDownloadUrl(t,a,e);wp(`${window.location.origin}${s}`,r)}else{const{token:a}=await be.createArchiveSlicerToken(t),s=be.getArchiveSlicerDownloadUrl(t,a,e);wp(`${window.location.origin}${s}`,r)}}catch{const a=n==="source"?be.getSource3mfForSlicer(t,e):be.getArchiveForSlicer(t,e);wp(`${window.location.origin}${a}`,r)}}function WXe({archive:t,printerName:e,isSelected:n,onSelect:r,selectionMode:a,projects:s,isHighlighted:o,timeFormat:l="system",preferredSlicer:c="bambu_studio",currency:d,t:u}){o&&console.log("ArchiveCard isHighlighted=true for archive:",t.id);const m=tn(),{showToast:p}=bn(),{hasPermission:f,canModify:y}=Rr(),x=are(),[b,v]=w.useState(!1),[_,k]=w.useState(!1),[P,C]=w.useState(!1),[T,N]=w.useState(!1),[R,A]=w.useState(!1),[D,$]=w.useState(!1),[U,G]=w.useState([]),[L,te]=w.useState(!1),[re,J]=w.useState(!1),[ue,me]=w.useState(!1),[ge,X]=w.useState(!1),[ie,le]=w.useState(!1),[pe,Ce]=w.useState(!1),[q,Z]=w.useState(!1),[j,E]=w.useState(null),[I,W]=w.useState(null),[B,ae]=w.useState(!1),z=w.useRef(null),V=w.useRef(null),ee=w.useRef(null),{data:K}=Je({queryKey:["archive-plates",t.id],queryFn:()=>be.getArchivePlates(t.id),enabled:B,staleTime:300*1e3}),ne=K?.plates??[],se=K?.is_multi_plate??!1,ce=I??0,fe=ut({mutationFn:()=>be.deleteArchiveTimelapse(t.id),onSuccess:()=>{m.invalidateQueries({queryKey:["archives"]}),p(u("archives.toast.timelapseRemoved"))},onError:ke=>{p(ke.message||u("archives.toast.failedRemoveTimelapse"),"error")}}),oe=ut({mutationFn:ke=>be.uploadArchiveTimelapse(t.id,ke),onSuccess:ke=>{m.invalidateQueries({queryKey:["archives"]}),p(u("archives.toast.timelapseUploaded",{filename:ke.filename}))},onError:ke=>{p(ke.message||u("archives.toast.failedUploadTimelapse"),"error")}}),O=ut({mutationFn:ke=>be.uploadSource3mf(t.id,ke),onSuccess:ke=>{m.invalidateQueries({queryKey:["archives"]}),p(u("archives.toast.source3mfAttached",{filename:ke.filename}))},onError:ke=>{p(ke.message||u("archives.toast.failedUploadSource3mf"),"error")}}),F=ut({mutationFn:()=>be.deleteSource3mf(t.id),onSuccess:()=>{m.invalidateQueries({queryKey:["archives"]}),p(u("archives.toast.source3mfRemoved"))},onError:ke=>{p(ke.message||u("archives.toast.failedRemoveSource3mf"),"error")}}),Q=ut({mutationFn:ke=>be.uploadF3d(t.id,ke),onSuccess:ke=>{m.invalidateQueries({queryKey:["archives"]}),p(u("archives.toast.f3dAttached",{filename:ke.filename}))},onError:ke=>{p(ke.message||u("archives.toast.failedUploadF3d"),"error")}}),ve=ut({mutationFn:()=>be.deleteF3d(t.id),onSuccess:()=>{m.invalidateQueries({queryKey:["archives"]}),p(u("archives.toast.f3dRemoved"))},onError:ke=>{p(ke.message||u("archives.toast.failedRemoveF3d"),"error")}}),he=ut({mutationFn:()=>be.scanArchiveTimelapse(t.id),onSuccess:ke=>{ke.status==="attached"?(m.invalidateQueries({queryKey:["archives"]}),p(u("archives.toast.timelapseAttached",{filename:ke.filename}))):ke.status==="exists"?p(u("archives.toast.timelapseAlreadyAttached")):ke.status==="not_found"&&ke.available_files&&ke.available_files.length>0?(G(ke.available_files),$(!0)):p(ke.message||u("archives.toast.noMatchingTimelapse"),"warning")},onError:ke=>{p(ke.message||u("archives.toast.failedScanTimelapse"),"error")}}),de=ut({mutationFn:ke=>be.selectArchiveTimelapse(t.id,ke),onSuccess:ke=>{m.invalidateQueries({queryKey:["archives"]}),p(u("archives.toast.timelapseAttached",{filename:ke.filename})),$(!1),G([])},onError:ke=>{p(ke.message||u("archives.toast.failedAttachTimelapse"),"error")}}),Ae=ut({mutationFn:()=>be.deleteArchive(t.id),onSuccess:()=>{m.invalidateQueries({queryKey:["archives"]}),p(u("archives.toast.archiveDeleted"))},onError:()=>{p(u("archives.toast.failedDeleteArchive"),"error")}}),_e=ut({mutationFn:()=>be.toggleFavorite(t.id),onSuccess:ke=>{m.invalidateQueries({queryKey:["archives"]}),p(ke.is_favorite?u("archives.toast.addedToFavorites"):u("archives.toast.removedFromFavorites"))}}),{data:ze}=Je({queryKey:["archive-folders",t.id],queryFn:()=>be.getLibraryFoldersByArchive(t.id)}),Be=ut({mutationFn:ke=>be.updateArchive(t.id,{project_id:ke}),onSuccess:()=>{m.invalidateQueries({queryKey:["archives"]}),m.invalidateQueries({queryKey:["projects"]}),p(u("archives.toast.projectUpdated"))},onError:()=>{p(u("archives.toast.failedUpdateProject"),"error")}}),Ue=ke=>{ke.preventDefault(),E({x:ke.clientX,y:ke.clientY})},Ee=[...Tm(t)?[{label:u("archives.menu.print"),icon:i.jsx(kr,{className:"w-4 h-4"}),onClick:()=>k(!0),disabled:!t.file_path||!y("archives","reprint",t.created_by_id),title:t.file_path?y("archives","reprint",t.created_by_id)?void 0:u("archives.permission.noReprint"):u("archives.card.noFileForReprint")},{label:u("archives.menu.schedule"),icon:i.jsx(Xr,{className:"w-4 h-4"}),onClick:()=>X(!0),disabled:!t.file_path||!f("queue:create"),title:t.file_path?f("queue:create")?void 0:u("archives.permission.noAddToQueue"):u("archives.card.noFileForReprint")},{label:u("archives.menu.openInBambuStudio"),icon:i.jsx(ei,{className:"w-4 h-4"}),onClick:()=>{const ke=t.print_name||t.filename||"model";Pm(t.id,ke,"file",c)},disabled:!t.file_path,title:t.file_path?void 0:u("archives.card.noFileForReprint")}]:[{label:u("archives.menu.slice"),icon:i.jsx(ei,{className:"w-4 h-4"}),onClick:()=>{const ke=t.print_name||t.filename||"model";Pm(t.id,ke,"file",c)}}],{label:t.external_url?u("archives.menu.externalLink"):u("archives.menu.viewOnMakerWorld"),icon:i.jsx($m,{className:"w-4 h-4"}),onClick:()=>{const ke=t.external_url||t.makerworld_url;ke&&window.open(ke,"_blank")},disabled:!t.external_url&&!t.makerworld_url},{label:"",divider:!0,onClick:()=>{}},{label:u("archives.menu.preview3d"),icon:i.jsx(ra,{className:"w-4 h-4"}),onClick:()=>v(!0)},{label:u("archives.menu.viewTimelapse"),icon:i.jsx(Hm,{className:"w-4 h-4"}),onClick:()=>A(!0),disabled:!t.timelapse_path},{label:u("archives.menu.scanForTimelapse"),icon:i.jsx(W1,{className:"w-4 h-4"}),onClick:()=>he.mutate(),disabled:!t.printer_id||!!t.timelapse_path||he.isPending||!y("archives","update",t.created_by_id),title:y("archives","update",t.created_by_id)?void 0:u("archives.permission.noUpdateArchives")},{label:u("archives.menu.uploadTimelapse"),icon:i.jsx(Si,{className:"w-4 h-4"}),onClick:()=>ee.current?.click(),disabled:!!t.timelapse_path||!y("archives","update",t.created_by_id),title:y("archives","update",t.created_by_id)?void 0:u("archives.permission.noUpdateArchives")},...t.timelapse_path?[{label:u("archives.menu.removeTimelapse"),icon:i.jsx(Qt,{className:"w-4 h-4"}),onClick:()=>Z(!0),danger:!0,disabled:!y("archives","update",t.created_by_id),title:y("archives","update",t.created_by_id)?void 0:u("archives.permission.noUpdateArchives")}]:[],{label:"",divider:!0,onClick:()=>{}},{label:t.source_3mf_path?u("archives.menu.downloadSource3mf"):u("archives.menu.uploadSource3mf"),icon:i.jsx($1,{className:"w-4 h-4"}),onClick:()=>{t.source_3mf_path?be.downloadSource3mf(t.id).catch(ke=>{console.error("Source 3MF download failed:",ke)}):z.current?.click()},disabled:!t.source_3mf_path&&!y("archives","update",t.created_by_id),title:!t.source_3mf_path&&!y("archives","update",t.created_by_id)?u("archives.permission.noUploadFiles"):void 0},...t.source_3mf_path?[{label:u("archives.menu.replaceSource3mf"),icon:i.jsx(Si,{className:"w-4 h-4"}),onClick:()=>z.current?.click(),disabled:!y("archives","update",t.created_by_id),title:y("archives","update",t.created_by_id)?void 0:u("archives.permission.noUpdateArchives")},{label:u("archives.menu.removeSource3mf"),icon:i.jsx(Qt,{className:"w-4 h-4"}),onClick:()=>le(!0),danger:!0,disabled:!y("archives","update",t.created_by_id),title:y("archives","update",t.created_by_id)?void 0:u("archives.permission.noUpdateArchives")}]:[],{label:t.f3d_path?u("archives.menu.replaceF3d"):u("archives.menu.uploadF3d"),icon:i.jsx(ra,{className:"w-4 h-4"}),onClick:()=>V.current?.click(),disabled:!y("archives","update",t.created_by_id),title:y("archives","update",t.created_by_id)?void 0:u("archives.permission.noUpdateArchives")},...t.f3d_path?[{label:u("archives.menu.downloadF3d"),icon:i.jsx(pi,{className:"w-4 h-4"}),onClick:()=>{be.downloadF3d(t.id).catch(ke=>{console.error("F3D download failed:",ke)})}},{label:u("archives.menu.removeF3d"),icon:i.jsx(Qt,{className:"w-4 h-4"}),onClick:()=>Ce(!0),danger:!0,disabled:!y("archives","update",t.created_by_id),title:y("archives","update",t.created_by_id)?void 0:u("archives.permission.noUpdateArchives")}]:[],{label:"",divider:!0,onClick:()=>{}},{label:u("archives.menu.download"),icon:i.jsx(pi,{className:"w-4 h-4"}),onClick:()=>{be.downloadArchive(t.id,`${t.print_name||t.filename}.3mf`).catch(ke=>{console.error("Archive download failed:",ke)})},disabled:!f("archives:read"),title:f("archives:read")?void 0:u("archives.permission.noDownload")},{label:u("archives.menu.copyDownloadLink"),icon:i.jsx(wl,{className:"w-4 h-4"}),onClick:()=>{const ke=`${window.location.origin}${be.getArchiveDownload(t.id)}`;navigator.clipboard.writeText(ke).then(()=>{p(u("archives.toast.linkCopied"))}).catch(()=>{p(u("archives.toast.failedCopyLink"),"error")})},disabled:!f("archives:read"),title:f("archives:read")?void 0:u("archives.permission.noCopyLink")},{label:u("archives.menu.qrCode"),icon:i.jsx(XY,{className:"w-4 h-4"}),onClick:()=>te(!0)},{label:t.photos?.length?u("archives.menu.viewPhotosCount",{count:t.photos.length}):u("archives.menu.viewPhotos"),icon:i.jsx(Mb,{className:"w-4 h-4"}),onClick:()=>J(!0),disabled:!t.photos?.length},{label:u("archives.menu.projectPage"),icon:i.jsx(Es,{className:"w-4 h-4"}),onClick:()=>me(!0)},{label:"",divider:!0,onClick:()=>{}},{label:t.is_favorite?u("archives.menu.removeFromFavorites"):u("archives.menu.addToFavorites"),icon:i.jsx(qp,{className:`w-4 h-4 ${t.is_favorite?"fill-yellow-400 text-yellow-400":""}`}),onClick:()=>_e.mutate(),disabled:!y("archives","update",t.created_by_id),title:y("archives","update",t.created_by_id)?void 0:u("archives.permission.noUpdateArchives")},{label:u("archives.menu.edit"),icon:i.jsx(Wi,{className:"w-4 h-4"}),onClick:()=>N(!0),disabled:!y("archives","update",t.created_by_id),title:y("archives","update",t.created_by_id)?void 0:u("archives.permission.noUpdateArchives")},...t.project_id&&t.project_name?[{label:u("archives.menu.goToProject",{name:t.project_name}),icon:i.jsx(fs,{className:"w-4 h-4 text-bambu-green"}),onClick:()=>window.location.href="/projects"}]:[],{label:u("archives.menu.addToProject"),icon:i.jsx(fs,{className:"w-4 h-4"}),onClick:()=>{},disabled:!y("archives","update",t.created_by_id),title:y("archives","update",t.created_by_id)?void 0:u("archives.permission.noUpdateArchives"),submenu:(()=>{const ke=[];if(t.project_id&&ke.push({label:u("archives.menu.removeFromProject"),icon:i.jsx(zt,{className:"w-4 h-4"}),onClick:()=>Be.mutate(null),disabled:!y("archives","update",t.created_by_id)}),!s)ke.push({label:u("archives.menu.loading"),icon:i.jsx(ct,{className:"w-4 h-4 animate-spin"}),onClick:()=>{},disabled:!0});else{const Me=s.filter(Ge=>Ge.status==="active");Me.length===0?ke.push({label:u("archives.menu.noProjectsAvailable"),icon:i.jsx(fs,{className:"w-4 h-4 opacity-50"}),onClick:()=>{},disabled:!0}):Me.forEach(Ge=>{ke.push({label:Ge.name,icon:i.jsx("div",{className:"w-3 h-3 rounded-full flex-shrink-0",style:{backgroundColor:Ge.color||"#888"}}),onClick:()=>Be.mutate(Ge.id),disabled:t.project_id===Ge.id||!y("archives","update",t.created_by_id)})})}return ke})()},{label:u(n?"archives.menu.deselect":"archives.menu.select"),icon:n?i.jsx(mo,{className:"w-4 h-4"}):i.jsx(Sl,{className:"w-4 h-4"}),onClick:()=>r(t.id)},{label:"",divider:!0,onClick:()=>{}},{label:u("archives.menu.delete"),icon:i.jsx(Qt,{className:"w-4 h-4"}),onClick:()=>C(!0),danger:!0,disabled:!y("archives","delete",t.created_by_id),title:y("archives","delete",t.created_by_id)?void 0:u("archives.permission.noDelete")}];return i.jsxs(Tt,{"data-archive-id":t.id,className:`relative flex flex-col group ${n?"ring-2 ring-bambu-green":""} ${a?"cursor-pointer":""}`,style:o?{outline:"4px solid #facc15",outlineOffset:"2px"}:void 0,onContextMenu:Ue,onClick:a?()=>r(t.id):void 0,children:[a&&i.jsx("button",{className:"absolute top-2 left-2 z-10 p-1 rounded bg-black/50 hover:bg-black/70 transition-colors",onClick:ke=>{ke.stopPropagation(),r(t.id)},children:n?i.jsx(mo,{className:"w-5 h-5 text-bambu-green"}):i.jsx(Sl,{className:"w-5 h-5 text-white"})}),i.jsxs("div",{className:"aspect-video bg-bambu-dark relative flex-shrink-0 overflow-hidden rounded-t-xl",onMouseEnter:()=>ae(!0),onMouseLeave:()=>ae(!1),children:[t.thumbnail_path?i.jsx("img",{src:I!==null&&ne.length>0?be.getArchivePlateThumbnail(t.id,ne[ce]?.index??0):be.getArchiveThumbnail(t.id),alt:t.print_name||t.filename,className:"w-full h-full object-cover"}):i.jsx("div",{className:"w-full h-full flex items-center justify-center",children:i.jsx(ou,{className:"w-12 h-12 text-bambu-dark-tertiary"})}),se&&ne.length>1&&i.jsxs(i.Fragment,{children:[i.jsx("button",{className:`absolute left-1 top-1/2 -translate-y-1/2 p-1 rounded-full bg-black/60 hover:bg-black/80 transition-all ${x?"opacity-100":"opacity-0 group-hover:opacity-100"}`,onClick:ke=>{ke.stopPropagation(),W(Me=>{const Ge=Me??0;return Ge>0?Ge-1:ne.length-1})},title:u("archives.card.previousPlate"),children:i.jsx(ec,{className:"w-4 h-4 text-white"})}),i.jsx("button",{className:`absolute right-1 top-1/2 -translate-y-1/2 p-1 rounded-full bg-black/60 hover:bg-black/80 transition-all ${x?"opacity-100":"opacity-0 group-hover:opacity-100"}`,onClick:ke=>{ke.stopPropagation(),W(Me=>{const Ge=Me??0;return Ge<ne.length-1?Ge+1:0})},title:u("archives.card.nextPlate"),children:i.jsx(pa,{className:"w-4 h-4 text-white"})}),i.jsx("div",{className:`absolute bottom-1 left-1/2 -translate-x-1/2 flex gap-1 px-2 py-1 rounded-full bg-black/50 transition-all ${x?"opacity-100":"opacity-0 group-hover:opacity-100"}`,children:ne.map((ke,Me)=>i.jsx("button",{className:`w-2 h-2 rounded-full transition-colors ${Me===ce?"bg-bambu-green":"bg-white/50 hover:bg-white/80"}`,onClick:Ge=>{Ge.stopPropagation(),W(Me)},title:ke.name||u("archives.card.plateNumber",{index:ke.index})},ke.index))})]}),i.jsx("button",{className:`absolute top-2 left-2 p-1.5 rounded bg-black/50 hover:bg-black/70 transition-all ${x?"opacity-100":"opacity-0 group-hover:opacity-100"} ${a?"left-10":""}`,onClick:ke=>{ke.stopPropagation();const Me=ke.currentTarget.getBoundingClientRect();E({x:Me.left,y:Me.bottom+4})},title:u("archives.card.moreOptions"),children:i.jsx(Bm,{className:"w-5 h-5 text-white"})}),i.jsx("button",{className:`absolute top-2 right-2 p-1 rounded transition-colors ${y("archives","update",t.created_by_id)?"bg-black/50 hover:bg-black/70":"bg-black/30 cursor-not-allowed"}`,onClick:ke=>{ke.stopPropagation(),y("archives","update",t.created_by_id)&&_e.mutate()},disabled:!y("archives","update",t.created_by_id),title:y("archives","update",t.created_by_id)?t.is_favorite?u("archives.card.removeFromFavorites"):u("archives.card.addToFavorites"):u("archives.permission.noUpdateArchives"),children:i.jsx(qp,{className:`w-5 h-5 ${t.is_favorite?"text-yellow-400 fill-yellow-400":"text-white"} ${y("archives","update",t.created_by_id)?"":"opacity-50"}`})}),(t.status==="failed"||t.status==="aborted")&&i.jsx("div",{className:"absolute top-2 left-12 px-2 py-1 rounded text-xs bg-status-error/80 text-white",children:t.status==="aborted"?u("archives.card.cancelled"):u("archives.card.failed")}),t.duplicate_count>0&&i.jsxs("div",{className:"absolute top-2 right-12 px-2 py-1 rounded text-xs bg-purple-500/80 text-white flex items-center gap-1",title:u("archives.card.duplicateTitle"),children:[i.jsx(wl,{className:"w-3 h-3"}),u("archives.card.duplicate")]}),t.source_3mf_path&&i.jsx("button",{className:"absolute bottom-2 left-2 p-1.5 rounded bg-black/60 hover:bg-black/80 transition-colors",onClick:ke=>{ke.stopPropagation();const Me=(t.print_name||t.filename||"source").replace(/\.gcode\.3mf$/i,"")+"_source";Pm(t.id,Me,"source",c)},title:u("archives.card.openSource3mf"),children:i.jsx($1,{className:"w-4 h-4 text-orange-400"})}),t.f3d_path&&i.jsx("button",{className:`absolute bottom-2 ${t.source_3mf_path?"left-12":"left-2"} p-1.5 rounded bg-black/60 hover:bg-black/80 transition-colors`,onClick:ke=>{ke.stopPropagation(),be.downloadF3d(t.id).catch(Me=>{console.error("F3D download failed:",Me)})},title:u("archives.card.downloadF3d"),children:i.jsx(ra,{className:"w-4 h-4 text-cyan-400"})}),i.jsx("button",{className:"absolute bottom-2 right-2 p-1.5 rounded bg-black/60 hover:bg-black/80 transition-colors",onClick:ke=>{ke.stopPropagation(),v(!0)},title:u("archives.card.preview3d"),children:i.jsx(Vi,{className:"w-4 h-4 text-white"})}),t.timelapse_path&&i.jsx("button",{className:"absolute bottom-2 right-12 p-1.5 rounded bg-black/60 hover:bg-black/80 transition-colors",onClick:ke=>{ke.stopPropagation(),A(!0)},title:u("archives.card.viewTimelapse"),children:i.jsx(Hm,{className:"w-4 h-4 text-bambu-green"})}),t.photos&&t.photos.length>0&&i.jsxs("button",{className:`absolute bottom-2 ${t.timelapse_path?"right-[5.5rem]":"right-12"} p-1.5 rounded bg-black/60 hover:bg-black/80 transition-colors`,onClick:ke=>{ke.stopPropagation(),J(!0)},title:t.photos.length===1?u("archives.card.viewPhoto"):u("archives.card.viewPhotos",{count:t.photos.length}),children:[i.jsx(Mb,{className:"w-4 h-4 text-blue-400"}),t.photos.length>1&&i.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})]}),ze&&ze.length>0&&i.jsx(Js,{to:`/files?folder=${ze[0].id}`,className:"absolute bottom-2 p-1.5 rounded bg-black/60 hover:bg-black/80 transition-colors",onClick:ke=>ke.stopPropagation(),title:u("archives.card.openFolder",{name:ze[0].name}),style:{left:t.source_3mf_path?t.f3d_path?"5.5rem":"3rem":t.f3d_path?"3rem":"0.5rem"},children:i.jsx(nc,{className:"w-4 h-4 text-yellow-400"})})]}),i.jsxs(Pt,{className:"p-4 flex-1 flex flex-col",children:[i.jsxs("div",{className:"flex items-center justify-between gap-2 mb-1",children:[i.jsx("h3",{className:"min-w-0 font-medium text-white truncate",children:t.print_name||t.filename}),i.jsx(Fe,{variant:"ghost",size:"sm",className:"p-1 sm:p-1.5 shrink-0",onClick:()=>N(!0),disabled:!y("archives","update",t.created_by_id),title:y("archives","update",t.created_by_id)?u("archives.card.edit"):u("archives.card.noPermissionEdit"),children:i.jsx(Wi,{className:"w-3 h-3 sm:w-4 sm:h-4"})})]}),i.jsxs("div",{className:"flex items-center gap-2 mb-3 flex-wrap",children:[i.jsx("p",{className:"text-xs text-bambu-gray",children:e}),i.jsx("span",{className:`text-[10px] px-1.5 py-0.5 rounded font-medium ${Tm(t)?"bg-bambu-green/20 text-bambu-green":"bg-orange-500/20 text-orange-400"}`,title:Tm(t)?u("archives.card.slicedFile"):u("archives.card.sourceFile"),children:Tm(t)?u("archives.card.gcode"):u("archives.card.source")}),t.project_name&&i.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded-full truncate max-w-[120px]",style:{backgroundColor:`${s?.find(ke=>ke.id===t.project_id)?.color||"#6b7280"}20`,color:s?.find(ke=>ke.id===t.project_id)?.color||"#6b7280"},title:u("archives.card.project",{name:t.project_name}),children:t.project_name})]}),i.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)&&i.jsxs("div",{className:"flex items-center gap-1.5 text-bambu-gray",title:t.time_accuracy?`Estimated: ${Ms(t.print_time_seconds||0)}
- Actual: ${Ms(t.actual_time_seconds||0)}
- Accuracy: ${t.time_accuracy.toFixed(0)}%`:t.actual_time_seconds?`Actual: ${Ms(t.actual_time_seconds)}`:`Estimated: ${Ms(t.print_time_seconds||0)}`,children:[i.jsx(er,{className:"w-3 h-3"}),Ms(t.actual_time_seconds||t.print_time_seconds||0),t.time_accuracy&&i.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&&i.jsxs("div",{className:"flex items-center gap-1.5 text-bambu-gray",children:[i.jsx(sa,{className:"w-3 h-3"}),t.filament_used_grams.toFixed(1),"g"]}),(t.cost!=null||t.energy_cost!=null)&&i.jsxs("div",{className:"flex items-center gap-3 text-bambu-gray",children:[t.cost!=null&&i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx(Che,{className:"w-3 h-3"}),d,t.cost.toFixed(2)]}),t.energy_cost!=null&&i.jsxs("div",{className:"flex items-center gap-1.5",title:`${u("stats.energyUsed")}: ${t.energy_kwh?.toFixed(3)||"N/A"} kWh`,children:[i.jsx(rc,{className:"w-3 h-3"}),d,t.energy_cost.toFixed(2)]})]}),(t.layer_height||t.total_layers)&&i.jsxs("div",{className:"flex items-center gap-1.5 text-bambu-gray",children:[i.jsx(Vi,{className:"w-3 h-3"}),t.total_layers&&i.jsx("span",{children:t.total_layers===1?u("archives.card.layer",{count:t.total_layers}):u("archives.card.layers",{count:t.total_layers})}),t.total_layers&&t.layer_height&&i.jsx("span",{className:"text-bambu-gray/50",children:"·"}),t.layer_height&&i.jsxs("span",{children:[t.layer_height,"mm"]})]}),t.object_count!=null&&t.object_count>0&&i.jsxs("div",{className:"flex items-center gap-1.5 text-bambu-gray",title:t.object_count===1?u("archives.card.object",{count:t.object_count}):u("archives.card.objects",{count:t.object_count}),children:[i.jsx(ra,{className:"w-3 h-3"}),t.object_count===1?u("archives.card.object",{count:t.object_count}):u("archives.card.objects",{count:t.object_count})]}),t.sliced_for_model&&i.jsxs("div",{className:"flex items-center gap-1.5 text-bambu-gray",title:u("archives.card.slicedFor",{model:t.sliced_for_model}),children:[i.jsx(kr,{className:"w-3 h-3"}),t.sliced_for_model]}),t.filament_type&&i.jsxs("div",{className:"flex items-center gap-1.5 col-span-2",children:[i.jsx("span",{className:"text-bambu-gray text-xs",children:t.filament_type}),t.filament_color&&i.jsx("div",{className:"flex items-center gap-0.5 flex-wrap",children:t.filament_color.split(",").map((ke,Me)=>i.jsx("div",{className:"w-3 h-3 rounded-full border border-white/20",style:{backgroundColor:ke},title:ke},Me))})]})]}),(t.tags||t.notes)&&i.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 mb-3",children:[t.notes&&i.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:i.jsx(JY,{className:"w-3 h-3"})}),t.tags?.split(",").map((ke,Me)=>i.jsx("span",{className:"px-1.5 py-0.5 bg-bambu-dark-tertiary text-bambu-gray-light rounded text-xs",children:ke.trim()},Me))]}),i.jsx("div",{className:"flex-1"}),i.jsxs("div",{className:"flex items-center justify-between text-xs text-bambu-gray border-t border-bambu-dark-tertiary pt-3",children:[i.jsx("span",{children:Wp(t.created_at,l)}),i.jsxs("div",{className:"flex items-center gap-2",children:[t.created_by_username&&i.jsxs("span",{className:"flex items-center gap-1",title:u("archives.card.uploadedBy",{name:t.created_by_username}),children:[i.jsx(du,{className:"w-3 h-3"}),t.created_by_username]}),i.jsx("span",{children:no(t.file_size)})]})]}),i.jsxs("div",{className:"flex gap-1 mt-3",children:[Tm(t)?i.jsxs(i.Fragment,{children:[i.jsxs(Fe,{variant:"primary",size:"sm",className:"flex-1 min-w-0 overflow-hidden",onClick:()=>k(!0),disabled:!t.file_path||!y("archives","reprint",t.created_by_id),title:t.file_path?y("archives","reprint",t.created_by_id)?void 0:u("archives.card.noPermissionReprint"):u("archives.card.noFileForReprint"),children:[i.jsx(kr,{className:"w-3 h-3 flex-shrink-0"}),i.jsx("span",{className:"hidden sm:inline truncate",children:u("archives.card.reprint")})]}),i.jsxs(Fe,{variant:"secondary",size:"sm",className:"flex-1 min-w-0 overflow-hidden",onClick:()=>X(!0),disabled:!t.file_path||!f("queue:create"),title:t.file_path?f("queue:create")?u("archives.card.schedulePrint"):u("archives.permission.noAddToQueue"):u("archives.card.noFileForReprint"),children:[i.jsx(Xr,{className:"w-3 h-3 flex-shrink-0"}),i.jsx("span",{className:"hidden sm:inline truncate",children:u("archives.card.schedule")})]}),i.jsx(Fe,{variant:"secondary",size:"sm",className:"min-w-0 p-1 sm:p-1.5",onClick:()=>{const ke=t.print_name||t.filename||"model";Pm(t.id,ke,"file",c)},title:u("archives.card.openInBambuStudio"),children:i.jsx(ei,{className:"w-3 h-3 sm:w-4 sm:h-4"})})]}):i.jsxs(Fe,{variant:"primary",size:"sm",className:"flex-1 min-w-0 overflow-hidden",onClick:()=>{const ke=t.print_name||t.filename||"model";Pm(t.id,ke,"file",c)},title:u("archives.card.openInBambuStudioToSlice"),children:[i.jsx(ei,{className:"w-3 h-3 flex-shrink-0"}),i.jsx("span",{className:"hidden sm:inline truncate",children:u("archives.card.slice")})]}),i.jsx(Fe,{variant:"secondary",size:"sm",className:"min-w-0 p-1 sm:p-1.5",onClick:()=>{const ke=t.external_url||t.makerworld_url;ke&&window.open(ke,"_blank")},disabled:!t.external_url&&!t.makerworld_url,title:t.external_url?u("archives.card.externalLink"):t.makerworld_url?u("archives.card.makerWorld",{designer:t.designer||u("archives.card.viewProject")}):u("archives.card.noExternalLink"),children:i.jsx($m,{className:`w-3 h-3 sm:w-4 sm:h-4 ${!t.external_url&&!t.makerworld_url?"opacity-20":""}`})}),i.jsx(Fe,{variant:"secondary",size:"sm",className:"min-w-0 p-1 sm:p-1.5",onClick:()=>{be.downloadArchive(t.id,`${t.print_name||t.filename}.3mf`).catch(ke=>{console.error("Archive download failed:",ke)})},title:u("archives.card.download"),children:i.jsx(pi,{className:"w-3 h-3 sm:w-4 sm:h-4"})}),i.jsx(Fe,{variant:"ghost",size:"sm",className:"min-w-0 p-1 sm:p-1.5",onClick:()=>C(!0),disabled:!y("archives","delete",t.created_by_id),title:y("archives","delete",t.created_by_id)?u("archives.card.delete"):u("archives.card.noPermissionDelete"),children:i.jsx(Qt,{className:"w-3 h-3 sm:w-4 sm:h-4 text-red-400"})})]})]}),T&&i.jsx(sre,{archive:t,onClose:()=>N(!1)}),b&&i.jsx(L4,{archiveId:t.id,title:t.print_name||t.filename,fileType:tse(t.filename),onClose:()=>v(!1)}),_&&i.jsx($c,{mode:"reprint",archiveId:t.id,archiveName:t.print_name||t.filename,onClose:()=>k(!1)}),P&&i.jsx(Nn,{title:u("archives.modal.deleteArchive"),message:u("archives.modal.deleteConfirm",{name:t.print_name||t.filename}),confirmText:u("archives.modal.deleteButton"),variant:"danger",onConfirm:()=>{Ae.mutate(),C(!1)},onCancel:()=>C(!1)}),ie&&i.jsx(Nn,{title:u("archives.modal.removeSource3mf"),message:u("archives.modal.removeSource3mfConfirm",{name:t.print_name||t.filename}),confirmText:u("archives.modal.removeButton"),variant:"danger",onConfirm:()=>{F.mutate(),le(!1)},onCancel:()=>le(!1)}),pe&&i.jsx(Nn,{title:u("archives.modal.removeF3d"),message:u("archives.modal.removeF3dConfirm",{name:t.print_name||t.filename}),confirmText:u("archives.modal.removeButton"),variant:"danger",onConfirm:()=>{ve.mutate(),Ce(!1)},onCancel:()=>Ce(!1)}),q&&i.jsx(Nn,{title:u("archives.modal.removeTimelapse"),message:u("archives.modal.removeTimelapseConfirm",{name:t.print_name||t.filename}),confirmText:u("archives.modal.removeButton"),variant:"danger",onConfirm:()=>{fe.mutate(),Z(!1)},onCancel:()=>Z(!1)}),j&&i.jsx(ore,{x:j.x,y:j.y,items:Ee,onClose:()=>E(null)}),R&&t.timelapse_path&&i.jsx(ese,{src:be.getArchiveTimelapse(t.id),title:u("archives.modal.timelapse",{name:t.print_name||t.filename}),downloadFilename:`${t.print_name||t.filename}_timelapse.mp4`,archiveId:t.id,onClose:()=>A(!1),onEdit:()=>{m.invalidateQueries({queryKey:["archives"]}),A(!1)}}),D&&U.length>0&&i.jsx("div",{className:"fixed inset-0 bg-black/80 flex items-center justify-center z-50 p-4",children:i.jsxs("div",{className:"bg-card-dark rounded-lg max-w-lg w-full max-h-[80vh] flex flex-col",children:[i.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-700",children:[i.jsxs("div",{children:[i.jsx("h3",{className:"text-lg font-semibold text-white",children:u("archives.modal.selectTimelapse")}),i.jsx("p",{className:"text-sm text-gray-400 mt-1",children:u("archives.modal.selectTimelapseDesc")})]}),i.jsx("button",{onClick:()=>{$(!1),G([])},className:"text-gray-400 hover:text-white p-1",children:i.jsx(zt,{className:"w-5 h-5"})})]}),i.jsx("div",{className:"overflow-y-auto flex-1 p-2",children:U.map(ke=>i.jsxs("button",{onClick:()=>de.mutate(ke.name),disabled:de.isPending,className:"w-full text-left p-3 rounded-lg hover:bg-gray-700 transition-colors flex items-center gap-3 disabled:opacity-50",children:[i.jsx(Hm,{className:"w-8 h-8 text-bambu-green flex-shrink-0"}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsx("p",{className:"text-white font-medium truncate",children:ke.name}),i.jsxs("p",{className:"text-sm text-gray-400",children:[no(ke.size),ke.mtime&&` • ${Wp(ke.mtime,l)}`]})]})]},ke.name))}),i.jsx("div",{className:"p-4 border-t border-gray-700",children:i.jsx(Fe,{variant:"secondary",onClick:()=>{$(!1),G([])},className:"w-full",children:"Cancel"})})]})}),L&&i.jsx(lre,{archiveId:t.id,archiveName:t.print_name||t.filename,onClose:()=>te(!1)}),re&&t.photos&&t.photos.length>0&&i.jsx(cre,{archiveId:t.id,archiveName:t.print_name||t.filename,photos:t.photos,onClose:()=>J(!1),onDelete:async ke=>{try{await be.deleteArchivePhoto(t.id,ke),m.invalidateQueries({queryKey:["archives"]}),p(u("archives.toast.photoDeleted"))}catch{p(u("archives.toast.failedDeletePhoto"),"error")}}}),ue&&i.jsx(Jae,{archiveId:t.id,archiveName:t.print_name||t.filename,onClose:()=>me(!1)}),ge&&i.jsx($c,{mode:"add-to-queue",archiveId:t.id,archiveName:t.print_name||t.filename,onClose:()=>X(!1)}),i.jsx("input",{ref:z,type:"file",accept:".3mf",className:"hidden",onChange:ke=>{const Me=ke.target.files?.[0];Me&&O.mutate(Me),ke.target.value=""}}),i.jsx("input",{ref:V,type:"file",accept:".f3d",className:"hidden",onChange:ke=>{const Me=ke.target.files?.[0];Me&&Q.mutate(Me),ke.target.value=""}}),i.jsx("input",{ref:ee,type:"file",accept:".mp4,.avi,.mkv",className:"hidden",onChange:ke=>{const Me=ke.target.files?.[0];Me&&oe.mutate(Me),ke.target.value=""}})]})}function KXe({archive:t,printerName:e,isSelected:n,onSelect:r,selectionMode:a,projects:s,isHighlighted:o,preferredSlicer:l="bambu_studio",t:c}){const d=tn(),{showToast:u}=bn(),{hasPermission:m,canModify:p}=Rr(),[f,y]=w.useState(!1),[x,b]=w.useState(!1),[v,_]=w.useState(!1),[k,P]=w.useState(!1),[C,T]=w.useState(!1),[N,R]=w.useState(!1),[A,D]=w.useState(!1),[$,U]=w.useState([]),[G,L]=w.useState(!1),[te,re]=w.useState(!1),[J,ue]=w.useState(!1),[me,ge]=w.useState(!1),[X,ie]=w.useState(!1),[le,pe]=w.useState(!1),[Ce,q]=w.useState(null),Z=w.useRef(null),j=w.useRef(null),E=w.useRef(null),I=ut({mutationFn:()=>be.deleteArchiveTimelapse(t.id),onSuccess:()=>{d.invalidateQueries({queryKey:["archives"]}),u(c("archives.toast.timelapseRemoved"))},onError:Q=>{u(Q.message||c("archives.toast.failedRemoveTimelapse"),"error")}}),W=ut({mutationFn:Q=>be.uploadArchiveTimelapse(t.id,Q),onSuccess:Q=>{d.invalidateQueries({queryKey:["archives"]}),u(c("archives.toast.timelapseUploaded",{filename:Q.filename}))},onError:Q=>{u(Q.message||c("archives.toast.failedUploadTimelapse"),"error")}}),B=ut({mutationFn:Q=>be.uploadSource3mf(t.id,Q),onSuccess:Q=>{d.invalidateQueries({queryKey:["archives"]}),u(c("archives.toast.source3mfAttached",{filename:Q.filename}))},onError:Q=>{u(Q.message||c("archives.toast.failedUploadSource3mf"),"error")}}),ae=ut({mutationFn:()=>be.deleteSource3mf(t.id),onSuccess:()=>{d.invalidateQueries({queryKey:["archives"]}),u(c("archives.toast.source3mfRemoved"))},onError:Q=>{u(Q.message||c("archives.toast.failedRemoveSource3mf"),"error")}}),z=ut({mutationFn:Q=>be.uploadF3d(t.id,Q),onSuccess:Q=>{d.invalidateQueries({queryKey:["archives"]}),u(c("archives.toast.f3dAttached",{filename:Q.filename}))},onError:Q=>{u(Q.message||c("archives.toast.failedUploadF3d"),"error")}}),V=ut({mutationFn:()=>be.deleteF3d(t.id),onSuccess:()=>{d.invalidateQueries({queryKey:["archives"]}),u(c("archives.toast.f3dRemoved"))},onError:Q=>{u(Q.message||c("archives.toast.failedRemoveF3d"),"error")}}),ee=ut({mutationFn:()=>be.scanArchiveTimelapse(t.id),onSuccess:Q=>{Q.status==="attached"?(d.invalidateQueries({queryKey:["archives"]}),u(c("archives.toast.timelapseAttached",{filename:Q.filename}))):Q.status==="exists"?u(c("archives.toast.timelapseAlreadyAttached")):Q.status==="not_found"&&Q.available_files&&Q.available_files.length>0?(U(Q.available_files),D(!0)):u(Q.message||c("archives.toast.noMatchingTimelapse"),"warning")},onError:Q=>{u(Q.message||c("archives.toast.failedScanTimelapse"),"error")}}),K=ut({mutationFn:Q=>be.selectArchiveTimelapse(t.id,Q),onSuccess:Q=>{d.invalidateQueries({queryKey:["archives"]}),u(c("archives.toast.timelapseAttached",{filename:Q.filename})),D(!1),U([])},onError:Q=>{u(Q.message||c("archives.toast.failedAttachTimelapse"),"error")}}),ne=ut({mutationFn:()=>be.deleteArchive(t.id),onSuccess:()=>{d.invalidateQueries({queryKey:["archives"]}),u(c("archives.toast.archiveDeleted"))},onError:()=>{u(c("archives.toast.failedDeleteArchive"),"error")}}),se=ut({mutationFn:()=>be.toggleFavorite(t.id),onSuccess:Q=>{d.invalidateQueries({queryKey:["archives"]}),u(Q.is_favorite?c("archives.toast.addedToFavorites"):c("archives.toast.removedFromFavorites"))}}),{data:ce}=Je({queryKey:["archive-folders",t.id],queryFn:()=>be.getLibraryFoldersByArchive(t.id)}),fe=ut({mutationFn:Q=>be.updateArchive(t.id,{project_id:Q}),onSuccess:()=>{d.invalidateQueries({queryKey:["archives"]}),d.invalidateQueries({queryKey:["projects"]}),u(c("archives.toast.projectUpdated"))},onError:()=>{u(c("archives.toast.failedUpdateProject"),"error")}}),oe=Q=>{Q.preventDefault(),q({x:Q.clientX,y:Q.clientY})},F=[...Tm(t)?[{label:c("archives.menu.print"),icon:i.jsx(kr,{className:"w-4 h-4"}),onClick:()=>_(!0),disabled:!t.file_path||!p("archives","reprint",t.created_by_id),title:t.file_path?p("archives","reprint",t.created_by_id)?void 0:c("archives.permission.noReprint"):c("archives.card.noFileForReprint")},{label:c("archives.menu.schedule"),icon:i.jsx(Xr,{className:"w-4 h-4"}),onClick:()=>P(!0),disabled:!t.file_path||!m("queue:create"),title:t.file_path?m("queue:create")?void 0:c("archives.permission.noAddToQueue"):c("archives.card.noFileForReprint")},{label:c("archives.menu.openInBambuStudio"),icon:i.jsx(ei,{className:"w-4 h-4"}),onClick:()=>{const Q=t.print_name||t.filename||"model";Pm(t.id,Q,"file",l)},disabled:!t.file_path,title:t.file_path?void 0:c("archives.card.noFileForReprint")}]:[{label:c("archives.menu.slice"),icon:i.jsx(ei,{className:"w-4 h-4"}),onClick:()=>{const Q=t.print_name||t.filename||"model";Pm(t.id,Q,"file",l)}}],{label:t.external_url?c("archives.menu.externalLink"):c("archives.menu.viewOnMakerWorld"),icon:i.jsx($m,{className:"w-4 h-4"}),onClick:()=>{const Q=t.external_url||t.makerworld_url;Q&&window.open(Q,"_blank")},disabled:!t.external_url&&!t.makerworld_url},{label:"",divider:!0,onClick:()=>{}},{label:c("archives.menu.preview3d"),icon:i.jsx(ra,{className:"w-4 h-4"}),onClick:()=>T(!0)},{label:c("archives.menu.viewTimelapse"),icon:i.jsx(Hm,{className:"w-4 h-4"}),onClick:()=>R(!0),disabled:!t.timelapse_path},{label:c("archives.menu.scanForTimelapse"),icon:i.jsx(W1,{className:"w-4 h-4"}),onClick:()=>ee.mutate(),disabled:!t.printer_id||!!t.timelapse_path||ee.isPending||!p("archives","update",t.created_by_id),title:p("archives","update",t.created_by_id)?void 0:c("archives.permission.noUpdateArchives")},{label:c("archives.menu.uploadTimelapse"),icon:i.jsx(Si,{className:"w-4 h-4"}),onClick:()=>E.current?.click(),disabled:!!t.timelapse_path||!p("archives","update",t.created_by_id),title:p("archives","update",t.created_by_id)?void 0:c("archives.permission.noUpdateArchives")},...t.timelapse_path?[{label:c("archives.menu.removeTimelapse"),icon:i.jsx(Qt,{className:"w-4 h-4"}),onClick:()=>pe(!0),danger:!0,disabled:!p("archives","update",t.created_by_id),title:p("archives","update",t.created_by_id)?void 0:c("archives.permission.noUpdateArchives")}]:[],{label:"",divider:!0,onClick:()=>{}},{label:t.source_3mf_path?c("archives.menu.downloadSource3mf"):c("archives.menu.uploadSource3mf"),icon:i.jsx($1,{className:"w-4 h-4"}),onClick:()=>{t.source_3mf_path?be.downloadSource3mf(t.id).catch(Q=>{console.error("Source 3MF download failed:",Q)}):Z.current?.click()},disabled:!t.source_3mf_path&&!p("archives","update",t.created_by_id),title:!t.source_3mf_path&&!p("archives","update",t.created_by_id)?c("archives.permission.noUploadFiles"):void 0},...t.source_3mf_path?[{label:c("archives.menu.replaceSource3mf"),icon:i.jsx(Si,{className:"w-4 h-4"}),onClick:()=>Z.current?.click(),disabled:!p("archives","update",t.created_by_id),title:p("archives","update",t.created_by_id)?void 0:c("archives.permission.noUpdateArchives")},{label:c("archives.menu.removeSource3mf"),icon:i.jsx(Qt,{className:"w-4 h-4"}),onClick:()=>ge(!0),danger:!0,disabled:!p("archives","update",t.created_by_id),title:p("archives","update",t.created_by_id)?void 0:c("archives.permission.noUpdateArchives")}]:[],{label:t.f3d_path?c("archives.menu.replaceF3d"):c("archives.menu.uploadF3d"),icon:i.jsx(ra,{className:"w-4 h-4"}),onClick:()=>j.current?.click(),disabled:!p("archives","update",t.created_by_id),title:p("archives","update",t.created_by_id)?void 0:c("archives.permission.noUpdateArchives")},...t.f3d_path?[{label:c("archives.menu.downloadF3d"),icon:i.jsx(pi,{className:"w-4 h-4"}),onClick:()=>{be.downloadF3d(t.id).catch(Q=>{console.error("F3D download failed:",Q)})}},{label:c("archives.menu.removeF3d"),icon:i.jsx(Qt,{className:"w-4 h-4"}),onClick:()=>ie(!0),danger:!0,disabled:!p("archives","update",t.created_by_id),title:p("archives","update",t.created_by_id)?void 0:c("archives.permission.noUpdateArchives")}]:[],{label:"",divider:!0,onClick:()=>{}},{label:c("archives.menu.download"),icon:i.jsx(pi,{className:"w-4 h-4"}),onClick:()=>{be.downloadArchive(t.id,`${t.print_name||t.filename}.3mf`).catch(Q=>{console.error("Archive download failed:",Q)})},disabled:!m("archives:read"),title:m("archives:read")?void 0:c("archives.permission.noDownload")},{label:c("archives.menu.copyDownloadLink"),icon:i.jsx(wl,{className:"w-4 h-4"}),onClick:()=>{const Q=`${window.location.origin}${be.getArchiveDownload(t.id)}`;navigator.clipboard.writeText(Q).then(()=>{u(c("archives.toast.linkCopied"))}).catch(()=>{u(c("archives.toast.failedCopyLink"),"error")})},disabled:!m("archives:read"),title:m("archives:read")?void 0:c("archives.permission.noCopyLink")},{label:c("archives.menu.qrCode"),icon:i.jsx(XY,{className:"w-4 h-4"}),onClick:()=>L(!0)},{label:t.photos?.length?c("archives.menu.viewPhotosCount",{count:t.photos.length}):c("archives.menu.viewPhotos"),icon:i.jsx(Mb,{className:"w-4 h-4"}),onClick:()=>re(!0),disabled:!t.photos?.length},{label:c("archives.menu.projectPage"),icon:i.jsx(Es,{className:"w-4 h-4"}),onClick:()=>ue(!0)},{label:"",divider:!0,onClick:()=>{}},{label:t.is_favorite?c("archives.menu.removeFromFavorites"):c("archives.menu.addToFavorites"),icon:i.jsx(qp,{className:`w-4 h-4 ${t.is_favorite?"fill-yellow-400 text-yellow-400":""}`}),onClick:()=>se.mutate(),disabled:!p("archives","update",t.created_by_id),title:p("archives","update",t.created_by_id)?void 0:c("archives.permission.noUpdateArchives")},{label:c("archives.menu.edit"),icon:i.jsx(Wi,{className:"w-4 h-4"}),onClick:()=>y(!0),disabled:!p("archives","update",t.created_by_id),title:p("archives","update",t.created_by_id)?void 0:c("archives.permission.noUpdateArchives")},...t.project_id&&t.project_name?[{label:c("archives.menu.goToProject",{name:t.project_name}),icon:i.jsx(fs,{className:"w-4 h-4 text-bambu-green"}),onClick:()=>window.location.href="/projects"}]:[],{label:c("archives.menu.addToProject"),icon:i.jsx(fs,{className:"w-4 h-4"}),onClick:()=>{},submenu:(()=>{const Q=[];if(t.project_id&&Q.push({label:c("archives.menu.removeFromProject"),icon:i.jsx(zt,{className:"w-4 h-4"}),onClick:()=>fe.mutate(null)}),!s)Q.push({label:c("archives.menu.loading"),icon:i.jsx(ct,{className:"w-4 h-4 animate-spin"}),onClick:()=>{},disabled:!0});else{const ve=s.filter(he=>he.status==="active");ve.length===0?Q.push({label:c("archives.menu.noProjectsAvailable"),icon:i.jsx(fs,{className:"w-4 h-4 opacity-50"}),onClick:()=>{},disabled:!0}):ve.forEach(he=>{Q.push({label:he.name,icon:i.jsx("div",{className:"w-3 h-3 rounded-full flex-shrink-0",style:{backgroundColor:he.color||"#888"}}),onClick:()=>fe.mutate(he.id),disabled:t.project_id===he.id})})}return Q})()},{label:c(n?"archives.menu.deselect":"archives.menu.select"),icon:n?i.jsx(mo,{className:"w-4 h-4"}):i.jsx(Sl,{className:"w-4 h-4"}),onClick:()=>r(t.id)},{label:"",divider:!0,onClick:()=>{}},{label:c("archives.menu.delete"),icon:i.jsx(Qt,{className:"w-4 h-4"}),onClick:()=>b(!0),danger:!0,disabled:!p("archives","delete",t.created_by_id),title:p("archives","delete",t.created_by_id)?void 0:c("archives.permission.noDelete")}];return i.jsxs(i.Fragment,{children:[i.jsxs("div",{"data-archive-id":t.id,className:`grid grid-cols-12 gap-4 px-4 py-3 items-center hover:bg-bambu-dark-tertiary/30 ${n?"bg-bambu-green/10":""}`,style:o?{outline:"4px solid #facc15",outlineOffset:"-4px"}:void 0,onContextMenu:oe,children:[i.jsxs("div",{className:"col-span-1 flex items-center gap-2",children:[a&&i.jsx("button",{onClick:()=>r(t.id),children:n?i.jsx(mo,{className:"w-4 h-4 text-bambu-green"}):i.jsx(Sl,{className:"w-4 h-4 text-bambu-gray"})}),t.thumbnail_path?i.jsx("img",{src:be.getArchiveThumbnail(t.id),alt:"",className:"w-10 h-10 object-cover rounded"}):i.jsx("div",{className:"w-10 h-10 bg-bambu-dark rounded flex items-center justify-center",children:i.jsx(ou,{className:"w-5 h-5 text-bambu-dark-tertiary"})})]}),i.jsxs("div",{className:"col-span-4",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("p",{className:"text-white text-sm truncate",children:t.print_name||t.filename}),(t.status==="failed"||t.status==="aborted")&&i.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] leading-tight bg-status-error/80 text-white flex-shrink-0",children:t.status==="aborted"?c("archives.card.cancelled"):c("archives.card.failed")}),t.timelapse_path&&i.jsx("span",{title:c("archives.list.hasTimelapse"),children:i.jsx(Hm,{className:"w-3.5 h-3.5 text-bambu-green flex-shrink-0"})}),ce&&ce.length>0&&i.jsx(Js,{to:`/files?folder=${ce[0].id}`,className:"flex-shrink-0",title:c("archives.card.openFolder",{name:ce[0].name}),onClick:Q=>Q.stopPropagation(),children:i.jsx(nc,{className:"w-3.5 h-3.5 text-yellow-400"})})]}),(t.filament_type||t.sliced_for_model)&&i.jsxs("div",{className:"flex items-center gap-1.5 mt-0.5",children:[t.sliced_for_model&&i.jsxs("span",{className:"text-xs text-bambu-gray flex items-center gap-1",title:c("archives.card.slicedFor",{model:t.sliced_for_model}),children:[i.jsx(kr,{className:"w-2.5 h-2.5"}),t.sliced_for_model]}),t.sliced_for_model&&t.filament_type&&i.jsx("span",{className:"text-bambu-gray/50",children:"·"}),t.filament_type&&i.jsx("span",{className:"text-xs text-bambu-gray",children:t.filament_type}),t.filament_color&&i.jsx("div",{className:"flex items-center gap-0.5 flex-wrap",children:t.filament_color.split(",").map((Q,ve)=>i.jsx("div",{className:"w-2.5 h-2.5 rounded-full border border-white/20",style:{backgroundColor:Q},title:Q},ve))})]})]}),i.jsx("div",{className:"col-span-2 text-sm text-bambu-gray truncate",children:e}),i.jsxs("div",{className:"col-span-2 text-sm text-bambu-gray",children:[i.jsx("div",{children:Gp(t.created_at)}),t.created_by_username&&i.jsxs("div",{className:"flex items-center gap-1 text-xs opacity-75",title:c("archives.card.uploadedBy",{name:t.created_by_username}),children:[i.jsx(du,{className:"w-3 h-3"}),t.created_by_username]})]}),i.jsx("div",{className:"col-span-1 text-sm text-bambu-gray",children:no(t.file_size)}),i.jsxs("div",{className:"col-span-2 flex justify-end gap-1",children:[Tm(t)&&i.jsx(Fe,{variant:"ghost",size:"sm",onClick:()=>_(!0),disabled:!p("archives","reprint",t.created_by_id),title:p("archives","reprint",t.created_by_id)?c("archives.card.reprint"):c("archives.card.noPermissionReprint"),className:"text-bambu-green hover:text-bambu-green-light hover:bg-bambu-green/10",children:i.jsx(co,{className:"w-4 h-4"})}),i.jsx(Fe,{variant:"ghost",size:"sm",onClick:()=>{const Q=t.print_name||t.filename||"model";Pm(t.id,Q,"file",l)},title:c("archives.card.openInBambuStudio"),children:i.jsx(ei,{className:"w-4 h-4"})}),(t.external_url||t.makerworld_url)&&i.jsx(Fe,{variant:"ghost",size:"sm",onClick:()=>window.open(t.external_url||t.makerworld_url,"_blank"),title:t.external_url?c("archives.card.externalLink"):"MakerWorld",children:i.jsx($m,{className:"w-4 h-4"})}),i.jsx(Fe,{variant:"ghost",size:"sm",onClick:()=>{be.downloadArchive(t.id,`${t.print_name||t.filename}.3mf`).catch(Q=>{console.error("Archive download failed:",Q)})},title:c("archives.card.download"),children:i.jsx(pi,{className:"w-4 h-4"})}),i.jsx(Fe,{variant:"ghost",size:"sm",onClick:()=>y(!0),disabled:!p("archives","update",t.created_by_id),title:p("archives","update",t.created_by_id)?c("archives.card.edit"):c("archives.card.noPermissionEdit"),children:i.jsx(Wi,{className:"w-4 h-4"})}),i.jsx(Fe,{variant:"ghost",size:"sm",onClick:()=>b(!0),disabled:!p("archives","delete",t.created_by_id),title:p("archives","delete",t.created_by_id)?c("archives.card.delete"):c("archives.card.noPermissionDelete"),children:i.jsx(Qt,{className:"w-4 h-4 text-red-400"})}),i.jsx(Fe,{variant:"ghost",size:"sm",onClick:Q=>{const ve=Q.currentTarget.getBoundingClientRect();q({x:ve.left,y:ve.bottom+4})},title:c("archives.card.moreOptions"),children:i.jsx(Bm,{className:"w-4 h-4"})})]})]}),f&&i.jsx(sre,{archive:t,onClose:()=>y(!1)}),C&&i.jsx(L4,{archiveId:t.id,title:t.print_name||t.filename,fileType:tse(t.filename),onClose:()=>T(!1)}),v&&i.jsx($c,{mode:"reprint",archiveId:t.id,archiveName:t.print_name||t.filename,onClose:()=>_(!1)}),x&&i.jsx(Nn,{title:c("archives.modal.deleteArchive"),message:c("archives.modal.deleteConfirm",{name:t.print_name||t.filename}),confirmText:c("archives.modal.deleteButton"),variant:"danger",onConfirm:()=>{ne.mutate(),b(!1)},onCancel:()=>b(!1)}),me&&i.jsx(Nn,{title:c("archives.modal.removeSource3mf"),message:c("archives.modal.removeSource3mfConfirm",{name:t.print_name||t.filename}),confirmText:c("archives.modal.removeButton"),variant:"danger",onConfirm:()=>{ae.mutate(),ge(!1)},onCancel:()=>ge(!1)}),X&&i.jsx(Nn,{title:c("archives.modal.removeF3d"),message:c("archives.modal.removeF3dConfirm",{name:t.print_name||t.filename}),confirmText:c("archives.modal.removeButton"),variant:"danger",onConfirm:()=>{V.mutate(),ie(!1)},onCancel:()=>ie(!1)}),le&&i.jsx(Nn,{title:c("archives.modal.removeTimelapse"),message:c("archives.modal.removeTimelapseConfirm",{name:t.print_name||t.filename}),confirmText:c("archives.modal.removeButton"),variant:"danger",onConfirm:()=>{I.mutate(),pe(!1)},onCancel:()=>pe(!1)}),Ce&&i.jsx(ore,{x:Ce.x,y:Ce.y,items:F,onClose:()=>q(null)}),N&&t.timelapse_path&&i.jsx(ese,{src:be.getArchiveTimelapse(t.id),title:c("archives.modal.timelapse",{name:t.print_name||t.filename}),downloadFilename:`${t.print_name||t.filename}_timelapse.mp4`,archiveId:t.id,onClose:()=>R(!1),onEdit:()=>{d.invalidateQueries({queryKey:["archives"]}),R(!1)}}),A&&$.length>0&&i.jsx("div",{className:"fixed inset-0 bg-black/80 flex items-center justify-center z-50 p-4",children:i.jsxs("div",{className:"bg-card-dark rounded-lg max-w-lg w-full max-h-[80vh] flex flex-col",children:[i.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-700",children:[i.jsxs("div",{children:[i.jsx("h3",{className:"text-lg font-semibold text-white",children:c("archives.modal.selectTimelapse")}),i.jsx("p",{className:"text-sm text-gray-400 mt-1",children:c("archives.modal.selectTimelapseDesc")})]}),i.jsx("button",{onClick:()=>{D(!1),U([])},className:"text-gray-400 hover:text-white p-1",children:i.jsx(zt,{className:"w-5 h-5"})})]}),i.jsx("div",{className:"overflow-y-auto flex-1 p-2",children:$.map(Q=>i.jsxs("button",{onClick:()=>K.mutate(Q.name),disabled:K.isPending,className:"w-full text-left p-3 rounded-lg hover:bg-gray-700 transition-colors mb-1",children:[i.jsx("div",{className:"font-medium text-white",children:Q.name}),i.jsxs("div",{className:"text-sm text-gray-400 flex gap-3",children:[i.jsx("span",{children:no(Q.size)}),Q.mtime&&i.jsx("span",{children:Gp(Q.mtime)})]})]},Q.name))})]})}),G&&i.jsx(lre,{archiveId:t.id,archiveName:t.print_name||t.filename,onClose:()=>L(!1)}),te&&t.photos&&i.jsx(cre,{archiveId:t.id,archiveName:t.print_name||t.filename,photos:t.photos,onClose:()=>re(!1),onDelete:async Q=>{try{await be.deleteArchivePhoto(t.id,Q),d.invalidateQueries({queryKey:["archives"]}),u(c("archives.toast.photoDeleted"))}catch{u(c("archives.toast.failedDeletePhoto"),"error")}}}),J&&i.jsx(Jae,{archiveId:t.id,archiveName:t.print_name||t.filename,onClose:()=>ue(!1)}),k&&i.jsx($c,{mode:"add-to-queue",archiveId:t.id,archiveName:t.print_name||t.filename,onClose:()=>P(!1)}),i.jsx("input",{ref:Z,type:"file",accept:".3mf",className:"hidden",onChange:Q=>{const ve=Q.target.files?.[0];ve&&B.mutate(ve),Q.target.value=""}}),i.jsx("input",{ref:j,type:"file",accept:".f3d",className:"hidden",onChange:Q=>{const ve=Q.target.files?.[0];ve&&z.mutate(ve),Q.target.value=""}}),i.jsx("input",{ref:E,type:"file",accept:".mp4,.avi,.mkv",className:"hidden",onChange:Q=>{const ve=Q.target.files?.[0];ve&&W.mutate(ve),Q.target.value=""}})]})}const YXe=[{id:"all",label:"All Archives",icon:i.jsx(nc,{className:"w-4 h-4"})},{id:"recent",label:"Last 24 Hours",icon:i.jsx(er,{className:"w-4 h-4"})},{id:"this-week",label:"This Week",icon:i.jsx(Xr,{className:"w-4 h-4"})},{id:"this-month",label:"This Month",icon:i.jsx(Xr,{className:"w-4 h-4"})},{id:"favorites",label:"Favorites",icon:i.jsx(qp,{className:"w-4 h-4"})},{id:"failed",label:"Failed Prints",icon:i.jsx(Ii,{className:"w-4 h-4"})},{id:"duplicates",label:"Duplicates",icon:i.jsx(wl,{className:"w-4 h-4"})}];function XXe(){const{t}=Mt(),e=tn(),{showToast:n}=bn(),{hasPermission:r,hasAnyPermission:a}=Rr(),s=w.useRef(null),[o,l]=w.useState(""),[c,d]=w.useState(()=>{const De=localStorage.getItem("archiveFilterPrinter");return De?Number(De):null}),[u,m]=w.useState(()=>localStorage.getItem("archiveFilterMaterial")),[p,f]=w.useState(()=>{const De=localStorage.getItem("archiveFilterColors");return De?new Set(JSON.parse(De)):new Set}),[y,x]=w.useState(()=>localStorage.getItem("archiveColorFilterMode")||"or"),[b,v]=w.useState(()=>localStorage.getItem("archiveFilterFavorites")==="true"),[_,k]=w.useState(()=>localStorage.getItem("archiveHideFailed")==="true"),[P,C]=w.useState(()=>localStorage.getItem("archiveFilterTag")),[T,N]=w.useState(()=>localStorage.getItem("archiveFilterFileType")||"all"),[R,A]=w.useState(!1),[D,$]=w.useState([]),[U,G]=w.useState(!1),[L,te]=w.useState(new Set),[re,J]=w.useState(!1),[ue,me]=w.useState(!1),[ge,X]=w.useState(!1),[ie,le]=w.useState(!1),[pe,Ce]=w.useState(()=>localStorage.getItem("archiveViewMode")||"grid"),[q,Z]=w.useState(()=>localStorage.getItem("archiveSortBy")||"date-desc"),[j,E]=w.useState(()=>localStorage.getItem("archiveCollection")||"all"),[I,W]=w.useState(!1),[B,ae]=w.useState(!1),[z,V]=w.useState(!1),[ee,K]=w.useState(!1),[ne,se]=w.useState(null),[ce,fe]=w.useState(()=>localStorage.getItem("logFilterUser")||null),[oe,O]=w.useState(()=>localStorage.getItem("logFilterStatus")),[F,Q]=w.useState(()=>localStorage.getItem("logFilterDateFrom")||""),[ve,he]=w.useState(()=>localStorage.getItem("logFilterDateTo")||""),[de,Ae]=w.useState(()=>{const De=localStorage.getItem("logOffset");return De?Number(De):0}),[_e,ze]=w.useState(!1),[Be,Ue]=w.useState(()=>{const De=localStorage.getItem("logPageSize");return De?Number(De):25});w.useEffect(()=>{if(ne){const De=setTimeout(()=>{const at=document.querySelector(`[data-archive-id="${ne}"]`);at&&at.scrollIntoView({behavior:"smooth",block:"center"})},100),Xe=setTimeout(()=>se(null),5e3);return()=>{clearTimeout(De),clearTimeout(Xe)}}},[ne]);const{data:Ne,isLoading:Ee}=Je({queryKey:["archives",c],queryFn:()=>be.getArchives(c||void 0)}),{data:ke}=Je({queryKey:["printers"],queryFn:be.getPrinters}),{data:Me}=Je({queryKey:["projects"],queryFn:()=>be.getProjects()}),{data:Ge}=Je({queryKey:["settings"],queryFn:be.getSettings}),{data:xe}=Je({queryKey:["users"],queryFn:be.getUsers,enabled:pe==="log"}),{data:He,isLoading:Pe}=Je({queryKey:["print-log",c,ce,oe,F,ve,o,de,Be],queryFn:()=>be.getPrintLog({search:o||void 0,printerId:c||void 0,username:ce||void 0,status:oe||void 0,dateFrom:F||void 0,dateTo:ve||void 0,limit:Be,offset:de}),enabled:pe==="log"}),Ve=Ge?.time_format||"system",je=Ge?.preferred_slicer||"bambu_studio",ye=al(Ge?.currency||"USD"),$e=ut({mutationFn:async De=>(await Promise.all(De.map(Xe=>be.deleteArchive(Xe))),De.length),onSuccess:De=>{e.invalidateQueries({queryKey:["archives"]}),te(new Set),n(`${De} archive${De!==1?"s":""} deleted`)},onError:()=>{n(t("archives.toast.failedDeleteArchives"),"error")}}),Ye=ut({mutationFn:()=>be.clearPrintLog(),onSuccess:De=>{e.invalidateQueries({queryKey:["print-log"]}),Ae(0),n(t("archives.log.cleared",{count:De.deleted}))},onError:()=>{n(t("archives.log.clearFailed"),"error")}});w.useEffect(()=>{c!==null?localStorage.setItem("archiveFilterPrinter",c.toString()):localStorage.removeItem("archiveFilterPrinter")},[c]),w.useEffect(()=>{u?localStorage.setItem("archiveFilterMaterial",u):localStorage.removeItem("archiveFilterMaterial")},[u]),w.useEffect(()=>{localStorage.setItem("archiveFilterColors",JSON.stringify([...p]))},[p]),w.useEffect(()=>{localStorage.setItem("archiveColorFilterMode",y)},[y]),w.useEffect(()=>{localStorage.setItem("archiveFilterFavorites",b.toString())},[b]),w.useEffect(()=>{localStorage.setItem("archiveHideFailed",_.toString())},[_]),w.useEffect(()=>{P?localStorage.setItem("archiveFilterTag",P):localStorage.removeItem("archiveFilterTag")},[P]),w.useEffect(()=>{localStorage.setItem("archiveFilterFileType",T)},[T]),w.useEffect(()=>{localStorage.setItem("archiveViewMode",pe)},[pe]),w.useEffect(()=>{localStorage.setItem("archiveSortBy",q)},[q]),w.useEffect(()=>{localStorage.setItem("archiveCollection",j)},[j]),w.useEffect(()=>{ce?localStorage.setItem("logFilterUser",ce):localStorage.removeItem("logFilterUser")},[ce]),w.useEffect(()=>{oe?localStorage.setItem("logFilterStatus",oe):localStorage.removeItem("logFilterStatus")},[oe]),w.useEffect(()=>{F?localStorage.setItem("logFilterDateFrom",F):localStorage.removeItem("logFilterDateFrom")},[F]),w.useEffect(()=>{ve?localStorage.setItem("logFilterDateTo",ve):localStorage.removeItem("logFilterDateTo")},[ve]),w.useEffect(()=>{localStorage.setItem("logOffset",de.toString())},[de]),w.useEffect(()=>{localStorage.setItem("logPageSize",Be.toString())},[Be]);const lt=new Map(ke?.map(De=>[De.id,De.name])||[]),St=[...new Set(Ne?.flatMap(De=>De.filament_type?.split(", ")||[]).filter(Boolean)||[])].sort(),ot=[...new Set(Ne?.flatMap(De=>De.filament_color?.split(",")||[]).filter(Boolean)||[])],ft=[...new Set(Ne?.flatMap(De=>De.tags?.split(",").map(Xe=>Xe.trim())||[]).filter(Boolean)||[])].sort(),qe=Ne?.filter(De=>{const Xe=new Date,at=Jn(De.created_at)||new Date(0);let Ke=!0;switch(j){case"recent":Ke=Xe.getTime()-at.getTime()<1440*60*1e3;break;case"this-week":Ke=Xe.getTime()-at.getTime()<10080*60*1e3;break;case"this-month":Ke=at.getMonth()===Xe.getMonth()&&at.getFullYear()===Xe.getFullYear();break;case"favorites":Ke=De.is_favorite===!0;break;case"failed":Ke=De.status==="failed"||De.status==="aborted";break;case"duplicates":Ke=De.duplicate_count>0;break}const It=(De.print_name||De.filename).toLowerCase().includes(o.toLowerCase()),Te=!u||De.filament_type?.split(", ").includes(u),We=De.filament_color?.split(",")||[],et=p.size===0||(y==="or"?We.some(Rt=>p.has(Rt)):[...p].every(Rt=>We.includes(Rt))),Ze=j==="favorites"||!b||De.is_favorite,Le=j==="failed"||!_||De.status!=="failed"&&De.status!=="aborted",mt=De.tags?.split(",").map(Rt=>Rt.trim())||[],st=!P||mt.includes(P),tt=Tm(De);return Ke&&It&&Te&&et&&Ze&&Le&&st&&(T==="all"||T==="gcode"&&tt||T==="source"&&!tt)}).sort((De,Xe)=>{switch(q){case"date-desc":return(Jn(Xe.created_at)?.getTime()||0)-(Jn(De.created_at)?.getTime()||0);case"date-asc":return(Jn(De.created_at)?.getTime()||0)-(Jn(Xe.created_at)?.getTime()||0);case"name-asc":return(De.print_name||De.filename).localeCompare(Xe.print_name||Xe.filename);case"name-desc":return(Xe.print_name||Xe.filename).localeCompare(De.print_name||De.filename);case"size-desc":return Xe.file_size-De.file_size;case"size-asc":return De.file_size-Xe.file_size;default:return 0}}),ht=re||L.size>0,yt=De=>{te(Xe=>{const at=new Set(Xe);return at.has(De)?at.delete(De):at.add(De),at})},Bt=()=>{qe&&te(new Set(qe.map(De=>De.id)))},Yt=()=>{te(new Set),J(!1)},xn=De=>{f(Xe=>{const at=new Set(Xe);return at.has(De)?at.delete(De):at.add(De),at})},Xt=()=>{f(new Set)},$t=()=>{l(""),d(null),m(null),v(!1),k(!1),C(null),N("all")},nn=o||c||u||b||_||P||T!=="all",on=w.useCallback(De=>{De.preventDefault(),De.dataTransfer.types.includes("Files")&&G(!0)},[]),cn=w.useCallback(De=>{De.preventDefault(),De.currentTarget===De.target&&G(!1)},[]),pn=w.useCallback(De=>{De.preventDefault(),G(!1);const Xe=Array.from(De.dataTransfer.files).filter(at=>at.name.endsWith(".3mf"));Xe.length>0?($(Xe),A(!0)):De.dataTransfer.files.length>0&&n(t("archives.page.only3mfSupported"),"warning")},[n,t]),Ie=w.useCallback(De=>{const Xe=De.target;if(Xe.tagName==="INPUT"||Xe.tagName==="TEXTAREA"||Xe.isContentEditable){De.key==="Escape"&&Xe.blur();return}switch(De.key){case"/":De.preventDefault(),s.current?.focus();break;case"u":case"U":!De.metaKey&&!De.ctrlKey&&(De.preventDefault(),A(!0));break;case"Escape":ht&&Yt();break}},[ht]);return w.useEffect(()=>(document.addEventListener("keydown",Ie),()=>document.removeEventListener("keydown",Ie)),[Ie]),i.jsxs("div",{className:"p-4 md:p-8 relative min-h-full",onDragOver:on,onDragLeave:cn,onDrop:pn,children:[U&&i.jsx("div",{className:"fixed inset-0 z-50 bg-bambu-dark/90 flex items-center justify-center pointer-events-none",children:i.jsxs("div",{className:"border-4 border-dashed border-bambu-green rounded-xl p-12 text-center",children:[i.jsx(Si,{className:"w-16 h-16 mx-auto mb-4 text-bambu-green"}),i.jsx("p",{className:"text-2xl font-semibold text-white mb-2",children:"Drop .3mf files here"}),i.jsx("p",{className:"text-bambu-gray",children:t("archives.releaseToUpload")})]})}),ht&&i.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:[i.jsxs(Fe,{variant:"secondary",size:"sm",onClick:Yt,children:[i.jsx(zt,{className:"w-4 h-4"}),"Close"]}),i.jsx("div",{className:"w-px h-6 bg-bambu-dark-tertiary"}),i.jsxs("span",{className:"text-white font-medium",children:[L.size," selected"]}),i.jsx("div",{className:"w-px h-6 bg-bambu-dark-tertiary"}),i.jsx(Fe,{variant:"secondary",size:"sm",onClick:Bt,children:"Select All"}),i.jsx("div",{className:"w-px h-6 bg-bambu-dark-tertiary"}),i.jsxs(Fe,{variant:"secondary",size:"sm",onClick:()=>X(!0),disabled:!a("archives:update_own","archives:update_all"),title:a("archives:update_own","archives:update_all")?void 0:t("archives.permission.noUpdateArchives"),children:[i.jsx(cu,{className:"w-4 h-4"}),"Tags"]}),i.jsxs(Fe,{variant:"secondary",size:"sm",onClick:()=>le(!0),disabled:!a("archives:update_own","archives:update_all"),title:a("archives:update_own","archives:update_all")?void 0:t("archives.permission.noUpdateArchives"),children:[i.jsx(fs,{className:"w-4 h-4"}),"Project"]}),i.jsxs(Fe,{variant:"secondary",size:"sm",disabled:!a("archives:update_own","archives:update_all"),title:a("archives:update_own","archives:update_all")?void 0:t("archives.permission.noUpdateArchives"),onClick:()=>{const De=Array.from(L);Promise.all(De.map(Xe=>be.toggleFavorite(Xe))).then(()=>{e.invalidateQueries({queryKey:["archives"]}),n(`Toggled favorites for ${De.length} archive${De.length!==1?"s":""}`)}).catch(()=>{n(t("archives.toast.failedUpdateFavorites"),"error")})},children:[i.jsx(qp,{className:"w-4 h-4"}),"Favorite"]}),i.jsxs(Fe,{size:"sm",className:"bg-red-500 hover:bg-red-600",onClick:()=>me(!0),disabled:!a("archives:delete_own","archives:delete_all"),title:a("archives:delete_own","archives:delete_all")?void 0:t("archives.permission.noDelete"),children:[i.jsx(Qt,{className:"w-4 h-4"}),"Delete"]})]}),i.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4 mb-8",children:[i.jsxs("div",{children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("h1",{className:"text-2xl font-bold text-white",children:"Archives"}),i.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:j,onChange:De=>E(De.target.value),children:YXe.map(De=>i.jsx("option",{value:De.id,children:De.label},De.id))})]}),i.jsxs("p",{className:"text-bambu-gray",children:[qe?.length||0," of ",Ne?.length||0," prints"]})]}),i.jsxs("div",{className:"flex items-center gap-2 sm:gap-3 flex-wrap",children:[i.jsxs("div",{className:"relative",children:[i.jsxs(Fe,{variant:"secondary",onClick:()=>W(!I),disabled:B,children:[B?i.jsx(ct,{className:"w-4 h-4 animate-spin"}):i.jsx(q1,{className:"w-4 h-4"}),"Export"]}),I&&i.jsxs("div",{className:"absolute right-0 top-full mt-1 w-48 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg shadow-xl z-20",children:[i.jsxs("button",{className:"w-full px-4 py-2 text-left text-white hover:bg-bambu-dark-tertiary transition-colors flex items-center gap-2 rounded-t-lg",onClick:async()=>{W(!1),ae(!0);try{const{blob:De,filename:Xe}=await be.exportArchives({format:"csv",printerId:c||void 0,status:j==="failed"?"failed":void 0,search:o||void 0}),at=URL.createObjectURL(De),Ke=document.createElement("a");Ke.href=at,Ke.download=Xe,Ke.click(),URL.revokeObjectURL(at),n(t("archives.toast.exportDownloaded"))}catch{n(t("archives.toast.exportFailed"),"error")}finally{ae(!1)}},children:[i.jsx(Es,{className:"w-4 h-4"}),"Export as CSV"]}),i.jsxs("button",{className:"w-full px-4 py-2 text-left text-white hover:bg-bambu-dark-tertiary transition-colors flex items-center gap-2 rounded-b-lg",onClick:async()=>{W(!1),ae(!0);try{const{blob:De,filename:Xe}=await be.exportArchives({format:"xlsx",printerId:c||void 0,status:j==="failed"?"failed":void 0,search:o||void 0}),at=URL.createObjectURL(De),Ke=document.createElement("a");Ke.href=at,Ke.download=Xe,Ke.click(),URL.revokeObjectURL(at),n(t("archives.toast.exportDownloaded"))}catch{n(t("archives.toast.exportFailed"),"error")}finally{ae(!1)}},children:[i.jsx(q1,{className:"w-4 h-4"}),"Export as Excel"]})]})]}),L.size>=2&&L.size<=5&&i.jsxs(Fe,{variant:"secondary",onClick:()=>V(!0),children:[i.jsx(mb,{className:"w-4 h-4"}),"Compare (",L.size,")"]}),!ht&&i.jsxs(Fe,{variant:"secondary",onClick:()=>J(!0),children:[i.jsx(mo,{className:"w-4 h-4"}),"Select"]}),i.jsxs(Fe,{onClick:()=>A(!0),disabled:!r("archives:create"),title:r("archives:create")?void 0:t("archives.permission.noCreate"),children:[i.jsx(Si,{className:"w-4 h-4"}),"Upload 3MF"]})]})]}),i.jsxs("div",{className:"flex items-center border border-bambu-dark-tertiary rounded-lg overflow-hidden flex-shrink-0 w-fit mb-4",children:[i.jsx("button",{className:`p-2 ${pe==="grid"?"bg-bambu-green text-white":"bg-bambu-dark text-bambu-gray hover:text-white"}`,onClick:()=>Ce("grid"),title:t("archives.gridView"),children:i.jsx(R0,{className:"w-4 h-4"})}),i.jsx("button",{className:`p-2 ${pe==="list"?"bg-bambu-green text-white":"bg-bambu-dark text-bambu-gray hover:text-white"}`,onClick:()=>Ce("list"),title:t("archives.listView"),children:i.jsx(mC,{className:"w-4 h-4"})}),i.jsx("button",{className:`p-2 ${pe==="calendar"?"bg-bambu-green text-white":"bg-bambu-dark text-bambu-gray hover:text-white"}`,onClick:()=>Ce("calendar"),title:t("archives.calendarView"),children:i.jsx(Gme,{className:"w-4 h-4"})}),i.jsx("button",{className:`p-2 ${pe==="log"?"bg-bambu-green text-white":"bg-bambu-dark text-bambu-gray hover:text-white"}`,onClick:()=>Ce("log"),title:t("archives.logView"),children:i.jsx(fhe,{className:"w-4 h-4"})})]}),pe!=="log"&&i.jsx(Tt,{className:"mb-6",children:i.jsxs(Pt,{className:"py-4",children:[i.jsxs("div",{className:"flex flex-col md:flex-row gap-3 md:gap-4 md:items-center md:flex-wrap",children:[i.jsxs("div",{className:"w-full md:flex-1 relative md:min-w-[200px]",children:[i.jsx(Dr,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray"}),i.jsx("input",{ref:s,type:"text",placeholder:t("archives.searchPlaceholder"),className:"w-full pl-10 pr-4 py-3 md:py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none",value:o,onChange:De=>l(De.target.value)})]}),i.jsxs("div",{className:"flex gap-2 md:gap-4 overflow-x-auto pb-1 md:pb-0 -mx-4 px-4 md:mx-0 md:px-0 md:flex-wrap scrollbar-hide",children:[i.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[i.jsx(dC,{className:"w-4 h-4 text-bambu-gray hidden md:block"}),i.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:c||"",onChange:De=>d(De.target.value?Number(De.target.value):null),children:[i.jsx("option",{value:"",children:"All Printers"}),ke?.map(De=>i.jsx("option",{value:De.id,children:De.name},De.id))]})]}),i.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[i.jsx(sa,{className:"w-4 h-4 text-bambu-gray hidden md:block"}),i.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:u||"",onChange:De=>m(De.target.value||null),children:[i.jsx("option",{value:"",children:"All Materials"}),St.map(De=>i.jsx("option",{value:De,children:De},De))]})]}),i.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[i.jsx($1,{className:"w-4 h-4 text-bambu-gray hidden md:block"}),i.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:T,onChange:De=>N(De.target.value),children:[i.jsx("option",{value:"all",children:"All Files"}),i.jsx("option",{value:"gcode",children:"Sliced (GCODE)"}),i.jsx("option",{value:"source",children:"Source Only"})]})]}),i.jsxs("button",{onClick:()=>v(!b),className:`flex items-center gap-2 px-3 py-2 rounded-lg border transition-colors flex-shrink-0 ${b?"bg-yellow-500/20 border-yellow-500 text-yellow-400":"bg-bambu-dark border-bambu-dark-tertiary text-bambu-gray hover:text-white"}`,title:t(b?"archives.showAll":"archives.showFavoritesOnly"),children:[i.jsx(qp,{className:`w-4 h-4 ${b?"fill-yellow-400":""}`}),i.jsx("span",{className:"text-sm hidden md:inline",children:"Favorites"})]}),i.jsxs("button",{onClick:()=>k(!_),className:`flex items-center gap-2 px-3 py-2 rounded-lg border transition-colors flex-shrink-0 ${_?"bg-red-500/20 border-red-500 text-red-400":"bg-bambu-dark border-bambu-dark-tertiary text-bambu-gray hover:text-white"}`,title:t(_?"archives.showFailedPrints":"archives.hideFailedPrints"),children:[i.jsx(Ii,{className:"w-4 h-4 "}),i.jsx("span",{className:"text-sm hidden md:inline",children:"Hide Failed"})]}),ft.length>0&&i.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[i.jsx(cu,{className:"w-4 h-4 text-bambu-gray hidden md:block"}),i.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:P||"",onChange:De=>C(De.target.value||null),children:[i.jsx("option",{value:"",children:"All Tags"}),ft.map(De=>i.jsx("option",{value:De,children:De},De))]}),i.jsx("button",{onClick:()=>K(!0),className:"p-2 rounded-lg bg-bambu-dark border border-bambu-dark-tertiary text-bambu-gray hover:text-white hover:border-bambu-green transition-colors",title:t("archives.manageTags"),children:i.jsx(bC,{className:"w-4 h-4"})})]}),i.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[i.jsx(VF,{className:"w-4 h-4 text-bambu-gray hidden md:block"}),i.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:q,onChange:De=>Z(De.target.value),children:[i.jsx("option",{value:"date-desc",children:t("archives.sortNewest")}),i.jsx("option",{value:"date-asc",children:t("archives.sortOldest")}),i.jsxs("option",{value:"name-asc",children:[t("archives.sortName")," A-Z"]}),i.jsxs("option",{value:"name-desc",children:[t("archives.sortName")," Z-A"]}),i.jsx("option",{value:"size-desc",children:t("archives.sortLargest")}),i.jsx("option",{value:"size-asc",children:t("archives.sortSmallest")})]})]})]}),nn&&i.jsxs(Fe,{variant:"ghost",size:"sm",onClick:$t,className:"text-bambu-gray hover:text-white",children:[i.jsx(zt,{className:"w-4 h-4"}),"Reset"]})]}),ot.length>0&&i.jsxs("div",{className:"flex items-center gap-3 mt-4 pt-4 border-t border-bambu-dark-tertiary",children:[i.jsx("span",{className:"text-xs text-bambu-gray",children:"Colors:"}),p.size>1&&i.jsx("button",{onClick:()=>x(De=>De==="or"?"and":"or"),className:`px-2 py-0.5 text-xs rounded transition-colors ${y==="and"?"bg-bambu-green text-white":"bg-bambu-dark-tertiary text-bambu-gray hover:text-white"}`,title:y==="or"?"Match ANY selected color":"Match ALL selected colors",children:y.toUpperCase()}),i.jsx("div",{className:"flex items-center gap-1.5 flex-wrap",children:ot.map(De=>i.jsx("button",{onClick:()=>xn(De),className:`w-6 h-6 rounded-full border-2 transition-all ${p.has(De)?"border-bambu-green scale-110":"border-white/20 hover:border-white/40"}`,style:{backgroundColor:De},title:De},De))}),p.size>0&&i.jsxs("button",{onClick:Xt,className:"text-xs text-bambu-gray hover:text-white flex items-center gap-1",children:[i.jsx(zt,{className:"w-3 h-3"}),"Clear"]})]})]})}),i.jsx(VXe,{}),Ee?i.jsx("div",{className:"text-center py-12 text-bambu-gray",children:t("archives.loadingArchives")}):qe?.length===0?i.jsx(Tt,{children:i.jsxs(Pt,{className:"text-center py-12",children:[i.jsx("p",{className:"text-bambu-gray",children:t(o?"archives.noArchivesSearch":"archives.noArchivesYet")}),i.jsx("p",{className:"text-sm text-bambu-gray mt-2",children:"Archives are created automatically when prints complete"})]})}):pe==="calendar"?i.jsx(Tt,{className:"p-6",children:i.jsx(Lqe,{archives:qe||[],onArchiveClick:De=>{l(""),Ce("grid"),se(De.id)},highlightedArchiveId:ne})}):pe==="grid"?i.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6",children:qe?.map(De=>i.jsx(WXe,{archive:De,printerName:De.printer_id?lt.get(De.printer_id)||"Unknown":De.sliced_for_model?`Sliced for ${De.sliced_for_model}`:"No Printer",isSelected:L.has(De.id),onSelect:yt,selectionMode:ht,projects:Me,isHighlighted:De.id===ne,timeFormat:Ve,preferredSlicer:je,currency:ye,t},De.id))}):pe==="list"?i.jsx(Tt,{children:i.jsxs("div",{className:"divide-y divide-bambu-dark-tertiary",children:[i.jsxs("div",{className:"grid grid-cols-12 gap-4 px-4 py-3 text-xs text-bambu-gray font-medium",children:[i.jsx("div",{className:"col-span-1"}),i.jsx("div",{className:"col-span-4",children:"Name"}),i.jsx("div",{className:"col-span-2",children:"Printer"}),i.jsx("div",{className:"col-span-2",children:"Date"}),i.jsx("div",{className:"col-span-1",children:"Size"}),i.jsx("div",{className:"col-span-2 text-right",children:"Actions"})]}),qe?.map(De=>i.jsx(KXe,{archive:De,printerName:De.printer_id?lt.get(De.printer_id)||"Unknown":De.sliced_for_model?`Sliced for ${De.sliced_for_model}`:"No Printer",isSelected:L.has(De.id),onSelect:yt,selectionMode:ht,projects:Me,isHighlighted:De.id===ne,preferredSlicer:je,t},De.id))]})}):pe==="log"?i.jsxs("div",{className:"space-y-4",children:[i.jsx(Tt,{children:i.jsx(Pt,{className:"py-3",children:i.jsxs("div",{className:"flex flex-col md:flex-row gap-3 md:items-center md:flex-wrap",children:[i.jsxs("div",{className:"flex-1 relative md:min-w-[200px]",children:[i.jsx(Dr,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray"}),i.jsx("input",{type:"text",placeholder:t("archives.searchPlaceholder"),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 text-sm",value:o,onChange:De=>{l(De.target.value),Ae(0)}})]}),i.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 text-sm",value:c||"",onChange:De=>{d(De.target.value?Number(De.target.value):null),Ae(0)},children:[i.jsx("option",{value:"",children:t("archives.log.allPrinters")}),ke?.map(De=>i.jsx("option",{value:De.id,children:De.name},De.id))]}),i.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 text-sm",value:ce||"",onChange:De=>{fe(De.target.value||null),Ae(0)},children:[i.jsx("option",{value:"",children:t("archives.log.allUsers")}),xe?.map(De=>i.jsx("option",{value:De.username,children:De.username},De.id))]}),i.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 text-sm",value:oe||"",onChange:De=>{O(De.target.value||null),Ae(0)},children:[i.jsx("option",{value:"",children:t("archives.log.allStatuses")}),i.jsx("option",{value:"completed",children:t("archives.status.completed")}),i.jsx("option",{value:"failed",children:t("archives.status.failed")}),i.jsx("option",{value:"stopped",children:t("archives.status.stopped")}),i.jsx("option",{value:"cancelled",children:t("archives.log.cancelled")}),i.jsx("option",{value:"skipped",children:t("archives.log.skipped")})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("label",{className:"text-sm text-bambu-gray",children:t("archives.log.dateFrom")}),i.jsx("input",{type:"date",className:"px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none text-sm",value:F,onChange:De=>{Q(De.target.value),Ae(0)}})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("label",{className:"text-sm text-bambu-gray",children:t("archives.log.dateTo")}),i.jsx("input",{type:"date",className:"px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none text-sm",value:ve,onChange:De=>{he(De.target.value),Ae(0)}})]}),i.jsx("div",{className:"ml-auto",children:i.jsxs(Fe,{variant:"danger",size:"sm",onClick:()=>ze(!0),disabled:!r("archives:delete_all")||Ye.isPending,children:[i.jsx(Qt,{className:"w-4 h-4"}),t("archives.log.clearLog")]})})]})})}),i.jsx(Tt,{children:Pe?i.jsx("div",{className:"flex items-center justify-center py-12",children:i.jsx(ct,{className:"w-6 h-6 animate-spin text-bambu-green"})}):He?.items.length?i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"overflow-x-auto",children:i.jsxs("table",{className:"w-full text-sm",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"border-b border-bambu-dark-tertiary text-bambu-gray text-left",children:[i.jsx("th",{className:"px-4 py-3 font-medium",children:t("archives.log.date")}),i.jsx("th",{className:"px-4 py-3 font-medium",children:t("archives.log.printName")}),i.jsx("th",{className:"px-4 py-3 font-medium",children:t("archives.log.printer")}),i.jsx("th",{className:"px-4 py-3 font-medium",children:t("archives.log.user")}),i.jsx("th",{className:"px-4 py-3 font-medium",children:t("archives.log.status")}),i.jsx("th",{className:"px-4 py-3 font-medium",children:t("archives.log.duration")}),i.jsx("th",{className:"px-4 py-3 font-medium",children:t("archives.log.filament")})]})}),i.jsx("tbody",{className:"divide-y divide-bambu-dark-tertiary",children:He.items.map(De=>i.jsxs("tr",{className:"hover:bg-bambu-dark-secondary/50",children:[i.jsx("td",{className:"px-4 py-3 text-white whitespace-nowrap",children:Wp(De.started_at||De.created_at,Ve)}),i.jsx("td",{className:"px-4 py-3",children:i.jsxs("div",{className:"flex items-center gap-2",children:[De.thumbnail_path&&i.jsx("img",{src:be.getPrintLogThumbnail(De.id),alt:"",className:"w-8 h-8 rounded object-cover flex-shrink-0",onError:Xe=>{Xe.target.style.display="none"}}),i.jsx("span",{className:"text-white truncate max-w-[200px]",children:De.print_name||"—"})]})}),i.jsx("td",{className:"px-4 py-3 text-bambu-gray-light",children:De.printer_name||"—"}),i.jsx("td",{className:"px-4 py-3 text-bambu-gray-light",children:De.created_by_username||"—"}),i.jsx("td",{className:"px-4 py-3",children:i.jsx("span",{className:`inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium ${De.status==="completed"?"bg-green-500/20 text-green-400":De.status==="failed"?"bg-red-500/20 text-red-400":De.status==="stopped"?"bg-yellow-500/20 text-yellow-400":De.status==="cancelled"?"bg-orange-500/20 text-orange-400":De.status==="skipped"?"bg-blue-500/20 text-blue-400":"bg-gray-500/20 text-gray-400"}`,children:De.status})}),i.jsx("td",{className:"px-4 py-3 text-bambu-gray-light whitespace-nowrap",children:De.duration_seconds?Ms(De.duration_seconds):"—"}),i.jsx("td",{className:"px-4 py-3",children:i.jsxs("div",{className:"flex items-center gap-1.5",children:[De.filament_color&&i.jsx("span",{className:"w-3 h-3 rounded-full border border-white/20 flex-shrink-0",style:{backgroundColor:De.filament_color.startsWith("#")?De.filament_color:void 0}}),i.jsx("span",{className:"text-bambu-gray-light text-xs",children:De.filament_type||"—"})]})})]},De.id))})]})}),i.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-t border-bambu-dark-tertiary flex-wrap gap-2",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("span",{className:"text-sm text-bambu-gray",children:t("archives.log.showing",{count:Math.min(de+Be,He.total),total:He.total})}),i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx("label",{className:"text-xs text-bambu-gray",children:t("archives.log.rowsPerPage")}),i.jsxs("select",{className:"px-2 py-1 bg-bambu-dark border border-bambu-dark-tertiary rounded text-white text-xs focus:border-bambu-green focus:outline-none",value:Be,onChange:De=>{Ue(Number(De.target.value)),Ae(0)},children:[i.jsx("option",{value:10,children:"10"}),i.jsx("option",{value:25,children:"25"}),i.jsx("option",{value:50,children:"50"}),i.jsx("option",{value:100,children:"100"})]})]})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs("span",{className:"text-sm text-bambu-gray",children:[t("archives.log.page")," ",Math.floor(de/Be)+1," / ",Math.max(1,Math.ceil(He.total/Be))]}),i.jsx(Fe,{variant:"secondary",size:"sm",onClick:()=>Ae(Math.max(0,de-Be)),disabled:de===0,children:i.jsx(ec,{className:"w-4 h-4"})}),i.jsx(Fe,{variant:"secondary",size:"sm",onClick:()=>Ae(de+Be),disabled:de+Be>=He.total,children:i.jsx(pa,{className:"w-4 h-4"})})]})]})]}):i.jsx("div",{className:"text-center py-12 text-bambu-gray",children:t("archives.log.noEntries")})})]}):null,R&&i.jsx(Tqe,{onClose:()=>{A(!1),$([])},initialFiles:D}),ue&&i.jsx(Nn,{title:t("archives.modal.deleteArchives"),message:t("archives.modal.deleteArchivesConfirm",{count:L.size}),confirmText:t("archives.modal.deleteCount",{count:L.size}),variant:"danger",onConfirm:()=>{$e.mutate(Array.from(L)),me(!1)},onCancel:()=>me(!1)}),ge&&i.jsx(Mqe,{selectedIds:Array.from(L),existingTags:ft,onClose:()=>X(!1)}),ie&&i.jsx(Eqe,{selectedIds:Array.from(L),onClose:()=>le(!1)}),z&&L.size>=2&&L.size<=5&&i.jsx(BXe,{archiveIds:Array.from(L),onClose:()=>{V(!1),te(new Set),J(!1)}}),ee&&i.jsx(GXe,{onClose:()=>K(!1)}),_e&&i.jsx(Nn,{title:t("archives.log.clearLogTitle"),message:t("archives.log.clearLogConfirm"),confirmText:t("archives.log.clearLogButton"),variant:"danger",onConfirm:()=>{Ye.mutate(),ze(!1)},onCancel:()=>ze(!1)})]})}function QXe(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return w.useMemo(()=>r=>{e.forEach(a=>a(r))},e)}const BT=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Px(t){const e=Object.prototype.toString.call(t);return e==="[object Window]"||e==="[object global]"}function _I(t){return"nodeType"in t}function fo(t){var e,n;return t?Px(t)?t:_I(t)&&(e=(n=t.ownerDocument)==null?void 0:n.defaultView)!=null?e:window:window}function kI(t){const{Document:e}=fo(t);return t instanceof e}function hw(t){return Px(t)?!1:t instanceof fo(t).HTMLElement}function nse(t){return t instanceof fo(t).SVGElement}function Ax(t){return t?Px(t)?t.document:_I(t)?kI(t)?t:hw(t)||nse(t)?t.ownerDocument:document:document:document}const Qc=BT?w.useLayoutEffect:w.useEffect;function NI(t){const e=w.useRef(t);return Qc(()=>{e.current=t}),w.useCallback(function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return e.current==null?void 0:e.current(...r)},[])}function ZXe(){const t=w.useRef(null),e=w.useCallback((r,a)=>{t.current=setInterval(r,a)},[]),n=w.useCallback(()=>{t.current!==null&&(clearInterval(t.current),t.current=null)},[]);return[e,n]}function k0(t,e){e===void 0&&(e=[t]);const n=w.useRef(t);return Qc(()=>{n.current!==t&&(n.current=t)},e),n}function pw(t,e){const n=w.useRef();return w.useMemo(()=>{const r=t(n.current);return n.current=r,r},[...e])}function JN(t){const e=NI(t),n=w.useRef(null),r=w.useCallback(a=>{a!==n.current&&e?.(a,n.current),n.current=a},[]);return[n,r]}function yF(t){const e=w.useRef();return w.useEffect(()=>{e.current=t},[t]),e.current}let Bj={};function fw(t,e){return w.useMemo(()=>{if(e)return e;const n=Bj[t]==null?0:Bj[t]+1;return Bj[t]=n,t+"-"+n},[t,e])}function rse(t){return function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];return r.reduce((s,o)=>{const l=Object.entries(o);for(const[c,d]of l){const u=s[c];u!=null&&(s[c]=u+t*d)}return s},{...e})}}const Cb=rse(1),N0=rse(-1);function JXe(t){return"clientX"in t&&"clientY"in t}function CI(t){if(!t)return!1;const{KeyboardEvent:e}=fo(t.target);return e&&t instanceof e}function eQe(t){if(!t)return!1;const{TouchEvent:e}=fo(t.target);return e&&t instanceof e}function vF(t){if(eQe(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 JXe(t)?{x:t.clientX,y:t.clientY}:null}const rx=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[rx.Translate.toString(t),rx.Scale.toString(t)].join(" ")}},Transition:{toString(t){let{property:e,duration:n,easing:r}=t;return e+" "+n+"ms "+r}}}),mK="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function tQe(t){return t.matches(mK)?t:t.querySelector(mK)}const nQe={display:"none"};function rQe(t){let{id:e,value:n}=t;return Kr.createElement("div",{id:e,style:nQe},n)}function iQe(t){let{id:e,announcement:n,ariaLiveType:r="assertive"}=t;const a={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 Kr.createElement("div",{id:e,style:a,role:"status","aria-live":r,"aria-atomic":!0},n)}function aQe(){const[t,e]=w.useState("");return{announce:w.useCallback(r=>{r!=null&&e(r)},[]),announcement:t}}const ise=w.createContext(null);function sQe(t){const e=w.useContext(ise);w.useEffect(()=>{if(!e)throw new Error("useDndMonitor must be used within a children of <DndContext>");return e(t)},[t,e])}function oQe(){const[t]=w.useState(()=>new Set),e=w.useCallback(r=>(t.add(r),()=>t.delete(r)),[t]);return[w.useCallback(r=>{let{type:a,event:s}=r;t.forEach(o=>{var l;return(l=o[a])==null?void 0:l.call(o,s)})},[t]),e]}const lQe={draggable:`
- To pick up a draggable item, press the space bar.
- While dragging, use the arrow keys to move the item.
- Press space again to drop the item in its new position, or press escape to cancel.
- `},cQe={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 dQe(t){let{announcements:e=cQe,container:n,hiddenTextDescribedById:r,screenReaderInstructions:a=lQe}=t;const{announce:s,announcement:o}=aQe(),l=fw("DndLiveRegion"),[c,d]=w.useState(!1);if(w.useEffect(()=>{d(!0)},[]),sQe(w.useMemo(()=>({onDragStart(m){let{active:p}=m;s(e.onDragStart({active:p}))},onDragMove(m){let{active:p,over:f}=m;e.onDragMove&&s(e.onDragMove({active:p,over:f}))},onDragOver(m){let{active:p,over:f}=m;s(e.onDragOver({active:p,over:f}))},onDragEnd(m){let{active:p,over:f}=m;s(e.onDragEnd({active:p,over:f}))},onDragCancel(m){let{active:p,over:f}=m;s(e.onDragCancel({active:p,over:f}))}}),[s,e])),!c)return null;const u=Kr.createElement(Kr.Fragment,null,Kr.createElement(rQe,{id:r,value:a.draggable}),Kr.createElement(iQe,{id:l,announcement:o}));return n?$d.createPortal(u,n):u}var ha;(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"})(ha||(ha={}));function eC(){}function tC(t,e){return w.useMemo(()=>({sensor:t,options:e??{}}),[t,e])}function ase(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return w.useMemo(()=>[...e].filter(r=>r!=null),[...e])}const sc=Object.freeze({x:0,y:0});function sse(t,e){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function ose(t,e){let{data:{value:n}}=t,{data:{value:r}}=e;return n-r}function uQe(t,e){let{data:{value:n}}=t,{data:{value:r}}=e;return r-n}function hK(t){let{left:e,top:n,height:r,width:a}=t;return[{x:e,y:n},{x:e+a,y:n},{x:e,y:n+r},{x:e+a,y:n+r}]}function lse(t,e){if(!t||t.length===0)return null;const[n]=t;return n[e]}function pK(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 cse=t=>{let{collisionRect:e,droppableRects:n,droppableContainers:r}=t;const a=pK(e,e.left,e.top),s=[];for(const o of r){const{id:l}=o,c=n.get(l);if(c){const d=sse(pK(c),a);s.push({id:l,data:{droppableContainer:o,value:d}})}}return s.sort(ose)},mQe=t=>{let{collisionRect:e,droppableRects:n,droppableContainers:r}=t;const a=hK(e),s=[];for(const o of r){const{id:l}=o,c=n.get(l);if(c){const d=hK(c),u=a.reduce((p,f,y)=>p+sse(d[y],f),0),m=Number((u/4).toFixed(4));s.push({id:l,data:{droppableContainer:o,value:m}})}}return s.sort(ose)};function hQe(t,e){const n=Math.max(e.top,t.top),r=Math.max(e.left,t.left),a=Math.min(e.left+e.width,t.left+t.width),s=Math.min(e.top+e.height,t.top+t.height),o=a-r,l=s-n;if(r<a&&n<s){const c=e.width*e.height,d=t.width*t.height,u=o*l,m=u/(c+d-u);return Number(m.toFixed(4))}return 0}const pQe=t=>{let{collisionRect:e,droppableRects:n,droppableContainers:r}=t;const a=[];for(const s of r){const{id:o}=s,l=n.get(o);if(l){const c=hQe(l,e);c>0&&a.push({id:o,data:{droppableContainer:s,value:c}})}}return a.sort(uQe)};function fQe(t,e,n){return{...t,scaleX:e&&n?e.width/n.width:1,scaleY:e&&n?e.height/n.height:1}}function dse(t,e){return t&&e?{x:t.left-e.left,y:t.top-e.top}:sc}function gQe(t){return function(n){for(var r=arguments.length,a=new Array(r>1?r-1:0),s=1;s<r;s++)a[s-1]=arguments[s];return a.reduce((o,l)=>({...o,top:o.top+t*l.y,bottom:o.bottom+t*l.y,left:o.left+t*l.x,right:o.right+t*l.x}),{...n})}}const bQe=gQe(1);function xQe(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 yQe(t,e,n){const r=xQe(e);if(!r)return t;const{scaleX:a,scaleY:s,x:o,y:l}=r,c=t.left-o-(1-a)*parseFloat(n),d=t.top-l-(1-s)*parseFloat(n.slice(n.indexOf(" ")+1)),u=a?t.width/a:t.width,m=s?t.height/s:t.height;return{width:u,height:m,top:d,right:c+u,bottom:d+m,left:c}}const vQe={ignoreTransform:!1};function Mx(t,e){e===void 0&&(e=vQe);let n=t.getBoundingClientRect();if(e.ignoreTransform){const{transform:d,transformOrigin:u}=fo(t).getComputedStyle(t);d&&(n=yQe(n,d,u))}const{top:r,left:a,width:s,height:o,bottom:l,right:c}=n;return{top:r,left:a,width:s,height:o,bottom:l,right:c}}function fK(t){return Mx(t,{ignoreTransform:!0})}function wQe(t){const e=t.innerWidth,n=t.innerHeight;return{top:0,left:0,right:e,bottom:n,width:e,height:n}}function SQe(t,e){return e===void 0&&(e=fo(t).getComputedStyle(t)),e.position==="fixed"}function _Qe(t,e){e===void 0&&(e=fo(t).getComputedStyle(t));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(a=>{const s=e[a];return typeof s=="string"?n.test(s):!1})}function HT(t,e){const n=[];function r(a){if(e!=null&&n.length>=e||!a)return n;if(kI(a)&&a.scrollingElement!=null&&!n.includes(a.scrollingElement))return n.push(a.scrollingElement),n;if(!hw(a)||nse(a)||n.includes(a))return n;const s=fo(t).getComputedStyle(a);return a!==t&&_Qe(a,s)&&n.push(a),SQe(a,s)?n:r(a.parentNode)}return t?r(t):n}function use(t){const[e]=HT(t,1);return e??null}function Hj(t){return!BT||!t?null:Px(t)?t:_I(t)?kI(t)||t===Ax(t).scrollingElement?window:hw(t)?t:null:null}function mse(t){return Px(t)?t.scrollX:t.scrollLeft}function hse(t){return Px(t)?t.scrollY:t.scrollTop}function wF(t){return{x:mse(t),y:hse(t)}}var ja;(function(t){t[t.Forward=1]="Forward",t[t.Backward=-1]="Backward"})(ja||(ja={}));function pse(t){return!BT||!t?!1:t===document.scrollingElement}function fse(t){const e={x:0,y:0},n=pse(t)?{height:window.innerHeight,width:window.innerWidth}:{height:t.clientHeight,width:t.clientWidth},r={x:t.scrollWidth-n.width,y:t.scrollHeight-n.height},a=t.scrollTop<=e.y,s=t.scrollLeft<=e.x,o=t.scrollTop>=r.y,l=t.scrollLeft>=r.x;return{isTop:a,isLeft:s,isBottom:o,isRight:l,maxScroll:r,minScroll:e}}const kQe={x:.2,y:.2};function NQe(t,e,n,r,a){let{top:s,left:o,right:l,bottom:c}=n;r===void 0&&(r=10),a===void 0&&(a=kQe);const{isTop:d,isBottom:u,isLeft:m,isRight:p}=fse(t),f={x:0,y:0},y={x:0,y:0},x={height:e.height*a.y,width:e.width*a.x};return!d&&s<=e.top+x.height?(f.y=ja.Backward,y.y=r*Math.abs((e.top+x.height-s)/x.height)):!u&&c>=e.bottom-x.height&&(f.y=ja.Forward,y.y=r*Math.abs((e.bottom-x.height-c)/x.height)),!p&&l>=e.right-x.width?(f.x=ja.Forward,y.x=r*Math.abs((e.right-x.width-l)/x.width)):!m&&o<=e.left+x.width&&(f.x=ja.Backward,y.x=r*Math.abs((e.left+x.width-o)/x.width)),{direction:f,speed:y}}function CQe(t){if(t===document.scrollingElement){const{innerWidth:s,innerHeight:o}=window;return{top:0,left:0,right:s,bottom:o,width:s,height:o}}const{top:e,left:n,right:r,bottom:a}=t.getBoundingClientRect();return{top:e,left:n,right:r,bottom:a,width:t.clientWidth,height:t.clientHeight}}function gse(t){return t.reduce((e,n)=>Cb(e,wF(n)),sc)}function TQe(t){return t.reduce((e,n)=>e+mse(n),0)}function PQe(t){return t.reduce((e,n)=>e+hse(n),0)}function AQe(t,e){if(e===void 0&&(e=Mx),!t)return;const{top:n,left:r,bottom:a,right:s}=e(t);use(t)&&(a<=0||s<=0||n>=window.innerHeight||r>=window.innerWidth)&&t.scrollIntoView({block:"center",inline:"center"})}const MQe=[["x",["left","right"],TQe],["y",["top","bottom"],PQe]];class TI{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 r=HT(n),a=gse(r);this.rect={...e},this.width=e.width,this.height=e.height;for(const[s,o,l]of MQe)for(const c of o)Object.defineProperty(this,c,{get:()=>{const d=l(r),u=a[s]-d;return this.rect[c]+u},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Cv{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=e}add(e,n,r){var a;(a=this.target)==null||a.addEventListener(e,n,r),this.listeners.push([e,n,r])}}function EQe(t){const{EventTarget:e}=fo(t);return t instanceof e?t:Ax(t)}function $j(t,e){const n=Math.abs(t.x),r=Math.abs(t.y);return typeof e=="number"?Math.sqrt(n**2+r**2)>e:"x"in e&&"y"in e?n>e.x&&r>e.y:"x"in e?n>e.x:"y"in e?r>e.y:!1}var ol;(function(t){t.Click="click",t.DragStart="dragstart",t.Keydown="keydown",t.ContextMenu="contextmenu",t.Resize="resize",t.SelectionChange="selectionchange",t.VisibilityChange="visibilitychange"})(ol||(ol={}));function gK(t){t.preventDefault()}function jQe(t){t.stopPropagation()}var mr;(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"})(mr||(mr={}));const bse={start:[mr.Space,mr.Enter],cancel:[mr.Esc],end:[mr.Space,mr.Enter,mr.Tab]},DQe=(t,e)=>{let{currentCoordinates:n}=e;switch(t.code){case mr.Right:return{...n,x:n.x+25};case mr.Left:return{...n,x:n.x-25};case mr.Down:return{...n,y:n.y+25};case mr.Up:return{...n,y:n.y-25}}};class $T{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 Cv(Ax(n)),this.windowListeners=new Cv(fo(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(ol.Resize,this.handleCancel),this.windowListeners.add(ol.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(ol.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:e,onStart:n}=this.props,r=e.node.current;r&&AQe(r),n(sc)}handleKeyDown(e){if(CI(e)){const{active:n,context:r,options:a}=this.props,{keyboardCodes:s=bse,coordinateGetter:o=DQe,scrollBehavior:l="smooth"}=a,{code:c}=e;if(s.end.includes(c)){this.handleEnd(e);return}if(s.cancel.includes(c)){this.handleCancel(e);return}const{collisionRect:d}=r.current,u=d?{x:d.left,y:d.top}:sc;this.referenceCoordinates||(this.referenceCoordinates=u);const m=o(e,{active:n,context:r.current,currentCoordinates:u});if(m){const p=N0(m,u),f={x:0,y:0},{scrollableAncestors:y}=r.current;for(const x of y){const b=e.code,{isTop:v,isRight:_,isLeft:k,isBottom:P,maxScroll:C,minScroll:T}=fse(x),N=CQe(x),R={x:Math.min(b===mr.Right?N.right-N.width/2:N.right,Math.max(b===mr.Right?N.left:N.left+N.width/2,m.x)),y:Math.min(b===mr.Down?N.bottom-N.height/2:N.bottom,Math.max(b===mr.Down?N.top:N.top+N.height/2,m.y))},A=b===mr.Right&&!_||b===mr.Left&&!k,D=b===mr.Down&&!P||b===mr.Up&&!v;if(A&&R.x!==m.x){const $=x.scrollLeft+p.x,U=b===mr.Right&&$<=C.x||b===mr.Left&&$>=T.x;if(U&&!p.y){x.scrollTo({left:$,behavior:l});return}U?f.x=x.scrollLeft-$:f.x=b===mr.Right?x.scrollLeft-C.x:x.scrollLeft-T.x,f.x&&x.scrollBy({left:-f.x,behavior:l});break}else if(D&&R.y!==m.y){const $=x.scrollTop+p.y,U=b===mr.Down&&$<=C.y||b===mr.Up&&$>=T.y;if(U&&!p.x){x.scrollTo({top:$,behavior:l});return}U?f.y=x.scrollTop-$:f.y=b===mr.Down?x.scrollTop-C.y:x.scrollTop-T.y,f.y&&x.scrollBy({top:-f.y,behavior:l});break}}this.handleMove(e,Cb(N0(m,this.referenceCoordinates),f))}}}handleMove(e,n){const{onMove:r}=this.props;e.preventDefault(),r(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()}}$T.activators=[{eventName:"onKeyDown",handler:(t,e,n)=>{let{keyboardCodes:r=bse,onActivation:a}=e,{active:s}=n;const{code:o}=t.nativeEvent;if(r.start.includes(o)){const l=s.activatorNode.current;return l&&t.target!==l?!1:(t.preventDefault(),a?.({event:t.nativeEvent}),!0)}return!1}}];function bK(t){return!!(t&&"distance"in t)}function xK(t){return!!(t&&"delay"in t)}class PI{constructor(e,n,r){var a;r===void 0&&(r=EQe(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:s}=e,{target:o}=s;this.props=e,this.events=n,this.document=Ax(o),this.documentListeners=new Cv(this.document),this.listeners=new Cv(r),this.windowListeners=new Cv(fo(o)),this.initialCoordinates=(a=vF(s))!=null?a:sc,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:r}}}=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(ol.Resize,this.handleCancel),this.windowListeners.add(ol.DragStart,gK),this.windowListeners.add(ol.VisibilityChange,this.handleCancel),this.windowListeners.add(ol.ContextMenu,gK),this.documentListeners.add(ol.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(xK(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(bK(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:r,onPending:a}=this.props;a(r,e,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:e}=this,{onStart:n}=this.props;e&&(this.activated=!0,this.documentListeners.add(ol.Click,jQe,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(ol.SelectionChange,this.removeTextSelection),n(e))}handleMove(e){var n;const{activated:r,initialCoordinates:a,props:s}=this,{onMove:o,options:{activationConstraint:l}}=s;if(!a)return;const c=(n=vF(e))!=null?n:sc,d=N0(a,c);if(!r&&l){if(bK(l)){if(l.tolerance!=null&&$j(d,l.tolerance))return this.handleCancel();if($j(d,l.distance))return this.handleStart()}if(xK(l)&&$j(d,l.tolerance))return this.handleCancel();this.handlePending(l,d);return}e.cancelable&&e.preventDefault(),o(c)}handleEnd(){const{onAbort:e,onEnd:n}=this.props;this.detach(),this.activated||e(this.props.active),n()}handleCancel(){const{onAbort:e,onCancel:n}=this.props;this.detach(),this.activated||e(this.props.active),n()}handleKeydown(e){e.code===mr.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}}const RQe={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class qT extends PI{constructor(e){const{event:n}=e,r=Ax(n.target);super(e,RQe,r)}}qT.activators=[{eventName:"onPointerDown",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:r}=e;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];const FQe={move:{name:"mousemove"},end:{name:"mouseup"}};var SF;(function(t){t[t.RightClick=2]="RightClick"})(SF||(SF={}));class LQe extends PI{constructor(e){super(e,FQe,Ax(e.event.target))}}LQe.activators=[{eventName:"onMouseDown",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:r}=e;return n.button===SF.RightClick?!1:(r?.({event:n}),!0)}}];const qj={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class OQe extends PI{constructor(e){super(e,qj)}static setup(){return window.addEventListener(qj.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(qj.move.name,e)};function e(){}}}OQe.activators=[{eventName:"onTouchStart",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:r}=e;const{touches:a}=n;return a.length>1?!1:(r?.({event:n}),!0)}}];var Tv;(function(t){t[t.Pointer=0]="Pointer",t[t.DraggableRect=1]="DraggableRect"})(Tv||(Tv={}));var nC;(function(t){t[t.TreeOrder=0]="TreeOrder",t[t.ReversedTreeOrder=1]="ReversedTreeOrder"})(nC||(nC={}));function IQe(t){let{acceleration:e,activator:n=Tv.Pointer,canScroll:r,draggingRect:a,enabled:s,interval:o=5,order:l=nC.TreeOrder,pointerCoordinates:c,scrollableAncestors:d,scrollableAncestorRects:u,delta:m,threshold:p}=t;const f=UQe({delta:m,disabled:!s}),[y,x]=ZXe(),b=w.useRef({x:0,y:0}),v=w.useRef({x:0,y:0}),_=w.useMemo(()=>{switch(n){case Tv.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case Tv.DraggableRect:return a}},[n,a,c]),k=w.useRef(null),P=w.useCallback(()=>{const T=k.current;if(!T)return;const N=b.current.x*v.current.x,R=b.current.y*v.current.y;T.scrollBy(N,R)},[]),C=w.useMemo(()=>l===nC.TreeOrder?[...d].reverse():d,[l,d]);w.useEffect(()=>{if(!s||!d.length||!_){x();return}for(const T of C){if(r?.(T)===!1)continue;const N=d.indexOf(T),R=u[N];if(!R)continue;const{direction:A,speed:D}=NQe(T,R,_,e,p);for(const $ of["x","y"])f[$][A[$]]||(D[$]=0,A[$]=0);if(D.x>0||D.y>0){x(),k.current=T,y(P,o),b.current=D,v.current=A;return}}b.current={x:0,y:0},v.current={x:0,y:0},x()},[e,P,r,x,s,o,JSON.stringify(_),JSON.stringify(f),y,d,C,u,JSON.stringify(p)])}const zQe={x:{[ja.Backward]:!1,[ja.Forward]:!1},y:{[ja.Backward]:!1,[ja.Forward]:!1}};function UQe(t){let{delta:e,disabled:n}=t;const r=yF(e);return pw(a=>{if(n||!r||!a)return zQe;const s={x:Math.sign(e.x-r.x),y:Math.sign(e.y-r.y)};return{x:{[ja.Backward]:a.x[ja.Backward]||s.x===-1,[ja.Forward]:a.x[ja.Forward]||s.x===1},y:{[ja.Backward]:a.y[ja.Backward]||s.y===-1,[ja.Forward]:a.y[ja.Forward]||s.y===1}}},[n,e,r])}function BQe(t,e){const n=e!=null?t.get(e):void 0,r=n?n.node.current:null;return pw(a=>{var s;return e==null?null:(s=r??a)!=null?s:null},[r,e])}function HQe(t,e){return w.useMemo(()=>t.reduce((n,r)=>{const{sensor:a}=r,s=a.activators.map(o=>({eventName:o.eventName,handler:e(o.handler,r)}));return[...n,...s]},[]),[t,e])}var C0;(function(t){t[t.Always=0]="Always",t[t.BeforeDragging=1]="BeforeDragging",t[t.WhileDragging=2]="WhileDragging"})(C0||(C0={}));var _F;(function(t){t.Optimized="optimized"})(_F||(_F={}));const yK=new Map;function $Qe(t,e){let{dragging:n,dependencies:r,config:a}=e;const[s,o]=w.useState(null),{frequency:l,measure:c,strategy:d}=a,u=w.useRef(t),m=b(),p=k0(m),f=w.useCallback(function(v){v===void 0&&(v=[]),!p.current&&o(_=>_===null?v:_.concat(v.filter(k=>!_.includes(k))))},[p]),y=w.useRef(null),x=pw(v=>{if(m&&!n)return yK;if(!v||v===yK||u.current!==t||s!=null){const _=new Map;for(let k of t){if(!k)continue;if(s&&s.length>0&&!s.includes(k.id)&&k.rect.current){_.set(k.id,k.rect.current);continue}const P=k.node.current,C=P?new TI(c(P),P):null;k.rect.current=C,C&&_.set(k.id,C)}return _}return v},[t,s,n,m,c]);return w.useEffect(()=>{u.current=t},[t]),w.useEffect(()=>{m||f()},[n,m]),w.useEffect(()=>{s&&s.length>0&&o(null)},[JSON.stringify(s)]),w.useEffect(()=>{m||typeof l!="number"||y.current!==null||(y.current=setTimeout(()=>{f(),y.current=null},l))},[l,m,f,...r]),{droppableRects:x,measureDroppableContainers:f,measuringScheduled:s!=null};function b(){switch(d){case C0.Always:return!1;case C0.BeforeDragging:return n;default:return!n}}}function xse(t,e){return pw(n=>t?n||(typeof e=="function"?e(t):t):null,[e,t])}function qQe(t,e){return xse(t,e)}function VQe(t){let{callback:e,disabled:n}=t;const r=NI(e),a=w.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:s}=window;return new s(r)},[r,n]);return w.useEffect(()=>()=>a?.disconnect(),[a]),a}function VT(t){let{callback:e,disabled:n}=t;const r=NI(e),a=w.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:s}=window;return new s(r)},[n]);return w.useEffect(()=>()=>a?.disconnect(),[a]),a}function GQe(t){return new TI(Mx(t),t)}function vK(t,e,n){e===void 0&&(e=GQe);const[r,a]=w.useState(null);function s(){a(c=>{if(!t)return null;if(t.isConnected===!1){var d;return(d=c??n)!=null?d:null}const u=e(t);return JSON.stringify(c)===JSON.stringify(u)?c:u})}const o=VQe({callback(c){if(t)for(const d of c){const{type:u,target:m}=d;if(u==="childList"&&m instanceof HTMLElement&&m.contains(t)){s();break}}}}),l=VT({callback:s});return Qc(()=>{s(),t?(l?.observe(t),o?.observe(document.body,{childList:!0,subtree:!0})):(l?.disconnect(),o?.disconnect())},[t]),r}function WQe(t){const e=xse(t);return dse(t,e)}const wK=[];function KQe(t){const e=w.useRef(t),n=pw(r=>t?r&&r!==wK&&t&&e.current&&t.parentNode===e.current.parentNode?r:HT(t):wK,[t]);return w.useEffect(()=>{e.current=t},[t]),n}function YQe(t){const[e,n]=w.useState(null),r=w.useRef(t),a=w.useCallback(s=>{const o=Hj(s.target);o&&n(l=>l?(l.set(o,wF(o)),new Map(l)):null)},[]);return w.useEffect(()=>{const s=r.current;if(t!==s){o(s);const l=t.map(c=>{const d=Hj(c);return d?(d.addEventListener("scroll",a,{passive:!0}),[d,wF(d)]):null}).filter(c=>c!=null);n(l.length?new Map(l):null),r.current=t}return()=>{o(t),o(s)};function o(l){l.forEach(c=>{const d=Hj(c);d?.removeEventListener("scroll",a)})}},[a,t]),w.useMemo(()=>t.length?e?Array.from(e.values()).reduce((s,o)=>Cb(s,o),sc):gse(t):sc,[t,e])}function SK(t,e){e===void 0&&(e=[]);const n=w.useRef(null);return w.useEffect(()=>{n.current=null},e),w.useEffect(()=>{const r=t!==sc;r&&!n.current&&(n.current=t),!r&&n.current&&(n.current=null)},[t]),n.current?N0(t,n.current):sc}function XQe(t){w.useEffect(()=>{if(!BT)return;const e=t.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of e)n?.()}},t.map(e=>{let{sensor:n}=e;return n}))}function QQe(t,e){return w.useMemo(()=>t.reduce((n,r)=>{let{eventName:a,handler:s}=r;return n[a]=o=>{s(o,e)},n},{}),[t,e])}function yse(t){return w.useMemo(()=>t?wQe(t):null,[t])}const _K=[];function ZQe(t,e){e===void 0&&(e=Mx);const[n]=t,r=yse(n?fo(n):null),[a,s]=w.useState(_K);function o(){s(()=>t.length?t.map(c=>pse(c)?r:new TI(e(c),c)):_K)}const l=VT({callback:o});return Qc(()=>{l?.disconnect(),o(),t.forEach(c=>l?.observe(c))},[t]),a}function JQe(t){if(!t)return null;if(t.children.length>1)return t;const e=t.children[0];return hw(e)?e:t}function eZe(t){let{measure:e}=t;const[n,r]=w.useState(null),a=w.useCallback(d=>{for(const{target:u}of d)if(hw(u)){r(m=>{const p=e(u);return m?{...m,width:p.width,height:p.height}:p});break}},[e]),s=VT({callback:a}),o=w.useCallback(d=>{const u=JQe(d);s?.disconnect(),u&&s?.observe(u),r(u?e(u):null)},[e,s]),[l,c]=JN(o);return w.useMemo(()=>({nodeRef:l,rect:n,setRef:c}),[n,l,c])}const tZe=[{sensor:qT,options:{}},{sensor:$T,options:{}}],nZe={current:{}},j1={draggable:{measure:fK},droppable:{measure:fK,strategy:C0.WhileDragging,frequency:_F.Optimized},dragOverlay:{measure:Mx}};class Pv 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,r;return(n=(r=this.get(e))==null?void 0:r.node.current)!=null?n:void 0}}const rZe={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Pv,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:eC},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:j1,measureDroppableContainers:eC,windowRect:null,measuringScheduled:!1},iZe={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:eC,draggableNodes:new Map,over:null,measureDroppableContainers:eC},GT=w.createContext(iZe),vse=w.createContext(rZe);function aZe(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Pv}}}function sZe(t,e){switch(e.type){case ha.DragStart:return{...t,draggable:{...t.draggable,initialCoordinates:e.initialCoordinates,active:e.active}};case ha.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 ha.DragEnd:case ha.DragCancel:return{...t,draggable:{...t.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case ha.RegisterDroppable:{const{element:n}=e,{id:r}=n,a=new Pv(t.droppable.containers);return a.set(r,n),{...t,droppable:{...t.droppable,containers:a}}}case ha.SetDroppableDisabled:{const{id:n,key:r,disabled:a}=e,s=t.droppable.containers.get(n);if(!s||r!==s.key)return t;const o=new Pv(t.droppable.containers);return o.set(n,{...s,disabled:a}),{...t,droppable:{...t.droppable,containers:o}}}case ha.UnregisterDroppable:{const{id:n,key:r}=e,a=t.droppable.containers.get(n);if(!a||r!==a.key)return t;const s=new Pv(t.droppable.containers);return s.delete(n),{...t,droppable:{...t.droppable,containers:s}}}default:return t}}function oZe(t){let{disabled:e}=t;const{active:n,activatorEvent:r,draggableNodes:a}=w.useContext(GT),s=yF(r),o=yF(n?.id);return w.useEffect(()=>{if(!e&&!r&&s&&o!=null){if(!CI(s)||document.activeElement===s.target)return;const l=a.get(o);if(!l)return;const{activatorNode:c,node:d}=l;if(!c.current&&!d.current)return;requestAnimationFrame(()=>{for(const u of[c.current,d.current]){if(!u)continue;const m=tQe(u);if(m){m.focus();break}}})}},[r,e,a,o,s]),null}function lZe(t,e){let{transform:n,...r}=e;return t!=null&&t.length?t.reduce((a,s)=>s({transform:a,...r}),n):n}function cZe(t){return w.useMemo(()=>({draggable:{...j1.draggable,...t?.draggable},droppable:{...j1.droppable,...t?.droppable},dragOverlay:{...j1.dragOverlay,...t?.dragOverlay}}),[t?.draggable,t?.droppable,t?.dragOverlay])}function dZe(t){let{activeNode:e,measure:n,initialRect:r,config:a=!0}=t;const s=w.useRef(!1),{x:o,y:l}=typeof a=="boolean"?{x:a,y:a}:a;Qc(()=>{if(!o&&!l||!e){s.current=!1;return}if(s.current||!r)return;const d=e?.node.current;if(!d||d.isConnected===!1)return;const u=n(d),m=dse(u,r);if(o||(m.x=0),l||(m.y=0),s.current=!0,Math.abs(m.x)>0||Math.abs(m.y)>0){const p=use(d);p&&p.scrollBy({top:m.y,left:m.x})}},[e,o,l,r,n])}const wse=w.createContext({...sc,scaleX:1,scaleY:1});var wm;(function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Initializing=1]="Initializing",t[t.Initialized=2]="Initialized"})(wm||(wm={}));const Sse=w.memo(function(e){var n,r,a,s;let{id:o,accessibility:l,autoScroll:c=!0,children:d,sensors:u=tZe,collisionDetection:m=pQe,measuring:p,modifiers:f,...y}=e;const x=w.useReducer(sZe,void 0,aZe),[b,v]=x,[_,k]=oQe(),[P,C]=w.useState(wm.Uninitialized),T=P===wm.Initialized,{draggable:{active:N,nodes:R,translate:A},droppable:{containers:D}}=b,$=N!=null?R.get(N):null,U=w.useRef({initial:null,translated:null}),G=w.useMemo(()=>{var Ve;return N!=null?{id:N,data:(Ve=$?.data)!=null?Ve:nZe,rect:U}:null},[N,$]),L=w.useRef(null),[te,re]=w.useState(null),[J,ue]=w.useState(null),me=k0(y,Object.values(y)),ge=fw("DndDescribedBy",o),X=w.useMemo(()=>D.getEnabled(),[D]),ie=cZe(p),{droppableRects:le,measureDroppableContainers:pe,measuringScheduled:Ce}=$Qe(X,{dragging:T,dependencies:[A.x,A.y],config:ie.droppable}),q=BQe(R,N),Z=w.useMemo(()=>J?vF(J):null,[J]),j=Pe(),E=qQe(q,ie.draggable.measure);dZe({activeNode:N!=null?R.get(N):null,config:j.layoutShiftCompensation,initialRect:E,measure:ie.draggable.measure});const I=vK(q,ie.draggable.measure,E),W=vK(q?q.parentElement:null),B=w.useRef({activatorEvent:null,active:null,activeNode:q,collisionRect:null,collisions:null,droppableRects:le,draggableNodes:R,draggingNode:null,draggingNodeRect:null,droppableContainers:D,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),ae=D.getNodeFor((n=B.current.over)==null?void 0:n.id),z=eZe({measure:ie.dragOverlay.measure}),V=(r=z.nodeRef.current)!=null?r:q,ee=T?(a=z.rect)!=null?a:I:null,K=!!(z.nodeRef.current&&z.rect),ne=WQe(K?null:I),se=yse(V?fo(V):null),ce=KQe(T?ae??q:null),fe=ZQe(ce),oe=lZe(f,{transform:{x:A.x-ne.x,y:A.y-ne.y,scaleX:1,scaleY:1},activatorEvent:J,active:G,activeNodeRect:I,containerNodeRect:W,draggingNodeRect:ee,over:B.current.over,overlayNodeRect:z.rect,scrollableAncestors:ce,scrollableAncestorRects:fe,windowRect:se}),O=Z?Cb(Z,A):null,F=YQe(ce),Q=SK(F),ve=SK(F,[I]),he=Cb(oe,Q),de=ee?bQe(ee,oe):null,Ae=G&&de?m({active:G,collisionRect:de,droppableRects:le,droppableContainers:X,pointerCoordinates:O}):null,_e=lse(Ae,"id"),[ze,Be]=w.useState(null),Ue=K?oe:Cb(oe,ve),Ne=fQe(Ue,(s=ze?.rect)!=null?s:null,I),Ee=w.useRef(null),ke=w.useCallback((Ve,je)=>{let{sensor:ye,options:$e}=je;if(L.current==null)return;const Ye=R.get(L.current);if(!Ye)return;const lt=Ve.nativeEvent,St=new ye({active:L.current,activeNode:Ye,event:lt,options:$e,context:B,onAbort(ft){if(!R.get(ft))return;const{onDragAbort:ht}=me.current,yt={id:ft};ht?.(yt),_({type:"onDragAbort",event:yt})},onPending(ft,qe,ht,yt){if(!R.get(ft))return;const{onDragPending:Yt}=me.current,xn={id:ft,constraint:qe,initialCoordinates:ht,offset:yt};Yt?.(xn),_({type:"onDragPending",event:xn})},onStart(ft){const qe=L.current;if(qe==null)return;const ht=R.get(qe);if(!ht)return;const{onDragStart:yt}=me.current,Bt={activatorEvent:lt,active:{id:qe,data:ht.data,rect:U}};$d.unstable_batchedUpdates(()=>{yt?.(Bt),C(wm.Initializing),v({type:ha.DragStart,initialCoordinates:ft,active:qe}),_({type:"onDragStart",event:Bt}),re(Ee.current),ue(lt)})},onMove(ft){v({type:ha.DragMove,coordinates:ft})},onEnd:ot(ha.DragEnd),onCancel:ot(ha.DragCancel)});Ee.current=St;function ot(ft){return async function(){const{active:ht,collisions:yt,over:Bt,scrollAdjustedTranslate:Yt}=B.current;let xn=null;if(ht&&Yt){const{cancelDrop:Xt}=me.current;xn={activatorEvent:lt,active:ht,collisions:yt,delta:Yt,over:Bt},ft===ha.DragEnd&&typeof Xt=="function"&&await Promise.resolve(Xt(xn))&&(ft=ha.DragCancel)}L.current=null,$d.unstable_batchedUpdates(()=>{v({type:ft}),C(wm.Uninitialized),Be(null),re(null),ue(null),Ee.current=null;const Xt=ft===ha.DragEnd?"onDragEnd":"onDragCancel";if(xn){const $t=me.current[Xt];$t?.(xn),_({type:Xt,event:xn})}})}}},[R]),Me=w.useCallback((Ve,je)=>(ye,$e)=>{const Ye=ye.nativeEvent,lt=R.get($e);if(L.current!==null||!lt||Ye.dndKit||Ye.defaultPrevented)return;const St={active:lt};Ve(ye,je.options,St)===!0&&(Ye.dndKit={capturedBy:je.sensor},L.current=$e,ke(ye,je))},[R,ke]),Ge=HQe(u,Me);XQe(u),Qc(()=>{I&&P===wm.Initializing&&C(wm.Initialized)},[I,P]),w.useEffect(()=>{const{onDragMove:Ve}=me.current,{active:je,activatorEvent:ye,collisions:$e,over:Ye}=B.current;if(!je||!ye)return;const lt={active:je,activatorEvent:ye,collisions:$e,delta:{x:he.x,y:he.y},over:Ye};$d.unstable_batchedUpdates(()=>{Ve?.(lt),_({type:"onDragMove",event:lt})})},[he.x,he.y]),w.useEffect(()=>{const{active:Ve,activatorEvent:je,collisions:ye,droppableContainers:$e,scrollAdjustedTranslate:Ye}=B.current;if(!Ve||L.current==null||!je||!Ye)return;const{onDragOver:lt}=me.current,St=$e.get(_e),ot=St&&St.rect.current?{id:St.id,rect:St.rect.current,data:St.data,disabled:St.disabled}:null,ft={active:Ve,activatorEvent:je,collisions:ye,delta:{x:Ye.x,y:Ye.y},over:ot};$d.unstable_batchedUpdates(()=>{Be(ot),lt?.(ft),_({type:"onDragOver",event:ft})})},[_e]),Qc(()=>{B.current={activatorEvent:J,active:G,activeNode:q,collisionRect:de,collisions:Ae,droppableRects:le,draggableNodes:R,draggingNode:V,draggingNodeRect:ee,droppableContainers:D,over:ze,scrollableAncestors:ce,scrollAdjustedTranslate:he},U.current={initial:ee,translated:de}},[G,q,Ae,de,R,V,ee,le,D,ze,ce,he]),IQe({...j,delta:A,draggingRect:de,pointerCoordinates:O,scrollableAncestors:ce,scrollableAncestorRects:fe});const xe=w.useMemo(()=>({active:G,activeNode:q,activeNodeRect:I,activatorEvent:J,collisions:Ae,containerNodeRect:W,dragOverlay:z,draggableNodes:R,droppableContainers:D,droppableRects:le,over:ze,measureDroppableContainers:pe,scrollableAncestors:ce,scrollableAncestorRects:fe,measuringConfiguration:ie,measuringScheduled:Ce,windowRect:se}),[G,q,I,J,Ae,W,z,R,D,le,ze,pe,ce,fe,ie,Ce,se]),He=w.useMemo(()=>({activatorEvent:J,activators:Ge,active:G,activeNodeRect:I,ariaDescribedById:{draggable:ge},dispatch:v,draggableNodes:R,over:ze,measureDroppableContainers:pe}),[J,Ge,G,I,v,ge,R,ze,pe]);return Kr.createElement(ise.Provider,{value:k},Kr.createElement(GT.Provider,{value:He},Kr.createElement(vse.Provider,{value:xe},Kr.createElement(wse.Provider,{value:Ne},d)),Kr.createElement(oZe,{disabled:l?.restoreFocus===!1})),Kr.createElement(dQe,{...l,hiddenTextDescribedById:ge}));function Pe(){const Ve=te?.autoScrollEnabled===!1,je=typeof c=="object"?c.enabled===!1:c===!1,ye=T&&!Ve&&!je;return typeof c=="object"?{...c,enabled:ye}:{enabled:ye}}}),uZe=w.createContext(null),kK="button",mZe="Draggable";function hZe(t){let{id:e,data:n,disabled:r=!1,attributes:a}=t;const s=fw(mZe),{activators:o,activatorEvent:l,active:c,activeNodeRect:d,ariaDescribedById:u,draggableNodes:m,over:p}=w.useContext(GT),{role:f=kK,roleDescription:y="draggable",tabIndex:x=0}=a??{},b=c?.id===e,v=w.useContext(b?wse:uZe),[_,k]=JN(),[P,C]=JN(),T=QQe(o,e),N=k0(n);Qc(()=>(m.set(e,{id:e,key:s,node:_,activatorNode:P,data:N}),()=>{const A=m.get(e);A&&A.key===s&&m.delete(e)}),[m,e]);const R=w.useMemo(()=>({role:f,tabIndex:x,"aria-disabled":r,"aria-pressed":b&&f===kK?!0:void 0,"aria-roledescription":y,"aria-describedby":u.draggable}),[r,f,x,b,y,u.draggable]);return{active:c,activatorEvent:l,activeNodeRect:d,attributes:R,isDragging:b,listeners:r?void 0:T,node:_,over:p,setNodeRef:k,setActivatorNodeRef:C,transform:v}}function pZe(){return w.useContext(vse)}const fZe="Droppable",gZe={timeout:25};function bZe(t){let{data:e,disabled:n=!1,id:r,resizeObserverConfig:a}=t;const s=fw(fZe),{active:o,dispatch:l,over:c,measureDroppableContainers:d}=w.useContext(GT),u=w.useRef({disabled:n}),m=w.useRef(!1),p=w.useRef(null),f=w.useRef(null),{disabled:y,updateMeasurementsFor:x,timeout:b}={...gZe,...a},v=k0(x??r),_=w.useCallback(()=>{if(!m.current){m.current=!0;return}f.current!=null&&clearTimeout(f.current),f.current=setTimeout(()=>{d(Array.isArray(v.current)?v.current:[v.current]),f.current=null},b)},[b]),k=VT({callback:_,disabled:y||!o}),P=w.useCallback((R,A)=>{k&&(A&&(k.unobserve(A),m.current=!1),R&&k.observe(R))},[k]),[C,T]=JN(P),N=k0(e);return w.useEffect(()=>{!k||!C.current||(k.disconnect(),m.current=!1,k.observe(C.current))},[C,k]),w.useEffect(()=>(l({type:ha.RegisterDroppable,element:{id:r,key:s,disabled:n,node:C,rect:p,data:N}}),()=>l({type:ha.UnregisterDroppable,key:s,id:r})),[r]),w.useEffect(()=>{n!==u.current.disabled&&(l({type:ha.SetDroppableDisabled,id:r,key:s,disabled:n}),u.current.disabled=n)},[r,s,n,l]),{active:o,rect:p,isOver:c?.id===r,node:C,over:c,setNodeRef:T}}function WT(t,e,n){const r=t.slice();return r.splice(n<0?r.length+n:n,0,r.splice(e,1)[0]),r}function xZe(t,e){return t.reduce((n,r,a)=>{const s=e.get(r);return s&&(n[a]=s),n},Array(t.length))}function n1(t){return t!==null&&t>=0}function yZe(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 vZe(t){return typeof t=="boolean"?{draggable:t,droppable:t}:t}const AI=t=>{let{rects:e,activeIndex:n,overIndex:r,index:a}=t;const s=WT(e,r,n),o=e[a],l=s[a];return!l||!o?null:{x:l.left-o.left,y:l.top-o.top,scaleX:l.width/o.width,scaleY:l.height/o.height}},r1={scaleX:1,scaleY:1},wZe=t=>{var e;let{activeIndex:n,activeNodeRect:r,index:a,rects:s,overIndex:o}=t;const l=(e=s[n])!=null?e:r;if(!l)return null;if(a===n){const d=s[o];return d?{x:0,y:n<o?d.top+d.height-(l.top+l.height):d.top-l.top,...r1}:null}const c=SZe(s,a,n);return a>n&&a<=o?{x:0,y:-l.height-c,...r1}:a<n&&a>=o?{x:0,y:l.height+c,...r1}:{x:0,y:0,...r1}};function SZe(t,e,n){const r=t[e],a=t[e-1],s=t[e+1];return r?n<e?a?r.top-(a.top+a.height):s?s.top-(r.top+r.height):0:s?s.top-(r.top+r.height):a?r.top-(a.top+a.height):0:0}const _se="Sortable",kse=Kr.createContext({activeIndex:-1,containerId:_se,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:AI,disabled:{draggable:!1,droppable:!1}});function Nse(t){let{children:e,id:n,items:r,strategy:a=AI,disabled:s=!1}=t;const{active:o,dragOverlay:l,droppableRects:c,over:d,measureDroppableContainers:u}=pZe(),m=fw(_se,n),p=l.rect!==null,f=w.useMemo(()=>r.map(T=>typeof T=="object"&&"id"in T?T.id:T),[r]),y=o!=null,x=o?f.indexOf(o.id):-1,b=d?f.indexOf(d.id):-1,v=w.useRef(f),_=!yZe(f,v.current),k=b!==-1&&x===-1||_,P=vZe(s);Qc(()=>{_&&y&&u(f)},[_,f,y,u]),w.useEffect(()=>{v.current=f},[f]);const C=w.useMemo(()=>({activeIndex:x,containerId:m,disabled:P,disableTransforms:k,items:f,overIndex:b,useDragOverlay:p,sortedRects:xZe(f,c),strategy:a}),[x,m,P.draggable,P.droppable,k,f,b,c,p,a]);return Kr.createElement(kse.Provider,{value:C},e)}const _Ze=t=>{let{id:e,items:n,activeIndex:r,overIndex:a}=t;return WT(n,r,a).indexOf(e)},kZe=t=>{let{containerId:e,isSorting:n,wasDragging:r,index:a,items:s,newIndex:o,previousItems:l,previousContainerId:c,transition:d}=t;return!d||!r||l!==s&&a===o?!1:n?!0:o!==a&&e===c},NZe={duration:200,easing:"ease"},Cse="transform",CZe=rx.Transition.toString({property:Cse,duration:0,easing:"linear"}),TZe={roleDescription:"sortable"};function PZe(t){let{disabled:e,index:n,node:r,rect:a}=t;const[s,o]=w.useState(null),l=w.useRef(n);return Qc(()=>{if(!e&&n!==l.current&&r.current){const c=a.current;if(c){const d=Mx(r.current,{ignoreTransform:!0}),u={x:c.left-d.left,y:c.top-d.top,scaleX:c.width/d.width,scaleY:c.height/d.height};(u.x||u.y)&&o(u)}}n!==l.current&&(l.current=n)},[e,n,r,a]),w.useEffect(()=>{s&&o(null)},[s]),s}function Tse(t){let{animateLayoutChanges:e=kZe,attributes:n,disabled:r,data:a,getNewIndex:s=_Ze,id:o,strategy:l,resizeObserverConfig:c,transition:d=NZe}=t;const{items:u,containerId:m,activeIndex:p,disabled:f,disableTransforms:y,sortedRects:x,overIndex:b,useDragOverlay:v,strategy:_}=w.useContext(kse),k=AZe(r,f),P=u.indexOf(o),C=w.useMemo(()=>({sortable:{containerId:m,index:P,items:u},...a}),[m,a,P,u]),T=w.useMemo(()=>u.slice(u.indexOf(o)),[u,o]),{rect:N,node:R,isOver:A,setNodeRef:D}=bZe({id:o,data:C,disabled:k.droppable,resizeObserverConfig:{updateMeasurementsFor:T,...c}}),{active:$,activatorEvent:U,activeNodeRect:G,attributes:L,setNodeRef:te,listeners:re,isDragging:J,over:ue,setActivatorNodeRef:me,transform:ge}=hZe({id:o,data:C,attributes:{...TZe,...n},disabled:k.draggable}),X=QXe(D,te),ie=!!$,le=ie&&!y&&n1(p)&&n1(b),pe=!v&&J,Ce=pe&&le?ge:null,Z=le?Ce??(l??_)({rects:x,activeNodeRect:G,activeIndex:p,overIndex:b,index:P}):null,j=n1(p)&&n1(b)?s({id:o,items:u,activeIndex:p,overIndex:b}):P,E=$?.id,I=w.useRef({activeId:E,items:u,newIndex:j,containerId:m}),W=u!==I.current.items,B=e({active:$,containerId:m,isDragging:J,isSorting:ie,id:o,index:P,items:u,newIndex:I.current.newIndex,previousItems:I.current.items,previousContainerId:I.current.containerId,transition:d,wasDragging:I.current.activeId!=null}),ae=PZe({disabled:!B,index:P,node:R,rect:N});return w.useEffect(()=>{ie&&I.current.newIndex!==j&&(I.current.newIndex=j),m!==I.current.containerId&&(I.current.containerId=m),u!==I.current.items&&(I.current.items=u)},[ie,j,m,u]),w.useEffect(()=>{if(E===I.current.activeId)return;if(E!=null&&I.current.activeId==null){I.current.activeId=E;return}const V=setTimeout(()=>{I.current.activeId=E},50);return()=>clearTimeout(V)},[E]),{active:$,activeIndex:p,attributes:L,data:C,rect:N,index:P,newIndex:j,items:u,isOver:A,isSorting:ie,isDragging:J,listeners:re,node:R,overIndex:b,over:ue,setNodeRef:X,setActivatorNodeRef:me,setDroppableNodeRef:D,setDraggableNodeRef:te,transform:ae??Z,transition:z()};function z(){if(ae||W&&I.current.newIndex===P)return CZe;if(!(pe&&!CI(U)||!d)&&(ie||B))return rx.Transition.toString({...d,property:Cse})}}function AZe(t,e){var n,r;return typeof t=="boolean"?{draggable:t,droppable:!1}:{draggable:(n=t?.draggable)!=null?n:e.draggable,droppable:(r=t?.droppable)!=null?r:e.droppable}}function rC(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 MZe=[mr.Down,mr.Right,mr.Up,mr.Left],Pse=(t,e)=>{let{context:{active:n,collisionRect:r,droppableRects:a,droppableContainers:s,over:o,scrollableAncestors:l}}=e;if(MZe.includes(t.code)){if(t.preventDefault(),!n||!r)return;const c=[];s.getEnabled().forEach(m=>{if(!m||m!=null&&m.disabled)return;const p=a.get(m.id);if(p)switch(t.code){case mr.Down:r.top<p.top&&c.push(m);break;case mr.Up:r.top>p.top&&c.push(m);break;case mr.Left:r.left>p.left&&c.push(m);break;case mr.Right:r.left<p.left&&c.push(m);break}});const d=mQe({collisionRect:r,droppableRects:a,droppableContainers:c});let u=lse(d,"id");if(u===o?.id&&d.length>1&&(u=d[1].id),u!=null){const m=s.get(n.id),p=s.get(u),f=p?a.get(p.id):null,y=p?.node.current;if(y&&f&&m&&p){const b=HT(y).some((T,N)=>l[N]!==T),v=Ase(m,p),_=EZe(m,p),k=b||!v?{x:0,y:0}:{x:_?r.width-f.width:0,y:_?r.height-f.height:0},P={x:f.left,y:f.top};return k.x&&k.y?P:N0(P,k)}}}};function Ase(t,e){return!rC(t)||!rC(e)?!1:t.data.current.sortable.containerId===e.data.current.sortable.containerId}function EZe(t,e){return!rC(t)||!rC(e)||!Ase(t,e)?!1:t.data.current.sortable.index<e.data.current.sortable.index}function Mse(t,e=!1){return e&&t>=1e3?`${(t/1e3).toFixed(1)}kg`:`${Math.round(t)}g`}function jZe({status:t,waitingReason:e,printerState:n,t:r}){if(t==="pending"&&e)return i.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-medium border text-purple-400 bg-purple-400/10 border-purple-400/20",children:[i.jsx(er,{className:"w-3.5 h-3.5"}),r("queue.status.waiting")]});if(t==="printing"&&n==="PAUSE")return i.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-medium border text-yellow-400 bg-yellow-400/10 border-yellow-400/20",children:[i.jsx(pC,{className:"w-3.5 h-3.5"}),r("queue.status.paused")]});const a={pending:{icon:er,color:"text-status-warning bg-status-warning/10 border-status-warning/20",label:r("queue.status.pending")},printing:{icon:co,color:"text-blue-400 bg-blue-400/10 border-blue-400/20",label:r("queue.status.printing")},completed:{icon:fr,color:"text-status-ok bg-status-ok/10 border-status-ok/20",label:r("queue.status.completed")},failed:{icon:qi,color:"text-status-error bg-status-error/10 border-status-error/20",label:r("queue.status.failed")},skipped:{icon:YF,color:"text-orange-400 bg-orange-400/10 border-orange-400/20",label:r("queue.status.skipped")},cancelled:{icon:zt,color:"text-gray-400 bg-gray-400/10 border-gray-400/20",label:r("queue.status.cancelled")}},{icon:s,color:o,label:l}=a[t];return i.jsxs("span",{className:`inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-medium border ${o}`,children:[i.jsx(s,{className:"w-3.5 h-3.5"}),l]})}function DZe({selectedCount:t,printers:e,onSave:n,onClose:r,isSaving:a,canControlPrinter:s,t:o}){const[l,c]=w.useState("unchanged"),[d,u]=w.useState("unchanged"),[m,p]=w.useState("unchanged"),[f,y]=w.useState("unchanged"),[x,b]=w.useState("unchanged"),[v,_]=w.useState("unchanged"),[k,P]=w.useState("unchanged"),[C,T]=w.useState("unchanged"),[N,R]=w.useState("unchanged"),[A,D]=w.useState("unchanged"),$=()=>{const G={};l!=="unchanged"&&(G.printer_id=l),d!=="unchanged"&&(G.manual_start=d),m!=="unchanged"&&(G.auto_off_after=m),f!=="unchanged"&&(G.require_previous_success=f),x!=="unchanged"&&(G.bed_levelling=x),v!=="unchanged"&&(G.flow_cali=v),k!=="unchanged"&&(G.vibration_cali=k),C!=="unchanged"&&(G.layer_inspect=C),N!=="unchanged"&&(G.timelapse=N),A!=="unchanged"&&(G.use_ams=A),n(G)},U=l!=="unchanged"||d!=="unchanged"||m!=="unchanged"||f!=="unchanged"||x!=="unchanged"||v!=="unchanged"||k!=="unchanged"||C!=="unchanged"||N!=="unchanged"||A!=="unchanged";return i.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm",children:i.jsxs("div",{className:"bg-bambu-dark-secondary rounded-xl border border-bambu-dark-tertiary w-full max-w-lg max-h-[90vh] overflow-y-auto",children:[i.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-bambu-dark-tertiary",children:[i.jsx("h2",{className:"text-lg font-semibold text-white",children:o("queue.bulkEdit.title",{count:t})}),i.jsx("button",{onClick:r,className:"p-1 hover:bg-bambu-dark rounded",children:i.jsx(zt,{className:"w-5 h-5 text-bambu-gray"})})]}),i.jsxs("div",{className:"p-4 space-y-4",children:[i.jsx("p",{className:"text-sm text-bambu-gray",children:o("queue.bulkEdit.description")}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-white mb-2",children:o("queue.bulkEdit.printer")}),i.jsxs("select",{value:l===null?"null":l==="unchanged"?"unchanged":String(l),onChange:G=>{const L=G.target.value;c(L==="unchanged"?"unchanged":L==="null"?null:Number(L))},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:[i.jsx("option",{value:"unchanged",children:o("queue.bulkEdit.noChange")}),i.jsx("option",{value:"null",children:o("queue.filter.unassigned")}),e.map(G=>i.jsx("option",{value:G.id,children:G.name},G.id))]})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-white mb-2",children:o("queue.bulkEdit.queueOptions")}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(Fd,{label:o("queue.bulkEdit.staged"),value:d,onChange:u,t:o}),i.jsx(Fd,{label:o("queue.bulkEdit.autoPowerOff"),value:m,onChange:p,disabled:!s,t:o}),i.jsx(Fd,{label:o("queue.bulkEdit.requirePrevious"),value:f,onChange:y,t:o})]})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-white mb-2",children:o("queue.bulkEdit.printOptions")}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(Fd,{label:o("queue.bulkEdit.bedLevelling"),value:x,onChange:b,t:o}),i.jsx(Fd,{label:o("queue.bulkEdit.flowCalibration"),value:v,onChange:_,t:o}),i.jsx(Fd,{label:o("queue.bulkEdit.vibrationCalibration"),value:k,onChange:P,t:o}),i.jsx(Fd,{label:o("queue.bulkEdit.layerInspection"),value:C,onChange:T,t:o}),i.jsx(Fd,{label:o("queue.bulkEdit.timelapse"),value:N,onChange:R,t:o}),i.jsx(Fd,{label:o("queue.bulkEdit.useAms"),value:A,onChange:D,t:o})]})]})]}),i.jsxs("div",{className:"flex justify-end gap-3 p-4 border-t border-bambu-dark-tertiary",children:[i.jsx(Fe,{variant:"secondary",onClick:r,children:o("common.cancel")}),i.jsx(Fe,{onClick:$,disabled:!U||a,children:o(a?"common.saving":"queue.bulkEdit.applyChanges")})]})]})})}function Fd({label:t,value:e,onChange:n,disabled:r,t:a}){return i.jsxs("div",{className:`flex items-center justify-between py-1 ${r?"opacity-50":""}`,children:[i.jsx("span",{className:"text-sm text-bambu-gray",children:t}),i.jsxs("div",{className:"flex items-center gap-1 bg-bambu-dark rounded-lg p-0.5",children:[i.jsx("button",{onClick:()=>n("unchanged"),disabled:r,className:`px-2 py-1 text-xs rounded ${e==="unchanged"?"bg-bambu-dark-tertiary text-white":"text-bambu-gray hover:text-white"} disabled:cursor-not-allowed`,children:"—"}),i.jsx("button",{onClick:()=>n(!1),disabled:r,className:`px-2 py-1 text-xs rounded ${e===!1?"bg-red-500/20 text-red-400":"text-bambu-gray hover:text-white"} disabled:cursor-not-allowed`,children:a("common.off")}),i.jsx("button",{onClick:()=>n(!0),disabled:r,className:`px-2 py-1 text-xs rounded ${e===!0?"bg-bambu-green/20 text-bambu-green":"text-bambu-gray hover:text-white"} disabled:cursor-not-allowed`,children:a("common.on")})]})]})}function Vj({item:t,position:e,onEdit:n,onCancel:r,onRemove:a,onStop:s,onRequeue:o,onStart:l,timeFormat:c="system",isSelected:d=!1,onToggleSelect:u,hasPermission:m,canModify:p,printerState:f,t:y}){const{data:x}=Je({queryKey:["printerStatus",t.printer_id],queryFn:()=>be.getPrinterStatus(t.printer_id),refetchInterval:3e4,enabled:t.printer_id!=null&&f==="printing"}),b=!!t.library_file_id&&!t.archive_id,{data:v}=Je({queryKey:["archive-plates",t.archive_id],queryFn:()=>be.getArchivePlates(t.archive_id),enabled:!!t.archive_id&&!b}),{data:_}=Je({queryKey:["library-file-plates",t.library_file_id],queryFn:()=>be.getLibraryFilePlates(t.library_file_id),enabled:b&&!!t.library_file_id}),k=b?_:v,P=k?.plates??[],C=m("queue:reorder"),{attributes:T,listeners:N,setNodeRef:R,transform:A,transition:D,isDragging:$}=Tse({id:t.id,disabled:t.status!=="pending"||!C}),U={transform:rx.Transform.toString(A),transition:D},G=t.status==="printing",L=t.status==="pending",te=["completed","failed","skipped","cancelled"].includes(t.status),re=L&&u;return i.jsxs("div",{ref:R,style:U,className:`
- group relative bg-bambu-dark-secondary rounded-xl border transition-all duration-200
- ${$?"opacity-50 scale-[1.02] shadow-xl z-50":""}
- ${G?"border-blue-500/30 bg-gradient-to-r from-blue-500/5 to-transparent":""}
- ${d&&re?"sm:border-bambu-dark-tertiary border-bambu-green/40":""}
- ${!d&&!G?"border-bambu-dark-tertiary hover:border-bambu-dark-tertiary/80":""}
- ${re?"sm:cursor-default":""}
- `,onClick:re?()=>{window.innerWidth<640&&u()}:void 0,children:[re&&d&&i.jsx("div",{className:"sm:hidden absolute left-0 top-3 bottom-3 w-1 rounded-full bg-bambu-green"}),i.jsxs("div",{className:"flex items-start sm:items-center gap-2 sm:gap-4 p-3 sm:p-4",children:[L&&u&&i.jsx("button",{onClick:J=>{J.stopPropagation(),u()},className:`hidden sm:flex items-center justify-center w-6 h-6 rounded border transition-colors shrink-0 ${d?"bg-bambu-green border-bambu-green text-white":"border-white/30 bg-black/30 hover:border-bambu-green/50"}`,children:d&&i.jsx(Vr,{className:"w-4 h-4"})}),L?i.jsx("div",{...T,...N,className:"hidden sm:flex items-center justify-center w-8 h-8 rounded-lg bg-bambu-dark cursor-grab active:cursor-grabbing hover:bg-bambu-dark-tertiary transition-colors touch-manipulation shrink-0",children:i.jsx(qm,{className:"w-4 h-4 text-bambu-gray"})}):e!==void 0?i.jsxs("div",{className:"hidden sm:flex items-center justify-center w-8 h-8 rounded-lg bg-bambu-dark text-bambu-gray text-sm font-medium shrink-0",children:["#",e]}):i.jsx("div",{className:"hidden sm:block w-8 shrink-0"}),i.jsx("div",{className:"w-10 h-10 sm:w-14 sm:h-14 flex-shrink-0 bg-bambu-dark rounded-lg overflow-hidden",children:t.archive_thumbnail?i.jsx("img",{src:t.plate_id!=null?be.getArchivePlateThumbnail(t.archive_id,t.plate_id):be.getArchiveThumbnail(t.archive_id),alt:"",className:"w-full h-full object-cover"}):t.library_file_thumbnail?i.jsx("img",{src:t.plate_id!=null?be.getLibraryFilePlateThumbnail(t.library_file_id,t.plate_id):be.getLibraryFileThumbnailUrl(t.library_file_id),alt:"",className:"w-full h-full object-cover"}):i.jsx("div",{className:"w-full h-full flex items-center justify-center text-bambu-gray",children:i.jsx(Vi,{className:"w-5 h-5 sm:w-6 sm:h-6"})})}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[i.jsxs("p",{className:"text-sm sm:text-base text-white font-medium truncate",children:[t.archive_name||t.library_file_name||`File #${t.archive_id||t.library_file_id}`,(k?.is_multi_plate??!1)&&t.plate_id!==void 0&&t.plate_id!==null&&` • ${P.find(J=>J.index===t.plate_id)?.name||y("queue.plateNumber",{index:t.plate_id})}`]}),t.archive_id?i.jsx(Js,{to:`/archives?highlight=${t.archive_id}`,className:"text-bambu-gray hover:text-bambu-green transition-colors flex-shrink-0",title:y("queue.viewArchive"),children:i.jsx(ei,{className:"w-3.5 h-3.5"})}):t.library_file_id?i.jsx(Js,{to:`/library?highlight=${t.library_file_id}`,className:"text-bambu-gray hover:text-bambu-green transition-colors flex-shrink-0",title:y("queue.viewInFileManager"),children:i.jsx(ei,{className:"w-3.5 h-3.5"})}):null]}),i.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 text-xs sm:text-sm text-bambu-gray",children:[i.jsxs("span",{className:`flex items-center gap-1 sm:gap-1.5 ${t.printer_id===null&&!t.target_model?"text-orange-400":""} ${t.target_model?"text-blue-400":""}`,children:[i.jsx(kr,{className:"w-3 h-3 sm:w-3.5 sm:h-3.5"}),i.jsx("span",{className:"truncate max-w-[120px] sm:max-w-none",children:t.target_model?`${y("queue.filter.any")} ${t.target_model}${t.target_location?` @ ${t.target_location}`:""}${t.required_filament_types?.length?` (${t.required_filament_types.join(", ")})`:""}`:t.printer_id===null?y("queue.filter.unassigned"):t.printer_name||`${y("common.printer")} #${t.printer_id}`})]}),t.print_time_seconds&&i.jsxs("span",{className:"flex items-center gap-1 sm:gap-1.5",children:[i.jsx(qd,{className:"w-3 h-3 sm:w-3.5 sm:h-3.5"}),Ms(t.print_time_seconds)]}),t.filament_used_grams&&i.jsxs("span",{className:"flex items-center gap-1 sm:gap-1.5",children:[i.jsx(nX,{className:"w-3 h-3 sm:w-3.5 sm:h-3.5"}),Mse(t.filament_used_grams)]}),t.created_by_username&&i.jsxs("span",{className:"hidden sm:flex items-center gap-1.5",title:y("queue.addedBy",{name:t.created_by_username}),children:[i.jsx(du,{className:"w-3.5 h-3.5"}),t.created_by_username]}),L&&!t.manual_start&&i.jsxs("span",{className:"flex items-center gap-1.5",children:[i.jsx(er,{className:"w-3.5 h-3.5"}),t.scheduled_time?(Jn(t.scheduled_time)?.getTime()??0)-Date.now()<-6e4?y?.("queue.time.overdue")??"Overdue":zv(t.scheduled_time,c,y):y?.("queue.time.asap")??"ASAP"]})]}),i.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 sm:gap-2 mt-1.5 sm:mt-2",children:[t.manual_start&&i.jsxs("span",{className:"text-[10px] sm:text-xs px-1.5 sm:px-2 py-0.5 bg-purple-500/10 text-purple-400 rounded-full border border-purple-500/20 flex items-center gap-1",children:[i.jsx(WY,{className:"w-2.5 h-2.5 sm:w-3 sm:h-3"}),y("queue.badges.staged")]}),t.require_previous_success&&i.jsx("span",{className:"text-[10px] sm:text-xs px-1.5 sm:px-2 py-0.5 bg-orange-500/10 text-orange-400 rounded-full border border-orange-500/20",children:y("queue.badges.requiresPrevious")}),t.auto_off_after&&i.jsxs("span",{className:"text-[10px] sm:text-xs px-1.5 sm:px-2 py-0.5 bg-blue-500/10 text-blue-400 rounded-full border border-blue-500/20 flex items-center gap-1",children:[i.jsx(wu,{className:"w-2.5 h-2.5 sm:w-3 sm:h-3"}),y("queue.badges.autoPowerOff")]})]}),G&&x&&i.jsxs("div",{className:"mt-2 sm:mt-3",children:[i.jsxs("div",{className:"flex items-center justify-between text-xs sm:text-sm",children:[i.jsx("div",{className:"flex-1 bg-bambu-dark-tertiary rounded-full h-1.5 sm:h-2 mr-3",children:i.jsx("div",{className:"bg-bambu-green h-1.5 sm:h-2 rounded-full transition-all",style:{width:`${x.progress||0}%`}})}),i.jsxs("span",{className:"text-white",children:[Math.round(x.progress||0),"%"]})]}),i.jsxs("div",{className:"flex flex-wrap items-center gap-2 sm:gap-3 mt-1.5 sm:mt-2 text-[10px] sm:text-xs text-bambu-gray",children:[x.remaining_time!=null&&x.remaining_time>0&&i.jsxs(i.Fragment,{children:[i.jsxs("span",{className:"flex items-center gap-1",children:[i.jsx(er,{className:"w-3 h-3"}),Ms(x.remaining_time*60)]}),i.jsxs("span",{className:"text-bambu-green font-medium",title:y("printers.estimatedCompletion"),children:["ETA ",eL(x.remaining_time,c,y)]})]}),x.layer_num!=null&&x.total_layers!=null&&x.total_layers>0&&i.jsxs("span",{className:"flex items-center gap-1",children:[i.jsx(Vi,{className:"w-3 h-3"}),x.layer_num,"/",x.total_layers]})]})]}),t.waiting_reason&&t.status==="pending"&&i.jsxs("p",{className:"text-[10px] sm:text-xs text-purple-400 mt-1.5 sm:mt-2 flex items-start gap-1",children:[i.jsx(Ii,{className:"w-3 h-3 mt-0.5 flex-shrink-0"}),i.jsx("span",{children:t.waiting_reason})]}),t.error_message&&i.jsxs("p",{className:"text-[10px] sm:text-xs text-red-400 mt-1.5 sm:mt-2 flex items-center gap-1",children:[i.jsx(Ii,{className:"w-3 h-3"}),t.error_message]})]}),i.jsxs("div",{className:"flex flex-col sm:flex-row items-end sm:items-center gap-2 sm:gap-1 shrink-0",onClick:J=>J.stopPropagation(),children:[i.jsx(jZe,{status:t.status,waitingReason:t.waiting_reason,printerState:f,t:y}),i.jsxs("div",{className:"flex items-center gap-0.5 sm:gap-1",children:[G&&i.jsx(Fe,{variant:"ghost",size:"sm",onClick:s,disabled:!m("printers:control"),title:m("printers:control")?y("queue.actions.stopPrint"):y("queue.permissions.noStopPrint"),className:"text-red-400 hover:text-red-300 hover:bg-red-500/10 p-1.5 sm:p-2",children:i.jsx(uhe,{className:"w-4 h-4"})}),L&&i.jsxs(i.Fragment,{children:[t.manual_start&&i.jsx(Fe,{variant:"ghost",size:"sm",onClick:l,disabled:!m("printers:control"),title:m("printers:control")?y("queue.actions.startPrint"):y("queue.permissions.noStartPrint"),className:"text-bambu-green hover:text-bambu-green-light hover:bg-bambu-green/10 p-1.5 sm:p-2",children:i.jsx(co,{className:"w-4 h-4"})}),i.jsx(Fe,{variant:"ghost",size:"sm",onClick:n,disabled:!p("queue","update",t.created_by_id),title:p("queue","update",t.created_by_id)?y("common.edit"):y("queue.permissions.noEdit"),className:"p-1.5 sm:p-2",children:i.jsx(Wi,{className:"w-4 h-4"})}),i.jsx(Fe,{variant:"ghost",size:"sm",onClick:r,disabled:!p("queue","delete",t.created_by_id),title:p("queue","delete",t.created_by_id)?y("common.cancel"):y("queue.permissions.noCancel"),className:"text-red-400 hover:text-red-300 hover:bg-red-500/10 p-1.5 sm:p-2",children:i.jsx(zt,{className:"w-4 h-4"})})]}),te&&i.jsxs(i.Fragment,{children:[i.jsx(Fe,{variant:"ghost",size:"sm",onClick:o,disabled:!m("queue:create"),title:m("queue:create")?y("queue.actions.requeue"):y("queue.permissions.noRequeue"),className:"text-bambu-green hover:text-bambu-green/80 hover:bg-bambu-green/10 p-1.5 sm:p-2",children:i.jsx(_r,{className:"w-4 h-4"})}),i.jsx(Fe,{variant:"ghost",size:"sm",onClick:a,disabled:!p("queue","delete",t.created_by_id),title:p("queue","delete",t.created_by_id)?y("common.remove"):y("queue.permissions.noRemove"),className:"p-1.5 sm:p-2",children:i.jsx(Qt,{className:"w-4 h-4"})})]})]})]})]})]})}function RZe(){const{t}=Mt(),e=tn(),{showToast:n}=bn(),{hasPermission:r,hasAnyPermission:a,canModify:s}=Rr(),[o,l]=w.useState(null),[c,d]=w.useState(""),[u,m]=w.useState(""),[p,f]=w.useState(!1),[y,x]=w.useState(null),[b,v]=w.useState(null),[_,k]=w.useState(null),[P,C]=w.useState([]),[T,N]=w.useState(!1),[R,A]=w.useState(()=>localStorage.getItem("queue.historySortBy")||"date"),[D,$]=w.useState(()=>{const O=localStorage.getItem("queue.historySortAsc");return O!==null?O==="true":!1}),[U,G]=w.useState(()=>localStorage.getItem("queue.pendingSortBy")||"position"),[L,te]=w.useState(()=>{const O=localStorage.getItem("queue.pendingSortAsc");return O!==null?O==="true":!0});w.useEffect(()=>{localStorage.setItem("queue.historySortBy",R)},[R]),w.useEffect(()=>{localStorage.setItem("queue.historySortAsc",String(D))},[D]),w.useEffect(()=>{localStorage.setItem("queue.pendingSortBy",U)},[U]),w.useEffect(()=>{localStorage.setItem("queue.pendingSortAsc",String(L))},[L]);const re=ase(tC(qT,{activationConstraint:{distance:8}}),tC($T,{coordinateGetter:Pse})),{data:J}=Je({queryKey:["settings"],queryFn:be.getSettings}),ue=J?.time_format||"system",{data:me,isLoading:ge}=Je({queryKey:["queue",o,c],queryFn:()=>be.getQueue(o||void 0,c||void 0),refetchInterval:5e3}),{data:X}=Je({queryKey:["printers"],queryFn:()=>be.getPrinters()}),ie=ut({mutationFn:O=>be.cancelQueueItem(O),onSuccess:()=>{e.invalidateQueries({queryKey:["queue"]}),n(t("queue.toast.cancelled"))},onError:()=>n(t("queue.toast.cancelFailed"),"error")}),le=ut({mutationFn:O=>be.removeFromQueue(O),onSuccess:()=>{e.invalidateQueries({queryKey:["queue"]}),n(t("queue.toast.removed"))},onError:()=>n(t("queue.toast.removeFailed"),"error")}),pe=ut({mutationFn:O=>be.stopQueueItem(O),onSuccess:()=>{e.invalidateQueries({queryKey:["queue"]}),n(t("queue.toast.stopped"))},onError:()=>n(t("queue.toast.stopFailed"),"error")}),Ce=ut({mutationFn:O=>be.startQueueItem(O),onSuccess:()=>{e.invalidateQueries({queryKey:["queue"]}),n(t("queue.toast.released"))},onError:()=>n(t("queue.toast.startFailed"),"error")}),q=ut({mutationFn:O=>be.reorderQueue(O),onSuccess:()=>{e.invalidateQueries({queryKey:["queue"]})},onError:()=>n(t("queue.toast.reorderFailed"),"error")}),Z=ut({mutationFn:async()=>{const O=me?.filter(F=>["completed","failed","skipped","cancelled"].includes(F.status))||[];for(const F of O)await be.removeFromQueue(F.id);return O.length},onSuccess:O=>{e.invalidateQueries({queryKey:["queue"]}),n(t("queue.toast.historyCleared",{count:O}))},onError:()=>n(t("queue.toast.clearHistoryFailed"),"error")}),j=ut({mutationFn:O=>be.bulkUpdateQueue(O),onSuccess:O=>{e.invalidateQueries({queryKey:["queue"]}),C([]),N(!1),n(O.message)},onError:()=>n(t("queue.toast.updateFailed"),"error")}),E=ut({mutationFn:async O=>{for(const F of O)await be.cancelQueueItem(F);return O.length},onSuccess:O=>{e.invalidateQueries({queryKey:["queue"]}),C([]),n(t("queue.toast.bulkCancelled",{count:O}))},onError:()=>n(t("queue.toast.bulkCancelFailed"),"error")}),I=O=>{C(F=>F.includes(O)?F.filter(Q=>Q!==O):[...F,O])},W=w.useMemo(()=>{const O=new Set;return X?.forEach(F=>{F.location&&O.add(F.location)}),me?.forEach(F=>{F.target_location&&O.add(F.target_location)}),Array.from(O).sort()},[X,me]),B=w.useCallback(O=>u?O.target_location?O.target_location===u:O.printer_id?X?.find(Q=>Q.id===O.printer_id)?.location===u:!1:!0,[u,X]),ae=w.useMemo(()=>{let O=me?.filter(Q=>Q.status==="pending")||[];u&&(O=O.filter(B));const F=Q=>{if(!Q.scheduled_time)return 0;const ve=Jn(Q.scheduled_time)?.getTime()??0,he=Date.now()+4320*60*60*1e3;return ve>he?0:ve};return[...O].sort((Q,ve)=>{let he;if(U==="name"){const de=Q.archive_name||Q.library_file_name||"",Ae=ve.archive_name||ve.library_file_name||"";he=de.localeCompare(Ae)}else U==="printer"?he=(Q.printer_name||"").localeCompare(ve.printer_name||""):U==="time"?he=F(Q)-F(ve):he=Q.position-ve.position;return L?he:-he})},[me,U,L,B,u]),z=()=>{const O=ae.map(F=>F.id);P.length===O.length?C([]):C(O)},V=w.useMemo(()=>{let O=me?.filter(F=>F.status==="printing")||[];return u&&(O=O.filter(B)),O},[me,u,B]),ee=w.useMemo(()=>{const O=new Set;return V.forEach(F=>{F.printer_id&&O.add(F.printer_id)}),Array.from(O)},[V]),K=gf({queries:ee.map(O=>({queryKey:["printerStatus",O],queryFn:()=>be.getPrinterStatus(O),refetchInterval:5e3}))}),ne=w.useMemo(()=>{const O={};return ee.forEach((F,Q)=>{const ve=K[Q];ve?.data?.state&&(O[F]=ve.data.state)}),O},[ee,K]),se=w.useMemo(()=>{let O=me?.filter(F=>["completed","failed","skipped","cancelled"].includes(F.status))||[];return u&&(O=O.filter(B)),[...O].sort((F,Q)=>{let ve;if(R==="name"){const he=F.archive_name||F.library_file_name||"",de=Q.archive_name||Q.library_file_name||"";ve=he.localeCompare(de)}else R==="printer"?ve=(F.printer_name||"").localeCompare(Q.printer_name||""):ve=(Jn(Q.completed_at||Q.created_at)?.getTime()??0)-(Jn(F.completed_at||F.created_at)?.getTime()??0);return D?-ve:ve})},[me,R,D,B,u]),ce=w.useMemo(()=>ae.reduce((O,F)=>O+(F.print_time_seconds||0),0),[ae]),fe=w.useMemo(()=>ae.reduce((O,F)=>O+(F.filament_used_grams||0),0),[ae]),oe=O=>{const{active:F,over:Q}=O;if(!Q||F.id===Q.id)return;const ve=ae.findIndex(de=>de.id===F.id),he=ae.findIndex(de=>de.id===Q.id);if(ve!==-1&&he!==-1){const Ae=WT(ae,ve,he).map((_e,ze)=>({id:_e.id,position:ze+1}));q.mutate(Ae)}};return i.jsxs("div",{className:"p-4 md:p-8",children:[i.jsx("div",{className:"flex items-center justify-between mb-8",children:i.jsxs("div",{children:[i.jsxs("h1",{className:"text-2xl font-bold text-white flex items-center gap-3",children:[i.jsx(KY,{className:"w-7 h-7 text-bambu-green"}),t("queue.title")]}),i.jsx("p",{className:"text-bambu-gray mt-1",children:t("queue.subtitle")})]})}),i.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-5 gap-2 sm:gap-3 lg:gap-4 mb-8",children:[i.jsx(Tt,{className:"bg-gradient-to-br from-blue-500/10 to-transparent border-blue-500/20",children:i.jsx(Pt,{className:"p-3 sm:p-4",children:i.jsxs("div",{className:"flex items-center gap-2 sm:gap-3",children:[i.jsx("div",{className:"w-8 h-8 sm:w-10 sm:h-10 rounded-lg bg-blue-500/20 flex items-center justify-center shrink-0",children:i.jsx(co,{className:"w-4 h-4 sm:w-5 sm:h-5 text-blue-400"})}),i.jsxs("div",{className:"min-w-0",children:[i.jsx("p",{className:"text-xl sm:text-2xl font-bold text-white truncate",children:V.length}),i.jsx("p",{className:"text-xs sm:text-sm text-bambu-gray truncate",children:t("queue.summary.printing")})]})]})})}),i.jsx(Tt,{className:"bg-gradient-to-br from-yellow-500/10 to-transparent border-yellow-500/20",children:i.jsx(Pt,{className:"p-3 sm:p-4",children:i.jsxs("div",{className:"flex items-center gap-2 sm:gap-3",children:[i.jsx("div",{className:"w-8 h-8 sm:w-10 sm:h-10 rounded-lg bg-yellow-500/20 flex items-center justify-center shrink-0",children:i.jsx(er,{className:"w-4 h-4 sm:w-5 sm:h-5 text-yellow-400"})}),i.jsxs("div",{className:"min-w-0",children:[i.jsx("p",{className:"text-xl sm:text-2xl font-bold text-white truncate",children:ae.length}),i.jsx("p",{className:"text-xs sm:text-sm text-bambu-gray truncate",children:t("queue.summary.queued")})]})]})})}),i.jsx(Tt,{className:"bg-gradient-to-br from-bambu-green/10 to-transparent border-bambu-green/20",children:i.jsx(Pt,{className:"p-3 sm:p-4",children:i.jsxs("div",{className:"flex items-center gap-2 sm:gap-3",children:[i.jsx("div",{className:"w-8 h-8 sm:w-10 sm:h-10 rounded-lg bg-bambu-green/20 flex items-center justify-center shrink-0",children:i.jsx(qd,{className:"w-4 h-4 sm:w-5 sm:h-5 text-bambu-green"})}),i.jsxs("div",{className:"min-w-0",children:[i.jsx("p",{className:"text-xl sm:text-2xl font-bold text-white truncate",children:Ms(ce)}),i.jsx("p",{className:"text-xs sm:text-sm text-bambu-gray truncate",children:t("queue.summary.totalTime")})]})]})})}),i.jsx(Tt,{className:"bg-gradient-to-br from-purple-500/10 to-transparent border-purple-500/20",children:i.jsx(Pt,{className:"p-3 sm:p-4",children:i.jsxs("div",{className:"flex items-center gap-2 sm:gap-3",children:[i.jsx("div",{className:"w-8 h-8 sm:w-10 sm:h-10 rounded-lg bg-purple-500/20 flex items-center justify-center shrink-0",children:i.jsx(nX,{className:"w-4 h-4 sm:w-5 sm:h-5 text-purple-500"})}),i.jsxs("div",{className:"min-w-0",children:[i.jsx("p",{className:"text-xl sm:text-2xl font-bold text-white truncate",children:Mse(fe)}),i.jsx("p",{className:"text-xs sm:text-sm text-bambu-gray truncate",children:t("queue.summary.totalWeight")})]})]})})}),i.jsx(Tt,{className:"col-span-2 sm:col-span-1 bg-gradient-to-br from-gray-500/10 to-transparent border-gray-500/20",children:i.jsx(Pt,{className:"p-3 sm:p-4",children:i.jsxs("div",{className:"flex items-center gap-2 sm:gap-3",children:[i.jsx("div",{className:"w-8 h-8 sm:w-10 sm:h-10 rounded-lg bg-gray-500/20 flex items-center justify-center shrink-0",children:i.jsx(fr,{className:"w-4 h-4 sm:w-5 sm:h-5 text-gray-400"})}),i.jsxs("div",{className:"min-w-0",children:[i.jsx("p",{className:"text-xl sm:text-2xl font-bold text-white truncate",children:se.length}),i.jsx("p",{className:"text-xs sm:text-sm text-bambu-gray truncate",children:t("queue.summary.history")})]})]})})})]}),i.jsxs("div",{className:"flex flex-wrap items-center gap-2 sm:gap-4 mb-6",children:[i.jsxs("select",{className:"px-2 sm:px-3 py-2 text-sm sm:text-base bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none min-w-0 flex-1 sm:flex-none",value:o===-1?"unassigned":o||"",onChange:O=>{const F=O.target.value;l(F==="unassigned"?-1:F===""?null:Number(F))},children:[i.jsx("option",{value:"",children:t("queue.filter.allPrinters")}),i.jsx("option",{value:"unassigned",children:t("queue.filter.unassigned")}),X?.map(O=>i.jsx("option",{value:O.id,children:O.name},O.id))]}),i.jsxs("select",{className:"px-2 sm:px-3 py-2 text-sm sm:text-base bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none min-w-0 flex-1 sm:flex-none",value:c,onChange:O=>d(O.target.value),children:[i.jsx("option",{value:"",children:t("queue.filter.allStatus")}),i.jsx("option",{value:"pending",children:t("queue.status.pending")}),i.jsx("option",{value:"printing",children:t("queue.status.printing")}),i.jsx("option",{value:"completed",children:t("queue.status.completed")}),i.jsx("option",{value:"failed",children:t("queue.status.failed")}),i.jsx("option",{value:"skipped",children:t("queue.status.skipped")}),i.jsx("option",{value:"cancelled",children:t("queue.status.cancelled")})]}),W.length>0&&i.jsxs("select",{className:"px-2 sm:px-3 py-2 text-sm sm:text-base bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none min-w-0 flex-1 sm:flex-none",value:u,onChange:O=>m(O.target.value),children:[i.jsx("option",{value:"",children:t("queue.filter.allLocations")}),W.map(O=>i.jsx("option",{value:O,children:O},O))]}),i.jsx("div",{className:"hidden sm:block flex-1"}),se.length>0&&i.jsxs(Fe,{className:"w-full sm:w-auto",variant:"secondary",size:"sm",onClick:()=>f(!0),disabled:!r("queue:delete_all"),title:r("queue:delete_all")?void 0:t("queue.permissions.noClearHistory"),children:[i.jsx(Qt,{className:"w-4 h-4"}),t("queue.clearHistory")]})]}),ge?i.jsx("div",{className:"text-center py-12 text-bambu-gray",children:t("common.loading")}):me?.length===0?i.jsxs(Tt,{className:"p-12 text-center border-dashed",children:[i.jsx(Xr,{className:"w-16 h-16 text-bambu-gray mx-auto mb-4 opacity-50"}),i.jsx("h3",{className:"text-xl font-medium text-white mb-2",children:t("queue.empty.title")}),i.jsx("p",{className:"text-bambu-gray max-w-md mx-auto",children:t("queue.empty.description")})]}):i.jsxs("div",{className:"space-y-6 sm:space-y-8",children:[V.length>0&&i.jsxs("div",{children:[i.jsxs("h2",{className:"text-base sm:text-lg font-semibold text-white mb-3 sm:mb-4 flex items-center gap-2",children:[i.jsx("div",{className:"w-2 h-2 rounded-full bg-blue-400 animate-pulse"}),t("queue.sections.currentlyPrinting")]}),i.jsx("div",{className:"space-y-2 sm:space-y-3",children:V.map(O=>i.jsx(Vj,{item:O,onEdit:()=>{},onCancel:()=>{},onRemove:()=>{},onStop:()=>k({type:"stop",item:O}),onRequeue:()=>{},onStart:()=>{},timeFormat:ue,hasPermission:r,canModify:s,printerState:O.printer_id?ne[O.printer_id]:null,t},O.id))})]}),ae.length>0&&i.jsxs("div",{children:[i.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 mb-3 sm:mb-4",children:[i.jsxs("h2",{className:"text-base sm:text-lg font-semibold text-white flex items-center gap-2",children:[i.jsx(er,{className:"w-4 h-4 sm:w-5 sm:h-5 text-yellow-400"}),t("queue.sections.queued"),i.jsxs("span",{className:"text-xs sm:text-sm font-normal text-bambu-gray",children:["(",t("queue.itemCount",{count:ae.length}),")"]}),i.jsx("span",{className:"hidden sm:inline text-xs text-bambu-gray ml-2",title:t("queue.reorderHint"),children:t("queue.dragToReorder")})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs("select",{className:"px-2 sm:px-3 py-1.5 text-xs sm:text-sm bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none",value:U,onChange:O=>G(O.target.value),children:[i.jsx("option",{value:"position",children:t("queue.sort.byPosition")}),i.jsx("option",{value:"name",children:t("queue.sort.byName")}),i.jsx("option",{value:"printer",children:t("queue.sort.byPrinter")}),i.jsx("option",{value:"time",children:t("queue.sort.bySchedule")})]}),i.jsx(Fe,{variant:"ghost",size:"sm",onClick:()=>te(!L),title:t(L?"common.ascending":"common.descending"),className:"px-2",children:L?i.jsx(Hp,{className:"w-4 h-4"}):i.jsx(Pb,{className:"w-4 h-4"})})]})]}),i.jsxs("div",{className:"flex flex-wrap items-center gap-2 sm:gap-3 mb-3 sm:mb-4 p-2 sm:p-3 bg-bambu-dark rounded-lg",children:[i.jsxs(Fe,{variant:"ghost",size:"sm",onClick:z,className:"flex items-center gap-1.5 sm:gap-2 text-xs sm:text-sm",children:[P.length===ae.length&&ae.length>0?i.jsx(mo,{className:"w-4 h-4 text-bambu-green"}):i.jsx(Sl,{className:"w-4 h-4"}),P.length===ae.length&&ae.length>0?t("queue.bulkEdit.deselectAll"):t("queue.bulkEdit.selectAll")]}),P.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"text-xs sm:text-sm text-bambu-gray",children:t("queue.bulkEdit.selected",{count:P.length})}),i.jsx("div",{className:"hidden sm:block h-4 w-px bg-bambu-dark-tertiary"}),i.jsxs(Fe,{variant:"ghost",size:"sm",onClick:()=>N(!0),className:"flex items-center gap-1.5 sm:gap-2 text-xs sm:text-sm text-bambu-green hover:text-bambu-green-light",disabled:!a("queue:update_own","queue:update_all"),title:a("queue:update_own","queue:update_all")?t("queue.bulkEdit.editSelected"):t("queue.permissions.noEditItems"),children:[i.jsx(Wi,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4"}),i.jsx("span",{className:"hidden sm:inline",children:t("queue.bulkEdit.editSelected")})]}),i.jsxs(Fe,{variant:"ghost",size:"sm",onClick:()=>E.mutate(P),className:"flex items-center gap-1.5 sm:gap-2 text-xs sm:text-sm text-red-400 hover:text-red-300",disabled:E.isPending||!a("queue:delete_own","queue:delete_all"),title:a("queue:delete_own","queue:delete_all")?t("queue.bulkEdit.cancelSelected"):t("queue.permissions.noCancelItems"),children:[i.jsx(zt,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4"}),i.jsx("span",{className:"hidden sm:inline",children:t("queue.bulkEdit.cancelSelected")})]})]})]}),i.jsx(Sse,{sensors:re,collisionDetection:cse,onDragEnd:oe,children:i.jsx(Nse,{items:ae.map(O=>O.id),strategy:wZe,children:i.jsx("div",{className:"space-y-2 sm:space-y-3",children:ae.map((O,F)=>i.jsx(Vj,{item:O,position:F+1,onEdit:()=>x(O),onCancel:()=>k({type:"cancel",item:O}),onRemove:()=>{},onStop:()=>{},onRequeue:()=>{},onStart:()=>Ce.mutate(O.id),timeFormat:ue,isSelected:P.includes(O.id),onToggleSelect:()=>I(O.id),hasPermission:r,canModify:s,t},O.id))})})})]}),se.length>0&&i.jsxs("div",{children:[i.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 mb-3 sm:mb-4",children:[i.jsxs("h2",{className:"text-base sm:text-lg font-semibold text-white flex items-center gap-2",children:[i.jsx(fr,{className:"w-4 h-4 sm:w-5 sm:h-5 text-bambu-gray"}),t("queue.sections.history"),i.jsxs("span",{className:"text-xs sm:text-sm font-normal text-bambu-gray",children:["(",t("queue.itemCount",{count:se.length}),")"]})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs("select",{className:"px-2 sm:px-3 py-1.5 text-xs sm:text-sm bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none",value:R,onChange:O=>A(O.target.value),children:[i.jsx("option",{value:"date",children:t("queue.sort.byDate")}),i.jsx("option",{value:"name",children:t("queue.sort.byName")}),i.jsx("option",{value:"printer",children:t("queue.sort.byPrinter")})]}),i.jsx(Fe,{variant:"ghost",size:"sm",onClick:()=>$(!D),title:t(D?"queue.sort.ascendingOldest":"queue.sort.descendingNewest"),className:"px-2",children:D?i.jsx(Hp,{className:"w-4 h-4"}):i.jsx(Pb,{className:"w-4 h-4"})})]})]}),i.jsx("div",{className:"space-y-2 sm:space-y-3",children:se.slice(0,20).map((O,F)=>i.jsx(Vj,{item:O,position:F+1,onEdit:()=>{},onCancel:()=>{},onRemove:()=>k({type:"remove",item:O}),onStop:()=>{},onRequeue:()=>v(O),onStart:()=>{},timeFormat:ue,hasPermission:r,canModify:s,t},O.id))})]})]}),y&&i.jsx($c,{mode:"edit-queue-item",archiveId:y.archive_id??void 0,libraryFileId:y.library_file_id??void 0,archiveName:y.archive_name||y.library_file_name||`File #${y.archive_id||y.library_file_id}`,queueItem:y,onClose:()=>x(null)}),b&&i.jsx($c,{mode:"add-to-queue",archiveId:b.archive_id??void 0,libraryFileId:b.library_file_id??void 0,archiveName:b.archive_name||b.library_file_name||`File #${b.archive_id||b.library_file_id}`,onClose:()=>v(null)}),_&&i.jsx(Nn,{title:_.type==="cancel"?t("queue.confirm.cancelTitle"):_.type==="stop"?t("queue.confirm.stopTitle"):t("queue.confirm.removeTitle"),message:_.type==="cancel"?t("queue.confirm.cancelMessage",{name:_.item.archive_name||_.item.library_file_name||t("queue.confirm.thisPrint")}):_.type==="stop"?t("queue.confirm.stopMessage",{name:_.item.archive_name||_.item.library_file_name||t("queue.confirm.thisPrint")}):t("queue.confirm.removeMessage",{name:_.item.archive_name||_.item.library_file_name||t("queue.confirm.thisItem")}),confirmText:_.type==="cancel"?t("queue.confirm.cancelButton"):_.type==="stop"?t("queue.confirm.stopButton"):t("common.remove"),variant:"danger",onConfirm:()=>{_.type==="cancel"?ie.mutate(_.item.id):_.type==="stop"?pe.mutate(_.item.id):le.mutate(_.item.id),k(null)},onCancel:()=>k(null)}),p&&i.jsx(Nn,{title:t("queue.confirm.clearHistoryTitle"),message:t("queue.confirm.clearHistoryMessage",{count:se.length}),confirmText:t("queue.clearHistory"),variant:"danger",onConfirm:()=>{Z.mutate(),f(!1)},onCancel:()=>f(!1)}),T&&i.jsx(DZe,{selectedCount:P.length,printers:X?.map(O=>({id:O.id,name:O.name}))||[],onSave:O=>{Object.keys(O).length>0&&j.mutate({item_ids:P,...O})},onClose:()=>N(!1),isSaving:j.isPending,canControlPrinter:r("printers:control"),t})]})}function FZe({printDates:t,months:e=3}){const n=w.useRef(null),[r,a]=w.useState(0);w.useEffect(()=>{const _=n.current;if(!_)return;const k=new ResizeObserver(P=>{const C=P[0]?.contentRect.width||0;a(C)});return k.observe(_),()=>k.disconnect()},[]);const{weeks:s,monthLabels:o,printCounts:l}=w.useMemo(()=>{const _={};t.forEach($=>{const U=$.split("T")[0];_[U]=(_[U]||0)+1});const k=new Date,P=new Date(k);P.setMonth(P.getMonth()-e),P.setDate(P.getDate()-P.getDay());const C=[],T=[];let N=[],R=-1;const A=new Date(P);let D=0;for(;A<=k;)A.getDay()===0&&N.length>0&&(C.push(N),N=[],D++),A.getMonth()!==R&&(T.push({month:A.toLocaleDateString("en-US",{month:"short"}),weekIndex:D}),R=A.getMonth()),N.push(new Date(A)),A.setDate(A.getDate()+1);return N.length>0&&C.push(N),{weeks:C,monthLabels:T,printCounts:_}},[t,e]),c=Math.max(1,...Object.values(l)),d=_=>{if(_===0)return"bg-bambu-dark";const k=_/c;return k<=.25?"bg-bambu-green/30":k<=.5?"bg-bambu-green/50":k<=.75?"bg-bambu-green/75":"bg-bambu-green"},u=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],m=s.length,p=32,f=2,y=r-p-16,x=m>0?Math.floor((y-(m-1)*f)/m):12,b=Math.max(8,Math.min(20,x)),v=b<=10?10:12;return i.jsx("div",{ref:n,className:"w-full flex justify-center",children:r>0&&i.jsxs("div",{children:[i.jsx("div",{className:"flex mb-1",style:{marginLeft:p+4},children:o.map(({month:_,weekIndex:k},P)=>i.jsx("div",{className:"text-bambu-gray",style:{fontSize:v,marginLeft:P===0?0:`${(k-(o[P-1]?.weekIndex||0))*(b+f)-24}px`},children:_},P))}),i.jsxs("div",{className:"flex",style:{gap:f},children:[i.jsx("div",{className:"flex flex-col",style:{gap:f,marginRight:4,width:p},children:u.map((_,k)=>i.jsx("div",{className:"text-bambu-gray flex items-center",style:{width:p,height:b,fontSize:v,visibility:k%2===1?"visible":"hidden"},children:_},_))}),s.map((_,k)=>i.jsx("div",{className:"flex flex-col",style:{gap:f},children:[0,1,2,3,4,5,6].map(P=>{const C=_.find(A=>A.getDay()===P);if(!C)return i.jsx("div",{style:{width:b,height:b}},P);const T=C.toISOString().split("T")[0],N=l[T]||0,R=T===new Date().toISOString().split("T")[0];return i.jsx("div",{className:`rounded-sm ${d(N)} ${R?"ring-1 ring-white":""}`,style:{width:b,height:b},title:`${C.toLocaleDateString()}: ${N} print${N!==1?"s":""}`},P)})},k))]}),i.jsxs("div",{className:"flex items-center gap-2 mt-3 text-bambu-gray",style:{fontSize:v},children:[i.jsx("span",{children:"Less"}),i.jsxs("div",{className:"flex",style:{gap:f},children:[i.jsx("div",{className:"rounded-sm bg-bambu-dark",style:{width:b,height:b}}),i.jsx("div",{className:"rounded-sm bg-bambu-green/30",style:{width:b,height:b}}),i.jsx("div",{className:"rounded-sm bg-bambu-green/50",style:{width:b,height:b}}),i.jsx("div",{className:"rounded-sm bg-bambu-green/75",style:{width:b,height:b}}),i.jsx("div",{className:"rounded-sm bg-bambu-green",style:{width:b,height:b}})]}),i.jsx("span",{children:"More"})]})]})})}const NK=["weight","prints","time"];function iC({value:t,onChange:e,exclude:n}){const{t:r}=Mt(),a={weight:r("stats.filamentByWeight"),prints:r("stats.filamentByPrints"),time:r("stats.filamentByTime")},s=n?NK.filter(o=>!n.includes(o)):NK;return i.jsx("div",{className:"flex gap-0.5 bg-bambu-dark rounded-lg p-0.5",children:s.map(o=>i.jsx("button",{onClick:()=>e(o),className:`px-2 py-0.5 text-xs rounded-md transition-colors ${t===o?"bg-bambu-green text-white":"text-bambu-gray hover:text-white"}`,children:a[o]},o))})}function Am(t){if(t>=1e6){const e=t/1e6;return`${e%1===0?e.toFixed(0):e.toFixed(1)}t`}if(t>=1e3){const e=t/1e3;return`${e%1===0?e.toFixed(0):e.toFixed(1)}kg`}return`${Math.round(t)}g`}const i1=["#00ae42","#3b82f6","#f59e0b","#ef4444","#8b5cf6","#ec4899","#14b8a6","#f97316"],LZe=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],CK=["12am","1am","2am","3am","4am","5am","6am","7am","8am","9am","10am","11am","12pm","1pm","2pm","3pm","4pm","5pm","6pm","7pm","8pm","9pm","10pm","11pm"];function OZe({archives:t,currency:e="$",dateFrom:n,dateTo:r}){const{t:a}=Mt(),[s,o]=w.useState("weight"),[l,c]=w.useState("weight"),d=w.useMemo(()=>{const R=new Map;return t.forEach(A=>{const D=Jn(A.completed_at||A.created_at)||new Date,$=`${D.getFullYear()}-${String(D.getMonth()+1).padStart(2,"0")}-${String(D.getDate()).padStart(2,"0")}`,U=R.get($)||{date:$,filament:0,cost:0,prints:0};U.filament+=A.filament_used_grams||0,U.cost+=A.cost||0,U.prints+=A.quantity||1,R.set($,U)}),Array.from(R.values()).sort((A,D)=>A.date.localeCompare(D.date)).map(A=>({...A,dateLabel:new Date(A.date).toLocaleDateString("en-US",{month:"short",day:"numeric"})}))},[t]),u=w.useMemo(()=>{if(n&&r)return Math.max((new Date(r).getTime()-new Date(n).getTime())/864e5,0)+1;if(n)return Math.max((Date.now()-new Date(n).getTime())/864e5,0)+1;if(t.length<2)return 0;const R=t.map(A=>new Date(A.completed_at||A.created_at).getTime());return(Math.max(...R)-Math.min(...R))/864e5},[t,n,r]),m=w.useMemo(()=>{if(u>7)return[];const R=new Map,A=u>1;return t.forEach(D=>{const $=Jn(D.completed_at||D.created_at)||new Date,U=$.getHours(),G=`${$.getFullYear()}-${String($.getMonth()+1).padStart(2,"0")}-${String($.getDate()).padStart(2,"0")}T${String(U).padStart(2,"0")}`,L=R.get(G)||{date:G,filament:0,cost:0,prints:0};L.filament+=D.filament_used_grams||0,L.cost+=D.cost||0,L.prints+=D.quantity||1,R.set(G,L)}),Array.from(R.values()).sort((D,$)=>D.date.localeCompare($.date)).map(D=>{const[$,U]=D.date.split("T"),G=new Date($),L=parseInt(U,10),te=A?`${LZe[G.getDay()]} ${CK[L]}`:CK[L];return{...D,dateLabel:te}})},[t,u]),p=w.useMemo(()=>{if(d.length<=60)return d;const R=new Map;return d.forEach(A=>{const D=new Date(A.date),$=new Date(D);$.setDate(D.getDate()-D.getDay());const U=`${$.getFullYear()}-${String($.getMonth()+1).padStart(2,"0")}-${String($.getDate()).padStart(2,"0")}`,G=R.get(U)||{week:U,filament:0,cost:0,prints:0};G.filament+=A.filament,G.cost+=A.cost,G.prints+=A.prints,R.set(U,G)}),Array.from(R.values()).sort((A,D)=>A.week.localeCompare(D.week)).map(A=>({date:A.week,dateLabel:`Week of ${new Date(A.week).toLocaleDateString("en-US",{month:"short",day:"numeric"})}`,...A}))},[d]),f=w.useMemo(()=>{const R=new Map;return t.forEach(A=>{const $=(A.filament_type||"Unknown").split(", ");$.forEach(U=>{const G=(A.filament_used_grams||0)/$.length;R.set(U,(R.get(U)||0)+G)})}),Array.from(R.entries()).map(([A,D])=>({name:A,value:Math.round(D)})).sort((A,D)=>D.value-A.value)},[t]),y=w.useMemo(()=>{const R=new Map;return t.forEach(A=>{(A.filament_type||"Unknown").split(", ").forEach(U=>{R.set(U,(R.get(U)||0)+1)})}),Array.from(R.entries()).map(([A,D])=>({name:A,value:D})).sort((A,D)=>D.value-A.value)},[t]),x=w.useMemo(()=>{const R=new Map;return t.forEach(A=>{const $=(A.filament_type||"Unknown").split(", "),U=(A.actual_time_seconds||A.print_time_seconds||0)/$.length;$.forEach(G=>{R.set(G,(R.get(G)||0)+U)})}),Array.from(R.entries()).map(([A,D])=>({name:A,value:Math.round(D/3600*10)/10})).sort((A,D)=>D.value-A.value)},[t]),b=w.useMemo(()=>{const R=new Map;return t.forEach(A=>{if(A.status!=="completed"&&A.status!=="failed")return;(A.filament_type||"Unknown").split(", ").forEach($=>{const U=R.get($)||{completed:0,failed:0};A.status==="completed"?U.completed++:U.failed++,R.set($,U)})}),Array.from(R.entries()).filter(([,A])=>A.completed+A.failed>=2).map(([A,D])=>{const $=D.completed+D.failed,U=Math.round(D.completed/$*100);return{name:A,rate:U,total:$}}).sort((A,D)=>D.rate-A.rate)},[t]),v=w.useMemo(()=>{const R=new Map;return t.forEach(A=>{if(!A.filament_color)return;const D=A.filament_color.split(",").map(U=>U.trim()),$=(A.filament_used_grams||0)/D.length;D.forEach(U=>{const G=R.get(U)||{count:0,weight:0};G.count++,G.weight+=$,R.set(U,G)})}),Array.from(R.entries()).map(([A,D])=>({hex:A,value:l==="prints"?D.count:Math.round(D.weight)})).sort((A,D)=>D.value-A.value)},[t,l]),_=s==="weight"?f:s==="prints"?y:x,k=u<=7&&m.length>0?m:p,P=t.reduce((R,A)=>R+(A.filament_used_grams||0),0),C=t.reduce((R,A)=>R+(A.cost||0),0),T=t.reduce((R,A)=>R+(A.quantity||1),0),N=new Set(t.map(R=>R.printer_id).filter(Boolean)).size;return i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"grid grid-cols-3 gap-2 max-[640px]:grid-cols-1",children:[i.jsxs("div",{className:"bg-bambu-dark rounded-lg p-4",children:[i.jsxs("div",{className:"flex items-center justify-between gap-2",children:[i.jsx("p",{className:"text-sm text-bambu-gray leading-none",children:a("stats.periodFilament")}),i.jsx("p",{className:"text-2xl font-bold text-white leading-none",children:Am(P)})]}),i.jsxs("p",{className:"text-xs text-bambu-gray",children:[N," ",a("nav.printers").toLowerCase()]})]}),i.jsxs("div",{className:"bg-bambu-dark rounded-lg p-4",children:[i.jsxs("div",{className:"flex items-center justify-between gap-2",children:[i.jsx("p",{className:"text-sm text-bambu-gray leading-none",children:a("stats.periodCost")}),i.jsxs("p",{className:"text-2xl font-bold text-white leading-none",children:[e,C.toFixed(2)]})]}),i.jsxs("p",{className:"text-xs text-bambu-gray",children:[T," ",a("common.prints")]})]}),i.jsxs("div",{className:"bg-bambu-dark rounded-lg p-4",children:[i.jsxs("div",{className:"flex items-center justify-between gap-2",children:[i.jsx("p",{className:"text-sm text-bambu-gray leading-none",children:a("stats.avgPerPrint")}),i.jsxs("p",{className:"text-2xl font-bold text-white leading-none",children:[T>0?(P/T).toFixed(0):0,"g"]})]}),i.jsxs("p",{className:"text-xs text-bambu-gray",children:[e,T>0?(C/T).toFixed(2):"0.00"," avg"]})]})]}),k.length>0?i.jsxs("div",{className:"bg-bambu-dark rounded-lg p-4",children:[i.jsx("h4",{className:"text-sm font-medium text-bambu-gray mb-4",children:a("stats.usageOverTime")}),i.jsx(Fm,{width:"100%",height:250,children:i.jsxs(I$e,{data:k,children:[i.jsx("defs",{children:i.jsxs("linearGradient",{id:"colorFilament",x1:"0",y1:"0",x2:"0",y2:"1",children:[i.jsx("stop",{offset:"5%",stopColor:"#00ae42",stopOpacity:.3}),i.jsx("stop",{offset:"95%",stopColor:"#00ae42",stopOpacity:0})]})}),i.jsx(xp,{strokeDasharray:"3 3",stroke:"#3d3d3d"}),i.jsx(yp,{dataKey:"dateLabel",stroke:"#9ca3af",tick:{fontSize:12},interval:"preserveStartEnd"}),i.jsx(vp,{stroke:"#9ca3af",tick:{fontSize:12},tickFormatter:R=>`${R}g`}),i.jsx(Lm,{contentStyle:{backgroundColor:"#2d2d2d",border:"1px solid #3d3d3d",borderRadius:"8px"},labelStyle:{color:"#fff"},formatter:R=>[`${Number(R??0).toFixed(0)}g`,"Filament"]}),i.jsx(Ane,{type:"monotone",dataKey:"filament",stroke:"#00ae42",strokeWidth:2,fillOpacity:1,fill:"url(#colorFilament)"})]})})]}):i.jsx("div",{className:"bg-bambu-dark rounded-lg p-8 text-center text-bambu-gray",children:a("stats.noPrintDataInRange")}),i.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4",children:[i.jsxs("div",{className:"bg-bambu-dark rounded-lg p-4",children:[i.jsxs("div",{className:"flex items-center justify-between mb-4",children:[i.jsx("h4",{className:"text-sm font-medium text-bambu-gray",children:a("stats.byMaterial")}),i.jsx(iC,{value:s,onChange:o})]}),_.length>0?i.jsxs("div",{className:"flex items-center gap-4",children:[i.jsx(Fm,{width:160,height:160,children:i.jsxs(fG,{children:[i.jsx(AR,{data:_,cx:"50%",cy:"50%",innerRadius:40,outerRadius:70,paddingAngle:2,dataKey:"value",children:_.map((R,A)=>i.jsx(Yb,{fill:i1[A%i1.length]},`cell-${A}`))}),i.jsx(Lm,{contentStyle:{backgroundColor:"#2d2d2d",border:"1px solid #3d3d3d",borderRadius:"8px"},formatter:R=>[s==="weight"?Am(Number(R??0)):s==="time"?`${Number(R??0)}h`:`${R??0}`,s==="weight"?"Usage":s==="time"?"Time":"Prints"]})]})}),i.jsx("div",{className:"flex-1 space-y-2 overflow-hidden",children:_.map((R,A)=>{const D=_.reduce((U,G)=>U+G.value,0),$=D>0?(R.value/D*100).toFixed(0):0;return i.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[i.jsx("div",{className:"w-3 h-3 rounded-sm flex-shrink-0",style:{backgroundColor:i1[A%i1.length]}}),i.jsx("span",{className:"text-white truncate flex-1",children:R.name}),i.jsxs("span",{className:"text-bambu-gray flex-shrink-0",children:[s==="weight"?Am(R.value):s==="time"?`${R.value}h`:R.value," · ",$,"%"]})]},R.name)})})]}):i.jsx("div",{className:"h-[160px] flex items-center justify-center text-bambu-gray",children:a("stats.noFilamentData")})]}),i.jsxs("div",{className:"bg-bambu-dark rounded-lg p-4",children:[i.jsx("h4",{className:"text-sm font-medium text-bambu-gray mb-4",children:a("stats.filamentSuccess")}),b.length>0?i.jsx("div",{className:"space-y-1.5",children:b.map(R=>i.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[i.jsx("span",{className:"text-white truncate w-20 flex-shrink-0",children:R.name}),i.jsx("div",{className:"flex-1 h-1.5 bg-bambu-dark-secondary rounded-full",children:i.jsx("div",{className:`h-full rounded-full transition-all ${R.rate>=90?"bg-status-ok":R.rate>=70?"bg-status-warning":"bg-status-error"}`,style:{width:`${R.rate}%`}})}),i.jsxs("span",{className:`font-medium flex-shrink-0 tabular-nums ${R.rate>=90?"text-status-ok":R.rate>=70?"text-status-warning":"text-status-error"}`,children:[R.rate,"%"]}),i.jsxs("span",{className:"text-bambu-gray flex-shrink-0 text-xs",children:["(",R.total,")"]})]},R.name))}):i.jsx("div",{className:"h-[160px] flex items-center justify-center text-bambu-gray",children:a("stats.noArchiveData")})]}),i.jsxs("div",{className:"bg-bambu-dark rounded-lg p-4",children:[i.jsxs("div",{className:"flex items-center justify-between mb-4",children:[i.jsx("h4",{className:"text-sm font-medium text-bambu-gray",children:a("stats.colorDistribution")}),i.jsx(iC,{value:l,onChange:c,exclude:["time"]})]}),v.length>0?(()=>{const R=v.reduce((A,D)=>A+D.value,0);return i.jsxs("div",{children:[i.jsxs("div",{className:"relative mx-auto",style:{width:160,height:160},children:[i.jsx(Fm,{width:"100%",height:"100%",children:i.jsxs(fG,{children:[i.jsx(AR,{data:v,cx:"50%",cy:"50%",innerRadius:45,outerRadius:70,paddingAngle:2,dataKey:"value",children:v.map((A,D)=>i.jsx(Yb,{fill:A.hex,stroke:"#1a1a1a",strokeWidth:1},`color-${D}`))}),i.jsx(Lm,{contentStyle:{backgroundColor:"#2d2d2d",border:"1px solid #3d3d3d",borderRadius:"8px"},formatter:A=>[l==="weight"?Am(Number(A??0)):`${A??0}`,a(l==="weight"?"stats.filamentByWeight":"stats.filamentByPrints")]})]})}),i.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center",children:[i.jsx("span",{className:"text-lg font-bold text-white",children:l==="weight"?Am(R):R}),i.jsxs("span",{className:"text-[10px] text-bambu-gray",children:[v.length," ",v.length===1?"color":"colors"]})]})]}),i.jsx("div",{className:"grid grid-cols-2 gap-x-3 gap-y-1 mt-2",children:v.slice(0,8).map(A=>{const D=R>0?(A.value/R*100).toFixed(0):0;return i.jsxs("div",{className:"flex items-center gap-1.5 text-xs min-w-0",children:[i.jsx("div",{className:"w-2.5 h-2.5 rounded-full flex-shrink-0 border border-white/20",style:{backgroundColor:A.hex}}),i.jsxs("span",{className:"text-bambu-gray truncate",children:[D,"%"]})]},A.hex)})}),v.length>8&&i.jsxs("p",{className:"text-[10px] text-bambu-gray mt-1 text-center",children:["+",v.length-8," more"]})]})})():i.jsx("div",{className:"h-[160px] flex items-center justify-center text-bambu-gray",children:a("stats.noColorData")})]})]})]})}function IZe({id:t,title:e,component:n,isHidden:r,size:a,columnSpan:s,onToggleVisibility:o,onToggleSize:l}){const{attributes:c,listeners:d,setNodeRef:u,transform:m,transition:p,isDragging:f}=Tse({id:t}),y={transform:rx.Transform.toString(m),transition:p,opacity:f?.5:1};return r?null:i.jsxs("div",{ref:u,style:{...y,gridColumn:`span ${s}`},className:`bg-bambu-dark-secondary rounded-xl border border-bambu-dark-tertiary overflow-hidden ${f?"ring-2 ring-bambu-green shadow-lg":""}`,children:[i.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-bambu-dark-tertiary bg-bambu-dark/30",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("button",{...c,...d,className:"cursor-grab active:cursor-grabbing p-1 hover:bg-bambu-dark-tertiary rounded transition-colors",title:"Drag to reorder",children:i.jsx(qm,{className:"w-6 h-6 md:w-4 md:h-4 text-bambu-gray"})}),i.jsx("h3",{className:"text-sm font-medium text-white",children:e})]}),i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx("button",{onClick:l,className:"p-1 hover:bg-bambu-dark-tertiary rounded transition-colors",title:`Size: ${a===1?"1/4":a===2?"1/2":"Full"} - Click to cycle`,children:a===4?i.jsx(WF,{className:"w-4 h-4 text-bambu-gray hover:text-white"}):i.jsx(hC,{className:"w-4 h-4 text-bambu-gray hover:text-white"})}),i.jsx("button",{onClick:o,className:"p-1 hover:bg-bambu-dark-tertiary rounded transition-colors",title:"Hide widget",children:i.jsx(j0,{className:"w-4 h-4 text-bambu-gray hover:text-white"})})]})]}),i.jsx("div",{className:"p-4",children:typeof n=="function"?n(a):n})]})}function zZe({widgets:t,storageKey:e,columns:n=4,stackBelow:r,hideControls:a=!1,onResetLayout:s,renderControls:o}){const l=()=>{const R={};return t.forEach(A=>{R[A.id]=A.defaultSize||4}),R},[c,d]=w.useState(()=>{const R=localStorage.getItem(e);if(R)try{const A=JSON.parse(R);if(!A.sizes)A.sizes=l();else{const D=l();for(const $ in D)$ in A.sizes||(A.sizes[$]=D[$])}return A}catch{}return{order:t.map(A=>A.id),hidden:t.filter(A=>A.defaultVisible===!1).map(A=>A.id),sizes:l()}}),[u,m]=w.useState(!1),[p,f]=w.useState(!1);w.useEffect(()=>{if(!r)return;const R=window.matchMedia(`(max-width: ${r}px)`),A=$=>{f($.matches)};A(R);const D=$=>A($);return R.addEventListener?R.addEventListener("change",D):R.addListener(D),()=>{R.removeEventListener?R.removeEventListener("change",D):R.removeListener(D)}},[r]);const y=r&&p?1:n;w.useEffect(()=>{const R=()=>m(A=>!A);return window.addEventListener("toggle-hidden-panel",R),()=>window.removeEventListener("toggle-hidden-panel",R)},[]),w.useEffect(()=>{localStorage.setItem(e,JSON.stringify(c))},[c,e]),w.useEffect(()=>{const A=t.map(D=>D.id).filter(D=>!c.order.includes(D));A.length>0&&d(D=>({...D,order:[...D.order,...A]}))},[t,c.order]);const x=ase(tC(qT,{activationConstraint:{distance:8}}),tC($T,{coordinateGetter:Pse})),b=R=>{const{active:A,over:D}=R;D&&A.id!==D.id&&d($=>{const U=$.order.indexOf(A.id),G=$.order.indexOf(D.id);return{...$,order:WT($.order,U,G)}})},v=R=>{d(A=>({...A,hidden:A.hidden.includes(R)?A.hidden.filter(D=>D!==R):[...A.hidden,R]}))},_=R=>{d(A=>{const D=A.sizes[R]||4,$=D===1?2:D===2?4:1;return{...A,sizes:{...A.sizes,[R]:$}}})},k=()=>{const R={order:t.map(A=>A.id),hidden:t.filter(A=>A.defaultVisible===!1).map(A=>A.id),sizes:l()};d(R),s?.()},P=c.order.map(R=>t.find(A=>A.id===R)).filter(Boolean),C=P.filter(R=>!c.hidden.includes(R.id)),T=P.filter(R=>c.hidden.includes(R.id)),N=o?.({hiddenCount:T.length,showHiddenPanel:u,setShowHiddenPanel:m,resetLayout:k});return i.jsxs("div",{className:"space-y-4",children:[N,!a&&!o&&i.jsxs("div",{className:"flex items-center justify-end gap-2",children:[i.jsxs(Fe,{variant:"secondary",size:"sm",onClick:k,children:[i.jsx(uo,{className:"w-4 h-4"}),"Reset Layout"]}),T.length>0&&i.jsxs(Fe,{variant:"secondary",size:"sm",onClick:()=>m(!u),children:[i.jsx(tc,{className:"w-4 h-4"}),T.length," Hidden"]})]}),u&&T.length>0&&i.jsxs("div",{className:"p-4 bg-bambu-dark rounded-xl border border-bambu-dark-tertiary",children:[i.jsx("p",{className:"text-sm text-bambu-gray mb-3",children:"Hidden widgets (click to show):"}),i.jsx("div",{className:"flex flex-wrap gap-2",children:T.map(R=>i.jsxs("button",{onClick:()=>v(R.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:[i.jsx(tc,{className:"w-3 h-3"}),R.title]},R.id))})]}),i.jsx(Sse,{sensors:x,collisionDetection:cse,onDragEnd:b,children:i.jsx(Nse,{items:C.map(R=>R.id),strategy:AI,children:i.jsx("div",{className:"grid gap-6",style:{gridTemplateColumns:`repeat(${y}, minmax(0, 1fr))`},children:C.map(R=>{const A=c.sizes[R.id]||2,D=Math.min(A,y);return i.jsx(IZe,{id:R.id,title:R.title,component:R.component,isHidden:c.hidden.includes(R.id),size:A,columnSpan:D,onToggleVisibility:()=>v(R.id),onToggleSize:()=>_(R.id)},R.id)})})})}),C.length===0&&i.jsxs("div",{className:"text-center py-12 text-bambu-gray",children:[i.jsx("p",{children:"All widgets are hidden."}),i.jsx(Fe,{className:"mt-4",onClick:k,children:"Reset Layout"})]})]})}function UZe(t){const e=new Date,n=e.getUTCFullYear(),r=e.getUTCMonth(),a=e.getUTCDate(),s=l=>l.toISOString().split("T")[0],o=s(e);switch(t){case"today":return{dateFrom:o,dateTo:o};case"this-week":{const l=e.getUTCDay(),c=new Date(Date.UTC(n,r,a-(l===0?6:l-1)));return{dateFrom:s(c),dateTo:o}}case"this-month":return{dateFrom:s(new Date(Date.UTC(n,r,1))),dateTo:o};case"last-7":return{dateFrom:s(new Date(Date.UTC(n,r,a-6))),dateTo:o};case"last-30":return{dateFrom:s(new Date(Date.UTC(n,r,a-29))),dateTo:o};case"last-90":return{dateFrom:s(new Date(Date.UTC(n,r,a-89))),dateTo:o};case"this-year":return{dateFrom:s(new Date(Date.UTC(n,0,1))),dateTo:o};case"all-time":return{dateFrom:void 0,dateTo:void 0};case"custom":return{}}}const BZe=["today","this-week","this-month","last-7","last-30","last-90","this-year","all-time"],HZe=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],kF=["12am","1am","2am","3am","4am","5am","6am","7am","8am","9am","10am","11am","12pm","1pm","2pm","3pm","4pm","5pm","6pm","7pm","8pm","9pm","10pm","11pm"],Gj=[{key:"<30m",max:1800},{key:"30m-1h",max:3600},{key:"1-2h",max:7200},{key:"2-4h",max:14400},{key:"4-8h",max:28800},{key:"8-12h",max:43200},{key:"12-24h",max:86400},{key:"24h+",max:1/0}],a1={backgroundColor:"#2d2d2d",border:"1px solid #3d3d3d",borderRadius:"8px"};function $Ze({stats:t,currency:e}){const{t:n}=Mt(),r=[{icon:sa,color:"text-bambu-green",label:n("stats.totalPrints"),value:`${t?.total_prints||0}`},{icon:er,color:"text-blue-400",label:n("stats.printTime"),value:`${t?.total_print_time_hours?.toFixed(1)??"0"}h`},{icon:sa,color:"text-orange-400",label:n("stats.filamentUsed"),value:Am(t?.total_filament_grams||0)},{icon:H1,color:"text-green-400",label:n("stats.filamentCost"),value:`${e} ${t?.total_cost?.toFixed(2)??"0.00"}`},{icon:rc,color:"text-yellow-400",label:n("stats.energyUsed"),value:`${t?.total_energy_kwh?.toFixed(3)??"0.000"} kWh`},{icon:H1,color:"text-yellow-500",label:n("stats.energyCost"),value:`${e} ${t?.total_energy_cost?.toFixed(2)??"0.00"}`}];return i.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-4",children:r.map(a=>i.jsxs("div",{className:"flex items-start gap-3",children:[i.jsx("div",{className:`p-2 rounded-lg bg-bambu-dark ${a.color}`,children:i.jsx(a.icon,{className:"w-5 h-5"})}),i.jsxs("div",{children:[i.jsx("p",{className:"text-xs text-bambu-gray",children:a.label}),i.jsx("p",{className:"text-xl font-bold text-white",children:a.value})]})]},a.label))})}function qZe({stats:t,printerMap:e,size:n=1}){const{t:r}=Mt(),a=(t?.successful_prints||0)+(t?.failed_prints||0),s=a?Math.round(t.successful_prints/a*100):0,o=n===1?112:n===2?128:144,l=o/2-8,c=l*2*Math.PI;return i.jsxs("div",{className:"flex items-center gap-6",children:[i.jsxs("div",{className:"relative flex-shrink-0",style:{width:o,height:o},children:[i.jsxs("svg",{className:"w-full h-full -rotate-90",children:[i.jsx("circle",{cx:o/2,cy:o/2,r:l,fill:"none",stroke:"#3d3d3d",strokeWidth:"10"}),i.jsx("circle",{cx:o/2,cy:o/2,r:l,fill:"none",stroke:"#00ae42",strokeWidth:"10",strokeLinecap:"round",strokeDasharray:`${s/100*c} ${c}`})]}),i.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:i.jsxs("span",{className:`font-bold text-white ${n>=2?"text-2xl":"text-xl"}`,children:[s,"%"]})})]}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(fr,{className:"w-4 h-4 text-status-ok flex-shrink-0"}),i.jsx("span",{className:"text-sm text-bambu-gray",children:r("stats.successful")}),i.jsx("span",{className:"text-sm text-white font-medium",children:t?.successful_prints||0})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(qi,{className:"w-4 h-4 text-status-error flex-shrink-0"}),i.jsx("span",{className:"text-sm text-bambu-gray",children:r("stats.failed")}),i.jsx("span",{className:"text-sm text-white font-medium",children:t?.failed_prints||0})]})]}),n>=2&&t?.prints_by_printer&&Object.keys(t.prints_by_printer).length>0&&i.jsxs("div",{className:"mt-4 pt-4 border-t border-bambu-dark-tertiary",children:[i.jsx("p",{className:"text-xs text-bambu-gray font-medium mb-2",children:r("stats.printsByPrinter")}),i.jsx("div",{className:`grid gap-x-6 gap-y-1 ${n===4?"grid-cols-3":"grid-cols-2"}`,style:{width:"fit-content"},children:Object.entries(t.prints_by_printer).map(([d,u])=>i.jsxs("div",{className:"flex items-center gap-3 text-sm",children:[i.jsx("span",{className:"text-bambu-gray truncate max-w-[120px]",children:e.get(d)||`${r("common.printer")} ${d}`}),i.jsx("span",{className:"text-white font-medium",children:u})]},d))})]})]})]})}function VZe({stats:t,printerMap:e,size:n=1}){const{t:r}=Mt(),a=t?.average_time_accuracy;if(a==null)return i.jsx("div",{className:"flex items-center justify-center h-full",children:i.jsx("p",{className:"text-bambu-gray text-center py-4",children:r("stats.noTimeAccuracyData")})});const o=(Math.min(150,Math.max(50,a))-50)/100*100,c=(x=>x>=95&&x<=105?"#00ae42":x>105?"#3b82f6":"#f97316")(a),d=a-100,u=n===1?112:n===2?128:144,m=u/2-8,p=m*2*Math.PI,f=n===1?3:n===2?6:999,y=t?.time_accuracy_by_printer?Object.entries(t.time_accuracy_by_printer).slice(0,f):[];return i.jsxs("div",{className:"flex items-center gap-6",children:[i.jsxs("div",{className:"relative flex-shrink-0",style:{width:u,height:u},children:[i.jsxs("svg",{className:"w-full h-full -rotate-90",children:[i.jsx("circle",{cx:u/2,cy:u/2,r:m,fill:"none",stroke:"#3d3d3d",strokeWidth:"10"}),i.jsx("circle",{cx:u/2,cy:u/2,r:m,fill:"none",stroke:c,strokeWidth:"10",strokeLinecap:"round",strokeDasharray:`${o/100*p} ${p}`})]}),i.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center",children:[i.jsxs("span",{className:`font-bold text-white ${n>=2?"text-2xl":"text-xl"}`,children:[a.toFixed(0),"%"]}),i.jsxs("span",{className:`text-xs ${d>=0?"text-blue-400":"text-orange-400"}`,children:[d>=0?"+":"",d.toFixed(0),"%"]})]})]}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsxs("div",{className:"flex items-center gap-2 text-xs text-bambu-gray",children:[i.jsx(eX,{className:"w-3 h-3 flex-shrink-0"}),i.jsx("span",{children:r("stats.perfectEstimate")})]}),y.length>0&&i.jsx("div",{className:`mt-2 ${n===4?"grid grid-cols-3 gap-x-6 gap-y-1":n===2?"grid grid-cols-2 gap-x-6 gap-y-1":"space-y-1"}`,style:{width:"fit-content"},children:y.map(([x,b])=>i.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[i.jsx("span",{className:"text-bambu-gray truncate max-w-[100px]",children:e.get(x)||`${r("common.printer")} ${x}`}),i.jsxs("span",{className:`font-medium ${b>=95&&b<=105?"text-status-ok":b>105?"text-blue-400":"text-status-warning"}`,children:[b.toFixed(0),"%"]})]},x))})]})]})}function GZe({printDates:t,dateFrom:e,dateTo:n}){const{days:r,hourlyCounts:a,maxCount:s}=w.useMemo(()=>{const u=new Date(e+"T00:00:00"),m=new Date(n+"T00:00:00"),p=[],f=v=>`${v.getFullYear()}-${String(v.getMonth()+1).padStart(2,"0")}-${String(v.getDate()).padStart(2,"0")}`,y=new Date(u);for(;y<=m;)p.push({key:f(y),label:y.toLocaleDateString(void 0,{weekday:"short",month:"short",day:"numeric"})}),y.setDate(y.getDate()+1);const x={};let b=0;return t.forEach(v=>{const _=Jn(v);if(!_)return;const P=`${`${_.getFullYear()}-${String(_.getMonth()+1).padStart(2,"0")}-${String(_.getDate()).padStart(2,"0")}`}-${_.getHours()}`;x[P]=(x[P]||0)+1,x[P]>b&&(b=x[P])}),{days:p,hourlyCounts:x,maxCount:Math.max(1,b)}},[t,e,n]),o=u=>{if(u===0)return"bg-bambu-dark";const m=u/s;return m<=.25?"bg-bambu-green/30":m<=.5?"bg-bambu-green/50":m<=.75?"bg-bambu-green/75":"bg-bambu-green"},l=20,c=2,d=80;return i.jsxs("div",{className:"w-full overflow-x-auto",children:[i.jsxs("div",{className:"inline-flex flex-col",style:{gap:c},children:[i.jsx("div",{className:"flex",style:{gap:c,marginLeft:d+4},children:kF.map((u,m)=>i.jsx("div",{className:"text-bambu-gray text-[10px] text-center",style:{width:l,visibility:m%2===0?"visible":"hidden"},children:u},m))}),r.map(u=>i.jsxs("div",{className:"flex items-center",style:{gap:c},children:[i.jsx("div",{className:"text-bambu-gray text-[10px] flex-shrink-0 truncate",style:{width:d},children:u.label}),Array.from({length:24},(m,p)=>{const f=a[`${u.key}-${p}`]||0;return i.jsx("div",{className:`rounded-sm ${o(f)}`,style:{width:l,height:l},title:`${u.label} ${kF[p]}: ${f} print${f!==1?"s":""}`},p)})]},u.key))]}),i.jsxs("div",{className:"flex items-center gap-2 mt-3 text-bambu-gray text-xs",children:[i.jsx("span",{children:"Less"}),i.jsxs("div",{className:"flex",style:{gap:c},children:[i.jsx("div",{className:"rounded-sm bg-bambu-dark",style:{width:l,height:l}}),i.jsx("div",{className:"rounded-sm bg-bambu-green/30",style:{width:l,height:l}}),i.jsx("div",{className:"rounded-sm bg-bambu-green/50",style:{width:l,height:l}}),i.jsx("div",{className:"rounded-sm bg-bambu-green/75",style:{width:l,height:l}}),i.jsx("div",{className:"rounded-sm bg-bambu-green",style:{width:l,height:l}})]}),i.jsx("span",{children:"More"})]})]})}function WZe({printDates:t,size:e=2,dateFrom:n,dateTo:r}){const a=w.useMemo(()=>n&&r?Math.max((new Date(r).getTime()-new Date(n).getTime())/864e5,0)+1:n?Math.max((Date.now()-new Date(n).getTime())/864e5,0)+1:1/0,[n,r]);if(a<=7&&n&&r)return i.jsx(GZe,{printDates:t,dateFrom:n,dateTo:r});const o=a===1/0?e===1?3:e===2?6:12:Math.max(1,Math.ceil(a/30));return i.jsx(FZe,{printDates:t,months:o})}function KZe({stats:t,archives:e,printerMap:n}){const{t:r}=Mt(),[a,s]=w.useState("weight"),[o,l]=w.useState("weight"),c=w.useMemo(()=>{const v=new Map;return t?.prints_by_printer&&Object.entries(t.prints_by_printer).forEach(([_,k])=>{const P=v.get(_)||{prints:0,weight:0,time:0};P.prints=k,v.set(_,P)}),e.forEach(_=>{if(!_.printer_id)return;const k=String(_.printer_id),P=v.get(k)||{prints:0,weight:0,time:0};P.weight+=_.filament_used_grams||0,P.time+=_.actual_time_seconds||_.print_time_seconds||0,t?.prints_by_printer||P.prints++,v.set(k,P)}),Array.from(v.entries()).map(([_,k])=>({name:n.get(_)||`${r("common.printer")} ${_}`,value:a==="prints"?k.prints:a==="weight"?Math.round(k.weight):Math.round(k.time/3600*10)/10})).sort((_,k)=>k.value-_.value)},[t,e,n,a,r]),d=w.useMemo(()=>{const v=Array.from({length:24},(_,k)=>({hour:k,label:kF[k],total:0,failures:0}));return e.forEach(_=>{if(!_.started_at)return;const k=Jn(_.started_at);if(!k)return;const P=k.getHours();v[P].total++,_.status==="failed"&&v[P].failures++}),v},[e]),u=w.useMemo(()=>{const v=Gj.map(_=>({name:_.key,count:0}));return e.forEach(_=>{const k=_.actual_time_seconds||_.print_time_seconds;if(!(!k||k<=0)){for(let P=0;P<Gj.length;P++)if(k<=Gj[P].max){v[P].count++;break}}}),v},[e]),m=w.useMemo(()=>{const v=[0,0,0,0,0,0,0],_=new Set;e.forEach(P=>{const C=Jn(P.created_at)||new Date(P.created_at);let T=C.getDay()-1;T<0&&(T=6),o==="prints"?v[T]++:o==="weight"?v[T]+=P.filament_used_grams||0:v[T]+=(P.actual_time_seconds||P.print_time_seconds||0)/3600;const N=new Date(C);N.setDate(C.getDate()-(C.getDay()+6)%7),_.add(`${N.getFullYear()}-${String(N.getMonth()+1).padStart(2,"0")}-${String(N.getDate()).padStart(2,"0")}`)});const k=Math.max(_.size,1);return HZe.map((P,C)=>({name:P,avg:Math.round(v[C]/k*10)/10}))},[e,o]),p=v=>({unit:v==="weight"?"g":v==="time"?"h":"",color:v==="weight"?"#00ae42":v==="time"?"#3b82f6":"#f59e0b"}),f=p(a),y=r(a==="weight"?"stats.filamentByWeight":a==="time"?"stats.hours":"common.prints"),x=p(o),b=r(o==="weight"?"stats.avgWeight":o==="time"?"stats.avgTime":"stats.avgPrints");return i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"bg-bambu-dark rounded-lg p-4",children:[i.jsxs("div",{className:"flex items-center justify-between mb-3",children:[i.jsx("h4",{className:"text-sm font-medium text-bambu-gray",children:r("stats.printsByPrinter")}),i.jsx(iC,{value:a,onChange:s})]}),c.length>0?i.jsx(Fm,{width:"100%",height:Math.max(140,c.length*40),children:i.jsxs(B_,{data:c,layout:"vertical",margin:{left:10},children:[i.jsx(xp,{strokeDasharray:"3 3",stroke:"#3d3d3d"}),i.jsx(yp,{type:"number",stroke:"#9ca3af",tick:{fontSize:11},unit:f.unit}),i.jsx(vp,{type:"category",dataKey:"name",stroke:"#9ca3af",tick:{fontSize:11},width:100}),i.jsx(Lm,{contentStyle:a1,formatter:v=>[a==="weight"?Am(Number(v??0)):`${v??0}${f.unit}`,y]}),i.jsx(Jg,{dataKey:"value",fill:f.color,radius:[0,4,4,0]})]})}):i.jsx("p",{className:"text-bambu-gray text-center py-4",children:r("stats.noPrinterData")})]}),i.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4",children:[i.jsxs("div",{className:"bg-bambu-dark rounded-lg p-4",children:[i.jsx("h4",{className:"text-sm font-medium text-bambu-gray mb-3",children:r("stats.printDuration")}),e.length>0?i.jsx(Fm,{width:"100%",height:160,children:i.jsxs(B_,{data:u,children:[i.jsx(xp,{strokeDasharray:"3 3",stroke:"#3d3d3d"}),i.jsx(yp,{dataKey:"name",stroke:"#9ca3af",tick:{fontSize:11}}),i.jsx(vp,{stroke:"#9ca3af",tick:{fontSize:11},allowDecimals:!1}),i.jsx(Lm,{contentStyle:a1}),i.jsx(Jg,{dataKey:"count",name:r("common.prints"),fill:"#00ae42",radius:[4,4,0,0]})]})}):i.jsx("p",{className:"text-bambu-gray text-center py-4",children:r("stats.noArchiveData")})]}),i.jsxs("div",{className:"bg-bambu-dark rounded-lg p-4",children:[i.jsxs("div",{className:"flex items-center justify-between mb-3",children:[i.jsx("h4",{className:"text-sm font-medium text-bambu-gray",children:r("stats.printHabits")}),i.jsx(iC,{value:o,onChange:l})]}),e.length>0?i.jsx(Fm,{width:"100%",height:160,children:i.jsxs(B_,{data:m,children:[i.jsx(xp,{strokeDasharray:"3 3",stroke:"#3d3d3d"}),i.jsx(yp,{dataKey:"name",stroke:"#9ca3af",tick:{fontSize:11}}),i.jsx(vp,{stroke:"#9ca3af",tick:{fontSize:11},unit:x.unit}),i.jsx(Lm,{contentStyle:a1,formatter:v=>[`${v??0}${x.unit}`,b]}),i.jsx(Jg,{dataKey:"avg",fill:x.color,radius:[4,4,0,0]})]})}):i.jsx("p",{className:"text-bambu-gray text-center py-4",children:r("stats.noArchiveData")})]}),i.jsxs("div",{className:"bg-bambu-dark rounded-lg p-4",children:[i.jsx("h4",{className:"text-sm font-medium text-bambu-gray mb-3",children:r("stats.printTimeOfDay")}),e.length>0?i.jsx(Fm,{width:"100%",height:160,children:i.jsxs(B_,{data:d,children:[i.jsx(xp,{strokeDasharray:"3 3",stroke:"#3d3d3d"}),i.jsx(yp,{dataKey:"label",stroke:"#9ca3af",tick:{fontSize:10},interval:5}),i.jsx(vp,{stroke:"#9ca3af",tick:{fontSize:11},allowDecimals:!1}),i.jsx(Lm,{contentStyle:a1}),i.jsx(Jg,{dataKey:"total",name:r("stats.totalPrints"),fill:"#00ae42",radius:[2,2,0,0]}),i.jsx(Jg,{dataKey:"failures",name:r("stats.failed"),fill:"#ef4444",radius:[2,2,0,0]})]})}):i.jsx("p",{className:"text-bambu-gray text-center py-4",children:r("stats.noArchiveData")})]})]})]})}function YZe({archives:t,currency:e,dateFrom:n,dateTo:r}){const{t:a}=Mt();return!t||t.length===0?i.jsx("p",{className:"text-bambu-gray text-center py-4",children:a("stats.noPrintData")}):i.jsx(OZe,{archives:t,currency:e,dateFrom:n,dateTo:r})}function XZe({size:t=1,dateFrom:e,dateTo:n}){const{t:r}=Mt(),a=!!(e||n),{data:s,isLoading:o}=Je({queryKey:["failureAnalysis",e,n],queryFn:()=>be.getFailureAnalysis({...a?{dateFrom:e,dateTo:n}:{days:30}})});if(o)return i.jsx("div",{className:"flex justify-center py-4",children:i.jsx(ct,{className:"w-6 h-6 text-bambu-green animate-spin"})});if(!s||s.total_prints===0)return i.jsx("p",{className:"text-bambu-gray text-center py-4",children:r(a?"stats.noPrintDataInRange":"stats.noPrintDataLast30Days")});const l=t===1?5:t===2?8:999,c=Object.entries(s.failures_by_reason).sort(([,m],[,p])=>p-m),d=c.slice(0,l),u=c.length>l;return i.jsxs("div",{className:`${t>=2?"flex gap-8":"space-y-4"}`,children:[i.jsxs("div",{className:t>=2?"flex-shrink-0":"",children:[i.jsx("div",{className:"flex items-center gap-4",children:i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(En,{className:`w-5 h-5 ${s.failure_rate>20?"text-status-error":s.failure_rate>10?"text-status-warning":"text-status-ok"}`}),i.jsxs("span",{className:`font-bold text-white ${t>=2?"text-3xl":"text-2xl"}`,children:[s.failure_rate.toFixed(1),"%"]})]})}),i.jsx("div",{className:"text-sm text-bambu-gray mt-1",children:r("stats.failedPrintsCount",{failed:s.failed_prints,total:s.total_prints})}),s.trend&&s.trend.length>=2&&i.jsx("div",{className:`${t>=2?"mt-4":"mt-2 pt-2 border-t border-bambu-dark-tertiary"}`,children:i.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[i.jsx(XF,{className:`w-4 h-4 ${s.trend[s.trend.length-1].failure_rate<s.trend[s.trend.length-2].failure_rate?"text-status-ok":"text-status-error"}`}),i.jsx("span",{className:"text-bambu-gray",children:r("stats.lastWeekRate",{rate:s.trend[s.trend.length-1].failure_rate.toFixed(1)})})]})})]}),d.length>0&&i.jsxs("div",{className:`flex-1 ${t>=2?"border-l border-bambu-dark-tertiary pl-8":"pt-2"}`,children:[i.jsx("p",{className:"text-xs text-bambu-gray font-medium mb-2",children:t>=2?r("stats.failureReasons"):r("stats.topFailureReasons")}),i.jsx("div",{className:`${t===4?"grid grid-cols-2 gap-x-6 gap-y-1":"space-y-1"}`,children:d.map(([m,p])=>i.jsxs("div",{className:"flex items-center justify-between text-sm",children:[i.jsx("span",{className:`text-white truncate ${t===4?"max-w-[200px]":"max-w-[160px]"}`,children:m||r("common.unknown")}),i.jsx("span",{className:"text-bambu-gray ml-2",children:p})]},m))}),u&&i.jsx("p",{className:"text-xs text-bambu-gray mt-2",children:r("common.more",{count:c.length-l})})]})]})}function QZe({archives:t,currency:e}){const{t:n}=Mt(),r=w.useMemo(()=>{const a=[];if(t.length===0)return a;const s=y=>{let x=null,b=0;return t.forEach(v=>{const _=y(v);_&&_>b&&(b=_,x=v)}),{archive:x,value:b}},o=s(y=>y.actual_time_seconds);o.archive&&a.push({icon:er,iconColor:"text-blue-400",label:n("stats.longestPrint"),value:Ms(o.value),detail:o.archive.print_name||null});const l=s(y=>y.filament_used_grams);l.archive&&a.push({icon:sa,iconColor:"text-orange-400",label:n("stats.heaviestPrint"),value:Am(l.value),detail:l.archive.print_name||null});const c=s(y=>y.cost);c.archive&&a.push({icon:H1,iconColor:"text-green-400",label:n("stats.mostExpensivePrint"),value:`${e}${c.value.toFixed(2)}`,detail:c.archive.print_name||null});const d=new Map;t.forEach(y=>{const x=Jn(y.created_at)||new Date(y.created_at),b=`${x.getFullYear()}-${String(x.getMonth()+1).padStart(2,"0")}-${String(x.getDate()).padStart(2,"0")}`;d.set(b,(d.get(b)||0)+1)});let u="",m=0;d.forEach((y,x)=>{y>m&&(m=y,u=x)}),m>1&&a.push({icon:Xr,iconColor:"text-purple-400",label:n("stats.busiestDay"),value:`${m} ${n("common.prints")}`,detail:(()=>{const[y,x,b]=u.split("-").map(Number);return new Date(y,x-1,b).toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"})})()});const p=[...t].filter(y=>y.status==="completed"||y.status==="failed").sort((y,x)=>new Date(x.completed_at||x.created_at).getTime()-new Date(y.completed_at||y.created_at).getTime());let f=0;for(const y of p)if(y.status==="completed")f++;else break;return f>0&&a.push({icon:rc,iconColor:"text-yellow-400",label:n("stats.successStreak"),value:`${f}`,detail:f===1?n("stats.streakPrint"):n("stats.streakPrints",{count:f})}),a},[t,e,n]);return r.length===0?i.jsx("p",{className:"text-bambu-gray text-center py-4",children:n("stats.noArchiveData")}):i.jsx("div",{className:"space-y-3",children:r.map((a,s)=>i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:`p-1.5 rounded-lg bg-bambu-dark ${a.iconColor}`,children:i.jsx(a.icon,{className:"w-4 h-4"})}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsx("p",{className:"text-xs text-bambu-gray",children:a.label}),i.jsxs("div",{className:"flex items-baseline gap-2",children:[i.jsx("span",{className:"text-sm font-bold text-white",children:a.value}),a.detail&&i.jsx("span",{className:"text-xs text-bambu-gray truncate",children:a.detail})]})]})]},s))})}function ZZe(){const{t}=Mt(),{showToast:e}=bn(),{hasPermission:n}=Rr(),[r,a]=w.useState(!1),[s,o]=w.useState(!1),[l,c]=w.useState(0),[d,u]=w.useState(0),[m,p]=w.useState(!1),[f,y]=w.useState(()=>{try{const te=localStorage.getItem("bambusy-stats-timeframe");if(te){const re=JSON.parse(te);if(re.preset)return re}}catch{}return{preset:"all-time",dateFrom:void 0,dateTo:void 0}}),[x,b]=w.useState(!1);w.useEffect(()=>{localStorage.setItem("bambusy-stats-timeframe",JSON.stringify(f))},[f]);const v=w.useMemo(()=>f.preset==="custom"?{dateFrom:f.dateFrom,dateTo:f.dateTo}:UZe(f.preset),[f]);w.useEffect(()=>{const te=()=>{try{const J=localStorage.getItem("bambusy-dashboard-layout-v2");if(J){const ue=JSON.parse(J);u(ue.hidden?.length||0)}}catch{u(0)}};te(),window.addEventListener("storage",te);const re=setInterval(te,2e3);return()=>{window.removeEventListener("storage",te),clearInterval(re)}},[l]);const{data:_,isLoading:k,refetch:P}=Je({queryKey:["archiveStats",v.dateFrom,v.dateTo],queryFn:()=>be.getArchiveStats({dateFrom:v.dateFrom,dateTo:v.dateTo})}),{data:C}=Je({queryKey:["printers"],queryFn:be.getPrinters}),{data:T,refetch:N}=Je({queryKey:["archivesSlim",v.dateFrom,v.dateTo],queryFn:()=>be.getArchivesSlim(v.dateFrom,v.dateTo)}),{data:R}=Je({queryKey:["settings"],queryFn:be.getSettings}),A=async te=>{o(!1),a(!0);try{const{blob:re,filename:J}=await be.exportStats({format:te,days:90}),ue=URL.createObjectURL(re),me=document.createElement("a");me.href=ue,me.download=J,me.click(),URL.revokeObjectURL(ue),e(t("stats.exportDownloaded"))}catch{e(t("stats.exportFailed"),"error")}finally{a(!1)}},D=async()=>{p(!0);try{const te=await be.recalculateCosts();await Promise.all([P(),N()]),e(t("stats.recalculatedCosts",{count:te.updated}))}catch{e(t("stats.recalculateFailed"),"error")}finally{p(!1)}},$=al(R?.currency||"USD"),U=new Map(C?.map(te=>[String(te.id),te.name])||[]),G=w.useMemo(()=>T?.map(te=>te.created_at)||[],[T]);if(k)return i.jsx("div",{className:"p-4 md:p-8",children:i.jsx("div",{className:"text-center py-12 text-bambu-gray",children:t("stats.loadingStats")})});const L=[{id:"quick-stats",title:t("stats.quickStats"),component:i.jsx($Ze,{stats:_,currency:$}),defaultSize:2},{id:"success-rate",title:t("stats.successRate"),component:te=>i.jsx(qZe,{stats:_,printerMap:U,size:te}),defaultSize:1},{id:"time-accuracy",title:t("stats.timeAccuracy"),component:te=>i.jsx(VZe,{stats:_,printerMap:U,size:te}),defaultSize:1},{id:"failure-analysis",title:t("stats.failureAnalysis"),component:te=>i.jsx(XZe,{size:te,dateFrom:v.dateFrom,dateTo:v.dateTo}),defaultSize:1},{id:"print-activity",title:t("stats.printActivity"),component:te=>i.jsx(WZe,{printDates:G,size:te,dateFrom:v.dateFrom,dateTo:v.dateTo}),defaultSize:2},{id:"records",title:t("stats.records"),component:i.jsx(QZe,{archives:T||[],currency:$}),defaultSize:1},{id:"printer-stats",title:t("stats.printerStats"),component:i.jsx(KZe,{stats:_,archives:T||[],printerMap:U}),defaultSize:4},{id:"filament-trends",title:t("stats.filamentTrends"),component:i.jsx(YZe,{archives:T||[],currency:$,dateFrom:v.dateFrom,dateTo:v.dateTo}),defaultSize:4}];return i.jsxs("div",{className:"p-4 md:p-8",children:[i.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4 mb-6",children:[i.jsxs("div",{children:[i.jsx("h1",{className:"text-2xl font-bold text-white",children:t("stats.title")}),i.jsx("p",{className:"text-bambu-gray",children:t("stats.subtitle")})]}),i.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[d>0&&i.jsxs(Fe,{variant:"secondary",onClick:()=>{window.dispatchEvent(new CustomEvent("toggle-hidden-panel"))},children:[i.jsx(tc,{className:"w-4 h-4"}),t("stats.hiddenCount",{count:d})]}),i.jsxs(Fe,{variant:"secondary",onClick:()=>{localStorage.removeItem("bambusy-dashboard-layout-v2"),c(te=>te+1),e(t("stats.layoutReset"))},disabled:!n("settings:update"),title:n("settings:update")?void 0:t("stats.noPermissionResetLayout"),children:[i.jsx(uo,{className:"w-4 h-4"}),t("stats.resetLayout")]}),i.jsxs(Fe,{variant:"secondary",onClick:D,disabled:m||!n("archives:update_all"),title:n("archives:update_all")?t("stats.recalculateCostsHint"):t("stats.noPermissionRecalculate"),children:[m?i.jsx(ct,{className:"w-4 h-4 animate-spin"}):i.jsx(qme,{className:"w-4 h-4"}),t("stats.recalculateCosts")]}),i.jsxs("div",{className:"relative",children:[i.jsxs(Fe,{variant:"secondary",onClick:()=>o(!s),disabled:r,children:[r?i.jsx(ct,{className:"w-4 h-4 animate-spin"}):i.jsx(q1,{className:"w-4 h-4"}),t("stats.exportStats")]}),s&&i.jsxs("div",{className:"absolute right-0 top-full mt-1 w-48 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg shadow-xl z-20",children:[i.jsxs("button",{className:"w-full px-4 py-2 text-left text-white hover:bg-bambu-dark-tertiary transition-colors flex items-center gap-2 rounded-t-lg",onClick:()=>A("csv"),children:[i.jsx(Es,{className:"w-4 h-4"}),t("stats.exportAsCsv")]}),i.jsxs("button",{className:"w-full px-4 py-2 text-left text-white hover:bg-bambu-dark-tertiary transition-colors flex items-center gap-2 rounded-b-lg",onClick:()=>A("xlsx"),children:[i.jsx(q1,{className:"w-4 h-4"}),t("stats.exportAsExcel")]})]})]}),i.jsxs("div",{className:"relative",children:[i.jsxs(Fe,{variant:"secondary",onClick:()=>b(!x),children:[i.jsx(Xr,{className:"w-4 h-4"}),t(`stats.timeframe.${f.preset}`),i.jsx(In,{className:"w-3 h-3"})]}),x&&i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"fixed inset-0 z-10",onClick:()=>b(!1)}),i.jsxs("div",{className:"absolute right-0 top-full mt-1 w-64 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg shadow-xl z-20 p-2",children:[BZe.map(te=>i.jsx("button",{className:`w-full px-3 py-2 text-left text-sm rounded-md transition-colors ${f.preset===te?"bg-bambu-green text-white":"text-white hover:bg-bambu-dark-tertiary"}`,onClick:()=>{y({preset:te,dateFrom:void 0,dateTo:void 0}),b(!1)},children:t(`stats.timeframe.${te}`)},te)),i.jsx("div",{className:"border-t border-bambu-dark-tertiary my-2"}),i.jsx("button",{className:`w-full px-3 py-2 text-left text-sm rounded-md transition-colors ${f.preset==="custom"?"bg-bambu-green text-white":"text-white hover:bg-bambu-dark-tertiary"}`,onClick:()=>y(te=>({...te,preset:"custom"})),children:t("stats.timeframe.custom")}),f.preset==="custom"&&i.jsxs("div",{className:"mt-2 px-1 pb-1 space-y-2",children:[i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-bambu-gray block mb-1",children:t("stats.timeframe.from")}),i.jsx("input",{type:"date",value:f.dateFrom||"",max:f.dateTo||new Date().toISOString().split("T")[0],onChange:te=>y(re=>({...re,dateFrom:te.target.value||void 0})),className:"w-full bg-bambu-dark border border-bambu-dark-tertiary rounded-md px-3 py-1.5 text-sm text-white [color-scheme:dark]"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-xs text-bambu-gray block mb-1",children:t("stats.timeframe.to")}),i.jsx("input",{type:"date",value:f.dateTo||"",min:f.dateFrom,max:new Date().toISOString().split("T")[0],onChange:te=>y(re=>({...re,dateTo:te.target.value||void 0})),className:"w-full bg-bambu-dark border border-bambu-dark-tertiary rounded-md px-3 py-1.5 text-sm text-white [color-scheme:dark]"})]}),i.jsx(Fe,{variant:"primary",onClick:()=>b(!1),className:"w-full",children:t("common.apply")})]})]})]})]})]})]}),i.jsx(zZe,{widgets:L,storageKey:"bambusy-dashboard-layout-v2",stackBelow:640,hideControls:!0},l)]})}function JZe({plug:t,onEdit:e}){const{t:n}=Mt(),r=tn(),{showToast:a}=bn(),[s,o]=w.useState(!1),[l,c]=w.useState(!1),[d,u]=w.useState(!1),[m,p]=w.useState(!1),{data:f,isLoading:y}=Je({queryKey:["smart-plug-status",t.id],queryFn:()=>be.getSmartPlugStatus(t.id),refetchInterval:3e4}),{data:x}=Je({queryKey:["printers"],queryFn:be.getPrinters}),b=x?.find(D=>D.id===t.printer_id),v=ut({mutationFn:D=>be.controlSmartPlug(t.id,D),onMutate:async D=>{await r.cancelQueries({queryKey:["smart-plug-status",t.id]});const $=r.getQueryData(["smart-plug-status",t.id]),U=D==="on"?"ON":D==="off"||f?.state==="ON"?"OFF":"ON";return r.setQueryData(["smart-plug-status",t.id],G=>({...G,state:U})),{previousStatus:$}},onError:(D,$,U)=>{U?.previousStatus&&r.setQueryData(["smart-plug-status",t.id],U.previousStatus),a(n("smartPlugs.failedToTurn",{action:$,name:t.name}),"error")},onSettled:()=>{setTimeout(()=>{r.invalidateQueries({queryKey:["smart-plug-status",t.id]}),r.invalidateQueries({queryKey:["smart-plugs"]})},1e3)}}),_=ut({mutationFn:D=>be.updateSmartPlug(t.id,D),onSuccess:()=>{r.invalidateQueries({queryKey:["smart-plugs"]}),t.printer_id&&(r.invalidateQueries({queryKey:["smartPlugByPrinter",t.printer_id]}),r.invalidateQueries({queryKey:["scriptPlugsByPrinter",t.printer_id]}))}}),k=ut({mutationFn:()=>be.deleteSmartPlug(t.id),onSuccess:()=>{r.invalidateQueries({queryKey:["smart-plugs"]}),t.printer_id&&r.invalidateQueries({queryKey:["scriptPlugsByPrinter",t.printer_id]})}}),P=f?.state==="ON",C=t.plug_type==="mqtt"&&f?.energy?.power!==null&&f?.energy?.power!==void 0,T=(f?.reachable??!1)||C,N=v.isPending,A=(()=>{if(t.plug_type!=="tasmota"||!t.ip_address)return null;const D=t.ip_address;return t.username&&t.password?`http://${encodeURIComponent(t.username)}:${encodeURIComponent(t.password)}@${D}/`:`http://${D}/`})();return i.jsxs(i.Fragment,{children:[i.jsx(Tt,{className:"relative",children:i.jsxs(Pt,{className:"p-4",children:[i.jsxs("div",{className:"flex items-start justify-between gap-2 mb-3",children:[i.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[i.jsx("div",{className:`p-2 rounded-lg flex-shrink-0 ${t.plug_type==="mqtt"?T?"bg-teal-500/20":"bg-red-500/20":T?P?"bg-bambu-green/20":"bg-bambu-dark":"bg-red-500/20"}`,children:t.plug_type==="mqtt"?i.jsx(KF,{className:`w-5 h-5 ${T?"text-teal-400":"text-red-400"}`}):t.plug_type==="homeassistant"?i.jsx(D0,{className:`w-5 h-5 ${T?P?"text-bambu-green":"text-bambu-gray":"text-red-400"}`}):i.jsx(fl,{className:`w-5 h-5 ${T?P?"text-bambu-green":"text-bambu-gray":"text-red-400"}`})}),i.jsxs("div",{className:"min-w-0",children:[i.jsx("h3",{className:"font-medium text-white truncate",children:t.name}),i.jsx("p",{className:"text-sm text-bambu-gray truncate",title:t.plug_type==="mqtt"?t.mqtt_topic??void 0:t.plug_type==="homeassistant"?t.ha_entity_id??void 0:t.ip_address??void 0,children:t.plug_type==="mqtt"?t.mqtt_topic:t.plug_type==="homeassistant"?t.ha_entity_id:t.ip_address})]})]}),i.jsxs("div",{className:"flex flex-col items-end gap-1 flex-shrink-0",children:[y?i.jsx(ct,{className:"w-4 h-4 text-bambu-gray animate-spin"}):t.plug_type==="mqtt"?i.jsxs("div",{className:"flex items-center gap-1.5 text-sm whitespace-nowrap",children:[i.jsx("span",{className:"px-1.5 py-0.5 bg-teal-500/20 text-teal-400 text-[10px] font-medium rounded flex-shrink-0",children:"MQTT"}),T&&i.jsx("span",{className:"text-status-ok",children:"✓"})]}):t.plug_type==="homeassistant"?i.jsxs("div",{className:"flex items-center gap-1 text-sm",children:[i.jsx("span",{className:"px-1 py-0.5 bg-blue-500/20 text-blue-400 text-[10px] font-medium rounded",children:"HA"}),i.jsx("span",{className:T?P?"text-status-ok":"text-bambu-gray":"text-status-error",children:T?f?.state||"?":n("smartPlugs.offline")})]}):T?i.jsxs("div",{className:"flex items-center gap-1 text-sm",children:[i.jsx(hb,{className:"w-4 h-4 text-status-ok"}),i.jsx("span",{className:P?"text-status-ok":"text-bambu-gray",children:f?.state||n("smartPlugs.unknown")})]}):i.jsxs("div",{className:"flex items-center gap-1 text-sm text-status-error",children:[i.jsx(rh,{className:"w-4 h-4"}),i.jsx("span",{children:n("smartPlugs.offline")})]}),A&&i.jsxs("a",{href:A,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 px-2 py-0.5 bg-bambu-dark hover:bg-bambu-dark-tertiary text-bambu-gray hover:text-white text-xs rounded-full transition-colors",title:n("smartPlugs.openPlugAdminPage"),children:[i.jsx(ei,{className:"w-3 h-3"}),n("smartPlugs.admin")]})]})]}),b&&i.jsxs("div",{className:"mb-3 px-2 py-1.5 bg-bambu-dark rounded-lg",children:[i.jsxs("span",{className:"text-xs text-bambu-gray",children:[n("smartPlugs.linkedTo")," "]}),i.jsx("span",{className:"text-sm text-white",children:b.name})]}),(t.power_alert_enabled||t.schedule_enabled||t.plug_type==="mqtt")&&i.jsxs("div",{className:"flex flex-wrap gap-1.5 mb-3",children:[t.plug_type==="mqtt"&&i.jsxs("span",{className:"flex items-center gap-1 px-2 py-0.5 bg-teal-500/20 text-teal-400 text-xs rounded-full",children:[i.jsx(tc,{className:"w-3 h-3"}),n("smartPlugs.monitorOnly")]}),t.power_alert_enabled&&i.jsxs("span",{className:"flex items-center gap-1 px-2 py-0.5 bg-yellow-500/20 text-yellow-400 text-xs rounded-full",children:[i.jsx(ub,{className:"w-3 h-3"}),n("smartPlugs.alerts")]}),t.schedule_enabled&&i.jsxs("span",{className:"flex items-center gap-1 px-2 py-0.5 bg-blue-500/20 text-blue-400 text-xs rounded-full",children:[i.jsx(Xr,{className:"w-3 h-3"}),t.schedule_on_time&&t.schedule_off_time?`${t.schedule_on_time} - ${t.schedule_off_time}`:t.schedule_on_time?n("smartPlugs.scheduleOn",{time:t.schedule_on_time}):n("smartPlugs.scheduleOff",{time:t.schedule_off_time})]})]}),t.plug_type!=="mqtt"&&i.jsxs("div",{className:"flex gap-2 mb-3",children:[i.jsxs(Fe,{size:"sm",variant:P?"primary":"secondary",disabled:!T||N,onClick:()=>c(!0),className:"flex-1",children:[N?i.jsx(ct,{className:"w-4 h-4 animate-spin"}):i.jsx(wu,{className:"w-4 h-4"}),n("smartPlugs.on")]}),i.jsxs(Fe,{size:"sm",variant:P?"secondary":"primary",disabled:!T||N,onClick:()=>u(!0),className:"flex-1",children:[N?i.jsx(ct,{className:"w-4 h-4 animate-spin"}):i.jsx(fC,{className:"w-4 h-4"}),n("smartPlugs.off")]})]}),t.plug_type==="mqtt"&&f?.energy&&i.jsxs("div",{className:"flex gap-2 mb-3 px-3 py-2 bg-bambu-dark rounded-lg",children:[f.energy.power!==null&&f.energy.power!==void 0&&i.jsxs("div",{className:"flex-1 text-center",children:[i.jsxs("p",{className:"text-lg font-semibold text-white",children:[Math.round(f.energy.power),"W"]}),i.jsx("p",{className:"text-xs text-bambu-gray",children:n("smartPlugs.power")})]}),f.energy.today!==null&&f.energy.today!==void 0&&i.jsxs("div",{className:"flex-1 text-center border-l border-bambu-dark-tertiary",children:[i.jsx("p",{className:"text-lg font-semibold text-white",children:f.energy.today.toFixed(3)}),i.jsx("p",{className:"text-xs text-bambu-gray",children:n("smartPlugs.kwhToday")})]})]}),i.jsxs("button",{onClick:()=>p(!m),className:"w-full flex items-center justify-between py-2 text-sm text-bambu-gray hover:text-white transition-colors",children:[i.jsxs("span",{className:"flex items-center gap-2",children:[i.jsx(lu,{className:"w-4 h-4"}),t.plug_type==="mqtt"?n("smartPlugs.settings"):n("smartPlugs.automationSettings")]}),i.jsx("span",{children:m?"-":"+"})]}),m&&i.jsxs("div",{className:"pt-3 border-t border-bambu-dark-tertiary space-y-4",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(R0,{className:"w-4 h-4 text-bambu-green"}),i.jsxs("div",{children:[i.jsx("p",{className:"text-sm text-white",children:n("smartPlugs.showInSwitchbar")}),i.jsx("p",{className:"text-xs text-bambu-gray",children:n("smartPlugs.quickAccessSidebar")})]})]}),i.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[i.jsx("input",{type:"checkbox",checked:t.show_in_switchbar,onChange:D=>_.mutate({show_in_switchbar:D.target.checked}),className:"sr-only peer"}),i.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.plug_type!=="mqtt"&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-sm text-white",children:n("smartPlugs.enabled")}),i.jsx("p",{className:"text-xs text-bambu-gray",children:n("smartPlugs.enableAutomation")})]}),i.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[i.jsx("input",{type:"checkbox",checked:t.enabled,onChange:D=>_.mutate({enabled:D.target.checked}),className:"sr-only peer"}),i.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"})]})]}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-sm text-white",children:n("smartPlugs.autoOn")}),i.jsx("p",{className:"text-xs text-bambu-gray",children:n("smartPlugs.autoOnDescription")})]}),i.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[i.jsx("input",{type:"checkbox",checked:t.auto_on,onChange:D=>_.mutate({auto_on:D.target.checked}),className:"sr-only peer"}),i.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"})]})]}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-sm text-white",children:n("smartPlugs.autoOff")}),i.jsx("p",{className:"text-xs text-bambu-gray",children:n("smartPlugs.autoOffDescription")})]}),i.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[i.jsx("input",{type:"checkbox",checked:t.auto_off,onChange:D=>_.mutate({auto_off:D.target.checked}),className:"sr-only peer"}),i.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&&i.jsxs("div",{className:"space-y-3 pl-4 border-l-2 border-bambu-dark-tertiary",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-sm text-white mb-2",children:n("smartPlugs.turnOffDelayMode")}),i.jsxs("div",{className:"flex gap-2",children:[i.jsxs("button",{onClick:()=>_.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:[i.jsx(er,{className:"w-4 h-4"}),n("smartPlugs.time")]}),i.jsxs("button",{onClick:()=>_.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:[i.jsx(xC,{className:"w-4 h-4"}),n("smartPlugs.temp")]})]})]}),t.off_delay_mode==="time"?i.jsxs("div",{children:[i.jsx("label",{className:"block text-xs text-bambu-gray mb-1",children:n("smartPlugs.delayMinutes")}),i.jsx("input",{type:"number",min:"1",max:"60",value:t.off_delay_minutes,onChange:D=>_.mutate({off_delay_minutes:parseInt(D.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"})]}):i.jsxs("div",{children:[i.jsx("label",{className:"block text-xs text-bambu-gray mb-1",children:n("smartPlugs.tempThreshold")}),i.jsx("input",{type:"number",min:"30",max:"100",value:t.off_temp_threshold,onChange:D=>_.mutate({off_temp_threshold:parseInt(D.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"}),i.jsx("p",{className:"text-xs text-bambu-gray mt-1",children:n("smartPlugs.tempThresholdDescription")})]})]})]}),i.jsxs("div",{className:"flex gap-2 pt-2",children:[i.jsxs(Fe,{size:"sm",variant:"secondary",onClick:()=>e(t),className:"flex-1",children:[i.jsx(Mm,{className:"w-4 h-4"}),n("smartPlugs.edit")]}),i.jsx(Fe,{size:"sm",variant:"secondary",onClick:()=>o(!0),className:"text-red-400 hover:text-red-300",children:i.jsx(Qt,{className:"w-4 h-4"})})]})]})]})}),s&&i.jsx(Nn,{title:n("smartPlugs.deleteSmartPlug"),message:n("smartPlugs.deleteConfirm",{name:t.name}),confirmText:n("smartPlugs.delete"),variant:"danger",onConfirm:()=>{k.mutate(),o(!1)},onCancel:()=>o(!1)}),l&&i.jsx(Nn,{title:n("smartPlugs.turnOnSmartPlug"),message:n("smartPlugs.turnOnConfirm",{name:t.name}),confirmText:n("smartPlugs.turnOn"),variant:"default",onConfirm:()=>{v.mutate("on"),c(!1)},onCancel:()=>c(!1)}),d&&i.jsx(Nn,{title:n("smartPlugs.turnOffSmartPlug"),message:n("smartPlugs.turnOffConfirm",{name:t.name}),confirmText:n("smartPlugs.turnOff"),variant:"danger",onConfirm:()=>{v.mutate("off"),u(!1)},onCancel:()=>u(!1)})]})}function eJe({plug:t,onClose:e}){const{t:n}=Mt(),r=tn(),a=!!t,[s,o]=w.useState(t?.plug_type||"tasmota"),[l,c]=w.useState(t?.name||""),[d,u]=w.useState(t?.ip_address||""),[m,p]=w.useState(t?.username||""),[f,y]=w.useState(t?.password||""),[x,b]=w.useState(t?.ha_entity_id||""),[v,_]=w.useState(t?.mqtt_power_topic||t?.mqtt_topic||""),[k,P]=w.useState(t?.mqtt_power_path||""),[C,T]=w.useState((t?.mqtt_power_multiplier??t?.mqtt_multiplier??1).toString()),[N,R]=w.useState(t?.mqtt_energy_topic||""),[A,D]=w.useState(t?.mqtt_energy_path||""),[$,U]=w.useState((t?.mqtt_energy_multiplier??1).toString()),[G,L]=w.useState(t?.mqtt_state_topic||""),[te,re]=w.useState(t?.mqtt_state_path||""),[J,ue]=w.useState(t?.mqtt_state_on_value||""),[me,ge]=w.useState(t?.ha_power_entity||""),[X,ie]=w.useState(t?.ha_energy_today_entity||""),[le,pe]=w.useState(t?.ha_energy_total_entity||""),[Ce,q]=w.useState(""),[Z,j]=w.useState(""),[E,I]=w.useState(!1),W=w.useRef(null),[B,ae]=w.useState(""),[z,V]=w.useState(!1),ee=w.useRef(null),[K,ne]=w.useState(""),[se,ce]=w.useState(!1),fe=w.useRef(null),[oe,O]=w.useState(""),[F,Q]=w.useState(!1),ve=w.useRef(null),[he,de]=w.useState(t?.printer_id||null),[Ae,_e]=w.useState(null),[ze,Be]=w.useState(null),[Ue,Ne]=w.useState(t?.power_alert_enabled||!1),[Ee,ke]=w.useState(t?.power_alert_high?.toString()||""),[Me,Ge]=w.useState(t?.power_alert_low?.toString()||""),[xe,He]=w.useState(t?.schedule_enabled||!1),[Pe,Ve]=w.useState(t?.schedule_on_time||""),[je,ye]=w.useState(t?.schedule_off_time||""),[$e,Ye]=w.useState(t?.show_in_switchbar||!1),[lt,St]=w.useState(t?.show_on_printer_card??!0),[ot,ft]=w.useState(!1),[qe,ht]=w.useState({scanned:0,total:0}),[yt,Bt]=w.useState([]),Yt=w.useRef(null),{data:xn}=Je({queryKey:["printers"],queryFn:be.getPrinters}),{data:Xt}=Je({queryKey:["smart-plugs"],queryFn:be.getSmartPlugs}),{data:$t}=Je({queryKey:["settings"],queryFn:be.getSettings}),nn=!!($t?.ha_enabled&&$t?.ha_url&&$t?.ha_token);w.useEffect(()=>{const Le=setTimeout(()=>{j(Ce)},300);return()=>clearTimeout(Le)},[Ce]),w.useEffect(()=>{const Le=mt=>{W.current&&!W.current.contains(mt.target)&&I(!1),ee.current&&!ee.current.contains(mt.target)&&V(!1),fe.current&&!fe.current.contains(mt.target)&&ce(!1),ve.current&&!ve.current.contains(mt.target)&&Q(!1)};return document.addEventListener("mousedown",Le),()=>document.removeEventListener("mousedown",Le)},[]);const{data:on,isLoading:cn,error:pn}=Je({queryKey:["ha-entities",Z],queryFn:()=>be.getHAEntities(Z||void 0),enabled:s==="homeassistant"&&nn,retry:!1,staleTime:0}),{data:Ie}=Je({queryKey:["ha-sensor-entities"],queryFn:be.getHASensorEntities,enabled:s==="homeassistant"&&nn,retry:!1,staleTime:0});w.useEffect(()=>{const Le=mt=>{mt.key==="Escape"&&e()};return window.addEventListener("keydown",Le),()=>{window.removeEventListener("keydown",Le),Yt.current&&clearInterval(Yt.current)}},[e]);const De=async()=>{ft(!0),Bt([]),ht({scanned:0,total:0}),Be(null);try{await be.startTasmotaScan();const Le=async()=>{try{const mt=await be.getTasmotaScanStatus();ht({scanned:mt.scanned,total:mt.total});const st=await be.getDiscoveredTasmotaDevices();Bt(st),mt.running||(ft(!1),Yt.current&&(clearInterval(Yt.current),Yt.current=null))}catch(mt){console.error("Polling error:",mt)}};await Le(),Yt.current=setInterval(Le,500)}catch(Le){ft(!1);const mt=Le instanceof Error?Le.message:typeof Le=="string"?Le:JSON.stringify(Le);Be(mt||n("smartPlugs.failedToStartScan"))}},Xe=async()=>{try{await be.stopTasmotaScan()}catch{}ft(!1),Yt.current&&(clearInterval(Yt.current),Yt.current=null)},at=Le=>{u(Le.ip_address),c(Le.name),_e(null)},Ke=ut({mutationFn:()=>be.testSmartPlugConnection(d,m||null,f||null),onSuccess:Le=>{_e(Le),Be(null),!l&&Le.device_name&&c(Le.device_name)},onError:Le=>{_e(null),Be(Le.message)}}),It=ut({mutationFn:Le=>be.createSmartPlug(Le),onSuccess:()=>{r.invalidateQueries({queryKey:["smart-plugs"]}),r.invalidateQueries({queryKey:["scriptPlugsByPrinter"]}),e()},onError:Le=>{Be(Le.message)}}),Te=ut({mutationFn:Le=>be.updateSmartPlug(t.id,Le),onSuccess:()=>{r.invalidateQueries({queryKey:["smart-plugs"]}),r.invalidateQueries({queryKey:["scriptPlugsByPrinter"]}),e()},onError:Le=>{Be(Le.message)}}),We=xn?.filter(Le=>s==="tasmota"?!Xt?.some(st=>st.printer_id===Le.id&&st.id!==t?.id&&st.plug_type==="tasmota"):!0),et=Le=>{if(Le.preventDefault(),Be(null),!l.trim()){Be(n("smartPlugs.nameRequired"));return}if(s==="tasmota"&&!d.trim()){Be("IP address is required for Tasmota plugs");return}if(s==="homeassistant"&&!x){Be(n("smartPlugs.entityRequired"));return}if(s==="mqtt"){const st=v.trim(),tt=N.trim(),Nt=G.trim();if(!st&&!tt&&!Nt){Be(n("smartPlugs.mqttTopicRequired"));return}}const mt={name:l.trim(),plug_type:s,ip_address:s==="tasmota"?d.trim():null,ha_entity_id:s==="homeassistant"?x:null,ha_power_entity:s==="homeassistant"&&me||null,ha_energy_today_entity:s==="homeassistant"&&X||null,ha_energy_total_entity:s==="homeassistant"&&le||null,mqtt_power_topic:s==="mqtt"&&v.trim()||null,mqtt_power_path:s==="mqtt"&&k.trim()||null,mqtt_power_multiplier:s==="mqtt"&&parseFloat(C)||1,mqtt_energy_topic:s==="mqtt"&&N.trim()||null,mqtt_energy_path:s==="mqtt"&&A.trim()||null,mqtt_energy_multiplier:s==="mqtt"&&parseFloat($)||1,mqtt_state_topic:s==="mqtt"&&G.trim()||null,mqtt_state_path:s==="mqtt"&&te.trim()||null,mqtt_state_on_value:s==="mqtt"&&J.trim()||null,username:s==="tasmota"&&m.trim()||null,password:s==="tasmota"&&f.trim()||null,printer_id:he,power_alert_enabled:Ue,power_alert_high:Ee?parseFloat(Ee):null,power_alert_low:Me?parseFloat(Me):null,schedule_enabled:xe,schedule_on_time:Pe||null,schedule_off_time:je||null,show_in_switchbar:$e,show_on_printer_card:lt};a?Te.mutate(mt):It.mutate(mt)},Ze=It.isPending||Te.isPending;return i.jsx("div",{className:"fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-4",onClick:e,children:i.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:Le=>Le.stopPropagation(),children:[i.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-bambu-dark-tertiary flex-shrink-0",children:[i.jsx("h2",{className:"text-lg font-semibold text-white",children:n(a?"smartPlugs.editTitle":"smartPlugs.addTitle")}),i.jsx("button",{onClick:e,className:"text-bambu-gray hover:text-white transition-colors",children:i.jsx(zt,{className:"w-5 h-5"})})]}),i.jsxs("form",{onSubmit:et,className:"p-6 space-y-4 overflow-y-auto",children:[ze&&i.jsx("div",{className:"p-3 bg-red-500/20 border border-red-500/50 rounded-lg text-sm text-red-400",children:ze}),!a&&i.jsxs("div",{className:"flex gap-2 mb-2",children:[i.jsxs("button",{type:"button",onClick:()=>{o("tasmota"),_e(null),Be(null)},className:`flex-1 flex items-center justify-center gap-2 px-3 py-2.5 rounded-lg font-medium transition-colors ${s==="tasmota"?"bg-bambu-green text-white":"bg-bambu-dark text-bambu-gray hover:text-white border border-bambu-dark-tertiary"}`,children:[i.jsx(fl,{className:"w-4 h-4"}),"Tasmota"]}),i.jsxs("button",{type:"button",onClick:()=>{o("homeassistant"),_e(null),Be(null)},className:`flex-1 flex items-center justify-center gap-2 px-3 py-2.5 rounded-lg font-medium transition-colors ${s==="homeassistant"?"bg-bambu-green text-white":"bg-bambu-dark text-bambu-gray hover:text-white border border-bambu-dark-tertiary"}`,children:[i.jsx(D0,{className:"w-4 h-4"}),"HA"]}),i.jsxs("button",{type:"button",onClick:()=>{o("mqtt"),_e(null),Be(null)},className:`flex-1 flex items-center justify-center gap-2 px-3 py-2.5 rounded-lg font-medium transition-colors ${s==="mqtt"?"bg-bambu-green text-white":"bg-bambu-dark text-bambu-gray hover:text-white border border-bambu-dark-tertiary"}`,children:[i.jsx(KF,{className:"w-4 h-4"}),"MQTT"]})]}),!a&&s==="tasmota"&&i.jsxs("div",{className:"space-y-3",children:[ot?i.jsxs(Fe,{type:"button",variant:"secondary",onClick:Xe,className:"w-full",children:[i.jsx(zt,{className:"w-4 h-4"}),n("smartPlugs.stopScanning")]}):i.jsxs(Fe,{type:"button",variant:"primary",onClick:De,className:"w-full",children:[i.jsx(Dr,{className:"w-4 h-4"}),n("smartPlugs.discoverTasmota")]}),ot&&qe.total>0&&i.jsxs("div",{className:"space-y-1",children:[i.jsxs("div",{className:"flex justify-between text-xs text-bambu-gray",children:[i.jsx("span",{children:n("smartPlugs.addSmartPlug.scanningNetwork")}),i.jsxs("span",{children:[qe.scanned," / ",qe.total]})]}),i.jsx("div",{className:"w-full bg-bambu-dark-tertiary rounded-full h-2",children:i.jsx("div",{className:"bg-bambu-green h-2 rounded-full transition-all duration-300",style:{width:`${qe.scanned/qe.total*100}%`}})})]}),yt.length>0&&i.jsxs("div",{className:"space-y-2",children:[i.jsx("p",{className:"text-xs text-bambu-gray",children:n("smartPlugs.foundDevices",{count:yt.length})}),i.jsx("div",{className:"max-h-40 overflow-y-auto space-y-1",children:yt.map(Le=>i.jsxs("button",{type:"button",onClick:()=>at(Le),className:"w-full flex items-center justify-between p-2 bg-bambu-dark hover:bg-bambu-dark-tertiary rounded-lg transition-colors text-left border border-bambu-dark-tertiary",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(fl,{className:"w-4 h-4 text-bambu-green"}),i.jsxs("div",{children:[i.jsx("p",{className:"text-sm text-white",children:Le.name}),i.jsx("p",{className:"text-xs text-bambu-gray",children:Le.ip_address})]})]}),Le.state&&i.jsxs("span",{className:`flex items-center gap-1 text-xs ${Le.state==="ON"?"text-bambu-green":"text-bambu-gray"}`,children:[i.jsx(wu,{className:"w-3 h-3"}),Le.state]})]},Le.ip_address))})]}),!ot&&yt.length===0&&qe.total>0&&i.jsx("p",{className:"text-xs text-bambu-gray text-center py-2",children:n("smartPlugs.noDevicesFound")})]}),s==="homeassistant"&&i.jsxs("div",{className:"space-y-3",children:[!nn&&i.jsxs("div",{className:"space-y-3",children:[i.jsxs("div",{className:"p-3 bg-yellow-500/20 border border-yellow-500/50 rounded-lg text-sm text-yellow-400",children:[n("smartPlugs.haNotConfigured")," ",i.jsx("span",{className:"font-medium",children:n("smartPlugs.haSettingsPath")})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm text-bambu-gray mb-1 opacity-50",children:n("smartPlugs.selectEntity")}),i.jsx("select",{disabled:!0,className:"w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-bambu-gray cursor-not-allowed opacity-50",children:i.jsx("option",{children:n("smartPlugs.addSmartPlug.chooseEntity")})})]})]}),nn&&i.jsxs(i.Fragment,{children:[cn&&i.jsxs("div",{className:"flex items-center justify-center py-4 text-bambu-gray",children:[i.jsx(ct,{className:"w-5 h-5 animate-spin mr-2"}),n("smartPlugs.loadingEntities")]}),pn&&i.jsx("div",{className:"p-3 bg-red-500/20 border border-red-500/50 rounded-lg text-sm text-red-400",children:n("smartPlugs.failedToLoadEntities",{error:pn.message})}),(()=>{const Le=Xt?.filter(tt=>tt.ha_entity_id&&tt.id!==t?.id).map(tt=>tt.ha_entity_id)||[],mt=(on||[]).filter(tt=>!Le.includes(tt.entity_id)),st=on?.find(tt=>tt.entity_id===x);return i.jsxs("div",{ref:W,className:"relative",children:[i.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:n("smartPlugs.selectEntity")}),i.jsxs("div",{className:"relative",children:[i.jsx(Dr,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray pointer-events-none"}),i.jsx("input",{type:"text",value:E?Ce:st?`${st.friendly_name} (${st.entity_id})`:"",onChange:tt=>{q(tt.target.value),E||I(!0)},onFocus:()=>{I(!0),q("")},placeholder:n("smartPlugs.addSmartPlug.placeholders.searchEntities"),className:"w-full pl-9 pr-8 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:border-bambu-green focus:outline-none"}),x&&!E&&i.jsx("button",{type:"button",onClick:()=>{b(""),q("")},className:"absolute right-2 top-1/2 -translate-y-1/2 p-1 hover:bg-bambu-dark-tertiary rounded",children:i.jsx(zt,{className:"w-4 h-4 text-bambu-gray hover:text-white"})}),cn&&i.jsx(ct,{className:"absolute right-2 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray animate-spin"})]}),E&&i.jsxs("div",{className:"absolute z-50 w-full mt-1 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg shadow-lg max-h-60 overflow-y-auto",children:[cn&&i.jsxs("div",{className:"px-3 py-2 text-sm text-bambu-gray flex items-center gap-2",children:[i.jsx(ct,{className:"w-4 h-4 animate-spin"}),n("smartPlugs.loading")]}),!cn&&mt.length===0&&i.jsx("div",{className:"px-3 py-2 text-sm text-bambu-gray",children:Z?n("smartPlugs.noEntitiesMatching",{search:Z}):n("smartPlugs.noEntitiesAvailable")}),!cn&&mt.map(tt=>i.jsxs("button",{type:"button",onClick:()=>{b(tt.entity_id),I(!1),q(""),l||c(tt.friendly_name)},className:`w-full px-3 py-2 text-left text-sm hover:bg-bambu-dark-tertiary transition-colors ${tt.entity_id===x?"bg-bambu-green/20 text-bambu-green":"text-white"}`,children:[i.jsx("div",{className:"font-medium",children:tt.friendly_name}),i.jsxs("div",{className:"text-xs text-bambu-gray flex items-center justify-between",children:[i.jsx("span",{children:tt.entity_id}),i.jsx("span",{className:tt.state==="on"?"text-bambu-green":"",children:tt.state})]})]},tt.entity_id))]}),i.jsx("p",{className:"text-xs text-bambu-gray mt-1",children:Z?n("smartPlugs.searchingEntities",{count:mt.length}):n("smartPlugs.showingEntities",{count:mt.length})})]})})(),x&&Ie&&Ie.length>0&&i.jsxs("div",{className:"border-t border-bambu-dark-tertiary pt-4 mt-4 space-y-3",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-white font-medium mb-1",children:n("smartPlugs.energyMonitoringOptional")}),i.jsx("p",{className:"text-xs text-bambu-gray mb-3",children:n("smartPlugs.energyMonitoringHint")})]}),(()=>{const Le=Ie.filter(tt=>tt.unit_of_measurement==="W"||tt.unit_of_measurement==="kW"||tt.unit_of_measurement==="mW"),mt=B?Le.filter(tt=>tt.entity_id.toLowerCase().includes(B.toLowerCase())||tt.friendly_name.toLowerCase().includes(B.toLowerCase())):Le,st=Ie.find(tt=>tt.entity_id===me);return i.jsxs("div",{ref:ee,className:"relative",children:[i.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:n("smartPlugs.powerSensorW")}),i.jsxs("div",{className:"relative",children:[i.jsx(Dr,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray pointer-events-none"}),i.jsx("input",{type:"text",value:z?B:st?`${st.friendly_name} (${st.state} ${st.unit_of_measurement})`:"",onChange:tt=>{ae(tt.target.value),z||V(!0)},onFocus:()=>{V(!0),ae("")},placeholder:n("smartPlugs.addSmartPlug.placeholders.searchPowerSensors"),className:"w-full pl-9 pr-8 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:border-bambu-green focus:outline-none"}),me&&!z&&i.jsx("button",{type:"button",onClick:()=>{ge(""),ae("")},className:"absolute right-2 top-1/2 -translate-y-1/2 p-1 hover:bg-bambu-dark-tertiary rounded",children:i.jsx(zt,{className:"w-4 h-4 text-bambu-gray hover:text-white"})})]}),z&&i.jsxs("div",{className:"absolute z-50 w-full mt-1 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg shadow-lg max-h-48 overflow-y-auto",children:[i.jsx("button",{type:"button",onClick:()=>{ge(""),V(!1),ae("")},className:"w-full px-3 py-2 text-left text-sm text-bambu-gray hover:bg-bambu-dark-tertiary",children:n("smartPlugs.none")}),mt.map(tt=>i.jsxs("button",{type:"button",onClick:()=>{ge(tt.entity_id),V(!1),ae("")},className:`w-full px-3 py-2 text-left text-sm hover:bg-bambu-dark-tertiary ${tt.entity_id===me?"bg-bambu-green/20 text-bambu-green":"text-white"}`,children:[i.jsx("div",{className:"font-medium",children:tt.friendly_name}),i.jsxs("div",{className:"text-xs text-bambu-gray",children:[tt.entity_id," • ",tt.state," ",tt.unit_of_measurement]})]},tt.entity_id)),mt.length===0&&i.jsx("div",{className:"px-3 py-2 text-sm text-bambu-gray",children:n("smartPlugs.noMatchingSensors")})]})]})})(),(()=>{const Le=Ie.filter(tt=>tt.unit_of_measurement==="kWh"||tt.unit_of_measurement==="Wh"||tt.unit_of_measurement==="MWh"),mt=K?Le.filter(tt=>tt.entity_id.toLowerCase().includes(K.toLowerCase())||tt.friendly_name.toLowerCase().includes(K.toLowerCase())):Le,st=Ie.find(tt=>tt.entity_id===X);return i.jsxs("div",{ref:fe,className:"relative",children:[i.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:n("smartPlugs.energyTodayKwh")}),i.jsxs("div",{className:"relative",children:[i.jsx(Dr,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray pointer-events-none"}),i.jsx("input",{type:"text",value:se?K:st?`${st.friendly_name} (${st.state} ${st.unit_of_measurement})`:"",onChange:tt=>{ne(tt.target.value),se||ce(!0)},onFocus:()=>{ce(!0),ne("")},placeholder:n("smartPlugs.addSmartPlug.placeholders.searchEnergySensors"),className:"w-full pl-9 pr-8 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:border-bambu-green focus:outline-none"}),X&&!se&&i.jsx("button",{type:"button",onClick:()=>{ie(""),ne("")},className:"absolute right-2 top-1/2 -translate-y-1/2 p-1 hover:bg-bambu-dark-tertiary rounded",children:i.jsx(zt,{className:"w-4 h-4 text-bambu-gray hover:text-white"})})]}),se&&i.jsxs("div",{className:"absolute z-50 w-full mt-1 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg shadow-lg max-h-48 overflow-y-auto",children:[i.jsx("button",{type:"button",onClick:()=>{ie(""),ce(!1),ne("")},className:"w-full px-3 py-2 text-left text-sm text-bambu-gray hover:bg-bambu-dark-tertiary",children:n("smartPlugs.none")}),mt.map(tt=>i.jsxs("button",{type:"button",onClick:()=>{ie(tt.entity_id),ce(!1),ne("")},className:`w-full px-3 py-2 text-left text-sm hover:bg-bambu-dark-tertiary ${tt.entity_id===X?"bg-bambu-green/20 text-bambu-green":"text-white"}`,children:[i.jsx("div",{className:"font-medium",children:tt.friendly_name}),i.jsxs("div",{className:"text-xs text-bambu-gray",children:[tt.entity_id," • ",tt.state," ",tt.unit_of_measurement]})]},tt.entity_id)),mt.length===0&&i.jsx("div",{className:"px-3 py-2 text-sm text-bambu-gray",children:n("smartPlugs.noMatchingSensors")})]})]})})(),(()=>{const Le=Ie.filter(tt=>tt.unit_of_measurement==="kWh"||tt.unit_of_measurement==="Wh"||tt.unit_of_measurement==="MWh"),mt=oe?Le.filter(tt=>tt.entity_id.toLowerCase().includes(oe.toLowerCase())||tt.friendly_name.toLowerCase().includes(oe.toLowerCase())):Le,st=Ie.find(tt=>tt.entity_id===le);return i.jsxs("div",{ref:ve,className:"relative",children:[i.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:n("smartPlugs.totalEnergyKwh")}),i.jsxs("div",{className:"relative",children:[i.jsx(Dr,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray pointer-events-none"}),i.jsx("input",{type:"text",value:F?oe:st?`${st.friendly_name} (${st.state} ${st.unit_of_measurement})`:"",onChange:tt=>{O(tt.target.value),F||Q(!0)},onFocus:()=>{Q(!0),O("")},placeholder:n("smartPlugs.addSmartPlug.placeholders.searchEnergySensors"),className:"w-full pl-9 pr-8 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:border-bambu-green focus:outline-none"}),le&&!F&&i.jsx("button",{type:"button",onClick:()=>{pe(""),O("")},className:"absolute right-2 top-1/2 -translate-y-1/2 p-1 hover:bg-bambu-dark-tertiary rounded",children:i.jsx(zt,{className:"w-4 h-4 text-bambu-gray hover:text-white"})})]}),F&&i.jsxs("div",{className:"absolute z-50 w-full mt-1 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg shadow-lg max-h-48 overflow-y-auto",children:[i.jsx("button",{type:"button",onClick:()=>{pe(""),Q(!1),O("")},className:"w-full px-3 py-2 text-left text-sm text-bambu-gray hover:bg-bambu-dark-tertiary",children:n("smartPlugs.none")}),mt.map(tt=>i.jsxs("button",{type:"button",onClick:()=>{pe(tt.entity_id),Q(!1),O("")},className:`w-full px-3 py-2 text-left text-sm hover:bg-bambu-dark-tertiary ${tt.entity_id===le?"bg-bambu-green/20 text-bambu-green":"text-white"}`,children:[i.jsx("div",{className:"font-medium",children:tt.friendly_name}),i.jsxs("div",{className:"text-xs text-bambu-gray",children:[tt.entity_id," • ",tt.state," ",tt.unit_of_measurement]})]},tt.entity_id)),mt.length===0&&i.jsx("div",{className:"px-3 py-2 text-sm text-bambu-gray",children:n("smartPlugs.noMatchingSensors")})]})]})})()]})]})]}),s==="mqtt"&&i.jsxs("div",{className:"space-y-3",children:[!$t?.mqtt_broker&&i.jsxs("div",{className:"p-3 bg-yellow-500/20 border border-yellow-500/50 rounded-lg text-sm text-yellow-400",children:[n("smartPlugs.mqttNotConfigured")," ",i.jsx("span",{className:"font-medium",children:n("smartPlugs.mqttSettingsPath")})," ",n("smartPlugs.mqttNotConfiguredSuffix")]}),$t?.mqtt_broker&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"p-3 bg-blue-500/10 border border-blue-500/30 rounded-lg text-sm text-blue-300",children:[i.jsx("p",{className:"font-medium mb-1",children:n("smartPlugs.monitorOnly")}),i.jsx("p",{className:"text-xs opacity-80",children:n("smartPlugs.mqttMonitorOnlyDescription")})]}),i.jsxs("div",{className:"space-y-3 p-3 bg-bambu-dark rounded-lg border border-bambu-dark-tertiary",children:[i.jsx("p",{className:"text-white font-medium text-sm",children:n("smartPlugs.powerMonitoring")}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:n("smartPlugs.topic")}),i.jsx("input",{type:"text",value:v,onChange:Le=>_(Le.target.value),placeholder:"zigbee2mqtt/shelly-working-room",className:"w-full px-3 py-2 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:border-bambu-green focus:outline-none"})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:n("smartPlugs.jsonPath")}),i.jsx("input",{type:"text",value:k,onChange:Le=>P(Le.target.value),placeholder:"power_l1",className:"w-full px-3 py-2 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:border-bambu-green focus:outline-none"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:n("smartPlugs.multiplier")}),i.jsx("input",{type:"text",value:C,onChange:Le=>T(Le.target.value),placeholder:"1",className:"w-full px-3 py-2 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:border-bambu-green focus:outline-none"})]})]}),i.jsx("p",{className:"text-xs text-bambu-gray",style:{whiteSpace:"pre-line"},children:n("smartPlugs.mqttPowerHint")})]}),i.jsxs("div",{className:"space-y-3 p-3 bg-bambu-dark rounded-lg border border-bambu-dark-tertiary",children:[i.jsxs("p",{className:"text-white font-medium text-sm",children:[n("smartPlugs.energyMonitoring")," ",i.jsxs("span",{className:"text-bambu-gray font-normal",children:["(",n("smartPlugs.optional"),")"]})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:n("smartPlugs.topic")}),i.jsx("input",{type:"text",value:N,onChange:Le=>R(Le.target.value),placeholder:"Same as power topic, or different",className:"w-full px-3 py-2 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:border-bambu-green focus:outline-none"})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:n("smartPlugs.jsonPath")}),i.jsx("input",{type:"text",value:A,onChange:Le=>D(Le.target.value),placeholder:"energy_l1",className:"w-full px-3 py-2 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:border-bambu-green focus:outline-none"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:n("smartPlugs.multiplier")}),i.jsx("input",{type:"text",value:$,onChange:Le=>U(Le.target.value),placeholder:"1",className:"w-full px-3 py-2 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:border-bambu-green focus:outline-none"})]})]}),i.jsx("p",{className:"text-xs text-bambu-gray",style:{whiteSpace:"pre-line"},children:n("smartPlugs.mqttEnergyHint")})]}),i.jsxs("div",{className:"space-y-3 p-3 bg-bambu-dark rounded-lg border border-bambu-dark-tertiary",children:[i.jsxs("p",{className:"text-white font-medium text-sm",children:[n("smartPlugs.stateMonitoring")," ",i.jsxs("span",{className:"text-bambu-gray font-normal",children:["(",n("smartPlugs.optional"),")"]})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:n("smartPlugs.topic")}),i.jsx("input",{type:"text",value:G,onChange:Le=>L(Le.target.value),placeholder:"Same as power topic, or different",className:"w-full px-3 py-2 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:border-bambu-green focus:outline-none"})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:n("smartPlugs.jsonPath")}),i.jsx("input",{type:"text",value:te,onChange:Le=>re(Le.target.value),placeholder:"state_l1",className:"w-full px-3 py-2 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:border-bambu-green focus:outline-none"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:n("smartPlugs.onValue")}),i.jsx("input",{type:"text",value:J,onChange:Le=>ue(Le.target.value),placeholder:n("smartPlugs.addSmartPlug.placeholders.mqttStateOnValue"),className:"w-full px-3 py-2 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:border-bambu-green focus:outline-none"})]})]}),i.jsx("p",{className:"text-xs text-bambu-gray",style:{whiteSpace:"pre-line"},children:n("smartPlugs.mqttStateHint")})]})]})]}),s==="tasmota"&&i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:n("smartPlugs.ipAddress")}),i.jsxs("div",{className:"flex gap-2",children:[i.jsx("input",{type:"text",value:d,onChange:Le=>{u(Le.target.value),_e(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"}),i.jsxs(Fe,{type:"button",variant:"secondary",onClick:()=>Ke.mutate(),disabled:!d.trim()||Ke.isPending,children:[Ke.isPending?i.jsx(ct,{className:"w-4 h-4 animate-spin"}):i.jsx(hb,{className:"w-4 h-4"}),n("smartPlugs.test")]})]})]}),s==="tasmota"&&Ae&&i.jsx("div",{className:`p-3 rounded-lg flex items-center gap-2 ${Ae.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:Ae.success?i.jsxs(i.Fragment,{children:[i.jsx(fr,{className:"w-5 h-5"}),i.jsxs("div",{children:[i.jsx("p",{className:"font-medium",children:n("smartPlugs.connectedResult")}),i.jsxs("p",{className:"text-sm opacity-80",children:[Ae.device_name&&n("smartPlugs.deviceLabel",{name:Ae.device_name}),n("smartPlugs.stateLabel",{state:Ae.state})]})]})]}):i.jsxs(i.Fragment,{children:[i.jsx(rh,{className:"w-5 h-5"}),i.jsx("span",{children:n("smartPlugs.addSmartPlug.connectionFailed")})]})}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:n("smartPlugs.nameLabel")}),i.jsx("input",{type:"text",value:l,onChange:Le=>c(Le.target.value),placeholder:n("smartPlugs.addSmartPlug.placeholders.plugName"),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==="tasmota"&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:n("smartPlugs.username")}),i.jsx("input",{type:"text",value:m,onChange:Le=>p(Le.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"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:n("smartPlugs.password")}),i.jsx("input",{type:"password",value:f,onChange:Le=>y(Le.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"})]})]}),i.jsx("p",{className:"text-xs text-bambu-gray -mt-2",children:n("smartPlugs.authHint")})]}),s!=="mqtt"&&i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:n("smartPlugs.linkToPrinter")}),i.jsxs("select",{value:he??"",onChange:Le=>de(Le.target.value?Number(Le.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:[i.jsx("option",{value:"",children:n("smartPlugs.noPrinter")}),We?.map(Le=>i.jsx("option",{value:Le.id,children:Le.name},Le.id))]}),i.jsx("p",{className:"text-xs text-bambu-gray mt-1",children:n("smartPlugs.linkingDescription")})]}),i.jsxs("div",{className:"border-t border-bambu-dark-tertiary pt-4",children:[i.jsxs("div",{className:"flex items-center justify-between mb-3",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(ub,{className:"w-4 h-4 text-bambu-green"}),i.jsx("span",{className:"text-white font-medium",children:n("smartPlugs.powerAlerts")})]}),i.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[i.jsx("input",{type:"checkbox",checked:Ue,onChange:Le=>Ne(Le.target.checked),className:"sr-only peer"}),i.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"})]})]}),Ue&&i.jsxs("div",{className:"space-y-3",children:[i.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:n("smartPlugs.alertAbove")}),i.jsx("input",{type:"number",value:Ee,onChange:Le=>ke(Le.target.value),placeholder:"e.g. 200",min:"0",max:"5000",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"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:n("smartPlugs.alertBelow")}),i.jsx("input",{type:"number",value:Me,onChange:Le=>Ge(Le.target.value),placeholder:"e.g. 10",min:"0",max:"5000",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"})]})]}),i.jsx("p",{className:"text-xs text-bambu-gray",children:n("smartPlugs.alertDescription")})]})]}),s!=="mqtt"&&i.jsxs("div",{className:"border-t border-bambu-dark-tertiary pt-4",children:[i.jsxs("div",{className:"flex items-center justify-between mb-3",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(er,{className:"w-4 h-4 text-bambu-green"}),i.jsx("span",{className:"text-white font-medium",children:n("smartPlugs.dailySchedule")})]}),i.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[i.jsx("input",{type:"checkbox",checked:xe,onChange:Le=>He(Le.target.checked),className:"sr-only peer"}),i.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"})]})]}),xe&&i.jsxs("div",{className:"space-y-3",children:[i.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:n("smartPlugs.turnOnAt")}),i.jsx("input",{type:"time",value:Pe,onChange:Le=>Ve(Le.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"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:n("smartPlugs.turnOffAt")}),i.jsx("input",{type:"time",value:je,onChange:Le=>ye(Le.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"})]})]}),i.jsx("p",{className:"text-xs text-bambu-gray",children:n("smartPlugs.scheduleDescription")})]})]}),i.jsx("div",{className:"border-t border-bambu-dark-tertiary pt-4",children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(R0,{className:"w-4 h-4 text-bambu-green"}),i.jsxs("div",{children:[i.jsx("span",{className:"text-white font-medium",children:n("smartPlugs.showInSwitchbar")}),i.jsx("p",{className:"text-xs text-bambu-gray",children:n("smartPlugs.quickAccessSidebar")})]})]}),i.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[i.jsx("input",{type:"checkbox",checked:$e,onChange:Le=>Ye(Le.target.checked),className:"sr-only peer"}),i.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==="homeassistant"&&i.jsx("div",{className:"border-t border-bambu-dark-tertiary pt-4",children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(tc,{className:"w-4 h-4 text-bambu-green"}),i.jsxs("div",{children:[i.jsx("span",{className:"text-white font-medium",children:n("smartPlugs.showOnPrinterCard")}),i.jsx("p",{className:"text-xs text-bambu-gray",children:n("smartPlugs.displayOnPrinterCard")})]})]}),i.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[i.jsx("input",{type:"checkbox",checked:lt,onChange:Le=>St(Le.target.checked),className:"sr-only peer"}),i.jsx("div",{className:"w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green"})]})]})}),i.jsxs("div",{className:"flex gap-3 pt-2",children:[i.jsx(Fe,{type:"button",variant:"secondary",onClick:e,className:"flex-1",children:n("smartPlugs.cancel")}),i.jsxs(Fe,{type:"submit",disabled:Ze,className:"flex-1",children:[Ze?i.jsx(ct,{className:"w-4 h-4 animate-spin"}):i.jsx(ps,{className:"w-4 h-4"}),n(a?"smartPlugs.save":"smartPlugs.add")]})]})]})]})})}function Gn({checked:t,onChange:e,disabled:n}){const r=a=>{a.preventDefault(),a.stopPropagation(),n||e(!t)};return i.jsx("button",{type:"button",role:"switch","aria-checked":t,disabled:n,onClick:r,className:`relative inline-flex w-11 h-7 md:w-9 md:h-5 rounded-full transition-colors flex-shrink-0 focus:outline-none focus:ring-2 focus:ring-bambu-green focus:ring-offset-2 focus:ring-offset-bambu-dark ${n?"bg-bambu-dark-tertiary/50 cursor-not-allowed opacity-50":t?"bg-bambu-green cursor-pointer":"bg-bambu-dark-tertiary cursor-pointer hover:bg-bambu-dark-tertiary/80"}`,children:i.jsx("span",{className:`pointer-events-none absolute top-[3px] md:top-[2px] left-[3px] md:left-[2px] w-5 h-5 md:w-4 md:h-4 bg-white rounded-full shadow transition-transform duration-200 ease-in-out ${t?"translate-x-4":"translate-x-0"}`})})}function tJe({provider:t,onEdit:e}){const{t:n}=Mt(),r=tn(),[a,s]=w.useState(!1),[o,l]=w.useState(!1),[c,d]=w.useState(null),{data:u}=Je({queryKey:["printers"],queryFn:be.getPrinters}),m=u?.find(b=>b.id===t.printer_id),p=ut({mutationFn:b=>be.updateNotificationProvider(t.id,b),onSuccess:()=>{r.invalidateQueries({queryKey:["notification-providers"]})}}),f=ut({mutationFn:()=>be.deleteNotificationProvider(t.id),onSuccess:()=>{r.invalidateQueries({queryKey:["notification-providers"]})}}),y=ut({mutationFn:()=>be.testNotificationProvider(t.id),onSuccess:b=>{d(b),r.invalidateQueries({queryKey:["notification-providers"]})},onError:b=>{d({success:!1,message:b.message})}}),x=b=>b||"";return i.jsxs(i.Fragment,{children:[i.jsx(Tt,{className:"relative",children:i.jsxs(Pt,{className:"p-4",children:[i.jsxs("div",{className:"flex items-start justify-between mb-3",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:`p-2 rounded-lg ${t.enabled?"bg-bambu-green/20":"bg-bambu-dark"}`,children:i.jsx(ub,{className:`w-5 h-5 ${t.enabled?"text-bambu-green":"text-bambu-gray"}`})}),i.jsxs("div",{children:[i.jsx("h3",{className:"font-medium text-white",children:t.name}),i.jsx("p",{className:"text-sm text-bambu-gray",children:n(`notifications.providerTypes.${t.provider_type}`,t.provider_type)})]})]}),i.jsxs("div",{className:"flex items-center gap-3",children:[t.last_success&&i.jsx("span",{className:"text-xs text-status-ok hidden sm:inline",children:n("notifications.lastSuccess",{date:Gp(t.last_success)})}),t.last_error&&t.last_error_at&&(!t.last_success||(Jn(t.last_error_at)?.getTime()||0)>(Jn(t.last_success)?.getTime()||0))&&i.jsx("span",{className:"text-xs text-status-error",title:t.last_error,children:n("notifications.error")}),i.jsx(Gn,{checked:t.enabled,onChange:b=>p.mutate({enabled:b})})]})]}),m&&i.jsxs("div",{className:"mb-3 px-2 py-1.5 bg-bambu-dark rounded-lg",children:[i.jsxs("span",{className:"text-xs text-bambu-gray",children:[n("notifications.printer")," "]}),i.jsx("span",{className:"text-sm text-white",children:m.name})]}),!m&&!t.printer_id&&i.jsx("div",{className:"mb-3 px-2 py-1.5 bg-bambu-dark rounded-lg",children:i.jsx("span",{className:"text-xs text-bambu-gray",children:n("notifications.allPrinters")})}),i.jsxs("div",{className:"mb-3 flex flex-wrap gap-1",children:[t.on_print_start&&i.jsx("span",{className:"px-2 py-0.5 bg-blue-500/20 text-blue-400 text-xs rounded",children:n("notifications.start")}),t.on_plate_not_empty&&i.jsx("span",{className:"px-2 py-0.5 bg-rose-600/20 text-rose-300 text-xs rounded",children:n("notifications.plateCheck")}),t.on_print_complete&&i.jsx("span",{className:"px-2 py-0.5 bg-bambu-green/20 text-bambu-green text-xs rounded",children:n("notifications.complete")}),t.on_print_failed&&i.jsx("span",{className:"px-2 py-0.5 bg-red-500/20 text-red-400 text-xs rounded",children:n("notifications.failed")}),t.on_print_stopped&&i.jsx("span",{className:"px-2 py-0.5 bg-orange-500/20 text-orange-400 text-xs rounded",children:n("notifications.stopped")}),t.on_print_progress&&i.jsx("span",{className:"px-2 py-0.5 bg-yellow-500/20 text-yellow-400 text-xs rounded",children:n("notifications.progress")}),t.on_printer_offline&&i.jsx("span",{className:"px-2 py-0.5 bg-gray-500/20 text-gray-400 text-xs rounded",children:n("notifications.offline")}),t.on_printer_error&&i.jsx("span",{className:"px-2 py-0.5 bg-rose-500/20 text-rose-400 text-xs rounded",children:n("notifications.error")}),t.on_filament_low&&i.jsx("span",{className:"px-2 py-0.5 bg-cyan-500/20 text-cyan-400 text-xs rounded",children:n("notifications.lowFilament")}),t.on_maintenance_due&&i.jsx("span",{className:"px-2 py-0.5 bg-purple-500/20 text-purple-400 text-xs rounded",children:n("notifications.maintenance")}),t.on_ams_humidity_high&&i.jsx("span",{className:"px-2 py-0.5 bg-blue-600/20 text-blue-300 text-xs rounded",children:n("notifications.amsHumidity")}),t.on_ams_temperature_high&&i.jsx("span",{className:"px-2 py-0.5 bg-orange-600/20 text-orange-300 text-xs rounded",children:n("notifications.amsTemp")}),t.on_ams_ht_humidity_high&&i.jsx("span",{className:"px-2 py-0.5 bg-cyan-600/20 text-cyan-300 text-xs rounded",children:n("notifications.amsHtHumidity")}),t.on_ams_ht_temperature_high&&i.jsx("span",{className:"px-2 py-0.5 bg-amber-600/20 text-amber-300 text-xs rounded",children:n("notifications.amsHtTemp")}),t.on_bed_cooled&&i.jsx("span",{className:"px-2 py-0.5 bg-teal-500/20 text-teal-400 text-xs rounded",children:n("notifications.bedCooled")}),t.quiet_hours_enabled&&i.jsxs("span",{className:"px-2 py-0.5 bg-indigo-500/20 text-indigo-400 text-xs rounded flex items-center gap-1",children:[i.jsx(G1,{className:"w-3 h-3"}),n("notifications.quiet")]}),t.daily_digest_enabled&&i.jsxs("span",{className:"px-2 py-0.5 bg-emerald-500/20 text-emerald-400 text-xs rounded flex items-center gap-1",children:[i.jsx(Xr,{className:"w-3 h-3"}),n("notifications.digest",{time:t.daily_digest_time})]})]}),i.jsx("div",{className:"mb-3",children:i.jsxs(Fe,{size:"sm",variant:"secondary",disabled:y.isPending,onClick:()=>{d(null),y.mutate()},className:"w-full",children:[y.isPending?i.jsx(ct,{className:"w-4 h-4 animate-spin"}):i.jsx(gC,{className:"w-4 h-4"}),n("notifications.sendTestNotification")]})}),c&&i.jsxs("div",{className:`mb-3 p-2 rounded-lg flex items-center gap-2 text-sm ${c.success?"bg-bambu-green/20 text-bambu-green":"bg-red-500/20 text-red-400"}`,children:[c.success?i.jsx(fr,{className:"w-4 h-4"}):i.jsx(qi,{className:"w-4 h-4"}),i.jsx("span",{children:c.message})]}),i.jsxs("button",{onClick:()=>l(!o),className:"w-full flex items-center justify-between py-2 text-sm text-bambu-gray hover:text-white transition-colors border-t border-bambu-dark-tertiary",children:[i.jsxs("span",{className:"flex items-center gap-2",children:[i.jsx(lu,{className:"w-4 h-4"}),n("notifications.eventSettings")]}),o?i.jsx(vl,{className:"w-4 h-4"}):i.jsx(In,{className:"w-4 h-4"})]}),o&&i.jsxs("div",{className:"pt-3 border-t border-bambu-dark-tertiary space-y-4",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-sm text-white",children:n("notifications.enabled")}),i.jsx("p",{className:"text-xs text-bambu-gray",children:n("notifications.sendFromProvider")})]}),i.jsx(Gn,{checked:t.enabled,onChange:b=>p.mutate({enabled:b})})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("p",{className:"text-xs text-bambu-gray uppercase tracking-wide",children:n("notifications.printEvents")}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("p",{className:"text-sm text-white",children:n("notifications.printStarted")}),i.jsx(Gn,{checked:t.on_print_start,onChange:b=>p.mutate({on_print_start:b})})]}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-sm text-white",children:n("notifications.plateNotEmpty")}),i.jsx("p",{className:"text-xs text-bambu-gray",children:n("notifications.plateNotEmptyDescription")})]}),i.jsx(Gn,{checked:t.on_plate_not_empty??!0,onChange:b=>p.mutate({on_plate_not_empty:b})})]}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("p",{className:"text-sm text-white",children:n("notifications.printCompleted")}),i.jsx(Gn,{checked:t.on_print_complete,onChange:b=>p.mutate({on_print_complete:b})})]}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-sm text-white",children:n("notifications.bedCooledLabel")}),i.jsx("p",{className:"text-xs text-bambu-gray",children:n("notifications.bedCooledDescription")})]}),i.jsx(Gn,{checked:t.on_bed_cooled??!1,onChange:b=>p.mutate({on_bed_cooled:b})})]}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("p",{className:"text-sm text-white",children:n("notifications.printFailed")}),i.jsx(Gn,{checked:t.on_print_failed,onChange:b=>p.mutate({on_print_failed:b})})]}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("p",{className:"text-sm text-white",children:n("notifications.printStopped")}),i.jsx(Gn,{checked:t.on_print_stopped,onChange:b=>p.mutate({on_print_stopped:b})})]}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-sm text-white",children:n("notifications.progressMilestones")}),i.jsx("p",{className:"text-xs text-bambu-gray",children:n("notifications.progressMilestonesDescription")})]}),i.jsx(Gn,{checked:t.on_print_progress,onChange:b=>p.mutate({on_print_progress:b})})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("p",{className:"text-xs text-bambu-gray uppercase tracking-wide",children:n("notifications.printerStatus")}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("p",{className:"text-sm text-white",children:n("notifications.printerOffline")}),i.jsx(Gn,{checked:t.on_printer_offline,onChange:b=>p.mutate({on_printer_offline:b})})]}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("p",{className:"text-sm text-white",children:n("notifications.printerError")}),i.jsx(Gn,{checked:t.on_printer_error,onChange:b=>p.mutate({on_printer_error:b})})]}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("p",{className:"text-sm text-white",children:n("notifications.lowFilamentLabel")}),i.jsx(Gn,{checked:t.on_filament_low,onChange:b=>p.mutate({on_filament_low:b})})]}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-sm text-white",children:n("notifications.maintenanceDue")}),i.jsx("p",{className:"text-xs text-bambu-gray",children:n("notifications.maintenanceDueDescription")})]}),i.jsx(Gn,{checked:t.on_maintenance_due??!1,onChange:b=>p.mutate({on_maintenance_due:b})})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("p",{className:"text-xs text-bambu-gray uppercase tracking-wide",children:n("notifications.amsAlarms")}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-sm text-white",children:n("notifications.amsHumidityHigh")}),i.jsx("p",{className:"text-xs text-bambu-gray",children:n("notifications.amsHumidityHighDescription")})]}),i.jsx(Gn,{checked:t.on_ams_humidity_high??!1,onChange:b=>p.mutate({on_ams_humidity_high:b})})]}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-sm text-white",children:n("notifications.amsTemperatureHigh")}),i.jsx("p",{className:"text-xs text-bambu-gray",children:n("notifications.amsTemperatureHighDescription")})]}),i.jsx(Gn,{checked:t.on_ams_temperature_high??!1,onChange:b=>p.mutate({on_ams_temperature_high:b})})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("p",{className:"text-xs text-bambu-gray uppercase tracking-wide",children:n("notifications.amsHtAlarms")}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-sm text-white",children:n("notifications.amsHtHumidityHigh")}),i.jsx("p",{className:"text-xs text-bambu-gray",children:n("notifications.amsHtHumidityHighDescription")})]}),i.jsx(Gn,{checked:t.on_ams_ht_humidity_high??!1,onChange:b=>p.mutate({on_ams_ht_humidity_high:b})})]}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-sm text-white",children:n("notifications.amsHtTemperatureHigh")}),i.jsx("p",{className:"text-xs text-bambu-gray",children:n("notifications.amsHtTemperatureHighDescription")})]}),i.jsx(Gn,{checked:t.on_ams_ht_temperature_high??!1,onChange:b=>p.mutate({on_ams_ht_temperature_high:b})})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("p",{className:"text-xs text-bambu-gray uppercase tracking-wide",children:n("notifications.printQueue")}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-sm text-white",children:n("notifications.jobAdded")}),i.jsx("p",{className:"text-xs text-bambu-gray",children:n("notifications.jobAddedDescription")})]}),i.jsx(Gn,{checked:t.on_queue_job_added??!1,onChange:b=>p.mutate({on_queue_job_added:b})})]}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-sm text-white",children:n("notifications.jobAssigned")}),i.jsx("p",{className:"text-xs text-bambu-gray",children:n("notifications.jobAssignedDescription")})]}),i.jsx(Gn,{checked:t.on_queue_job_assigned??!1,onChange:b=>p.mutate({on_queue_job_assigned:b})})]}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-sm text-white",children:n("notifications.jobStarted")}),i.jsx("p",{className:"text-xs text-bambu-gray",children:n("notifications.jobStartedDescription")})]}),i.jsx(Gn,{checked:t.on_queue_job_started??!1,onChange:b=>p.mutate({on_queue_job_started:b})})]}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-sm text-white",children:n("notifications.jobWaiting")}),i.jsx("p",{className:"text-xs text-bambu-gray",children:n("notifications.jobWaitingDescription")})]}),i.jsx(Gn,{checked:t.on_queue_job_waiting??!0,onChange:b=>p.mutate({on_queue_job_waiting:b})})]}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-sm text-white",children:n("notifications.jobSkipped")}),i.jsx("p",{className:"text-xs text-bambu-gray",children:n("notifications.jobSkippedDescription")})]}),i.jsx(Gn,{checked:t.on_queue_job_skipped??!0,onChange:b=>p.mutate({on_queue_job_skipped:b})})]}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-sm text-white",children:n("notifications.jobFailed")}),i.jsx("p",{className:"text-xs text-bambu-gray",children:n("notifications.jobFailedDescription")})]}),i.jsx(Gn,{checked:t.on_queue_job_failed??!0,onChange:b=>p.mutate({on_queue_job_failed:b})})]}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-sm text-white",children:n("notifications.queueComplete")}),i.jsx("p",{className:"text-xs text-bambu-gray",children:n("notifications.queueCompleteDescription")})]}),i.jsx(Gn,{checked:t.on_queue_completed??!1,onChange:b=>p.mutate({on_queue_completed:b})})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(G1,{className:"w-4 h-4 text-purple-400"}),i.jsx("p",{className:"text-sm text-white",children:n("notifications.quietHours")})]}),i.jsx(Gn,{checked:t.quiet_hours_enabled,onChange:b=>p.mutate({quiet_hours_enabled:b})})]}),t.quiet_hours_enabled&&i.jsxs("div",{className:"pl-4 border-l-2 border-bambu-dark-tertiary space-y-2",children:[i.jsx("p",{className:"text-xs text-bambu-gray",children:n("notifications.noNotificationsDuring")}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(er,{className:"w-4 h-4 text-bambu-gray"}),i.jsxs("span",{className:"text-sm text-white",children:[x(t.quiet_hours_start)||"22:00"," - ",x(t.quiet_hours_end)||"07:00"]})]}),i.jsx("p",{className:"text-xs text-bambu-gray",children:n("notifications.editProviderToChangeQuietHours")})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(Xr,{className:"w-4 h-4 text-emerald-400"}),i.jsx("p",{className:"text-sm text-white",children:n("notifications.dailyDigest")})]}),i.jsx(Gn,{checked:t.daily_digest_enabled,onChange:b=>p.mutate({daily_digest_enabled:b})})]}),t.daily_digest_enabled&&i.jsxs("div",{className:"pl-4 border-l-2 border-bambu-dark-tertiary space-y-2",children:[i.jsx("p",{className:"text-xs text-bambu-gray",children:n("notifications.batchNotifications")}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(er,{className:"w-4 h-4 text-bambu-gray"}),i.jsx("span",{className:"text-sm text-white",children:n("notifications.sendAt",{time:x(t.daily_digest_time)||"08:00"})})]}),i.jsx("p",{className:"text-xs text-bambu-gray",children:n("notifications.editProviderToChangeDigestTime")})]})]}),i.jsxs("div",{className:"flex gap-2 pt-2",children:[i.jsxs(Fe,{size:"sm",variant:"secondary",onClick:()=>e(t),className:"flex-1",children:[i.jsx(Mm,{className:"w-4 h-4"}),n("notifications.edit")]}),i.jsx(Fe,{size:"sm",variant:"secondary",onClick:()=>s(!0),className:"text-red-400 hover:text-red-300",children:i.jsx(Qt,{className:"w-4 h-4"})})]})]})]})}),a&&i.jsx(Nn,{title:n("notifications.deleteProvider"),message:n("notifications.deleteConfirm",{name:t.name}),confirmText:n("notifications.delete"),variant:"danger",onConfirm:()=>{f.mutate(),s(!1)},onCancel:()=>s(!1)})]})}const nJe=["email","telegram","discord","ntfy","pushover","callmebot","webhook","homeassistant"];function rJe({provider:t,onClose:e}){const{t:n}=Mt(),r=tn(),a=!!t,[s,o]=w.useState(t?.name||""),[l,c]=w.useState(t?.provider_type||"email"),[d,u]=w.useState(t?.printer_id||null),[m,p]=w.useState(t?.quiet_hours_enabled||!1),[f,y]=w.useState(t?.quiet_hours_start||"22:00"),[x,b]=w.useState(t?.quiet_hours_end||"07:00"),[v,_]=w.useState(t?.daily_digest_enabled||!1),[k,P]=w.useState(t?.daily_digest_time||"08:00"),[C,T]=w.useState(t?.on_print_start??!1),[N,R]=w.useState(t?.on_print_complete??!0),[A,D]=w.useState(t?.on_print_failed??!0),[$,U]=w.useState(t?.on_print_stopped??!0),[G,L]=w.useState(t?.on_print_progress??!1),[te,re]=w.useState(t?.on_printer_offline??!1),[J,ue]=w.useState(t?.on_printer_error??!1),[me,ge]=w.useState(t?.on_filament_low??!1),[X,ie]=w.useState(t?.on_maintenance_due??!1),[le,pe]=w.useState(t?.on_bed_cooled??!1),[Ce,q]=w.useState(t?.config?Object.fromEntries(Object.entries(t.config).map(([ce,fe])=>[ce,String(fe)])):{}),[Z,j]=w.useState(null),[E,I]=w.useState(null),{data:W}=Je({queryKey:["printers"],queryFn:be.getPrinters});w.useEffect(()=>{const ce=fe=>{fe.key==="Escape"&&e()};return window.addEventListener("keydown",ce),()=>window.removeEventListener("keydown",ce)},[e]);const B=ut({mutationFn:()=>be.testNotificationConfig({provider_type:l,config:Ce}),onSuccess:ce=>{j(ce),I(null)},onError:ce=>{j({success:!1,message:ce.message})}}),ae=ut({mutationFn:ce=>be.createNotificationProvider(ce),onSuccess:()=>{r.invalidateQueries({queryKey:["notification-providers"]}),e()},onError:ce=>{I(ce.message)}}),z=ut({mutationFn:ce=>be.updateNotificationProvider(t.id,ce),onSuccess:()=>{r.invalidateQueries({queryKey:["notification-providers"]}),e()},onError:ce=>{I(ce.message)}}),V=ce=>{if(ce.preventDefault(),I(null),!s.trim()){I(n("notifications.nameRequired"));return}const fe=ne(l);for(const O of fe)if(!Ce[O.key]?.trim()){I(n("notifications.fieldRequired",{field:O.label}));return}const oe={name:s.trim(),provider_type:l,config:Ce,printer_id:d,quiet_hours_enabled:m,quiet_hours_start:m?f:null,quiet_hours_end:m?x:null,daily_digest_enabled:v,daily_digest_time:v?k:null,on_print_start:C,on_print_complete:N,on_print_failed:A,on_print_stopped:$,on_print_progress:G,on_printer_offline:te,on_printer_error:J,on_filament_low:me,on_maintenance_due:X,on_bed_cooled:le};a?z.mutate(oe):ae.mutate(oe)},ee=ae.isPending||z.isPending,K=ce=>{switch(ce){case"callmebot":return[{key:"phone",label:"Phone Number",placeholder:"+1234567890",type:"text",required:!0},{key:"apikey",label:"API Key",placeholder:"Your CallMeBot API key",type:"text",required:!0}];case"ntfy":return[{key:"server",label:"Server URL",placeholder:"https://ntfy.sh",type:"text",required:!1},{key:"topic",label:"Topic",placeholder:"my-bambuddy",type:"text",required:!0},{key:"auth_token",label:"Auth Token",placeholder:"Optional authentication",type:"password",required:!1}];case"pushover":return[{key:"user_key",label:"User Key",placeholder:"Your Pushover user key",type:"text",required:!0},{key:"app_token",label:"App Token",placeholder:"Your Pushover app token",type:"text",required:!0},{key:"priority",label:"Priority",placeholder:"0 (normal)",type:"number",required:!1}];case"telegram":return[{key:"bot_token",label:"Bot Token",placeholder:"Bot token from @BotFather",type:"password",required:!0},{key:"chat_id",label:"Chat ID",placeholder:"Your chat or group ID",type:"text",required:!0}];case"email":return[{key:"smtp_server",label:"SMTP Server",placeholder:"smtp.gmail.com",type:"text",required:!0},{key:"smtp_port",label:"SMTP Port",placeholder:"587",type:"number",required:!1},{key:"security",label:"Security",type:"select",required:!1,options:[{value:"starttls",label:"STARTTLS (Port 587)"},{value:"ssl",label:"SSL/TLS (Port 465)"},{value:"none",label:"None (Port 25)"}]},{key:"auth_enabled",label:"Authentication",type:"select",required:!1,options:[{value:"true",label:"Enabled"},{value:"false",label:"Disabled"}]},{key:"username",label:"Username",placeholder:"your@email.com",type:"text",required:!1},{key:"password",label:"Password",placeholder:"App password",type:"password",required:!1},{key:"from_email",label:"From Email",placeholder:"your@email.com",type:"text",required:!0},{key:"to_email",label:"To Email",placeholder:"recipient@email.com",type:"text",required:!0}];case"discord":return[{key:"webhook_url",label:"Webhook URL",placeholder:"https://discord.com/api/webhooks/...",type:"text",required:!0}];case"webhook":return[{key:"webhook_url",label:"Webhook URL",placeholder:"https://example.com/webhook",type:"text",required:!0},{key:"payload_format",label:"Payload Format",type:"select",required:!1,options:[{value:"generic",label:"Generic JSON"},{value:"slack",label:"Slack / Mattermost"}]},{key:"auth_header",label:"Authorization",placeholder:"Bearer token (optional)",type:"password",required:!1},{key:"field_title",label:"Title Field Name",placeholder:"title",type:"text",required:!1,showIf:fe=>fe.payload_format!=="slack"},{key:"field_message",label:"Message Field Name",placeholder:"message",type:"text",required:!1,showIf:fe=>fe.payload_format!=="slack"}];case"homeassistant":return[];default:return[]}},ne=ce=>K(ce).filter(fe=>fe.required),se=K(l);return i.jsx("div",{className:"fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-4 overflow-y-auto",onClick:e,children:i.jsxs("div",{className:"bg-bambu-dark-secondary rounded-xl border border-bambu-dark-tertiary w-full max-w-lg my-8 max-h-[90vh] overflow-y-auto",onClick:ce=>ce.stopPropagation(),children:[i.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-bambu-dark-tertiary",children:[i.jsx("h2",{className:"text-lg font-semibold text-white",children:n(a?"notifications.editTitle":"notifications.addTitle")}),i.jsx("button",{onClick:e,className:"text-bambu-gray hover:text-white transition-colors",children:i.jsx(zt,{className:"w-5 h-5"})})]}),i.jsxs("form",{onSubmit:V,className:"p-6 space-y-4",children:[E&&i.jsx("div",{className:"p-3 bg-red-500/20 border border-red-500/50 rounded-lg text-sm text-red-400",children:E}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:n("notifications.nameLabel")}),i.jsx("input",{type:"text",value:s,onChange:ce=>o(ce.target.value),placeholder:n("notifications.namePlaceholder"),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"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:n("notifications.providerTypeLabel")}),i.jsx("select",{value:l,onChange:ce=>{c(ce.target.value),q({}),j(null)},disabled:a,className:"w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none disabled:opacity-50",children:nJe.map(ce=>i.jsx("option",{value:ce,children:n(`notifications.providerTypes.${ce}`,ce)},ce))}),i.jsx("p",{className:"text-xs text-bambu-gray mt-1",children:n(`notifications.providerDescriptions.${l}`,"")})]}),i.jsxs("div",{className:"space-y-3",children:[i.jsx("p",{className:"text-sm text-bambu-gray",children:n("notifications.configuration")}),se.filter(ce=>!("showIf"in ce)||ce.showIf?.(Ce)!==!1).map(ce=>i.jsxs("div",{children:[i.jsxs("label",{className:"block text-sm text-bambu-gray mb-1",children:[ce.label," ",ce.required&&"*"]}),ce.type==="select"&&"options"in ce&&ce.options?i.jsx("select",{value:Ce[ce.key]||ce.options[0]?.value||"",onChange:fe=>{q({...Ce,[ce.key]:fe.target.value}),j(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:ce.options.map(fe=>i.jsx("option",{value:fe.value,children:fe.label},fe.value))}):i.jsx("input",{type:ce.type,value:Ce[ce.key]||"",onChange:fe=>{q({...Ce,[ce.key]:fe.target.value}),j(null)},placeholder:ce.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"})]},ce.key))]}),i.jsx("div",{className:"flex gap-2",children:i.jsxs(Fe,{type:"button",variant:"secondary",onClick:()=>{j(null),B.mutate()},disabled:B.isPending||ne(l).length>0&&!Ce[ne(l)[0]?.key],className:"flex-1",children:[B.isPending?i.jsx(ct,{className:"w-4 h-4 animate-spin"}):i.jsx(gC,{className:"w-4 h-4"}),n("notifications.testConfiguration")]})}),Z&&i.jsx("div",{className:`p-3 rounded-lg flex items-center gap-2 ${Z.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:Z.success?i.jsxs(i.Fragment,{children:[i.jsx(fr,{className:"w-5 h-5"}),i.jsx("span",{children:Z.message})]}):i.jsxs(i.Fragment,{children:[i.jsx(qi,{className:"w-5 h-5"}),i.jsx("span",{children:Z.message})]})}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:n("notifications.printerFilter")}),i.jsxs("select",{value:d??"",onChange:ce=>u(ce.target.value?Number(ce.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:[i.jsx("option",{value:"",children:n("notifications.allPrinters")}),W?.map(ce=>i.jsx("option",{value:ce.id,children:ce.name},ce.id))]}),i.jsx("p",{className:"text-xs text-bambu-gray mt-1",children:n("notifications.onlyFromPrinter")})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("label",{className:"text-sm text-white",children:n("notifications.quietHoursDnd")}),i.jsx(Gn,{checked:m,onChange:p})]}),m&&i.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[i.jsxs("div",{children:[i.jsx("label",{className:"block text-xs text-bambu-gray mb-1",children:n("notifications.quietStart")}),i.jsx("input",{type:"time",value:f,onChange:ce=>y(ce.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"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-xs text-bambu-gray mb-1",children:n("notifications.quietEnd")}),i.jsx("input",{type:"time",value:x,onChange:ce=>b(ce.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"})]})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("label",{className:"text-sm text-white",children:n("notifications.dailyDigestLabel")}),i.jsx("p",{className:"text-xs text-bambu-gray",children:n("notifications.batchNotifications")})]}),i.jsx(Gn,{checked:v,onChange:_})]}),v&&i.jsxs("div",{children:[i.jsx("label",{className:"block text-xs text-bambu-gray mb-1",children:n("notifications.sendDigestAt")}),i.jsx("input",{type:"time",value:k,onChange:ce=>P(ce.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"}),i.jsx("p",{className:"text-xs text-bambu-gray mt-1",children:n("notifications.digestCollected")})]})]}),i.jsxs("div",{className:"space-y-3",children:[i.jsx("p",{className:"text-sm text-bambu-gray",children:n("notifications.notificationEvents")}),i.jsxs("div",{className:"space-y-2 p-3 bg-bambu-dark rounded-lg",children:[i.jsx("p",{className:"text-xs text-bambu-gray uppercase tracking-wide mb-2",children:n("notifications.printEvents")}),i.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("span",{className:"text-sm text-white",children:n("notifications.start")}),i.jsx(Gn,{checked:C,onChange:T})]}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("span",{className:"text-sm text-white",children:n("notifications.complete")}),i.jsx(Gn,{checked:N,onChange:R})]}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("span",{className:"text-sm text-white",children:n("notifications.failed")}),i.jsx(Gn,{checked:A,onChange:D})]}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("span",{className:"text-sm text-white",children:n("notifications.stopped")}),i.jsx(Gn,{checked:$,onChange:U})]}),i.jsxs("div",{className:"flex items-center justify-between col-span-2",children:[i.jsxs("div",{children:[i.jsx("span",{className:"text-sm text-white",children:n("notifications.progress")}),i.jsx("span",{className:"text-xs text-bambu-gray ml-1",children:n("notifications.progressPercent")})]}),i.jsx(Gn,{checked:G,onChange:L})]}),i.jsxs("div",{className:"flex items-center justify-between col-span-2",children:[i.jsxs("div",{children:[i.jsx("span",{className:"text-sm text-white",children:n("notifications.bedCooled")}),i.jsx("span",{className:"text-xs text-bambu-gray ml-1",children:n("notifications.bedCooledAfterPrint")})]}),i.jsx(Gn,{checked:le,onChange:pe})]})]})]}),i.jsxs("div",{className:"space-y-2 p-3 bg-bambu-dark rounded-lg",children:[i.jsx("p",{className:"text-xs text-bambu-gray uppercase tracking-wide mb-2",children:n("notifications.printerStatus")}),i.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("span",{className:"text-sm text-white",children:n("notifications.offline")}),i.jsx(Gn,{checked:te,onChange:re})]}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("span",{className:"text-sm text-white",children:n("notifications.error")}),i.jsx(Gn,{checked:J,onChange:ue})]}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("span",{className:"text-sm text-white",children:n("notifications.lowFilament")}),i.jsx(Gn,{checked:me,onChange:ge})]}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("span",{className:"text-sm text-white",children:n("notifications.maintenance")}),i.jsx(Gn,{checked:X,onChange:ie})]})]})]})]}),i.jsxs("div",{className:"flex gap-3 pt-2",children:[i.jsx(Fe,{type:"button",variant:"secondary",onClick:e,className:"flex-1",children:n("notifications.cancel")}),i.jsxs(Fe,{type:"submit",disabled:ee,className:"flex-1",children:[ee?i.jsx(ct,{className:"w-4 h-4 animate-spin"}):i.jsx(ps,{className:"w-4 h-4"}),n(a?"notifications.save":"notifications.add")]})]})]})]})})}function iJe({template:t,onClose:e}){const{t:n}=Mt(),r=tn(),a=w.useRef(null),[s,o]=w.useState(t.title_template),[l,c]=w.useState(t.body_template),[d,u]=w.useState(null),[m,p]=w.useState(!0),{data:f}=Je({queryKey:["template-variables"],queryFn:be.getTemplateVariables}),y=f?.find(T=>T.event_type===t.event_type),{data:x,isLoading:b}=Je({queryKey:["template-preview",t.event_type,s,l],queryFn:()=>be.previewTemplate({event_type:t.event_type,title_template:s,body_template:l}),enabled:m&&s.length>0&&l.length>0});w.useEffect(()=>{const T=N=>{N.key==="Escape"&&e()};return window.addEventListener("keydown",T),()=>window.removeEventListener("keydown",T)},[e]);const v=ut({mutationFn:T=>be.updateNotificationTemplate(t.id,T),onSuccess:()=>{r.invalidateQueries({queryKey:["notification-templates"]}),e()},onError:T=>{u(T.message)}}),_=ut({mutationFn:()=>be.resetNotificationTemplate(t.id),onSuccess:T=>{o(T.title_template),c(T.body_template),r.invalidateQueries({queryKey:["notification-templates"]})},onError:T=>{u(T.message)}}),k=T=>{if(T.preventDefault(),u(null),!s.trim()){u(n("notifications.titleRequired"));return}if(!l.trim()){u(n("notifications.bodyRequired"));return}v.mutate({title_template:s,body_template:l})},P=T=>{const N=a.current;if(!N)return;const R=N.selectionStart,A=N.selectionEnd,D=l,$=D.substring(0,R),U=D.substring(A),G=$+`{${T}}`+U;c(G),setTimeout(()=>{N.focus();const L=R+T.length+2;N.setSelectionRange(L,L)},0)},C=s!==t.title_template||l!==t.body_template;return i.jsx("div",{className:"fixed inset-0 bg-black/80 flex items-center justify-center z-50 p-4",children:i.jsxs("div",{className:"bg-bambu-dark-secondary rounded-lg w-full max-w-2xl max-h-[90vh] flex flex-col",children:[i.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-bambu-dark-tertiary shrink-0",children:[i.jsx("h2",{className:"text-lg font-semibold text-white",children:n("notifications.editTemplate",{name:t.name})}),i.jsx("button",{onClick:e,className:"p-1 hover:bg-bambu-dark-tertiary rounded transition-colors",children:i.jsx(zt,{className:"w-5 h-5 text-bambu-gray"})})]}),i.jsxs("form",{onSubmit:k,className:"flex-1 overflow-y-auto p-4 space-y-4",children:[d&&i.jsx("div",{className:"p-3 bg-red-500/20 border border-red-500/50 rounded text-red-400 text-sm",children:d}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-bambu-gray mb-1",children:n("notifications.titleLabel")}),i.jsx("input",{type:"text",value:s,onChange:T=>o(T.target.value),className:"w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded text-white focus:outline-none focus:ring-1 focus:ring-bambu-green",placeholder:n("notifications.titlePlaceholder")})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-bambu-gray mb-1",children:n("notifications.bodyLabel")}),i.jsx("textarea",{ref:a,value:l,onChange:T=>c(T.target.value),rows:4,className:"w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded text-white focus:outline-none focus:ring-1 focus:ring-bambu-green font-mono text-sm resize-none",placeholder:n("notifications.bodyPlaceholder")})]}),y&&i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-bambu-gray mb-2",children:n("notifications.availableVariables")}),i.jsx("div",{className:"flex flex-wrap gap-2",children:y.variables.map(T=>i.jsxs("button",{type:"button",onClick:()=>P(T),className:"inline-flex items-center gap-1 px-2 py-1 bg-bambu-dark hover:bg-bambu-dark-tertiary border border-bambu-dark-tertiary rounded text-xs text-bambu-gray hover:text-white transition-colors",children:[i.jsx(sr,{className:"w-3 h-3"}),T]},T))}),i.jsx("p",{className:"text-xs text-bambu-gray/60 mt-1",children:n("notifications.clickToInsert")})]}),i.jsxs("div",{children:[i.jsxs("div",{className:"flex items-center justify-between mb-2",children:[i.jsxs("label",{className:"text-sm font-medium text-bambu-gray flex items-center gap-2",children:[i.jsx(tc,{className:"w-4 h-4"}),n("notifications.livePreview")]}),i.jsx("button",{type:"button",onClick:()=>p(!m),className:"text-xs text-bambu-green hover:text-bambu-green-light",children:n(m?"notifications.hide":"notifications.show")})]}),m&&i.jsx("div",{className:"bg-bambu-dark border border-bambu-dark-tertiary rounded p-3 space-y-2",children:b?i.jsxs("div",{className:"flex items-center gap-2 text-bambu-gray text-sm",children:[i.jsx(ct,{className:"w-4 h-4 animate-spin"}),n("notifications.loadingPreview")]}):x?i.jsxs(i.Fragment,{children:[i.jsxs("div",{children:[i.jsx("span",{className:"text-xs text-bambu-gray",children:n("notifications.titlePreview")}),i.jsx("div",{className:"text-white font-medium",children:x.title})]}),i.jsxs("div",{children:[i.jsx("span",{className:"text-xs text-bambu-gray",children:n("notifications.bodyPreview")}),i.jsx("div",{className:"text-white whitespace-pre-wrap text-sm",children:x.body})]})]}):i.jsx("div",{className:"text-bambu-gray text-sm",children:n("notifications.enterTemplateContent")})})]})]}),i.jsxs("div",{className:"flex items-center justify-between p-4 border-t border-bambu-dark-tertiary shrink-0",children:[i.jsxs(Fe,{type:"button",variant:"ghost",onClick:()=>_.mutate(),disabled:_.isPending,className:"text-orange-400 hover:text-orange-300",children:[_.isPending?i.jsx(ct,{className:"w-4 h-4 animate-spin mr-2"}):i.jsx(uo,{className:"w-4 h-4 mr-2"}),n("notifications.resetToDefault")]}),i.jsxs("div",{className:"flex gap-2",children:[i.jsx(Fe,{type:"button",variant:"secondary",onClick:e,children:n("notifications.cancel")}),i.jsxs(Fe,{onClick:k,disabled:v.isPending||!C,children:[v.isPending?i.jsx(ct,{className:"w-4 h-4 animate-spin mr-2"}):i.jsx(ps,{className:"w-4 h-4 mr-2"}),n("notifications.save")]})]})]})]})})}const aJe={print_start:"text-blue-400",print_complete:"text-bambu-green",print_failed:"text-red-400",print_stopped:"text-orange-400",print_progress:"text-yellow-400",printer_offline:"text-gray-400",printer_error:"text-rose-400",filament_low:"text-cyan-400",maintenance_due:"text-purple-400",test:"text-bambu-gray"};function sJe({onClose:t}){const{t:e}=Mt(),n=tn(),{showToast:r}=bn(),[a,s]=w.useState(7),[o,l]=w.useState(null),[c,d]=w.useState(!1),{data:u}=Je({queryKey:["settings"],queryFn:be.getSettings}),m=u?.time_format||"system",{data:p,isLoading:f,refetch:y,isRefetching:x}=Je({queryKey:["notification-logs",a,c],queryFn:()=>be.getNotificationLogs({days:a,limit:100,success:c?!1:void 0})}),{data:b}=Je({queryKey:["notification-log-stats",a],queryFn:()=>be.getNotificationLogStats(a)}),v=ut({mutationFn:()=>be.clearNotificationLogs(30),onSuccess:k=>{r(k.message,"success"),n.invalidateQueries({queryKey:["notification-logs"]}),n.invalidateQueries({queryKey:["notification-log-stats"]})},onError:k=>{r(`Failed to clear logs: ${k.message}`,"error")}}),_=k=>{const P=Jn(k);if(!P)return"";const T=new Date().getTime()-P.getTime();return T<6e4?e("notifications.justNow"):T<36e5?`${Math.floor(T/6e4)}m ago`:T<864e5?`${Math.floor(T/36e5)}h ago`:P.toLocaleDateString()+" "+cX(P,m)};return i.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",children:i.jsxs("div",{className:"bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg w-full max-w-3xl max-h-[85vh] flex flex-col",children:[i.jsxs("div",{className:"p-4 border-b border-bambu-dark-tertiary flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(Fv,{className:"w-5 h-5 text-bambu-green"}),i.jsx("h2",{className:"text-lg font-semibold text-white",children:e("notifications.notificationLog")})]}),i.jsx("button",{onClick:t,className:"text-bambu-gray hover:text-white transition-colors",children:"×"})]}),b&&i.jsx("div",{className:"px-4 py-3 border-b border-bambu-dark-tertiary bg-bambu-dark/50",children:i.jsxs("div",{className:"flex items-center gap-6 text-sm",children:[i.jsxs("span",{className:"text-bambu-gray",children:[e("notifications.statsSummary",{days:a})," ",i.jsx("span",{className:"text-white font-medium",children:b.total})," ",e("notifications.statsNotifications")]}),i.jsxs("span",{className:"flex items-center gap-1 text-bambu-green",children:[i.jsx(fr,{className:"w-4 h-4"}),e("notifications.statsSent",{count:b.success_count})]}),b.failure_count>0&&i.jsxs("span",{className:"flex items-center gap-1 text-red-400",children:[i.jsx(qi,{className:"w-4 h-4"}),e("notifications.statsFailed",{count:b.failure_count})]})]})}),i.jsxs("div",{className:"px-4 py-3 border-b border-bambu-dark-tertiary flex items-center gap-4",children:[i.jsxs("select",{value:a,onChange:k=>s(Number(k.target.value)),className:"px-3 py-1.5 bg-bambu-dark border border-bambu-dark-tertiary rounded text-white text-sm focus:outline-none focus:ring-1 focus:ring-bambu-green",children:[i.jsx("option",{value:1,children:e("notifications.last24Hours")}),i.jsx("option",{value:7,children:e("notifications.last7Days")}),i.jsx("option",{value:30,children:e("notifications.last30Days")}),i.jsx("option",{value:90,children:e("notifications.last90Days")})]}),i.jsxs("label",{className:"flex items-center gap-2 text-sm text-bambu-gray cursor-pointer",children:[i.jsx("input",{type:"checkbox",checked:c,onChange:k=>d(k.target.checked),className:"rounded border-bambu-dark-tertiary bg-bambu-dark text-bambu-green focus:ring-bambu-green"}),e("notifications.showFailedOnly")]}),i.jsx("div",{className:"flex-1"}),i.jsxs(Fe,{size:"sm",variant:"secondary",onClick:()=>y(),disabled:x,children:[x?i.jsx(ct,{className:"w-4 h-4 animate-spin"}):i.jsx(_r,{className:"w-4 h-4"}),e("notifications.refresh")]}),i.jsxs(Fe,{size:"sm",variant:"secondary",onClick:()=>v.mutate(),disabled:v.isPending,className:"text-red-400 hover:text-red-300",children:[v.isPending?i.jsx(ct,{className:"w-4 h-4 animate-spin"}):i.jsx(Qt,{className:"w-4 h-4"}),e("notifications.clearOld")]})]}),i.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:f?i.jsx("div",{className:"flex justify-center py-12",children:i.jsx(ct,{className:"w-6 h-6 text-bambu-green animate-spin"})}):p&&p.length>0?i.jsx("div",{className:"space-y-2",children:p.map(k=>i.jsx(oJe,{log:k,isExpanded:o===k.id,onToggle:()=>l(o===k.id?null:k.id),formatDate:_,formatFullDate:P=>Wp(P,m)},k.id))}):i.jsxs("div",{className:"text-center py-12 text-bambu-gray",children:[i.jsx(Fv,{className:"w-12 h-12 mx-auto mb-3 opacity-30"}),i.jsx("p",{className:"text-sm",children:e(c?"notifications.noFailedNotifications":"notifications.noNotificationsLogged")})]})})]})})}function oJe({log:t,isExpanded:e,onToggle:n,formatDate:r,formatFullDate:a}){const{t:s}=Mt();return i.jsxs("div",{className:`border rounded-lg overflow-hidden transition-colors ${t.success?"border-bambu-dark-tertiary bg-bambu-dark/30":"border-red-500/30 bg-red-500/5"}`,children:[i.jsxs("button",{className:"w-full px-3 py-2 flex items-center gap-3 text-left hover:bg-bambu-dark/50 transition-colors",onClick:n,children:[t.success?i.jsx(fr,{className:"w-4 h-4 text-bambu-green shrink-0"}):i.jsx(qi,{className:"w-4 h-4 text-red-400 shrink-0"}),i.jsx("span",{className:`text-xs font-medium ${aJe[t.event_type]||"text-bambu-gray"}`,children:s(`notifications.eventTypes.${t.event_type}`,t.event_type)}),i.jsx("span",{className:"text-sm text-white truncate flex-1",children:t.provider_name||s("notifications.unknownProvider")}),t.printer_name&&i.jsx("span",{className:"text-xs text-bambu-gray",children:t.printer_name}),i.jsx("span",{className:"text-xs text-bambu-gray shrink-0",children:r(t.created_at)}),e?i.jsx(vl,{className:"w-4 h-4 text-bambu-gray shrink-0"}):i.jsx(In,{className:"w-4 h-4 text-bambu-gray shrink-0"})]}),e&&i.jsxs("div",{className:"px-3 py-2 border-t border-bambu-dark-tertiary bg-bambu-dark/20 space-y-2",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-xs text-bambu-gray mb-1",children:s("notifications.logTitle")}),i.jsx("p",{className:"text-sm text-white",children:t.title})]}),i.jsxs("div",{children:[i.jsx("p",{className:"text-xs text-bambu-gray mb-1",children:s("notifications.logMessage")}),i.jsx("p",{className:"text-sm text-white whitespace-pre-wrap",children:t.message})]}),!t.success&&t.error_message&&i.jsxs("div",{children:[i.jsx("p",{className:"text-xs text-red-400 mb-1",children:s("notifications.logError")}),i.jsx("p",{className:"text-sm text-red-300",children:t.error_message})]}),i.jsxs("div",{className:"flex gap-4 text-xs text-bambu-gray pt-1",children:[i.jsx("span",{children:s("notifications.logProvider",{type:t.provider_type})}),i.jsx("span",{children:s("notifications.logTime",{time:a(t.created_at)})})]})]})]})}function lJe({formData:t,setFormData:e,groups:n,onClose:r,onCreate:a,isCreating:s,isCreateButtonDisabled:o}){const{t:l}=Mt();w.useEffect(()=>{const d=u=>{u.key==="Escape"&&r()};return window.addEventListener("keydown",d),()=>window.removeEventListener("keydown",d)},[r]);const c=d=>{e({...t,group_ids:t.group_ids.includes(d)?t.group_ids.filter(u=>u!==d):[...t.group_ids,d]})};return i.jsx("div",{className:"fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-4",onClick:r,children:i.jsxs(Tt,{className:"w-full max-w-md",onClick:d=>d.stopPropagation(),children:[i.jsx(Wn,{children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"flex flex-col gap-1",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(Sm,{className:"w-5 h-5 text-bambu-green"}),i.jsx("h2",{className:"text-lg font-semibold text-white",children:l("users.modal.createUser")})]}),i.jsx("p",{className:"text-sm text-bambu-gray ml-7",children:l("users.modal.advancedAuthSubtitle")||"with Advanced Authentication"})]}),i.jsx(Fe,{variant:"ghost",size:"sm",onClick:r,children:i.jsx(zt,{className:"w-5 h-5"})})]})}),i.jsxs(Pt,{children:[i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{children:[i.jsxs("label",{className:"block text-sm font-medium text-white mb-2",children:[l("users.form.username")," ",i.jsx("span",{className:"text-red-400",children:"*"})]}),i.jsx("input",{type:"text",value:t.username,onChange:d=>e({...t,username:d.target.value}),className:"w-full px-4 py-3 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:border-bambu-green transition-colors",placeholder:l("users.form.usernamePlaceholder"),autoComplete:"username",required:!0})]}),i.jsxs("div",{children:[i.jsxs("label",{className:"block text-sm font-medium text-white mb-2",children:[l("users.form.email")||"Email"," ",i.jsx("span",{className:"text-red-400",children:"*"})]}),i.jsx("input",{type:"email",value:t.email,onChange:d=>e({...t,email:d.target.value}),className:"w-full px-4 py-3 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:border-bambu-green transition-colors",placeholder:l("users.form.emailPlaceholder")||"user@example.com",required:!0})]}),i.jsx("div",{className:"bg-bambu-dark-secondary/50 border border-bambu-green/20 rounded-lg p-3",children:i.jsx("p",{className:"text-sm text-bambu-gray",children:l("users.form.autoGeneratedPassword")||"A secure password will be automatically generated and emailed to the user."})}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-white mb-2",children:l("users.form.groups")}),i.jsxs("div",{className:"space-y-2 max-h-40 overflow-y-auto p-2 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg",children:[n.map(d=>i.jsxs("label",{className:"flex items-center gap-3 px-2 py-1.5 rounded hover:bg-bambu-dark-tertiary cursor-pointer",children:[i.jsx("input",{type:"checkbox",checked:t.group_ids.includes(d.id),onChange:()=>c(d.id),className:"w-4 h-4 rounded border-bambu-gray text-bambu-green focus:ring-bambu-green focus:ring-offset-0 bg-bambu-dark"}),i.jsx("span",{className:"text-sm text-white",children:d.name}),d.is_system&&i.jsxs("span",{className:"text-xs text-yellow-400",children:["(",l("users.system"),")"]})]},d.id)),n.length===0&&i.jsx("p",{className:"text-sm text-bambu-gray",children:l("users.noGroupsAvailable")})]})]})]}),i.jsxs("div",{className:"mt-6 flex justify-end gap-3",children:[i.jsx(Fe,{variant:"secondary",onClick:r,children:l("users.modal.cancel")}),i.jsx(Fe,{onClick:a,disabled:o,children:s?i.jsxs(i.Fragment,{children:[i.jsx(ct,{className:"w-4 h-4 animate-spin"}),l("users.modal.creating")]}):i.jsxs(i.Fragment,{children:[i.jsx(sr,{className:"w-4 h-4"}),l("users.modal.createUser")]})})]})]})]})})}function cJe(){const{t}=Mt(),e=tn(),{showToast:n}=bn(),[r,a]=w.useState(!1),[s,o]=w.useState(""),[l,c]=w.useState("auto"),[d,u]=w.useState(!1),[m,p]=w.useState(!0),[f,y]=w.useState("all"),[x,b]=w.useState(!1),[v,_]=w.useState(!1),[k,P]=w.useState(!1),{data:C,isLoading:T}=Je({queryKey:["spoolman-settings"],queryFn:be.getSpoolmanSettings}),{data:N,isLoading:R,refetch:A}=Je({queryKey:["spoolman-status"],queryFn:be.getSpoolmanStatus,refetchInterval:3e4}),{data:D}=Je({queryKey:["printers"],queryFn:be.getPrinters});w.useEffect(()=>{C&&(a(C.spoolman_enabled==="true"),o(C.spoolman_url||""),c(C.spoolman_sync_mode||"auto"),u(C.spoolman_disable_weight_sync==="true"),p(C.spoolman_report_partial_usage!=="false"),b(!0))},[C]),w.useEffect(()=>{if(!x||!C)return;if(C.spoolman_enabled==="true"!==r||(C.spoolman_url||"")!==s||(C.spoolman_sync_mode||"auto")!==l||C.spoolman_disable_weight_sync==="true"!==d||C.spoolman_report_partial_usage!=="false"!==m){const ie=setTimeout(()=>{$.mutate()},500);return()=>clearTimeout(ie)}},[r,s,l,d,m,x]);const $=ut({mutationFn:()=>be.updateSpoolmanSettings({spoolman_enabled:r?"true":"false",spoolman_url:s,spoolman_sync_mode:l,spoolman_disable_weight_sync:d?"true":"false",spoolman_report_partial_usage:m?"true":"false"}),onSuccess:()=>{e.invalidateQueries({queryKey:["spoolman-settings"]}),e.invalidateQueries({queryKey:["spoolman-status"]}),e.invalidateQueries({queryKey:["spool-assignments"]}),n(t("settings.toast.settingsSaved"))}}),U=ut({mutationFn:be.connectSpoolman,onSuccess:()=>{A()}}),G=ut({mutationFn:be.disconnectSpoolman,onSuccess:()=>{A()}}),L=ut({mutationFn:be.syncAllPrintersAms,onSuccess:X=>{X.success}}),te=ut({mutationFn:X=>be.syncPrinterAms(X),onSuccess:X=>{X.success}}),re=()=>{f==="all"?L.mutate():te.mutate(f)},J=ut({mutationFn:be.syncWeightsFromAms,onSuccess:X=>{e.invalidateQueries({queryKey:["spools"]}),e.invalidateQueries({queryKey:["inventory-spools"]}),n(t("settings.amsSyncSuccess",{synced:X.synced,skipped:X.skipped}),"success"),P(!1)},onError:()=>{n(t("settings.amsSyncError"),"error"),P(!1)}}),ue=L.isPending||te.isPending,me=f==="all"?L.data:te.data,ge=f==="all"?L.isSuccess:te.isSuccess;return T?i.jsxs(Tt,{children:[i.jsx(Wn,{children:i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(Ic,{className:"w-5 h-5 text-bambu-green"}),i.jsx("h2",{className:"text-lg font-semibold text-white",children:t("settings.filamentTracking")})]})}),i.jsx(Pt,{children:i.jsx("div",{className:"flex justify-center py-8",children:i.jsx(ct,{className:"w-6 h-6 text-bambu-green animate-spin"})})})]}):i.jsxs(Tt,{children:[i.jsx(Wn,{children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(Ic,{className:"w-5 h-5 text-bambu-green"}),i.jsx("h2",{className:"text-lg font-semibold text-white",children:t("settings.filamentTracking")})]}),$.isPending&&i.jsx(ct,{className:"w-4 h-4 text-bambu-green animate-spin"})]})}),i.jsxs(Pt,{className:"space-y-4",children:[i.jsx("p",{className:"text-sm text-bambu-gray",children:t("settings.filamentTrackingDesc")}),i.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[i.jsxs("button",{type:"button",onClick:()=>a(!1),className:`p-3 rounded-lg border-2 text-left transition-colors ${r?"border-bambu-dark-tertiary bg-bambu-dark hover:border-bambu-gray/50":"border-bambu-green bg-bambu-green/10"}`,children:[i.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[i.jsx(sa,{className:`w-4 h-4 ${r?"text-bambu-gray":"text-bambu-green"}`}),i.jsx("span",{className:`text-sm font-medium ${r?"text-bambu-gray":"text-white"}`,children:t("settings.trackingModeBuiltIn")})]}),i.jsx("p",{className:`text-xs ${r?"text-bambu-gray/60":"text-bambu-gray"}`,children:t("settings.trackingModeBuiltInDesc")}),!r&&i.jsxs("div",{className:"flex items-center gap-1 mt-2",children:[i.jsx(Vr,{className:"w-3 h-3 text-bambu-green"}),i.jsx("span",{className:"text-xs text-bambu-green",children:t("common.enabled")})]})]}),i.jsxs("button",{type:"button",onClick:()=>a(!0),className:`p-3 rounded-lg border-2 text-left transition-colors ${r?"border-bambu-green bg-bambu-green/10":"border-bambu-dark-tertiary bg-bambu-dark hover:border-bambu-gray/50"}`,children:[i.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[i.jsx(ei,{className:`w-4 h-4 ${r?"text-bambu-green":"text-bambu-gray"}`}),i.jsx("span",{className:`text-sm font-medium ${r?"text-white":"text-bambu-gray"}`,children:"Spoolman"})]}),i.jsx("p",{className:`text-xs ${r?"text-bambu-gray":"text-bambu-gray/60"}`,children:t("settings.trackingModeSpoolmanDesc")}),r&&i.jsxs("div",{className:"flex items-center gap-1 mt-2",children:[i.jsx(Vr,{className:"w-3 h-3 text-bambu-green"}),i.jsx("span",{className:"text-xs text-bambu-green",children:t("common.enabled")})]})]})]}),!r&&i.jsxs("div",{className:"space-y-3",children:[i.jsx("div",{className:"p-3 bg-bambu-green/5 border border-bambu-green/20 rounded-lg",children:i.jsxs("div",{className:"flex gap-2",children:[i.jsx(js,{className:"w-4 h-4 text-bambu-green flex-shrink-0 mt-0.5"}),i.jsx("div",{className:"text-xs text-bambu-gray",children:i.jsxs("ul",{className:"list-disc list-inside space-y-0.5",children:[i.jsx("li",{children:t("settings.builtInFeatureRfid")}),i.jsx("li",{children:t("settings.builtInFeatureUsage")}),i.jsx("li",{children:t("settings.builtInFeatureCatalog")}),i.jsx("li",{children:t("settings.builtInFeatureThirdParty")})]})})]})}),i.jsxs(Fe,{variant:"secondary",size:"sm",onClick:()=>P(!0),disabled:J.isPending,children:[J.isPending?i.jsx(ct,{className:"w-4 h-4 mr-2 animate-spin"}):i.jsx(_r,{className:"w-4 h-4 mr-2"}),t("settings.amsSyncButton")]})]}),r&&i.jsxs("div",{className:"space-y-4",children:[i.jsx("div",{className:"p-3 bg-blue-500/10 border border-blue-500/30 rounded-lg",children:i.jsxs("div",{className:"flex gap-2",children:[i.jsx(js,{className:"w-4 h-4 text-blue-400 flex-shrink-0 mt-0.5"}),i.jsxs("div",{className:"text-xs text-blue-300",children:[i.jsx("p",{className:"font-medium mb-1",children:t("settings.howSyncWorks")}),i.jsxs("ul",{className:"list-disc list-inside space-y-0.5 text-blue-300/80",children:[i.jsx("li",{children:t("settings.syncInfoRfidOnly")}),i.jsx("li",{children:t("settings.syncInfoAutoCreate")}),i.jsx("li",{children:t("settings.syncInfoThirdPartySkipped")})]}),i.jsx("p",{className:"font-medium mt-2 mb-1",children:t("settings.linkingExistingSpools")}),i.jsx("p",{className:"text-blue-300/80",children:t("settings.linkingExistingSpoolsDesc")})]})]})}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:t("settings.spoolmanUrl")}),i.jsx("input",{type:"text",placeholder:"http://192.168.1.100:7912",value:s,onChange:X=>o(X.target.value),className:"w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray/50 focus:border-bambu-green focus:outline-none"}),i.jsx("p",{className:"text-xs text-bambu-gray mt-1",children:t("settings.spoolmanUrlHint")})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:t("settings.syncMode")}),i.jsxs("select",{value:l,onChange:X=>c(X.target.value),className:"w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none",children:[i.jsx("option",{value:"auto",children:t("settings.syncModeAuto")}),i.jsx("option",{value:"manual",children:t("settings.syncModeManual")})]}),i.jsx("p",{className:"text-xs text-bambu-gray mt-1",children:t(l==="auto"?"settings.syncModeAutoDesc":"settings.syncModeManualDesc")})]}),l==="auto"&&i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-white",children:t("spoolman.disableWeightSync")}),i.jsx("p",{className:"text-sm text-bambu-gray",children:t("spoolman.disableWeightSyncDesc")})]}),i.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[i.jsx("input",{type:"checkbox",checked:d,onChange:X=>u(X.target.checked),className:"sr-only peer"}),i.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"})]})]}),d&&i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-white",children:t("spoolman.reportPartialUsage")}),i.jsx("p",{className:"text-sm text-bambu-gray",children:t("spoolman.reportPartialUsageDesc")})]}),i.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[i.jsx("input",{type:"checkbox",checked:m,onChange:X=>p(X.target.checked),className:"sr-only peer"}),i.jsx("div",{className:"w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green"})]})]}),i.jsxs("div",{className:"pt-2 border-t border-bambu-dark-tertiary",children:[i.jsxs("div",{className:"flex items-center justify-between mb-3",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs("span",{className:"text-sm text-bambu-gray",children:[t("settings.status"),":"]}),R?i.jsx(ct,{className:"w-4 h-4 text-bambu-gray animate-spin"}):N?.connected?i.jsxs("span",{className:"flex items-center gap-1 text-sm text-green-500",children:[i.jsx(Vr,{className:"w-4 h-4"}),t("settings.spoolmanConnected")]}):i.jsxs("span",{className:"flex items-center gap-1 text-sm text-red-500",children:[i.jsx(zt,{className:"w-4 h-4"}),t("settings.spoolmanDisconnected")]})]}),i.jsx("div",{className:"flex gap-2",children:N?.connected?i.jsxs(Fe,{variant:"secondary",size:"sm",onClick:()=>G.mutate(),disabled:G.isPending,children:[G.isPending?i.jsx(ct,{className:"w-4 h-4 animate-spin"}):i.jsx(qpe,{className:"w-4 h-4"}),t("settings.disconnect")]}):i.jsxs(Fe,{size:"sm",onClick:()=>U.mutate(),disabled:U.isPending||!s,children:[U.isPending?i.jsx(ct,{className:"w-4 h-4 animate-spin"}):i.jsx(Vm,{className:"w-4 h-4"}),t("settings.connect")]})})]}),U.isError&&i.jsx("div",{className:"mb-3 p-2 bg-red-500/20 border border-red-500/50 rounded text-sm text-red-400",children:U.error.message}),N?.connected&&i.jsxs("div",{className:"space-y-3",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-sm text-white",children:t("settings.syncAmsData")}),i.jsx("p",{className:"text-xs text-bambu-gray",children:t("settings.syncAmsDataDesc")})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs("div",{className:"relative flex-1",children:[i.jsxs("select",{value:f,onChange:X=>y(X.target.value==="all"?"all":Number(X.target.value)),className:"w-full px-3 py-2 pr-8 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm focus:border-bambu-green focus:outline-none appearance-none cursor-pointer",children:[i.jsx("option",{value:"all",children:t("settings.allPrinters")}),D?.map(X=>i.jsx("option",{value:X.id,children:X.name},X.id))]}),i.jsx(In,{className:"absolute right-2 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray pointer-events-none"})]}),i.jsxs(Fe,{variant:"secondary",size:"sm",onClick:re,disabled:ue,children:[ue?i.jsx(ct,{className:"w-4 h-4 animate-spin"}):i.jsx(_r,{className:"w-4 h-4"}),t("spoolman.sync")]})]})]}),ge&&me&&i.jsxs("div",{className:"mt-3 space-y-2",children:[i.jsx("div",{className:`p-2 rounded text-sm ${me.success?"bg-green-500/20 border border-green-500/50 text-green-400":"bg-yellow-500/20 border border-yellow-500/50 text-yellow-400"}`,children:me.success?`Synced ${me.synced_count} spool${me.synced_count!==1?"s":""} successfully`:`Synced ${me.synced_count} spool${me.synced_count!==1?"s":""} with ${me.errors.length} error${me.errors.length!==1?"s":""}`}),me.skipped_count>0&&i.jsxs("div",{className:"p-2 bg-amber-500/10 border border-amber-500/30 rounded text-sm",children:[i.jsxs("div",{className:"flex items-center justify-between text-amber-400 mb-1",children:[i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx(En,{className:"w-3.5 h-3.5"}),i.jsxs("span",{className:"font-medium",children:[me.skipped_count," spool",me.skipped_count!==1?"s":""," skipped"]})]}),me.skipped_count>5&&i.jsx("button",{onClick:()=>_(!v),className:"text-xs text-amber-400 hover:text-amber-300 underline",children:v?"Show less":"Show all"})]}),i.jsxs("ul",{className:"text-xs text-amber-300/80 space-y-0.5",children:[(v?me.skipped:me.skipped.slice(0,5)).map((X,ie)=>i.jsxs("li",{className:"flex items-center gap-2",children:[X.color&&i.jsx("span",{className:"w-3 h-3 rounded-full border border-white/20",style:{backgroundColor:`#${X.color}`}}),i.jsx("span",{children:X.location}),i.jsxs("span",{className:"text-amber-300/60",children:["- ",X.reason]})]},ie)),!v&&me.skipped_count>5&&i.jsxs("li",{className:"text-amber-300/60 italic",children:["...and ",me.skipped_count-5," more"]})]})]}),me.errors.length>0&&i.jsxs("div",{className:"p-2 bg-red-500/10 border border-red-500/30 rounded text-sm",children:[i.jsx("div",{className:"text-red-400 font-medium mb-1",children:"Errors:"}),i.jsx("ul",{className:"text-xs text-red-300/80 space-y-0.5",children:me.errors.map((X,ie)=>i.jsx("li",{children:X},ie))})]})]})]})]})]}),k&&i.jsx(Nn,{title:t("settings.amsSyncTitle"),message:t("settings.amsSyncMessage"),confirmText:t("settings.amsSyncButton"),variant:"warning",isLoading:J.isPending,loadingText:t("settings.amsSyncing"),onConfirm:()=>J.mutate(),onCancel:()=>P(!1)})]})}function dJe(){const{t}=Mt(),{showToast:e}=bn(),[n,r]=w.useState([]),[a,s]=w.useState(!0),[o,l]=w.useState(""),c=w.useRef(null),[d,u]=w.useState(!1),[m,p]=w.useState(null),[f,y]=w.useState(""),[x,b]=w.useState(""),[v,_]=w.useState(!1),[k,P]=w.useState(new Set),[C,T]=w.useState(!1),[N,R]=w.useState(null),[A,D]=w.useState(!1),$=w.useCallback(async()=>{try{const pe=await be.getSpoolCatalog();r(pe)}catch{e(t("settings.catalog.loadFailed"),"error")}finally{s(!1)}},[e,t]);w.useEffect(()=>{$()},[$]);const U=n.filter(pe=>pe.name.toLowerCase().includes(o.toLowerCase())),G=async()=>{if(!f.trim()||!x){e(t("settings.catalog.nameWeightRequired"),"error");return}_(!0);try{const pe=await be.addCatalogEntry({name:f.trim(),weight:parseInt(x)});r(Ce=>[...Ce,pe].sort((q,Z)=>q.name.localeCompare(Z.name))),u(!1),y(""),b(""),e(t("settings.catalog.entryAdded"),"success")}catch{e(t("settings.catalog.addFailed"),"error")}finally{_(!1)}},L=pe=>{p(pe.id),y(pe.name),b(pe.weight.toString())},te=()=>{p(null),y(""),b("")},re=async pe=>{if(!f.trim()||!x){e(t("settings.catalog.nameWeightRequired"),"error");return}_(!0);try{const Ce=await be.updateCatalogEntry(pe,{name:f.trim(),weight:parseInt(x)});r(q=>q.map(Z=>Z.id===pe?Ce:Z).sort((Z,j)=>Z.name.localeCompare(j.name))),p(null),y(""),b(""),e(t("settings.catalog.entryUpdated"),"success")}catch{e(t("settings.catalog.updateFailed"),"error")}finally{_(!1)}},J=async()=>{if(N)try{await be.deleteCatalogEntry(N.id),r(pe=>pe.filter(Ce=>Ce.id!==N.id)),e(t("settings.catalog.entryDeleted"),"success")}catch{e(t("settings.catalog.deleteFailed"),"error")}finally{R(null)}},ue=async()=>{D(!1),s(!0);try{await be.resetSpoolCatalog(),await $(),e(t("settings.catalog.resetSuccess"),"success")}catch{e(t("settings.catalog.resetFailed"),"error"),s(!1)}},me=pe=>{P(Ce=>{const q=new Set(Ce);return q.has(pe)?q.delete(pe):q.add(pe),q})},ge=()=>{k.size===U.length?P(new Set):P(new Set(U.map(pe=>pe.id)))},X=async()=>{if(T(!1),k.size!==0)try{const pe=await be.bulkDeleteCatalogEntries([...k]);r(Ce=>Ce.filter(q=>!k.has(q.id))),P(new Set),e(t("settings.catalog.bulkDeleted",{count:pe.deleted}),"success")}catch{e(t("settings.catalog.bulkDeleteFailed"),"error")}},ie=()=>{const pe=n.map(({name:j,weight:E})=>({name:j,weight:E})),Ce=new Blob([JSON.stringify(pe,null,2)],{type:"application/json"}),q=URL.createObjectURL(Ce),Z=document.createElement("a");Z.href=q,Z.download="spool-catalog.json",document.body.appendChild(Z),Z.click(),document.body.removeChild(Z),URL.revokeObjectURL(q),e(t("settings.catalog.exported",{count:n.length}),"success")},le=async pe=>{const Ce=pe.target.files?.[0];if(Ce){try{const q=await Ce.text(),Z=JSON.parse(q);if(!Array.isArray(Z))throw new Error("Invalid format");let j=0,E=0;for(const I of Z){if(!I.name||typeof I.weight!="number"){E++;continue}if(n.some(B=>B.name.toLowerCase()===I.name.toLowerCase())){E++;continue}try{const B=await be.addCatalogEntry({name:I.name,weight:I.weight});r(ae=>[...ae,B].sort((z,V)=>z.name.localeCompare(V.name))),j++}catch{E++}}e(t("settings.catalog.imported",{added:j,skipped:E}),"success")}catch{e(t("settings.catalog.importFailed"),"error")}c.current&&(c.current.value="")}};return i.jsxs(Tt,{children:[i.jsxs(Wn,{children:[i.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[i.jsx(Ic,{className:"w-5 h-5 text-bambu-gray"}),i.jsx("h2",{className:"text-lg font-semibold text-white",children:t("settings.catalog.spoolCatalog")}),i.jsxs("span",{className:"text-sm text-bambu-gray",children:["(",n.length,")"]})]}),i.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[i.jsxs("button",{onClick:ie,className:"px-3 py-1.5 text-sm bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-bambu-gray hover:text-white transition-colors flex items-center gap-1.5",title:t("settings.catalog.exportTooltip"),children:[i.jsx(pi,{className:"w-4 h-4"}),i.jsx("span",{className:"hidden sm:inline",children:t("common.export")})]}),i.jsxs("button",{onClick:()=>c.current?.click(),className:"px-3 py-1.5 text-sm bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-bambu-gray hover:text-white transition-colors flex items-center gap-1.5",title:t("settings.catalog.importTooltip"),children:[i.jsx(Si,{className:"w-4 h-4"}),i.jsx("span",{className:"hidden sm:inline",children:t("common.import")})]}),i.jsx("input",{ref:c,type:"file",accept:".json",className:"hidden",onChange:le}),i.jsxs("button",{onClick:()=>D(!0),className:"px-3 py-1.5 text-sm bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-bambu-gray hover:text-white transition-colors flex items-center gap-1.5",title:t("settings.catalog.resetTooltip"),children:[i.jsx(uo,{className:"w-4 h-4"}),i.jsx("span",{className:"hidden sm:inline",children:t("common.reset")})]}),i.jsxs("button",{onClick:()=>u(!0),className:"px-3 py-1.5 text-sm bg-bambu-green text-white rounded-lg hover:bg-bambu-green/80 transition-colors flex items-center gap-1.5",children:[i.jsx(sr,{className:"w-4 h-4"}),i.jsx("span",{className:"hidden sm:inline",children:t("common.add")})]})]}),k.size>0&&i.jsxs("div",{className:"flex items-center gap-2 mt-2 px-3 py-2 bg-red-500/10 border border-red-500/30 rounded-lg",children:[i.jsx("span",{className:"text-sm text-red-400",children:t("settings.catalog.selectedCount",{count:k.size})}),i.jsxs("button",{onClick:()=>T(!0),className:"ml-auto px-3 py-1.5 text-sm bg-red-500 text-white rounded-lg hover:bg-red-600 transition-colors flex items-center gap-1.5",children:[i.jsx(Qt,{className:"w-4 h-4"}),t("settings.catalog.deleteSelected")]}),i.jsx("button",{onClick:()=>P(new Set),className:"px-3 py-1.5 text-sm text-bambu-gray hover:text-white transition-colors",children:t("common.cancel")})]})]}),i.jsxs(Pt,{className:"space-y-4",children:[i.jsx("p",{className:"text-sm text-bambu-gray",children:t("settings.catalog.spoolCatalogDescription")}),i.jsxs("div",{className:"relative",children:[i.jsx(Dr,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray"}),i.jsx("input",{type:"text",className:"w-full pl-10 pr-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:border-bambu-green focus:outline-none",placeholder:t("settings.catalog.searchCatalog"),value:o,onChange:pe=>l(pe.target.value)})]}),d&&i.jsxs("div",{className:"p-4 bg-bambu-dark rounded-lg border border-bambu-dark-tertiary",children:[i.jsx("h3",{className:"text-sm font-medium text-white mb-3",children:t("settings.catalog.addNewEntry")}),i.jsxs("div",{className:"flex gap-2 items-center",children:[i.jsx("div",{className:"flex-1 min-w-0",children:i.jsx("input",{type:"text",className:"w-full px-3 py-2 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:border-bambu-green focus:outline-none",placeholder:t("settings.catalog.namePlaceholder"),value:f,onChange:pe=>y(pe.target.value)})}),i.jsx("input",{type:"number",className:"w-20 px-3 py-2 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white text-center focus:border-bambu-green focus:outline-none",placeholder:"g",value:x,onChange:pe=>b(pe.target.value)}),i.jsx("span",{className:"text-bambu-gray shrink-0",children:"g"}),i.jsxs("button",{onClick:G,disabled:v,className:"px-3 py-2 bg-bambu-green text-white rounded-lg hover:bg-bambu-green/80 flex items-center gap-1 shrink-0",children:[v?i.jsx(ct,{className:"w-4 h-4 animate-spin"}):i.jsx(Vr,{className:"w-4 h-4"}),t("common.add")]}),i.jsx("button",{onClick:()=>{u(!1),y(""),b("")},className:"p-2 rounded-lg text-bambu-gray hover:text-white hover:bg-bambu-dark-tertiary",children:i.jsx(zt,{className:"w-4 h-4"})})]})]}),a?i.jsxs("div",{className:"flex items-center justify-center py-8 text-bambu-gray",children:[i.jsx(ct,{className:"w-5 h-5 animate-spin mr-2"}),t("common.loading")]}):i.jsx("div",{className:"max-h-[600px] overflow-y-auto border border-bambu-dark-tertiary rounded-lg",children:i.jsxs("table",{className:"w-full text-sm",children:[i.jsx("thead",{className:"bg-bambu-dark sticky top-0",children:i.jsxs("tr",{children:[i.jsx("th",{className:"px-2 py-2 w-10",children:i.jsx("input",{type:"checkbox",checked:U.length>0&&k.size===U.length,onChange:ge,className:"w-4 h-4 accent-bambu-green cursor-pointer"})}),i.jsx("th",{className:"px-4 py-2 text-left text-bambu-gray font-medium",children:t("common.name")}),i.jsx("th",{className:"px-4 py-2 text-right text-bambu-gray font-medium w-24",children:t("settings.catalog.weight")}),i.jsx("th",{className:"px-4 py-2 text-center text-bambu-gray font-medium w-20",children:t("settings.catalog.type")}),i.jsx("th",{className:"px-4 py-2 w-24"})]})}),i.jsx("tbody",{children:U.length===0?i.jsx("tr",{children:i.jsx("td",{colSpan:5,className:"px-4 py-8 text-center text-bambu-gray",children:t(o?"settings.catalog.noMatch":"settings.catalog.empty")})}):U.map(pe=>i.jsx("tr",{className:`border-t border-bambu-dark-tertiary hover:bg-bambu-dark ${k.has(pe.id)?"bg-bambu-dark":""}`,children:m===pe.id?i.jsxs(i.Fragment,{children:[i.jsx("td",{className:"px-2 py-2",children:i.jsx("input",{type:"checkbox",checked:k.has(pe.id),onChange:()=>me(pe.id),className:"w-4 h-4 accent-bambu-green cursor-pointer"})}),i.jsx("td",{className:"px-4 py-2",children:i.jsx("input",{type:"text",className:"w-full px-2 py-1 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded text-white focus:border-bambu-green focus:outline-none",value:f,onChange:Ce=>y(Ce.target.value)})}),i.jsx("td",{className:"px-4 py-2",children:i.jsx("input",{type:"number",className:"w-full px-2 py-1 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded text-white text-right focus:border-bambu-green focus:outline-none",value:x,onChange:Ce=>b(Ce.target.value)})}),i.jsx("td",{className:"px-4 py-2 text-center",children:i.jsx("span",{className:"text-xs text-bambu-gray",children:"-"})}),i.jsx("td",{className:"px-4 py-2",children:i.jsxs("div",{className:"flex justify-end gap-1",children:[i.jsx("button",{onClick:()=>re(pe.id),disabled:v,className:"p-1.5 rounded hover:bg-green-500/20 text-green-500",children:v?i.jsx(ct,{className:"w-4 h-4 animate-spin"}):i.jsx(Vr,{className:"w-4 h-4"})}),i.jsx("button",{onClick:te,className:"p-1.5 rounded hover:bg-bambu-dark-tertiary text-bambu-gray",children:i.jsx(zt,{className:"w-4 h-4"})})]})})]}):i.jsxs(i.Fragment,{children:[i.jsx("td",{className:"px-2 py-2",children:i.jsx("input",{type:"checkbox",checked:k.has(pe.id),onChange:()=>me(pe.id),className:"w-4 h-4 accent-bambu-green cursor-pointer"})}),i.jsx("td",{className:"px-4 py-2 text-white",children:pe.name}),i.jsxs("td",{className:"px-4 py-2 text-right font-mono text-white",children:[pe.weight,"g"]}),i.jsx("td",{className:"px-4 py-2 text-center",children:pe.is_default?i.jsx("span",{className:"text-xs px-2 py-0.5 rounded bg-bambu-dark-tertiary text-bambu-gray",children:t("settings.catalog.default")}):i.jsx("span",{className:"text-xs px-2 py-0.5 rounded bg-bambu-green/20 text-bambu-green",children:t("settings.catalog.custom")})}),i.jsx("td",{className:"px-4 py-2",children:i.jsxs("div",{className:"flex justify-end gap-1",children:[i.jsx("button",{onClick:()=>L(pe),className:"p-1.5 rounded hover:bg-bambu-dark-tertiary text-bambu-gray hover:text-white",children:i.jsx(Wi,{className:"w-4 h-4"})}),i.jsx("button",{onClick:()=>R(pe),className:"p-1.5 rounded bg-red-500/10 hover:bg-red-500/20 text-red-500",children:i.jsx(Qt,{className:"w-4 h-4"})})]})})]})},pe.id))})]})})]}),N&&i.jsx(Nn,{title:t("settings.catalog.deleteEntry"),message:t("settings.catalog.deleteConfirm",{name:N.name}),confirmText:t("common.delete"),variant:"danger",onConfirm:J,onCancel:()=>R(null)}),C&&i.jsx(Nn,{title:t("settings.catalog.deleteSelected"),message:t("settings.catalog.bulkDeleteConfirm",{count:k.size}),confirmText:t("common.delete"),variant:"danger",onConfirm:X,onCancel:()=>T(!1)}),A&&i.jsx(Nn,{title:t("settings.catalog.resetCatalog"),message:t("settings.catalog.resetConfirm"),confirmText:t("common.reset"),variant:"danger",onConfirm:ue,onCancel:()=>D(!1)})]})}function uJe(){const{t}=Mt(),{showToast:e}=bn(),[n,r]=w.useState([]),[a,s]=w.useState(!0),[o,l]=w.useState(""),[c,d]=w.useState("Bambu Lab"),u=w.useRef(null),[m,p]=w.useState(!1),[f,y]=w.useState(null),[x,b]=w.useState(""),[v,_]=w.useState(""),[k,P]=w.useState("#FFFFFF"),[C,T]=w.useState(""),[N,R]=w.useState(!1),[A,D]=w.useState(new Set),[$,U]=w.useState(!1),[G,L]=w.useState(!1),[te,re]=w.useState(null),[J,ue]=w.useState(null),[me,ge]=w.useState(!1),X=w.useCallback(async()=>{try{const K=await be.getColorCatalog();r(K)}catch{e(t("settings.colorCatalog.loadFailed"),"error")}finally{s(!1)}},[e,t]);w.useEffect(()=>{X()},[X]);const ie=[...new Set(n.map(K=>K.manufacturer))].sort(),le=n.filter(K=>{const ne=o===""||K.manufacturer.toLowerCase().includes(o.toLowerCase())||K.color_name.toLowerCase().includes(o.toLowerCase())||(K.material?.toLowerCase().includes(o.toLowerCase())??!1),se=c===""||K.manufacturer===c;return ne&&se}),pe=()=>{b(""),_(""),P("#FFFFFF"),T("")},Ce=async()=>{if(!x.trim()||!v.trim()||!k){e(t("settings.colorCatalog.fieldsRequired"),"error");return}R(!0);try{const K=await be.addColorEntry({manufacturer:x.trim(),color_name:v.trim(),hex_color:k,material:C.trim()||null});r(ne=>[...ne,K].sort((se,ce)=>se.manufacturer.localeCompare(ce.manufacturer)||(se.material||"").localeCompare(ce.material||"")||se.color_name.localeCompare(ce.color_name))),p(!1),pe(),e(t("settings.colorCatalog.colorAdded"),"success")}catch{e(t("settings.colorCatalog.addFailed"),"error")}finally{R(!1)}},q=K=>{y(K.id),b(K.manufacturer),_(K.color_name),P(K.hex_color),T(K.material||"")},Z=()=>{y(null),pe()},j=async K=>{if(!x.trim()||!v.trim()||!k){e(t("settings.colorCatalog.fieldsRequired"),"error");return}R(!0);try{const ne=await be.updateColorEntry(K,{manufacturer:x.trim(),color_name:v.trim(),hex_color:k,material:C.trim()||null});r(se=>se.map(ce=>ce.id===K?ne:ce).sort((ce,fe)=>ce.manufacturer.localeCompare(fe.manufacturer)||(ce.material||"").localeCompare(fe.material||"")||ce.color_name.localeCompare(fe.color_name))),y(null),pe(),e(t("settings.colorCatalog.colorUpdated"),"success")}catch{e(t("settings.colorCatalog.updateFailed"),"error")}finally{R(!1)}},E=async()=>{if(J)try{await be.deleteColorEntry(J.id),r(K=>K.filter(ne=>ne.id!==J.id)),e(t("settings.colorCatalog.colorDeleted"),"success")}catch{e(t("settings.colorCatalog.deleteFailed"),"error")}finally{ue(null)}},I=async()=>{ge(!1),s(!0);try{await be.resetColorCatalog(),await X(),e(t("settings.colorCatalog.resetSuccess"),"success")}catch{e(t("settings.colorCatalog.resetFailed"),"error"),s(!1)}},W=async()=>{L(!0),re(null);try{const K={},ne=uu();ne&&(K.Authorization=`Bearer ${ne}`);const se=await fetch("/api/v1/inventory/colors/sync",{method:"POST",headers:K});if(!se.ok)throw new Error("Failed to start sync");const ce=se.body?.getReader();if(!ce)throw new Error("No response body");const fe=new TextDecoder;let oe="";for(;;){const{done:O,value:F}=await ce.read();if(O)break;oe+=fe.decode(F,{stream:!0});const Q=oe.split(`
- `);oe=Q.pop()||"";for(const ve of Q)if(ve.startsWith("data: "))try{const he=JSON.parse(ve.slice(6));he.type==="progress"?re({fetched:he.total_fetched,total:he.total_available}):he.type==="complete"?he.added===0?e(t("settings.colorCatalog.syncUpToDate",{count:he.total_fetched}),"success"):e(t("settings.colorCatalog.syncComplete",{added:he.added,skipped:he.skipped}),"success"):he.type==="error"&&e(`${t("settings.colorCatalog.syncError")}: ${he.error}`,"error")}catch{}}await X()}catch{e(t("settings.colorCatalog.syncFailed"),"error")}finally{L(!1),re(null)}},B=K=>{D(ne=>{const se=new Set(ne);return se.has(K)?se.delete(K):se.add(K),se})},ae=()=>{A.size===le.length?D(new Set):D(new Set(le.map(K=>K.id)))},z=async()=>{if(U(!1),A.size!==0)try{const K=await be.bulkDeleteColorEntries([...A]);r(ne=>ne.filter(se=>!A.has(se.id))),D(new Set),e(t("settings.colorCatalog.bulkDeleted",{count:K.deleted}),"success")}catch{e(t("settings.colorCatalog.bulkDeleteFailed"),"error")}},V=()=>{const K=n.map(({manufacturer:fe,color_name:oe,hex_color:O,material:F})=>({manufacturer:fe,color_name:oe,hex_color:O,material:F})),ne=new Blob([JSON.stringify(K,null,2)],{type:"application/json"}),se=URL.createObjectURL(ne),ce=document.createElement("a");ce.href=se,ce.download="color-catalog.json",document.body.appendChild(ce),ce.click(),document.body.removeChild(ce),URL.revokeObjectURL(se),e(t("settings.colorCatalog.exported",{count:n.length}),"success")},ee=async K=>{const ne=K.target.files?.[0];if(ne){try{const se=await ne.text(),ce=JSON.parse(se);if(!Array.isArray(ce))throw new Error("Invalid format");let fe=0,oe=0;for(const O of ce){if(!O.manufacturer||!O.color_name||!O.hex_color){oe++;continue}if(n.some(Q=>Q.manufacturer.toLowerCase()===O.manufacturer.toLowerCase()&&Q.color_name.toLowerCase()===O.color_name.toLowerCase()&&(Q.material||"").toLowerCase()===(O.material||"").toLowerCase())){oe++;continue}try{const Q=await be.addColorEntry({manufacturer:O.manufacturer,color_name:O.color_name,hex_color:O.hex_color,material:O.material||null});r(ve=>[...ve,Q].sort((he,de)=>he.manufacturer.localeCompare(de.manufacturer)||(he.material||"").localeCompare(de.material||"")||he.color_name.localeCompare(de.color_name))),fe++}catch{oe++}}e(t("settings.colorCatalog.imported",{added:fe,skipped:oe}),"success")}catch{e(t("settings.colorCatalog.importFailed"),"error")}u.current&&(u.current.value="")}};return i.jsxs(Tt,{children:[i.jsxs(Wn,{children:[i.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[i.jsx(F0,{className:"w-5 h-5 text-bambu-gray"}),i.jsx("h2",{className:"text-lg font-semibold text-white",children:t("settings.colorCatalog.title")}),i.jsxs("span",{className:"text-sm text-bambu-gray",children:["(",n.length,")"]})]}),i.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[i.jsxs("button",{onClick:V,className:"px-3 py-1.5 text-sm bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-bambu-gray hover:text-white transition-colors flex items-center gap-1.5",children:[i.jsx(pi,{className:"w-4 h-4"}),i.jsx("span",{className:"hidden sm:inline",children:t("common.export")})]}),i.jsxs("button",{onClick:()=>u.current?.click(),className:"px-3 py-1.5 text-sm bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-bambu-gray hover:text-white transition-colors flex items-center gap-1.5",children:[i.jsx(Si,{className:"w-4 h-4"}),i.jsx("span",{className:"hidden sm:inline",children:t("common.import")})]}),i.jsx("input",{ref:u,type:"file",accept:".json",className:"hidden",onChange:ee}),i.jsxs("button",{onClick:W,disabled:G,className:"px-3 py-1.5 text-sm bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-bambu-gray hover:text-white transition-colors flex items-center gap-1.5",title:t("settings.colorCatalog.syncTooltip"),children:[G?i.jsx(ct,{className:"w-4 h-4 animate-spin"}):i.jsx(lx,{className:"w-4 h-4"}),i.jsx("span",{className:"hidden sm:inline",children:G?te?`${Math.min(te.fetched,te.total)} / ${te.total}`:t("settings.colorCatalog.starting"):t("settings.colorCatalog.sync")})]}),i.jsxs("button",{onClick:()=>ge(!0),className:"px-3 py-1.5 text-sm bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-bambu-gray hover:text-white transition-colors flex items-center gap-1.5",children:[i.jsx(uo,{className:"w-4 h-4"}),i.jsx("span",{className:"hidden sm:inline",children:t("common.reset")})]}),i.jsxs("button",{onClick:()=>p(!0),className:"px-3 py-1.5 text-sm bg-bambu-green text-white rounded-lg hover:bg-bambu-green/80 transition-colors flex items-center gap-1.5",children:[i.jsx(sr,{className:"w-4 h-4"}),i.jsx("span",{className:"hidden sm:inline",children:t("common.add")})]})]}),A.size>0&&i.jsxs("div",{className:"flex items-center gap-2 mt-2 px-3 py-2 bg-red-500/10 border border-red-500/30 rounded-lg",children:[i.jsx("span",{className:"text-sm text-red-400",children:t("settings.colorCatalog.selectedCount",{count:A.size})}),i.jsxs("button",{onClick:()=>U(!0),className:"ml-auto px-3 py-1.5 text-sm bg-red-500 text-white rounded-lg hover:bg-red-600 transition-colors flex items-center gap-1.5",children:[i.jsx(Qt,{className:"w-4 h-4"}),t("settings.colorCatalog.deleteSelected")]}),i.jsx("button",{onClick:()=>D(new Set),className:"px-3 py-1.5 text-sm text-bambu-gray hover:text-white transition-colors",children:t("common.cancel")})]})]}),i.jsxs(Pt,{className:"space-y-4",children:[i.jsx("p",{className:"text-sm text-bambu-gray",children:t("settings.colorCatalog.description")}),i.jsxs("div",{className:"flex gap-2 flex-wrap",children:[i.jsxs("div",{className:"relative flex-1 min-w-[200px]",children:[i.jsx(Dr,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray"}),i.jsx("input",{type:"text",className:"w-full pl-10 pr-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:border-bambu-green focus:outline-none",placeholder:t("settings.colorCatalog.searchColors"),value:o,onChange:K=>l(K.target.value)})]}),i.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:c,onChange:K=>d(K.target.value),children:[i.jsx("option",{value:"",children:t("settings.colorCatalog.allManufacturers")}),ie.map(K=>i.jsx("option",{value:K,children:K},K))]})]}),m&&i.jsxs("div",{className:"p-4 bg-bambu-dark rounded-lg border border-bambu-dark-tertiary",children:[i.jsx("h3",{className:"text-sm font-medium text-white mb-3",children:t("settings.colorCatalog.addNewColor")}),i.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-5 gap-2 items-end",children:[i.jsx("input",{type:"text",className:"px-3 py-2 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:border-bambu-green focus:outline-none",placeholder:t("settings.colorCatalog.manufacturer"),value:x,onChange:K=>b(K.target.value)}),i.jsx("input",{type:"text",className:"px-3 py-2 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:border-bambu-green focus:outline-none",placeholder:t("settings.colorCatalog.colorName"),value:v,onChange:K=>_(K.target.value)}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("input",{type:"color",className:"w-20 h-10 rounded cursor-pointer border border-bambu-dark-tertiary",value:k,onChange:K=>P(K.target.value)}),i.jsx("input",{type:"text",className:"w-32 px-3 py-2 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:border-bambu-green focus:outline-none",placeholder:"#FFFFFF",value:k,onChange:K=>P(K.target.value)})]}),i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx("input",{type:"text",className:"flex-1 max-w-lg min-w-[200px] px-3 py-2 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:border-bambu-green focus:outline-none",placeholder:t("settings.colorCatalog.materialOptional"),value:C,onChange:K=>T(K.target.value)}),i.jsxs("button",{onClick:Ce,disabled:N,className:"w-24 px-3 py-2 bg-bambu-green text-white rounded-lg hover:bg-bambu-green/80 flex items-center justify-center gap-3",children:[N?i.jsx(ct,{className:"w-4 h-4 animate-spin"}):i.jsx(Vr,{className:"w-4 h-4"}),t("common.add")]}),i.jsx("button",{onClick:()=>{p(!1),pe()},className:"p-2 ml-2 rounded-lg text-bambu-gray hover:text-white hover:bg-bambu-dark-tertiary",children:i.jsx(zt,{className:"w-4 h-4"})})]})]})]}),(o||c)&&i.jsx("div",{className:"text-xs text-bambu-gray",children:t("settings.colorCatalog.showing",{filtered:le.length,total:n.length})}),a?i.jsxs("div",{className:"flex items-center justify-center py-8 text-bambu-gray",children:[i.jsx(ct,{className:"w-5 h-5 animate-spin mr-2"}),t("common.loading")]}):i.jsx("div",{className:"max-h-[600px] overflow-auto border border-bambu-dark-tertiary rounded-lg",children:i.jsxs("table",{className:"w-full text-sm",children:[i.jsx("thead",{className:"bg-bambu-dark sticky top-0",children:i.jsxs("tr",{children:[i.jsx("th",{className:"px-2 py-2 w-10",children:i.jsx("input",{type:"checkbox",checked:le.length>0&&A.size===le.length,onChange:ae,className:"w-4 h-4 accent-bambu-green cursor-pointer"})}),i.jsx("th",{className:"px-3 py-2 text-left text-bambu-gray font-medium w-12"}),i.jsx("th",{className:"px-3 py-2 text-left text-bambu-gray font-medium",children:t("settings.colorCatalog.manufacturer")}),i.jsx("th",{className:"px-3 py-2 text-left text-bambu-gray font-medium",children:t("inventory.material")}),i.jsx("th",{className:"px-3 py-2 text-left text-bambu-gray font-medium",children:t("settings.colorCatalog.colorName")}),i.jsx("th",{className:"px-3 py-2 text-left text-bambu-gray font-medium w-24",children:t("settings.colorCatalog.hex")}),i.jsx("th",{className:"px-3 py-2 w-16"})]})}),i.jsx("tbody",{children:le.length===0?i.jsx("tr",{children:i.jsx("td",{colSpan:7,className:"px-3 py-8 text-center text-bambu-gray",children:t(o||c?"settings.colorCatalog.noMatch":"settings.colorCatalog.empty")})}):le.map(K=>i.jsx("tr",{className:`border-t border-bambu-dark-tertiary hover:bg-bambu-dark ${A.has(K.id)?"bg-bambu-dark":""}`,children:f===K.id?i.jsxs(i.Fragment,{children:[i.jsx("td",{className:"px-2 py-2",children:i.jsx("input",{type:"checkbox",checked:A.has(K.id),onChange:()=>B(K.id),className:"w-4 h-4 accent-bambu-green cursor-pointer"})}),i.jsx("td",{className:"px-3 py-2",children:i.jsx("input",{type:"color",className:"w-8 h-8 rounded cursor-pointer border border-bambu-dark-tertiary",value:k,onChange:ne=>P(ne.target.value)})}),i.jsx("td",{className:"px-3 py-2",children:i.jsx("input",{type:"text",className:"w-full px-2 py-1 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded text-white text-sm focus:border-bambu-green focus:outline-none",value:x,onChange:ne=>b(ne.target.value)})}),i.jsx("td",{className:"px-3 py-2",children:i.jsx("input",{type:"text",className:"w-full px-2 py-1 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded text-white text-sm focus:border-bambu-green focus:outline-none",value:C,onChange:ne=>T(ne.target.value)})}),i.jsx("td",{className:"px-3 py-2",children:i.jsx("input",{type:"text",className:"w-full px-2 py-1 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded text-white text-sm focus:border-bambu-green focus:outline-none",value:v,onChange:ne=>_(ne.target.value)})}),i.jsx("td",{className:"px-3 py-2",children:i.jsx("input",{type:"text",className:"w-full px-2 py-1 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded text-white text-sm focus:border-bambu-green focus:outline-none",value:k,onChange:ne=>P(ne.target.value)})}),i.jsx("td",{className:"px-3 py-2",children:i.jsxs("div",{className:"flex justify-end gap-1",children:[i.jsx("button",{onClick:()=>j(K.id),disabled:N,className:"p-1.5 rounded hover:bg-green-500/20 text-green-500",children:N?i.jsx(ct,{className:"w-4 h-4 animate-spin"}):i.jsx(Vr,{className:"w-4 h-4"})}),i.jsx("button",{onClick:Z,className:"p-1.5 rounded hover:bg-bambu-dark-tertiary text-bambu-gray",children:i.jsx(zt,{className:"w-4 h-4"})})]})})]}):i.jsxs(i.Fragment,{children:[i.jsx("td",{className:"px-2 py-2",children:i.jsx("input",{type:"checkbox",checked:A.has(K.id),onChange:()=>B(K.id),className:"w-4 h-4 accent-bambu-green cursor-pointer"})}),i.jsx("td",{className:"px-3 py-2",children:i.jsx("div",{className:"w-8 h-8 rounded border border-bambu-dark-tertiary",style:{backgroundColor:K.hex_color},title:K.hex_color})}),i.jsx("td",{className:"px-3 py-2 text-white",children:K.manufacturer}),i.jsx("td",{className:"px-3 py-2 text-bambu-gray",children:K.material||"-"}),i.jsx("td",{className:"px-3 py-2 text-white",children:K.color_name}),i.jsx("td",{className:"px-3 py-2 font-mono text-xs text-bambu-gray",children:K.hex_color}),i.jsx("td",{className:"px-3 py-2",children:i.jsxs("div",{className:"flex justify-end gap-1",children:[i.jsx("button",{onClick:()=>q(K),className:"p-1.5 rounded hover:bg-bambu-dark-tertiary text-bambu-gray hover:text-white",children:i.jsx(Wi,{className:"w-4 h-4"})}),i.jsx("button",{onClick:()=>ue(K),className:"p-1.5 rounded bg-red-500/10 hover:bg-red-500/20 text-red-500",children:i.jsx(Qt,{className:"w-4 h-4"})})]})})]})},K.id))})]})})]}),J&&i.jsx(Nn,{title:t("settings.colorCatalog.deleteColor"),message:t("settings.colorCatalog.deleteConfirm",{name:`${J.manufacturer} - ${J.color_name}`}),confirmText:t("common.delete"),variant:"danger",onConfirm:E,onCancel:()=>ue(null)}),$&&i.jsx(Nn,{title:t("settings.colorCatalog.deleteSelected"),message:t("settings.colorCatalog.bulkDeleteConfirm",{count:A.size}),confirmText:t("common.delete"),variant:"danger",onConfirm:z,onCancel:()=>U(!1)}),me&&i.jsx(Nn,{title:t("settings.colorCatalog.resetCatalog"),message:t("settings.colorCatalog.resetConfirm"),confirmText:t("common.reset"),variant:"danger",onConfirm:I,onCancel:()=>ge(!1)})]})}function mJe({link:t,onClose:e}){const{t:n}=Mt(),r=tn(),a=!!t,s=w.useRef(null),[o,l]=w.useState(t?.name||""),[c,d]=w.useState(t?.url||""),[u,m]=w.useState(t?.icon||"link"),[p,f]=w.useState(t?.open_in_new_tab||!1),[y,x]=w.useState(!!t?.custom_icon),[b,v]=w.useState(t?.custom_icon?be.getExternalLinkIconUrl(t.id):null),[_,k]=w.useState(null),[P,C]=w.useState(null);w.useEffect(()=>{const G=L=>{L.key==="Escape"&&e()};return window.addEventListener("keydown",G),()=>window.removeEventListener("keydown",G)},[e]);const T=ut({mutationFn:async G=>{const L=await be.createExternalLink(G);return _?await be.uploadExternalLinkIcon(L.id,_):L},onSuccess:()=>{r.invalidateQueries({queryKey:["external-links"]}),e()},onError:G=>{C(G.message)}}),N=ut({mutationFn:async G=>{let L=await be.updateExternalLink(t.id,G);return _?L=await be.uploadExternalLinkIcon(t.id,_):!y&&t?.custom_icon&&(L=await be.deleteExternalLinkIcon(t.id)),L},onSuccess:()=>{r.invalidateQueries({queryKey:["external-links"]}),e()},onError:G=>{C(G.message)}}),R=G=>{const L=G.target.files?.[0];if(L){if(!["image/png","image/jpeg","image/gif","image/svg+xml","image/webp","image/x-icon"].includes(L.type)){C("Please select a valid image file (PNG, JPG, GIF, SVG, WebP, or ICO)");return}if(L.size>1024*1024){C("Image file must be less than 1MB");return}k(L),x(!0);const re=new FileReader;re.onload=J=>{v(J.target?.result)},re.readAsDataURL(L)}},A=()=>{k(null),v(null),x(!1),s.current&&(s.current.value="")},D=G=>{if(G.preventDefault(),C(null),!o.trim()){C("Name is required");return}if(!c.trim()){C("URL is required");return}if(!c.startsWith("http://")&&!c.startsWith("https://")){C("URL must start with http:// or https://");return}const L={name:o.trim(),url:c.trim(),icon:u,open_in_new_tab:p};a?N.mutate(L):T.mutate(L)},$=T.isPending||N.isPending,U=yC(u);return i.jsx("div",{className:"fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-4",onClick:e,children:i.jsxs("div",{className:"bg-bambu-dark-secondary rounded-xl border border-bambu-dark-tertiary w-full max-w-md",onClick:G=>G.stopPropagation(),children:[i.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-bambu-dark-tertiary",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"p-2 rounded-full bg-bambu-green/20 text-bambu-green",children:y&&b?i.jsx("img",{src:b,alt:"",className:"w-5 h-5 rounded"}):i.jsx(U,{className:"w-5 h-5"})}),i.jsx("h2",{className:"text-lg font-semibold text-white",children:a?"Edit Link":"Add External Link"})]}),i.jsx("button",{onClick:e,className:"text-bambu-gray hover:text-white transition-colors",children:i.jsx(zt,{className:"w-5 h-5"})})]}),i.jsxs("form",{onSubmit:D,className:"p-6 space-y-4",children:[P&&i.jsx("div",{className:"p-3 bg-red-500/20 border border-red-500/50 rounded-lg text-sm text-red-400",children:P}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Name *"}),i.jsx("input",{type:"text",value:o,onChange:G=>l(G.target.value),placeholder:"My Link",maxLength:50,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"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"URL *"}),i.jsx("input",{type:"text",value:c,onChange:G=>d(G.target.value),placeholder:"https://example.com",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"})]}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("label",{className:"text-sm text-bambu-gray",children:n("externalLinks.openInNewTab")}),i.jsx("button",{type:"button",onClick:()=>f(!p),className:`relative inline-flex h-6 w-11 items-center rounded-full transition-colors ${p?"bg-bambu-green":"bg-bambu-dark-tertiary"}`,children:i.jsx("span",{className:`inline-block h-4 w-4 transform rounded-full bg-white transition-transform ${p?"translate-x-6":"translate-x-1"}`})})]}),i.jsxs("div",{className:"space-y-3",children:[i.jsx("label",{className:"block text-sm text-bambu-gray",children:"Icon"}),i.jsxs("div",{className:"p-3 rounded-lg bg-bambu-dark border border-bambu-dark-tertiary",children:[i.jsxs("div",{className:"flex items-center justify-between mb-2",children:[i.jsx("span",{className:"text-sm text-white",children:"Custom Icon"}),i.jsx("input",{ref:s,type:"file",accept:"image/png,image/jpeg,image/gif,image/svg+xml,image/webp,image/x-icon",className:"hidden",onChange:R}),y&&b?i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("img",{src:b,alt:"Custom icon",className:"w-8 h-8 rounded border border-bambu-dark-tertiary"}),i.jsx("button",{type:"button",onClick:A,className:"p-1 text-red-400 hover:text-red-300 transition-colors",title:"Remove custom icon",children:i.jsx(Qt,{className:"w-4 h-4"})})]}):i.jsxs(Fe,{type:"button",variant:"secondary",size:"sm",onClick:()=>s.current?.click(),children:[i.jsx(Si,{className:"w-4 h-4"}),"Upload"]})]}),i.jsx("p",{className:"text-xs text-bambu-gray",children:"PNG, JPG, GIF, SVG, WebP, or ICO. Max 1MB."})]}),!y&&i.jsxs("div",{children:[i.jsx("span",{className:"text-sm text-bambu-gray block mb-2",children:"Or choose a preset icon"}),i.jsx(abe,{value:u,onChange:m})]})]}),i.jsxs("div",{className:"flex gap-3 pt-2",children:[i.jsx(Fe,{type:"button",variant:"secondary",onClick:e,className:"flex-1",children:"Cancel"}),i.jsxs(Fe,{type:"submit",disabled:$,className:"flex-1",children:[$?i.jsx(ct,{className:"w-4 h-4 animate-spin"}):i.jsx(ps,{className:"w-4 h-4"}),a?"Save":"Add"]})]})]})]})})}function hJe(){const{t}=Mt(),e=tn(),[n,r]=w.useState(!1),[a,s]=w.useState(null),[o,l]=w.useState(null),[c,d]=w.useState(null),{data:u,isLoading:m}=Je({queryKey:["external-links"],queryFn:be.getExternalLinks}),p=ut({mutationFn:k=>be.deleteExternalLink(k),onSuccess:()=>{e.invalidateQueries({queryKey:["external-links"]})}}),f=ut({mutationFn:k=>be.reorderExternalLinks(k),onSuccess:()=>{e.invalidateQueries({queryKey:["external-links"]})}}),y=(k,P)=>{d(P),k.dataTransfer.effectAllowed="move"},x=k=>{k.preventDefault(),k.dataTransfer.dropEffect="move"},b=(k,P)=>{if(k.preventDefault(),c===null||c===P||!u)return;const C=u.map(A=>A.id),T=C.indexOf(c),N=C.indexOf(P);if(T===-1||N===-1)return;const R=[...C];R.splice(T,1),R.splice(N,0,c),f.mutate(R),d(null)},v=k=>{l(k)},_=()=>{o&&(p.mutate(o.id),l(null))};return i.jsxs(i.Fragment,{children:[i.jsxs(Tt,{children:[i.jsx(Wn,{children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(Vm,{className:"w-5 h-5 text-bambu-green"}),i.jsx("h2",{className:"text-lg font-semibold text-white",children:"Sidebar Links"})]}),i.jsxs(Fe,{size:"sm",onClick:()=>r(!0),children:[i.jsx(sr,{className:"w-4 h-4"}),"Add Link"]})]})}),i.jsxs(Pt,{children:[i.jsx("p",{className:"text-sm text-bambu-gray mb-4",children:"Add external links to the sidebar navigation. Drag to reorder."}),m?i.jsx("div",{className:"flex justify-center py-8",children:i.jsx(ct,{className:"w-6 h-6 text-bambu-green animate-spin"})}):u&&u.length>0?i.jsx("div",{className:"space-y-2",children:u.map(k=>{const P=yC(k.icon);return i.jsxs("div",{draggable:!0,onDragStart:C=>y(C,k.id),onDragOver:x,onDrop:C=>b(C,k.id),className:`flex items-center gap-3 p-3 rounded-lg bg-bambu-dark border border-bambu-dark-tertiary transition-colors ${c===k.id?"opacity-50":""}`,children:[i.jsx(qm,{className:"w-6 h-6 md:w-4 md:h-4 text-bambu-gray cursor-grab flex-shrink-0"}),i.jsx("div",{className:"p-2 rounded-lg bg-bambu-dark-tertiary text-bambu-gray",children:i.jsx(P,{className:"w-4 h-4"})}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"text-white font-medium truncate",children:k.name}),i.jsx(ei,{className:"w-3 h-3 text-bambu-gray flex-shrink-0"})]}),i.jsx("span",{className:"text-sm text-bambu-gray truncate block",children:k.url})]}),i.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[i.jsx("button",{onClick:()=>s(k),className:"p-2 rounded-lg hover:bg-bambu-dark-tertiary text-bambu-gray hover:text-white transition-colors",title:t("common.edit"),children:i.jsx(Wi,{className:"w-4 h-4"})}),i.jsx("button",{onClick:()=>v(k),disabled:p.isPending,className:"p-2 rounded-lg hover:bg-red-500/20 text-bambu-gray hover:text-red-400 transition-colors disabled:opacity-50",title:t("externalLinks.deleteLink"),children:i.jsx(Qt,{className:"w-4 h-4"})})]})]},k.id)})}):i.jsxs("div",{className:"text-center py-8 text-bambu-gray",children:[i.jsx(Vm,{className:"w-8 h-8 mx-auto mb-2 opacity-50"}),i.jsx("p",{children:t("externalLinks.noLinksConfigured")}),i.jsx("p",{className:"text-sm",children:'Click "Add Link" to add one'})]})]})]}),(n||a)&&i.jsx(mJe,{link:a,onClose:()=>{r(!1),s(null)}}),o&&i.jsx(Nn,{title:"Delete Link",message:`Are you sure you want to delete "${o.name}"? This action cannot be undone.`,confirmText:"Delete",cancelText:"Cancel",variant:"danger",onConfirm:_,onCancel:()=>l(null)})]})}const Wj={immediate:"archive",review:"review",print_queue:"queue",proxy:"proxy"};function pJe({printer:t,models:e}){const{t:n}=Mt(),r=tn(),{showToast:a}=bn(),[s,o]=w.useState(!0),[l,c]=w.useState(t.enabled),[d,u]=w.useState(t.name),[m,p]=w.useState(""),[f,y]=w.useState(t.mode==="queue"?"review":t.mode),[x,b]=w.useState(t.target_printer_id),[v,_]=w.useState(t.bind_ip||""),[k,P]=w.useState(t.remote_interface_ip||""),[C,T]=w.useState(t.model||""),[N,R]=w.useState(t.auto_dispatch??!0),[A,D]=w.useState(!1),[$,U]=w.useState(null),[G,L]=w.useState(!1);w.useEffect(()=>{$||(c(t.enabled),y(t.mode==="queue"?"review":t.mode),u(t.name),b(t.target_printer_id),_(t.bind_ip||""),P(t.remote_interface_ip||""),T(t.model||""),R(t.auto_dispatch??!0))},[t,$]);const{data:te}=Je({queryKey:["printers"],queryFn:be.getPrinters}),{data:re}=Je({queryKey:["network-interfaces"],queryFn:()=>be.getNetworkInterfaces().then(E=>E.interfaces)}),J=ut({mutationFn:E=>K1.update(t.id,E),onSuccess:()=>{r.invalidateQueries({queryKey:["virtual-printers"]}),a(n("virtualPrinter.toast.updated")),U(null)},onError:E=>{a(E.message||n("virtualPrinter.toast.failedToUpdate"),"error"),c(t.enabled),y(t.mode==="queue"?"review":t.mode),b(t.target_printer_id),_(t.bind_ip||""),U(null)}}),ue=ut({mutationFn:()=>K1.remove(t.id),onSuccess:()=>{r.invalidateQueries({queryKey:["virtual-printers"]}),a(n("virtualPrinter.toast.deleted")),L(!1)},onError:E=>{a(E.message||n("virtualPrinter.toast.failedToDelete"),"error"),L(!1)}}),me=E=>{E.stopPropagation();const I=!l;if(I){if(!v){a(n("virtualPrinter.toast.bindIpRequired"),"error");return}if(f==="proxy"){if(!x){a(n("virtualPrinter.toast.targetPrinterRequired"),"error");return}}else if(!m&&!t.access_code_set){a(n("virtualPrinter.toast.accessCodeRequired"),"error");return}}c(I),U("toggle"),J.mutate({enabled:I})},ge=()=>{d.trim()&&(U("name"),J.mutate({name:d.trim()}))},X=()=>{if(!m){a(n("virtualPrinter.toast.accessCodeEmpty"),"error");return}if(m.length!==8){a(n("virtualPrinter.toast.accessCodeLength"),"error");return}U("accessCode"),J.mutate({access_code:m}),p("")},ie=E=>{y(E),U("mode"),J.mutate({mode:E})},le=E=>{T(E),U("model"),J.mutate({model:E})},pe=E=>{b(E),U("targetPrinter"),J.mutate({target_printer_id:E})},Ce=E=>{P(E),U("remoteInterface"),J.mutate({remote_interface_ip:E})},q=t.status?.running||!1,Z=n(`virtualPrinter.mode.${Wj[f]||"archive"}`),j=te?.find(E=>E.id===x)?.name;return i.jsxs(i.Fragment,{children:[i.jsxs(Tt,{children:[i.jsxs("div",{className:"px-4 py-3 flex items-center gap-3 cursor-pointer select-none",onClick:()=>o(!s),children:[i.jsx("button",{className:"text-bambu-gray flex-shrink-0",children:s?i.jsx(In,{className:"w-4 h-4"}):i.jsx(pa,{className:"w-4 h-4"})}),i.jsx("span",{className:`w-2 h-2 rounded-full flex-shrink-0 ${q?"bg-green-400 animate-pulse":"bg-gray-500"}`}),i.jsx("span",{className:"text-white font-medium truncate",children:t.name}),i.jsx("span",{className:"text-xs text-bambu-gray flex-shrink-0",children:Z}),t.model_name&&i.jsx("span",{className:"text-xs text-bambu-gray flex-shrink-0",children:t.model_name}),j&&i.jsxs("span",{className:"text-xs text-bambu-gray flex-shrink-0 truncate",children:[f==="proxy"&&i.jsx(SD,{className:"w-3 h-3 inline mr-1"}),j]}),v&&i.jsx("span",{className:"text-[10px] text-bambu-gray flex-shrink-0 font-mono",children:v}),k&&i.jsx("span",{className:"text-[10px] text-bambu-gray flex-shrink-0 font-mono",children:k}),i.jsx("div",{className:"ml-auto flex items-center gap-2 flex-shrink-0",onClick:E=>E.stopPropagation(),children:i.jsx("button",{onClick:me,disabled:$==="toggle",className:`relative w-10 h-5 rounded-full transition-colors ${l?"bg-bambu-green":"bg-bambu-dark-tertiary"} ${$==="toggle"?"opacity-50":""}`,children:i.jsx("span",{className:`absolute top-0.5 left-0.5 w-4 h-4 bg-white rounded-full transition-transform ${l?"translate-x-5":""}`})})})]}),s&&i.jsxs(Pt,{className:"pt-0 space-y-4",children:[i.jsx("div",{className:"border-t border-bambu-dark-tertiary"}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("input",{type:"text",value:d,onChange:E=>u(E.target.value),onBlur:ge,onKeyDown:E=>E.key==="Enter"&&ge(),className:"flex-1 text-sm text-white bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-md px-3 py-1.5 focus:border-bambu-green focus:outline-none"}),i.jsx("span",{className:"text-xs text-bambu-gray font-mono",children:t.serial}),i.jsx("button",{onClick:()=>L(!0),className:"p-1.5 text-bambu-gray hover:text-red-400 transition-colors",title:n("common.delete"),children:i.jsx(Qt,{className:"w-4 h-4"})})]}),i.jsxs("div",{children:[i.jsx("div",{className:"text-white text-sm font-medium mb-2",children:n("virtualPrinter.mode.title")}),i.jsx("div",{className:"grid grid-cols-2 gap-2",children:["immediate","review","print_queue","proxy"].map(E=>i.jsxs("button",{onClick:()=>ie(E),disabled:$==="mode",className:`p-2 rounded-lg border text-left transition-colors ${f===E?E==="proxy"?"border-blue-500 bg-blue-500/10":"border-bambu-green bg-bambu-green/10":"border-bambu-dark-tertiary hover:border-bambu-gray"}`,children:[i.jsxs("div",{className:"flex items-center gap-1.5 text-white text-xs font-medium",children:[E==="proxy"&&i.jsx(SD,{className:"w-3 h-3"}),n(`virtualPrinter.mode.${Wj[E]}`)]}),i.jsx("div",{className:"text-[10px] text-bambu-gray",children:n(`virtualPrinter.mode.${Wj[E]}Desc`)})]},E))})]}),f==="print_queue"&&i.jsx("div",{className:"pt-2 border-t border-bambu-dark-tertiary",children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("div",{className:"text-white text-sm font-medium",children:n("virtualPrinter.autoDispatch.title")}),i.jsx("div",{className:"text-[10px] text-bambu-gray",children:n("virtualPrinter.autoDispatch.description")})]}),i.jsx("button",{onClick:()=>{const E=!N;R(E),U("autoDispatch"),J.mutate({auto_dispatch:E})},disabled:$==="autoDispatch",className:`relative w-10 h-5 rounded-full transition-colors flex-shrink-0 ${N?"bg-bambu-green":"bg-bambu-dark-tertiary"} ${$==="autoDispatch"?"opacity-50":""}`,children:i.jsx("span",{className:`absolute top-0.5 left-0.5 w-4 h-4 bg-white rounded-full transition-transform ${N?"translate-x-5":""}`})})]})}),f!=="proxy"&&i.jsxs("div",{className:"pt-2 border-t border-bambu-dark-tertiary",children:[i.jsx("div",{className:"text-white text-sm font-medium mb-1",children:n("virtualPrinter.model.title")}),i.jsx("p",{className:"text-xs text-bambu-gray mb-2",children:n("virtualPrinter.model.description")}),i.jsxs("div",{className:"relative",children:[i.jsx("select",{value:C,onChange:E=>le(E.target.value),disabled:$==="model",className:"w-full bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-md px-3 py-1.5 text-white text-sm appearance-none cursor-pointer disabled:opacity-50 pr-10",children:Object.entries(e).map(([E,I])=>i.jsxs("option",{value:E,children:[I," (",E,")"]},E))}),i.jsx(In,{className:"absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray pointer-events-none"})]})]}),f==="proxy"&&i.jsx("div",{className:"pt-2 border-t border-bambu-dark-tertiary",children:i.jsxs("div",{className:"flex items-start gap-2 p-2 rounded bg-blue-500/10 border border-blue-500/30",children:[i.jsx(js,{className:"w-4 h-4 text-blue-400 flex-shrink-0 mt-0.5"}),i.jsx("p",{className:"text-xs text-bambu-gray",children:n("virtualPrinter.proxy.accessCodeHint")})]})}),f!=="proxy"&&i.jsxs("div",{className:"pt-2 border-t border-bambu-dark-tertiary",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[i.jsx("div",{className:"text-white text-sm font-medium",children:n("virtualPrinter.accessCode.title")}),t.access_code_set?i.jsxs("span",{className:"flex items-center gap-1 text-xs text-green-400",children:[i.jsx(Vr,{className:"w-3 h-3"}),n("virtualPrinter.accessCode.isSet")]}):i.jsxs("span",{className:"flex items-center gap-1 text-xs text-yellow-400",children:[i.jsx(En,{className:"w-3 h-3"}),n("virtualPrinter.accessCode.notSet")]})]}),i.jsxs("div",{className:"flex gap-2",children:[i.jsxs("div",{className:"relative flex-1",children:[i.jsx("input",{type:A?"text":"password",value:m,onChange:E=>p(E.target.value),placeholder:t.access_code_set?n("virtualPrinter.accessCode.placeholderChange"):n("virtualPrinter.accessCode.placeholder"),maxLength:8,className:"w-full bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-md px-3 py-1.5 text-white text-sm placeholder-bambu-gray pr-10 font-mono"}),i.jsx("button",{onClick:()=>D(!A),className:"absolute right-2 top-1/2 -translate-y-1/2 text-bambu-gray hover:text-white",children:A?i.jsx(j0,{className:"w-4 h-4"}):i.jsx(tc,{className:"w-4 h-4"})})]}),i.jsx(Fe,{onClick:X,disabled:!m||$==="accessCode",variant:"primary",children:$==="accessCode"?i.jsx(ct,{className:"w-4 h-4 animate-spin"}):n("common.save")})]}),m&&i.jsx("p",{className:"text-xs text-bambu-gray mt-1",children:i.jsx("span",{className:m.length===8?"text-green-400":"text-yellow-400",children:n("virtualPrinter.accessCode.charCount",{count:m.length})})})]}),i.jsxs("div",{className:"pt-2 border-t border-bambu-dark-tertiary",children:[i.jsx("div",{className:"text-white text-sm font-medium mb-2",children:n("virtualPrinter.targetPrinter.title")}),i.jsxs("div",{className:"relative",children:[i.jsxs("select",{value:x??"",onChange:E=>{const I=parseInt(E.target.value,10);isNaN(I)||pe(I)},disabled:$==="targetPrinter",className:"w-full bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-md px-3 py-1.5 text-white text-sm appearance-none cursor-pointer disabled:opacity-50 pr-10",children:[i.jsx("option",{value:"",children:n("virtualPrinter.targetPrinter.placeholder")}),te?.map(E=>i.jsxs("option",{value:E.id,children:[E.name," (",E.ip_address,")"]},E.id))]}),i.jsx(In,{className:"absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray pointer-events-none"})]})]}),i.jsxs("div",{className:"pt-2 border-t border-bambu-dark-tertiary",children:[i.jsx("div",{className:"text-white text-sm font-medium mb-1",children:n("virtualPrinter.bindIp.title")}),i.jsxs("div",{className:"relative",children:[i.jsxs("select",{value:v,onChange:E=>{_(E.target.value),U("bindIp"),J.mutate({bind_ip:E.target.value})},disabled:$==="bindIp",className:"w-full bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-md px-3 py-1.5 text-white text-sm appearance-none cursor-pointer disabled:opacity-50 pr-10",children:[i.jsx("option",{value:"",children:n("virtualPrinter.bindIp.placeholder")}),re?.map(E=>i.jsxs("option",{value:E.ip,children:[E.name," (",E.ip,")",E.is_alias?" [alias]":""," - ",E.subnet]},E.ip))]}),i.jsx(In,{className:"absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray pointer-events-none"})]}),i.jsx("p",{className:"text-xs text-bambu-gray mt-1",children:n("virtualPrinter.bindIp.hint")})]}),i.jsxs("div",{className:"pt-2 border-t border-bambu-dark-tertiary",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[i.jsx("div",{className:"text-white text-sm font-medium",children:n("virtualPrinter.remoteInterface.title")}),k?i.jsx("span",{className:"flex items-center gap-1 text-xs text-green-400",children:i.jsx(Vr,{className:"w-3 h-3"})}):i.jsx("span",{className:"flex items-center gap-1 text-xs text-bambu-gray",title:n("virtualPrinter.remoteInterface.optional"),children:i.jsx(js,{className:"w-3 h-3"})})]}),i.jsxs("div",{className:"relative",children:[i.jsxs("select",{value:k,onChange:E=>Ce(E.target.value),disabled:$==="remoteInterface",className:"w-full bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-md px-3 py-1.5 text-white text-sm appearance-none cursor-pointer disabled:opacity-50 pr-10",children:[i.jsx("option",{value:"",children:n("virtualPrinter.remoteInterface.placeholder")}),re?.map(E=>i.jsxs("option",{value:E.ip,children:[E.name," (",E.ip,") - ",E.subnet]},E.ip))]}),i.jsx(In,{className:"absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray pointer-events-none"})]})]})]})]}),G&&i.jsx(Nn,{title:n("virtualPrinter.deleteConfirm.title"),message:n("virtualPrinter.deleteConfirm.message",{name:t.name}),variant:"danger",confirmText:n("common.delete"),isLoading:ue.isPending,onConfirm:()=>ue.mutate(),onCancel:()=>L(!1)})]})}const TK={immediate:"archive",review:"review",print_queue:"queue",proxy:"proxy"};function fJe({onClose:t}){const{t:e}=Mt(),n=tn(),{showToast:r}=bn(),[a,s]=w.useState(""),[o,l]=w.useState("immediate"),[c,d]=w.useState(null),{data:u}=Je({queryKey:["printers"],queryFn:be.getPrinters}),m=ut({mutationFn:()=>K1.create({name:a.trim()||"Bambuddy",mode:o,target_printer_id:o==="proxy"?c??void 0:void 0}),onSuccess:()=>{n.invalidateQueries({queryKey:["virtual-printers"]}),r(e("virtualPrinter.toast.created")),t()},onError:p=>{r(p.message||e("virtualPrinter.toast.failedToCreate"),"error")}});return i.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",onClick:t,children:i.jsx(Tt,{className:"w-full max-w-md",onClick:p=>p.stopPropagation(),children:i.jsxs(Pt,{className:"p-6 space-y-4",children:[i.jsx("h3",{className:"text-lg font-semibold text-white",children:e("virtualPrinter.addDialog.title")}),i.jsxs("div",{children:[i.jsx("label",{className:"text-sm text-white font-medium block mb-1",children:e("virtualPrinter.addDialog.name")}),i.jsx("input",{type:"text",value:a,onChange:p=>s(p.target.value),placeholder:"Bambuddy",className:"w-full bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-md px-3 py-2 text-white text-sm placeholder-bambu-gray",autoFocus:!0})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-sm text-white font-medium block mb-1",children:e("virtualPrinter.mode.title")}),i.jsx("div",{className:"grid grid-cols-2 gap-2",children:["immediate","review","print_queue","proxy"].map(p=>i.jsxs("button",{onClick:()=>l(p),className:`p-2 rounded-lg border text-left transition-colors ${o===p?p==="proxy"?"border-blue-500 bg-blue-500/10":"border-bambu-green bg-bambu-green/10":"border-bambu-dark-tertiary hover:border-bambu-gray"}`,children:[i.jsxs("div",{className:"flex items-center gap-1.5 text-white text-xs font-medium",children:[p==="proxy"&&i.jsx(SD,{className:"w-3 h-3"}),e(`virtualPrinter.mode.${TK[p]}`)]}),i.jsx("div",{className:"text-[10px] text-bambu-gray",children:e(`virtualPrinter.mode.${TK[p]}Desc`)})]},p))})]}),o==="proxy"&&i.jsxs("div",{children:[i.jsx("label",{className:"text-sm text-white font-medium block mb-1",children:e("virtualPrinter.targetPrinter.title")}),i.jsxs("div",{className:"relative",children:[i.jsxs("select",{value:c??"",onChange:p=>{const f=parseInt(p.target.value,10);d(isNaN(f)?null:f)},className:"w-full bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-md px-3 py-2 text-white text-sm appearance-none cursor-pointer pr-10",children:[i.jsx("option",{value:"",children:e("virtualPrinter.targetPrinter.placeholder")}),u?.map(p=>i.jsxs("option",{value:p.id,children:[p.name," (",p.ip_address,")"]},p.id))]}),i.jsx(In,{className:"absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray pointer-events-none"})]})]}),i.jsx("p",{className:"text-xs text-bambu-gray",children:e("virtualPrinter.addDialog.hint")}),i.jsxs("div",{className:"flex gap-3 pt-2",children:[i.jsx(Fe,{variant:"secondary",onClick:t,className:"flex-1",disabled:m.isPending,children:e("common.cancel")}),i.jsx(Fe,{variant:"primary",onClick:()=>m.mutate(),className:"flex-1",disabled:m.isPending,children:m.isPending?i.jsx(ct,{className:"w-4 h-4 animate-spin"}):e("virtualPrinter.addDialog.create")})]})]})})})}function gJe(){const{t}=Mt(),[e,n]=w.useState(!1),{data:r,isLoading:a}=Je({queryKey:["virtual-printers"],queryFn:K1.list,refetchInterval:1e4});if(a)return i.jsx(Tt,{children:i.jsx(Pt,{className:"py-8 flex justify-center",children:i.jsx(ct,{className:"w-6 h-6 animate-spin text-bambu-green"})})});const s=r?.printers||[],o=r?.models||{};return i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-4 gap-4 items-stretch",children:[i.jsx(Tt,{className:"border-l-4 border-l-yellow-500",children:i.jsx(Pt,{className:"py-3 px-4",children:i.jsxs("div",{className:"flex items-start gap-2",children:[i.jsx(En,{className:"w-4 h-4 text-yellow-500 flex-shrink-0 mt-0.5"}),i.jsxs("div",{className:"text-xs",children:[i.jsx("p",{className:"text-white font-medium",children:t("virtualPrinter.setupRequired.title")}),i.jsx("p",{className:"text-bambu-gray mt-1",children:t("virtualPrinter.setupRequired.description")}),i.jsxs("a",{href:"https://wiki.bambuddy.cool/features/virtual-printer/",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 mt-2 px-3 py-1.5 bg-yellow-500/20 border border-yellow-500/50 rounded text-yellow-400 hover:bg-yellow-500/30 transition-colors text-xs",children:[i.jsx(ei,{className:"w-3 h-3"}),t("virtualPrinter.setupRequired.readGuide")]})]})]})})}),i.jsx(Tt,{className:"lg:col-span-3",children:i.jsx(Pt,{className:"py-3 px-4",children:i.jsxs("div",{className:"flex items-start gap-2",children:[i.jsx(js,{className:"w-4 h-4 text-blue-400 flex-shrink-0 mt-0.5"}),i.jsxs("div",{className:"text-xs text-bambu-gray",children:[i.jsx("p",{className:"text-white font-medium mb-1",children:t("virtualPrinter.howItWorks.title")}),i.jsxs("ul",{className:"space-y-1 list-disc list-inside",children:[i.jsx("li",{children:t("virtualPrinter.howItWorks.step1")}),i.jsx("li",{children:t("virtualPrinter.howItWorks.step2")}),i.jsx("li",{children:t("virtualPrinter.howItWorks.step3")})]})]})]})})})]}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(kr,{className:"w-5 h-5 text-bambu-green"}),i.jsx("h2",{className:"text-lg font-semibold text-white",children:t("virtualPrinter.list.title")}),i.jsxs("span",{className:"text-sm text-bambu-gray",children:["(",s.length,")"]})]}),i.jsxs(Fe,{variant:"primary",onClick:()=>n(!0),children:[i.jsx(sr,{className:"w-4 h-4 mr-1"}),t("virtualPrinter.list.add")]})]}),s.length===0?i.jsx(Tt,{children:i.jsxs(Pt,{className:"py-8 text-center",children:[i.jsx(kr,{className:"w-12 h-12 text-bambu-gray mx-auto mb-3"}),i.jsx("p",{className:"text-bambu-gray mb-4",children:t("virtualPrinter.list.empty")}),i.jsxs(Fe,{variant:"primary",onClick:()=>n(!0),children:[i.jsx(sr,{className:"w-4 h-4 mr-1"}),t("virtualPrinter.list.addFirst")]})]})}):i.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4 items-start",children:s.map(l=>i.jsx(pJe,{printer:l,models:o},l.id))}),e&&i.jsx(fJe,{onClose:()=>n(!1)})]})}function bJe(t){if(!t)return"-";const e=Jn(t);return e?e.toLocaleString():"-"}function PK({status:t}){if(!t)return null;const e={success:"bg-green-500/20 text-green-400",failed:"bg-red-500/20 text-red-400",skipped:"bg-yellow-500/20 text-yellow-400",running:"bg-blue-500/20 text-blue-400"},n={success:i.jsx(fr,{className:"w-3 h-3"}),failed:i.jsx(qi,{className:"w-3 h-3"}),skipped:i.jsx(YF,{className:"w-3 h-3"}),running:i.jsx(ct,{className:"w-3 h-3 animate-spin"})};return i.jsxs("span",{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded text-xs font-medium ${e[t]||"bg-gray-500/20 text-gray-400"}`,children:[n[t],t.charAt(0).toUpperCase()+t.slice(1)]})}function xJe(){const t=tn(),{showToast:e}=bn(),{t:n}=Mt(),[r,a]=w.useState(""),[s,o]=w.useState(""),[l,c]=w.useState("main"),[d,u]=w.useState(!1),[m,p]=w.useState("daily"),[f,y]=w.useState(!0),[x,b]=w.useState(!0),[v,_]=w.useState(!1),[k,P]=w.useState(!0),[C,T]=w.useState(!1),[N,R]=w.useState(!1),[A,D]=w.useState(""),[$,U]=w.useState(!1),[G,L]=w.useState(null),[te,re]=w.useState(null),J=w.useRef(null);w.useEffect(()=>{if(C||N){const O=F=>(F.preventDefault(),F.returnValue="A backup operation is in progress. Are you sure you want to leave?",F.returnValue);return window.addEventListener("beforeunload",O),()=>window.removeEventListener("beforeunload",O)}},[C,N]);const[ue,me]=w.useState(!1),[ge,X]=w.useState(null),ie=w.useRef(null),le=w.useRef(!1),{data:pe,isLoading:Ce}=Je({queryKey:["github-backup-config"],queryFn:be.getGitHubBackupConfig}),{data:q}=Je({queryKey:["github-backup-status"],queryFn:be.getGitHubBackupStatus,refetchInterval:oe=>oe.state.data?.is_running?500:1e4}),{data:Z}=Je({queryKey:["github-backup-logs"],queryFn:()=>be.getGitHubBackupLogs(20)}),{data:j}=Je({queryKey:["cloud-status"],queryFn:be.getCloudStatus}),{data:E}=Je({queryKey:["printers"],queryFn:be.getPrinters}),I=gf({queries:(E??[]).map(oe=>({queryKey:["printerStatus",oe.id],queryFn:()=>be.getPrinterStatus(oe.id),staleTime:1e4,refetchInterval:3e4}))}),W=(E??[]).map((oe,O)=>({printer:oe,connected:I[O]?.data?.connected??!1})),B=W.length,ae=W.filter(oe=>oe.connected).length,z=B>0&&ae===0,V=ae>0&&ae<B;w.useEffect(()=>{pe&&(a(pe.repository_url),c(pe.branch),u(pe.schedule_enabled),p(pe.schedule_type),y(pe.backup_kprofiles),b(pe.backup_cloud_profiles),_(pe.backup_settings),P(pe.enabled),o(""),setTimeout(()=>{le.current=!0},100))},[pe]);const ee=w.useCallback(async(oe=!1)=>{if(pe?.has_token)try{oe&&s?(await be.saveGitHubBackupConfig({repository_url:r,access_token:s,branch:l,schedule_enabled:d,schedule_type:m,backup_kprofiles:f,backup_cloud_profiles:x,backup_settings:v,enabled:k}),o(""),e(n("backup.tokenUpdated"))):(await be.updateGitHubBackupConfig({repository_url:r,branch:l,schedule_enabled:d,schedule_type:m,backup_kprofiles:f,backup_cloud_profiles:x,backup_settings:v,enabled:k}),e(n("backup.settingsSaved"))),t.invalidateQueries({queryKey:["github-backup-config"]}),t.invalidateQueries({queryKey:["github-backup-status"]})}catch(O){e(n("backup.failedToSave",{message:O.message}),"error")}},[pe?.has_token,r,s,l,d,m,f,x,v,k,t,e,n]);w.useEffect(()=>{if(!(!le.current||!pe?.has_token))return ie.current&&clearTimeout(ie.current),ie.current=setTimeout(()=>{ee(!1)},500),()=>{ie.current&&clearTimeout(ie.current)}},[r,l,d,m,f,x,v,k,ee,pe?.has_token]),w.useEffect(()=>{if(!(!le.current||!pe?.has_token||!s))return ie.current&&clearTimeout(ie.current),ie.current=setTimeout(()=>{ee(!0)},1e3),()=>{ie.current&&clearTimeout(ie.current)}},[s,ee,pe?.has_token]);const K=ut({mutationFn:oe=>be.saveGitHubBackupConfig(oe),onSuccess:()=>{t.invalidateQueries({queryKey:["github-backup-config"]}),t.invalidateQueries({queryKey:["github-backup-status"]}),e(n("backup.githubBackupEnabled")),o(""),le.current=!0},onError:oe=>{e(n("backup.failedToSave",{message:oe.message}),"error")}}),ne=ut({mutationFn:be.triggerGitHubBackup,onSuccess:oe=>{t.invalidateQueries({queryKey:["github-backup-status"]}),t.invalidateQueries({queryKey:["github-backup-logs"]}),oe.success?oe.files_changed>0?e(n("backup.backupCompleteFiles",{count:oe.files_changed})):e(n("backup.backupSkippedNoChanges")):e(n("backup.backupFailed2",{message:oe.message}),"error")},onError:oe=>{e(n("backup.backupFailed2",{message:oe.message}),"error")}}),se=ut({mutationFn:()=>be.clearGitHubBackupLogs(0),onSuccess:oe=>{t.invalidateQueries({queryKey:["github-backup-logs"]}),e(n("backup.clearedLogs",{count:oe.deleted}))},onError:oe=>{e(n("backup.failedToClearLogs",{message:oe.message}),"error")}}),ce=async()=>{me(!0),X(null);try{let oe;if(s){if(!r){e(n("backup.enterRepoUrl"),"error"),me(!1);return}oe=await be.testGitHubConnection(r,s)}else if(pe?.has_token)oe=await be.testGitHubStoredConnection();else{e(n("backup.enterRepoAndToken"),"error"),me(!1);return}X({success:oe.success,message:oe.message})}catch(oe){X({success:!1,message:oe.message})}finally{me(!1)}},fe=()=>{if(!r){e(n("backup.repoRequired"),"error");return}if(!s){e(n("backup.tokenRequired"),"error");return}K.mutate({repository_url:r,access_token:s,branch:l,schedule_enabled:d,schedule_type:m,backup_kprofiles:f,backup_cloud_profiles:x,backup_settings:v,enabled:k})};return Ce?i.jsx("div",{className:"flex items-center justify-center py-12",children:i.jsx(ct,{className:"w-8 h-8 animate-spin text-bambu-green"})}):i.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[i.jsxs("div",{className:"space-y-6",children:[i.jsxs(Tt,{children:[i.jsx(Wn,{children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(kD,{className:"w-5 h-5 text-gray-400"}),i.jsx("h2",{className:"text-lg font-semibold text-white",children:n("backup.githubBackup")})]}),pe&&i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"text-sm text-bambu-gray",children:n("backup.enabled")}),i.jsx(Gn,{checked:k,onChange:P})]})]})}),i.jsxs(Pt,{className:"space-y-4",children:[i.jsx("p",{className:"text-sm text-bambu-gray",children:n("backup.githubDescription")}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:n("backup.repositoryUrl")}),i.jsx("input",{type:"text",value:r,onChange:oe=>{a(oe.target.value),X(null)},placeholder:"https://github.com/username/bambuddy-backup",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"})]}),i.jsxs("div",{children:[i.jsxs("label",{className:"block text-sm text-bambu-gray mb-1",children:[n("backup.personalAccessToken")," ",pe?.has_token&&i.jsx("span",{className:"text-green-400",children:n("backup.tokenSaved")})]}),i.jsx("input",{type:"password",value:s,onChange:oe=>{o(oe.target.value),X(null)},placeholder:pe?.has_token?n("backup.enterNewToken"):"ghp_xxxxxxxxxxxx",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"}),i.jsx("p",{className:"text-xs text-bambu-gray mt-1",children:n("backup.tokenHint")})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:n("backup.branch")}),i.jsx("input",{type:"text",value:l,onChange:oe=>c(oe.target.value),placeholder:"main",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"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:n("backup.autoBackup")}),i.jsxs("select",{value:d?m:"disabled",onChange:oe=>{oe.target.value==="disabled"?u(!1):(u(!0),p(oe.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:[i.jsx("option",{value:"disabled",children:n("backup.manualOnly")}),i.jsx("option",{value:"hourly",children:n("backup.hourly")}),i.jsx("option",{value:"daily",children:n("backup.daily")}),i.jsx("option",{value:"weekly",children:n("backup.weekly")})]})]})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm text-bambu-gray mb-2",children:n("backup.includeInBackup")}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs("label",{className:`flex items-start gap-2 ${z?"cursor-not-allowed opacity-60":"cursor-pointer"}`,children:[i.jsx("input",{type:"checkbox",checked:f,onChange:oe=>y(oe.target.checked),className:"w-4 h-4 mt-0.5 rounded border-bambu-dark-tertiary bg-bambu-dark text-bambu-green focus:ring-bambu-green",disabled:z}),i.jsxs("div",{className:"flex-1",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:`text-sm ${z?"text-bambu-gray":"text-white"}`,children:n("backup.kProfiles")}),z&&i.jsxs("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs bg-yellow-500/20 text-yellow-400",children:[i.jsx(En,{className:"w-3 h-3"}),n("backup.noPrintersConnected")]}),V&&i.jsxs("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs bg-yellow-500/20 text-yellow-400",children:[i.jsx(En,{className:"w-3 h-3"}),n("backup.printersConnected",{connected:ae,total:B})]})]}),i.jsx("p",{className:"text-xs text-bambu-gray",children:n("backup.kProfilesDescription")})]})]}),i.jsxs("label",{className:`flex items-start gap-2 ${j?.is_authenticated?"cursor-pointer":"cursor-not-allowed opacity-60"}`,children:[i.jsx("input",{type:"checkbox",checked:x,onChange:oe=>b(oe.target.checked),className:"w-4 h-4 mt-0.5 rounded border-bambu-dark-tertiary bg-bambu-dark text-bambu-green focus:ring-bambu-green",disabled:!j?.is_authenticated}),i.jsxs("div",{children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:`text-sm ${j?.is_authenticated?"text-white":"text-bambu-gray"}`,children:n("backup.cloudProfiles")}),!j?.is_authenticated&&i.jsxs("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs bg-yellow-500/20 text-yellow-400",children:[i.jsx(En,{className:"w-3 h-3"}),n("backup.cloudLoginRequiredShort")]})]}),i.jsx("p",{className:"text-xs text-bambu-gray",children:n("backup.cloudProfilesDescription")})]})]}),i.jsxs("label",{className:"flex items-start gap-2 cursor-pointer",children:[i.jsx("input",{type:"checkbox",checked:v,onChange:oe=>_(oe.target.checked),className:"w-4 h-4 mt-0.5 rounded border-bambu-dark-tertiary bg-bambu-dark text-bambu-green focus:ring-bambu-green"}),i.jsxs("div",{children:[i.jsx("span",{className:"text-white text-sm",children:n("backup.appSettings")}),i.jsx("p",{className:"text-xs text-bambu-gray",children:n("backup.appSettingsDescription")})]})]})]})]}),i.jsxs("div",{className:"border-t border-bambu-dark-tertiary pt-4 space-y-3",children:[q?.configured&&i.jsxs("div",{className:"flex items-center justify-between text-sm",children:[i.jsx("div",{className:"flex items-center gap-2 text-bambu-gray",children:q.last_backup_at?i.jsxs(i.Fragment,{children:[i.jsxs("span",{children:[n("backup.lastBackupAt")," ",zv(q.last_backup_at,"system",n)]}),i.jsx(PK,{status:q.last_backup_status})]}):i.jsx("span",{children:n("backup.noBackupsYet")})}),q.next_scheduled_run&&i.jsxs("span",{className:"text-bambu-gray",children:[i.jsx(er,{className:"w-3 h-3 inline mr-1"}),n("backup.next")," ",zv(q.next_scheduled_run,"system",n)]})]}),ge&&i.jsxs("div",{className:`text-sm flex items-center gap-1 ${ge.success?"text-green-400":"text-red-400"}`,children:[ge.success?i.jsx(fr,{className:"w-4 h-4"}):i.jsx(qi,{className:"w-4 h-4"}),ge.message]}),i.jsx("div",{className:"flex flex-wrap items-center gap-2",children:q?.configured?i.jsx(i.Fragment,{children:ne.isPending||q.is_running?i.jsxs("div",{className:"flex items-center gap-2 text-bambu-green",children:[i.jsx(ct,{className:"w-4 h-4 animate-spin"}),i.jsx("span",{className:"text-sm",children:q.progress||n("backup.startingBackup")})]}):i.jsxs(i.Fragment,{children:[i.jsxs(Fe,{variant:"primary",size:"sm",onClick:()=>ne.mutate(),disabled:!pe?.enabled,children:[i.jsx(co,{className:"w-4 h-4"}),n("backup.backupNow")]}),i.jsxs(Fe,{variant:"secondary",size:"sm",onClick:ce,disabled:ue,children:[ue?i.jsx(ct,{className:"w-4 h-4 animate-spin"}):i.jsx(_r,{className:"w-4 h-4"}),n("backup.test")]})]})}):i.jsxs(i.Fragment,{children:[i.jsxs(Fe,{variant:"primary",size:"sm",onClick:fe,disabled:K.isPending||!r||!s,children:[K.isPending?i.jsx(ct,{className:"w-4 h-4 animate-spin"}):i.jsx(fr,{className:"w-4 h-4"}),n("backup.enableBackup")]}),i.jsxs(Fe,{variant:"secondary",size:"sm",onClick:ce,disabled:ue||!r||!s,children:[ue?i.jsx(ct,{className:"w-4 h-4 animate-spin"}):i.jsx(_r,{className:"w-4 h-4"}),n("backup.testConnection")]})]})})]})]})]}),Z&&Z.length>0&&i.jsxs(Tt,{children:[i.jsx(Wn,{children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(Fv,{className:"w-5 h-5 text-gray-400"}),i.jsx("h2",{className:"text-lg font-semibold text-white",children:n("backup.history")})]}),i.jsxs(Fe,{variant:"ghost",size:"sm",onClick:()=>se.mutate(),disabled:se.isPending,children:[i.jsx(Qt,{className:"w-4 h-4"}),n("backup.clear")]})]})}),i.jsx(Pt,{children:i.jsx("div",{className:"overflow-x-auto",children:i.jsxs("table",{className:"w-full text-sm",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"text-bambu-gray border-b border-bambu-dark-tertiary",children:[i.jsx("th",{className:"text-left py-2 px-2",children:n("backup.date")}),i.jsx("th",{className:"text-left py-2 px-2",children:n("backup.status")}),i.jsx("th",{className:"text-left py-2 px-2",children:n("backup.commit")})]})}),i.jsx("tbody",{children:Z.slice(0,10).map(oe=>i.jsxs("tr",{className:"border-b border-bambu-dark-tertiary/50 hover:bg-bambu-dark-secondary",children:[i.jsx("td",{className:"py-2 px-2 text-white",children:bJe(oe.started_at)}),i.jsx("td",{className:"py-2 px-2",children:i.jsx(PK,{status:oe.status})}),i.jsx("td",{className:"py-2 px-2",children:oe.commit_sha?i.jsxs("a",{href:`${pe?.repository_url}/commit/${oe.commit_sha}`,target:"_blank",rel:"noopener noreferrer",className:"text-bambu-green hover:underline inline-flex items-center gap-1",children:[oe.commit_sha.substring(0,7),i.jsx(ei,{className:"w-3 h-3"})]}):i.jsx("span",{className:"text-bambu-gray",children:"-"})})]},oe.id))})]})})})]})]}),i.jsx("div",{className:"space-y-6",children:i.jsxs(Tt,{children:[i.jsx(Wn,{children:i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(Ic,{className:"w-5 h-5 text-gray-400"}),i.jsx("h2",{className:"text-lg font-semibold text-white",children:n("backup.localBackup")})]})}),i.jsxs(Pt,{className:"space-y-4",children:[i.jsx("p",{className:"text-sm text-bambu-gray",children:n("backup.localBackupDescription")}),i.jsxs("div",{className:"flex items-center justify-between py-3 border-b border-bambu-dark-tertiary",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-white",children:n("backup.downloadBackupLabel")}),i.jsx("p",{className:"text-sm text-bambu-gray",children:n("backup.completeBackupZip")})]}),i.jsxs(Fe,{variant:"secondary",size:"sm",disabled:C||N,onClick:async()=>{T(!0),D(n("backup.preparingBackup"));try{D(n("backup.creatingArchive"));const{blob:oe,filename:O}=await be.exportBackup();D(n("backup.downloadingFile"));const F=URL.createObjectURL(oe),Q=document.createElement("a");Q.href=F,Q.download=O,Q.click(),URL.revokeObjectURL(F),e(n("backup.backupDownloaded"))}catch(oe){e(n("backup.failedToCreateBackup",{message:oe instanceof Error?oe.message:"Unknown error"}),"error")}finally{T(!1),D("")}},children:[i.jsx(pi,{className:"w-4 h-4"}),n("backup.download")]})]}),i.jsxs("div",{className:"flex items-center justify-between py-3 border-b border-bambu-dark-tertiary",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-white",children:n("backup.restoreBackup")}),i.jsx("p",{className:"text-sm text-bambu-gray",children:n("backup.restoreDescription")}),i.jsx("p",{className:"text-xs text-bambu-gray-light mt-1",children:n("backup.restoreNote")})]}),i.jsx("input",{ref:J,type:"file",accept:".zip",className:"hidden",onChange:oe=>{const O=oe.target.files?.[0];O&&(L(O),U(!0)),oe.target.value=""}}),i.jsxs(Fe,{variant:"secondary",size:"sm",disabled:N||C,onClick:()=>J.current?.click(),children:[i.jsx(Si,{className:"w-4 h-4"}),n("backup.restore")]})]}),te&&i.jsx("div",{className:`p-3 rounded-lg ${te.success?"bg-green-500/10 border border-green-500/30":"bg-red-500/10 border border-red-500/30"}`,children:i.jsxs("div",{className:"flex items-start gap-2 text-sm",children:[te.success?i.jsx(fr,{className:"w-4 h-4 text-green-400 mt-0.5 flex-shrink-0"}):i.jsx(qi,{className:"w-4 h-4 text-red-400 mt-0.5 flex-shrink-0"}),i.jsxs("div",{className:te.success?"text-green-200":"text-red-200",children:[te.message,te.success&&i.jsx("div",{className:"mt-2",children:i.jsxs(Fe,{size:"sm",onClick:()=>window.location.reload(),children:[i.jsx(uo,{className:"w-3 h-3"}),n("backup.reloadNow")]})})]})]})}),i.jsx("div",{className:"p-3 rounded-lg bg-yellow-500/10 border border-yellow-500/30",children:i.jsxs("div",{className:"flex items-start gap-2 text-sm",children:[i.jsx(En,{className:"w-4 h-4 text-yellow-400 mt-0.5 flex-shrink-0"}),i.jsxs("div",{className:"text-yellow-200",children:[i.jsx("span",{className:"font-medium",children:n("backup.restoreReplacesAll")})," ",i.jsx("span",{className:"text-yellow-200/70",children:n("backup.restoreReplacesAllDetail")})]})]})})]})]})}),$&&G&&i.jsx(Nn,{title:n("backup.restoreConfirmTitle"),message:n("backup.restoreConfirmMessage",{filename:G.name}),confirmText:n("backup.restoreConfirmButton"),variant:"danger",onConfirm:async()=>{U(!1),R(!0),re(null);try{D(n("backup.uploadingFile"));const oe=await be.importBackup(G);re(oe),oe.success?e(n("backup.backupRestoredRestart"),"success"):e(oe.message,"error")}catch(oe){const O=oe instanceof Error?oe.message:n("backup.failedToRestore");re({success:!1,message:O}),e(O,"error")}finally{R(!1),D(""),L(null)}},onCancel:()=>{U(!1),L(null)}}),(C||N)&&i.jsx("div",{className:"fixed inset-0 bg-black/80 flex items-center justify-center z-[100]",children:i.jsxs("div",{className:"bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-xl p-8 max-w-md w-full mx-4 text-center",children:[i.jsx("div",{className:"flex justify-center mb-4",children:i.jsxs("div",{className:"relative",children:[i.jsx("div",{className:"w-16 h-16 border-4 border-bambu-dark-tertiary rounded-full"}),i.jsx("div",{className:"w-16 h-16 border-4 border-bambu-green border-t-transparent rounded-full absolute inset-0 animate-spin"})]})}),i.jsx("h3",{className:"text-xl font-semibold text-white mb-2",children:n(C?"backup.creatingBackup":"backup.restoringBackup")}),i.jsx("p",{className:"text-bambu-gray mb-4",children:A||n(C?"backup.preparing":"backup.processing")}),i.jsx("div",{className:"p-3 rounded-lg bg-yellow-500/10 border border-yellow-500/30",children:i.jsxs("div",{className:"flex items-start gap-2 text-sm",children:[i.jsx(En,{className:"w-4 h-4 text-yellow-400 mt-0.5 flex-shrink-0"}),i.jsx("p",{className:"text-yellow-200 text-left",children:n("backup.doNotClosePage")})]})})]})})]})}const yJe={starttls:587,ssl:465,none:25},vJe={587:"starttls",465:"ssl",25:"none"};function wJe(){const{t}=Mt(),{showToast:e}=bn(),n=tn(),[r,a]=w.useState({smtp_host:"",smtp_port:587,smtp_username:"",smtp_password:"",smtp_security:"starttls",smtp_auth_enabled:!0,smtp_from_email:"",smtp_from_name:"BamBuddy"}),[s,o]=w.useState(""),{data:l,isLoading:c}=Je({queryKey:["smtpSettings"],queryFn:()=>be.getSMTPSettings()}),{data:d}=Je({queryKey:["advancedAuthStatus"],queryFn:()=>be.getAdvancedAuthStatus()});w.useEffect(()=>{l&&a({...l,smtp_password:""})},[l]);const u=T=>{a({...r,smtp_security:T,smtp_port:yJe[T]})},m=T=>{const N=vJe[T];a({...r,smtp_port:T,...N?{smtp_security:N}:{}})},p=T=>{a({...r,smtp_auth_enabled:T,...T?{}:{smtp_username:"",smtp_password:""}})},f=ut({mutationFn:T=>be.saveSMTPSettings(T),onSuccess:()=>{n.invalidateQueries({queryKey:["smtpSettings"]}),n.invalidateQueries({queryKey:["advancedAuthStatus"]}),e(t("settings.email.success.settingsSaved"),"success")},onError:T=>{e(T.message,"error")}}),y=ut({mutationFn:T=>be.testSMTP(T),onSuccess:T=>{e(T.message,T.success?"success":"error")},onError:T=>{e(T.message,"error")}}),x=ut({mutationFn:T=>T?be.enableAdvancedAuth():be.disableAdvancedAuth(),onSuccess:T=>{n.invalidateQueries({queryKey:["advancedAuthStatus"]}),e(T.message,"success")},onError:T=>{e(T.message,"error")}}),b=()=>{if(!r.smtp_host||!r.smtp_from_email){e(t("settings.email.errors.requiredFields"),"error");return}if(r.smtp_auth_enabled&&!r.smtp_username){e(t("settings.email.errors.usernameRequired"),"error");return}f.mutate(r)},v=()=>{if(!s){e(t("settings.email.errors.enterTestEmail"),"error");return}if(!r.smtp_host||!r.smtp_from_email){e(t("settings.email.errors.smtpServerAndEmail"),"error");return}if(r.smtp_auth_enabled&&(!r.smtp_username||!r.smtp_password)){e(t("settings.email.errors.usernamePasswordRequired"),"error");return}y.mutate({smtp_host:r.smtp_host,smtp_port:r.smtp_port,smtp_username:r.smtp_username,smtp_password:r.smtp_password,smtp_security:r.smtp_security,smtp_auth_enabled:r.smtp_auth_enabled,smtp_from_email:r.smtp_from_email,test_recipient:s})},_=()=>{if(!d?.advanced_auth_enabled&&!d?.smtp_configured){e(t("settings.email.errors.configureSmtpFirst"),"error");return}x.mutate(!d?.advanced_auth_enabled)};if(c)return i.jsx("div",{className:"flex items-center justify-center p-12",children:i.jsx(ct,{className:"w-8 h-8 animate-spin text-bambu-green"})});const k=d?.advanced_auth_enabled??!1,P="w-full px-4 py-3 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:border-bambu-green transition-colors",C="w-full px-4 py-3 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white/40 placeholder-bambu-gray/40 cursor-not-allowed";return i.jsxs("div",{className:"space-y-6",children:[i.jsxs(Tt,{children:[i.jsx(Wn,{children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(Lv,{className:"w-5 h-5 text-bambu-green"}),i.jsx("h2",{className:"text-lg font-semibold text-white",children:t("settings.email.advancedAuth")||"Advanced Authentication"})]}),i.jsx(Fe,{onClick:_,disabled:x.isPending,variant:k?"danger":"primary",children:k?i.jsxs(i.Fragment,{children:[i.jsx(c1,{className:"w-4 h-4"}),t("settings.email.disable")||"Disable"]}):i.jsxs(i.Fragment,{children:[i.jsx(Jh,{className:"w-4 h-4"}),t("settings.email.enable")||"Enable"]})})]})}),i.jsx(Pt,{children:i.jsx("div",{className:"space-y-4",children:k?i.jsx("div",{className:"bg-green-500/10 border border-green-500/30 rounded-lg p-4",children:i.jsxs("div",{className:"flex items-start gap-3",children:[i.jsx(fr,{className:"w-5 h-5 text-green-400 mt-0.5 flex-shrink-0"}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("p",{className:"text-white font-medium",children:t("settings.email.advancedAuthEnabled")||"Advanced Authentication is enabled"}),i.jsxs("ul",{className:"text-sm text-green-300 space-y-1 list-disc list-inside",children:[i.jsx("li",{children:t("settings.email.feature1")||"Passwords are auto-generated and emailed to new users"}),i.jsx("li",{children:t("settings.email.feature2")||"Users can login with username or email"}),i.jsx("li",{children:t("settings.email.feature3")||"Forgot password feature is available"}),i.jsx("li",{children:t("settings.email.feature4")||"Admins can reset user passwords via email"})]})]})]})}):i.jsx("div",{className:"bg-yellow-500/10 border border-yellow-500/30 rounded-lg p-4",children:i.jsxs("div",{className:"flex items-start gap-3",children:[i.jsx(En,{className:"w-5 h-5 text-yellow-400 mt-0.5 flex-shrink-0"}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("p",{className:"text-white font-medium",children:t("settings.email.advancedAuthDisabled")||"Advanced Authentication is disabled"}),i.jsx("p",{className:"text-sm text-yellow-300",children:t("settings.email.advancedAuthDisabledDesc")||"Enable advanced authentication to activate email-based features for user management."})]})]})})})})]}),i.jsx("div",{className:k?"":"opacity-50 pointer-events-none",children:i.jsxs(Tt,{children:[i.jsx(Wn,{children:i.jsx("h2",{className:"text-lg font-semibold text-white",children:t("settings.email.smtpSettings")||"SMTP Configuration"})}),i.jsx(Pt,{children:i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-white mb-2",children:t("settings.email.authentication")||"Authentication"}),i.jsxs("select",{value:r.smtp_auth_enabled?"true":"false",onChange:T=>p(T.target.value==="true"),className:P,children:[i.jsx("option",{value:"true",children:t("settings.email.authOptions.enabled")}),i.jsx("option",{value:"false",children:t("settings.email.authOptions.disabled")})]})]}),i.jsxs("div",{className:`grid grid-cols-1 md:grid-cols-2 gap-4 transition-opacity ${r.smtp_auth_enabled?"":"opacity-40 pointer-events-none"}`,children:[i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-white mb-2",children:t("settings.email.username")||"Username"}),i.jsx("input",{type:"text",value:r.smtp_username||"",onChange:T=>a({...r,smtp_username:T.target.value}),placeholder:"your.email@gmail.com",disabled:!r.smtp_auth_enabled,className:r.smtp_auth_enabled?P:C})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-white mb-2",children:t("settings.email.password")||"Password"}),i.jsx("input",{type:"password",value:r.smtp_password||"",onChange:T=>a({...r,smtp_password:T.target.value}),placeholder:l?"••••••••":"App password",disabled:!r.smtp_auth_enabled,className:r.smtp_auth_enabled?P:C})]})]}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[i.jsxs("div",{children:[i.jsxs("label",{className:"block text-sm font-medium text-white mb-2",children:[t("settings.email.smtpHost")||"SMTP Server"," *"]}),i.jsx("input",{type:"text",value:r.smtp_host,onChange:T=>a({...r,smtp_host:T.target.value}),placeholder:"smtp.gmail.com",className:P})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-white mb-2",children:t("settings.email.smtpPort")||"SMTP Port"}),i.jsx("input",{type:"number",value:r.smtp_port,onChange:T=>m(parseInt(T.target.value)||587),placeholder:"587",className:P})]})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-white mb-2",children:t("settings.email.security")||"Security"}),i.jsxs("select",{value:r.smtp_security,onChange:T=>u(T.target.value),className:P,children:[i.jsx("option",{value:"starttls",children:t("settings.email.securityOptions.starttls")}),i.jsx("option",{value:"ssl",children:t("settings.email.securityOptions.ssl")}),i.jsx("option",{value:"none",children:t("settings.email.securityOptions.none")})]})]}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[i.jsxs("div",{children:[i.jsxs("label",{className:"block text-sm font-medium text-white mb-2",children:[t("settings.email.fromEmail")||"From Email"," *"]}),i.jsx("input",{type:"email",value:r.smtp_from_email,onChange:T=>a({...r,smtp_from_email:T.target.value}),placeholder:"your@email.com",className:P})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-white mb-2",children:t("settings.email.fromName")||"From Name"}),i.jsx("input",{type:"text",value:r.smtp_from_name,onChange:T=>a({...r,smtp_from_name:T.target.value}),placeholder:"BamBuddy",className:P})]})]}),i.jsx("div",{className:"flex gap-2",children:i.jsx(Fe,{onClick:b,disabled:f.isPending,className:"flex-1",children:f.isPending?i.jsxs(i.Fragment,{children:[i.jsx(ct,{className:"w-4 h-4 animate-spin"}),t("settings.email.saving")||"Saving..."]}):t("settings.email.save")||"Save Settings"})})]})})]})}),i.jsx("div",{className:k?"":"opacity-50 pointer-events-none",children:i.jsxs(Tt,{children:[i.jsx(Wn,{children:i.jsx("h2",{className:"text-lg font-semibold text-white",children:t("settings.email.testConnection")||"Test SMTP Connection"})}),i.jsx(Pt,{children:i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-white mb-2",children:t("settings.email.testRecipient")||"Test Recipient Email"}),i.jsx("input",{type:"email",value:s,onChange:T=>o(T.target.value),placeholder:"test@example.com",className:P})]}),i.jsx(Fe,{onClick:v,disabled:y.isPending,variant:"secondary",children:y.isPending?i.jsxs(i.Fragment,{children:[i.jsx(ct,{className:"w-4 h-4 animate-spin"}),t("settings.email.sending")||"Sending..."]}):i.jsxs(i.Fragment,{children:[i.jsx(gC,{className:"w-4 h-4"}),t("settings.email.sendTest")||"Send Test Email"]})})]})})]})})]})}const SJe={get:"bg-blue-500/20 text-blue-400 border-blue-500/30",post:"bg-green-500/20 text-green-400 border-green-500/30",put:"bg-yellow-500/20 text-yellow-400 border-yellow-500/30",patch:"bg-orange-500/20 text-orange-400 border-orange-500/30",delete:"bg-red-500/20 text-red-400 border-red-500/30"};function _Je(t,e){const n=e.replace("#/","").split("/");let r=t;for(const a of n)r=r[a];return r}function rv(t,e,n=0){if(n>5)return"...";if(e.$ref)return rv(t,_Je(t,e.$ref),n+1);if(e.allOf){const r={};for(const a of e.allOf){const s=rv(t,a,n+1);typeof s=="object"&&s!==null&&Object.assign(r,s)}return r}if(e.example!==void 0)return e.example;if(e.default!==void 0)return e.default;switch(e.type){case"string":return e.enum?e.enum[0]:"string";case"integer":case"number":return 0;case"boolean":return!1;case"array":return e.items?[rv(t,e.items,n+1)]:[];case"object":if(e.properties){const r={};for(const[a,s]of Object.entries(e.properties))r[a]=rv(t,s,n+1);return r}return{};default:return null}}function kJe({path:t,method:e,spec:n,schema:r,apiKey:a}){const[s,o]=w.useState(!1),[l,c]=w.useState({}),[d,u]=w.useState(""),[m,p]=w.useState(null),[f,y]=w.useState(!1),[x,b]=w.useState(!1);w.useEffect(()=>{if(s&&n.parameters){const R={};for(const A of n.parameters)A.schema?.default!==void 0&&(R[A.name]=String(A.schema.default));c(A=>({...R,...A}))}},[s,n.parameters]),w.useEffect(()=>{if(s&&n.requestBody?.content?.["application/json"]?.schema&&!d){const R=n.requestBody.content["application/json"].schema,A=rv(r,R);u(JSON.stringify(A,null,2))}},[s,n.requestBody,r,d]);const _=(()=>{const R=[];for(const A of n.parameters||[])if(A.in==="path"||A.required){const D=l[A.name];(D===void 0||D==="")&&R.push(A.name)}return R})(),k=async()=>{if(_.length>0){p({status:0,statusText:"Validation Error",headers:{},body:`Missing required parameters: ${_.join(", ")}`,duration:0});return}y(!0),p(null);try{let R=t;const A=new URLSearchParams;for(const ge of n.parameters||[]){const X=l[ge.name];X!==void 0&&X!==""&&(ge.in==="path"?R=R.replace(`{${ge.name}}`,encodeURIComponent(X)):ge.in==="query"&&A.append(ge.name,X))}const D=A.toString(),$=`${R}${D?`?${D}`:""}`,U={"Content-Type":"application/json"};a&&(U["X-API-Key"]=a);const G={method:e.toUpperCase(),headers:U};["post","put","patch"].includes(e)&&d&&(G.body=d);const L=performance.now(),te=await fetch($,G),re=Math.round(performance.now()-L),J={};te.headers.forEach((ge,X)=>{J[X]=ge});let ue;te.headers.get("content-type")?.includes("application/json")?ue=await te.json():ue=await te.text(),p({status:te.status,statusText:te.statusText,headers:J,body:ue,duration:re})}catch(R){p({status:0,statusText:"Network Error",headers:{},body:R instanceof Error?R.message:"Unknown error",duration:0})}finally{y(!1)}},P=async()=>{if(m){const R=typeof m.body=="string"?m.body:JSON.stringify(m.body,null,2);try{await navigator.clipboard.writeText(R),b(!0),setTimeout(()=>b(!1),2e3)}catch{const A=document.createElement("textarea");A.value=R,A.style.position="fixed",A.style.left="-999999px",document.body.appendChild(A),A.select(),document.execCommand("copy"),document.body.removeChild(A),b(!0),setTimeout(()=>b(!1),2e3)}}},C=(n.parameters||[]).filter(R=>R.in==="path"),T=(n.parameters||[]).filter(R=>R.in==="query"),N=["post","put","patch"].includes(e)&&n.requestBody;return i.jsxs("div",{className:"border border-bambu-dark-tertiary rounded-lg overflow-hidden",children:[i.jsxs("button",{onClick:()=>o(!s),className:"w-full flex items-center gap-3 p-3 hover:bg-bambu-dark-tertiary/50 transition-colors text-left",children:[s?i.jsx(In,{className:"w-4 h-4 text-bambu-gray flex-shrink-0"}):i.jsx(pa,{className:"w-4 h-4 text-bambu-gray flex-shrink-0"}),i.jsx("span",{className:`px-2 py-0.5 text-xs font-mono font-semibold uppercase rounded border ${SJe[e]||"bg-gray-500/20 text-gray-400"}`,children:e}),i.jsx("code",{className:"text-sm text-white font-mono flex-1 truncate",children:t}),n.summary&&i.jsx("span",{className:"text-sm text-bambu-gray truncate max-w-[40%]",children:n.summary})]}),s&&i.jsxs("div",{className:"border-t border-bambu-dark-tertiary p-4 space-y-4 bg-bambu-dark/50",children:[n.description&&i.jsx("p",{className:"text-sm text-bambu-gray",children:n.description}),C.length>0&&i.jsxs("div",{className:"space-y-2",children:[i.jsx("h4",{className:"text-sm font-medium text-white",children:"Path Parameters"}),i.jsx("div",{className:"space-y-2",children:C.map(R=>i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs("label",{className:"text-sm text-bambu-gray w-32 flex-shrink-0",children:[R.name,R.required&&i.jsx("span",{className:"text-red-400 ml-1",children:"*"})]}),i.jsx("input",{type:"text",value:l[R.name]||"",onChange:A=>c(D=>({...D,[R.name]:A.target.value})),placeholder:R.description||R.schema?.type||"value",className:"flex-1 px-2 py-1 bg-bambu-dark border border-bambu-dark-tertiary rounded text-white text-sm font-mono focus:border-bambu-green focus:outline-none"})]},R.name))})]}),T.length>0&&i.jsxs("div",{className:"space-y-2",children:[i.jsx("h4",{className:"text-sm font-medium text-white",children:"Query Parameters"}),i.jsx("div",{className:"space-y-2",children:T.map(R=>i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs("label",{className:"text-sm text-bambu-gray w-32 flex-shrink-0",children:[R.name,R.required&&i.jsx("span",{className:"text-red-400 ml-1",children:"*"})]}),R.schema?.enum?i.jsxs("select",{value:l[R.name]||"",onChange:A=>c(D=>({...D,[R.name]:A.target.value})),className:"flex-1 px-2 py-1 bg-bambu-dark border border-bambu-dark-tertiary rounded text-white text-sm focus:border-bambu-green focus:outline-none",children:[i.jsx("option",{value:"",children:"-- Select --"}),R.schema.enum.map(A=>i.jsx("option",{value:A,children:A},A))]}):i.jsx("input",{type:"text",value:l[R.name]||"",onChange:A=>c(D=>({...D,[R.name]:A.target.value})),placeholder:R.description||R.schema?.type||"value",className:"flex-1 px-2 py-1 bg-bambu-dark border border-bambu-dark-tertiary rounded text-white text-sm font-mono focus:border-bambu-green focus:outline-none"})]},R.name))})]}),N&&i.jsxs("div",{className:"space-y-2",children:[i.jsx("h4",{className:"text-sm font-medium text-white",children:"Request Body"}),i.jsx("textarea",{value:d,onChange:R=>u(R.target.value),rows:8,className:"w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm font-mono focus:border-bambu-green focus:outline-none resize-y",placeholder:"JSON request body..."})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs(Fe,{onClick:k,disabled:f,children:[f?i.jsx(ct,{className:"w-4 h-4 animate-spin"}):i.jsx(co,{className:"w-4 h-4"}),"Execute"]}),_.length>0&&i.jsxs("span",{className:"text-xs text-yellow-400 flex items-center gap-1",children:[i.jsx(Ii,{className:"w-3 h-3"}),"Fill in: ",_.join(", ")]})]}),m&&i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("h4",{className:"text-sm font-medium text-white flex items-center gap-2",children:["Response",i.jsxs("span",{className:`px-2 py-0.5 text-xs rounded ${m.status>=200&&m.status<300?"bg-green-500/20 text-green-400":m.status>=400?"bg-red-500/20 text-red-400":"bg-yellow-500/20 text-yellow-400"}`,children:[m.status," ",m.statusText]}),i.jsxs("span",{className:"text-xs text-bambu-gray",children:[m.duration,"ms"]})]}),i.jsx(Fe,{variant:"secondary",size:"sm",onClick:P,children:x?i.jsx(fr,{className:"w-3 h-3 text-green-400"}):i.jsx(wl,{className:"w-3 h-3"})})]}),i.jsx("pre",{className:"p-3 bg-bambu-dark rounded-lg text-sm font-mono text-white overflow-auto max-h-96 border border-bambu-dark-tertiary",children:typeof m.body=="string"?m.body:JSON.stringify(m.body,null,2)})]})]})]})}function NJe({apiKey:t=""}){const[e,n]=w.useState(null),[r,a]=w.useState(!0),[s,o]=w.useState(null),[l,c]=w.useState(new Set),[d,u]=w.useState("");if(w.useEffect(()=>{async function b(){try{const v=await fetch("/openapi.json");if(!v.ok)throw new Error("Failed to fetch OpenAPI schema");const _=await v.json();n(_)}catch(v){o(v instanceof Error?v.message:"Unknown error")}finally{a(!1)}}b()},[]),r)return i.jsx("div",{className:"flex justify-center py-12",children:i.jsx(ct,{className:"w-8 h-8 text-bambu-green animate-spin"})});if(s||!e)return i.jsx(Tt,{children:i.jsx(Pt,{className:"py-8",children:i.jsxs("div",{className:"text-center text-red-400",children:[i.jsx(Ii,{className:"w-12 h-12 mx-auto mb-3 opacity-50"}),i.jsx("p",{children:"Failed to load API schema"}),i.jsx("p",{className:"text-sm text-bambu-gray mt-1",children:s})]})})});const m={};for(const[b,v]of Object.entries(e.paths))for(const[_,k]of Object.entries(v)){if(_==="parameters")continue;const P=k.tags||["Other"];for(const C of P)m[C]||(m[C]=[]),m[C].push({path:b,method:_,spec:k})}const p=Object.entries(m).map(([b,v])=>{if(!d)return{tag:b,endpoints:v};const _=v.filter(({path:k,method:P,spec:C})=>{const T=d.toLowerCase();return k.toLowerCase().includes(T)||P.toLowerCase().includes(T)||(C.summary?.toLowerCase()||"").includes(T)||(C.description?.toLowerCase()||"").includes(T)});return{tag:b,endpoints:_}}).filter(({endpoints:b})=>b.length>0).sort((b,v)=>b.tag.localeCompare(v.tag)),f=b=>{c(v=>{const _=new Set(v);return _.has(b)?_.delete(b):_.add(b),_})},y=()=>{c(new Set(p.map(b=>b.tag)))},x=()=>{c(new Set)};return i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"flex items-center justify-between gap-4",children:[i.jsx("div",{className:"flex-1",children:i.jsx("input",{type:"text",value:d,onChange:b=>u(b.target.value),placeholder:"Search endpoints...",className:"w-full max-w-md px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none"})}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(Fe,{variant:"secondary",size:"sm",onClick:y,children:"Expand All"}),i.jsx(Fe,{variant:"secondary",size:"sm",onClick:x,children:"Collapse All"}),i.jsxs("a",{href:"/docs",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 text-sm text-bambu-green hover:underline",children:[i.jsx(ei,{className:"w-4 h-4"}),"Swagger UI"]})]})]}),i.jsxs("p",{className:"text-sm text-bambu-gray",children:[p.reduce((b,v)=>b+v.endpoints.length,0)," endpoints in ",p.length," categories"]}),i.jsx("div",{className:"space-y-3",children:p.map(({tag:b,endpoints:v})=>i.jsxs(Tt,{children:[i.jsx("button",{onClick:()=>f(b),className:"w-full flex items-center justify-between p-4 hover:bg-bambu-dark-tertiary/30 transition-colors text-left",children:i.jsxs("div",{className:"flex items-center gap-2",children:[l.has(b)?i.jsx(In,{className:"w-5 h-5 text-bambu-gray"}):i.jsx(pa,{className:"w-5 h-5 text-bambu-gray"}),i.jsx("h3",{className:"text-base font-semibold text-white capitalize",children:b.replace(/-/g," ")}),i.jsx("span",{className:"text-xs bg-bambu-dark-tertiary px-2 py-0.5 rounded-full text-bambu-gray",children:v.length})]})}),l.has(b)&&i.jsx(Pt,{className:"pt-0 space-y-2",children:v.map(({path:_,method:k,spec:P})=>i.jsx(kJe,{path:_,method:k,spec:P,schema:e,apiKey:t},`${k}-${_}`))})]},b))})]})}const CJe=["general","network","plugs","notifications","filament","apikeys","virtual-printer","users","backup"],TJe={database:"bg-blue-600",library_files:"bg-green-500",library_thumbnails:"bg-teal-500",library_other:"bg-emerald-700",archive_timelapses:"bg-red-500",archive_thumbnails:"bg-amber-500",archive_files:"bg-sky-500",virtual_printer_uploads:"bg-purple-500",virtual_printer_upload_cache:"bg-fuchsia-500",virtual_printer_certs:"bg-violet-500",virtual_printer_other:"bg-purple-700",downloads:"bg-cyan-500",plate_calibration:"bg-lime-500",logs:"bg-orange-500",other_data:"bg-yellow-500"},AK=["bg-blue-500","bg-green-500","bg-yellow-500","bg-red-500","bg-orange-500","bg-teal-500","bg-cyan-500","bg-purple-500"],MK=(t,e)=>TJe[t]||AK[e%AK.length];function PJe(){const t=tn(),e=Ml(),[n,r]=OF(),{t:a,i18n:s}=Mt(),{showToast:o}=bn(),{authEnabled:l,user:c,refreshAuth:d}=Rr(),{mode:u,darkStyle:m,darkBackground:p,darkAccent:f,lightStyle:y,lightBackground:x,lightAccent:b,setDarkStyle:v,setDarkBackground:_,setDarkAccent:k,setLightStyle:P,setLightBackground:C,setLightAccent:T}=bf(),[N,R]=w.useState(null),[A,D]=w.useState(!1),[$,U]=w.useState(null),[G,L]=w.useState(!1),[te,re]=w.useState(null),[J,ue]=w.useState(null),[me,ge]=w.useState(!1),[X,ie]=w.useState(dX()),le=n.get("tab"),pe=le==="email",Ce=pe?"users":le&&CJe.includes(le)?le:"general",[q,Z]=w.useState(Ce),[j,E]=w.useState(pe?"email":"users"),I=Se=>{Z(Se),Se==="users"&&E("users"),Se==="general"?n.delete("tab"):n.set("tab",Se),r(n,{replace:!0})},[W,B]=w.useState(!1),[ae,z]=w.useState(""),[V,ee]=w.useState({can_queue:!0,can_control_printer:!1,can_read_status:!0}),[K,ne]=w.useState(null),[se,ce]=w.useState(null),[fe,oe]=w.useState(""),[O,F]=w.useState(!1),[Q,ve]=w.useState(!1),[he,de]=w.useState(null),[Ae,_e]=w.useState(!1),[ze,Be]=w.useState(!1),[Ue,Ne]=w.useState(!1),[Ee,ke]=w.useState({currentPassword:"",newPassword:"",confirmPassword:""}),[Me,Ge]=w.useState(!1),[xe,He]=w.useState(!1),[Pe,Ve]=w.useState(!1),[je,ye]=w.useState(!1),[$e,Ye]=w.useState(null),[lt,St]=w.useState(null),[ot,ft]=w.useState(null),[qe,ht]=w.useState(!1),[yt,Bt]=w.useState({username:"",password:"",email:"",confirmPassword:"",role:"user",group_ids:[]}),[Yt,xn]=w.useState(null),[Xt,$t]=w.useState(null),[nn,on]=w.useState(!1),[cn,pn]=w.useState({}),[Ie,De]=w.useState({}),Xe=Se=>{ie(Se),Sbe(Se),o(a("settings.toast.settingsSaved"),"success")},at=()=>{localStorage.removeItem("sidebarOrder"),window.location.reload()},{data:Ke,isLoading:It}=Je({queryKey:["settings"],queryFn:be.getSettings}),{data:Te,isLoading:We,isFetching:et}=Je({queryKey:["storage-usage"],queryFn:()=>be.getStorageUsage(),enabled:q==="general",staleTime:1/0,refetchInterval:!1,refetchOnWindowFocus:!1,refetchOnReconnect:!1}),Ze=async()=>{He(!0);try{const Se=await be.getStorageUsage({refresh:!0});t.setQueryData(["storage-usage"],Se)}catch(Se){const Dt=Se instanceof Error?Se.message:"Failed to refresh storage usage";o(Dt,"error")}finally{He(!1)}},{data:Le,isLoading:mt}=Je({queryKey:["smart-plugs"],queryFn:be.getSmartPlugs}),{data:st,isLoading:tt}=Je({queryKey:["smart-plugs-energy",Le?.map(Se=>Se.id)],queryFn:async()=>{if(!Le||Le.length===0)return null;const Se=await Promise.all(Le.filter(Yi=>Yi.enabled).map(async Yi=>{try{const Xn=await be.getSmartPlugStatus(Yi.id);return{plug:Yi,status:Xn}}catch{return{plug:Yi,status:null}}}));let Dt=0,Cn=0,nr=0,ri=0,Na=0;for(const{plug:Yi,status:Xn}of Se){const ks=Yi.plug_type==="mqtt"&&Xn?.energy?.power!=null;(Xn?.reachable||ks)&&Xn?.energy&&(Na++,Xn.energy?.power!=null&&(Dt+=Xn.energy.power),Xn.energy?.today!=null&&(Cn+=Xn.energy.today),Xn.energy?.yesterday!=null&&(nr+=Xn.energy.yesterday),Xn.energy?.total!=null&&(ri+=Xn.energy.total))}return{totalPower:Dt,totalToday:Cn,totalYesterday:nr,totalLifetime:ri,reachableCount:Na,totalPlugs:Le.filter(Yi=>Yi.enabled).length}},enabled:q==="plugs"&&!!Le&&Le.length>0,refetchInterval:q==="plugs"?1e4:!1}),{data:Nt,isLoading:Rt}=Je({queryKey:["notification-providers"],queryFn:be.getNotificationProviders}),{data:jt,isLoading:Ft}=Je({queryKey:["api-keys"],queryFn:be.getAPIKeys}),mn=ut({mutationFn:Se=>be.createAPIKey(Se),onSuccess:Se=>{ne(Se.key||null),B(!1),z(""),t.invalidateQueries({queryKey:["api-keys"]}),o(a("settings.toast.apiKeyCreated"))},onError:Se=>{o(`Failed to create API key: ${Se.message}`,"error")}}),rn=ut({mutationFn:Se=>be.deleteAPIKey(Se),onSuccess:()=>{t.invalidateQueries({queryKey:["api-keys"]}),o(a("settings.toast.apiKeyDeleted"))},onError:Se=>{o(`Failed to delete API key: ${Se.message}`,"error")}}),{data:vn}=Je({queryKey:["printers"],queryFn:be.getPrinters}),{data:Dn,isLoading:Bn}=Je({queryKey:["notification-templates"],queryFn:be.getNotificationTemplates}),{data:en}=Je({queryKey:["virtual-printer-settings"],queryFn:Jge.getSettings,refetchInterval:1e4}),kn=en?.status?.running??!1,{data:_n}=Je({queryKey:["ffmpeg-status"],queryFn:be.checkFfmpeg}),{data:vr}=Je({queryKey:["version"],queryFn:be.getVersion}),{data:wn,refetch:lr,isRefetching:ci}=Je({queryKey:["updateCheck"],queryFn:be.checkForUpdates,enabled:Ke?.check_updates!==!1,staleTime:300*1e3}),{data:zn,refetch:gi}=Je({queryKey:["updateStatus"],queryFn:be.getUpdateStatus,refetchInterval:Se=>{const Dt=Se.state.data;return Dt?.status==="downloading"||Dt?.status==="installing"?1e3:!1}}),{data:tr}=Je({queryKey:["mqtt-status"],queryFn:be.getMQTTStatus,refetchInterval:q==="network"?5e3:!1}),{data:bi}=Je({queryKey:["github-backup-status"],queryFn:be.getGitHubBackupStatus}),{data:ni}=Je({queryKey:["cloud-status"],queryFn:be.getCloudStatus}),{data:Fr={advanced_auth_enabled:!1,smtp_configured:!1}}=Je({queryKey:["advancedAuthStatus"],queryFn:()=>be.getAdvancedAuthStatus()}),{hasPermission:xi}=Rr(),{data:_h=[],isLoading:kf}=Je({queryKey:["users"],queryFn:()=>be.getUsers(),enabled:l&&xi("users:read")}),{data:za=[],isLoading:Nf}=Je({queryKey:["groups"],queryFn:()=>be.getGroups(),enabled:l&&xi("groups:read")}),dc=ut({mutationFn:Se=>be.createUser(Se),onSuccess:()=>{t.invalidateQueries({queryKey:["users"]}),t.invalidateQueries({queryKey:["groups"]}),Ve(!1),Bt({username:"",password:"",email:"",confirmPassword:"",role:"user",group_ids:[]}),o(a("settings.toast.userCreated"))},onError:Se=>{o(Se.message,"error")}}),uc=ut({mutationFn:({id:Se,data:Dt})=>be.updateUser(Se,Dt),onSuccess:()=>{t.invalidateQueries({queryKey:["users"]}),t.invalidateQueries({queryKey:["groups"]}),ye(!1),Ye(null),Bt({username:"",password:"",email:"",confirmPassword:"",role:"user",group_ids:[]}),o(a("settings.toast.userUpdated"))},onError:Se=>{o(Se.message,"error")}}),Ki=ut({mutationFn:({id:Se,deleteItems:Dt})=>be.deleteUser(Se,Dt),onSuccess:()=>{t.invalidateQueries({queryKey:["users"]}),o(a("settings.toast.userDeleted")),St(null),ft(null)},onError:Se=>{o(Se.message,"error")}}),Ss=ut({mutationFn:Se=>be.resetUserPassword({user_id:Se}),onSuccess:Se=>{o(Se.message,"success")},onError:Se=>{o(Se.message,"error")}}),_s=async Se=>{St(Se),ht(!0);try{const Dt=await be.getUserItemsCount(Se);ft(Dt)}catch{ft({archives:0,queue_items:0,library_files:0})}finally{ht(!1)}},$s=ut({mutationFn:Se=>be.deleteGroup(Se),onSuccess:()=>{t.invalidateQueries({queryKey:["groups"]}),o(a("settings.toast.groupDeleted"))},onError:Se=>{o(Se.message,"error")}}),jl=()=>{const Se=Fr?.advanced_auth_enabled||!1;if(!yt.username){o(a("settings.toast.fillRequiredFields"),"error");return}if(Se&&!yt.email){o("Email is required when advanced authentication is enabled","error");return}if(!Se){if(!yt.password){o(a("settings.toast.fillRequiredFields"),"error");return}if(yt.password!==yt.confirmPassword){o(a("settings.toast.passwordsDoNotMatch"),"error");return}if(yt.password.length<6){o(a("settings.toast.passwordTooShort"),"error");return}}dc.mutate({username:yt.username,password:Se?void 0:yt.password,email:yt.email||void 0,role:yt.role,group_ids:yt.group_ids.length>0?yt.group_ids:void 0})},Cf=Se=>{if(yt.password){if(yt.password!==yt.confirmPassword){o(a("settings.toast.passwordsDoNotMatch"),"error");return}if(yt.password.length<6){o(a("settings.toast.passwordTooShort"),"error");return}}const Dt={username:yt.username||void 0,password:yt.password||void 0,role:yt.role,group_ids:yt.group_ids};Dt.password||delete Dt.password,uc.mutate({id:Se,data:Dt})},kh=Se=>{Ye(Se.id),Bt({username:Se.username,password:"",email:Se.email||"",confirmPassword:"",role:Se.role,group_ids:Se.groups?.map(Dt=>Dt.id)||[]}),ye(!0)},mc=Se=>{Bt(Dt=>({...Dt,group_ids:Dt.group_ids.includes(Se)?Dt.group_ids.filter(Cn=>Cn!==Se):[...Dt.group_ids,Se]}))},Dl=ut({mutationFn:be.applyUpdate,onSuccess:Se=>{Se.is_docker?o(Se.message,"error"):gi()}}),[ka,rd]=w.useState(null),Rl=ut({mutationFn:be.testAllNotificationProviders,onSuccess:Se=>{rd(Se),t.invalidateQueries({queryKey:["notification-providers"]}),Se.failed===0?o(`All ${Se.tested} providers tested successfully!`,"success"):o(`${Se.success}/${Se.tested} providers succeeded`,Se.failed>0?"error":"success")},onError:Se=>{o(`Failed to test providers: ${Se.message}`,"error")}}),bt=ut({mutationFn:async Se=>{if(!Le)return{success:0,failed:0};const Dt=Le.filter(nr=>nr.enabled),Cn=await Promise.all(Dt.map(async nr=>{try{return await be.controlSmartPlug(nr.id,Se),{success:!0}}catch{return{success:!1}}}));return{success:Cn.filter(nr=>nr.success).length,failed:Cn.filter(nr=>!nr.success).length}},onSuccess:(Se,Dt)=>{t.invalidateQueries({queryKey:["smart-plugs"]}),t.invalidateQueries({queryKey:["smart-plugs-energy"]}),Se.failed===0?o(`All ${Se.success} plugs turned ${Dt}`,"success"):o(`${Se.success} plugs turned ${Dt}, ${Se.failed} failed`,"error")},onError:Se=>{o(`Failed: ${Se.message}`,"error")}}),Ot=w.useRef(null),dn=w.useRef(!1),kt=w.useRef(!0);w.useEffect(()=>{if(Ke&&!N){const Se={...Ke,external_url:Ke.external_url||window.location.origin};R(Se),setTimeout(()=>{kt.current=!1},100)}},[Ke,N]);const Pn=ut({mutationFn:be.updateSettings,onSuccess:Se=>{t.setQueryData(["settings"],Se),t.invalidateQueries({queryKey:["archiveStats"]}),o(a("settings.toast.settingsSaved"),"success")},onError:Se=>{o(`Failed to save: ${Se.message}`,"error")},onSettled:()=>{dn.current=!1}}),Nr=ut({mutationFn:({id:Se,data:Dt})=>be.updatePrinter(Se,Dt),onSuccess:()=>{t.invalidateQueries({queryKey:["printers"]}),o(a("settings.toast.cameraSettingsSaved"),"success")},onError:Se=>{o(`Failed to update printer: ${Se.message}`,"error")}});w.useEffect(()=>{if(!(kt.current||!N||!Ke||!(Ke.auto_archive!==N.auto_archive||Ke.save_thumbnails!==N.save_thumbnails||Ke.capture_finish_photo!==N.capture_finish_photo||Ke.default_filament_cost!==N.default_filament_cost||Ke.currency!==N.currency||Ke.energy_cost_per_kwh!==N.energy_cost_per_kwh||Ke.energy_tracking_mode!==N.energy_tracking_mode||Ke.check_updates!==N.check_updates||(Ke.check_printer_firmware??!0)!==(N.check_printer_firmware??!0)||(Ke.include_beta_updates??!1)!==(N.include_beta_updates??!1)||Ke.notification_language!==N.notification_language||(Ke.bed_cooled_threshold??35)!==(N.bed_cooled_threshold??35)||Ke.ams_humidity_good!==N.ams_humidity_good||Ke.ams_humidity_fair!==N.ams_humidity_fair||Ke.ams_temp_good!==N.ams_temp_good||Ke.ams_temp_fair!==N.ams_temp_fair||Ke.ams_history_retention_days!==N.ams_history_retention_days||Ke.per_printer_mapping_expanded!==N.per_printer_mapping_expanded||Ke.date_format!==N.date_format||Ke.time_format!==N.time_format||Ke.default_printer_id!==N.default_printer_id||Ke.ftp_retry_enabled!==N.ftp_retry_enabled||Ke.ftp_retry_count!==N.ftp_retry_count||Ke.ftp_retry_delay!==N.ftp_retry_delay||Ke.ftp_timeout!==N.ftp_timeout||Ke.mqtt_enabled!==N.mqtt_enabled||Ke.mqtt_broker!==N.mqtt_broker||Ke.mqtt_port!==N.mqtt_port||Ke.mqtt_username!==N.mqtt_username||Ke.mqtt_password!==N.mqtt_password||Ke.mqtt_topic_prefix!==N.mqtt_topic_prefix||Ke.mqtt_use_tls!==N.mqtt_use_tls||Ke.external_url!==N.external_url||Ke.ha_enabled!==N.ha_enabled||Ke.ha_url!==N.ha_url||Ke.ha_token!==N.ha_token||(Ke.library_archive_mode??"ask")!==(N.library_archive_mode??"ask")||Number(Ke.library_disk_warning_gb??5)!==Number(N.library_disk_warning_gb??5)||(Ke.camera_view_mode??"window")!==(N.camera_view_mode??"window")||(Ke.preferred_slicer??"bambu_studio")!==(N.preferred_slicer??"bambu_studio")||Ke.prometheus_enabled!==N.prometheus_enabled||Ke.prometheus_token!==N.prometheus_token))&&!dn.current)return Ot.current&&clearTimeout(Ot.current),Ot.current=setTimeout(()=>{if(dn.current)return;dn.current=!0;const Dt={auto_archive:N.auto_archive,save_thumbnails:N.save_thumbnails,capture_finish_photo:N.capture_finish_photo,default_filament_cost:N.default_filament_cost,currency:N.currency,energy_cost_per_kwh:N.energy_cost_per_kwh,energy_tracking_mode:N.energy_tracking_mode,check_updates:N.check_updates,check_printer_firmware:N.check_printer_firmware,include_beta_updates:N.include_beta_updates,notification_language:N.notification_language,bed_cooled_threshold:N.bed_cooled_threshold,ams_humidity_good:N.ams_humidity_good,ams_humidity_fair:N.ams_humidity_fair,ams_temp_good:N.ams_temp_good,ams_temp_fair:N.ams_temp_fair,ams_history_retention_days:N.ams_history_retention_days,per_printer_mapping_expanded:N.per_printer_mapping_expanded,date_format:N.date_format,time_format:N.time_format,default_printer_id:N.default_printer_id,ftp_retry_enabled:N.ftp_retry_enabled,ftp_retry_count:N.ftp_retry_count,ftp_retry_delay:N.ftp_retry_delay,ftp_timeout:N.ftp_timeout,mqtt_enabled:N.mqtt_enabled,mqtt_broker:N.mqtt_broker,mqtt_port:N.mqtt_port,mqtt_username:N.mqtt_username,mqtt_password:N.mqtt_password,mqtt_topic_prefix:N.mqtt_topic_prefix,mqtt_use_tls:N.mqtt_use_tls,external_url:N.external_url,ha_enabled:N.ha_enabled,ha_url:N.ha_url,ha_token:N.ha_token,library_archive_mode:N.library_archive_mode,library_disk_warning_gb:N.library_disk_warning_gb,camera_view_mode:N.camera_view_mode,preferred_slicer:N.preferred_slicer,prometheus_enabled:N.prometheus_enabled,prometheus_token:N.prometheus_token};Pn.mutate(Dt)},500),()=>{Ot.current&&clearTimeout(Ot.current)}},[N,Ke,Pn]);const Ht=w.useCallback((Se,Dt)=>{R(Cn=>Cn?{...Cn,[Se]:Dt}:null)},[]),wr=async(Se,Dt,Cn)=>{if(!Dt){o(a("settings.toast.enterCameraUrl"),"error");return}De(nr=>({...nr,[Se]:!0})),pn(nr=>({...nr,[Se]:null}));try{const nr=await be.testExternalCamera(Se,Dt,Cn);pn(ri=>({...ri,[Se]:nr})),nr.success?o(a("settings.toast.cameraConnected",{resolution:nr.resolution||""}),"success"):o(nr.error||a("settings.toast.connectionFailed"),"error")}catch(nr){const ri=nr instanceof Error?nr.message:a("settings.toast.testFailed");pn(Na=>({...Na,[Se]:{success:!1,error:ri}})),o(ri,"error")}finally{De(nr=>({...nr,[Se]:!1}))}},[yi,sn]=w.useState({}),Rn=w.useRef({}),qs=w.useRef(new Set);w.useEffect(()=>{if(vn){const Se={};vn.forEach(Dt=>{Dt.external_camera_url&&!qs.current.has(Dt.id)&&(Se[Dt.id]=Dt.external_camera_url,qs.current.add(Dt.id))}),Object.keys(Se).length>0&&sn(Dt=>({...Dt,...Se}))}},[vn]);const Vs=(Se,Dt)=>{sn(Cn=>({...Cn,[Se]:Dt})),Rn.current[Se]&&clearTimeout(Rn.current[Se]),Rn.current[Se]=setTimeout(()=>{Nr.mutate({id:Se,data:{external_camera_url:Dt||null}})},800)},go=(Se,Dt)=>{const Cn={};Dt.type!==void 0&&(Cn.external_camera_type=Dt.type||null),Dt.enabled!==void 0&&(Cn.external_camera_enabled=Dt.enabled),Nr.mutate({id:Se,data:Cn})};return It||!N?i.jsx("div",{className:"p-4 md:p-8 flex justify-center",children:i.jsx(ct,{className:"w-8 h-8 text-bambu-green animate-spin"})}):i.jsxs("div",{className:"p-4 md:p-8",children:[i.jsxs("div",{className:"mb-8",children:[i.jsx("h1",{className:"text-2xl font-bold text-white",children:a("settings.title")}),i.jsx("p",{className:"text-bambu-gray",children:a("settings.configureBambuddy")})]}),i.jsxs("div",{className:"flex flex-wrap gap-1 mb-6 border-b border-bambu-dark-tertiary",children:[i.jsx("button",{onClick:()=>I("general"),className:`px-4 py-2 text-sm font-medium transition-colors border-b-2 -mb-px ${q==="general"?"text-bambu-green border-bambu-green":"text-bambu-gray hover:text-gray-900 dark:hover:text-white border-transparent"}`,children:a("settings.tabs.general")}),i.jsxs("button",{onClick:()=>I("plugs"),className:`px-4 py-2 text-sm font-medium transition-colors border-b-2 -mb-px flex items-center gap-2 ${q==="plugs"?"text-bambu-green border-bambu-green":"text-bambu-gray hover:text-gray-900 dark:hover:text-white border-transparent"}`,children:[i.jsx(fl,{className:"w-4 h-4"}),a("settings.tabs.smartPlugs"),Le&&Le.length>0&&i.jsx("span",{className:"text-xs bg-bambu-dark-tertiary px-1.5 py-0.5 rounded-full",children:Le.length})]}),i.jsxs("button",{onClick:()=>I("notifications"),className:`px-4 py-2 text-sm font-medium transition-colors border-b-2 -mb-px flex items-center gap-2 ${q==="notifications"?"text-bambu-green border-bambu-green":"text-bambu-gray hover:text-gray-900 dark:hover:text-white border-transparent"}`,children:[i.jsx(ub,{className:"w-4 h-4"}),a("settings.tabs.notifications"),Nt&&Nt.length>0&&i.jsx("span",{className:"text-xs bg-bambu-dark-tertiary px-1.5 py-0.5 rounded-full",children:Nt.length})]}),i.jsxs("button",{onClick:()=>I("filament"),className:`px-4 py-2 text-sm font-medium transition-colors border-b-2 -mb-px flex items-center gap-2 ${q==="filament"?"text-bambu-green border-bambu-green":"text-bambu-gray hover:text-gray-900 dark:hover:text-white border-transparent"}`,children:[i.jsx(Lhe,{className:"w-4 h-4"}),a("settings.tabs.filament")]}),i.jsxs("button",{onClick:()=>I("network"),className:`px-4 py-2 text-sm font-medium transition-colors border-b-2 -mb-px flex items-center gap-2 ${q==="network"?"text-bambu-green border-bambu-green":"text-bambu-gray hover:text-gray-900 dark:hover:text-white border-transparent"}`,children:[i.jsx(hb,{className:"w-4 h-4"}),a("settings.tabs.network"),i.jsx("span",{className:`w-2 h-2 rounded-full ${tr?.enabled?"bg-green-400":"bg-gray-500"}`})]}),i.jsxs("button",{onClick:()=>I("apikeys"),className:`px-4 py-2 text-sm font-medium transition-colors border-b-2 -mb-px flex items-center gap-2 ${q==="apikeys"?"text-bambu-green border-bambu-green":"text-bambu-gray hover:text-gray-900 dark:hover:text-white border-transparent"}`,children:[i.jsx(il,{className:"w-4 h-4"}),a("settings.tabs.apiKeys"),jt&&jt.length>0&&i.jsx("span",{className:"text-xs bg-bambu-dark-tertiary px-1.5 py-0.5 rounded-full",children:jt.length})]}),i.jsxs("button",{onClick:()=>I("virtual-printer"),className:`px-4 py-2 text-sm font-medium transition-colors border-b-2 -mb-px flex items-center gap-2 ${q==="virtual-printer"?"text-bambu-green border-bambu-green":"text-bambu-gray hover:text-gray-900 dark:hover:text-white border-transparent"}`,children:[i.jsx(kr,{className:"w-4 h-4"}),a("settings.tabs.virtualPrinter"),i.jsx("span",{className:`w-2 h-2 rounded-full ${kn?"bg-green-400":"bg-gray-500"}`})]}),i.jsxs("button",{onClick:()=>I("users"),className:`px-4 py-2 text-sm font-medium transition-colors border-b-2 -mb-px flex items-center gap-2 ${q==="users"?"text-bambu-green border-bambu-green":"text-bambu-gray hover:text-gray-900 dark:hover:text-white border-transparent"}`,children:[i.jsx(Sm,{className:"w-4 h-4"}),a("settings.tabs.users"),l&&i.jsx("span",{className:"w-2 h-2 rounded-full bg-green-400"})]}),i.jsxs("button",{onClick:()=>I("backup"),className:`px-4 py-2 text-sm font-medium transition-colors border-b-2 -mb-px flex items-center gap-2 ${q==="backup"?"text-bambu-green border-bambu-green":"text-bambu-gray hover:text-gray-900 dark:hover:text-white border-transparent"}`,children:[i.jsx(Ic,{className:"w-4 h-4"}),a("settings.tabs.backup"),i.jsx("span",{className:`w-2 h-2 rounded-full ${ni?.is_authenticated&&bi?.configured&&bi?.enabled?"bg-green-400":"bg-gray-500"}`})]})]}),q==="general"&&i.jsxs("div",{className:"flex flex-col lg:flex-row gap-6 lg:gap-8",children:[i.jsxs("div",{className:"space-y-6 flex-1 lg:max-w-xl",children:[i.jsxs(Tt,{children:[i.jsx(Wn,{children:i.jsx("h2",{className:"text-lg font-semibold text-white",children:a("settings.general")})}),i.jsxs(Pt,{className:"space-y-4",children:[i.jsxs("div",{children:[i.jsxs("label",{className:"block text-sm text-bambu-gray mb-1",children:[i.jsx($m,{className:"w-4 h-4 inline mr-1"}),a("settings.language")]}),i.jsxs("div",{className:"relative",children:[i.jsx("select",{value:s.language,onChange:Se=>{s.changeLanguage(Se.target.value),be.updateSettings({language:Se.target.value}),o(a("settings.toast.settingsSaved"),"success")},className:"w-full px-3 py-2 pr-10 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none appearance-none cursor-pointer",children:LB.map(Se=>i.jsxs("option",{value:Se.code,children:[Se.nativeName," (",Se.name,")"]},Se.code))}),i.jsx(In,{className:"absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray pointer-events-none"})]}),i.jsx("p",{className:"text-xs text-bambu-gray mt-1",children:a("settings.languageDescription")})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:a("settings.defaultView")}),i.jsxs("div",{className:"relative",children:[i.jsx("select",{value:X,onChange:Se=>Xe(Se.target.value),className:"w-full px-3 py-2 pr-10 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none appearance-none cursor-pointer",children:Uv.map(Se=>i.jsx("option",{value:Se.to,children:a(Se.labelKey)},Se.id))}),i.jsx(In,{className:"absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray pointer-events-none"})]}),i.jsx("p",{className:"text-xs text-bambu-gray mt-1",children:a("settings.defaultViewDescription")})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:a("settings.dateFormat")}),i.jsxs("div",{className:"relative",children:[i.jsxs("select",{value:N.date_format||"system",onChange:Se=>Ht("date_format",Se.target.value),className:"w-full px-3 py-2 pr-10 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none appearance-none cursor-pointer",children:[i.jsx("option",{value:"system",children:a("settings.systemDefault")}),i.jsx("option",{value:"us",children:a("settings.dateFormatUs")}),i.jsx("option",{value:"eu",children:a("settings.dateFormatEu")}),i.jsx("option",{value:"iso",children:a("settings.dateFormatIso")})]}),i.jsx(In,{className:"absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray pointer-events-none"})]})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:a("settings.timeFormat")}),i.jsxs("div",{className:"relative",children:[i.jsxs("select",{value:N.time_format||"system",onChange:Se=>Ht("time_format",Se.target.value),className:"w-full px-3 py-2 pr-10 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none appearance-none cursor-pointer",children:[i.jsx("option",{value:"system",children:a("settings.systemDefault")}),i.jsx("option",{value:"12h",children:a("settings.timeFormat12")}),i.jsx("option",{value:"24h",children:a("settings.timeFormat24")})]}),i.jsx(In,{className:"absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray pointer-events-none"})]})]})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:a("settings.defaultPrinter")}),i.jsxs("div",{className:"relative",children:[i.jsxs("select",{value:N.default_printer_id??"",onChange:Se=>Ht("default_printer_id",Se.target.value?Number(Se.target.value):null),className:"w-full px-3 py-2 pr-10 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none appearance-none cursor-pointer",children:[i.jsx("option",{value:"",children:a("settings.noDefaultPrinter")}),vn?.map(Se=>i.jsx("option",{value:Se.id,children:Se.name},Se.id))]}),i.jsx(In,{className:"absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray pointer-events-none"})]}),i.jsx("p",{className:"text-xs text-bambu-gray mt-1",children:a("settings.defaultPrinterDescription")})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:a("settings.preferredSlicer")}),i.jsxs("div",{className:"relative",children:[i.jsxs("select",{value:N.preferred_slicer??"bambu_studio",onChange:Se=>Ht("preferred_slicer",Se.target.value),className:"w-full px-3 py-2 pr-10 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none appearance-none cursor-pointer",children:[i.jsx("option",{value:"bambu_studio",children:a("settings.slicerBambuStudio")}),i.jsx("option",{value:"orcaslicer",children:a("settings.slicerOrcaSlicer")})]}),i.jsx(In,{className:"absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray pointer-events-none"})]}),i.jsx("p",{className:"text-xs text-bambu-gray mt-1",children:a("settings.preferredSlicerDescription")})]}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-white",children:a("settings.sidebarOrder")}),i.jsx("p",{className:"text-sm text-bambu-gray",children:a("settings.sidebarOrderDescription")})]}),i.jsxs(Fe,{variant:"secondary",size:"sm",onClick:at,children:[i.jsx(uo,{className:"w-4 h-4"}),a("settings.reset")]})]})]})]}),i.jsxs(Tt,{children:[i.jsx(Wn,{children:i.jsxs("h2",{className:"text-lg font-semibold text-white flex items-center gap-2",children:[i.jsx(F0,{className:"w-5 h-5"}),a("settings.appearance")]})}),i.jsxs(Pt,{className:"space-y-6",children:[i.jsxs("div",{className:`space-y-3 p-4 rounded-lg border ${u==="dark"?"border-bambu-green bg-bambu-green/5":"border-bambu-dark-tertiary"}`,children:[i.jsxs("h3",{className:"text-sm font-medium text-white flex items-center gap-2",children:[a("settings.darkMode"),u==="dark"&&i.jsx("span",{className:"text-xs text-bambu-green",children:a("settings.active")})]}),i.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[i.jsxs("div",{children:[i.jsx("label",{className:"block text-xs text-bambu-gray mb-1",children:a("settings.background")}),i.jsxs("select",{value:p,onChange:Se=>{_(Se.target.value),o(a("settings.toast.settingsSaved"),"success")},className:"w-full px-2 py-1.5 text-sm bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none",children:[i.jsx("option",{value:"neutral",children:a("settings.bgNeutral")}),i.jsx("option",{value:"warm",children:a("settings.bgWarm")}),i.jsx("option",{value:"cool",children:a("settings.bgCool")}),i.jsx("option",{value:"oled",children:a("settings.bgOled")}),i.jsx("option",{value:"slate",children:a("settings.bgSlate")}),i.jsx("option",{value:"forest",children:a("settings.bgForest")})]})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-xs text-bambu-gray mb-1",children:a("settings.accent")}),i.jsxs("select",{value:f,onChange:Se=>{k(Se.target.value),o(a("settings.toast.settingsSaved"),"success")},className:"w-full px-2 py-1.5 text-sm bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none",children:[i.jsx("option",{value:"green",children:a("settings.accentGreen")}),i.jsx("option",{value:"teal",children:a("settings.accentTeal")}),i.jsx("option",{value:"blue",children:a("settings.accentBlue")}),i.jsx("option",{value:"orange",children:a("settings.accentOrange")}),i.jsx("option",{value:"purple",children:a("settings.accentPurple")}),i.jsx("option",{value:"red",children:a("settings.accentRed")})]})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-xs text-bambu-gray mb-1",children:a("settings.style")}),i.jsxs("select",{value:m,onChange:Se=>{v(Se.target.value),o(a("settings.toast.settingsSaved"),"success")},className:"w-full px-2 py-1.5 text-sm bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none",children:[i.jsx("option",{value:"classic",children:a("settings.styleClassic")}),i.jsx("option",{value:"glow",children:a("settings.styleGlow")}),i.jsx("option",{value:"vibrant",children:a("settings.styleVibrant")})]})]})]})]}),i.jsxs("div",{className:`space-y-3 p-4 rounded-lg border ${u==="light"?"border-bambu-green bg-bambu-green/5":"border-bambu-dark-tertiary"}`,children:[i.jsxs("h3",{className:"text-sm font-medium text-white flex items-center gap-2",children:[a("settings.lightMode"),u==="light"&&i.jsx("span",{className:"text-xs text-bambu-green",children:a("settings.active")})]}),i.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[i.jsxs("div",{children:[i.jsx("label",{className:"block text-xs text-bambu-gray mb-1",children:a("settings.background")}),i.jsxs("select",{value:x,onChange:Se=>{C(Se.target.value),o(a("settings.toast.settingsSaved"),"success")},className:"w-full px-2 py-1.5 text-sm bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none",children:[i.jsx("option",{value:"neutral",children:a("settings.bgNeutral")}),i.jsx("option",{value:"warm",children:a("settings.bgWarm")}),i.jsx("option",{value:"cool",children:a("settings.bgCool")})]})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-xs text-bambu-gray mb-1",children:a("settings.accent")}),i.jsxs("select",{value:b,onChange:Se=>{T(Se.target.value),o(a("settings.toast.settingsSaved"),"success")},className:"w-full px-2 py-1.5 text-sm bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none",children:[i.jsx("option",{value:"green",children:a("settings.accentGreen")}),i.jsx("option",{value:"teal",children:a("settings.accentTeal")}),i.jsx("option",{value:"blue",children:a("settings.accentBlue")}),i.jsx("option",{value:"orange",children:a("settings.accentOrange")}),i.jsx("option",{value:"purple",children:a("settings.accentPurple")}),i.jsx("option",{value:"red",children:a("settings.accentRed")})]})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-xs text-bambu-gray mb-1",children:a("settings.style")}),i.jsxs("select",{value:y,onChange:Se=>{P(Se.target.value),o(a("settings.toast.settingsSaved"),"success")},className:"w-full px-2 py-1.5 text-sm bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none",children:[i.jsx("option",{value:"classic",children:a("settings.styleClassic")}),i.jsx("option",{value:"glow",children:a("settings.styleGlow")}),i.jsx("option",{value:"vibrant",children:a("settings.styleVibrant")})]})]})]})]}),i.jsx("p",{className:"text-xs text-bambu-gray",children:a("settings.themeToggleHint")})]})]}),i.jsxs(Tt,{children:[i.jsx(Wn,{children:i.jsx("h2",{className:"text-lg font-semibold text-white",children:a("settings.archiveSettings")})}),i.jsxs(Pt,{className:"space-y-4",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-white",children:a("settings.autoArchivePrints")}),i.jsx("p",{className:"text-sm text-bambu-gray",children:a("settings.autoArchiveDescription")})]}),i.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[i.jsx("input",{type:"checkbox",checked:N.auto_archive,onChange:Se=>Ht("auto_archive",Se.target.checked),className:"sr-only peer"}),i.jsx("div",{className:"w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green"})]})]}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-white",children:a("settings.saveThumbnails")}),i.jsx("p",{className:"text-sm text-bambu-gray",children:a("settings.saveThumbnailsDescription")})]}),i.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[i.jsx("input",{type:"checkbox",checked:N.save_thumbnails,onChange:Se=>Ht("save_thumbnails",Se.target.checked),className:"sr-only peer"}),i.jsx("div",{className:"w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green"})]})]}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-white",children:a("settings.captureFinishPhoto")}),i.jsx("p",{className:"text-sm text-bambu-gray",children:a("settings.captureFinishPhotoDescription")})]}),i.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[i.jsx("input",{type:"checkbox",checked:N.capture_finish_photo,onChange:Se=>Ht("capture_finish_photo",Se.target.checked),className:"sr-only peer"}),i.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"})]})]}),N.capture_finish_photo&&_n&&!_n.installed&&i.jsxs("div",{className:"flex items-start gap-2 p-3 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[i.jsx(En,{className:"w-5 h-5 text-yellow-500 flex-shrink-0 mt-0.5"}),i.jsxs("div",{className:"text-sm",children:[i.jsx("p",{className:"text-yellow-500 font-medium",children:a("settings.ffmpegNotInstalled")}),i.jsx("p",{className:"text-bambu-gray mt-1",children:a("settings.ffmpegRequired")})]})]})]})]})]}),i.jsxs("div",{className:"space-y-6 flex-1 lg:max-w-md",children:[i.jsxs(Tt,{children:[i.jsx(Wn,{children:i.jsxs("h2",{className:"text-lg font-semibold text-white flex items-center gap-2",children:[i.jsx(QF,{className:"w-5 h-5 text-bambu-green"}),a("settings.camera")]})}),i.jsxs(Pt,{className:"space-y-4",children:[i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:a("settings.cameraViewMode")}),i.jsxs("select",{value:N.camera_view_mode??"window",onChange:Se=>Ht("camera_view_mode",Se.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:[i.jsx("option",{value:"window",children:a("settings.newWindow")}),i.jsx("option",{value:"embedded",children:a("settings.embeddedOverlay")})]}),i.jsx("p",{className:"text-xs text-bambu-gray mt-1",children:N.camera_view_mode==="embedded"?a("settings.cameraOverlayDescription"):a("settings.cameraWindowDescription")})]}),i.jsxs("div",{className:"border-t border-bambu-dark-tertiary pt-4 mt-4",children:[i.jsx("h3",{className:"text-sm font-medium text-white mb-2",children:a("settings.externalCameras")}),i.jsx("p",{className:"text-xs text-bambu-gray mb-3",children:a("settings.externalCamerasDescription")}),vn&&vn.length>0?i.jsx("div",{className:"space-y-3",children:vn.map(Se=>i.jsxs("div",{className:"p-3 bg-bambu-dark rounded-lg",children:[i.jsxs("div",{className:"flex items-center justify-between mb-2",children:[i.jsx("span",{className:"text-white font-medium text-sm",children:Se.name}),i.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[i.jsx("input",{type:"checkbox",checked:Se.external_camera_enabled,onChange:Dt=>go(Se.id,{enabled:Dt.target.checked}),className:"sr-only peer"}),i.jsx("div",{className:"w-9 h-5 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:border-gray-300 after:border after:rounded-full after:h-4 after:w-4 after:transition-all peer-checked:bg-bambu-green"})]})]}),Se.external_camera_enabled&&i.jsxs("div",{className:"space-y-2 mt-2",children:[i.jsx("input",{type:"text",placeholder:Se.external_camera_type==="usb"?a("settings.cameraPlaceholderUsb"):a("settings.cameraPlaceholderUrl"),value:yi[Se.id]??Se.external_camera_url??"",onChange:Dt=>Vs(Se.id,Dt.target.value),className:"w-full px-3 py-2 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded text-white text-sm focus:border-bambu-green focus:outline-none"}),i.jsxs("div",{className:"flex gap-2",children:[i.jsxs("select",{value:Se.external_camera_type||"mjpeg",onChange:Dt=>go(Se.id,{type:Dt.target.value}),className:"flex-1 px-3 py-2 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded text-white text-sm focus:border-bambu-green focus:outline-none",children:[i.jsx("option",{value:"mjpeg",children:a("settings.cameraTypeMjpeg")}),i.jsx("option",{value:"rtsp",children:a("settings.cameraTypeRtsp")}),i.jsx("option",{value:"snapshot",children:a("settings.cameraTypeSnapshot")}),i.jsx("option",{value:"usb",children:a("settings.cameraTypeUsb")})]}),i.jsx(Fe,{size:"sm",variant:"secondary",onClick:()=>wr(Se.id,yi[Se.id]??Se.external_camera_url??"",Se.external_camera_type||"mjpeg"),disabled:Ie[Se.id]||!(yi[Se.id]??Se.external_camera_url),children:Ie[Se.id]?i.jsx(ct,{className:"w-4 h-4 animate-spin"}):a("settings.test")})]}),cn[Se.id]&&i.jsx("div",{className:`text-xs flex items-center gap-1 ${cn[Se.id]?.success?"text-green-500":"text-red-500"}`,children:cn[Se.id]?.success?i.jsxs(i.Fragment,{children:[i.jsx(fr,{className:"w-3 h-3"}),a("settings.connected"),cn[Se.id]?.resolution&&` (${cn[Se.id]?.resolution})`]}):i.jsxs(i.Fragment,{children:[i.jsx(qi,{className:"w-3 h-3"}),cn[Se.id]?.error||a("settings.toast.connectionFailed")]})})]})]},Se.id))}):i.jsx("p",{className:"text-xs text-bambu-gray italic",children:a("settings.noPrintersConfigured")})]})]})]}),i.jsxs(Tt,{children:[i.jsx(Wn,{children:i.jsx("h2",{className:"text-lg font-semibold text-white",children:a("settings.costTracking")})}),i.jsxs(Pt,{className:"space-y-4",children:[i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:a("settings.currency")}),i.jsx("select",{value:N.currency,onChange:Se=>Ht("currency",Se.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:X$e.map(Se=>i.jsx("option",{value:Se.code,children:Se.label},Se.code))})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:a("settings.defaultFilamentCost")}),i.jsxs("div",{className:"relative",children:[i.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-bambu-gray text-sm pointer-events-none",children:al(N.currency)}),i.jsx("input",{type:"number",step:"0.01",min:"0",value:N.default_filament_cost,onChange:Se=>Ht("default_filament_cost",parseFloat(Se.target.value)||0),style:{paddingLeft:`${Math.max(2,al(N.currency).length*.6+1)}rem`},className:"w-full pr-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none"})]})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:a("settings.electricityCost")}),i.jsxs("div",{className:"relative",children:[i.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-bambu-gray text-sm pointer-events-none",children:al(N.currency)}),i.jsx("input",{type:"number",step:"0.001",min:"0",value:N.energy_cost_per_kwh,onChange:Se=>Ht("energy_cost_per_kwh",parseFloat(Se.target.value)||0),style:{paddingLeft:`${Math.max(2,al(N.currency).length*.6+1)}rem`},className:"w-full pr-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none"})]})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:a("settings.energyDisplayMode")}),i.jsxs("select",{value:N.energy_tracking_mode||"total",onChange:Se=>Ht("energy_tracking_mode",Se.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:[i.jsx("option",{value:"print",children:a("settings.printsOnly")}),i.jsx("option",{value:"total",children:a("settings.totalConsumption")})]}),i.jsx("p",{className:"text-xs text-bambu-gray mt-1",children:N.energy_tracking_mode==="print"?a("settings.energyModePrintDescription"):a("settings.energyModeTotalDescription")})]})]})]}),i.jsxs(Tt,{children:[i.jsx(Wn,{children:i.jsxs("h2",{className:"text-lg font-semibold text-white flex items-center gap-2",children:[i.jsx(Es,{className:"w-5 h-5 text-bambu-green"}),a("settings.fileManager")]})}),i.jsxs(Pt,{className:"space-y-4",children:[i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:a("settings.createArchiveEntry")}),i.jsxs("select",{value:N.library_archive_mode??"ask",onChange:Se=>Ht("library_archive_mode",Se.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:[i.jsx("option",{value:"always",children:a("settings.archiveMode.always")}),i.jsx("option",{value:"never",children:a("settings.archiveMode.never")}),i.jsx("option",{value:"ask",children:a("settings.archiveMode.ask")})]}),i.jsx("p",{className:"text-xs text-bambu-gray mt-1",children:a("settings.createArchiveEntryDescription")})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:a("settings.lowDiskSpaceWarning")}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("input",{type:"number",min:"0.5",max:"100",step:"0.5",value:N.library_disk_warning_gb??5,onChange:Se=>Ht("library_disk_warning_gb",parseFloat(Se.target.value)||5),className:"w-24 px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none"}),i.jsx("span",{className:"text-bambu-gray",children:"GB"})]}),i.jsx("p",{className:"text-xs text-bambu-gray mt-1",children:a("settings.lowDiskSpaceDescription")})]})]})]})]}),i.jsxs("div",{className:"space-y-6 flex-1 lg:max-w-sm",children:[i.jsx(hJe,{}),i.jsxs(Tt,{children:[i.jsx(Wn,{children:i.jsx("h2",{className:"text-lg font-semibold text-white",children:a("settings.updates")})}),i.jsxs(Pt,{className:"space-y-4",children:[i.jsx("p",{className:"text-xs font-medium text-bambu-gray uppercase tracking-wider",children:a("settings.printerFirmware")}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-white",children:a("settings.checkPrinterFirmware")}),i.jsx("p",{className:"text-sm text-bambu-gray",children:a("settings.checkFirmwareDescription")})]}),i.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[i.jsx("input",{type:"checkbox",checked:N.check_printer_firmware??!0,onChange:Se=>Ht("check_printer_firmware",Se.target.checked),className:"sr-only peer"}),i.jsx("div",{className:"w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green"})]})]}),i.jsx("div",{className:"border-t border-bambu-dark-tertiary pt-4",children:i.jsx("p",{className:"text-xs font-medium text-bambu-gray uppercase tracking-wider mb-4",children:a("settings.bambuddySoftware")})}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-white",children:a("settings.checkForUpdatesLabel")}),i.jsx("p",{className:"text-sm text-bambu-gray",children:a("settings.autoCheckDescription")})]}),i.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[i.jsx("input",{type:"checkbox",checked:N.check_updates,onChange:Se=>Ht("check_updates",Se.target.checked),className:"sr-only peer"}),i.jsx("div",{className:"w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green"})]})]}),i.jsxs("div",{className:`flex items-center justify-between ${N.check_updates?"":"opacity-50"}`,children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-white",children:a("settings.includeBetaUpdates")}),i.jsx("p",{className:"text-sm text-bambu-gray",children:a("settings.includeBetaUpdatesDesc")})]}),i.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[i.jsx("input",{type:"checkbox",checked:N.include_beta_updates??!1,onChange:Se=>Ht("include_beta_updates",Se.target.checked),disabled:!N.check_updates,className:"sr-only peer"}),i.jsx("div",{className:"w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green"})]})]}),i.jsxs("div",{children:[i.jsxs("div",{className:"flex items-center justify-between mb-2",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-white",children:a("settings.currentVersion")}),i.jsxs("p",{className:"text-sm text-bambu-gray",children:["v",vr?.version||"..."]})]}),i.jsxs(Fe,{variant:"secondary",size:"sm",onClick:()=>lr(),disabled:ci,children:[ci?i.jsx(ct,{className:"w-4 h-4 animate-spin"}):i.jsx(_r,{className:"w-4 h-4"}),a("settings.checkNow")]})]}),wn?.update_available?i.jsxs("div",{className:"mt-4 p-3 bg-bambu-green/10 border border-bambu-green/30 rounded-lg",children:[i.jsxs("div",{className:"flex items-start justify-between",children:[i.jsxs("div",{children:[i.jsxs("p",{className:"text-bambu-green font-medium",children:["Update available: v",wn.latest_version]}),wn.release_name&&wn.release_name!==wn.latest_version&&i.jsx("p",{className:"text-sm text-bambu-gray mt-1",children:wn.release_name})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[wn.release_notes&&i.jsx("button",{onClick:()=>_e(!0),className:"text-bambu-gray hover:text-white transition-colors text-sm underline",children:a("settings.releaseNotes")}),wn.release_url&&i.jsx("a",{href:wn.release_url,target:"_blank",rel:"noopener noreferrer",className:"text-bambu-gray hover:text-white transition-colors",title:a("settings.viewReleaseOnGitHub"),children:i.jsx(ei,{className:"w-4 h-4"})})]})]}),zn?.status==="downloading"||zn?.status==="installing"?i.jsxs("div",{className:"mt-3",children:[i.jsxs("div",{className:"flex items-center gap-2 text-sm text-bambu-gray",children:[i.jsx(ct,{className:"w-4 h-4 animate-spin"}),i.jsx("span",{children:zn.message})]}),i.jsx("div",{className:"mt-2 w-full bg-bambu-dark-tertiary rounded-full h-2",children:i.jsx("div",{className:"bg-bambu-green h-2 rounded-full transition-all duration-300",style:{width:`${zn.progress}%`}})})]}):zn?.status==="complete"?i.jsx("div",{className:"mt-3 p-2 bg-bambu-green/20 rounded text-sm text-bambu-green",children:zn.message}):zn?.status==="error"?i.jsx("div",{className:"mt-3 p-2 bg-red-500/20 rounded text-sm text-red-400",children:zn.error||zn.message}):wn?.is_docker?i.jsxs("div",{className:"mt-3 p-3 bg-bambu-dark-tertiary rounded-lg",children:[i.jsx("p",{className:"text-sm text-bambu-gray mb-2",children:a("settings.updateViaDocker")}),i.jsx("code",{className:"block text-xs bg-bambu-dark p-2 rounded text-bambu-green font-mono",children:"docker compose pull && docker compose up -d"})]}):i.jsxs(Fe,{className:"mt-3",onClick:()=>Dl.mutate(),disabled:Dl.isPending,children:[Dl.isPending?i.jsx(ct,{className:"w-4 h-4 animate-spin"}):i.jsx(pi,{className:"w-4 h-4"}),a("settings.installUpdate")]})]}):wn?.error?i.jsx("div",{className:"mt-2 p-2 bg-red-500/10 border border-red-500/30 rounded text-sm text-red-400",children:a("settings.failedToCheckUpdates",{error:wn.error})}):wn&&!wn.update_available?i.jsx("p",{className:"mt-2 text-sm text-bambu-gray",children:a("settings.latestVersionRunning")}):null]})]})]}),i.jsxs(Tt,{children:[i.jsx(Wn,{children:i.jsx("h2",{className:"text-lg font-semibold text-white",children:a("settings.dataManagement")})}),i.jsxs(Pt,{className:"space-y-4",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-white",children:a("settings.clearNotificationLogs")}),i.jsx("p",{className:"text-sm text-bambu-gray",children:a("settings.clearNotificationLogsDescription")})]}),i.jsxs(Fe,{variant:"secondary",size:"sm",onClick:()=>F(!0),children:[i.jsx(Qt,{className:"w-4 h-4"}),a("common.clear")]})]}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-white",children:a("settings.resetUiPreferences")}),i.jsx("p",{className:"text-sm text-bambu-gray",children:a("settings.resetUiPreferencesDescription")})]}),i.jsxs(Fe,{variant:"secondary",size:"sm",onClick:()=>ve(!0),children:[i.jsx(Qt,{className:"w-4 h-4"}),a("settings.reset")]})]}),i.jsxs("div",{className:"pt-4 border-t border-bambu-dark-tertiary",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-white",children:a("settings.storageUsage","Storage Usage")}),i.jsx("p",{className:"text-sm text-bambu-gray",children:a("settings.storageUsageDescription","Breakdown of data usage by category")})]}),i.jsxs(Fe,{variant:"secondary",size:"sm",onClick:Ze,disabled:et||xe,children:[i.jsx(_r,{className:`w-4 h-4 ${et||xe?"animate-spin":""}`}),a("common.refresh","Refresh")]})]}),i.jsx("div",{className:"mt-3",children:We?i.jsxs("div",{className:"flex items-center gap-2 text-sm text-bambu-gray",children:[i.jsx(ct,{className:"w-4 h-4 animate-spin"}),a("common.loading","Loading")]}):Te?i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"w-full h-3 bg-bambu-dark rounded-full overflow-hidden flex",children:Te.categories.filter(Se=>Se.bytes>0).map((Se,Dt)=>i.jsx("div",{className:`${MK(Se.key,Dt)} h-full`,style:{width:`${Se.percent_of_total}%`},title:`${Se.label}: ${Se.formatted}`},Se.key))}),i.jsx("div",{className:"mt-3 flex flex-wrap gap-3",children:Te.categories.filter(Se=>Se.bytes>0).map((Se,Dt)=>i.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[i.jsx("span",{className:`w-3 h-3 rounded-full ${MK(Se.key,Dt)}`}),i.jsx("span",{className:"text-bambu-gray",children:Se.label}),i.jsx("span",{className:"text-white",children:Se.formatted}),i.jsxs("span",{className:"text-bambu-gray",children:["(",Se.percent_of_total.toFixed(1),"%)"]})]},Se.key))}),i.jsxs("div",{className:"mt-2 text-xs text-bambu-gray",children:[a("settings.storageUsageTotal","Total"),": ",i.jsx("span",{className:"text-white",children:Te.total_formatted}),Te.scan_errors>0&&i.jsxs("span",{className:"ml-2 text-amber-400",children:[a("settings.storageUsageErrors","Scan errors"),": ",Te.scan_errors]})]}),Te.other_breakdown?.length>0&&i.jsxs("div",{className:"mt-4",children:[i.jsx("p",{className:"text-xs text-bambu-gray mb-2",children:a("settings.storageUsageOtherBreakdown","Other breakdown")}),i.jsx("div",{className:"space-y-2",children:Te.other_breakdown.map(Se=>i.jsxs("div",{className:"flex items-center justify-between text-xs",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"text-white",children:Se.label}),i.jsx("span",{className:`px-2 py-0.5 rounded-full border ${Se.kind==="system"?"border-slate-500 text-slate-300":"border-bambu-green text-bambu-green"}`,children:Se.kind==="system"?a("settings.storageUsageSystem","System"):a("settings.storageUsageData","Data")})]}),i.jsxs("div",{className:"flex items-center gap-2 text-bambu-gray",children:[i.jsx("span",{className:"text-white",children:Se.formatted}),i.jsxs("span",{children:["(",Se.percent_of_total.toFixed(1),"%)"]})]})]},`${Se.bucket}-${Se.kind}`))})]})]}):i.jsx("p",{className:"text-sm text-bambu-gray",children:a("settings.storageUsageUnavailable","Storage usage data is unavailable")})})]}),i.jsxs("div",{className:"flex items-center justify-between pt-4 border-t border-bambu-dark-tertiary",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-white",children:a("settings.backupRestore")}),i.jsx("p",{className:"text-sm text-bambu-gray",children:a("settings.backupRestoreDescription")})]}),i.jsxs(Fe,{variant:"secondary",size:"sm",onClick:()=>I("backup"),children:[i.jsx(Ic,{className:"w-4 h-4"}),a("settings.goToBackup")]})]})]})]})]})]}),q==="network"&&N&&i.jsxs("div",{className:"flex flex-col lg:flex-row gap-6",children:[i.jsxs("div",{className:"flex-1 lg:max-w-xl space-y-4",children:[i.jsxs(Tt,{children:[i.jsx(Wn,{children:i.jsxs("h2",{className:"text-lg font-semibold text-white flex items-center gap-2",children:[i.jsx($m,{className:"w-5 h-5 text-blue-400"}),a("settings.externalUrl")]})}),i.jsxs(Pt,{className:"space-y-4",children:[i.jsx("p",{className:"text-sm text-bambu-gray",children:a("settings.externalUrlDescription")}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:a("settings.bambuddyUrl")}),i.jsx("input",{type:"text",value:N.external_url??"",onChange:Se=>Ht("external_url",Se.target.value),placeholder:"http://192.168.1.100:8000",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"}),i.jsx("p",{className:"text-xs text-bambu-gray mt-1",children:a("settings.externalUrlHint")})]})]})]}),i.jsxs(Tt,{children:[i.jsx(Wn,{children:i.jsxs("h2",{className:"text-lg font-semibold text-white flex items-center gap-2",children:[i.jsx(_r,{className:"w-5 h-5 text-blue-400"}),a("settings.ftpRetry")]})}),i.jsxs(Pt,{className:"space-y-4",children:[i.jsx("p",{className:"text-sm text-bambu-gray",children:a("settings.ftpRetryDescription")}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-white",children:a("settings.enableRetry")}),i.jsx("p",{className:"text-sm text-bambu-gray",children:a("settings.autoRetryDescription")})]}),i.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[i.jsx("input",{type:"checkbox",checked:N.ftp_retry_enabled??!0,onChange:Se=>Ht("ftp_retry_enabled",Se.target.checked),className:"sr-only peer"}),i.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"})]})]}),N.ftp_retry_enabled&&i.jsxs("div",{className:"space-y-4 pt-2 border-t border-bambu-dark-tertiary",children:[i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:a("settings.retryAttempts")}),i.jsxs("div",{className:"relative w-44",children:[i.jsx("select",{value:N.ftp_retry_count??3,onChange:Se=>Ht("ftp_retry_count",parseInt(Se.target.value)),className:"w-full px-3 py-2 pr-10 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none appearance-none cursor-pointer",children:[1,2,3,4,5,6,7,8,9,10].map(Se=>i.jsx("option",{value:Se,children:a("settings.time",{count:Se})},Se))}),i.jsx(In,{className:"absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray pointer-events-none"})]})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:a("settings.retryDelay")}),i.jsxs("div",{className:"relative w-44",children:[i.jsx("select",{value:N.ftp_retry_delay??2,onChange:Se=>Ht("ftp_retry_delay",parseInt(Se.target.value)),className:"w-full px-3 py-2 pr-10 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none appearance-none cursor-pointer",children:[1,2,3,5,10,15,20,30].map(Se=>i.jsx("option",{value:Se,children:a("settings.second",{count:Se})},Se))}),i.jsx(In,{className:"absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray pointer-events-none"})]})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:a("settings.connectionTimeout")}),i.jsxs("div",{className:"relative w-44",children:[i.jsx("select",{value:N.ftp_timeout??30,onChange:Se=>Ht("ftp_timeout",parseInt(Se.target.value)),className:"w-full px-3 py-2 pr-10 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none appearance-none cursor-pointer",children:[10,15,20,30,45,60,90,120,180,300].map(Se=>i.jsx("option",{value:Se,children:a("settings.nSeconds",{count:Se})},Se))}),i.jsx(In,{className:"absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray pointer-events-none"})]}),i.jsx("p",{className:"text-xs text-bambu-gray mt-1",children:a("settings.increaseForWeakWifi")})]})]})]})]})]}),i.jsxs("div",{className:"flex-1 lg:max-w-xl space-y-4",children:[i.jsxs(Tt,{children:[i.jsx(Wn,{children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("h2",{className:"text-lg font-semibold text-white flex items-center gap-2",children:[i.jsx(D0,{className:"w-5 h-5 text-bambu-green"}),a("settings.homeAssistant")]}),N.ha_enabled&&Xt&&i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:`w-2.5 h-2.5 rounded-full ${Xt.success?"bg-green-400":"bg-red-400"}`}),i.jsx("span",{className:`text-sm ${Xt.success?"text-green-400":"text-red-400"}`,children:Xt.success?a("settings.connected"):a("settings.disconnected")})]})]})}),i.jsxs(Pt,{className:"space-y-4",children:[i.jsx("p",{className:"text-sm text-bambu-gray",children:a("settings.homeAssistantFullDescription")}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"flex-1",children:[i.jsx("p",{className:"text-white",children:a("settings.enableHomeAssistant")}),i.jsx("p",{className:"text-xs text-bambu-gray",children:a("settings.homeAssistantDescription")}),N.ha_env_managed&&i.jsxs("div",{className:"flex items-center gap-1 mt-1",children:[i.jsx(Jh,{className:"w-3 h-3 text-bambu-green"}),i.jsx("span",{className:"text-xs text-bambu-green",children:a("settings.autoEnabledViaEnv")})]})]}),i.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[i.jsx("input",{type:"checkbox",checked:N.ha_enabled??!1,onChange:Se=>Ht("ha_enabled",Se.target.checked),disabled:N.ha_env_managed,className:"sr-only peer"}),i.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 ${N.ha_env_managed?"opacity-60 cursor-not-allowed":""}`})]})]}),N.ha_enabled&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{children:[i.jsxs("label",{className:"block text-sm text-bambu-gray mb-1",children:[a("settings.homeAssistantUrl"),N.ha_url_from_env&&i.jsx("span",{className:"ml-2 text-xs text-bambu-green",children:a("settings.environmentManagedLabel")})]}),i.jsxs("div",{className:"relative",children:[i.jsx("input",{type:"text",value:N.ha_url??"",onChange:Se=>Ht("ha_url",Se.target.value),placeholder:"http://192.168.1.100:8123",disabled:N.ha_url_from_env,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 ${N.ha_url_from_env?"opacity-60 cursor-not-allowed":""}`}),N.ha_url_from_env&&i.jsx(Jh,{className:"absolute right-3 top-2.5 w-4 h-4 text-bambu-gray"})]}),N.ha_url_from_env&&i.jsx("p",{className:"text-xs text-bambu-gray mt-1",children:a("settings.urlFromEnvReadOnly")})]}),i.jsxs("div",{children:[i.jsxs("label",{className:"block text-sm text-bambu-gray mb-1",children:[a("settings.longLivedAccessToken"),N.ha_token_from_env&&i.jsx("span",{className:"ml-2 text-xs text-bambu-green",children:a("settings.environmentManagedLabel")})]}),i.jsxs("div",{className:"relative",children:[i.jsx("input",{type:"password",value:N.ha_token??"",onChange:Se=>Ht("ha_token",Se.target.value),placeholder:"eyJ0eXAiOiJKV1QiLC...",disabled:N.ha_token_from_env,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 ${N.ha_token_from_env?"opacity-60 cursor-not-allowed":""}`}),N.ha_token_from_env&&i.jsx(Jh,{className:"absolute right-3 top-2.5 w-4 h-4 text-bambu-gray"})]}),N.ha_token_from_env?i.jsx("p",{className:"text-xs text-bambu-gray mt-1",children:a("settings.tokenFromEnvReadOnly")}):i.jsx("p",{className:"text-xs text-bambu-gray mt-1",children:a("settings.haTokenHint")})]}),N.ha_url&&N.ha_token&&i.jsx("div",{className:"pt-2 border-t border-bambu-dark-tertiary",children:i.jsxs(Fe,{variant:"secondary",size:"sm",disabled:nn,onClick:async()=>{on(!0),$t(null);try{const Se=await be.testHAConnection(N.ha_url,N.ha_token);$t(Se)}catch(Se){$t({success:!1,message:null,error:Se instanceof Error?Se.message:a("common.unknownError")})}finally{on(!1)}},children:[nn?i.jsx(ct,{className:"w-4 h-4 animate-spin"}):i.jsx(hb,{className:"w-4 h-4"}),a("settings.testConnection")]})})]})]})]}),i.jsxs(Tt,{children:[i.jsx(Wn,{children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("h2",{className:"text-lg font-semibold text-white flex items-center gap-2",children:[i.jsx(hb,{className:"w-5 h-5 text-blue-400"}),a("settings.mqttPublishing")]}),tr?.enabled&&i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:`w-2.5 h-2.5 rounded-full ${tr.connected?"bg-green-400":"bg-red-400"}`}),i.jsx("span",{className:`text-sm ${tr.connected?"text-green-400":"text-red-400"}`,children:tr.connected?a("settings.connected"):a("settings.disconnected")})]})]})}),i.jsxs(Pt,{className:"space-y-4",children:[i.jsx("p",{className:"text-sm text-bambu-gray",children:a("settings.mqttDescription")}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-white",children:a("settings.enableMqtt")}),i.jsx("p",{className:"text-sm text-bambu-gray",children:a("settings.mqttEnableDescription")})]}),i.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[i.jsx("input",{type:"checkbox",checked:N.mqtt_enabled??!1,onChange:Se=>Ht("mqtt_enabled",Se.target.checked),className:"sr-only peer"}),i.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"})]})]}),N.mqtt_enabled&&i.jsxs("div",{className:"space-y-4 pt-2 border-t border-bambu-dark-tertiary",children:[i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:a("settings.brokerHostname")}),i.jsx("input",{type:"text",value:N.mqtt_broker??"",onChange:Se=>Ht("mqtt_broker",Se.target.value),placeholder:"mqtt.example.com or 192.168.1.100",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"})]}),i.jsxs("div",{className:"flex items-end gap-4",children:[i.jsxs("div",{className:"flex-1",children:[i.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:a("settings.port")}),i.jsx("input",{type:"number",min:"1",max:"65535",value:N.mqtt_port??1883,onChange:Se=>Ht("mqtt_port",Math.min(65535,Math.max(1,parseInt(Se.target.value)||1883))),className:"w-24 px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none"})]}),i.jsxs("div",{className:"flex items-center gap-3 pb-2",children:[i.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[i.jsx("input",{type:"checkbox",checked:N.mqtt_use_tls??!1,onChange:Se=>{const Dt=Se.target.checked;Ht("mqtt_use_tls",Dt);const Cn=N.mqtt_port??1883;Dt&&Cn===1883?Ht("mqtt_port",8883):!Dt&&Cn===8883&&Ht("mqtt_port",1883)},className:"sr-only peer"}),i.jsx("div",{className:"w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green"})]}),i.jsx("span",{className:"text-white text-sm",children:a("settings.useTls")})]})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:a("settings.usernameOptional")}),i.jsx("input",{type:"text",value:N.mqtt_username??"",onChange:Se=>Ht("mqtt_username",Se.target.value),placeholder:a("settings.leaveEmptyForAnonymous"),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"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:a("settings.passwordOptional")}),i.jsx("input",{type:"password",value:N.mqtt_password??"",onChange:Se=>Ht("mqtt_password",Se.target.value),placeholder:a("settings.leaveEmptyForAnonymous"),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"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:a("settings.topicPrefix")}),i.jsx("input",{type:"text",value:N.mqtt_topic_prefix??"bambuddy",onChange:Se=>Ht("mqtt_topic_prefix",Se.target.value),placeholder:"bambuddy",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"}),i.jsx("p",{className:"text-xs text-bambu-gray mt-1",children:a("settings.topicPrefixHint",{prefix:N.mqtt_topic_prefix||"bambuddy"})})]}),tr&&i.jsx("div",{className:"pt-3 mt-3 border-t border-bambu-dark-tertiary",children:i.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[i.jsx("span",{className:`w-2 h-2 rounded-full ${tr.connected?"bg-green-400":"bg-red-400"}`}),i.jsx("span",{className:"text-bambu-gray",children:tr.connected?i.jsxs(i.Fragment,{children:[a("settings.mqttConnectedTo")," ",i.jsxs("span",{className:"text-white",children:[tr.broker,":",tr.port]})]}):a("settings.spoolmanDisconnected")})]})})]})]})]})]}),i.jsx("div",{className:"flex-1 lg:max-w-md space-y-4",children:i.jsxs(Tt,{children:[i.jsx(Wn,{children:i.jsxs("h2",{className:"text-lg font-semibold text-white flex items-center gap-2",children:[i.jsx(MD,{className:"w-5 h-5 text-orange-400"}),a("settings.prometheusMetrics")]})}),i.jsxs(Pt,{className:"space-y-4",children:[i.jsx("p",{className:"text-sm text-bambu-gray",children:a("settings.prometheusEndpointDescription")}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-white",children:a("settings.enableMetricsEndpoint")}),i.jsx("p",{className:"text-xs text-bambu-gray",children:a("settings.prometheusDescription")})]}),i.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[i.jsx("input",{type:"checkbox",checked:N.prometheus_enabled??!1,onChange:Se=>Ht("prometheus_enabled",Se.target.checked),className:"sr-only peer"}),i.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"})]})]}),N.prometheus_enabled&&i.jsxs("div",{className:"space-y-4 pt-2 border-t border-bambu-dark-tertiary",children:[i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:a("settings.bearerTokenOptional")}),i.jsx("input",{type:"password",value:N.prometheus_token??"",onChange:Se=>Ht("prometheus_token",Se.target.value),placeholder:a("settings.leaveEmptyForNoAuth"),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"}),i.jsx("p",{className:"text-xs text-bambu-gray mt-1",children:a("settings.bearerTokenHint")})]}),i.jsxs("div",{className:"pt-2 border-t border-bambu-dark-tertiary",children:[i.jsx("p",{className:"text-sm text-white mb-2",children:a("settings.availableMetrics")}),i.jsxs("div",{className:"text-xs text-bambu-gray space-y-1",children:[i.jsxs("p",{children:[i.jsx("code",{className:"text-orange-400",children:"bambuddy_printer_connected"})," - ",a("settings.metricsConnectionStatus")]}),i.jsxs("p",{children:[i.jsx("code",{className:"text-orange-400",children:"bambuddy_printer_state"})," - ",a("settings.metricsPrinterState")]}),i.jsxs("p",{children:[i.jsx("code",{className:"text-orange-400",children:"bambuddy_print_progress"})," - ",a("settings.metricsPrintProgress")]}),i.jsxs("p",{children:[i.jsx("code",{className:"text-orange-400",children:"bambuddy_bed_temp_celsius"})," - ",a("settings.metricsBedTemp")]}),i.jsxs("p",{children:[i.jsx("code",{className:"text-orange-400",children:"bambuddy_nozzle_temp_celsius"})," - ",a("settings.metricsNozzleTemp")]}),i.jsxs("p",{children:[i.jsx("code",{className:"text-orange-400",children:"bambuddy_prints_total"})," - ",a("settings.metricsPrintsTotal")]}),i.jsx("p",{className:"text-bambu-gray/70 italic",children:a("settings.metricsMore")})]})]})]})]})]})})]}),Xt&&i.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:i.jsxs("div",{className:"bg-bambu-dark-secondary rounded-lg p-6 max-w-md w-full mx-4",children:[i.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[Xt.success?i.jsx(fr,{className:"w-8 h-8 text-green-400"}):i.jsx(qi,{className:"w-8 h-8 text-red-400"}),i.jsx("h3",{className:"text-lg font-medium text-white",children:Xt.success?a("settings.connectionSuccessful"):a("settings.connectionFailed")})]}),i.jsx("p",{className:"text-bambu-gray mb-6",children:Xt.success?Xt.message||a("settings.haConnectionSuccess"):Xt.error||a("settings.haConnectionFailed")}),i.jsx("div",{className:"flex justify-end",children:i.jsx(Fe,{variant:"primary",onClick:()=>$t(null),children:a("settings.ok")})})]})}),q==="plugs"&&i.jsxs("div",{className:"max-w-4xl",children:[i.jsxs("div",{className:"flex items-start justify-between mb-6",children:[i.jsxs("div",{children:[i.jsxs("h2",{className:"text-lg font-semibold text-white flex items-center gap-2",children:[i.jsx(fl,{className:"w-5 h-5 text-bambu-green"}),a("settings.smartPlugs")]}),i.jsx("p",{className:"text-sm text-bambu-gray mt-1",children:a("settings.smartPlugsDescription")})]}),i.jsxs("div",{className:"flex items-center gap-2 pt-1 shrink-0",children:[Le&&Le.filter(Se=>Se.enabled).length>1&&i.jsxs(i.Fragment,{children:[i.jsxs(Fe,{variant:"secondary",size:"sm",className:"whitespace-nowrap",onClick:()=>de("on"),disabled:bt.isPending,title:a("settings.turnAllPlugsOn"),children:[bt.isPending?i.jsx(ct,{className:"w-4 h-4 animate-spin"}):i.jsx(wu,{className:"w-4 h-4 text-bambu-green"}),a("settings.allOn")]}),i.jsxs(Fe,{variant:"secondary",size:"sm",className:"whitespace-nowrap",onClick:()=>de("off"),disabled:bt.isPending,title:a("settings.turnAllPlugsOff"),children:[bt.isPending?i.jsx(ct,{className:"w-4 h-4 animate-spin"}):i.jsx(fC,{className:"w-4 h-4 text-red-400"}),a("settings.allOff")]})]}),i.jsxs(Fe,{className:"whitespace-nowrap",onClick:()=>{U(null),D(!0)},children:[i.jsx(sr,{className:"w-4 h-4"}),a("settings.addSmartPlug")]})]})]}),Le&&Le.length>0&&i.jsxs(Tt,{className:"mb-6",children:[i.jsx(Wn,{children:i.jsxs("h3",{className:"text-base font-semibold text-white flex items-center gap-2",children:[i.jsx(rc,{className:"w-4 h-4 text-yellow-400"}),a("settings.energySummary"),tt&&i.jsx(ct,{className:"w-4 h-4 animate-spin text-bambu-gray ml-2"})]})}),i.jsx(Pt,{children:st?i.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[i.jsxs("div",{className:"bg-bambu-dark rounded-lg p-3",children:[i.jsxs("div",{className:"flex items-center gap-2 text-bambu-gray text-xs mb-1",children:[i.jsx(rc,{className:"w-3 h-3"}),a("settings.currentPower")]}),i.jsxs("div",{className:"text-xl font-bold text-white",children:[st.totalPower.toFixed(1),i.jsx("span",{className:"text-sm font-normal text-bambu-gray ml-1",children:"W"})]}),i.jsx("div",{className:"text-xs text-bambu-gray mt-1",children:a("settings.plugsOnline",{reachable:st.reachableCount,total:st.totalPlugs})})]}),i.jsxs("div",{className:"bg-bambu-dark rounded-lg p-3",children:[i.jsxs("div",{className:"flex items-center gap-2 text-bambu-gray text-xs mb-1",children:[i.jsx(Xr,{className:"w-3 h-3"}),a("settings.today")]}),i.jsxs("div",{className:"text-xl font-bold text-white",children:[st.totalToday.toFixed(3),i.jsx("span",{className:"text-sm font-normal text-bambu-gray ml-1",children:"kWh"})]}),(N?.energy_cost_per_kwh??0)>0&&i.jsxs("div",{className:"text-xs text-bambu-gray mt-1",children:["~",(st.totalToday*(N?.energy_cost_per_kwh??0)).toFixed(2)," ",al(N?.currency||"USD")]})]}),i.jsxs("div",{className:"bg-bambu-dark rounded-lg p-3",children:[i.jsxs("div",{className:"flex items-center gap-2 text-bambu-gray text-xs mb-1",children:[i.jsx(MD,{className:"w-3 h-3"}),a("settings.yesterday")]}),i.jsxs("div",{className:"text-xl font-bold text-white",children:[st.totalYesterday.toFixed(3),i.jsx("span",{className:"text-sm font-normal text-bambu-gray ml-1",children:"kWh"})]}),(N?.energy_cost_per_kwh??0)>0&&i.jsxs("div",{className:"text-xs text-bambu-gray mt-1",children:["~",(st.totalYesterday*(N?.energy_cost_per_kwh??0)).toFixed(2)," ",al(N?.currency||"USD")]})]}),i.jsxs("div",{className:"bg-bambu-dark rounded-lg p-3",children:[i.jsxs("div",{className:"flex items-center gap-2 text-bambu-gray text-xs mb-1",children:[i.jsx(H1,{className:"w-3 h-3"}),a("settings.total")]}),i.jsxs("div",{className:"text-xl font-bold text-white",children:[st.totalLifetime.toFixed(1),i.jsx("span",{className:"text-sm font-normal text-bambu-gray ml-1",children:"kWh"})]}),(N?.energy_cost_per_kwh??0)>0&&i.jsxs("div",{className:"text-xs text-bambu-gray mt-1",children:["~",(st.totalLifetime*(N?.energy_cost_per_kwh??0)).toFixed(2)," ",al(N?.currency||"USD")]})]})]}):tt?null:i.jsx("p",{className:"text-sm text-bambu-gray",children:a("settings.enablePlugsForSummary")})})]}),mt?i.jsx("div",{className:"flex justify-center py-12",children:i.jsx(ct,{className:"w-8 h-8 text-bambu-green animate-spin"})}):Le&&Le.length>0?i.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:Le.map(Se=>i.jsx(JZe,{plug:Se,onEdit:Dt=>{U(Dt),D(!0)}},Se.id))}):i.jsx(Tt,{children:i.jsx(Pt,{className:"py-12",children:i.jsxs("div",{className:"text-center text-bambu-gray",children:[i.jsx(fl,{className:"w-16 h-16 mx-auto mb-4 opacity-30"}),i.jsx("p",{className:"text-lg font-medium text-white mb-2",children:a("settings.noSmartPlugsTitle")}),i.jsx("p",{className:"text-sm mb-4",children:a("settings.noSmartPlugsDescription")}),i.jsxs(Fe,{onClick:()=>{U(null),D(!0)},children:[i.jsx(sr,{className:"w-4 h-4"}),a("settings.addFirstSmartPlug")]})]})})})]}),q==="notifications"&&i.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-8",children:[i.jsxs("div",{children:[i.jsxs("div",{className:"flex items-center justify-between mb-4",children:[i.jsxs("h2",{className:"text-lg font-semibold text-white flex items-center gap-2",children:[i.jsx(ub,{className:"w-5 h-5 text-bambu-green"}),a("settings.providers")]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs(Fe,{size:"sm",variant:"secondary",onClick:()=>ge(!0),children:[i.jsx(Fv,{className:"w-4 h-4"}),a("settings.log")]}),Nt&&Nt.length>0&&i.jsxs(Fe,{size:"sm",variant:"secondary",onClick:()=>{rd(null),Rl.mutate()},disabled:Rl.isPending,children:[Rl.isPending?i.jsx(ct,{className:"w-4 h-4 animate-spin"}):i.jsx(gC,{className:"w-4 h-4"}),a("settings.testAll")]}),i.jsxs(Fe,{size:"sm",onClick:()=>{re(null),L(!0)},children:[i.jsx(sr,{className:"w-4 h-4"}),a("settings.addNotificationProvider")]})]})]}),i.jsx(Tt,{className:"mb-4",children:i.jsx(Pt,{className:"py-3",children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-white text-sm font-medium",children:a("settings.notificationLanguage")}),i.jsx("p",{className:"text-xs text-bambu-gray",children:a("settings.notificationLanguageDescription")})]}),i.jsx("select",{value:N.notification_language||"en",onChange:Se=>Ht("notification_language",Se.target.value),className:"px-2 py-1.5 bg-bambu-dark border border-bambu-dark-tertiary rounded text-white text-sm focus:outline-none focus:ring-1 focus:ring-bambu-green",children:LB.map(Se=>i.jsx("option",{value:Se.code,children:Se.nativeName},Se.code))})]})})}),i.jsx(Tt,{className:"mb-4",children:i.jsx(Pt,{className:"py-3",children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-white text-sm font-medium",children:a("settings.bedCooledThreshold")}),i.jsx("p",{className:"text-xs text-bambu-gray",children:a("settings.bedCooledThresholdDescription")})]}),i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx("input",{type:"number",min:20,max:80,step:1,value:N.bed_cooled_threshold??35,onChange:Se=>Ht("bed_cooled_threshold",Number(Se.target.value)),className:"w-16 px-2 py-1.5 bg-bambu-dark border border-bambu-dark-tertiary rounded text-white text-sm text-center focus:outline-none focus:ring-1 focus:ring-bambu-green"}),i.jsx("span",{className:"text-sm text-bambu-gray",children:"°C"})]})]})})}),ka&&i.jsx(Tt,{className:"mb-4",children:i.jsxs(Pt,{className:"py-3",children:[i.jsxs("div",{className:"flex items-center justify-between mb-2",children:[i.jsx("span",{className:"text-sm font-medium text-white",children:a("settings.testResults")}),i.jsx("button",{onClick:()=>rd(null),className:"text-bambu-gray hover:text-white text-xs",children:a("common.dismiss")})]}),i.jsxs("div",{className:"flex items-center gap-4 text-sm mb-2",children:[i.jsxs("span",{className:"flex items-center gap-1 text-bambu-green",children:[i.jsx(fr,{className:"w-4 h-4"}),a("settings.testPassedCount",{count:ka.success})]}),ka.failed>0&&i.jsxs("span",{className:"flex items-center gap-1 text-red-400",children:[i.jsx(qi,{className:"w-4 h-4"}),a("settings.testFailedCount",{count:ka.failed})]})]}),ka.results.filter(Se=>!Se.success).length>0&&i.jsx("div",{className:"space-y-1 mt-2 pt-2 border-t border-bambu-dark-tertiary",children:ka.results.filter(Se=>!Se.success).map(Se=>i.jsxs("div",{className:"text-xs text-red-400",children:[i.jsxs("span",{className:"font-medium",children:[Se.provider_name,":"]})," ",Se.message]},Se.provider_id))})]})}),Rt?i.jsx("div",{className:"flex justify-center py-12",children:i.jsx(ct,{className:"w-6 h-6 text-bambu-green animate-spin"})}):Nt&&Nt.length>0?i.jsx("div",{className:"space-y-3",children:Nt.map(Se=>i.jsx(tJe,{provider:Se,onEdit:Dt=>{re(Dt),L(!0)}},Se.id))}):i.jsx(Tt,{children:i.jsx(Pt,{className:"py-8",children:i.jsxs("div",{className:"text-center text-bambu-gray",children:[i.jsx(ub,{className:"w-12 h-12 mx-auto mb-3 opacity-30"}),i.jsx("p",{className:"text-sm font-medium text-white mb-2",children:a("settings.noProvidersTitle")}),i.jsx("p",{className:"text-xs mb-3",children:a("settings.noProvidersDescription")}),i.jsxs(Fe,{size:"sm",onClick:()=>{re(null),L(!0)},children:[i.jsx(sr,{className:"w-4 h-4"}),a("settings.addProvider")]})]})})})]}),i.jsxs("div",{children:[i.jsxs("h2",{className:"text-lg font-semibold text-white flex items-center gap-2 mb-4",children:[i.jsx(Es,{className:"w-5 h-5 text-bambu-green"}),a("settings.messageTemplates")]}),i.jsx("p",{className:"text-sm text-bambu-gray mb-4",children:a("settings.messageTemplatesDescription")}),Bn?i.jsx("div",{className:"flex justify-center py-8",children:i.jsx(ct,{className:"w-6 h-6 text-bambu-green animate-spin"})}):Dn&&Dn.length>0?i.jsx("div",{className:"space-y-2",children:[...Dn].sort((Se,Dt)=>Se.name.localeCompare(Dt.name)).map(Se=>i.jsx(Tt,{className:"cursor-pointer hover:border-bambu-green/50 transition-colors",onClick:()=>ue(Se),children:i.jsx(Pt,{className:"py-2.5 px-3",children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsx("p",{className:"text-white font-medium text-sm truncate",children:Se.name}),i.jsx("p",{className:"text-bambu-gray text-xs truncate mt-0.5",children:Se.title_template})]}),i.jsx("button",{className:"p-1.5 hover:bg-bambu-dark-tertiary rounded transition-colors shrink-0 ml-2",onClick:Dt=>{Dt.stopPropagation(),ue(Se)},children:i.jsx(Mm,{className:"w-4 h-4 text-bambu-gray"})})]})})},Se.id))}):i.jsx(Tt,{children:i.jsx(Pt,{className:"py-8",children:i.jsxs("div",{className:"text-center text-bambu-gray",children:[i.jsx(Es,{className:"w-12 h-12 mx-auto mb-3 opacity-30"}),i.jsx("p",{className:"text-sm",children:a("settings.noTemplatesAvailable")})]})})})]})]}),q==="apikeys"&&i.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-2 gap-8",children:[i.jsxs("div",{children:[i.jsxs("div",{className:"flex items-start justify-between gap-4 mb-6",children:[i.jsxs("div",{className:"flex-1",children:[i.jsxs("h2",{className:"text-lg font-semibold text-white flex items-center gap-2",children:[i.jsx(il,{className:"w-5 h-5 text-bambu-green"}),a("settings.apiKeys")]}),i.jsx("p",{className:"text-sm text-bambu-gray mt-1",children:a("settings.apiKeysDescription")})]}),i.jsxs(Fe,{size:"sm",onClick:()=>B(!0),className:"flex-shrink-0",children:[i.jsx(sr,{className:"w-4 h-4"}),a("settings.createKey")]})]}),K&&i.jsx(Tt,{className:"mb-6 border-bambu-green",children:i.jsx(Pt,{className:"py-4",children:i.jsxs("div",{className:"flex items-start gap-3",children:[i.jsx(fr,{className:"w-5 h-5 text-bambu-green flex-shrink-0 mt-0.5"}),i.jsxs("div",{className:"flex-1",children:[i.jsx("p",{className:"text-white font-medium mb-1",children:a("settings.apiKeyCreated")}),i.jsx("p",{className:"text-sm text-bambu-gray mb-2",children:a("settings.apiKeyCopyWarning")}),i.jsxs("div",{className:"flex items-center gap-2 bg-bambu-dark rounded-lg p-2",children:[i.jsx("code",{className:"flex-1 text-sm text-bambu-green font-mono break-all",children:K}),i.jsx(Fe,{variant:"secondary",size:"sm",onClick:async()=>{try{if(navigator.clipboard&&navigator.clipboard.writeText)await navigator.clipboard.writeText(K);else{const Se=document.createElement("textarea");Se.value=K,Se.style.position="fixed",Se.style.left="-999999px",document.body.appendChild(Se),Se.select(),document.execCommand("copy"),document.body.removeChild(Se)}o(a("settings.toast.keyCopied"))}catch{o(a("settings.toast.copyFailed"),"error")}},children:i.jsx(wl,{className:"w-4 h-4"})})]}),i.jsxs("div",{className:"flex gap-2 mt-3",children:[i.jsx(Fe,{variant:"secondary",size:"sm",onClick:()=>{oe(K),o(a("settings.toast.keyAddedToBrowser"))},children:a("settings.useInApiBrowser")}),i.jsx(Fe,{variant:"secondary",size:"sm",onClick:()=>ne(null),children:a("common.dismiss")})]})]})]})})}),W&&i.jsxs(Tt,{className:"mb-6",children:[i.jsx(Wn,{children:i.jsx("h3",{className:"text-base font-semibold text-white",children:a("settings.createNewApiKey")})}),i.jsxs(Pt,{className:"space-y-4",children:[i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:a("settings.keyName")}),i.jsx("input",{type:"text",value:ae,onChange:Se=>z(Se.target.value),placeholder:a("settings.keyNamePlaceholder"),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"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm text-bambu-gray mb-2",children:a("common.permissions")}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs("label",{className:"flex items-center gap-3 cursor-pointer",children:[i.jsx("input",{type:"checkbox",checked:V.can_read_status,onChange:Se=>ee(Dt=>({...Dt,can_read_status:Se.target.checked})),className:"w-4 h-4 text-bambu-green rounded border-bambu-dark-tertiary bg-bambu-dark focus:ring-bambu-green"}),i.jsxs("div",{children:[i.jsx("span",{className:"text-white",children:a("settings.readStatus")}),i.jsx("p",{className:"text-xs text-bambu-gray",children:a("settings.readStatusDescription")})]})]}),i.jsxs("label",{className:"flex items-center gap-3 cursor-pointer",children:[i.jsx("input",{type:"checkbox",checked:V.can_queue,onChange:Se=>ee(Dt=>({...Dt,can_queue:Se.target.checked})),className:"w-4 h-4 text-bambu-green rounded border-bambu-dark-tertiary bg-bambu-dark focus:ring-bambu-green"}),i.jsxs("div",{children:[i.jsx("span",{className:"text-white",children:a("settings.manageQueue")}),i.jsx("p",{className:"text-xs text-bambu-gray",children:a("settings.manageQueueDescription")})]})]}),i.jsxs("label",{className:"flex items-center gap-3 cursor-pointer",children:[i.jsx("input",{type:"checkbox",checked:V.can_control_printer,onChange:Se=>ee(Dt=>({...Dt,can_control_printer:Se.target.checked})),className:"w-4 h-4 text-bambu-green rounded border-bambu-dark-tertiary bg-bambu-dark focus:ring-bambu-green"}),i.jsxs("div",{children:[i.jsx("span",{className:"text-white",children:a("settings.controlPrinter")}),i.jsx("p",{className:"text-xs text-bambu-gray",children:a("settings.controlPrinterDescription")})]})]})]})]}),i.jsxs("div",{className:"flex items-center gap-2 pt-2",children:[i.jsxs(Fe,{onClick:()=>mn.mutate({name:ae||a("settings.unnamedKey"),...V}),disabled:mn.isPending,children:[mn.isPending?i.jsx(ct,{className:"w-4 h-4 animate-spin"}):i.jsx(sr,{className:"w-4 h-4"}),a("settings.createKey")]}),i.jsx(Fe,{variant:"secondary",onClick:()=>B(!1),children:a("common.cancel")})]})]})]}),Ft?i.jsx("div",{className:"flex justify-center py-12",children:i.jsx(ct,{className:"w-8 h-8 text-bambu-green animate-spin"})}):jt&&jt.length>0?i.jsx("div",{className:"space-y-3",children:jt.map(Se=>i.jsx(Tt,{children:i.jsx(Pt,{className:"py-3",children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(il,{className:`w-5 h-5 ${Se.enabled?"text-bambu-green":"text-bambu-gray"}`}),i.jsxs("div",{children:[i.jsx("p",{className:"text-white font-medium",children:Se.name}),i.jsxs("p",{className:"text-xs text-bambu-gray",children:[Se.key_prefix,"••••••••",Se.last_used&&` · ${a("settings.lastUsed")}: ${Gp(Se.last_used)}`]})]})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs("div",{className:"flex gap-1 text-xs",children:[Se.can_read_status&&i.jsx("span",{className:"px-1.5 py-0.5 bg-blue-500/20 text-blue-400 rounded",children:a("settings.read")}),Se.can_queue&&i.jsx("span",{className:"px-1.5 py-0.5 bg-green-500/20 text-green-400 rounded",children:a("queue.title")}),Se.can_control_printer&&i.jsx("span",{className:"px-1.5 py-0.5 bg-orange-500/20 text-orange-400 rounded",children:a("settings.control")})]}),i.jsx(Fe,{variant:"secondary",size:"sm",onClick:()=>ce(Se.id),children:i.jsx(Qt,{className:"w-4 h-4 text-red-400"})})]})]})})},Se.id))}):i.jsx(Tt,{children:i.jsx(Pt,{className:"py-12",children:i.jsxs("div",{className:"text-center text-bambu-gray",children:[i.jsx(il,{className:"w-16 h-16 mx-auto mb-4 opacity-30"}),i.jsx("p",{className:"text-lg font-medium text-white mb-2",children:a("settings.apiKeysEmptyTitle")}),i.jsx("p",{className:"text-sm mb-4",children:a("settings.apiKeysEmptyDescription")}),i.jsxs(Fe,{onClick:()=>B(!0),children:[i.jsx(sr,{className:"w-4 h-4"}),a("settings.createFirstKey")]})]})})}),i.jsxs(Tt,{className:"mt-6",children:[i.jsx(Wn,{children:i.jsx("h3",{className:"text-base font-semibold text-white",children:a("settings.webhookEndpoints")})}),i.jsxs(Pt,{className:"space-y-3 text-sm",children:[i.jsx("p",{className:"text-bambu-gray",children:a("settings.webhookApiKeyHint")}),i.jsxs("div",{className:"space-y-2 font-mono text-xs",children:[i.jsxs("div",{className:"p-2 bg-bambu-dark rounded",children:[i.jsx("span",{className:"text-blue-400",children:"GET"})," ",i.jsx("span",{className:"text-white",children:"/api/v1/webhook/status"}),i.jsxs("span",{className:"text-bambu-gray",children:[" - ",a("settings.webhook.getAllStatus")]})]}),i.jsxs("div",{className:"p-2 bg-bambu-dark rounded",children:[i.jsx("span",{className:"text-blue-400",children:"GET"})," ",i.jsx("span",{className:"text-white",children:"/api/v1/webhook/status/:id"}),i.jsxs("span",{className:"text-bambu-gray",children:[" - ",a("settings.webhook.getSpecificStatus")]})]}),i.jsxs("div",{className:"p-2 bg-bambu-dark rounded",children:[i.jsx("span",{className:"text-green-400",children:"POST"})," ",i.jsx("span",{className:"text-white",children:"/api/v1/webhook/queue"}),i.jsxs("span",{className:"text-bambu-gray",children:[" - ",a("settings.webhook.addToQueue")]})]}),i.jsxs("div",{className:"p-2 bg-bambu-dark rounded",children:[i.jsx("span",{className:"text-orange-400",children:"POST"})," ",i.jsx("span",{className:"text-white",children:"/api/v1/webhook/printer/:id/pause"}),i.jsxs("span",{className:"text-bambu-gray",children:[" - ",a("settings.webhook.pausePrint")]})]}),i.jsxs("div",{className:"p-2 bg-bambu-dark rounded",children:[i.jsx("span",{className:"text-orange-400",children:"POST"})," ",i.jsx("span",{className:"text-white",children:"/api/v1/webhook/printer/:id/resume"}),i.jsxs("span",{className:"text-bambu-gray",children:[" - ",a("settings.webhook.resumePrint")]})]}),i.jsxs("div",{className:"p-2 bg-bambu-dark rounded",children:[i.jsx("span",{className:"text-red-400",children:"POST"})," ",i.jsx("span",{className:"text-white",children:"/api/v1/webhook/printer/:id/stop"}),i.jsxs("span",{className:"text-bambu-gray",children:[" - ",a("settings.webhook.stopPrint")]})]})]})]})]})]}),i.jsxs("div",{children:[i.jsxs("div",{className:"mb-6",children:[i.jsxs("h2",{className:"text-lg font-semibold text-white flex items-center gap-2",children:[i.jsx($m,{className:"w-5 h-5 text-bambu-green"}),a("settings.apiBrowser")]}),i.jsx("p",{className:"text-sm text-bambu-gray mt-1",children:a("settings.apiBrowserDescription")})]}),i.jsx(Tt,{className:"mb-4",children:i.jsxs(Pt,{className:"py-3",children:[i.jsx("label",{className:"block text-sm text-bambu-gray mb-2",children:a("settings.apiKeyForTesting")}),i.jsx("input",{type:"text",value:fe,onChange:Se=>oe(Se.target.value),placeholder:a("settings.apiKeyPlaceholder"),className:"w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white font-mono text-sm focus:border-bambu-green focus:outline-none"}),i.jsx("p",{className:"text-xs text-bambu-gray mt-2",children:a("settings.apiKeyHint")})]})}),i.jsx(NJe,{apiKey:fe})]})]}),q==="virtual-printer"&&i.jsx(gJe,{}),q==="filament"&&N&&i.jsx(i.Fragment,{children:i.jsxs("div",{className:"flex flex-col lg:flex-row gap-6 lg:gap-8",children:[i.jsxs("div",{className:"lg:w-1/3 space-y-6",children:[i.jsx(cJe,{}),i.jsxs(Tt,{children:[i.jsx(Wn,{children:i.jsx("h2",{className:"text-lg font-semibold text-white",children:a("settings.amsDisplayThresholds")})}),i.jsxs(Pt,{className:"space-y-4",children:[i.jsx("p",{className:"text-sm text-bambu-gray",children:a("settings.amsThresholdsDescription")}),i.jsxs("div",{className:"space-y-3",children:[i.jsxs("div",{className:"flex items-center gap-2 text-white",children:[i.jsx(GF,{className:"w-4 h-4 text-blue-400"}),i.jsx("span",{className:"font-medium",children:a("settings.humidity")})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[i.jsxs("div",{children:[i.jsxs("label",{className:"block text-sm text-bambu-gray mb-1",children:[a("settings.goodGreen")," ≤"]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("input",{type:"number",min:"0",max:"100",value:N.ams_humidity_good??40,onChange:Se=>Ht("ams_humidity_good",parseInt(Se.target.value)||40),className:"w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none"}),i.jsx("span",{className:"text-bambu-gray",children:"%"})]})]}),i.jsxs("div",{children:[i.jsxs("label",{className:"block text-sm text-bambu-gray mb-1",children:[a("settings.fairOrange")," ≤"]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("input",{type:"number",min:"0",max:"100",value:N.ams_humidity_fair??60,onChange:Se=>Ht("ams_humidity_fair",parseInt(Se.target.value)||60),className:"w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none"}),i.jsx("span",{className:"text-bambu-gray",children:"%"})]})]})]}),i.jsx("p",{className:"text-xs text-bambu-gray",children:a("settings.aboveFairBad")})]}),i.jsxs("div",{className:"space-y-3 pt-2 border-t border-bambu-dark-tertiary",children:[i.jsxs("div",{className:"flex items-center gap-2 text-white",children:[i.jsx(xC,{className:"w-4 h-4 text-orange-400"}),i.jsx("span",{className:"font-medium",children:a("settings.temperature")})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[i.jsxs("div",{children:[i.jsxs("label",{className:"block text-sm text-bambu-gray mb-1",children:[a("settings.goodBlue")," ≤"]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("input",{type:"number",step:"0.5",min:"0",max:"60",value:N.ams_temp_good??28,onChange:Se=>Ht("ams_temp_good",parseFloat(Se.target.value)||28),className:"w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none"}),i.jsx("span",{className:"text-bambu-gray",children:"°C"})]})]}),i.jsxs("div",{children:[i.jsxs("label",{className:"block text-sm text-bambu-gray mb-1",children:[a("settings.fairOrange")," ≤"]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("input",{type:"number",step:"0.5",min:"0",max:"60",value:N.ams_temp_fair??35,onChange:Se=>Ht("ams_temp_fair",parseFloat(Se.target.value)||35),className:"w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none"}),i.jsx("span",{className:"text-bambu-gray",children:"°C"})]})]})]}),i.jsx("p",{className:"text-xs text-bambu-gray",children:a("settings.aboveFairHot")})]}),i.jsxs("div",{className:"space-y-3 pt-4 border-t border-bambu-dark-tertiary",children:[i.jsxs("div",{className:"flex items-center gap-2 text-white",children:[i.jsx(Ic,{className:"w-4 h-4 text-purple-400"}),i.jsx("span",{className:"font-medium",children:a("settings.historyRetention")})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:a("settings.keepSensorHistory")}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("input",{type:"number",min:"1",max:"365",value:N.ams_history_retention_days??30,onChange:Se=>Ht("ams_history_retention_days",parseInt(Se.target.value)||30),className:"w-24 px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none"}),i.jsx("span",{className:"text-bambu-gray",children:a("common.days")})]})]}),i.jsx("p",{className:"text-xs text-bambu-gray",children:a("settings.historyRetentionDescription")})]}),i.jsxs("div",{className:"space-y-3 pt-4 border-t border-bambu-dark-tertiary",children:[i.jsxs("div",{className:"flex items-center gap-2 text-white",children:[i.jsx(kr,{className:"w-4 h-4 text-bambu-green"}),i.jsx("span",{className:"font-medium",children:a("settings.printModal")})]}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm text-white",children:a("settings.expandCustomMapping")}),i.jsx("p",{className:"text-xs text-bambu-gray mt-0.5",children:a("settings.expandCustomMappingDescription")})]}),i.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[i.jsx("input",{type:"checkbox",checked:N.per_printer_mapping_expanded??!1,onChange:Se=>Ht("per_printer_mapping_expanded",Se.target.checked),className:"sr-only peer"}),i.jsx("div",{className:"w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green"})]})]})]})]})]})]}),i.jsxs("div",{className:"lg:w-2/3 space-y-6",children:[i.jsx(dJe,{}),i.jsx(uJe,{})]})]})}),se!==null&&i.jsx(Nn,{title:a("settings.deleteApiKeyTitle"),message:a("settings.deleteApiKeyMessage"),confirmText:a("settings.deleteKey"),variant:"danger",onConfirm:()=>{rn.mutate(se),ce(null)},onCancel:()=>ce(null)}),A&&i.jsx(eJe,{plug:$,onClose:()=>{D(!1),U(null)}}),G&&i.jsx(rJe,{provider:te,onClose:()=>{L(!1),re(null)}}),J&&i.jsx(iJe,{template:J,onClose:()=>ue(null)}),me&&i.jsx(sJe,{onClose:()=>ge(!1)}),O&&i.jsx(Nn,{title:a("settings.clearNotificationLogs"),message:a("settings.clearLogsMessage"),confirmText:a("settings.clearLogs"),variant:"warning",onConfirm:async()=>{F(!1);try{const Se=await be.clearNotificationLogs(30);o(Se.message,"success")}catch{o(a("settings.toast.clearLogsFailed"),"error")}},onCancel:()=>F(!1)}),Q&&i.jsx(Nn,{title:a("settings.resetUiPreferences"),message:a("settings.resetUiPreferencesMessage"),confirmText:a("settings.resetPreferences"),variant:"default",onConfirm:()=>{ve(!1),localStorage.clear(),o(a("settings.toast.uiPreferencesReset"),"success"),setTimeout(()=>window.location.reload(),1e3)},onCancel:()=>ve(!1)}),he&&i.jsx(Nn,{title:`Turn All Plugs ${he==="on"?"On":"Off"}`,message:`This will turn ${he==="on"?"ON":"OFF"} all ${Le?.filter(Se=>Se.enabled).length||0} enabled smart plugs. ${he==="off"?"Any running printers may be affected!":""}`,confirmText:`Turn All ${he==="on"?"On":"Off"}`,variant:he==="off"?"danger":"warning",onConfirm:()=>{const Se=he;de(null),bt.mutate(Se)},onCancel:()=>de(null)}),Ae&&wn?.release_notes&&i.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",onClick:()=>_e(!1),children:i.jsxs(Tt,{className:"w-full max-w-2xl max-h-[80vh] flex flex-col",onClick:Se=>Se.stopPropagation(),children:[i.jsxs(Wn,{className:"flex flex-row items-center justify-between shrink-0",children:[i.jsxs("div",{children:[i.jsxs("h2",{className:"text-lg font-semibold text-white",children:["Release Notes - v",wn.latest_version]}),wn.release_name&&wn.release_name!==wn.latest_version&&i.jsx("p",{className:"text-sm text-bambu-gray",children:wn.release_name})]}),i.jsx("button",{onClick:()=>_e(!1),className:"p-1 rounded hover:bg-bambu-dark-tertiary text-bambu-gray hover:text-white",children:i.jsx(zt,{className:"w-5 h-5"})})]}),i.jsx(Pt,{className:"overflow-y-auto flex-1",children:i.jsx("pre",{className:"text-sm text-bambu-gray whitespace-pre-wrap font-sans",children:wn.release_notes})}),i.jsxs("div",{className:"p-4 border-t border-bambu-dark-tertiary shrink-0 flex gap-2",children:[wn.release_url&&i.jsx("a",{href:wn.release_url,target:"_blank",rel:"noopener noreferrer",className:"flex-1",children:i.jsxs(Fe,{variant:"secondary",className:"w-full",children:[i.jsx(ei,{className:"w-4 h-4"}),"View on GitHub"]})}),i.jsx(Fe,{onClick:()=>_e(!1),className:"flex-1",children:"Close"})]})]})}),q==="users"&&i.jsxs("div",{className:"space-y-6",children:[i.jsxs("div",{className:"flex gap-1 border-b border-bambu-dark-tertiary",children:[i.jsxs("button",{onClick:()=>E("users"),className:`px-4 py-2 text-sm font-medium transition-colors border-b-2 -mb-px flex items-center gap-2 ${j==="users"?"text-bambu-green border-bambu-green":"text-bambu-gray hover:text-gray-900 dark:hover:text-white border-transparent"}`,children:[i.jsx(Sm,{className:"w-4 h-4"}),a("settings.tabs.users")]}),i.jsxs("button",{onClick:()=>E("email"),className:`px-4 py-2 text-sm font-medium transition-colors border-b-2 -mb-px flex items-center gap-2 ${j==="email"?"text-bambu-green border-bambu-green":"text-bambu-gray hover:text-gray-900 dark:hover:text-white border-transparent"}`,children:[i.jsx(Lv,{className:"w-4 h-4"}),a("settings.tabs.emailAuth")||"Email Authentication",Fr?.advanced_auth_enabled&&i.jsx("span",{className:"w-2 h-2 rounded-full bg-green-400"})]})]}),j==="users"&&i.jsxs(i.Fragment,{children:[i.jsx(Tt,{children:i.jsx(Pt,{className:"py-4",children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:`w-10 h-10 rounded-full flex items-center justify-center ${l?"bg-green-500/20":"bg-gray-500/20"}`,children:l?i.jsx(Jh,{className:"w-5 h-5 text-green-400"}):i.jsx(c1,{className:"w-5 h-5 text-gray-400"})}),i.jsxs("div",{children:[i.jsx("h3",{className:"text-white font-medium",children:a("settings.authentication")}),i.jsx("p",{className:"text-sm text-bambu-gray",children:a(l?"settings.authEnabledDescription":"settings.authDisabledDescription")})]})]}),l?c?.is_admin&&i.jsxs(Fe,{variant:"secondary",onClick:()=>Be(!0),children:[i.jsx(c1,{className:"w-4 h-4"}),a("common.disable")]}):i.jsxs(Fe,{onClick:()=>e("/setup"),children:[i.jsx(Jh,{className:"w-4 h-4"}),a("common.enable")]})]})})}),Fr?.advanced_auth_enabled&&i.jsx(Tt,{className:"border-blue-500/30 bg-blue-500/5",children:i.jsx(Pt,{className:"py-4",children:i.jsxs("div",{className:"flex items-start gap-3",children:[i.jsx("div",{className:"w-10 h-10 rounded-full flex items-center justify-center bg-blue-500/20 flex-shrink-0",children:i.jsx(Lv,{className:"w-5 h-5 text-blue-400"})}),i.jsxs("div",{children:[i.jsx("h3",{className:"text-white font-medium",children:a("settings.email.advancedAuthEnabled")}),i.jsx("p",{className:"text-sm text-bambu-gray mt-1",children:a("settings.email.advancedAuthEnabledDesc")})]})]})})}),l&&i.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-2 gap-6",children:[i.jsxs("div",{className:"space-y-6",children:[c&&i.jsxs(Tt,{children:[i.jsx(Wn,{children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("h3",{className:"text-lg font-semibold text-white flex items-center gap-2",children:[i.jsx(Sm,{className:"w-5 h-5 text-bambu-green"}),a("settings.currentUser")]}),i.jsxs(Fe,{size:"sm",variant:"ghost",onClick:()=>Ne(!0),children:[i.jsx(il,{className:"w-4 h-4"}),a("settings.changePassword")]})]})}),i.jsx(Pt,{children:i.jsx("div",{className:"flex items-center justify-between",children:i.jsxs("div",{children:[i.jsx("p",{className:"text-white font-medium text-lg",children:c.username}),i.jsxs("div",{className:"flex flex-wrap gap-1 mt-2",children:[c.is_admin&&i.jsx("span",{className:"px-2 py-0.5 rounded-full text-xs font-medium bg-purple-500/20 text-purple-300",children:a("settings.admin")}),c.groups?.map(Se=>i.jsx("span",{className:`px-2 py-0.5 rounded-full text-xs font-medium ${Se.name==="Administrators"?"bg-purple-500/20 text-purple-300":Se.name==="Operators"?"bg-blue-500/20 text-blue-300":Se.name==="Viewers"?"bg-green-500/20 text-green-300":"bg-gray-500/20 text-gray-300"}`,children:Se.name},Se.id))]})]})})})]}),i.jsxs(Tt,{children:[i.jsx(Wn,{children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("h3",{className:"text-lg font-semibold text-white flex items-center gap-2",children:[i.jsx(Sm,{className:"w-5 h-5 text-bambu-green"}),a("settings.users")]}),xi("users:create")&&i.jsxs(Fe,{size:"sm",onClick:()=>{Ve(!0),Bt({username:"",password:"",email:"",confirmPassword:"",role:"user",group_ids:[]})},children:[i.jsx(sr,{className:"w-4 h-4"}),a("settings.addUser")]})]})}),i.jsx(Pt,{children:kf?i.jsx("div",{className:"flex items-center justify-center py-8",children:i.jsx(ct,{className:"w-6 h-6 text-bambu-green animate-spin"})}):_h.length===0?i.jsx("p",{className:"text-center text-bambu-gray py-8",children:a("settings.noUsersFound")}):i.jsx("div",{className:"divide-y divide-bambu-dark-tertiary",children:_h.map(Se=>i.jsxs("div",{className:"py-3 flex items-center justify-between",children:[i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsx("p",{className:"text-white font-medium truncate",children:Se.username}),i.jsxs("div",{className:"flex flex-wrap gap-1 mt-1",children:[Se.is_admin&&i.jsx("span",{className:"px-2 py-0.5 rounded-full text-xs font-medium bg-purple-500/20 text-purple-300",children:a("settings.admin")}),Se.groups?.map(Dt=>i.jsx("span",{className:`px-2 py-0.5 rounded-full text-xs font-medium ${Dt.name==="Administrators"?"bg-purple-500/20 text-purple-300":Dt.name==="Operators"?"bg-blue-500/20 text-blue-300":Dt.name==="Viewers"?"bg-green-500/20 text-green-300":"bg-gray-500/20 text-gray-300"}`,children:Dt.name},Dt.id))]})]}),i.jsxs("div",{className:"flex items-center gap-1 ml-4",children:[xi("users:update")&&i.jsx(Fe,{size:"sm",variant:"ghost",onClick:()=>kh(Se),children:i.jsx(Mm,{className:"w-4 h-4"})}),xi("users:delete")&&Se.id!==c?.id&&i.jsx(Fe,{size:"sm",variant:"ghost",onClick:()=>_s(Se.id),children:i.jsx(Qt,{className:"w-4 h-4"})})]})]},Se.id))})})]})]}),i.jsx("div",{children:i.jsxs(Tt,{children:[i.jsx(Wn,{children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("h3",{className:"text-lg font-semibold text-white flex items-center gap-2",children:[i.jsx(AD,{className:"w-5 h-5 text-bambu-green"}),a("settings.groups")]}),xi("groups:create")&&i.jsxs(Fe,{size:"sm",onClick:()=>e("/groups/new"),children:[i.jsx(sr,{className:"w-4 h-4"}),a("settings.addGroup")]})]})}),i.jsx(Pt,{children:Nf?i.jsx("div",{className:"flex items-center justify-center py-8",children:i.jsx(ct,{className:"w-6 h-6 text-bambu-green animate-spin"})}):za.length===0?i.jsx("p",{className:"text-center text-bambu-gray py-8",children:a("settings.noGroupsFound")}):i.jsx("div",{className:"divide-y divide-bambu-dark-tertiary",children:za.map(Se=>i.jsxs("div",{className:"py-3",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(AD,{className:`w-4 h-4 ${Se.name==="Administrators"?"text-purple-400":Se.name==="Operators"?"text-blue-400":Se.name==="Viewers"?"text-green-400":"text-bambu-gray"}`}),i.jsx("span",{className:"text-white font-medium",children:Se.name}),Se.is_system&&i.jsx("span",{className:"px-2 py-0.5 rounded text-xs bg-yellow-500/20 text-yellow-400",children:a("settings.system")})]}),i.jsxs("div",{className:"flex items-center gap-1",children:[xi("groups:update")&&i.jsx(Fe,{size:"sm",variant:"ghost",onClick:()=>e(`/groups/${Se.id}/edit`),children:i.jsx(Mm,{className:"w-4 h-4"})}),xi("groups:delete")&&!Se.is_system&&i.jsx(Fe,{size:"sm",variant:"ghost",onClick:()=>xn(Se.id),children:i.jsx(Qt,{className:"w-4 h-4"})})]})]}),i.jsx("p",{className:"text-sm text-bambu-gray mt-1 ml-6",children:Se.description||a("settings.noDescription")}),i.jsxs("div",{className:"flex items-center gap-4 mt-2 ml-6 text-xs text-bambu-gray",children:[i.jsx("span",{children:a("settings.userCount",{count:Se.user_count})}),i.jsx("span",{children:a("settings.permissionCount",{count:Se.permissions.length})})]})]},Se.id))})})]})})]}),!l&&i.jsx(Tt,{children:i.jsx(Pt,{className:"py-6",children:i.jsxs("div",{className:"text-center",children:[i.jsx(c1,{className:"w-12 h-12 text-bambu-gray mx-auto mb-4"}),i.jsx("h3",{className:"text-lg font-medium text-white mb-2",children:a("settings.authDisabledTitle")}),i.jsx("p",{className:"text-sm text-bambu-gray mb-4 max-w-md mx-auto",children:a("settings.authDisabledMessage")}),i.jsxs("ul",{className:"space-y-2 text-sm text-bambu-gray mb-6 text-left max-w-xs mx-auto",children:[i.jsxs("li",{className:"flex items-start gap-2",children:[i.jsx(fr,{className:"w-4 h-4 text-bambu-green mt-0.5 flex-shrink-0"}),i.jsx("span",{children:a("settings.authDisabledFeature1")})]}),i.jsxs("li",{className:"flex items-start gap-2",children:[i.jsx(fr,{className:"w-4 h-4 text-bambu-green mt-0.5 flex-shrink-0"}),i.jsx("span",{children:a("settings.authDisabledFeature2")})]}),i.jsxs("li",{className:"flex items-start gap-2",children:[i.jsx(fr,{className:"w-4 h-4 text-bambu-green mt-0.5 flex-shrink-0"}),i.jsx("span",{children:a("settings.authDisabledFeature3")})]})]}),i.jsxs(Fe,{onClick:()=>e("/setup"),children:[i.jsx(Jh,{className:"w-4 h-4"}),a("settings.enableAuthentication")]})]})})})]}),j==="email"&&i.jsx("div",{className:"max-w-2xl",children:i.jsx(wJe,{})})]}),Pe&&!Fr?.advanced_auth_enabled&&i.jsx("div",{className:"fixed inset-0 bg-black flex items-center justify-center z-50 p-4",onClick:()=>{Ve(!1),Bt({username:"",password:"",email:"",confirmPassword:"",role:"user",group_ids:[]})},children:i.jsxs(Tt,{className:"w-full max-w-md",onClick:Se=>Se.stopPropagation(),children:[i.jsx(Wn,{children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(Sm,{className:"w-5 h-5 text-bambu-green"}),i.jsx("h2",{className:"text-lg font-semibold text-white",children:a("settings.createUser")})]}),i.jsx(Fe,{variant:"ghost",size:"sm",onClick:()=>{Ve(!1),Bt({username:"",password:"",email:"",confirmPassword:"",role:"user",group_ids:[]})},children:i.jsx(zt,{className:"w-5 h-5"})})]})}),i.jsxs(Pt,{children:[i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-white mb-2",children:a("settings.username")}),i.jsx("input",{type:"text",value:yt.username,onChange:Se=>Bt({...yt,username:Se.target.value}),className:"w-full px-4 py-3 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:border-bambu-green transition-colors",placeholder:a("settings.enterUsername"),autoComplete:"username"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-white mb-2",children:a("settings.password")}),i.jsx("input",{type:"password",value:yt.password,onChange:Se=>Bt({...yt,password:Se.target.value}),className:"w-full px-4 py-3 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:border-bambu-green transition-colors",placeholder:a("settings.enterPassword"),autoComplete:"new-password",minLength:6})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-white mb-2",children:a("settings.confirmPassword")}),i.jsx("input",{type:"password",value:yt.confirmPassword,onChange:Se=>Bt({...yt,confirmPassword:Se.target.value}),className:`w-full px-4 py-3 bg-bambu-dark-secondary border rounded-lg text-white placeholder-bambu-gray focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:border-bambu-green transition-colors ${yt.confirmPassword&&yt.password!==yt.confirmPassword?"border-red-500":"border-bambu-dark-tertiary"}`,placeholder:a("settings.confirmPasswordPlaceholder"),autoComplete:"new-password",minLength:6}),yt.confirmPassword&&yt.password!==yt.confirmPassword&&i.jsx("p",{className:"text-red-400 text-xs mt-1",children:a("settings.passwordsDoNotMatch")})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-white mb-2",children:a("settings.groups")}),i.jsxs("div",{className:"space-y-2 max-h-40 overflow-y-auto p-2 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg",children:[za.map(Se=>i.jsxs("label",{className:"flex items-center gap-3 px-2 py-1.5 rounded hover:bg-bambu-dark-tertiary cursor-pointer",children:[i.jsx("input",{type:"checkbox",checked:yt.group_ids.includes(Se.id),onChange:()=>mc(Se.id),className:"w-4 h-4 rounded border-bambu-gray text-bambu-green focus:ring-bambu-green focus:ring-offset-0 bg-bambu-dark"}),i.jsx("span",{className:"text-sm text-white",children:Se.name}),Se.is_system&&i.jsx("span",{className:"text-xs text-yellow-400",children:a("settings.systemBadge")})]},Se.id)),za.length===0&&i.jsx("p",{className:"text-sm text-bambu-gray",children:a("settings.noGroupsAvailable")})]})]})]}),i.jsxs("div",{className:"mt-6 flex justify-end gap-3",children:[i.jsx(Fe,{variant:"secondary",onClick:()=>{Ve(!1),Bt({username:"",password:"",email:"",confirmPassword:"",role:"user",group_ids:[]})},children:a("common.cancel")}),i.jsx(Fe,{onClick:jl,disabled:dc.isPending||!yt.username||!yt.password||yt.password!==yt.confirmPassword||yt.password.length<6,children:dc.isPending?i.jsxs(i.Fragment,{children:[i.jsx(ct,{className:"w-4 h-4 animate-spin"}),a("settings.creating")]}):i.jsxs(i.Fragment,{children:[i.jsx(sr,{className:"w-4 h-4"}),a("settings.createUser")]})})]})]})]})}),Pe&&Fr?.advanced_auth_enabled&&i.jsx(lJe,{formData:yt,setFormData:Bt,groups:za,onClose:()=>{Ve(!1),Bt({username:"",password:"",email:"",confirmPassword:"",role:"user",group_ids:[]})},onCreate:jl,isCreating:dc.isPending,isCreateButtonDisabled:dc.isPending||!yt.username||!yt.email}),je&&$e!==null&&i.jsx("div",{className:"fixed inset-0 bg-black flex items-center justify-center z-50 p-4",onClick:()=>{ye(!1),Ye(null),Bt({username:"",password:"",email:"",confirmPassword:"",role:"user",group_ids:[]})},children:i.jsxs(Tt,{className:"w-full max-w-md",onClick:Se=>Se.stopPropagation(),children:[i.jsx(Wn,{children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(Mm,{className:"w-5 h-5 text-bambu-green"}),i.jsx("h2",{className:"text-lg font-semibold text-white",children:a("settings.editUser")})]}),i.jsx(Fe,{variant:"ghost",size:"sm",onClick:()=>{ye(!1),Ye(null),Bt({username:"",password:"",email:"",confirmPassword:"",role:"user",group_ids:[]})},children:i.jsx(zt,{className:"w-5 h-5"})})]})}),i.jsxs(Pt,{children:[i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{children:[i.jsxs("label",{className:"block text-sm font-medium text-white mb-2",children:[a("settings.username")," ",Fr?.advanced_auth_enabled&&i.jsx("span",{className:"text-red-400",children:"*"})]}),i.jsx("input",{type:"text",value:yt.username,onChange:Se=>Bt({...yt,username:Se.target.value}),className:"w-full px-4 py-3 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:border-bambu-green transition-colors",placeholder:a("settings.enterUsername"),autoComplete:"username"})]}),i.jsxs("div",{children:[i.jsxs("label",{className:"block text-sm font-medium text-white mb-2",children:[a("users.form.email")||"Email"," ",Fr?.advanced_auth_enabled?i.jsx("span",{className:"text-red-400",children:"*"}):i.jsxs("span",{className:"text-bambu-gray font-normal",children:["(",a("users.form.optional")||"optional",")"]})]}),i.jsx("input",{type:"email",value:yt.email,onChange:Se=>Bt({...yt,email:Se.target.value}),className:"w-full px-4 py-3 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:border-bambu-green transition-colors",placeholder:a("users.form.emailPlaceholder")||"user@example.com",required:Fr?.advanced_auth_enabled})]}),!Fr?.advanced_auth_enabled&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{children:[i.jsxs("label",{className:"block text-sm font-medium text-white mb-2",children:[a("users.form.password")||"Password"," ",i.jsxs("span",{className:"text-bambu-gray font-normal",children:["(",a("users.form.leaveBlankToKeep")||"leave blank to keep current",")"]})]}),i.jsx("input",{type:"password",value:yt.password,onChange:Se=>Bt({...yt,password:Se.target.value,confirmPassword:""}),className:"w-full px-4 py-3 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:border-bambu-green transition-colors",placeholder:a("settings.enterNewPassword"),autoComplete:"new-password",minLength:6})]}),yt.password&&i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-white mb-2",children:a("settings.confirmPassword")}),i.jsx("input",{type:"password",value:yt.confirmPassword,onChange:Se=>Bt({...yt,confirmPassword:Se.target.value}),className:`w-full px-4 py-3 bg-bambu-dark-secondary border rounded-lg text-white placeholder-bambu-gray focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:border-bambu-green transition-colors ${yt.confirmPassword&&yt.password!==yt.confirmPassword?"border-red-500":"border-bambu-dark-tertiary"}`,placeholder:a("settings.confirmNewPassword"),autoComplete:"new-password",minLength:6}),yt.confirmPassword&&yt.password!==yt.confirmPassword&&i.jsx("p",{className:"text-red-400 text-xs mt-1",children:a("settings.passwordsDoNotMatch")})]})]}),Fr?.advanced_auth_enabled&&i.jsxs("div",{className:"bg-bambu-dark-secondary/50 border border-bambu-green/20 rounded-lg p-3 space-y-3",children:[i.jsx("p",{className:"text-sm text-bambu-gray",children:a("users.form.passwordManagedByAdvancedAuth")||'Password is managed by Advanced Authentication. Use "Reset Password" to send a new password to the user via email.'}),i.jsx(Fe,{variant:"secondary",size:"sm",onClick:()=>$e&&Ss.mutate($e),disabled:Ss.isPending||!yt.email,className:"w-full",children:Ss.isPending?i.jsxs(i.Fragment,{children:[i.jsx(ct,{className:"w-4 h-4 animate-spin"}),a("users.form.resettingPassword")||"Resetting Password..."]}):i.jsxs(i.Fragment,{children:[i.jsx(uo,{className:"w-4 h-4"}),a("users.form.resetPassword")||"Reset Password"]})})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-white mb-2",children:a("users.form.groups")||"Groups"}),i.jsx("div",{className:"space-y-2 max-h-40 overflow-y-auto p-2 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg",children:za.map(Se=>i.jsxs("label",{className:"flex items-center gap-3 px-2 py-1.5 rounded hover:bg-bambu-dark-tertiary cursor-pointer",children:[i.jsx("input",{type:"checkbox",checked:yt.group_ids.includes(Se.id),onChange:()=>mc(Se.id),className:"w-4 h-4 rounded border-bambu-gray text-bambu-green focus:ring-bambu-green focus:ring-offset-0 bg-bambu-dark"}),i.jsx("span",{className:"text-sm text-white",children:Se.name}),Se.is_system&&i.jsxs("span",{className:"text-xs text-yellow-400",children:["(",a("users.system")||"System",")"]})]},Se.id))})]})]}),i.jsxs("div",{className:"mt-6 flex justify-end gap-3",children:[i.jsx(Fe,{variant:"secondary",onClick:()=>{ye(!1),Ye(null),Bt({username:"",password:"",email:"",confirmPassword:"",role:"user",group_ids:[]})},children:a("users.modal.cancel")||"Cancel"}),i.jsx(Fe,{onClick:()=>Cf($e),disabled:uc.isPending||!yt.username||Fr?.advanced_auth_enabled&&!yt.email||!!(!Fr?.advanced_auth_enabled&&yt.password&&(yt.password!==yt.confirmPassword||yt.password.length<6)),children:uc.isPending?i.jsxs(i.Fragment,{children:[i.jsx(ct,{className:"w-4 h-4 animate-spin"}),a("users.modal.saving")||"Saving..."]}):i.jsxs(i.Fragment,{children:[i.jsx(ps,{className:"w-4 h-4"}),a("users.modal.saveChanges")||"Save Changes"]})})]})]})]})}),lt!==null&&i.jsx("div",{className:"fixed inset-0 bg-black/80 flex items-center justify-center z-50 p-4",onClick:()=>{St(null),ft(null)},children:i.jsxs(Tt,{className:"w-full max-w-md",onClick:Se=>Se.stopPropagation(),children:[i.jsx(Wn,{children:i.jsxs("div",{className:"flex items-center gap-2 text-red-400",children:[i.jsx(Qt,{className:"w-5 h-5"}),i.jsx("h3",{className:"text-lg font-semibold",children:a("settings.deleteUserTitle")})]})}),i.jsx(Pt,{className:"space-y-4",children:qe?i.jsx("div",{className:"flex items-center justify-center py-4",children:i.jsx("div",{className:"animate-spin rounded-full h-6 w-6 border-2 border-bambu-green border-t-transparent"})}):ot&&ot.archives+ot.queue_items+ot.library_files>0?i.jsxs(i.Fragment,{children:[i.jsx("p",{className:"text-white",children:a("settings.userHasCreated")}),i.jsxs("ul",{className:"list-disc list-inside text-bambu-gray space-y-1",children:[ot.archives>0&&i.jsxs("li",{children:[ot.archives," archive",ot.archives!==1?"s":""]}),ot.queue_items>0&&i.jsxs("li",{children:[ot.queue_items," queue item",ot.queue_items!==1?"s":""]}),ot.library_files>0&&i.jsxs("li",{children:[ot.library_files," library file",ot.library_files!==1?"s":""]})]}),i.jsx("p",{className:"text-bambu-gray text-sm",children:a("settings.userItemsQuestion")}),i.jsxs("div",{className:"flex flex-col gap-2",children:[i.jsx(Fe,{variant:"danger",onClick:()=>Ki.mutate({id:lt,deleteItems:!0}),disabled:Ki.isPending,className:"justify-center",children:a("settings.deleteUserAndItems")}),i.jsx(Fe,{variant:"secondary",onClick:()=>Ki.mutate({id:lt,deleteItems:!1}),disabled:Ki.isPending,className:"justify-center",children:a("settings.deleteUserKeepItems")}),i.jsx(Fe,{variant:"ghost",onClick:()=>{St(null),ft(null)},disabled:Ki.isPending,className:"justify-center",children:a("common.cancel")})]})]}):i.jsxs(i.Fragment,{children:[i.jsx("p",{className:"text-white",children:a("settings.deleteUserConfirm")}),i.jsx("p",{className:"text-bambu-gray text-sm",children:a("settings.actionCannotBeUndone")}),i.jsxs("div",{className:"flex gap-2 justify-end",children:[i.jsx(Fe,{variant:"ghost",onClick:()=>{St(null),ft(null)},disabled:Ki.isPending,children:a("common.cancel")}),i.jsx(Fe,{variant:"danger",onClick:()=>Ki.mutate({id:lt,deleteItems:!1}),disabled:Ki.isPending,children:a("settings.deleteUserTitle")})]})]})})]})}),Yt!==null&&i.jsx(Nn,{title:a("settings.deleteGroupTitle"),message:a("settings.deleteGroupMessage"),confirmText:a("settings.deleteGroup"),variant:"danger",onConfirm:()=>{$s.mutate(Yt),xn(null)},onCancel:()=>xn(null)}),q==="backup"&&i.jsx(xJe,{}),ze&&i.jsx(Nn,{title:a("settings.disableAuthenticationTitle"),message:a("settings.disableAuthenticationMessage"),confirmText:a("settings.disableAuthentication"),variant:"danger",onConfirm:async()=>{try{await be.disableAuth(),o(a("settings.toast.authDisabled"),"success"),await d(),Be(!1),window.location.href="/"}catch(Se){const Dt=Se instanceof Error?Se.message:a("settings.toast.authDisableFailed");o(Dt,"error")}},onCancel:()=>Be(!1)}),Ue&&i.jsx("div",{className:"fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-4",onClick:()=>{Ne(!1),ke({currentPassword:"",newPassword:"",confirmPassword:""})},children:i.jsxs(Tt,{className:"w-full max-w-md",onClick:Se=>Se.stopPropagation(),children:[i.jsx(Wn,{children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(il,{className:"w-5 h-5 text-bambu-green"}),i.jsx("h2",{className:"text-lg font-semibold text-white",children:a("settings.changePassword")})]}),i.jsx(Fe,{variant:"ghost",size:"sm",onClick:()=>{Ne(!1),ke({currentPassword:"",newPassword:"",confirmPassword:""})},children:i.jsx(zt,{className:"w-5 h-5"})})]})}),i.jsxs(Pt,{children:[i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-white mb-2",children:"Current Password"}),i.jsx("input",{type:"password",value:Ee.currentPassword,onChange:Se=>ke({...Ee,currentPassword:Se.target.value}),className:"w-full px-4 py-3 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:border-bambu-green transition-colors",placeholder:a("settings.enterCurrentPassword"),autoComplete:"current-password"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-white mb-2",children:"New Password"}),i.jsx("input",{type:"password",value:Ee.newPassword,onChange:Se=>ke({...Ee,newPassword:Se.target.value}),className:"w-full px-4 py-3 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:border-bambu-green transition-colors",placeholder:a("settings.enterNewPasswordMin6"),autoComplete:"new-password",minLength:6})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-white mb-2",children:"Confirm New Password"}),i.jsx("input",{type:"password",value:Ee.confirmPassword,onChange:Se=>ke({...Ee,confirmPassword:Se.target.value}),className:`w-full px-4 py-3 bg-bambu-dark-secondary border rounded-lg text-white placeholder-bambu-gray focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:border-bambu-green transition-colors ${Ee.confirmPassword&&Ee.newPassword!==Ee.confirmPassword?"border-red-500":"border-bambu-dark-tertiary"}`,placeholder:a("settings.confirmNewPassword"),autoComplete:"new-password",minLength:6}),Ee.confirmPassword&&Ee.newPassword!==Ee.confirmPassword&&i.jsx("p",{className:"text-red-400 text-xs mt-1",children:a("settings.passwordsDoNotMatch")})]})]}),i.jsxs("div",{className:"mt-6 flex justify-end gap-3",children:[i.jsx(Fe,{variant:"secondary",onClick:()=>{Ne(!1),ke({currentPassword:"",newPassword:"",confirmPassword:""})},children:a("common.cancel")}),i.jsx(Fe,{onClick:async()=>{if(Ee.newPassword!==Ee.confirmPassword){o(a("settings.toast.passwordsDoNotMatch"),"error");return}if(Ee.newPassword.length<6){o(a("settings.toast.passwordTooShort"),"error");return}Ge(!0);try{await be.changePassword(Ee.currentPassword,Ee.newPassword),o(a("settings.toast.passwordChanged"),"success"),Ne(!1),ke({currentPassword:"",newPassword:"",confirmPassword:""})}catch(Se){const Dt=Se instanceof Error?Se.message:"Failed to change password";o(Dt,"error")}finally{Ge(!1)}},disabled:Me||!Ee.currentPassword||!Ee.newPassword||Ee.newPassword!==Ee.confirmPassword||Ee.newPassword.length<6,children:Me?i.jsxs(i.Fragment,{children:[i.jsx(ct,{className:"w-4 h-4 animate-spin"}),a("settings.changing")]}):i.jsxs(i.Fragment,{children:[i.jsx(il,{className:"w-4 h-4"}),a("settings.changePassword")]})})]})]})]})})]})}const Ese=t=>{const e=parseFloat(t);return(Math.trunc(e*1e3)/1e3).toFixed(3)},AJe=t=>t.startsWith("HH")?"HF":"S",MJe=t=>{const e=t.match(/^([A-Z]{2}\d{2})/);return e?e[1]:"HH00"},jse=t=>{const e=["High Flow_","High Flow ","Standard_","Standard ","HF_","HF ","S_","S "];for(const r of e)if(t.startsWith(r))return t.slice(r.length);const n=t.indexOf("_");return n>0?t.slice(n+1):t};function Kj({profile:t,onEdit:e,onCopy:n,selectionMode:r,isSelected:a,onToggleSelect:s,note:o}){const l=AJe(t.nozzle_id),c=t.nozzle_diameter,d=()=>{r&&s?s():e()};return i.jsxs("div",{className:"flex items-center gap-2",children:[r&&i.jsx("button",{onClick:s,className:"text-bambu-gray hover:text-white transition-colors p-1",children:a?i.jsx(mo,{className:"w-4 h-4 text-bambu-green"}):i.jsx(Sl,{className:"w-4 h-4"})}),i.jsxs("button",{onClick:d,className:`flex-1 text-left px-3 py-2 bg-bambu-dark rounded hover:bg-bambu-dark-tertiary transition-colors ${a?"ring-1 ring-bambu-green":""}`,children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"text-bambu-green font-mono text-sm font-bold whitespace-nowrap",children:Ese(t.k_value)}),i.jsx("span",{className:"text-white text-sm truncate flex-1",title:t.name,children:t.name||"Unnamed"}),o&&i.jsx("span",{title:"Has note",children:i.jsx(JY,{className:"w-3 h-3 text-yellow-500"})}),i.jsxs("span",{className:"text-xs text-bambu-gray whitespace-nowrap",children:[l," ",c]})]}),o&&i.jsxs("div",{className:"text-xs mt-0.5 truncate text-yellow-500/70",title:o,children:["Note: ",o.length>50?o.substring(0,50)+"...":o]})]}),!r&&n&&i.jsx("button",{onClick:u=>{u.stopPropagation(),n()},className:"text-bambu-gray hover:text-white transition-colors p-1",title:"Copy profile",children:i.jsx(wl,{className:"w-4 h-4"})})]})}function Yj({profile:t,printerId:e,nozzleDiameter:n,existingProfiles:r=[],builtinFilaments:a=[],isDualNozzle:s=!1,initialNote:o="",initialNoteKey:l=null,onClose:c,onSave:d,onSaveNote:u,hasPermission:m}){const{t:p}=Mt(),{showToast:f}=bn(),[y,x]=w.useState(t?.name||""),[b,v]=w.useState(t?.k_value?Ese(t.k_value):"0.020"),[_,k]=w.useState(t?.filament_id||""),[P,C]=w.useState(t?.nozzle_id?MJe(t.nozzle_id):"HH00"),[T,N]=w.useState(t?.nozzle_diameter||n),[R,A]=w.useState(t?[t.extruder_id]:s?[0,1]:[0]),[D,$]=w.useState(!1),[U,G]=w.useState({current:0,total:0}),[L,te]=w.useState(o),re=Kr.useMemo(()=>{const le=new Map;for(const Ce of a)le.set(Ce.filament_id,Ce.name);const pe=new Map;for(const Ce of r)if(Ce.filament_id&&!pe.has(Ce.filament_id)){const Z=le.get(Ce.filament_id)||jse(Ce.name||"");pe.set(Ce.filament_id,{id:Ce.filament_id,name:Z||Ce.filament_id})}return Array.from(pe.values()).sort((Ce,q)=>Ce.name.localeCompare(q.name))},[r,a]),J=ut({mutationFn:le=>(console.log("[KProfile] Calling API..."),be.setKProfile(e,le)),onSuccess:le=>{if(console.log("[KProfile] Save success:",le),f(p("kProfiles.toast.profileSaved")),u&&L!==o){let pe;L===""&&l?pe=l:t&&t.slot_id>0?pe=t.setting_id||`slot_${t.slot_id}_${t.filament_id}_${t.extruder_id}`:pe=`name_${y}_${_}`,u(pe,L)}$(!0),setTimeout(()=>{$(!1),d()},2500)},onError:le=>{console.error("[KProfile] Save error:",le),f(le.message,"error"),$(!1)}}),ue=ut({mutationFn:le=>(console.log("[KProfile] Deleting profile..."),be.deleteKProfile(e,le)),onSuccess:le=>{console.log("[KProfile] Delete success:",le),f(p("kProfiles.toast.profileDeleted")),$(!0),setTimeout(()=>{$(!1),c()},4e3)},onError:le=>{console.error("[KProfile] Delete error:",le),f(le.message,"error"),$(!1)}}),[me,ge]=w.useState(!1),X=()=>{t&&ue.mutate({slot_id:t.slot_id,extruder_id:t.extruder_id,nozzle_id:t.nozzle_id,nozzle_diameter:t.nozzle_diameter,filament_id:t.filament_id,setting_id:t.setting_id})},ie=async le=>{if(le.preventDefault(),s&&!t&&R.length===0){f(p("kProfiles.toast.selectAtLeastOneExtruder"),"error");return}const pe=parseFloat(b).toFixed(6),Ce=`${P}-${T}`;if(t||R.length===1){const Z={name:y,k_value:pe,filament_id:_,nozzle_id:Ce,nozzle_diameter:T,extruder_id:t?t.extruder_id:R[0],setting_id:t?.setting_id,slot_id:t?.slot_id??0};console.log("[KProfile] Saving profile:",Z),J.mutate(Z);return}$(!0),G({current:1,total:R.length});const q=R.map(Z=>({name:y,k_value:pe,filament_id:_,nozzle_id:Ce,nozzle_diameter:T,extruder_id:Z,setting_id:void 0,slot_id:0}));console.log(`[KProfile] Saving ${q.length} profiles in batch:`,q);try{if(await be.setKProfilesBatch(e,q),f(p("kProfiles.toast.profilesSaved",{count:R.length})),u&&L){const Z=`name_${y}_${_}`;u(Z,L)}}catch(Z){console.error("[KProfile] Failed to save batch:",Z),f(p("kProfiles.toast.failedToSaveBatch"),"error"),$(!1),G({current:0,total:0});return}G({current:R.length,total:R.length}),setTimeout(()=>{$(!1),G({current:0,total:0}),d()},3e3)};return i.jsxs("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",children:[i.jsxs(Tt,{className:"w-full max-w-md relative",children:[D&&i.jsxs("div",{className:"absolute inset-0 bg-bambu-dark-secondary/90 flex flex-col items-center justify-center z-10 rounded-lg",children:[i.jsx(ct,{className:"w-8 h-8 text-bambu-green animate-spin mb-3"}),i.jsx("p",{className:"text-white font-medium",children:U.total>1?p("kProfiles.modal.savingExtruder",{current:U.current,total:U.total}):p("kProfiles.modal.syncing")}),i.jsx("p",{className:"text-bambu-gray text-sm mt-1",children:p("kProfiles.modal.pleaseWait")})]}),i.jsxs(Pt,{className:"p-0",children:[i.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-bambu-dark-tertiary",children:[i.jsx("h2",{className:"text-xl font-semibold text-white",children:p(t?"kProfiles.modal.editTitle":"kProfiles.modal.addTitle")}),i.jsx("button",{onClick:c,className:"text-bambu-gray hover:text-white transition-colors",disabled:D,children:i.jsx(zt,{className:"w-5 h-5"})})]}),i.jsxs("form",{onSubmit:ie,className:"p-4 space-y-4",children:[i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:p("kProfiles.modal.profileName")}),i.jsx("input",{type:"text",value:y,onChange:le=>x(le.target.value),disabled:!!t,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none ${t?"opacity-60 cursor-not-allowed":""}`,placeholder:p("kProfiles.modal.profileNamePlaceholder"),required:!t})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:p("kProfiles.modal.kValue")}),i.jsx("input",{type:"text",inputMode:"decimal",value:b,onChange:le=>{const pe=le.target.value;(pe===""||/^\d*\.?\d*$/.test(pe))&&v(pe)},onBlur:le=>{const pe=parseFloat(le.target.value);isNaN(pe)||v((Math.trunc(pe*1e3)/1e3).toFixed(3))},className:"w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none font-mono",placeholder:p("kProfiles.modal.kValuePlaceholder"),required:!0}),i.jsx("p",{className:"text-xs text-bambu-gray mt-1",children:p("kProfiles.modal.kValueHelp")})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:p("kProfiles.modal.filament")}),i.jsxs("select",{value:_,onChange:le=>{const pe=le.target.value;if(k(pe),!t&&pe&&!y){const Ce=re.find(q=>q.id===pe);Ce&&x(`${P==="HH00"?"HF":"S"} ${Ce.name}`)}},disabled:!!t,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none ${t?"opacity-60 cursor-not-allowed":""}`,required:!t,children:[i.jsx("option",{value:"",children:p("kProfiles.modal.selectFilament")}),t?.filament_id&&i.jsx("option",{value:t.filament_id,children:re.find(le=>le.id===t.filament_id)?.name||t.filament_id},t.filament_id),!t&&re.map(le=>i.jsx("option",{value:le.id,children:le.name},le.id))]}),!t&&re.length===0&&i.jsx("p",{className:"text-xs text-bambu-gray mt-1",children:p("kProfiles.modal.noFilamentsHelp")})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:p("kProfiles.modal.flowType")}),i.jsxs("select",{value:P,onChange:le=>{const pe=le.target.value;if(C(pe),!t&&_&&!y){const Ce=re.find(q=>q.id===_);Ce&&x(`${pe==="HS00"?"HF":"S"} ${Ce.name}`)}},disabled:!!t,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none ${t?"opacity-60 cursor-not-allowed":""}`,children:[i.jsx("option",{value:"HH00",children:p("kProfiles.modal.highFlow")}),i.jsx("option",{value:"HS00",children:p("kProfiles.modal.standard")})]})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:p("kProfiles.modal.nozzleSize")}),i.jsxs("select",{value:T,onChange:le=>N(le.target.value),disabled:!!t,className:`w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none ${t?"opacity-60 cursor-not-allowed":""}`,children:[i.jsx("option",{value:"0.2",children:"0.2mm"}),i.jsx("option",{value:"0.4",children:"0.4mm"}),i.jsx("option",{value:"0.6",children:"0.6mm"}),i.jsx("option",{value:"0.8",children:"0.8mm"})]})]})]}),s&&i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:p(t?"kProfiles.modal.extruder":"kProfiles.modal.extruders")}),t?i.jsx("div",{className:"px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white opacity-60",children:t.extruder_id===1?p("kProfiles.modal.left"):p("kProfiles.modal.right")}):i.jsxs("div",{className:"flex gap-4",children:[i.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[i.jsx("input",{type:"checkbox",checked:R.includes(1),onChange:le=>{le.target.checked?A([...R,1]):A(R.filter(pe=>pe!==1))},className:"w-4 h-4 rounded border-bambu-dark-tertiary bg-bambu-dark text-bambu-green focus:ring-bambu-green focus:ring-offset-0 accent-bambu-green"}),i.jsx("span",{className:"text-white",children:p("kProfiles.modal.left")})]}),i.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[i.jsx("input",{type:"checkbox",checked:R.includes(0),onChange:le=>{le.target.checked?A([...R,0]):A(R.filter(pe=>pe!==0))},className:"w-4 h-4 rounded border-bambu-dark-tertiary bg-bambu-dark text-bambu-green focus:ring-bambu-green focus:ring-offset-0 accent-bambu-green"}),i.jsx("span",{className:"text-white",children:p("kProfiles.modal.right")})]})]})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:p("kProfiles.modal.notes")}),i.jsx("textarea",{value:L,onChange:le=>te(le.target.value),placeholder:p("kProfiles.modal.notesPlaceholder"),rows:2,className:"w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:border-bambu-green focus:outline-none resize-none"}),i.jsx("p",{className:"text-xs text-bambu-gray mt-1",children:p("kProfiles.modal.notesHelp")})]}),i.jsxs("div",{className:"flex gap-2 pt-4",children:[t&&i.jsx(Fe,{type:"button",variant:"secondary",onClick:()=>ge(!0),disabled:ue.isPending||D||!m("kprofiles:delete"),title:m("kprofiles:delete")?void 0:p("kProfiles.permission.noDelete"),className:"text-red-500 hover:bg-red-500/10",children:ue.isPending?i.jsx(ct,{className:"w-4 h-4 animate-spin"}):i.jsx(Qt,{className:"w-4 h-4"})}),i.jsx(Fe,{type:"button",variant:"secondary",onClick:c,disabled:D,className:"flex-1",children:p("common.cancel")}),i.jsxs(Fe,{type:"submit",disabled:J.isPending||D||!m(t?"kprofiles:update":"kprofiles:create"),title:m(t?"kprofiles:update":"kprofiles:create")?void 0:p(t?"kProfiles.permission.noUpdate":"kProfiles.permission.noCreate"),className:"flex-1",children:[J.isPending?i.jsx(ct,{className:"w-4 h-4 animate-spin"}):i.jsx(uC,{className:"w-4 h-4"}),p("common.save")]})]})]})]})]}),me&&i.jsx("div",{className:"fixed inset-0 bg-black/70 flex items-center justify-center z-[60]",children:i.jsx(Tt,{className:"w-full max-w-sm",children:i.jsxs(Pt,{className:"p-6",children:[i.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[i.jsx("div",{className:"w-10 h-10 rounded-full bg-red-500/20 flex items-center justify-center",children:i.jsx(Qt,{className:"w-5 h-5 text-red-500"})}),i.jsxs("div",{children:[i.jsx("h3",{className:"text-lg font-semibold text-white",children:p("kProfiles.deleteConfirm.title")}),i.jsx("p",{className:"text-sm text-bambu-gray",children:p("kProfiles.deleteConfirm.cannotUndo")})]})]}),i.jsx("p",{className:"text-bambu-gray mb-6",children:p("kProfiles.deleteConfirm.message",{name:t?.name})}),i.jsxs("div",{className:"flex gap-3",children:[i.jsx(Fe,{variant:"secondary",onClick:()=>ge(!1),className:"flex-1",children:p("common.cancel")}),i.jsxs(Fe,{onClick:()=>{ge(!1),X()},disabled:ue.isPending,className:"flex-1 bg-red-500 hover:bg-red-600 text-white",children:[ue.isPending?i.jsx(ct,{className:"w-4 h-4 animate-spin"}):i.jsx(Qt,{className:"w-4 h-4"}),p("common.delete")]})]})]})})})]})}const s1={NOZZLE_DIAMETER:"bambusy_kprofiles_nozzle",SORT_OPTION:"bambusy_kprofiles_sort"};function EJe(){const{t}=Mt(),{showToast:e}=bn(),{hasPermission:n}=Rr(),[r,a]=w.useState(null),[s,o]=w.useState(()=>localStorage.getItem(s1.NOZZLE_DIAMETER)||"0.4"),[l,c]=w.useState(null),[d,u]=w.useState(!1),[m,p]=w.useState(null),[f,y]=w.useState(""),[x,b]=w.useState("all"),[v,_]=w.useState("all"),[k,P]=w.useState(()=>localStorage.getItem(s1.SORT_OPTION)||"name"),[C,T]=w.useState(!1),[N,R]=w.useState(new Set),[A,D]=w.useState(!1),[$,U]=w.useState(!1),G=w.useCallback(F=>`${F.slot_id}_${F.extruder_id}`,[]);w.useEffect(()=>{localStorage.setItem(s1.NOZZLE_DIAMETER,s)},[s]),w.useEffect(()=>{localStorage.setItem(s1.SORT_OPTION,k)},[k]);const{data:L,isLoading:te}=Je({queryKey:["printers"],queryFn:be.getPrinters}),{data:re,isLoading:J,isFetching:ue,error:me,refetch:ge}=Je({queryKey:["kprofiles",r,s],queryFn:async()=>{console.log("[KProfiles] Fetching profiles for printer",r,"nozzle",s);const F=await be.getKProfiles(r,s);return console.log("[KProfiles] Received profiles:",F?.profiles?.length||0,"profiles"),F},enabled:!!r,retry:!1,staleTime:0,gcTime:0,refetchOnMount:"always"}),{data:X}=Je({queryKey:["kprofiles",r,"0.4"],queryFn:()=>be.getKProfiles(r,"0.4"),enabled:!!r,staleTime:6e4}),{data:ie}=Je({queryKey:["builtinFilaments"],queryFn:()=>be.getBuiltinFilaments(),staleTime:3e5}),{data:le}=Je({queryKey:["filamentIdMap"],queryFn:()=>be.getFilamentIdMap(),staleTime:3e5}),{data:pe,refetch:Ce}=Je({queryKey:["kprofile-notes",r],queryFn:()=>be.getKProfileNotes(r),enabled:!!r,staleTime:3e4}),q=me?.message?.includes("not connected");w.useEffect(()=>{if(!r&&L&&L.length>0){const F=L.find(Q=>Q.is_active);F&&a(F.id)}},[r,L]),w.useEffect(()=>{if(r){const F=setTimeout(()=>{ge()},150);return()=>clearTimeout(F)}},[r,s]);const Z=L?.filter(F=>F.is_active)||[],j=Kr.useMemo(()=>{const F=new Map;if(ie)for(const Q of ie)F.set(Q.filament_id,Q.name);if(le)for(const[Q,ve]of Object.entries(le))F.has(Q)||F.set(Q,ve);return F},[ie,le]),E=Kr.useMemo(()=>Array.from(j.entries()).map(([F,Q])=>({filament_id:F,name:Q})),[j]),I=Kr.useCallback(F=>j.get(F.filament_id)||jse(F.name),[j]),W=Kr.useMemo(()=>re?.profiles?re.profiles.filter(Q=>{const ve=f.toLowerCase(),he=!ve||Q.name.toLowerCase().includes(ve)||Q.filament_id.toLowerCase().includes(ve),de=x==="all"||x==="left"&&Q.extruder_id===1||x==="right"&&Q.extruder_id===0,Ae=v==="all"||v==="hf"&&Q.nozzle_id.startsWith("HH")||v==="s"&&Q.nozzle_id.startsWith("HS");return he&&de&&Ae}).sort((Q,ve)=>{switch(k){case"k_value":return parseFloat(Q.k_value)-parseFloat(ve.k_value);case"filament":return I(Q).localeCompare(I(ve));default:return Q.name.localeCompare(ve.name)}}):[],[re?.profiles,f,x,v,k,I]),B=L?.find(F=>F.id===r),ae=B?.nozzle_count===2;w.useEffect(()=>{const F=Q=>{Q.target instanceof HTMLInputElement||Q.target instanceof HTMLTextAreaElement||Q.target instanceof HTMLSelectElement||l||d||m||(Q.key==="r"||Q.key==="R"?(Q.preventDefault(),ge()):Q.key==="n"||Q.key==="N"?(Q.preventDefault(),u(!0)):Q.key==="Escape"&&C&&(Q.preventDefault(),T(!1),R(new Set)))};return window.addEventListener("keydown",F),()=>window.removeEventListener("keydown",F)},[l,d,m,C,ge]);const z=w.useCallback(()=>{if(!re?.profiles||re.profiles.length===0){e(t("kProfiles.toast.noProfilesToExport"),"error");return}const F={version:1,exported_at:new Date().toISOString(),printer:B?.name||"Unknown",nozzle_diameter:s,profiles:re.profiles.map(de=>({name:de.name,k_value:de.k_value,filament_id:de.filament_id,nozzle_id:de.nozzle_id,nozzle_diameter:de.nozzle_diameter,extruder_id:de.extruder_id}))},Q=new Blob([JSON.stringify(F,null,2)],{type:"application/json"}),ve=URL.createObjectURL(Q),he=document.createElement("a");he.href=ve,he.download=`kprofiles_${B?.name||"printer"}_${s}mm_${new Date().toISOString().split("T")[0]}.json`,document.body.appendChild(he),he.click(),document.body.removeChild(he),URL.revokeObjectURL(ve),e(t("kProfiles.toast.exportedProfiles",{count:re.profiles.length}))},[re?.profiles,B,s,e,t]),V=w.useCallback(()=>{const F=document.createElement("input");F.type="file",F.accept=".json",F.onchange=async Q=>{const ve=Q.target.files?.[0];if(ve)try{const he=await ve.text(),de=JSON.parse(he);if(!de.profiles||!Array.isArray(de.profiles)){e(t("kProfiles.toast.invalidFileFormat"),"error");return}let Ae=0;for(const _e of de.profiles)if(!(!_e.name||!_e.k_value||!_e.filament_id))try{await be.setKProfile(r,{name:_e.name,k_value:parseFloat(_e.k_value).toFixed(6),filament_id:_e.filament_id,nozzle_id:_e.nozzle_id||`HH00-${s}`,nozzle_diameter:_e.nozzle_diameter||s,extruder_id:_e.extruder_id??0,slot_id:0}),Ae++,await new Promise(ze=>setTimeout(ze,500))}catch(ze){console.error("Failed to import profile:",_e.name,ze)}e(t("kProfiles.toast.importedProfiles",{count:Ae,total:de.profiles.length})),ge()}catch(he){console.error("Import error:",he),e(t("kProfiles.toast.failedToParseImport"),"error")}},F.click()},[r,s,e,ge,t]),ee=w.useCallback(F=>{R(Q=>{const ve=new Set(Q);return ve.has(F)?ve.delete(F):ve.add(F),ve})},[]),K=w.useCallback(()=>{R(new Set(W.map(F=>G(F))))},[W,G]),ne=w.useCallback(()=>{N.size!==0&&D(!0)},[N.size]),se=w.useCallback(async()=>{const F=W.filter(ve=>N.has(G(ve)));U(!0);let Q=0;for(const ve of F)try{await be.deleteKProfile(r,{slot_id:ve.slot_id,extruder_id:ve.extruder_id,nozzle_id:ve.nozzle_id,nozzle_diameter:ve.nozzle_diameter,filament_id:ve.filament_id,setting_id:ve.setting_id}),Q++,await new Promise(he=>setTimeout(he,300))}catch(he){console.error("Failed to delete profile:",ve.name,he)}e(t("kProfiles.toast.profilesDeleted",{count:Q})),U(!1),D(!1),T(!1),R(new Set),ge()},[r,N,W,e,ge,G,t]),ce=w.useCallback(F=>{const Q=[];return F.setting_id&&Q.push(F.setting_id),Q.push(`slot_${F.slot_id}_${F.filament_id}_${F.extruder_id}`),Q.push(`name_${F.name}_${F.filament_id}`),Q},[]),fe=w.useCallback(async(F,Q)=>{if(r)try{await be.setKProfileNote(r,F,Q),Ce()}catch(ve){console.error("Failed to save note:",ve),e(t("kProfiles.toast.failedToSaveNote"),"error")}},[r,Ce,e,t]),oe=w.useCallback(F=>{if(!pe?.notes)return{note:"",key:null};const Q=ce(F);for(const ve of Q)if(pe.notes[ve])return{note:pe.notes[ve],key:ve};return{note:"",key:null}},[pe,ce]),O=w.useCallback(F=>oe(F).note,[oe]);return te?i.jsx("div",{className:"flex justify-center py-12",children:i.jsx(ct,{className:"w-8 h-8 text-bambu-green animate-spin"})}):!L||L.length===0?i.jsx(Tt,{children:i.jsxs(Pt,{className:"py-12 text-center",children:[i.jsx(Ii,{className:"w-12 h-12 text-bambu-gray mx-auto mb-4"}),i.jsx("h3",{className:"text-lg font-semibold text-white mb-2",children:t("kProfiles.noPrintersConfigured")}),i.jsx("p",{className:"text-bambu-gray",children:t("kProfiles.addPrinterInSettings")})]})}):Z.length===0?i.jsx(Tt,{children:i.jsxs(Pt,{className:"py-12 text-center",children:[i.jsx(kr,{className:"w-12 h-12 text-bambu-gray mx-auto mb-4"}),i.jsx("h3",{className:"text-lg font-semibold text-white mb-2",children:t("kProfiles.noActivePrinters")}),i.jsx("p",{className:"text-bambu-gray",children:t("kProfiles.enablePrinterConnection")})]})}):i.jsxs(i.Fragment,{children:[ue&&!J&&i.jsxs("div",{className:"fixed inset-0 bg-black/50 flex flex-col items-center justify-center z-40",children:[i.jsx(ct,{className:"w-10 h-10 text-bambu-green animate-spin mb-3"}),i.jsx("p",{className:"text-white font-medium",children:t("kProfiles.loadingProfiles")})]}),i.jsxs("div",{className:"flex flex-wrap gap-4 mb-6",children:[i.jsxs("div",{className:"flex-1 min-w-48",children:[i.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:t("kProfiles.printer")}),i.jsx("select",{value:r||"",onChange:F=>a(parseInt(F.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:Z.map(F=>i.jsx("option",{value:F.id,children:F.name},F.id))})]}),i.jsxs("div",{className:"w-32",children:[i.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:t("kProfiles.nozzle")}),i.jsxs("select",{value:s,onChange:F=>o(F.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:[i.jsx("option",{value:"0.2",children:"0.2mm"}),i.jsx("option",{value:"0.4",children:"0.4mm"}),i.jsx("option",{value:"0.6",children:"0.6mm"}),i.jsx("option",{value:"0.8",children:"0.8mm"})]})]}),i.jsxs("div",{className:"flex items-end gap-2",children:[i.jsxs(Fe,{variant:"secondary",onClick:()=>ge(),disabled:ue||!n("kprofiles:read"),title:n("kprofiles:read")?void 0:t("kProfiles.permission.noRead"),children:[i.jsx(_r,{className:`w-4 h-4 ${ue?"animate-spin":""}`}),t("kProfiles.refresh")]}),i.jsxs(Fe,{onClick:()=>u(!0),disabled:!n("kprofiles:create"),title:n("kprofiles:create")?void 0:t("kProfiles.permission.noCreate"),children:[i.jsx(sr,{className:"w-4 h-4"}),t("kProfiles.addProfile")]})]})]}),i.jsxs("div",{className:"flex flex-wrap gap-4 mb-4",children:[i.jsxs("div",{className:"flex-1 min-w-48 relative",children:[i.jsx(Dr,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray"}),i.jsx("input",{type:"text",value:f,onChange:F=>y(F.target.value),placeholder:t("kProfiles.searchPlaceholder"),className:"w-full pl-10 pr-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:border-bambu-green focus:outline-none"})]}),ae&&i.jsx("div",{className:"w-36",children:i.jsxs("select",{value:x,onChange:F=>b(F.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:[i.jsx("option",{value:"all",children:t("kProfiles.allExtruders")}),i.jsx("option",{value:"left",children:t("kProfiles.leftOnly")}),i.jsx("option",{value:"right",children:t("kProfiles.rightOnly")})]})}),i.jsx("div",{className:"w-32",children:i.jsxs("select",{value:v,onChange:F=>_(F.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:[i.jsx("option",{value:"all",children:t("kProfiles.allFlow")}),i.jsx("option",{value:"hf",children:t("kProfiles.hfOnly")}),i.jsx("option",{value:"s",children:t("kProfiles.sOnly")})]})}),i.jsx("div",{className:"w-32",children:i.jsxs("select",{value:k,onChange:F=>P(F.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:[i.jsx("option",{value:"name",children:t("kProfiles.sortName")}),i.jsx("option",{value:"k_value",children:t("kProfiles.sortKValue")}),i.jsx("option",{value:"filament",children:t("kProfiles.sortFilament")})]})})]}),i.jsxs("div",{className:"flex flex-wrap gap-2 mb-6",children:[i.jsxs(Fe,{variant:"secondary",onClick:z,disabled:!re?.profiles?.length||!n("kprofiles:read"),title:n("kprofiles:read")?void 0:t("kProfiles.permission.noExport"),children:[i.jsx(pi,{className:"w-4 h-4"}),t("kProfiles.export")]}),i.jsxs(Fe,{variant:"secondary",onClick:V,disabled:!n("kprofiles:create"),title:n("kprofiles:create")?void 0:t("kProfiles.permission.noImport"),children:[i.jsx(Si,{className:"w-4 h-4"}),t("kProfiles.import")]}),i.jsx("div",{className:"flex-1"}),C?i.jsxs(i.Fragment,{children:[i.jsxs(Fe,{variant:"secondary",onClick:K,children:[i.jsx(mo,{className:"w-4 h-4"}),t("kProfiles.selectAll")]}),i.jsxs(Fe,{variant:"secondary",onClick:ne,disabled:N.size===0||!n("kprofiles:delete"),className:"text-red-500 hover:bg-red-500/10",title:n("kprofiles:delete")?void 0:t("kProfiles.permission.noDelete"),children:[i.jsx(Qt,{className:"w-4 h-4"}),t("kProfiles.delete")," (",N.size,")"]}),i.jsxs(Fe,{variant:"secondary",onClick:()=>{T(!1),R(new Set)},children:[i.jsx(zt,{className:"w-4 h-4"}),t("common.cancel")]})]}):i.jsxs(Fe,{variant:"secondary",onClick:()=>T(!0),disabled:!W.length||!n("kprofiles:delete"),title:n("kprofiles:delete")?void 0:t("kProfiles.permission.noDelete"),children:[i.jsx(mo,{className:"w-4 h-4"}),t("kProfiles.select")]})]}),J?i.jsx("div",{className:"flex justify-center py-12",children:i.jsx(ct,{className:"w-8 h-8 text-bambu-green animate-spin"})}):q?i.jsx(Tt,{children:i.jsxs(Pt,{className:"py-12 text-center",children:[i.jsx(rh,{className:"w-12 h-12 text-bambu-gray mx-auto mb-4"}),i.jsx("h3",{className:"text-lg font-semibold text-white mb-2",children:t("kProfiles.printerOffline")}),i.jsx("p",{className:"text-bambu-gray mb-4",children:t("kProfiles.printerOfflineDesc")}),i.jsxs(Fe,{variant:"secondary",onClick:()=>ge(),children:[i.jsx(_r,{className:"w-4 h-4"}),t("common.refresh")]})]})}):W.length>0?ae?i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{children:[i.jsx("h3",{className:"text-sm font-medium text-bambu-gray mb-2 px-1",children:t("kProfiles.leftExtruder")}),i.jsx("div",{className:"space-y-1",children:W.filter(F=>F.extruder_id===1).map(F=>i.jsx(Kj,{profile:F,onEdit:()=>c(F),onCopy:()=>p(F),selectionMode:C,isSelected:N.has(G(F)),onToggleSelect:()=>ee(G(F)),note:O(F)},G(F)))})]}),i.jsxs("div",{children:[i.jsx("h3",{className:"text-sm font-medium text-bambu-gray mb-2 px-1",children:t("kProfiles.rightExtruder")}),i.jsx("div",{className:"space-y-1",children:W.filter(F=>F.extruder_id===0).map(F=>i.jsx(Kj,{profile:F,onEdit:()=>c(F),onCopy:()=>p(F),selectionMode:C,isSelected:N.has(G(F)),onToggleSelect:()=>ee(G(F)),note:O(F)},G(F)))})]})]}):i.jsx("div",{className:"space-y-1",children:W.map(F=>i.jsx(Kj,{profile:F,onEdit:()=>c(F),onCopy:()=>p(F),selectionMode:C,isSelected:N.has(G(F)),onToggleSelect:()=>ee(G(F)),note:O(F)},G(F)))}):f||x!=="all"||v!=="all"?i.jsx(Tt,{children:i.jsxs(Pt,{className:"py-12 text-center",children:[i.jsx(Dr,{className:"w-12 h-12 text-bambu-gray mx-auto mb-4"}),i.jsx("h3",{className:"text-lg font-semibold text-white mb-2",children:t("kProfiles.noMatchingProfiles")}),i.jsx("p",{className:"text-bambu-gray",children:t("kProfiles.noMatchingProfilesDesc")})]})}):i.jsx(Tt,{children:i.jsxs(Pt,{className:"py-12 text-center",children:[i.jsx(uC,{className:"w-12 h-12 text-bambu-gray mx-auto mb-4"}),i.jsx("h3",{className:"text-lg font-semibold text-white mb-2",children:t("kProfiles.noKProfiles")}),i.jsx("p",{className:"text-bambu-gray mb-4",children:t("kProfiles.noKProfilesDesc",{diameter:s})}),i.jsxs(Fe,{onClick:()=>u(!0),children:[i.jsx(sr,{className:"w-4 h-4"}),t("kProfiles.createFirstProfile")]})]})}),l&&r&&(()=>{const{note:F,key:Q}=oe(l);return i.jsx(Yj,{profile:l,printerId:r,nozzleDiameter:s,existingProfiles:X?.profiles||re?.profiles,builtinFilaments:E,isDualNozzle:ae,initialNote:F,initialNoteKey:Q,onSaveNote:fe,hasPermission:n,onClose:()=>{console.log("[KProfiles] Edit modal onClose - refetching profiles..."),c(null),ge()},onSave:()=>{c(null),ge()}})})(),d&&r&&i.jsx(Yj,{printerId:r,nozzleDiameter:s,existingProfiles:X?.profiles||re?.profiles,builtinFilaments:E,isDualNozzle:ae,onSaveNote:fe,hasPermission:n,onClose:()=>{u(!1),ge()},onSave:()=>{u(!1),ge()}}),m&&r&&i.jsx(Yj,{printerId:r,nozzleDiameter:s,existingProfiles:X?.profiles||re?.profiles,builtinFilaments:E,isDualNozzle:ae,onSaveNote:fe,hasPermission:n,profile:{...m,slot_id:0,name:`${m.name} (Copy)`},onClose:()=>{p(null),ge()},onSave:()=>{p(null),ge()}}),A&&i.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",children:i.jsx(Tt,{className:"w-full max-w-sm",children:i.jsxs(Pt,{className:"p-6",children:[i.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[i.jsx("div",{className:"w-10 h-10 rounded-full bg-red-500/20 flex items-center justify-center",children:i.jsx(Qt,{className:"w-5 h-5 text-red-500"})}),i.jsxs("div",{children:[i.jsx("h3",{className:"text-lg font-semibold text-white",children:t("kProfiles.bulkDelete.title")}),i.jsx("p",{className:"text-sm text-bambu-gray",children:t("kProfiles.bulkDelete.cannotUndo")})]})]}),i.jsx("p",{className:"text-bambu-gray mb-6",children:t("kProfiles.bulkDelete.message",{count:N.size})}),i.jsxs("div",{className:"flex gap-3",children:[i.jsx(Fe,{variant:"secondary",onClick:()=>D(!1),disabled:$,className:"flex-1",children:t("common.cancel")}),i.jsxs(Fe,{onClick:se,disabled:$,className:"flex-1 bg-red-500 hover:bg-red-600 text-white",children:[$?i.jsx(ct,{className:"w-4 h-4 animate-spin"}):i.jsx(Qt,{className:"w-4 h-4"}),t("common.delete")]})]})]})})})]})}const Dse=["PLA","PETG","PCTG","ABS","ASA","TPU","PC","PA","PVA","HIPS","PP","PET","NYLON"],jJe={PLA:"E8E8E8",PETG:"4A90D9",ABS:"E67E22",ASA:"D35400",TPU:"9B59B6",PC:"BDC3C7",PA:"2ECC71",NYLON:"2ECC71",PVA:"F1C40F",HIPS:"95A5A6",PP:"ECF0F1",PET:"3498DB"};function DJe(t){const e=t.toUpperCase();for(const n of Dse)if(new RegExp(`\\b${n}\\b`).test(e))return n;return null}function RJe(t){const e=t.replace(/@.+$/,"").trim(),n=e.toUpperCase();for(const r of Dse){const a=n.indexOf(r);if(a>0){const s=e.slice(0,a).trim();if(s&&s.length>1)return s}}return null}function Xj({preset:t,onDelete:e,onExpand:n,isExpanded:r}){const{t:a}=Mt(),{hasPermission:s}=Rr(),o=t.filament_type||DJe(t.name),l=t.filament_vendor||RJe(t.name);let c=null,d=!1;if(t.default_filament_colour)try{const u=JSON.parse(t.default_filament_colour),m=Array.isArray(u)?u[0]:u;typeof m=="string"&&/^#?[0-9a-fA-F]{6,8}$/.test(m.replace("#",""))&&(c=m.replace("#","").slice(0,6),d=!0)}catch{const u=t.default_filament_colour;/^#?[0-9a-fA-F]{6,8}$/.test(u.replace("#",""))&&(c=u.replace("#","").slice(0,6),d=!0)}return!c&&o&&(c=jJe[o.toUpperCase()]||null),i.jsx(Tt,{className:"bg-bambu-dark border-bambu-dark-tertiary hover:border-bambu-dark-tertiary/80 transition-colors",children:i.jsxs(Pt,{className:"p-3",children:[i.jsxs("div",{className:"flex items-start justify-between gap-2",children:[i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[t.preset_type==="filament"&&i.jsx("div",{className:`w-4 h-4 rounded-full border border-white/20 flex-shrink-0 ${!d&&!c?"opacity-25":d?"":"opacity-50"}`,style:{backgroundColor:c?`#${c}`:"#666"}}),i.jsx("span",{className:"text-sm font-medium text-white truncate",children:t.name})]}),i.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[o&&i.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-bambu-green/20 text-bambu-green",children:o}),l&&i.jsx("span",{className:"text-xs text-bambu-gray",children:l}),i.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-blue-500/20 text-blue-400",children:a("profiles.localProfiles.badge")})]})]}),i.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[s("settings:update")&&i.jsx("button",{onClick:()=>e(t.id),className:"p-1 text-bambu-gray hover:text-red-400 transition-colors",title:a("profiles.localProfiles.delete"),children:i.jsx(Qt,{className:"w-3.5 h-3.5"})}),i.jsx("button",{onClick:()=>n(r?null:t.id),className:"p-1 text-bambu-gray hover:text-white transition-colors",children:r?i.jsx(vl,{className:"w-3.5 h-3.5"}):i.jsx(In,{className:"w-3.5 h-3.5"})})]})]}),r&&i.jsxs("div",{className:"mt-3 pt-3 border-t border-bambu-dark-tertiary text-xs space-y-1.5",children:[o&&i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-bambu-gray",children:a("profiles.localProfiles.filamentType")}),i.jsx("span",{className:"text-white",children:o})]}),l&&i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-bambu-gray",children:a("profiles.localProfiles.vendor")}),i.jsx("span",{className:"text-white",children:l})]}),t.nozzle_temp_min!=null&&t.nozzle_temp_max!=null&&i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-bambu-gray",children:a("profiles.localProfiles.nozzleTemp")}),i.jsxs("span",{className:"text-white",children:[t.nozzle_temp_min,"–",t.nozzle_temp_max,"°C"]})]}),t.filament_cost&&i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-bambu-gray",children:a("profiles.localProfiles.cost")}),i.jsx("span",{className:"text-white",children:t.filament_cost})]}),t.filament_density&&i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-bambu-gray",children:a("profiles.localProfiles.density")}),i.jsxs("span",{className:"text-white",children:[t.filament_density," g/cm³"]})]}),t.pressure_advance&&i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-bambu-gray",children:a("profiles.localProfiles.pressureAdvance")}),i.jsx("span",{className:"text-white",children:t.pressure_advance})]}),t.compatible_printers&&i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-bambu-gray",children:a("profiles.localProfiles.compatiblePrinters")}),i.jsx("span",{className:"text-white truncate ml-2",children:(()=>{try{return JSON.parse(t.compatible_printers).join(", ")}catch{return t.compatible_printers}})()})]}),t.inherits&&t.inherits!==t.name&&i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-bambu-gray",children:a("profiles.localProfiles.inheritsFrom")}),i.jsx("span",{className:"text-white truncate ml-2",children:t.inherits})]}),i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-bambu-gray",children:a("profiles.localProfiles.source")}),i.jsx("span",{className:"text-white capitalize",children:t.source})]})]})]})})}function FJe(){const{t}=Mt(),{hasPermission:e}=Rr(),n=tn(),{showToast:r}=bn(),[a,s]=w.useState(""),[o,l]=w.useState(null),[c,d]=w.useState(!1),[u,m]=w.useState(null),{data:p,isLoading:f}=Je({queryKey:["localPresets"],queryFn:()=>be.getLocalPresets()}),y=ut({mutationFn:async N=>{const R=[];for(const A of Array.from(N)){const D=new FormData;D.append("file",A),R.push(await be.importLocalPresets(D))}return R},onSuccess:N=>{n.invalidateQueries({queryKey:["localPresets"]});let R=0,A=0,D=0;for(const $ of N)R+=$.imported,A+=$.skipped,D+=$.errors.length;R>0&&r(t("profiles.localProfiles.toast.importSuccess",{count:R})),A>0&&r(t("profiles.localProfiles.toast.importSkipped",{count:A}),"warning"),D>0&&r(t("profiles.localProfiles.toast.importError",{count:D}),"error")},onError:N=>{r(N.message,"error")}}),x=ut({mutationFn:N=>be.deleteLocalPreset(N),onSuccess:()=>{n.invalidateQueries({queryKey:["localPresets"]}),m(null),r(t("profiles.localProfiles.toast.deleted"))}}),b=w.useCallback(N=>{!N||N.length===0||y.mutate(N)},[y]),v=w.useCallback(N=>{N.preventDefault(),d(!1),b(N.dataTransfer.files)},[b]),_=w.useCallback(N=>{if(!a)return N;const R=a.toLowerCase();return N.filter(A=>A.name.toLowerCase().includes(R)||A.filament_type?.toLowerCase().includes(R)||A.filament_vendor?.toLowerCase().includes(R))},[a]),k=w.useMemo(()=>_(p?.filament||[]),[p?.filament,_]),P=w.useMemo(()=>_(p?.printer||[]),[p?.printer,_]),C=w.useMemo(()=>_(p?.process||[]),[p?.process,_]),T=k.length+P.length+C.length;return f?i.jsx("div",{className:"flex items-center justify-center py-16",children:i.jsx(ct,{className:"w-8 h-8 text-bambu-green animate-spin"})}):i.jsxs("div",{className:"space-y-6",children:[e("settings:update")&&i.jsxs("div",{onDragOver:N=>{N.preventDefault(),d(!0)},onDragLeave:()=>d(!1),onDrop:v,className:`relative border-2 border-dashed rounded-lg p-6 text-center transition-colors ${c?"border-bambu-green bg-bambu-green/10":"border-bambu-dark-tertiary hover:border-bambu-gray"}`,children:[i.jsx("input",{type:"file",accept:".json,.zip,.orca_filament,.bbscfg,.bbsflmt",multiple:!0,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",onChange:N=>b(N.target.files)}),y.isPending?i.jsxs("div",{className:"flex items-center justify-center gap-2",children:[i.jsx(ct,{className:"w-5 h-5 text-bambu-green animate-spin"}),i.jsx("span",{className:"text-bambu-gray",children:t("profiles.localProfiles.importing")})]}):i.jsxs(i.Fragment,{children:[i.jsx(Si,{className:"w-8 h-8 text-bambu-gray mx-auto mb-2"}),i.jsx("p",{className:"text-sm text-white font-medium",children:t("profiles.localProfiles.import")}),i.jsx("p",{className:"text-xs text-bambu-gray mt-1",children:t("profiles.localProfiles.importDesc")})]})]}),T>0&&i.jsxs("div",{className:"relative",children:[i.jsx(Dr,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray"}),i.jsx("input",{type:"text",value:a,onChange:N=>s(N.target.value),placeholder:t("profiles.localProfiles.search"),className:"w-full pl-9 pr-4 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-sm text-white placeholder-bambu-gray focus:outline-none focus:border-bambu-green"})]}),T===0&&!f&&i.jsxs("div",{className:"text-center py-12",children:[i.jsx(cx,{className:"w-12 h-12 text-bambu-gray mx-auto mb-3 opacity-50"}),i.jsx("p",{className:"text-bambu-gray",children:t("profiles.localProfiles.noPresets")}),i.jsx("p",{className:"text-xs text-bambu-gray/60 mt-1",children:t("profiles.localProfiles.importDesc")})]}),T>0&&i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:[k.length>0&&i.jsxs("div",{children:[i.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[i.jsx(lC,{className:"w-4 h-4 text-bambu-green"}),i.jsx("h3",{className:"text-sm font-medium text-white",children:t("profiles.localProfiles.filament")}),i.jsxs("span",{className:"text-xs text-bambu-gray",children:["(",k.length,")"]})]}),i.jsx("div",{className:"space-y-2",children:k.map(N=>i.jsx(Xj,{preset:N,onDelete:R=>m(R),onExpand:l,isExpanded:o===N.id},N.id))})]}),C.length>0&&i.jsxs("div",{children:[i.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[i.jsx(Vi,{className:"w-4 h-4 text-blue-400"}),i.jsx("h3",{className:"text-sm font-medium text-white",children:t("profiles.localProfiles.process")}),i.jsxs("span",{className:"text-xs text-bambu-gray",children:["(",C.length,")"]})]}),i.jsx("div",{className:"space-y-2",children:C.map(N=>i.jsx(Xj,{preset:N,onDelete:R=>m(R),onExpand:l,isExpanded:o===N.id},N.id))})]}),P.length>0&&i.jsxs("div",{children:[i.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[i.jsx(lu,{className:"w-4 h-4 text-orange-400"}),i.jsx("h3",{className:"text-sm font-medium text-white",children:t("profiles.localProfiles.printer")}),i.jsxs("span",{className:"text-xs text-bambu-gray",children:["(",P.length,")"]})]}),i.jsx("div",{className:"space-y-2",children:P.map(N=>i.jsx(Xj,{preset:N,onDelete:R=>m(R),onExpand:l,isExpanded:o===N.id},N.id))})]})]}),u!==null&&i.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:i.jsxs("div",{className:"bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg p-6 max-w-sm mx-4",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[i.jsx(Ii,{className:"w-5 h-5 text-red-400"}),i.jsx("h3",{className:"text-white font-medium",children:t("profiles.localProfiles.deleteConfirmTitle")})]}),i.jsx("p",{className:"text-sm text-bambu-gray mb-4",children:t("profiles.localProfiles.deleteConfirm")}),i.jsxs("div",{className:"flex justify-end gap-2",children:[i.jsx(Fe,{variant:"secondary",size:"sm",onClick:()=>m(null),children:t("profiles.localProfiles.cancel")}),i.jsxs(Fe,{variant:"danger",size:"sm",onClick:()=>x.mutate(u),disabled:x.isPending,children:[x.isPending?i.jsx(ct,{className:"w-4 h-4 animate-spin"}):i.jsx(Qt,{className:"w-4 h-4"}),t("profiles.localProfiles.delete")]})]})]})})]})}function MI(t,e){const n=`${t} ${e||""}`,r=n.match(/@?\s*(?:BBL\s+)?(?:Bambu\s+Lab\s+)?([XPAH][1-9][A-Z]?(?:\s*(?:Carbon|mini))?|H2D)/i),a=r?r[1].trim():null,s=n.match(/(\d+\.?\d*)\s*(?:mm\s*)?nozzle|nozzle\s*(\d+\.?\d*)/i),o=s?(s[1]||s[2])+"mm":null,l=n.match(/(\d+\.?\d*)mm\s*(?:Standard|Fine|Extra Fine|Draft|Quality)?/i),c=l?l[1]+"mm":null,d=n.match(/\b(PLA|PETG|ABS|ASA|TPU|PC|PA|PVA|HIPS|PP|PET(?:-?CF)?|PA(?:-?CF)?|PLA(?:-?CF)?)\b/i),u=d?d[1].toUpperCase():null;return{printer:a,nozzle:o,layerHeight:c,filamentType:u}}function T0(t){return/^(P[FPM]US|PF\d|PP\d)/.test(t)}function LJe({onSuccess:t,t:e}){const{showToast:n}=bn(),[r,a]=w.useState("email"),[s,o]=w.useState(""),[l,c]=w.useState(""),[d,u]=w.useState(""),[m,p]=w.useState(""),[f,y]=w.useState("global"),[x,b]=w.useState(null),[v,_]=w.useState(null),k=ut({mutationFn:()=>be.cloudLogin(s,l,f),onSuccess:R=>{R.success?(n(e("profiles.login.toast.loggedIn")),t()):R.needs_verification?(b(R.verification_type||"email"),_(R.tfa_key||null),R.verification_type==="totp"?n(e("profiles.login.toast.enterTotp")):n(e("profiles.login.toast.codeSent")),a("code")):n(R.message,"error")},onError:R=>n(R.message,"error")}),P=ut({mutationFn:()=>be.cloudVerify(s,d,v||void 0),onSuccess:R=>{R.success?(n(e("profiles.login.toast.loggedIn")),t()):n(R.message,"error")},onError:R=>n(R.message,"error")}),C=ut({mutationFn:()=>be.cloudSetToken(m),onSuccess:()=>{n(e("profiles.login.toast.tokenSet")),t()},onError:R=>n(R.message,"error")}),T=R=>{R.preventDefault(),r==="email"?k.mutate():r==="code"?P.mutate():r==="token"&&C.mutate()},N=k.isPending||P.isPending||C.isPending;return i.jsx(Tt,{className:"max-w-md mx-auto",children:i.jsxs(Pt,{children:[i.jsxs("div",{className:"text-center mb-6",children:[i.jsx("div",{className:"inline-flex items-center justify-center w-12 h-12 rounded-xl bg-bambu-green/20 mb-3",children:i.jsx(lx,{className:"w-6 h-6 text-bambu-green"})}),i.jsx("h2",{className:"text-xl font-semibold text-white",children:e("profiles.login.title")}),i.jsx("p",{className:"text-sm text-bambu-gray mt-1",children:e("profiles.login.subtitle")})]}),i.jsxs("form",{onSubmit:T,className:"space-y-4",children:[r==="email"&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:e("profiles.login.email")}),i.jsx("input",{type:"email",value:s,onChange:R=>o(R.target.value),className:"w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray-dark focus:border-bambu-green focus:outline-none",placeholder:"your@email.com",required:!0})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:e("profiles.login.password")}),i.jsx("input",{type:"password",value:l,onChange:R=>c(R.target.value),className:"w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray-dark focus:border-bambu-green focus:outline-none",placeholder:"••••••••",required:!0})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:e("profiles.login.region")}),i.jsxs("select",{value:f,onChange:R=>y(R.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:[i.jsx("option",{value:"global",children:e("profiles.login.regionGlobal")}),i.jsx("option",{value:"china",children:e("profiles.login.regionChina")})]})]})]}),r==="code"&&i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:e(x==="totp"?"profiles.login.totpCode":"profiles.login.verificationCode")}),i.jsx("p",{className:"text-xs text-bambu-gray mb-2",children:x==="totp"?e("profiles.login.enterTotpHint"):e("profiles.login.checkEmail",{email:s})}),i.jsx("input",{type:"text",value:d,onChange:R=>u(R.target.value.replace(/\D/g,"").slice(0,6)),className:"w-full px-3 py-3 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-center text-2xl tracking-widest font-mono focus:border-bambu-green focus:outline-none",placeholder:"000000",maxLength:6,required:!0})]}),r==="token"&&i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:e("profiles.login.accessToken")}),i.jsx("p",{className:"text-xs text-bambu-gray mb-2",children:e("profiles.login.accessTokenHint")}),i.jsx("textarea",{value:m,onChange:R=>p(R.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 placeholder-bambu-gray-dark focus:border-bambu-green focus:outline-none resize-none",placeholder:"eyJ...",rows:4,required:!0})]}),i.jsxs("div",{className:"flex gap-2 max-[550px]:flex-wrap max-[550px]:items-center",children:[r==="code"&&i.jsx(Fe,{type:"button",variant:"secondary",onClick:()=>a("email"),className:"flex-1",children:e("profiles.login.back")}),i.jsxs(Fe,{type:"submit",disabled:N,className:"flex-1",children:[N?i.jsx(ct,{className:"w-4 h-4 animate-spin"}):i.jsx(t8,{className:"w-4 h-4"}),e(r==="email"?"profiles.login.loginButton":r==="code"?"profiles.login.verifyButton":"profiles.login.setTokenButton")]})]}),r==="email"&&i.jsx("div",{className:"pt-4 border-t border-bambu-dark-tertiary",children:i.jsxs("button",{type:"button",onClick:()=>a("token"),className:"text-sm text-bambu-gray hover:text-white flex items-center gap-2 transition-colors",children:[i.jsx(il,{className:"w-4 h-4"}),e("profiles.login.useToken")]})}),r==="token"&&i.jsx("div",{className:"pt-4 border-t border-bambu-dark-tertiary",children:i.jsxs("button",{type:"button",onClick:()=>a("email"),className:"text-sm text-bambu-gray hover:text-white flex items-center gap-2 transition-colors",children:[i.jsx(t8,{className:"w-4 h-4"}),e("profiles.login.useEmail")]})})]})]})})}function Wg({label:t,value:e,options:n,onChange:r}){const[a,s]=w.useState(!1),o=n.find(l=>l.value===e);return i.jsxs("div",{className:"relative",children:[i.jsxs("button",{onClick:()=>s(!a),className:"flex items-center gap-2 px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-sm text-white hover:border-bambu-gray-dark transition-colors",children:[i.jsxs("span",{className:"text-bambu-gray",children:[t,":"]}),i.jsx("span",{children:o?.label||"All"}),i.jsx(In,{className:`w-4 h-4 text-bambu-gray transition-transform ${a?"rotate-180":""}`})]}),a&&i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"fixed inset-0 z-10",onClick:()=>s(!1)}),i.jsx("div",{className:"absolute top-full left-0 mt-1 min-w-[160px] bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg shadow-xl z-20 py-1 max-h-60 overflow-y-auto",children:n.map(l=>i.jsxs("button",{onClick:()=>{r(l.value),s(!1)},className:`w-full px-3 py-2 text-left text-sm flex items-center justify-between hover:bg-bambu-dark-tertiary transition-colors ${e===l.value?"text-bambu-green":"text-white"}`,children:[i.jsx("span",{children:l.label}),l.count!==void 0&&i.jsx("span",{className:"text-bambu-gray text-xs",children:l.count})]},l.value))})]})]})}function OJe(){const[t,e]=w.useState(!1);w.useEffect(()=>{const r=()=>{e(window.scrollY>300)};return window.addEventListener("scroll",r),()=>window.removeEventListener("scroll",r)},[]);const n=()=>{window.scrollTo({top:0,behavior:"smooth"})};return t?i.jsx("button",{onClick:n,className:"fixed bottom-6 right-6 p-3 bg-bambu-green hover:bg-bambu-green-light text-white rounded-full shadow-lg shadow-bambu-green/25 transition-all z-40","aria-label":"Scroll to top",children:i.jsx(Hp,{className:"w-5 h-5"})}):null}function Qj({setting:t,onClick:e,onDuplicate:n,compareMode:r,isCompareSelected:a,compareIndex:s,compareDisabled:o,t:l}){const c=MI(t.name),d=T0(t.setting_id);return i.jsxs("div",{className:"flex items-center gap-2 group",children:[i.jsx("button",{onClick:e,disabled:o,className:`flex-1 text-left px-3 py-2 rounded transition-colors ${a?"bg-blue-500/20 border border-blue-500/50":o?"bg-bambu-dark/50 opacity-40 cursor-not-allowed":"bg-bambu-dark hover:bg-bambu-dark-tertiary"} ${r&&!o?"cursor-pointer":""}`,children:i.jsxs("div",{className:"flex items-center gap-2",children:[a&&s!==void 0&&i.jsx("span",{className:"flex-shrink-0 w-5 h-5 rounded-full bg-blue-500 text-white text-xs flex items-center justify-center font-medium",children:s+1}),!a&&d&&i.jsx("span",{className:"flex-shrink-0 w-1.5 h-1.5 rounded-full bg-bambu-green",title:l("profiles.presets.myPreset")}),i.jsx("span",{className:"text-white text-sm truncate flex-1",title:t.name,children:t.name}),c.filamentType&&t.type==="filament"&&i.jsx("span",{className:"text-xs text-bambu-gray whitespace-nowrap",children:c.filamentType}),c.layerHeight&&t.type==="process"&&i.jsx("span",{className:"text-xs text-bambu-gray whitespace-nowrap",children:c.layerHeight}),c.printer&&i.jsx("span",{className:"text-xs text-bambu-gray whitespace-nowrap",children:c.printer})]})}),i.jsx("button",{onClick:u=>{u.stopPropagation(),n()},className:"opacity-0 group-hover:opacity-100 text-bambu-gray hover:text-white transition-all p-1",title:l("profiles.presets.duplicate"),children:i.jsx(wl,{className:"w-4 h-4"})})]})}function NF(t,e=0){const n=" ".repeat(e);if(t===null)return"null";if(t===void 0)return"undefined";if(typeof t=="string"){if(t.includes("\\n")||t.includes(`
- `)){const a=t.replace(/\\n/g,`
- `).replace(/\\"/g,'"').replace(/\\t/g," ").split(`
- `);if(a.length>1)return`"""
- `+a.map(s=>n+" "+s).join(`
- `)+`
- `+n+'"""'}return JSON.stringify(t)}if(typeof t=="number"||typeof t=="boolean")return String(t);if(Array.isArray(t))return t.length===0?"[]":`[
- `+t.map(a=>n+" "+NF(a,e+1)).join(`,
- `)+`
- `+n+"]";if(typeof t=="object"){const r=Object.entries(t);return r.length===0?"{}":`{
- `+r.map(([s,o])=>n+" "+JSON.stringify(s)+": "+NF(o,e+1)).join(`,
- `)+`
- `+n+"}"}return String(t)}function IJe({setting:t,onClose:e,onDeleted:n,onDuplicate:r,onEdit:a,hasPermission:s,t:o}){const{showToast:l}=bn(),c=tn(),[d,u]=w.useState(!1),{data:m,isLoading:p}=Je({queryKey:["cloudSettingDetail",t.setting_id],queryFn:()=>be.getCloudSettingDetail(t.setting_id)}),f=ut({mutationFn:()=>be.deleteCloudSetting(t.setting_id),onSuccess:()=>{l(o("profiles.presets.toast.deleted")),c.invalidateQueries({queryKey:["cloudSettings"]}),n()},onError:b=>l(b.message,"error")}),y=T0(t.setting_id),x=MI(t.name,m?.setting?.inherits);return i.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",children:i.jsx(Tt,{className:"w-full max-w-3xl max-h-[90vh] flex flex-col overflow-hidden",children:i.jsxs(Pt,{className:"p-0 flex flex-col min-h-0 flex-1",children:[i.jsxs("div",{className:"flex-shrink-0 flex items-center justify-between p-4 border-b border-bambu-dark-tertiary",children:[i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("h2",{className:"text-xl font-semibold text-white truncate",children:t.name}),y&&i.jsx("span",{className:"px-2 py-0.5 text-xs font-medium bg-bambu-green/20 text-bambu-green rounded-full",children:o("profiles.presets.editable")})]}),i.jsxs("div",{className:"flex items-center gap-2 mt-1 text-sm text-bambu-gray",children:[i.jsx("span",{className:"capitalize",children:o(`profiles.presets.types.${t.type}`)}),x.printer&&i.jsxs(i.Fragment,{children:[i.jsx("span",{children:"•"}),i.jsx("span",{children:x.printer})]})]})]}),i.jsx("button",{onClick:e,className:"p-2 text-bambu-gray hover:text-white hover:bg-bambu-dark-tertiary rounded-lg transition-colors",children:i.jsx(zt,{className:"w-5 h-5"})})]}),i.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto p-4",children:p?i.jsx("div",{className:"flex items-center justify-center py-16",children:i.jsx(ct,{className:"w-8 h-8 text-bambu-green animate-spin"})}):m?i.jsx("pre",{className:"text-xs text-bambu-gray font-mono whitespace-pre-wrap break-all bg-bambu-dark p-4 rounded-lg border border-bambu-dark-tertiary overflow-x-auto max-w-full",children:NF(m)}):i.jsx("div",{className:"text-center py-16 text-bambu-gray",children:o("profiles.presets.failedToLoadDetails")})}),d?i.jsxs("div",{className:"flex-shrink-0 p-4 border-t border-bambu-dark-tertiary bg-red-500/5",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-3 text-red-400",children:[i.jsx(En,{className:"w-5 h-5"}),i.jsx("span",{className:"font-medium",children:o("profiles.presets.deleteConfirm")})]}),i.jsx("p",{className:"text-sm text-bambu-gray mb-4",children:o("profiles.presets.deleteWarning",{name:t.name})}),i.jsxs("div",{className:"flex gap-2",children:[i.jsx(Fe,{variant:"secondary",onClick:()=>u(!1),disabled:f.isPending,className:"flex-1",children:o("common.cancel")}),i.jsxs(Fe,{variant:"danger",onClick:()=>f.mutate(),disabled:f.isPending,className:"flex-1",children:[f.isPending?i.jsx(ct,{className:"w-4 h-4 animate-spin"}):i.jsx(Qt,{className:"w-4 h-4"}),o("common.delete")]})]})]}):i.jsx("div",{className:"flex-shrink-0 p-4 border-t border-bambu-dark-tertiary",children:i.jsxs("div",{className:"flex gap-2",children:[i.jsx(Fe,{variant:"secondary",onClick:e,className:"flex-1",children:o("common.close")}),i.jsxs(Fe,{variant:"secondary",onClick:r,disabled:!s("cloud:auth"),title:s("cloud:auth")?void 0:o("profiles.presets.noDuplicatePermission"),children:[i.jsx(wl,{className:"w-4 h-4"}),o("profiles.presets.duplicate")]}),y&&i.jsxs(i.Fragment,{children:[i.jsxs(Fe,{variant:"secondary",onClick:a,disabled:p||!m||!s("cloud:auth"),title:s("cloud:auth")?void 0:o("profiles.presets.noEditPermission"),children:[i.jsx(Wi,{className:"w-4 h-4"}),o("common.edit")]}),i.jsx(Fe,{variant:"danger",onClick:()=>u(!0),disabled:!s("cloud:auth"),title:s("cloud:auth")?void 0:o("profiles.presets.noDeletePermission"),children:i.jsx(Qt,{className:"w-4 h-4"})})]})]})})]})})})}function Rse(){try{const t=localStorage.getItem("bambusy_preset_templates");return t?JSON.parse(t):[]}catch{return[]}}function Fse(t){localStorage.setItem("bambusy_preset_templates",JSON.stringify(t))}function zJe({onClose:t,onApply:e,t:n}){const{showToast:r}=bn(),[a,s]=w.useState(Rse),[o,l]=w.useState("all"),[c,d]=w.useState(null),[u,m]=w.useState(""),[p,f]=w.useState(""),[y,x]=w.useState("{}"),[b,v]=w.useState(null),[_,k]=w.useState(null),P=o==="all"?a:a.filter(G=>G.type===o),C=G=>{s(G),Fse(G)},T=G=>{const L=a.filter(te=>te.id!==G);C(L),k(null),r(n("profiles.templates.toast.deleted"))},N=G=>{d(G.id),m(G.name),f(G.description),x(JSON.stringify(G.settings,null,2)),v(null)},R=()=>{if(!(!c||!u.trim()))try{const G=JSON.parse(y),L=a.map(te=>te.id===c?{...te,name:u.trim(),description:p.trim(),settings:G}:te);C(L),d(null),r(n("profiles.templates.toast.updated"))}catch(G){v(G.message)}},A=()=>{d(null),m(""),f(""),x("{}"),v(null)},D=G=>{const L=a.map(te=>te.id===G?{...te,showInModal:!te.showInModal}:te);C(L)},$={filament:{label:n("profiles.presets.types.filament"),icon:lC,color:"text-amber-400"},print:{label:n("profiles.presets.types.process"),icon:lu,color:"text-blue-400"},printer:{label:n("profiles.presets.types.printer"),icon:kr,color:"text-purple-400"}},U=_?a.find(G=>G.id===_):null;return w.useEffect(()=>{const G=L=>{L.key==="Escape"&&(_?k(null):c?A():t())};return window.addEventListener("keydown",G),()=>window.removeEventListener("keydown",G)},[_,c,t]),i.jsxs("div",{className:"fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-4",children:[U&&i.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-60",children:i.jsx(Tt,{className:"w-full max-w-md",children:i.jsxs(Pt,{className:"p-6",children:[i.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[i.jsx("div",{className:"p-2 bg-red-500/20 rounded-lg",children:i.jsx(En,{className:"w-6 h-6 text-red-400"})}),i.jsxs("div",{children:[i.jsx("h3",{className:"text-lg font-semibold text-white",children:n("profiles.templates.deleteTitle")}),i.jsx("p",{className:"text-sm text-bambu-gray",children:n("profiles.templates.deleteWarning")})]})]}),i.jsx("p",{className:"text-white mb-6",children:n("profiles.templates.deleteConfirm",{name:U.name})}),i.jsxs("div",{className:"flex gap-2",children:[i.jsx(Fe,{variant:"secondary",onClick:()=>k(null),className:"flex-1",children:n("common.cancel")}),i.jsxs(Fe,{onClick:()=>T(_),className:"flex-1 bg-red-500 hover:bg-red-600",children:[i.jsx(Qt,{className:"w-4 h-4"}),n("common.delete")]})]})]})})}),i.jsx(Tt,{className:"w-full max-w-2xl max-h-[80vh] flex flex-col",children:i.jsxs(Pt,{className:"p-0 flex flex-col h-full",children:[i.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-bambu-dark-tertiary",children:[i.jsxs("h2",{className:"text-lg font-semibold text-white flex items-center gap-2",children:[i.jsx(jb,{className:"w-5 h-5 text-amber-400"}),n("profiles.templates.title")]}),i.jsx("button",{onClick:t,className:"text-bambu-gray hover:text-white",children:i.jsx(zt,{className:"w-5 h-5"})})]}),i.jsxs("div",{className:"flex items-center gap-2 p-4 border-b border-bambu-dark-tertiary",children:[i.jsx("span",{className:"text-sm text-bambu-gray",children:n("profiles.templates.typeFilter")}),["all","filament","print","printer"].map(G=>i.jsx("button",{onClick:()=>l(G),className:`px-3 py-1 text-sm rounded-lg transition-colors ${o===G?"bg-bambu-green text-white":"bg-bambu-dark text-bambu-gray hover:text-white"}`,children:G==="all"?n("common.all"):$[G].label},G))]}),i.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:P.length===0?i.jsxs("div",{className:"text-center py-12 text-bambu-gray",children:[i.jsx(jb,{className:"w-12 h-12 mx-auto mb-4 opacity-30"}),i.jsx("p",{children:n("profiles.templates.noTemplates")}),i.jsx("p",{className:"text-sm mt-1",children:n("profiles.templates.createFirst")})]}):i.jsx("div",{className:"space-y-2",children:P.map(G=>{const L=$[G.type],te=L.icon;return c===G.id?i.jsxs("div",{className:"p-4 bg-bambu-dark rounded-lg border border-bambu-green",children:[i.jsxs("div",{className:"grid grid-cols-2 gap-3 mb-3",children:[i.jsx("input",{type:"text",value:u,onChange:re=>m(re.target.value),placeholder:n("profiles.templates.namePlaceholder"),className:"px-3 py-2 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded text-white text-sm focus:border-bambu-green focus:outline-none",autoFocus:!0}),i.jsx("input",{type:"text",value:p,onChange:re=>f(re.target.value),placeholder:n("profiles.templates.descriptionPlaceholder"),className:"px-3 py-2 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded text-white text-sm focus:border-bambu-green focus:outline-none"})]}),i.jsxs("div",{className:"mb-3",children:[i.jsx("label",{className:"text-xs text-bambu-gray mb-1 block",children:n("profiles.templates.settingsJson")}),i.jsx("textarea",{value:y,onChange:re=>{x(re.target.value),v(null)},rows:6,className:`w-full px-3 py-2 bg-bambu-dark-secondary border rounded text-white text-sm font-mono focus:outline-none ${b?"border-red-500":"border-bambu-dark-tertiary focus:border-bambu-green"}`}),b&&i.jsx("p",{className:"text-xs text-red-400 mt-1",children:b})]}),i.jsxs("div",{className:"flex gap-2",children:[i.jsxs(Fe,{size:"sm",onClick:R,disabled:!u.trim(),children:[i.jsx(ps,{className:"w-4 h-4"}),"Save"]}),i.jsx(Fe,{size:"sm",variant:"secondary",onClick:A,children:"Cancel"})]})]},G.id):i.jsxs("div",{className:"flex items-center gap-3 p-3 bg-bambu-dark rounded-lg border border-bambu-dark-tertiary hover:border-bambu-gray-dark transition-colors",children:[i.jsx(te,{className:`w-5 h-5 ${L.color} flex-shrink-0`}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsx("p",{className:"text-sm font-medium text-white",children:G.name}),i.jsx("p",{className:"text-xs text-bambu-gray truncate",children:G.description})]}),i.jsx("span",{className:"text-xs text-bambu-gray-dark px-2 py-1 bg-bambu-dark-secondary rounded",children:n("profiles.templates.fieldsCount",{count:Object.keys(G.settings).length})}),i.jsx("button",{onClick:()=>D(G.id),className:`p-1 transition-colors ${G.showInModal?"text-bambu-green hover:text-bambu-green/70":"text-bambu-gray hover:text-white"}`,title:G.showInModal?n("profiles.templates.shownInModals"):n("profiles.templates.hiddenInModals"),children:G.showInModal?i.jsx(tc,{className:"w-4 h-4"}):i.jsx(j0,{className:"w-4 h-4"})}),i.jsx("button",{onClick:()=>e(G),className:"px-3 py-1 text-xs bg-bambu-green/20 text-bambu-green rounded hover:bg-bambu-green/30 transition-colors",children:n("profiles.templates.apply")}),i.jsx("button",{onClick:()=>N(G),className:"p-1 text-bambu-gray hover:text-white",title:n("common.edit"),children:i.jsx(Wi,{className:"w-4 h-4"})}),i.jsx("button",{onClick:()=>k(G.id),className:"p-1 text-bambu-gray hover:text-red-400",title:n("common.delete"),children:i.jsx(Qt,{className:"w-4 h-4"})})]},G.id)})})})]})})]})}function Lse({onClose:t,leftPreset:e,rightPreset:n,leftLabel:r,rightLabel:a,t:s}){const[o,l]=w.useState("changes"),[c,d]=w.useState(""),u=w.useMemo(()=>{const y=new Set([...Object.keys(e),...Object.keys(n)]),x=[];for(const b of y){if(b==="inherits"||b==="version")continue;const v=e[b],_=n[b],k=b in e,P=b in n;let C;!k&&P?C="added":k&&!P?C="removed":JSON.stringify(v)!==JSON.stringify(_)?C="changed":C="same",x.push({key:b,left:v,right:_,status:C})}return x.sort((b,v)=>{const _={changed:0,added:1,removed:2,same:3};return _[b.status]!==_[v.status]?_[b.status]-_[v.status]:b.key.localeCompare(v.key)})},[e,n]),m=w.useMemo(()=>{let y=[...u];if(o==="changes"&&(y=y.filter(x=>x.status!=="same")),c){const x=c.toLowerCase();y=y.filter(b=>b.key.toLowerCase().includes(x)||String(b.left).toLowerCase().includes(x)||String(b.right).toLowerCase().includes(x))}return y},[u,o,c]),p=w.useMemo(()=>({added:u.filter(y=>y.status==="added").length,removed:u.filter(y=>y.status==="removed").length,changed:u.filter(y=>y.status==="changed").length,same:u.filter(y=>y.status==="same").length}),[u]),f=y=>{if(y===void 0)return"—";if(y===null)return"null";if(Array.isArray(y))return y.length===0?"[]":y.length===1?String(y[0]):y.join(", ");if(typeof y=="object")return JSON.stringify(y);const x=String(y);if(x.includes("\\n")||x.length>100){const b=x.split("\\n").length;if(b>1)return`[${b} lines of G-code/script]`;if(x.length>100)return x.substring(0,100)+"…"}return x};return w.useEffect(()=>{const y=x=>{x.key==="Escape"&&t()};return window.addEventListener("keydown",y),()=>window.removeEventListener("keydown",y)},[t]),i.jsx("div",{className:"fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-4",children:i.jsx(Tt,{className:"w-full max-w-4xl max-h-[85vh] flex flex-col overflow-hidden",children:i.jsxs(Pt,{className:"p-0 flex flex-col min-h-0 flex-1",children:[i.jsxs("div",{className:"flex-shrink-0 flex items-center justify-between p-4 border-b border-bambu-dark-tertiary",children:[i.jsxs("h2",{className:"text-lg font-semibold text-white flex items-center gap-2",children:[i.jsx(mb,{className:"w-5 h-5 text-blue-400"}),s("profiles.diff.title")]}),i.jsx("button",{onClick:t,className:"text-bambu-gray hover:text-white",children:i.jsx(zt,{className:"w-5 h-5"})})]}),i.jsxs("div",{className:"flex-shrink-0 grid grid-cols-2 gap-4 p-4 border-b border-bambu-dark-tertiary bg-bambu-dark",children:[i.jsxs("div",{className:"text-center",children:[i.jsx("span",{className:"text-sm text-bambu-gray",children:s("profiles.diff.left")}),i.jsx("p",{className:"text-white font-medium truncate",children:r})]}),i.jsxs("div",{className:"text-center",children:[i.jsx("span",{className:"text-sm text-bambu-gray",children:s("profiles.diff.right")}),i.jsx("p",{className:"text-white font-medium truncate",children:a})]})]}),i.jsxs("div",{className:"flex-shrink-0 flex items-center justify-between p-4 border-b border-bambu-dark-tertiary",children:[i.jsxs("div",{className:"flex items-center gap-4 text-sm",children:[i.jsxs("span",{className:"flex items-center gap-1 text-green-400",children:[i.jsx(sr,{className:"w-3.5 h-3.5"}),p.added," ",s("profiles.diff.added")]}),i.jsxs("span",{className:"flex items-center gap-1 text-red-400",children:[i.jsx(V1,{className:"w-3.5 h-3.5"}),p.removed," ",s("profiles.diff.removed")]}),i.jsxs("span",{className:"flex items-center gap-1 text-amber-400",children:[i.jsx(_D,{className:"w-3.5 h-3.5"}),p.changed," ",s("profiles.diff.changed")]}),i.jsxs("span",{className:"flex items-center gap-1 text-bambu-gray",children:[i.jsx(rM,{className:"w-3.5 h-3.5"}),p.same," ",s("profiles.diff.same")]})]}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsxs("div",{className:"relative",children:[i.jsx(Dr,{className:"absolute left-2 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray"}),i.jsx("input",{type:"text",value:c,onChange:y=>d(y.target.value),placeholder:s("profiles.diff.searchFields"),className:"pl-8 pr-3 py-1.5 bg-bambu-dark border border-bambu-dark-tertiary rounded text-white text-sm focus:border-bambu-green focus:outline-none w-48"})]}),p.same>0&&i.jsxs("div",{className:"flex rounded overflow-hidden border border-bambu-dark-tertiary",children:[i.jsx("button",{onClick:()=>l("changes"),className:`px-3 py-1.5 text-sm transition-colors ${o==="changes"?"bg-bambu-green text-white":"bg-bambu-dark text-bambu-gray hover:text-white"}`,children:s("profiles.diff.changes")}),i.jsx("button",{onClick:()=>l("all"),className:`px-3 py-1.5 text-sm transition-colors ${o==="all"?"bg-bambu-green text-white":"bg-bambu-dark text-bambu-gray hover:text-white"}`,children:s("common.all")})]})]})]}),i.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto",children:m.length===0?i.jsxs("div",{className:"text-center py-12 text-bambu-gray",children:[i.jsx(rM,{className:"w-12 h-12 mx-auto mb-4 opacity-30"}),i.jsx("p",{children:s(o==="changes"?"profiles.diff.noDifferences":"profiles.diff.noFieldsMatch")})]}):i.jsxs("table",{className:"w-full",children:[i.jsx("thead",{className:"sticky top-0 bg-bambu-dark-secondary",children:i.jsxs("tr",{className:"text-sm text-bambu-gray border-b border-bambu-dark-tertiary",children:[i.jsx("th",{className:"text-left p-3 w-1/3",children:s("profiles.diff.field")}),i.jsx("th",{className:"text-left p-3 w-1/3",children:r}),i.jsx("th",{className:"text-left p-3 w-1/3",children:a})]})}),i.jsx("tbody",{children:m.map(y=>{const x={added:"bg-green-500/10",removed:"bg-red-500/10",changed:"bg-amber-500/10",same:""}[y.status],b={added:i.jsx(sr,{className:"w-3.5 h-3.5 text-green-400"}),removed:i.jsx(V1,{className:"w-3.5 h-3.5 text-red-400"}),changed:i.jsx(_D,{className:"w-3.5 h-3.5 text-amber-400"}),same:i.jsx(rM,{className:"w-3.5 h-3.5 text-bambu-gray-dark"})}[y.status];return i.jsxs("tr",{className:`border-b border-bambu-dark-tertiary ${x}`,children:[i.jsx("td",{className:"p-3",children:i.jsxs("div",{className:"flex items-center gap-2",children:[b,i.jsx("span",{className:"text-sm text-white font-mono",children:y.key})]})}),i.jsx("td",{className:"p-3",children:i.jsx("span",{className:`text-sm font-mono break-all ${y.status==="removed"?"text-red-300":y.status==="changed"?"text-white":"text-bambu-gray"}`,children:f(y.left)})}),i.jsx("td",{className:"p-3",children:i.jsx("span",{className:`text-sm font-mono break-all ${y.status==="added"?"text-green-300":y.status==="changed"?"text-white":"text-bambu-gray"}`,children:f(y.right)})})]},y.key)})})]})})]})})})}function UJe({onClose:t,initialData:e,allPresets:n,t:r}){const{showToast:a}=bn(),s=tn(),o=!!e?.setting_id,[l,c]=w.useState("common"),[d,u]=w.useState(e?.type||"filament"),[m,p]=w.useState(e?.name?o?e.name:`${e.name} (Copy)`:""),[f,y]=w.useState(e?.base_id||""),[x,b]=w.useState(""),[v,_]=w.useState(e?.setting||{inherits:""}),[k,P]=w.useState(JSON.stringify(e?.setting||{inherits:""},null,2)),[C,T]=w.useState(null),[N,R]=w.useState(""),[A,D]=w.useState(!1),[$,U]=w.useState(""),[G,L]=w.useState(!1),[te,re]=w.useState(Rse),[J,ue]=w.useState(!1),[me,ge]=w.useState(""),[X,ie]=w.useState(""),[le,pe]=w.useState(!0),[Ce,q]=w.useState(null),[Z,j]=w.useState(!1),E=w.useMemo(()=>({filament:n.filament,print:n.process,printer:n.printer})[d]||[],[n,d]),I=w.useMemo(()=>E.filter(Ee=>T0(Ee.setting_id)),[E]),{data:W}=Je({queryKey:["cloudFields",d],queryFn:()=>be.getCloudFields(d==="print"?"process":d),staleTime:1e3*60*60}),{data:B}=Je({queryKey:["allPresetDetails",d,I.map(Ee=>Ee.setting_id).join(",")],queryFn:async()=>{const Ee={};for(let Me=0;Me<I.length;Me+=5){const Ge=I.slice(Me,Me+5);(await Promise.all(Ge.map(async He=>{try{const Pe=await be.getCloudSettingDetail(He.setting_id);return{id:He.setting_id,detail:Pe}}catch{return null}}))).forEach(He=>{He&&(Ee[He.id]=He.detail)})}return Ee},enabled:I.length>0,staleTime:1e3*60*10}),{data:ae,isLoading:z}=Je({queryKey:["cloudSettingDetail",f],queryFn:()=>be.getCloudSettingDetail(f),enabled:!!f});w.useEffect(()=>{l!=="json"&&P(JSON.stringify(v,null,2))},[v,l]);const V=w.useMemo(()=>({filament:n.filament,print:n.process,printer:n.printer}[d]||[]).filter(ke=>!T0(ke.setting_id)).sort((ke,Me)=>ke.name.localeCompare(Me.name)),[n,d]);w.useEffect(()=>{if(!f)return;const Ee=V.find(ke=>ke.setting_id===f);Ee&&(b(Ee.name),o||(_({inherits:Ee.name}),P(JSON.stringify({inherits:Ee.name},null,2))))},[f,V,o]);const ee=w.useMemo(()=>{const Ee=W?.fields||[],ke=new Set(Ee.map(He=>He.key)),Me=new Set,Ge=new Set(["inherits","updated_time","compatible_printers","compatible_prints"]);B&&Object.values(B).forEach(He=>{He?.setting&&Object.keys(He.setting).forEach(Pe=>{!ke.has(Pe)&&!Ge.has(Pe)&&Me.add(Pe)})}),Object.keys(v).forEach(He=>{!ke.has(He)&&!Ge.has(He)&&Me.add(He)});const xe=Array.from(Me).sort().map(He=>({key:He,label:He.replace(/_/g," ").replace(/\b\w/g,Pe=>Pe.toUpperCase()),type:"text",category:"discovered",description:r("profiles.presets.discoveredFromPresets")}));return[...Ee,...xe]},[W,B,v,r]),K=ee.filter(Ee=>Ee.label.toLowerCase().includes(N.toLowerCase())||Ee.key.toLowerCase().includes(N.toLowerCase())),ne=()=>{if($.trim()){const Ee=$.trim().toLowerCase().replace(/\s+/g,"_");se(Ee,""),U(""),L(!1),a(r("profiles.presets.toast.fieldAdded",{key:Ee}))}},se=(Ee,ke)=>{_(Me=>{const Ge={...Me};return ke===""||ke===void 0?delete Ge[Ee]:Ge[Ee]=ke,Ge})},ce=Ee=>{_(ke=>({...ke,...Ee.settings})),q(Ee.name),a(r("profiles.templates.toast.applied"))},fe=()=>{if(!me.trim())return;const Ee={...v};if(delete Ee.inherits,Object.keys(Ee).length===0){a(r("profiles.presets.noOverridesToSave"),"error");return}const ke={id:Date.now().toString(),name:me.trim(),description:X.trim()||r("profiles.presets.customTemplate"),type:d,settings:Ee,showInModal:le},Me=[...te,ke];re(Me),Fse(Me),ue(!1),ge(""),ie(""),pe(!0),a(r("profiles.templates.toast.created"))},oe=w.useMemo(()=>te.filter(Ee=>Ee.type===d&&Ee.showInModal),[d,te]),O=Ee=>{P(Ee);try{const ke=JSON.parse(Ee);_(ke),T(null)}catch(ke){T(ke.message)}},F=Ee=>{Ee.preventDefault(),D(!1);const ke=Ee.dataTransfer.files[0];if(ke&&ke.name.endsWith(".json")){const Me=new FileReader;Me.onload=Ge=>{try{const xe=Ge.target?.result,He=JSON.parse(xe),Pe=He.setting||He;_(Ve=>({...Ve,...Pe})),P(JSON.stringify({...v,...Pe},null,2)),a(r("profiles.presets.fileImported"))}catch{a(r("profiles.presets.invalidJsonFile"),"error")}},Me.readAsText(ke)}},Q=ut({mutationFn:()=>{const Ee={...v},ke=d==="filament"?"filament_settings_id":d==="print"?"print_settings_id":"printer_settings_id";Ee[ke]=`"${m}"`;const Me={type:d,name:m,base_id:f,setting:Ee};return be.createCloudSetting(Me)},onSuccess:async()=>{a(r("profiles.presets.toast.created")),await s.refetchQueries({queryKey:["cloudSettings"]}),t()},onError:Ee=>a(Ee.message,"error")}),ve=ut({mutationFn:()=>{if(!e?.setting_id)throw new Error(r("profiles.presets.noSettingId"));return be.updateCloudSetting(e.setting_id,{name:m,setting:v})},onSuccess:async()=>{a(r("profiles.presets.toast.updated")),s.removeQueries({queryKey:["cloudSettingDetail"]}),await s.refetchQueries({queryKey:["cloudSettings"]}),t()},onError:Ee=>a(Ee.message,"error")}),he=o?ve:Q,de=ae?.setting?.inherits,Ae=de?V.find(Ee=>Ee.name===de):void 0,{data:_e}=Je({queryKey:["cloudSettingDetail",Ae?.setting_id],queryFn:()=>be.getCloudSettingDetail(Ae.setting_id),enabled:!!Ae?.setting_id}),ze=w.useMemo(()=>{const Ee=_e?.setting||{},ke=ae?.setting||{},Me=f&&B?.[f]?.setting?B[f].setting:{};return{...Ee,...ke,...Me}},[f,ae,_e,B]),Be=Ee=>{if(Ee==null)return"";if(Array.isArray(Ee)){const ke=[...new Set(Ee.map(Me=>String(Me)))];return ke.length===1?ke[0]:Ee.join(", ")}return String(Ee)},Ue=Ee=>{const ke=v[Ee.key],Me=ze[Ee.key],Ge=Be(Me),xe=z?r("common.loading"):Ge||"",He="w-full px-3 py-1.5 bg-bambu-dark border border-bambu-dark-tertiary rounded text-white text-sm focus:border-bambu-green focus:outline-none";if(Ee.type==="boolean"){const Pe=ke==="1"||ke===void 0&&Me==="1";return i.jsx("button",{type:"button",onClick:()=>se(Ee.key,ke==="1"?"0":"1"),className:`w-8 h-5 rounded-full transition-colors ${Pe?"bg-bambu-green":"bg-bambu-dark-tertiary"}`,children:i.jsx("div",{className:`w-4 h-4 rounded-full bg-white shadow transition-transform ${Pe?"translate-x-3.5":"translate-x-0.5"}`})})}return Ee.type==="select"?i.jsxs("select",{value:ke||"",onChange:Pe=>se(Ee.key,Pe.target.value),className:He,children:[i.jsx("option",{value:"",children:xe}),Ee.options?.map(Pe=>i.jsx("option",{value:Pe.value,children:Pe.label},Pe.value))]}):i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("input",{type:Ee.type==="number"?"number":"text",value:ke!==void 0?String(ke):"",onChange:Pe=>se(Ee.key,Pe.target.value),step:Ee.step,min:Ee.min,max:Ee.max,placeholder:xe,className:He}),Ee.unit&&i.jsx("span",{className:"text-xs text-bambu-gray whitespace-nowrap",children:Ee.unit})]})},Ne=w.useMemo(()=>ae?.setting?ae.setting:{},[ae]);return i.jsxs("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",onDragOver:Ee=>{Ee.preventDefault(),D(!0)},onDragLeave:()=>D(!1),onDrop:F,children:[Z&&f&&i.jsx(Lse,{onClose:()=>j(!1),leftPreset:Ne,rightPreset:v,leftLabel:r("profiles.presets.baseLabel",{name:x||f}),rightLabel:r("profiles.presets.currentLabel",{name:m||r("profiles.presets.newPreset")}),t:r}),i.jsx(Tt,{className:"w-full max-w-6xl max-h-[90vh] flex flex-col overflow-y-auto",children:i.jsxs(Pt,{className:"p-0 flex flex-col h-full",children:[i.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-bambu-dark-tertiary",children:[i.jsxs("div",{children:[i.jsx("h2",{className:"text-xl font-semibold text-white",children:r(o?"profiles.presets.editPreset":e?"profiles.presets.duplicatePreset":"profiles.presets.createNewPreset")}),i.jsx("p",{className:"text-sm text-bambu-gray mt-1",children:r("profiles.presets.customizeSettings")})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[f&&i.jsxs("button",{onClick:()=>j(!0),className:"flex items-center gap-2 px-3 py-2 text-sm text-bambu-gray hover:text-white hover:bg-bambu-dark-tertiary rounded-lg transition-colors",title:r("profiles.presets.compareWithBase"),children:[i.jsx(mb,{className:"w-4 h-4"}),r("profiles.presets.compare")]}),i.jsx("button",{onClick:t,className:"p-2 text-bambu-gray hover:text-white hover:bg-bambu-dark-tertiary rounded-lg transition-colors",children:i.jsx(zt,{className:"w-5 h-5"})})]})]}),A&&i.jsx("div",{className:"absolute inset-0 bg-bambu-green/10 border-2 border-dashed border-bambu-green rounded-lg flex items-center justify-center z-10",children:i.jsxs("div",{className:"text-center",children:[i.jsx(Si,{className:"w-12 h-12 text-bambu-green mx-auto mb-2"}),i.jsx("p",{className:"text-bambu-green font-medium",children:r("profiles.presets.dropJsonToImport")})]})}),i.jsxs("div",{className:"p-4 border-b border-bambu-dark-tertiary space-y-3",children:[i.jsxs("div",{className:"grid grid-cols-3 gap-4 max-[640px]:grid-cols-1",children:[i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:r("common.type")}),i.jsxs("select",{value:d,onChange:Ee=>{u(Ee.target.value),y("")},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:[i.jsx("option",{value:"filament",children:r("profiles.presets.types.filament")}),i.jsx("option",{value:"print",children:r("profiles.presets.types.process")}),i.jsx("option",{value:"printer",children:r("profiles.presets.types.printer")})]})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:r("profiles.presets.basePreset")}),i.jsxs("select",{value:f,onChange:Ee=>y(Ee.target.value),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",children:[i.jsx("option",{value:"",children:r("profiles.presets.selectBasePreset")}),V.map(Ee=>i.jsx("option",{value:Ee.setting_id,children:Ee.name},Ee.setting_id))]})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:r("profiles.presets.presetName")}),i.jsx("input",{type:"text",value:m,onChange:Ee=>p(Ee.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:r("profiles.presets.myCustomPreset")})]})]}),x&&i.jsx("div",{className:"text-xs text-bambu-gray",children:i.jsxs("p",{className:"flex items-center gap-1",children:[i.jsx(Vr,{className:"w-3 h-3 text-bambu-green"}),r("profiles.presets.inheritsFrom")," ",i.jsx("span",{className:"text-white",children:x}),z&&i.jsx(ct,{className:"w-3 h-3 animate-spin ml-1"})]})})]}),i.jsxs("div",{className:"flex border-b border-bambu-dark-tertiary max-[640px]:flex-wrap max-[640px]:items-center",children:[i.jsxs("button",{onClick:()=>c("common"),className:`flex items-center gap-2 px-4 py-3 text-sm font-medium transition-colors border-b-2 -mb-px ${l==="common"?"text-bambu-green border-bambu-green":"text-bambu-gray hover:text-white border-transparent"}`,children:[i.jsx(n8,{className:"w-4 h-4"}),r("profiles.presets.tabs.common")]}),i.jsxs("button",{onClick:()=>c("fields"),className:`flex items-center gap-2 px-4 py-3 text-sm font-medium transition-colors border-b-2 -mb-px ${l==="fields"?"text-bambu-green border-bambu-green":"text-bambu-gray hover:text-white border-transparent"}`,children:[i.jsx(mC,{className:"w-4 h-4"}),r("profiles.presets.tabs.allFields")]}),i.jsxs("button",{onClick:()=>c("json"),className:`flex items-center gap-2 px-4 py-3 text-sm font-medium transition-colors border-b-2 -mb-px ${l==="json"?"text-bambu-green border-bambu-green":"text-bambu-gray hover:text-white border-transparent"}`,children:[i.jsx(qY,{className:"w-4 h-4"}),"JSON",C&&i.jsx(Ii,{className:"w-3 h-3 text-red-400"})]}),i.jsx("div",{className:"flex-1 max-[640px]:hidden"}),i.jsxs("button",{onClick:()=>{const Ee={name:m,type:d,base_id:f,setting:v},ke=new Blob([JSON.stringify(Ee,null,2)],{type:"application/json"}),Me=URL.createObjectURL(ke),Ge=document.createElement("a");Ge.href=Me,Ge.download=`${m||"preset"}.json`,document.body.appendChild(Ge),Ge.click(),document.body.removeChild(Ge),URL.revokeObjectURL(Me),a(r("profiles.presets.toast.exported"))},className:"flex items-center gap-2 px-4 py-3 text-sm text-bambu-gray hover:text-white transition-colors",title:r("profiles.presets.exportToJson"),children:[i.jsx(pi,{className:"w-4 h-4"}),r("common.download")]}),i.jsxs("button",{onClick:()=>document.getElementById("file-import")?.click(),className:"flex items-center gap-2 px-4 py-3 text-sm text-bambu-gray hover:text-white transition-colors",title:r("profiles.presets.importFromJson"),children:[i.jsx(Si,{className:"w-4 h-4"}),r("common.upload")]}),i.jsx("input",{id:"file-import",type:"file",accept:".json",className:"hidden",onChange:Ee=>{const ke=Ee.target.files?.[0];if(ke){const Me=new FileReader;Me.onload=Ge=>{try{const xe=JSON.parse(Ge.target?.result),He=xe.setting||xe;_(Pe=>({...Pe,...He})),a(r("profiles.presets.fileImported"))}catch{a(r("profiles.presets.invalidJson"),"error")}},Me.readAsText(ke)}}})]}),i.jsxs("div",{className:"flex-1 p-4",children:[l==="common"&&i.jsxs("div",{className:"space-y-6",children:[i.jsxs("div",{children:[i.jsxs("div",{className:"flex items-center justify-between mb-3",children:[i.jsxs("h3",{className:"text-sm font-medium text-white flex items-center gap-2",children:[i.jsx(jb,{className:"w-4 h-4 text-amber-400"}),r("profiles.templates.title")]}),Object.keys(v).filter(Ee=>Ee!=="inherits").length>0&&i.jsxs("button",{onClick:()=>ue(!J),className:"text-xs text-bambu-gray hover:text-white flex items-center gap-1 transition-colors",children:[i.jsx(ps,{className:"w-3 h-3"}),r("profiles.presets.saveAsTemplate")]})]}),J&&i.jsxs("div",{className:"mb-3 p-3 bg-bambu-dark rounded-lg border border-bambu-dark-tertiary",children:[i.jsxs("div",{className:"grid grid-cols-2 gap-2 mb-2",children:[i.jsx("input",{type:"text",value:me,onChange:Ee=>ge(Ee.target.value),placeholder:r("profiles.templates.namePlaceholder"),className:"px-3 py-1.5 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded text-white text-sm focus:border-bambu-green focus:outline-none",autoFocus:!0}),i.jsx("input",{type:"text",value:X,onChange:Ee=>ie(Ee.target.value),placeholder:r("profiles.templates.descriptionPlaceholder"),className:"px-3 py-1.5 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded text-white text-sm focus:border-bambu-green focus:outline-none"})]}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"flex gap-2",children:[i.jsxs(Fe,{size:"sm",onClick:fe,disabled:!me.trim(),children:[i.jsx(ps,{className:"w-3 h-3"}),r("common.save")]}),i.jsx(Fe,{size:"sm",variant:"secondary",onClick:()=>ue(!1),children:r("common.cancel")})]}),i.jsxs("button",{onClick:()=>pe(!le),className:`flex items-center gap-1.5 text-xs transition-colors ${le?"text-bambu-green":"text-bambu-gray hover:text-white"}`,children:[le?i.jsx(tc,{className:"w-3.5 h-3.5"}):i.jsx(j0,{className:"w-3.5 h-3.5"}),r(le?"profiles.templates.shownInModals":"profiles.templates.hiddenInModals")]})]})]}),Ce&&i.jsxs("div",{className:"mb-3 px-3 py-2 bg-bambu-green/10 border border-bambu-green/30 rounded-lg flex items-center gap-2",children:[i.jsx(Vr,{className:"w-4 h-4 text-bambu-green"}),i.jsxs("span",{className:"text-sm text-bambu-green",children:[r("profiles.presets.templateApplied")," ",i.jsx("span",{className:"font-medium",children:Ce})]}),i.jsx("button",{onClick:()=>q(null),className:"ml-auto text-bambu-green/70 hover:text-bambu-green",children:i.jsx(zt,{className:"w-4 h-4"})})]}),i.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[oe.map(Ee=>i.jsxs("button",{onClick:()=>ce(Ee),className:"p-3 text-left bg-bambu-dark border border-bambu-dark-tertiary rounded-lg hover:border-bambu-gray-dark transition-colors",children:[i.jsx("p",{className:"text-sm font-medium text-white",children:Ee.name}),i.jsx("p",{className:"text-xs text-bambu-gray mt-1",children:Ee.description})]},Ee.id)),oe.length===0&&i.jsx("p",{className:"col-span-3 text-center text-bambu-gray text-sm py-4",children:r("profiles.presets.noTemplatesSelected")})]}),i.jsx("p",{className:"text-xs text-bambu-gray-dark mt-2 text-center",children:r("profiles.presets.manageTemplatesHint")})]}),i.jsxs("div",{children:[i.jsx("h3",{className:"text-sm font-medium text-white mb-3",children:r("profiles.presets.commonSettings")}),i.jsx("div",{className:"grid grid-cols-2 gap-x-6 gap-y-3",children:ee.slice(0,10).map(Ee=>i.jsxs("div",{className:"flex items-center justify-between gap-4 max-[640px]:flex-col max-[640px]:items-start",children:[i.jsx("label",{className:"text-sm text-bambu-gray flex-shrink-0",children:Ee.label}),i.jsx("div",{className:"w-48 max-[640px]:w-full",children:Ue(Ee)})]},Ee.key))})]}),Object.keys(v).length>1&&i.jsxs("div",{children:[i.jsx("h3",{className:"text-sm font-medium text-white mb-3",children:r("profiles.presets.currentOverrides")}),i.jsx("div",{className:"flex flex-wrap gap-2",children:Object.entries(v).filter(([Ee])=>Ee!=="inherits").map(([Ee,ke])=>i.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 bg-bambu-green/10 text-bambu-green text-xs rounded",children:[Ee,": ",String(ke).slice(0,20),i.jsx("button",{onClick:()=>se(Ee,void 0),className:"hover:text-white",children:i.jsx(zt,{className:"w-3 h-3"})})]},Ee))})]})]}),l==="fields"&&i.jsxs("div",{className:"grid grid-cols-2 gap-6",style:{height:"400px"},children:[i.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[i.jsxs("div",{className:"flex items-center justify-between mb-3 flex-shrink-0",children:[i.jsx("h3",{className:"text-sm font-medium text-white",children:r("profiles.presets.availableFields")}),i.jsx("span",{className:"text-xs text-bambu-gray",children:B?r("profiles.templates.fieldsCount",{count:ee.length}):r("common.loading")})]}),i.jsxs("div",{className:"relative mb-3 flex-shrink-0",children:[i.jsx(Dr,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray"}),i.jsx("input",{type:"text",value:N,onChange:Ee=>R(Ee.target.value),placeholder:r("profiles.presets.searchFieldsPlaceholder"),className:"w-full pl-10 pr-4 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm placeholder-bambu-gray-dark focus:border-bambu-green focus:outline-none"})]}),i.jsxs("div",{className:"flex-1 overflow-y-auto space-y-1 pr-2 min-h-0",children:[K.filter(Ee=>!(Ee.key in v)).map(Ee=>{const ke=ze[Ee.key],Me=Be(ke);return i.jsxs("div",{onClick:()=>{_(Ge=>({...Ge,[Ee.key]:Me||""}))},className:"flex items-center justify-between gap-2 p-2 rounded-lg hover:bg-bambu-dark-tertiary transition-colors cursor-pointer group",children:[i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsx("p",{className:"text-sm text-white truncate",children:Ee.label}),i.jsx("p",{className:"text-xs text-bambu-gray-dark truncate",children:Ee.key})]}),i.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[Me&&i.jsxs("span",{className:"text-xs text-bambu-gray bg-bambu-dark px-2 py-0.5 rounded max-w-32 truncate",title:Me,children:[Me.slice(0,20),Me.length>20?"...":""]}),i.jsx("div",{className:"w-6 h-6 flex items-center justify-center rounded bg-bambu-dark-tertiary group-hover:bg-bambu-green/20 transition-colors",children:i.jsx(sr,{className:"w-4 h-4 text-bambu-gray group-hover:text-bambu-green transition-colors"})})]})]},Ee.key)}),K.filter(Ee=>!(Ee.key in v)).length===0&&i.jsx("p",{className:"text-center text-bambu-gray py-4 text-sm",children:r(N?"profiles.presets.noMatchingFields":"profiles.presets.allFieldsAdded")})]}),i.jsx("div",{className:"pt-3 mt-3 border-t border-bambu-dark-tertiary flex-shrink-0",children:G?i.jsxs("div",{className:"flex gap-2",children:[i.jsx("input",{type:"text",value:$,onChange:Ee=>U(Ee.target.value),onKeyDown:Ee=>Ee.key==="Enter"&&ne(),placeholder:"custom_field_name",className:"flex-1 px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white font-mono text-sm placeholder-bambu-gray-dark focus:border-bambu-green focus:outline-none",autoFocus:!0}),i.jsx(Fe,{size:"sm",onClick:ne,disabled:!$.trim(),children:i.jsx(sr,{className:"w-4 h-4"})}),i.jsx(Fe,{size:"sm",variant:"secondary",onClick:()=>{L(!1),U("")},children:i.jsx(zt,{className:"w-4 h-4"})})]}):i.jsxs("button",{onClick:()=>L(!0),className:"w-full flex items-center justify-center gap-2 p-2 text-sm text-bambu-gray hover:text-white border border-dashed border-bambu-dark-tertiary hover:border-bambu-gray-dark rounded-lg transition-colors",children:[i.jsx(sr,{className:"w-4 h-4"}),r("profiles.presets.addCustomField")]})})]}),i.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[i.jsxs("div",{className:"flex items-center justify-between mb-3 flex-shrink-0",children:[i.jsx("h3",{className:"text-sm font-medium text-white",children:r("profiles.presets.yourOverrides")}),i.jsx("span",{className:"text-xs text-bambu-gray",children:r("profiles.templates.fieldsCount",{count:Object.keys(v).filter(Ee=>Ee!=="inherits").length})})]}),i.jsxs("div",{className:"flex-1 overflow-y-auto space-y-2 pr-2 min-h-0",children:[Object.entries(v).filter(([Ee])=>Ee!=="inherits").map(([Ee,ke])=>{const Me=ee.find(Ge=>Ge.key===Ee);return i.jsxs("div",{className:"p-3 bg-bambu-dark rounded-lg border border-bambu-dark-tertiary",children:[i.jsxs("div",{className:"flex items-center justify-between mb-2",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-sm font-medium text-white",children:Me?.label||Ee}),i.jsx("p",{className:"text-xs text-bambu-gray-dark",children:Ee})]}),i.jsx("button",{onClick:()=>se(Ee,void 0),className:"p-1 text-bambu-gray hover:text-red-400 transition-colors",children:i.jsx(zt,{className:"w-4 h-4"})})]}),Me?Ue(Me):i.jsx("input",{type:"text",value:String(ke),onChange:Ge=>se(Ee,Ge.target.value),className:"w-full px-3 py-1.5 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded text-white text-sm focus:border-bambu-green focus:outline-none"})]},Ee)}),Object.keys(v).filter(Ee=>Ee!=="inherits").length===0&&i.jsxs("div",{className:"text-center py-8 text-bambu-gray",children:[i.jsx(n8,{className:"w-8 h-8 mx-auto mb-2 opacity-50"}),i.jsx("p",{className:"text-sm",children:r("profiles.presets.noOverridesYet")}),i.jsx("p",{className:"text-xs mt-1",children:r("profiles.presets.clickFieldsToAdd")})]})]}),Object.keys(v).filter(Ee=>Ee!=="inherits").length>0&&i.jsx("div",{className:"pt-3 mt-3 border-t border-bambu-dark-tertiary flex-shrink-0",children:i.jsxs("button",{onClick:()=>{ue(!0),c("common")},className:"w-full flex items-center justify-center gap-2 p-2 text-sm text-bambu-gray hover:text-white border border-dashed border-bambu-dark-tertiary hover:border-bambu-gray-dark rounded-lg transition-colors",children:[i.jsx(ps,{className:"w-4 h-4"}),r("profiles.presets.saveAsTemplate")]})})]})]}),l==="json"&&i.jsxs("div",{className:"space-y-2",children:[C&&i.jsxs("div",{className:"flex items-center gap-2 text-red-400 text-sm",children:[i.jsx(Ii,{className:"w-4 h-4"}),C]}),i.jsx("textarea",{value:k,onChange:Ee=>O(Ee.target.value),className:`w-full h-80 px-3 py-2 bg-bambu-dark border rounded-lg text-white text-xs font-mono focus:outline-none resize-none ${C?"border-red-500 focus:border-red-500":"border-bambu-dark-tertiary focus:border-bambu-green"}`,spellCheck:!1}),i.jsx("p",{className:"text-xs text-bambu-gray",children:r("profiles.presets.jsonTip")})]})]}),i.jsxs("div",{className:"p-4 border-t border-bambu-dark-tertiary flex gap-2",children:[i.jsx(Fe,{variant:"secondary",onClick:t,className:"flex-1",children:r("common.cancel")}),i.jsxs(Fe,{onClick:()=>he.mutate(),disabled:he.isPending||!m.trim()||!o&&!f||!!C,className:"flex-1",children:[he.isPending?i.jsx(ct,{className:"w-4 h-4 animate-spin"}):o?i.jsx(ps,{className:"w-4 h-4"}):i.jsx(sr,{className:"w-4 h-4"}),r(o?"common.save":e?"common.duplicate":"common.create")]})]})]})})]})}function BJe({settings:t,lastSyncTime:e,onRefresh:n,isRefreshing:r,printers:a,hasPermission:s,t:o}){const[l,c]=w.useState(""),[d,u]=w.useState("all"),[m,p]=w.useState("all"),[f,y]=w.useState("all"),[x,b]=w.useState("all"),[v,_]=w.useState("all"),[k,P]=w.useState("all"),[C,T]=w.useState(null),[N,R]=w.useState(!1),[A,D]=w.useState(!1),[$,U]=w.useState(null),[G,L]=w.useState(null),[te,re]=w.useState(null),[J,ue]=w.useState(!1),[me,ge]=w.useState([null,null]),[X,ie]=w.useState(!1),[le,pe]=w.useState(null),Ce=tn(),q=w.useMemo(()=>[...t.filament.map(ne=>({...ne,type:"filament"})),...t.printer.map(ne=>({...ne,type:"printer"})),...t.process.map(ne=>({...ne,type:"process"}))].map(ne=>({...ne,meta:MI(ne.name)})),[t]),Z=w.useMemo(()=>{const K=new Set,ne=new Set,se=new Set;return q.forEach(ce=>{ce.meta.nozzle&&K.add(ce.meta.nozzle),ce.meta.filamentType&&ne.add(ce.meta.filamentType),ce.meta.layerHeight&&se.add(ce.meta.layerHeight)}),{printers:a.map(ce=>({id:ce.id.toString(),name:ce.name})),nozzles:Array.from(K).sort((ce,fe)=>parseFloat(ce)-parseFloat(fe)),filaments:Array.from(ne).sort(),layerHeights:Array.from(se).sort((ce,fe)=>parseFloat(ce)-parseFloat(fe))}},[q,a]),j=w.useMemo(()=>f==="all"?null:a.find(ne=>ne.id.toString()===f)?.model||null,[f,a]),E=w.useMemo(()=>q.filter(K=>d==="all"||K.type===d).filter(K=>{if(m==="all")return!0;const ne=T0(K.setting_id);return m==="custom"?ne:!ne}).filter(K=>{if(f==="all"||!j)return!0;const ne=K.meta.printer?.toLowerCase()||"",se=j.toLowerCase();return ne.includes(se)||se.includes(ne)}).filter(K=>x==="all"||K.meta.nozzle===x).filter(K=>v==="all"||K.meta.filamentType===v).filter(K=>k==="all"||K.meta.layerHeight===k).filter(K=>l===""||K.name.toLowerCase().includes(l.toLowerCase())).sort((K,ne)=>K.name.localeCompare(ne.name)),[q,d,m,f,j,x,v,k,l]),I=K=>{if(J){const ne=me[0]?.setting_id===K.setting_id,se=me[1]?.setting_id===K.setting_id;if(ne)ge([me[1],null]);else if(se)ge([me[0],null]);else if(!me[0])ge([K,null]);else if(me[1]){if(me[0].type!==K.type)return;ge([me[0],K])}else{if(me[0].type!==K.type)return;ge([me[0],K])}}else T(K)},W=K=>{if(me[0]?.setting_id===K.setting_id)return 0;if(me[1]?.setting_id===K.setting_id)return 1},B=async K=>{try{const ne=await be.getCloudSettingDetail(K.setting_id),se=K.type==="process"?"print":K.type;U({type:se,name:K.name,base_id:ne.base_id||"GFSA00",setting:ne.setting||{}}),T(null)}catch(ne){console.error("Failed to fetch preset details for duplication:",ne)}},ae=async K=>{try{Ce.removeQueries({queryKey:["cloudSettingDetail",K.setting_id]});const ne=await be.getCloudSettingDetail(K.setting_id),se=K.type==="process"?"print":K.type;L({type:se,name:K.name,base_id:ne.base_id||"GFSA00",setting:ne.setting||{},setting_id:K.setting_id}),T(null)}catch(ne){console.error("Failed to fetch preset details for editing:",ne)}},z=()=>{u("all"),p("all"),y("all"),b("all"),_("all"),P("all"),c("")},V=d!=="all"||m!=="all"||f!=="all"||x!=="all"||v!=="all"||k!=="all"||l!=="",ee=t.filament.length+t.printer.length+t.process.length;return i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"space-y-4 mb-6",children:[i.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[i.jsxs("div",{className:"relative flex-1",children:[i.jsx(Dr,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray"}),i.jsx("input",{type:"text",value:l,onChange:K=>c(K.target.value),placeholder:o("profiles.cloudView.searchPlaceholder"),className:"w-full pl-10 pr-4 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray-dark focus:border-bambu-green focus:outline-none"})]}),i.jsxs("div",{className:"flex gap-2 max-[550px]:flex-wrap max-[550px]:items-center",children:[i.jsxs(Fe,{variant:J?"primary":"secondary",onClick:()=>{J?(ue(!1),ge([null,null])):ue(!0)},children:[i.jsx(mb,{className:"w-4 h-4"}),o(J?"common.cancel":"profiles.presets.compare")]}),i.jsxs(Fe,{variant:"secondary",onClick:()=>D(!0),disabled:!s("cloud:auth"),title:s("cloud:auth")?void 0:o("profiles.cloudView.noTemplatesPermission"),children:[i.jsx(jb,{className:"w-4 h-4"}),o("profiles.cloudView.templates")]}),i.jsxs(Fe,{variant:"secondary",onClick:n,disabled:r||!s("cloud:auth"),title:s("cloud:auth")?void 0:o("profiles.cloudView.noRefreshPermission"),children:[i.jsx(_r,{className:`w-4 h-4 ${r?"animate-spin":""}`}),o("profiles.cloudView.refresh")]}),i.jsxs(Fe,{onClick:()=>R(!0),disabled:!s("cloud:auth"),title:s("cloud:auth")?void 0:o("profiles.cloudView.noCreatePermission"),children:[i.jsx(sr,{className:"w-4 h-4"}),o("profiles.cloudView.newPreset")]})]})]}),i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[i.jsx(dC,{className:"w-4 h-4 text-bambu-gray"}),i.jsx(Wg,{label:o("profiles.cloudView.filters.type"),value:d,options:[{value:"all",label:o("profiles.cloudView.filters.all"),count:ee},{value:"filament",label:o("profiles.cloudView.filters.filament"),count:t.filament.length},{value:"printer",label:o("profiles.cloudView.filters.printer"),count:t.printer.length},{value:"process",label:o("profiles.cloudView.filters.process"),count:t.process.length}],onChange:K=>u(K)}),i.jsx(Wg,{label:o("profiles.cloudView.filters.owner"),value:m,options:[{value:"all",label:o("profiles.cloudView.filters.all")},{value:"custom",label:o("profiles.cloudView.filters.myPresets")},{value:"builtin",label:o("profiles.cloudView.filters.builtIn")}],onChange:K=>p(K)}),Z.printers.length>0&&i.jsx(Wg,{label:o("profiles.cloudView.filters.printer"),value:f,options:[{value:"all",label:o("profiles.cloudView.filters.all")},...Z.printers.map(K=>({value:K.id,label:K.name}))],onChange:y}),Z.nozzles.length>0&&i.jsx(Wg,{label:o("profiles.cloudView.filters.nozzle"),value:x,options:[{value:"all",label:o("profiles.cloudView.filters.all")},...Z.nozzles.map(K=>({value:K,label:K}))],onChange:b}),Z.filaments.length>0&&(d==="all"||d==="filament")&&i.jsx(Wg,{label:o("profiles.cloudView.filters.filament"),value:v,options:[{value:"all",label:o("profiles.cloudView.filters.all")},...Z.filaments.map(K=>({value:K,label:K}))],onChange:_}),Z.layerHeights.length>0&&(d==="all"||d==="process")&&i.jsx(Wg,{label:o("profiles.cloudView.filters.layer"),value:k,options:[{value:"all",label:o("profiles.cloudView.filters.all")},...Z.layerHeights.map(K=>({value:K,label:K}))],onChange:P}),V&&i.jsx("button",{onClick:z,className:"px-3 py-2 text-sm text-bambu-gray hover:text-white transition-colors",children:o("profiles.cloudView.clearFilters")})]})]}),J&&i.jsx("div",{className:"mb-4 p-3 bg-blue-500/10 border border-blue-500/30 rounded-lg",children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center gap-4",children:[i.jsx(mb,{className:"w-5 h-5 text-blue-400"}),i.jsx("span",{className:"text-white font-medium",children:o("profiles.cloudView.compareMode")}),i.jsx("span",{className:"text-bambu-gray",children:me[0]?o("profiles.cloudView.selectAnotherPreset",{type:me[0].type}):o("profiles.cloudView.clickTwoPresets")})]}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:`px-2 py-1 text-sm rounded truncate max-w-[200px] ${me[0]?"bg-blue-500/30 text-blue-700 dark:text-blue-300":"bg-bambu-dark text-bambu-gray"}`,children:me[0]?me[0].name:o("profiles.cloudView.selectFirst")}),i.jsx(_D,{className:"w-4 h-4 text-bambu-gray"}),i.jsx("span",{className:`px-2 py-1 text-sm rounded truncate max-w-[200px] ${me[1]?"bg-blue-500/30 text-blue-700 dark:text-blue-300":"bg-bambu-dark text-bambu-gray"}`,children:me[1]?me[1].name:o("profiles.cloudView.selectSecond")})]}),me[0]&&me[1]&&i.jsxs(Fe,{size:"sm",onClick:async()=>{try{const[K,ne]=await Promise.all([be.getCloudSettingDetail(me[0].setting_id),be.getCloudSettingDetail(me[1].setting_id)]);pe([K.setting||{},ne.setting||{}]),ie(!0)}catch{}},children:[i.jsx(mb,{className:"w-4 h-4"}),o("profiles.cloudView.compareNow")]})]})]})}),i.jsxs("div",{className:"flex flex-wrap items-center gap-4 mb-4 text-sm text-bambu-gray",children:[e&&i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx(er,{className:"w-3 h-3"}),o("profiles.cloudView.lastSynced")," ",zv(e.toISOString(),"system",o)]}),i.jsx("span",{children:o("profiles.cloudView.showingCount",{showing:E.length,total:ee})}),i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-bambu-green"}),i.jsxs("span",{children:["= ",o("profiles.presets.myPreset")]})]})]}),E.length===0?i.jsxs("div",{className:"text-center py-16",children:[i.jsx(Vi,{className:"w-12 h-12 text-bambu-gray-dark mx-auto mb-4"}),i.jsx("p",{className:"text-bambu-gray",children:o("profiles.cloudView.noPresetsFound")}),V&&i.jsx("button",{onClick:z,className:"mt-2 text-sm text-bambu-green hover:text-bambu-green-light",children:o("profiles.cloudView.clearFilters")})]}):i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[i.jsxs("div",{children:[i.jsxs("div",{className:"flex items-center gap-2 mb-3 px-1",children:[i.jsx(lC,{className:"w-4 h-4 text-amber-400"}),i.jsx("h3",{className:"text-sm font-medium text-bambu-gray",children:o("profiles.cloudView.columns.filament")}),i.jsxs("span",{className:"text-xs text-bambu-gray-dark",children:["(",E.filter(K=>K.type==="filament").length,")"]})]}),i.jsxs("div",{className:"space-y-1 max-h-[calc(100vh-320px)] overflow-y-auto pr-1",children:[E.filter(K=>K.type==="filament").map(K=>i.jsx(Qj,{setting:K,onClick:()=>I(K),onDuplicate:()=>B(K),compareMode:J,isCompareSelected:W(K)!==void 0,compareIndex:W(K),compareDisabled:J&&!!me[0]&&me[0].type!==K.type,t:o},K.setting_id)),E.filter(K=>K.type==="filament").length===0&&i.jsx("p",{className:"text-xs text-bambu-gray-dark px-3 py-2",children:o("profiles.cloudView.noFilamentPresets")})]})]}),i.jsxs("div",{children:[i.jsxs("div",{className:"flex items-center gap-2 mb-3 px-1",children:[i.jsx(lu,{className:"w-4 h-4 text-blue-400"}),i.jsx("h3",{className:"text-sm font-medium text-bambu-gray",children:o("profiles.cloudView.columns.process")}),i.jsxs("span",{className:"text-xs text-bambu-gray-dark",children:["(",E.filter(K=>K.type==="process").length,")"]})]}),i.jsxs("div",{className:"space-y-1 max-h-[calc(100vh-320px)] overflow-y-auto pr-1",children:[E.filter(K=>K.type==="process").map(K=>i.jsx(Qj,{setting:K,onClick:()=>I(K),onDuplicate:()=>B(K),compareMode:J,isCompareSelected:W(K)!==void 0,compareIndex:W(K),compareDisabled:J&&!!me[0]&&me[0].type!==K.type,t:o},K.setting_id)),E.filter(K=>K.type==="process").length===0&&i.jsx("p",{className:"text-xs text-bambu-gray-dark px-3 py-2",children:o("profiles.cloudView.noProcessPresets")})]})]}),i.jsxs("div",{children:[i.jsxs("div",{className:"flex items-center gap-2 mb-3 px-1",children:[i.jsx(kr,{className:"w-4 h-4 text-purple-400"}),i.jsx("h3",{className:"text-sm font-medium text-bambu-gray",children:o("profiles.cloudView.columns.printer")}),i.jsxs("span",{className:"text-xs text-bambu-gray-dark",children:["(",E.filter(K=>K.type==="printer").length,")"]})]}),i.jsxs("div",{className:"space-y-1 max-h-[calc(100vh-320px)] overflow-y-auto pr-1",children:[E.filter(K=>K.type==="printer").map(K=>i.jsx(Qj,{setting:K,onClick:()=>I(K),onDuplicate:()=>B(K),compareMode:J,isCompareSelected:W(K)!==void 0,compareIndex:W(K),compareDisabled:J&&!!me[0]&&me[0].type!==K.type,t:o},K.setting_id)),E.filter(K=>K.type==="printer").length===0&&i.jsx("p",{className:"text-xs text-bambu-gray-dark px-3 py-2",children:o("profiles.cloudView.noPrinterPresets")})]})]})]}),C&&i.jsx(IJe,{setting:C,onClose:()=>T(null),onDeleted:()=>T(null),onDuplicate:()=>B(C),onEdit:()=>ae(C),hasPermission:s,t:o}),(N||$||G||te)&&i.jsx(UJe,{onClose:()=>{R(!1),U(null),L(null),re(null)},initialData:G||$||(te?{type:te.type,name:"",base_id:"",setting:te.setting}:void 0),allPresets:t,t:o}),A&&i.jsx(zJe,{onClose:()=>D(!1),onApply:K=>{re({type:K.type,setting:K.settings}),D(!1)},t:o}),X&&le&&me[0]&&me[1]&&i.jsx(Lse,{onClose:()=>{ie(!1),pe(null)},leftPreset:le[0],rightPreset:le[1],leftLabel:me[0].name,rightLabel:me[1].name,t:o})]})}function HJe(){const{t}=Mt(),e=tn(),{showToast:n}=bn(),{hasPermission:r}=Rr(),[a,s]=w.useState("cloud"),[o,l]=w.useState(),{data:c,isLoading:d}=Je({queryKey:["cloudStatus"],queryFn:be.getCloudStatus}),{data:u=[]}=Je({queryKey:["printers"],queryFn:be.getPrinters}),{data:m,isLoading:p,refetch:f,dataUpdatedAt:y}=Je({queryKey:["cloudSettings"],queryFn:()=>be.getCloudSettings(),enabled:!!c?.is_authenticated,retry:!1,staleTime:1e3*60*5});w.useEffect(()=>{y&&l(new Date(y))},[y]);const x=ut({mutationFn:be.cloudLogout,onSuccess:()=>{e.invalidateQueries({queryKey:["cloudStatus"]}),e.removeQueries({queryKey:["cloudSettings"]}),n(t("profiles.toast.loggedOut"))}}),b=()=>{e.invalidateQueries({queryKey:["cloudStatus"]})};return d?i.jsx("div",{className:"p-4 md:p-8 flex items-center justify-center min-h-[400px]",children:i.jsx(ct,{className:"w-8 h-8 text-bambu-green animate-spin"})}):i.jsxs("div",{className:"p-6 lg:p-8",children:[i.jsxs("div",{className:"mb-6",children:[i.jsx("h1",{className:"text-2xl font-bold text-white",children:t("profiles.title")}),i.jsx("p",{className:"text-bambu-gray",children:t("profiles.subtitle")})]}),i.jsxs("div",{className:"flex border-b border-bambu-dark-tertiary mb-6",children:[i.jsxs("button",{onClick:()=>s("cloud"),className:`flex items-center gap-2 px-4 py-3 text-sm font-medium transition-colors border-b-2 -mb-px ${a==="cloud"?"text-bambu-green border-bambu-green":"text-bambu-gray hover:text-white border-transparent"}`,children:[i.jsx(lx,{className:"w-4 h-4"}),t("profiles.tabs.cloud")]}),i.jsxs("button",{onClick:()=>s("local"),className:`flex items-center gap-2 px-4 py-3 text-sm font-medium transition-colors border-b-2 -mb-px ${a==="local"?"text-bambu-green border-bambu-green":"text-bambu-gray hover:text-white border-transparent"}`,children:[i.jsx(cx,{className:"w-4 h-4"}),t("profiles.tabs.local")]}),i.jsxs("button",{onClick:()=>s("kprofiles"),className:`flex items-center gap-2 px-4 py-3 text-sm font-medium transition-colors border-b-2 -mb-px ${a==="kprofiles"?"text-bambu-green border-bambu-green":"text-bambu-gray hover:text-white border-transparent"}`,children:[i.jsx(uC,{className:"w-4 h-4"}),t("profiles.tabs.kprofiles")]})]}),a==="cloud"&&i.jsxs(i.Fragment,{children:[c?.is_authenticated&&i.jsxs("div",{className:"flex items-center justify-between p-3 mb-6 bg-bambu-dark rounded-lg border border-bambu-dark-tertiary",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"w-2 h-2 rounded-full bg-bambu-green animate-pulse"}),i.jsxs("span",{className:"text-sm text-bambu-gray",children:[t("profiles.connectedAs")," ",i.jsx("span",{className:"text-white",children:c.email})]})]}),i.jsxs(Fe,{variant:"secondary",size:"sm",onClick:()=>x.mutate(),disabled:x.isPending||!r("cloud:auth"),title:r("cloud:auth")?void 0:t("profiles.noLogoutPermission"),children:[i.jsx(TD,{className:"w-4 h-4"}),t("profiles.logout")]})]}),c?.is_authenticated?p?i.jsx("div",{className:"flex items-center justify-center py-16",children:i.jsx(ct,{className:"w-8 h-8 text-bambu-green animate-spin"})}):m?i.jsx(BJe,{settings:m,lastSyncTime:o,onRefresh:()=>f(),isRefreshing:p,printers:u,hasPermission:r,t}):i.jsxs("div",{className:"text-center py-16",children:[i.jsx("p",{className:"text-bambu-gray mb-4",children:t("profiles.failedToLoad")}),i.jsx(Fe,{onClick:()=>f(),children:t("profiles.retry")})]}):i.jsx(LJe,{onSuccess:b,t})]}),a==="local"&&i.jsx(FJe,{}),a==="kprofiles"&&i.jsx(EJe,{}),i.jsx(OJe,{})]})}const iv={Droplet:lC,Flame:ape,Ruler:zfe,Sparkles:jb,Square:Sl,Cable:Hme,Wrench:Vp,Calendar:Xr,Timer:qd,Cog:Phe,Fan:VY,Zap:rc,Wind:rX,Thermometer:xC,Layers:Vi,Box:ra,Target:eX,RefreshCw:_r,Settings:bC,Filter:dC,CircleDot:che};function Av(t){return t&&iv[t]||Vp}function Kg(t,e,n){if(e==="days"){if(t<1)return n?n("common.today"):"Today";if(t===1)return n?n("maintenance.day"):"1 day";if(t<7){const a=Math.round(t);return n?n("maintenance.days",{count:a}):`${a} days`}if(t<180){const a=Math.round(t/7);return a===1?n?n("maintenance.week"):"1 week":n?n("maintenance.weeks",{count:a}):`${a} weeks`}const r=Math.round(t/30);return r===1?n?n("maintenance.month"):"1 month":n?n("maintenance.months",{count:r}):`${r} months`}else{if(t<1)return`${Math.round(t*60)}m`;if(t<24)return`${t<10?t.toFixed(1):Math.round(t)}h`;const r=t/24;if(r<7)return`${r<2?r.toFixed(1):Math.round(r)}d`;const a=r/7;return a<12?`${a<2?a.toFixed(1):Math.round(a)}w`:`${Math.round(a/4)}mo`}}function Zj(t,e,n){return e==="days"?t===1?n?n("maintenance.day"):"1 day":t===7?n?n("maintenance.week"):"1 week":t===14?n?n("maintenance.weeks",{count:2}):"2 weeks":t===30?n?n("maintenance.month"):"1 month":t===60?n?n("maintenance.months",{count:2}):"2 months":t===90?n?n("maintenance.months",{count:3}):"3 months":t===180?n?n("maintenance.months",{count:6}):"6 months":t===365?n?n("maintenance.year"):"1 year":n?n("maintenance.days",{count:t}):`${t} days`:`${t}h`}function $Je(t,e){const n=(e||"").toUpperCase().replace(/[- ]/g,""),r=n.includes("X1"),a=n.includes("P1"),s=n.includes("A1MINI"),o=n.includes("A1")&&!s,l=n.includes("H2D"),c=n.includes("H2C"),d=n.includes("H2S"),u=l||c||d,m=n.includes("P2S");switch(t){case"Lubricate Carbon Rods":return r?"https://wiki.bambulab.com/en/x1/maintenance/basic-maintenance":a?"https://wiki.bambulab.com/en/p1/maintenance/p1p-maintenance":null;case"Lubricate Steel Rods":return m?"https://wiki.bambulab.com/en/p2s/maintenance/lubricate-x-y-z-axis":null;case"Clean Steel Rods":return m?"https://wiki.bambulab.com/en/p2s/maintenance/lubricate-x-y-z-axis":null;case"Lubricate Linear Rails":return s?"https://wiki.bambulab.com/en/a1-mini/maintenance/lubricate-y-axis":o?"https://wiki.bambulab.com/en/a1/maintenance/lubricate-y-axis":u?"https://wiki.bambulab.com/en/h2/maintenance/x-axis-lubrication":null;case"Clean Nozzle/Hotend":return r||a?"https://wiki.bambulab.com/en/x1/troubleshooting/nozzle-clog":s||o?"https://wiki.bambulab.com/en/a1-mini/troubleshooting/nozzle-clog":u?"https://wiki.bambulab.com/en/h2/maintenance/nozzl-cold-pull-maintenance-and-cleaning":m?"https://wiki.bambulab.com/en/p2s/maintenance/cold-pull-maintenance-hotend":"https://wiki.bambulab.com/en/x1/troubleshooting/nozzle-clog";case"Check Belt Tension":return r?"https://wiki.bambulab.com/en/x1/maintenance/belt-tension":a?"https://wiki.bambulab.com/en/p1/maintenance/p1p-maintenance":s?"https://wiki.bambulab.com/en/a1-mini/maintenance/belt_tension":o?"https://wiki.bambulab.com/en/a1/maintenance/belt_tension":l?"https://wiki.bambulab.com/en/h2/maintenance/belt-tension":c?"https://wiki.bambulab.com/en/h2c/maintenance/belt-tension":d?"https://wiki.bambulab.com/en/h2s/maintenance/belt-tension":m?"https://wiki.bambulab.com/en/p2s/maintenance/belt-tension":"https://wiki.bambulab.com/en/x1/maintenance/belt-tension";case"Clean Carbon Rods":return r||a?"https://wiki.bambulab.com/en/general/carbon-rods-clearance":null;case"Clean Linear Rails":return s?"https://wiki.bambulab.com/en/a1-mini/maintenance/lubricate-y-axis":o?"https://wiki.bambulab.com/en/a1/maintenance/lubricate-y-axis":u?"https://wiki.bambulab.com/en/h2/maintenance/x-axis-lubrication":null;case"Clean Build Plate":return"https://wiki.bambulab.com/en/filament-acc/acc/pei-plate-clean-guide";case"Check PTFE Tube":return r||a?"https://wiki.bambulab.com/en/x1/maintenance/replace-ptfe-tube":s||o?"https://wiki.bambulab.com/en/a1-mini/maintenance/ptfe-tube":l?"https://wiki.bambulab.com/en/h2/maintenance/replace-ptfe-tube-on-h2d-printer":d?"https://wiki.bambulab.com/en/h2s/maintenance/replace-ptfe-tube-on-h2s-printer":c?"https://wiki.bambulab.com/en/h2/maintenance/replace-ptfe-tube-on-h2d-printer":"https://wiki.bambulab.com/en/x1/maintenance/replace-ptfe-tube";case"Replace HEPA Filter":case"HEPA Filter":case"Replace Carbon Filter":case"Carbon Filter":return u?"https://wiki.bambulab.com/en/h2/maintenance/replace-smoke-purifier-air-filte":"https://wiki.bambulab.com/en/x1/maintenance/replace-carbon-filter";case"Lubricate Left Nozzle Rail":case"Left Nozzle Rail":return u?"https://wiki.bambulab.com/en/h2/maintenance/x-axis-lubrication":null;default:return null}}function qJe({item:t,onPerform:e,onToggle:n,hasPermission:r,t:a}){const s=Av(t.maintenance_type_icon),o=t.interval_type||"hours",c=(()=>{if(o==="days"){const f=t.days_since_maintenance??0;return Math.max(0,Math.min(100,f/t.interval_hours*100))}return Math.max(0,Math.min(100,(t.interval_hours-t.hours_until_due)/t.interval_hours*100))})(),d=()=>t.enabled?t.is_due?"text-red-400":t.is_warning?"text-amber-400":"text-bambu-green":"text-bambu-gray",u=()=>t.enabled?t.is_due?"bg-red-500":t.is_warning?"bg-amber-500":"bg-bambu-green":"bg-bambu-gray/30",m=()=>t.enabled?t.is_due?"bg-red-500/5 border-red-500/20":t.is_warning?"bg-amber-500/5 border-amber-500/20":"bg-bambu-dark-secondary border-bambu-dark-tertiary":"bg-bambu-dark-secondary/50",p=()=>{if(!t.enabled)return a("common.disabled");if(o==="days"){const f=t.days_until_due??0;return t.is_due?a("maintenance.overdueBy",{duration:Kg(Math.abs(f),"days",a)}):t.is_warning?a("maintenance.dueIn",{duration:Kg(f,"days",a)}):a("maintenance.timeLeft",{duration:Kg(f,"days",a)})}else return t.is_due?a("maintenance.overdueBy",{duration:Kg(Math.abs(t.hours_until_due),"hours",a)}):t.is_warning?a("maintenance.dueIn",{duration:Kg(t.hours_until_due,"hours",a)}):a("maintenance.timeLeft",{duration:Kg(t.hours_until_due,"hours",a)})};return i.jsx("div",{className:`rounded-xl border p-4 transition-all ${m()}`,children:i.jsxs("div",{className:"flex items-start gap-3 max-[550px]:flex-wrap",children:[i.jsxs("div",{className:`relative p-2.5 rounded-lg shrink-0 ${t.is_due?"bg-red-500/20":t.is_warning?"bg-amber-500/20":t.enabled?"bg-bambu-dark":"bg-bambu-dark/50"}`,children:[i.jsx(s,{className:`w-5 h-5 ${d()}`}),t.enabled&&(t.is_due||t.is_warning)&&i.jsx("span",{className:`absolute -top-1 -right-1 w-2.5 h-2.5 rounded-full ${t.is_due?"bg-red-500":"bg-amber-500"} animate-pulse`})]}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("h3",{className:`font-medium truncate ${t.enabled?"text-white":"text-bambu-gray"}`,children:t.maintenance_type_name}),o==="days"&&i.jsx("span",{title:a("maintenance.timeBasedInterval"),children:i.jsx(Xr,{className:"w-3.5 h-3.5 text-bambu-gray shrink-0"})}),(()=>{const f=t.maintenance_type_wiki_url||$Je(t.maintenance_type_name,t.printer_model);return f?i.jsx("a",{href:f,target:"_blank",rel:"noopener noreferrer",className:"text-bambu-gray hover:text-bambu-green transition-colors shrink-0",title:a("maintenance.viewDocumentation"),onClick:y=>y.stopPropagation(),children:i.jsx(ei,{className:"w-3.5 h-3.5"})}):null})()]}),i.jsx("div",{className:"mt-2 mb-1.5",children:i.jsx("div",{className:"w-full h-1.5 bg-bambu-dark rounded-full overflow-hidden",children:i.jsx("div",{className:`h-full rounded-full transition-all duration-500 ${u()}`,style:{width:`${c}%`}})})}),i.jsxs("div",{className:`text-xs flex items-center gap-1 ${d()}`,children:[t.is_due&&i.jsx(En,{className:"w-3 h-3"}),t.is_warning&&!t.is_due&&i.jsx(er,{className:"w-3 h-3"}),!t.is_due&&!t.is_warning&&t.enabled&&i.jsx(Vr,{className:"w-3 h-3"}),p()]})]}),i.jsxs("div",{className:"flex items-center gap-2 shrink-0 max-[550px]:w-full max-[550px]:justify-end max-[550px]:mt-1",children:[i.jsx("span",{title:r("maintenance:update")?void 0:a("maintenance.noPermissionUpdate"),children:i.jsx(Gn,{checked:t.enabled,onChange:f=>n(t.id,f),disabled:!r("maintenance:update")})}),i.jsxs(Fe,{size:"sm",variant:t.is_due?"primary":"secondary",onClick:()=>e(t.id),disabled:!t.enabled||!r("maintenance:update"),title:r("maintenance:update")?void 0:a("maintenance.noPermissionPerform"),className:"!px-3",children:[i.jsx(uo,{className:"w-3.5 h-3.5"}),a("common.reset")]})]})]})})}function VJe({overview:t,onPerform:e,onToggle:n,onSetHours:r,hasPermission:a,t:s}){const[o,l]=w.useState(!1),[c,d]=w.useState(!1),[u,m]=w.useState(t.total_print_hours.toFixed(1)),p=[...t.maintenance_items].sort((x,b)=>x.is_due&&!b.is_due?-1:!x.is_due&&b.is_due?1:x.is_warning&&!b.is_warning?-1:!x.is_warning&&b.is_warning?1:x.maintenance_type_id-b.maintenance_type_id),f=p.find(x=>x.enabled&&(x.is_due||x.is_warning)),y=()=>{const x=parseFloat(u);!isNaN(x)&&x>=0&&(r(t.printer_id,x),d(!1))};return i.jsxs(Tt,{className:"overflow-hidden",children:[i.jsxs("div",{className:"p-5",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center gap-4",children:[i.jsx("h2",{className:"text-xl font-semibold text-white",children:t.printer_name}),i.jsxs("div",{className:"flex items-center gap-2",children:[t.due_count>0&&i.jsxs("span",{className:"px-2.5 py-1 bg-red-500/20 text-red-400 text-xs font-medium rounded-full flex items-center gap-1.5",children:[i.jsx(En,{className:"w-3 h-3"}),s("maintenance.overdueCount",{count:t.due_count})]}),t.warning_count>0&&i.jsxs("span",{className:"px-2.5 py-1 bg-amber-500/20 text-amber-400 text-xs font-medium rounded-full flex items-center gap-1.5",children:[i.jsx(er,{className:"w-3 h-3"}),s("maintenance.dueSoonCount",{count:t.warning_count})]}),t.due_count===0&&t.warning_count===0&&i.jsxs("span",{className:"px-2.5 py-1 bg-bambu-green/20 text-bambu-green text-xs font-medium rounded-full flex items-center gap-1.5",children:[i.jsx(Vr,{className:"w-3 h-3"}),s("maintenance.allGood")]})]})]}),i.jsxs("button",{onClick:()=>l(!o),className:"flex items-center gap-1.5 px-3 py-1.5 text-sm text-bambu-gray hover:text-white hover:bg-bambu-dark rounded-lg transition-colors",children:[o?i.jsx(vl,{className:"w-4 h-4"}):i.jsx(In,{className:"w-4 h-4"}),s(o?"common.collapse":"common.expand")]})]}),i.jsxs("div",{className:"flex items-center gap-6 mt-4",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"p-2 bg-bambu-dark/50 rounded-lg",children:i.jsx(qd,{className:"w-4 h-4 text-bambu-gray"})}),c?i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("input",{type:"number",value:u,onChange:x=>m(x.target.value),onKeyDown:x=>{x.key==="Enter"&&y(),x.key==="Escape"&&d(!1)},className:"w-24 px-2 py-1 bg-bambu-dark border border-bambu-dark-tertiary rounded text-white text-sm",min:"0",step:"1",autoFocus:!0}),i.jsx("span",{className:"text-xs text-bambu-gray",children:s("common.hours")}),i.jsx(Fe,{size:"sm",onClick:y,children:s("common.save")}),i.jsx(Fe,{size:"sm",variant:"secondary",onClick:()=>d(!1),children:s("common.cancel")})]}):i.jsxs("button",{onClick:()=>{a("maintenance:update")&&(m(Math.round(t.total_print_hours).toString()),d(!0))},className:`group ${a("maintenance:update")?"":"cursor-not-allowed opacity-60"}`,title:a("maintenance:update")?void 0:s("maintenance.noPermissionEditHours"),children:[i.jsxs("div",{className:`text-sm font-medium text-white ${a("maintenance:update")?"group-hover:text-bambu-green":""} transition-colors flex items-center gap-1`,children:[Math.round(t.total_print_hours)," ",s("common.hours"),i.jsx($p,{className:`w-3 h-3 text-bambu-gray ${a("maintenance:update")?"group-hover:text-bambu-green":""}`})]}),i.jsx("div",{className:"text-xs text-bambu-gray",children:s("maintenance.totalPrintTime")})]})]}),i.jsx("div",{className:"w-px h-10 bg-bambu-dark-tertiary"}),f&&i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:`p-2 rounded-lg ${f.is_due?"bg-red-500/20":"bg-amber-500/20"}`,children:(()=>{const x=Av(f.maintenance_type_icon);return i.jsx(x,{className:`w-4 h-4 ${f.is_due?"text-red-400":"text-amber-400"}`})})()}),i.jsxs("div",{children:[i.jsx("div",{className:`text-sm font-medium ${f.is_due?"text-red-400":"text-amber-400"}`,children:f.maintenance_type_name}),i.jsx("div",{className:`text-xs ${f.is_due?"text-red-400/70":"text-amber-400/70"}`,children:f.is_due?s("common.overdue"):s("maintenance.dueSoon")})]})]})]})]}),o&&i.jsx(Pt,{className:"pt-0 border-t border-bambu-dark-tertiary",children:i.jsx("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-3 pt-4",children:p.map(x=>i.jsx(qJe,{item:x,onPerform:e,onToggle:n,hasPermission:a,t:s},x.id))})})]})}function GJe({overview:t,types:e,onUpdateInterval:n,onAddType:r,onUpdateType:a,onDeleteType:s,onRestoreDefaults:o,isRestoringDefaults:l,onAssignType:c,onRemoveItem:d,hasPermission:u,t:m}){const[p,f]=w.useState(null),[y,x]=w.useState(""),[b,v]=w.useState("hours"),[_,k]=w.useState(!1),[P,C]=w.useState(""),[T,N]=w.useState("100"),[R,A]=w.useState("hours"),[D,$]=w.useState("Wrench"),[U,G]=w.useState(""),[L,te]=w.useState(new Set),[re,J]=w.useState(null),[ue,me]=w.useState(null),ge=w.useMemo(()=>t?t.map(O=>({id:O.printer_id,name:O.printer_name})):[],[t]),X=O=>t?t.filter(F=>F.maintenance_items.some(Q=>Q.maintenance_type_id===O)).map(F=>({printerId:F.printer_id,printerName:F.printer_name,itemId:F.maintenance_items.find(Q=>Q.maintenance_type_id===O)?.id})):[],ie=O=>{if(!t)return[];const F=new Set(X(O).map(Q=>Q.printerId));return ge.filter(Q=>!F.has(Q.id))},[le,pe]=w.useState(null),[Ce,q]=w.useState(""),[Z,j]=w.useState(""),[E,I]=w.useState("hours"),[W,B]=w.useState("Wrench"),[ae,z]=w.useState(""),V=O=>{pe(O),q(O.name),j(O.default_interval_hours.toString()),I(O.interval_type||"hours"),B(O.icon||"Wrench"),z(O.wiki_url||"")},ee=()=>{le&&Ce.trim()&&parseFloat(Z)>0&&(a(le.id,{name:Ce.trim(),default_interval_hours:parseFloat(Z),interval_type:E,icon:W,wiki_url:ae.trim()||null}),pe(null))},K=(O,F,Q)=>{const ve=parseFloat(y);if(!isNaN(ve)&&ve>0){const he=Math.abs(ve-F)<.01?null:ve;n(O,{custom_interval_hours:he,custom_interval_type:b!==Q?b:null})}f(null)},ne=O=>{O.preventDefault(),P.trim()&&parseFloat(T)>0&&L.size>0&&(r({name:P.trim(),default_interval_hours:parseFloat(T),interval_type:R,icon:D,wiki_url:U.trim()||null},Array.from(L)),C(""),N("100"),A("hours"),G(""),te(new Set),k(!1))},se=O=>{te(F=>{const Q=new Set(F);return Q.has(O)?Q.delete(O):Q.add(O),Q})},ce=t?.map(O=>({printerId:O.printer_id,printerName:O.printer_name,items:O.maintenance_items.sort((F,Q)=>F.maintenance_type_id-Q.maintenance_type_id)})).sort((O,F)=>O.printerName.localeCompare(F.printerName))||[],fe=e.filter(O=>O.is_system),oe=e.filter(O=>!O.is_system);return i.jsxs("div",{className:"space-y-8",children:[i.jsxs("div",{children:[i.jsxs("div",{className:"flex items-center justify-between mb-4",children:[i.jsxs("div",{children:[i.jsx("h2",{className:"text-lg font-semibold text-white",children:m("maintenance.maintenanceTypes")}),i.jsx("p",{className:"text-sm text-bambu-gray mt-1",children:m("maintenance.maintenanceTypesDescription")})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(Fe,{variant:"secondary",onClick:o,disabled:!u("maintenance:delete")||l,title:u("maintenance:delete")?void 0:m("maintenance.noPermissionDeleteTypes"),children:m("maintenance.restoreDefaults")}),i.jsxs(Fe,{onClick:()=>k(!_),disabled:!u("maintenance:create"),title:u("maintenance:create")?void 0:m("maintenance.noPermissionEditTypes"),children:[i.jsx(sr,{className:"w-4 h-4"}),m("maintenance.addCustomType")]})]})]}),_&&i.jsx(Tt,{className:"mb-6",children:i.jsx(Pt,{className:"py-4",children:i.jsxs("form",{onSubmit:ne,children:[i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4",children:[i.jsxs("div",{className:"lg:col-span-2",children:[i.jsx("label",{className:"block text-xs text-bambu-gray mb-1.5",children:m("common.name")}),i.jsx("input",{type:"text",value:P,onChange:O=>C(O.target.value),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",placeholder:m("maintenance.exampleName"),autoFocus:!0})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-xs text-bambu-gray mb-1.5",children:m("maintenance.intervalType")}),i.jsxs("select",{value:R,onChange:O=>{A(O.target.value),O.target.value==="days"?N("30"):N("100")},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",children:[i.jsx("option",{value:"hours",children:m("maintenance.printHours")}),i.jsx("option",{value:"days",children:m("maintenance.calendarDays")})]})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-xs text-bambu-gray mb-1.5",children:m("maintenance.intervalValue",{type:R==="days"?m("maintenance.calendarDays").toLowerCase():m("common.hours")})}),i.jsx("input",{type:"number",value:T,onChange:O=>N(O.target.value),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",min:"1"})]})]}),i.jsx("div",{className:"mt-4 flex items-end justify-between",children:i.jsxs("div",{children:[i.jsx("label",{className:"block text-xs text-bambu-gray mb-1.5",children:m("maintenance.icon")}),i.jsx("div",{className:"flex gap-1",children:Object.keys(iv).map(O=>{const F=iv[O];return i.jsx("button",{type:"button",onClick:()=>$(O),className:`p-2 rounded-lg transition-colors ${D===O?"bg-bambu-green text-white":"bg-bambu-dark text-bambu-gray hover:text-white hover:bg-bambu-dark-tertiary"}`,children:i.jsx(F,{className:"w-4 h-4"})},O)})})]})}),i.jsxs("div",{className:"mt-4",children:[i.jsx("label",{className:"block text-xs text-bambu-gray mb-1.5",children:m("maintenance.documentationLink")}),i.jsx("input",{type:"url",value:U,onChange:O=>G(O.target.value),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",placeholder:"https://wiki.bambulab.com/..."})]}),i.jsxs("div",{className:"mt-4",children:[i.jsx("label",{className:"block text-xs text-bambu-gray mb-1.5",children:m("maintenance.assignToPrinters")}),i.jsx("div",{className:"flex flex-wrap gap-2",children:ge.map(O=>i.jsx("button",{type:"button",onClick:()=>se(O.id),className:`px-3 py-1.5 rounded-lg text-sm transition-colors ${L.has(O.id)?"bg-bambu-green text-white":"bg-bambu-dark text-bambu-gray hover:text-white hover:bg-bambu-dark-tertiary"}`,children:O.name},O.id))}),L.size===0&&i.jsx("p",{className:"text-xs text-orange-400 mt-1",children:m("maintenance.selectAtLeastOnePrinter")})]}),i.jsxs("div",{className:"mt-4 flex justify-end gap-2",children:[i.jsx(Fe,{type:"button",variant:"secondary",onClick:()=>{k(!1),te(new Set)},children:m("common.cancel")}),i.jsx(Fe,{type:"submit",disabled:!P.trim()||L.size===0,children:m("maintenance.addType")})]})]})})}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3",children:[fe.map(O=>{const F=Av(O.icon),Q=O.interval_type||"hours";return i.jsx("div",{className:"bg-bambu-dark-secondary rounded-xl p-4 border border-bambu-dark-tertiary",children:i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"p-2.5 bg-bambu-dark rounded-lg",children:i.jsx(F,{className:"w-5 h-5 text-bambu-gray"})}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsx("div",{className:"text-sm font-medium text-white truncate",children:O.name}),i.jsxs("div",{className:"text-xs text-bambu-gray mt-0.5 flex items-center gap-1",children:[Q==="days"?i.jsx(Xr,{className:"w-3 h-3"}):i.jsx(qd,{className:"w-3 h-3"}),Zj(O.default_interval_hours,Q,m)]})]}),i.jsx("button",{onClick:()=>{u("maintenance:delete")&&me(O)},disabled:!u("maintenance:delete"),title:u("maintenance:delete")?void 0:m("maintenance.noPermissionDeleteTypes"),className:`p-2 rounded-lg hover:bg-bambu-dark text-bambu-gray hover:text-red-400 transition-colors ${u("maintenance:delete")?"":"opacity-50 cursor-not-allowed"}`,children:i.jsx(Qt,{className:"w-4 h-4"})})]})},O.id)}),oe.map(O=>{const F=Av(O.icon),Q=O.interval_type||"hours";if(le?.id===O.id)return i.jsx("div",{className:"bg-bambu-dark-secondary rounded-xl p-4 border border-bambu-green",children:i.jsxs("div",{className:"space-y-3",children:[i.jsx("input",{type:"text",value:Ce,onChange:_e=>q(_e.target.value),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",placeholder:m("common.name"),autoFocus:!0}),i.jsxs("div",{className:"flex gap-2",children:[i.jsxs("select",{value:E,onChange:_e=>I(_e.target.value),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",children:[i.jsx("option",{value:"hours",children:m("maintenance.printHours")}),i.jsx("option",{value:"days",children:m("maintenance.calendarDays")})]}),i.jsx("input",{type:"number",value:Z,onChange:_e=>j(_e.target.value),className:"w-24 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",min:"1"})]}),i.jsx("div",{className:"flex flex-wrap gap-1",children:Object.keys(iv).map(_e=>{const ze=iv[_e];return i.jsx("button",{type:"button",onClick:()=>B(_e),className:`p-1.5 rounded transition-colors ${W===_e?"bg-bambu-green text-white":"bg-bambu-dark text-bambu-gray hover:text-white"}`,children:i.jsx(ze,{className:"w-3.5 h-3.5"})},_e)})}),i.jsx("input",{type:"url",value:ae,onChange:_e=>z(_e.target.value),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",placeholder:m("maintenance.documentationLink")}),i.jsxs("div",{className:"flex gap-2",children:[i.jsx(Fe,{size:"sm",onClick:ee,disabled:!Ce.trim(),children:m("common.save")}),i.jsx(Fe,{size:"sm",variant:"secondary",onClick:()=>pe(null),children:m("common.cancel")})]})]})},O.id);const he=X(O.id),de=ie(O.id),Ae=re===O.id;return i.jsxs("div",{className:"bg-bambu-dark-secondary rounded-xl p-4 border border-bambu-green/30",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"p-2.5 bg-bambu-green/20 rounded-lg",children:i.jsx(F,{className:"w-5 h-5 text-bambu-green"})}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"text-sm font-medium text-white truncate",children:O.name}),i.jsx("span",{className:"px-1.5 py-0.5 bg-bambu-green/20 text-bambu-green text-[10px] font-medium rounded",children:m("maintenance.custom")})]}),i.jsxs("div",{className:"text-xs text-bambu-gray mt-0.5 flex items-center gap-1",children:[Q==="days"?i.jsx(Xr,{className:"w-3 h-3"}):i.jsx(qd,{className:"w-3 h-3"}),Zj(O.default_interval_hours,Q,m)]})]}),i.jsxs("button",{onClick:()=>J(Ae?null:O.id),className:`px-2 py-1 rounded-lg border transition-colors flex items-center gap-1 ${he.length>0?"border-bambu-green/50 bg-bambu-green/10 text-bambu-green hover:bg-bambu-green/20":"border-orange-400/50 bg-orange-400/10 text-orange-400 hover:bg-orange-400/20"}`,title:m("maintenance.printersAssignedClick",{count:he.length}),children:[i.jsx(kr,{className:"w-3 h-3"}),i.jsx("span",{className:"text-xs font-medium",children:he.length}),i.jsx(In,{className:`w-3 h-3 transition-transform ${Ae?"rotate-180":""}`})]}),i.jsx("button",{onClick:()=>V(O),disabled:!u("maintenance:update"),title:u("maintenance:update")?void 0:m("maintenance.noPermissionEditTypes"),className:`p-2 rounded-lg hover:bg-bambu-dark text-bambu-gray hover:text-white transition-colors ${u("maintenance:update")?"":"opacity-50 cursor-not-allowed"}`,children:i.jsx($p,{className:"w-4 h-4"})}),i.jsx("button",{onClick:()=>{confirm(m("maintenance.deleteTypeConfirm",{name:O.name}))&&s(O.id)},disabled:!u("maintenance:delete"),title:u("maintenance:delete")?void 0:m("maintenance.noPermissionDeleteTypes"),className:`p-2 rounded-lg hover:bg-bambu-dark text-bambu-gray hover:text-red-400 transition-colors ${u("maintenance:delete")?"":"opacity-50 cursor-not-allowed"}`,children:i.jsx(Qt,{className:"w-4 h-4"})})]}),Ae&&i.jsxs("div",{className:"mt-3 pt-3 border-t border-bambu-dark-tertiary",children:[i.jsx("p",{className:"text-xs text-bambu-gray mb-2",children:m("maintenance.assignedToPrinters")}),he.length===0?i.jsx("p",{className:"text-xs text-orange-400",children:m("maintenance.noPrintersAssigned")}):i.jsx("div",{className:"flex flex-wrap gap-1 mb-2",children:he.map(_e=>i.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 bg-bambu-dark rounded text-xs text-white",children:[_e.printerName,i.jsx("button",{onClick:()=>_e.itemId&&d(_e.itemId),disabled:!u("maintenance:delete"),title:u("maintenance:delete")?m("maintenance.removeFromPrinter"):m("maintenance.noPermissionRemovePrinter"),className:`ml-1 ${u("maintenance:delete")?"hover:text-red-400":"opacity-50 cursor-not-allowed"}`,children:"×"})]},_e.printerId))}),de.length>0&&i.jsxs("div",{className:"flex flex-wrap gap-1",children:[i.jsx("span",{className:"text-xs text-bambu-gray mr-1",children:m("maintenance.addPrinterShort")}),de.map(_e=>i.jsxs("button",{onClick:()=>c(_e.id,O.id),disabled:!u("maintenance:create"),title:u("maintenance:create")?void 0:m("maintenance.noPermissionAssignPrinter"),className:`px-2 py-1 bg-bambu-dark rounded text-xs transition-colors ${u("maintenance:create")?"hover:bg-bambu-green/20 text-bambu-gray hover:text-bambu-green":"opacity-50 cursor-not-allowed text-bambu-gray"}`,children:["+ ",_e.name]},_e.id))]})]})]},O.id)})]})]}),ce.length>0&&i.jsxs("div",{children:[i.jsxs("div",{className:"mb-4",children:[i.jsx("h2",{className:"text-lg font-semibold text-white",children:m("maintenance.intervalOverrides")}),i.jsx("p",{className:"text-sm text-bambu-gray mt-1",children:m("maintenance.intervalOverridesDescription")})]}),i.jsx("div",{className:"space-y-4",children:ce.map(O=>i.jsx(Tt,{children:i.jsxs(Pt,{className:"py-4",children:[i.jsx("h3",{className:"text-sm font-medium text-white mb-3",children:O.printerName}),i.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-2",children:O.items.map(F=>{const Q=Av(F.maintenance_type_icon),ve=e.find(ze=>ze.id===F.maintenance_type_id),he=ve?.default_interval_hours||F.interval_hours,de=ve?.interval_type||"hours",Ae=F.interval_type||"hours",_e=p===F.id;return i.jsxs("div",{className:"flex items-center gap-2 p-2.5 bg-bambu-dark rounded-lg",children:[i.jsx(Q,{className:"w-4 h-4 text-bambu-gray shrink-0"}),i.jsx("span",{className:"text-xs text-bambu-gray flex-1 truncate",children:F.maintenance_type_name}),_e?i.jsxs("div",{className:"flex items-center gap-1",children:[b==="days"?i.jsx(Xr,{className:"w-3.5 h-3.5 text-bambu-gray shrink-0"}):i.jsx(qd,{className:"w-3.5 h-3.5 text-bambu-gray shrink-0"}),i.jsxs("select",{value:b,onChange:ze=>v(ze.target.value),className:"px-1.5 py-1 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded text-white text-xs",children:[i.jsx("option",{value:"hours",children:m("maintenance.printHours")}),i.jsx("option",{value:"days",children:m("maintenance.calendarDays")})]}),i.jsx("input",{type:"number",value:y,onChange:ze=>x(ze.target.value),onKeyDown:ze=>{ze.key==="Enter"&&K(F.id,he,de),ze.key==="Escape"&&f(null)},className:"w-16 px-2 py-1 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded text-white text-xs",min:"1"}),i.jsx(Fe,{size:"sm",onClick:()=>K(F.id,he,de),children:"OK"})]}):i.jsxs("button",{onClick:()=>{u("maintenance:update")&&(f(F.id),x(F.interval_hours.toString()),v(Ae))},disabled:!u("maintenance:update"),title:u("maintenance:update")?void 0:m("maintenance.noPermissionEditIntervals"),className:`px-2 py-1 bg-bambu-dark-tertiary border border-bambu-dark-tertiary rounded text-xs font-medium text-white transition-colors flex items-center gap-1 ${u("maintenance:update")?"hover:bg-bambu-dark-secondary hover:border-bambu-green":"opacity-50 cursor-not-allowed"}`,children:[Ae==="days"?i.jsx(Xr,{className:"w-3 h-3"}):i.jsx(qd,{className:"w-3 h-3"}),Zj(F.interval_hours,Ae,m),i.jsx($p,{className:"w-3 h-3 text-bambu-gray"})]})]},F.id)})})]})},O.printerId))})]}),ce.length===0&&i.jsx(Tt,{children:i.jsxs(Pt,{className:"text-center py-12",children:[i.jsx(er,{className:"w-12 h-12 mx-auto mb-4 text-bambu-gray/30"}),i.jsx("p",{className:"text-bambu-gray",children:m("common.noPrinters")}),i.jsx("p",{className:"text-sm text-bambu-gray/70 mt-1",children:m("maintenance.intervalOverridesDescription")})]})}),ue&&i.jsx(Nn,{title:m("maintenance.deleteSystemTypeTitle"),message:m("maintenance.deleteSystemTypeMessage",{name:ue.name}),confirmText:m("common.delete"),cancelText:m("common.cancel"),variant:"danger",cancelVariant:"primary",cardClassName:"bg-red-950/70 border border-red-800/70",onConfirm:()=>{s(ue.id),me(null)},onCancel:()=>me(null)})]})}function WJe(){const{t}=Mt(),e=tn(),{showToast:n}=bn(),{hasPermission:r}=Rr(),[a,s]=w.useState("status"),{data:o,isLoading:l}=Je({queryKey:["maintenanceOverview"],queryFn:be.getMaintenanceOverview}),{data:c}=Je({queryKey:["maintenanceTypes"],queryFn:be.getMaintenanceTypes}),d=ut({mutationFn:({id:T,notes:N})=>be.performMaintenance(T,N),onSuccess:()=>{e.invalidateQueries({queryKey:["maintenanceOverview"]}),e.invalidateQueries({queryKey:["maintenanceSummary"]}),n(t("maintenance.maintenanceComplete"))},onError:T=>{n(T.message,"error")}}),u=ut({mutationFn:({id:T,data:N})=>be.updateMaintenanceItem(T,N),onSuccess:()=>{e.invalidateQueries({queryKey:["maintenanceOverview"]})},onError:T=>{n(T.message,"error")}}),m=ut({mutationFn:({id:T,data:N})=>be.updateMaintenanceType(T,N),onSuccess:()=>{e.invalidateQueries({queryKey:["maintenanceTypes"]}),e.invalidateQueries({queryKey:["maintenanceOverview"]}),n(t("maintenance.typeUpdated"))},onError:T=>{n(T.message,"error")}}),p=ut({mutationFn:be.deleteMaintenanceType,onSuccess:()=>{e.invalidateQueries({queryKey:["maintenanceTypes"]}),e.invalidateQueries({queryKey:["maintenanceOverview"]}),n(t("maintenance.typeDeleted"))},onError:T=>{n(T.message,"error")}}),f=ut({mutationFn:be.restoreDefaultMaintenanceTypes,onSuccess:T=>{e.invalidateQueries({queryKey:["maintenanceTypes"]}),e.invalidateQueries({queryKey:["maintenanceOverview"]}),n(t("maintenance.defaultsRestored",{count:T.restored}))},onError:T=>{n(T.message,"error")}}),y=ut({mutationFn:({printerId:T,hours:N})=>be.setPrinterHours(T,N),onSuccess:()=>{e.invalidateQueries({queryKey:["maintenanceOverview"]}),e.invalidateQueries({queryKey:["maintenanceSummary"]}),n(t("maintenance.printHoursUpdated"))},onError:T=>{n(T.message,"error")}}),x=ut({mutationFn:({printerId:T,typeId:N})=>be.assignMaintenanceType(T,N),onSuccess:()=>{e.invalidateQueries({queryKey:["maintenanceOverview"]}),n(t("maintenance.printerAssigned"))},onError:T=>{n(T.message,"error")}}),b=ut({mutationFn:be.removeMaintenanceItem,onSuccess:()=>{e.invalidateQueries({queryKey:["maintenanceOverview"]}),n(t("maintenance.printerRemoved"))},onError:T=>{n(T.message,"error")}}),v=T=>{d.mutate({id:T})},_=(T,N)=>{u.mutate({id:T,data:{enabled:N}})},k=(T,N)=>{y.mutate({printerId:T,hours:N})};if(l)return i.jsx("div",{className:"p-4 md:p-8 flex justify-center",children:i.jsx(ct,{className:"w-8 h-8 text-bambu-green animate-spin"})});const P=o?.reduce((T,N)=>T+N.due_count,0)||0,C=o?.reduce((T,N)=>T+N.warning_count,0)||0;return i.jsxs("div",{className:"p-4 md:p-8",children:[i.jsxs("div",{className:"mb-6",children:[i.jsx("h1",{className:"text-2xl font-bold text-white",children:t("maintenance.title")}),i.jsx("p",{className:"text-bambu-gray text-sm mt-1",children:a==="status"?i.jsxs(i.Fragment,{children:[P>0&&i.jsx("span",{className:"text-red-400",children:t("maintenance.dueCount",{count:P})}),P>0&&C>0&&" · ",C>0&&i.jsx("span",{className:"text-amber-400",children:t("maintenance.warningCount",{count:C})}),P===0&&C===0&&i.jsx("span",{className:"text-bambu-green",children:t("maintenance.allOk")})]}):t("maintenance.configureSettings")})]}),i.jsxs("div",{className:"flex gap-1 mb-6 border-b border-bambu-dark-tertiary",children:[i.jsx("button",{onClick:()=>s("status"),className:`px-4 py-2 text-sm font-medium border-b-2 -mb-px transition-colors ${a==="status"?"text-bambu-green border-bambu-green":"text-bambu-gray border-transparent hover:text-white"}`,children:t("maintenance.statusTab")}),i.jsx("button",{onClick:()=>s("settings"),className:`px-4 py-2 text-sm font-medium border-b-2 -mb-px transition-colors ${a==="settings"?"text-bambu-green border-bambu-green":"text-bambu-gray border-transparent hover:text-white"}`,children:t("maintenance.settingsTab")})]}),a==="status"?i.jsx("div",{className:"space-y-6",children:o&&o.length>0?[...o].sort((T,N)=>{const R=T.due_count*10+T.warning_count,A=N.due_count*10+N.warning_count;return R!==A?A-R:T.printer_name.localeCompare(N.printer_name)}).map(T=>i.jsx(VJe,{overview:T,onPerform:v,onToggle:_,onSetHours:k,hasPermission:r,t},T.printer_id)):i.jsx(Tt,{children:i.jsxs(Pt,{className:"text-center py-16",children:[i.jsx(Vp,{className:"w-16 h-16 mx-auto mb-4 text-bambu-gray/30"}),i.jsx("p",{className:"text-lg font-medium text-white mb-2",children:t("common.noPrinters")}),i.jsx("p",{className:"text-bambu-gray",children:t("maintenance.configureSettings")})]})})}):i.jsx(GJe,{overview:o,types:c||[],onUpdateInterval:(T,N)=>u.mutate({id:T,data:N}),onAddType:async(T,N)=>{const R=await be.createMaintenanceType(T);for(const A of N)await be.assignMaintenanceType(A,R.id);e.invalidateQueries({queryKey:["maintenanceTypes"]}),e.invalidateQueries({queryKey:["maintenanceOverview"]}),n(t("maintenance.typeUpdated"))},onUpdateType:(T,N)=>m.mutate({id:T,data:N}),onDeleteType:T=>p.mutate(T),onRestoreDefaults:()=>f.mutate(),isRestoringDefaults:f.isPending,onAssignType:(T,N)=>x.mutate({printerId:T,typeId:N}),onRemoveItem:T=>b.mutate(T),hasPermission:r,t})]})}const EK=["#ef4444","#f97316","#eab308","#22c55e","#06b6d4","#3b82f6","#8b5cf6","#ec4899","#6b7280"];function Ose({project:t,onClose:e,onSave:n,isLoading:r,t:a}){const[s,o]=w.useState(t?.name||""),[l,c]=w.useState(t?.description||""),[d,u]=w.useState(t?.color||EK[0]),[m,p]=w.useState(t?.target_count?.toString()||""),[f,y]=w.useState(t?.target_parts_count?.toString()||""),[x,b]=w.useState(t?.status||"active"),[v,_]=w.useState(t?.tags||""),[k,P]=w.useState(t?.due_date?.split("T")[0]||""),[C,T]=w.useState(t?.priority||"normal"),N=R=>{R.preventDefault(),n({name:s.trim(),description:l.trim()||void 0,color:d,target_count:m?parseInt(m,10):void 0,target_parts_count:f?parseInt(f,10):void 0,tags:v.trim()||void 0,due_date:k||void 0,priority:C,...t&&{status:x}})};return i.jsx("div",{className:"fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-4",children:i.jsxs("div",{className:"bg-bambu-dark-secondary rounded-lg w-full max-w-md border border-bambu-dark-tertiary",children:[i.jsx("div",{className:"p-4 border-b border-bambu-dark-tertiary",children:i.jsx("h2",{className:"text-lg font-semibold text-white",children:a(t?"projects.editProject":"projects.newProject")})}),i.jsxs("form",{onSubmit:N,className:"p-4 space-y-4",children:[i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-white mb-1",children:a("common.name")}),i.jsx("input",{type:"text",value:s,onChange:R=>o(R.target.value),className:"w-full bg-bambu-dark border border-bambu-dark-tertiary rounded px-3 py-2 text-white placeholder-bambu-gray focus:outline-none focus:border-bambu-green",placeholder:a("projects.namePlaceholder"),required:!0})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-white mb-1",children:a("common.description")}),i.jsx("textarea",{value:l,onChange:R=>c(R.target.value),className:"w-full bg-bambu-dark border border-bambu-dark-tertiary rounded px-3 py-2 text-white placeholder-bambu-gray focus:outline-none focus:border-bambu-green resize-none",placeholder:a("projects.descriptionPlaceholder"),rows:2})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-white mb-1",children:a("projects.color")}),i.jsx("div",{className:"flex gap-2 flex-wrap",children:EK.map(R=>i.jsx("button",{type:"button",onClick:()=>u(R),className:`w-8 h-8 rounded-full transition-transform ${d===R?"ring-2 ring-white ring-offset-2 ring-offset-bambu-dark-secondary scale-110":""}`,style:{backgroundColor:R}},R))})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-white mb-1",children:a("projects.targetPlates")}),i.jsx("input",{type:"number",value:m,onChange:R=>p(R.target.value),className:"w-full bg-bambu-dark border border-bambu-dark-tertiary rounded px-3 py-2 text-white placeholder-bambu-gray focus:outline-none focus:border-bambu-green",placeholder:a("projects.targetPlatesPlaceholder"),min:"1"}),i.jsx("p",{className:"text-xs text-bambu-gray mt-1",children:a("projects.targetPlatesHelp")})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-white mb-1",children:a("projects.targetParts")}),i.jsx("input",{type:"number",value:f,onChange:R=>y(R.target.value),className:"w-full bg-bambu-dark border border-bambu-dark-tertiary rounded px-3 py-2 text-white placeholder-bambu-gray focus:outline-none focus:border-bambu-green",placeholder:a("projects.targetPartsPlaceholder"),min:"1"}),i.jsx("p",{className:"text-xs text-bambu-gray mt-1",children:a("projects.targetPartsHelp")})]})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-white mb-1",children:a("projects.tagsLabel")}),i.jsx("input",{type:"text",value:v,onChange:R=>_(R.target.value),className:"w-full bg-bambu-dark border border-bambu-dark-tertiary rounded px-3 py-2 text-white placeholder-bambu-gray focus:outline-none focus:border-bambu-green",placeholder:a("projects.tagsPlaceholder")})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-white mb-1",children:a("projects.dueDate")}),i.jsx("input",{type:"date",value:k,onChange:R=>P(R.target.value),className:"w-full bg-bambu-dark border border-bambu-dark-tertiary rounded px-3 py-2 text-white focus:outline-none focus:border-bambu-green"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-white mb-1",children:a("projects.priority")}),i.jsxs("select",{value:C,onChange:R=>T(R.target.value),className:"w-full bg-bambu-dark border border-bambu-dark-tertiary rounded px-3 py-2 text-white focus:outline-none focus:border-bambu-green",children:[i.jsx("option",{value:"low",children:a("projects.priorityLow")}),i.jsx("option",{value:"normal",children:a("projects.priorityNormal")}),i.jsx("option",{value:"high",children:a("projects.priorityHigh")}),i.jsx("option",{value:"urgent",children:a("projects.priorityUrgent")})]})]})]}),t&&i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-white mb-1",children:a("common.status")}),i.jsxs("select",{value:x,onChange:R=>b(R.target.value),className:"w-full bg-bambu-dark border border-bambu-dark-tertiary rounded px-3 py-2 text-white focus:outline-none focus:border-bambu-green",children:[i.jsx("option",{value:"active",children:a("projects.statusActive")}),i.jsx("option",{value:"completed",children:a("projects.statusCompleted")}),i.jsx("option",{value:"archived",children:a("projects.statusArchived")})]})]}),i.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[i.jsx(Fe,{type:"button",variant:"secondary",onClick:e,children:a("common.cancel")}),i.jsx(Fe,{type:"submit",disabled:!s.trim()||r,children:r?i.jsx(ct,{className:"w-4 h-4 animate-spin"}):a(t?"common.save":"projects.create")})]})]})]})})}function KJe({project:t,onClick:e,onEdit:n,onDelete:r,hasPermission:a,t:s}){const o=t.target_count?Math.round(t.archive_count/t.target_count*100):0,l=t.target_parts_count?Math.round(t.completed_count/t.target_parts_count*100):0,c=t.status==="completed",d=t.status==="archived",[u,m]=w.useState(!1),f=c?{icon:Eb,color:"text-bambu-green",bg:"bg-bambu-green/10"}:d?{icon:Fs,color:"text-bambu-gray",bg:"bg-bambu-gray/10"}:t.queue_count>0?{icon:er,color:"text-blue-400",bg:"bg-blue-400/10"}:{icon:fs,color:"text-bambu-gray",bg:"bg-bambu-gray/10"};return i.jsxs("div",{className:"group relative bg-gradient-to-br from-bambu-card to-bambu-dark-secondary rounded-xl border border-bambu-dark-tertiary hover:border-bambu-green/50 hover:shadow-lg hover:shadow-bambu-green/5 transition-all duration-300 cursor-pointer overflow-hidden",onClick:e,children:[i.jsx("div",{className:"absolute top-0 left-0 w-1.5 h-full",style:{backgroundColor:t.color||"#6b7280",boxShadow:`0 0 12px ${t.color||"#6b7280"}40`}}),i.jsxs("div",{className:"p-5 pl-6",children:[i.jsxs("div",{className:"flex items-start justify-between mb-4",children:[i.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[i.jsx("div",{className:`p-2 rounded-lg ${f.bg} flex-shrink-0`,children:i.jsx(f.icon,{className:`w-5 h-5 ${f.color}`})}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[i.jsx("h3",{className:"font-semibold text-white truncate",children:t.name}),t.target_parts_count?i.jsxs("span",{className:`text-xs px-2 py-0.5 rounded-full whitespace-nowrap font-medium ${l>=100?"bg-bambu-green/20 text-bambu-green":"bg-bambu-dark text-bambu-gray"}`,children:[t.completed_count,"/",t.target_parts_count," ",s("projects.parts")]}):t.target_count?i.jsxs("span",{className:`text-xs px-2 py-0.5 rounded-full whitespace-nowrap font-medium ${o>=100?"bg-bambu-green/20 text-bambu-green":"bg-bambu-dark text-bambu-gray"}`,children:[t.archive_count,"/",t.target_count," ",s("projects.plates")]}):t.completed_count>0?i.jsxs("span",{className:"text-xs px-2 py-0.5 rounded-full whitespace-nowrap font-medium bg-bambu-dark text-bambu-gray",children:[t.completed_count," ",s("projects.parts")]}):null,c&&i.jsx("span",{className:"text-xs bg-bambu-green/20 text-bambu-green px-2 py-0.5 rounded-full whitespace-nowrap",children:s("projects.done")}),d&&i.jsx("span",{className:"text-xs bg-bambu-gray/20 text-bambu-gray px-2 py-0.5 rounded-full whitespace-nowrap",children:s("projects.statusArchived")})]}),t.description&&i.jsx("p",{className:"text-sm text-bambu-gray/70 mt-1 line-clamp-1",children:t.description}),t.archives&&t.archives.length>0&&(()=>{const y=t.archives.map(_=>_.filament_type).filter(Boolean).flatMap(_=>_.split(",").map(k=>k.trim())).filter(Boolean),x=[...new Set(y)],b=t.archives.map(_=>_.filament_color).filter(Boolean).flatMap(_=>_.split(",").map(k=>k.trim())).filter(_=>_.startsWith("#")||/^[0-9A-Fa-f]{6}$/.test(_)),v=[...new Set(b)];return x.length===0&&v.length===0?null:i.jsxs("div",{className:"flex items-center gap-2 mt-1.5",children:[x.slice(0,3).map(_=>i.jsx("span",{className:"text-[10px] px-1.5 py-0.5 bg-bambu-dark text-bambu-gray rounded",children:_},_)),v.length>0&&i.jsxs("div",{className:"flex items-center gap-0.5",children:[v.slice(0,5).map(_=>i.jsx("div",{className:"w-3 h-3 rounded-full border border-white/20",style:{backgroundColor:_.startsWith("#")?_:`#${_}`},title:_},_)),v.length>5&&i.jsxs("span",{className:"text-[10px] text-bambu-gray ml-0.5",children:["+",v.length-5]})]})]})})()]})]}),i.jsxs("div",{className:"relative",onClick:y=>y.stopPropagation(),children:[i.jsx("button",{className:"p-1.5 rounded-lg hover:bg-bambu-dark text-bambu-gray hover:text-white transition-colors opacity-0 group-hover:opacity-100",onClick:()=>m(!u),children:i.jsx(Bm,{className:"w-4 h-4"})}),u&&i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"fixed inset-0 z-10",onClick:()=>m(!1)}),i.jsxs("div",{className:"absolute right-0 top-8 z-20 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg shadow-xl py-1 min-w-[120px]",children:[i.jsxs("button",{className:`w-full px-3 py-2 text-left text-sm flex items-center gap-2 ${a("projects:update")?"text-white hover:bg-bambu-dark":"text-bambu-gray cursor-not-allowed"}`,onClick:()=>{a("projects:update")&&(n(),m(!1))},disabled:!a("projects:update"),title:a("projects:update")?void 0:s("projects.noEditPermission"),children:[i.jsx($p,{className:"w-4 h-4"}),s("common.edit")]}),i.jsxs("button",{className:`w-full px-3 py-2 text-left text-sm flex items-center gap-2 ${a("projects:delete")?"text-red-400 hover:bg-bambu-dark":"text-bambu-gray cursor-not-allowed"}`,onClick:()=>{a("projects:delete")&&(r(),m(!1))},disabled:!a("projects:delete"),title:a("projects:delete")?void 0:s("projects.noDeletePermission"),children:[i.jsx(Qt,{className:"w-4 h-4"}),s("common.delete")]})]})]})]})]}),i.jsx("div",{className:"mb-4",children:t.target_count||t.target_parts_count?i.jsxs("div",{className:"space-y-3",children:[t.target_count&&i.jsxs("div",{children:[i.jsxs("div",{className:"flex items-center justify-between text-xs mb-1",children:[i.jsx("span",{className:"text-bambu-gray",children:s("projects.plates")}),i.jsxs("span",{className:o>=100?"text-bambu-green font-medium":"text-white",children:[t.archive_count," / ",t.target_count]})]}),i.jsx("div",{className:"h-2 bg-bambu-dark/80 rounded-full overflow-hidden backdrop-blur-sm",children:i.jsx("div",{className:"h-full transition-all duration-500 ease-out rounded-full relative",style:{width:`${Math.min(o,100)}%`,background:o>=100?"linear-gradient(90deg, #22c55e, #4ade80)":`linear-gradient(90deg, ${t.color||"#6b7280"}, ${t.color||"#6b7280"}cc)`,boxShadow:`0 0 8px ${o>=100?"#22c55e":t.color||"#6b7280"}60`}})})]}),t.target_parts_count&&i.jsxs("div",{children:[i.jsxs("div",{className:"flex items-center justify-between text-xs mb-1",children:[i.jsx("span",{className:"text-bambu-gray",children:s("projects.parts")}),i.jsxs("span",{className:l>=100?"text-bambu-green font-medium":"text-white",children:[t.completed_count," / ",t.target_parts_count]})]}),i.jsx("div",{className:"h-2 bg-bambu-dark/80 rounded-full overflow-hidden backdrop-blur-sm",children:i.jsx("div",{className:"h-full transition-all duration-500 ease-out rounded-full relative",style:{width:`${Math.min(l,100)}%`,background:l>=100?"linear-gradient(90deg, #22c55e, #4ade80)":`linear-gradient(90deg, ${t.color||"#6b7280"}, ${t.color||"#6b7280"}cc)`,boxShadow:`0 0 8px ${l>=100?"#22c55e":t.color||"#6b7280"}60`}})})]}),t.failed_count>0&&i.jsxs("div",{className:"text-xs text-red-400",children:[t.failed_count," ",s("projects.failed")]})]}):t.completed_count>0||t.failed_count>0?i.jsxs("div",{className:"flex items-center gap-4 text-xs",children:[t.completed_count>0&&i.jsxs("div",{className:"flex items-center gap-1.5 text-bambu-gray",children:[i.jsx(Fs,{className:"w-3.5 h-3.5"}),i.jsxs("span",{children:[t.completed_count," ",s("projects.completed")]})]}),t.failed_count>0&&i.jsxs("div",{className:"flex items-center gap-1.5 text-red-400",children:[i.jsx(En,{className:"w-3.5 h-3.5"}),i.jsxs("span",{children:[t.failed_count," ",s("projects.failed")]})]}),t.queue_count>0&&i.jsxs("div",{className:"flex items-center gap-1.5 text-blue-400",children:[i.jsx(er,{className:"w-3.5 h-3.5"}),i.jsxs("span",{children:[t.queue_count," ",s("projects.inQueue")]})]})]}):i.jsx("div",{className:"text-xs text-bambu-gray/60 italic",children:s("projects.noPrintsYet")})}),t.archives&&t.archives.length>0&&i.jsxs("div",{className:"mb-4",children:[i.jsx("div",{className:"grid grid-cols-4 gap-1.5",children:t.archives.slice(0,4).map(y=>i.jsxs("div",{className:"relative aspect-square rounded-lg bg-bambu-dark overflow-hidden border border-bambu-dark-tertiary",title:y.print_name||"Unknown",children:[y.thumbnail_path?i.jsx("img",{src:be.getArchiveThumbnail(y.id),alt:y.print_name||"",className:"w-full h-full object-cover"}):i.jsx("div",{className:"w-full h-full flex items-center justify-center text-bambu-gray/50",children:i.jsx(sa,{className:"w-6 h-6"})}),y.status==="failed"&&i.jsx("div",{className:"absolute inset-0 bg-red-500/40 flex items-center justify-center",children:i.jsx(En,{className:"w-4 h-4 text-white"})})]},y.id))}),t.archive_count>4&&i.jsx("p",{className:"text-xs text-bambu-gray mt-1.5 text-center",children:s("common.more",{count:t.archive_count-4})})]}),i.jsxs("div",{className:"flex items-center justify-between pt-3 border-t border-bambu-dark-tertiary",children:[i.jsxs("div",{className:"flex items-center gap-4 text-xs text-bambu-gray",children:[i.jsxs("div",{className:"flex items-center gap-1.5",title:s("projects.printJobs"),children:[i.jsx(Vi,{className:"w-3.5 h-3.5 text-blue-400"}),i.jsxs("span",{children:[t.archive_count," ",s("projects.plates")]})]}),i.jsxs("div",{className:"flex items-center gap-1.5",title:s("projects.partsPrinted"),children:[i.jsx(sa,{className:"w-3.5 h-3.5 text-bambu-green"}),i.jsxs("span",{children:[t.completed_count," ",s("projects.parts")]})]}),t.failed_count>0&&i.jsxs("div",{className:"flex items-center gap-1.5 text-red-400",title:s("projects.failedParts"),children:[i.jsx(En,{className:"w-3.5 h-3.5"}),i.jsx("span",{children:t.failed_count})]}),t.queue_count>0&&i.jsxs("div",{className:"flex items-center gap-1.5 text-yellow-400",title:s("projects.inQueue"),children:[i.jsx(CD,{className:"w-3.5 h-3.5"}),i.jsx("span",{children:t.queue_count})]})]}),i.jsx(pa,{className:"w-4 h-4 text-bambu-gray/50 group-hover:text-bambu-gray transition-colors"})]})]})]})}function YJe(){const{t}=Mt(),e=Ml(),n=tn(),{showToast:r}=bn(),{hasPermission:a}=Rr(),[s,o]=w.useState(!1),[l,c]=w.useState(),[d,u]=w.useState("active"),[m,p]=w.useState(null),{data:f,isLoading:y}=Je({queryKey:["projects",d==="all"?void 0:d],queryFn:()=>be.getProjects(d==="all"?void 0:d)}),x=ut({mutationFn:G=>be.createProject(G),onSuccess:()=>{n.invalidateQueries({queryKey:["projects"]}),o(!1),r(t("projects.toast.created"),"success")},onError:G=>{r(G.message,"error")}}),b=ut({mutationFn:({id:G,data:L})=>be.updateProject(G,L),onSuccess:()=>{n.invalidateQueries({queryKey:["projects"]}),o(!1),c(void 0),r(t("projects.toast.updated"),"success")},onError:G=>{r(G.message,"error")}}),v=ut({mutationFn:G=>be.deleteProject(G),onSuccess:()=>{p(null),r(t("projects.toast.deleted"),"success"),setTimeout(()=>window.location.reload(),100)},onError:G=>{p(null),r(G.message,"error")}}),_=ut({mutationFn:G=>be.importProject(G),onSuccess:()=>{n.invalidateQueries({queryKey:["projects"]}),r(t("projects.toast.imported"),"success")},onError:G=>{r(G.message,"error")}}),k=w.useRef(null),P=async()=>{try{const G=await be.getProjects(),L=await Promise.all(G.map(async ue=>await be.exportProjectJson(ue.id))),te=new Blob([JSON.stringify(L,null,2)],{type:"application/json"}),re=URL.createObjectURL(te),J=document.createElement("a");J.href=re,J.download=`bambuddy_projects_${new Date().toISOString().split("T")[0]}.json`,J.click(),URL.revokeObjectURL(re),r(t("projects.toast.exported"),"success")}catch(G){r(G.message,"error")}},C=()=>{k.current?.click()},T=async G=>{const L=G.target.files?.[0];if(L){try{if(L.name.toLowerCase().endsWith(".zip"))await be.importProjectFile(L),n.invalidateQueries({queryKey:["projects"]}),r(t("projects.toast.imported"),"success");else{const re=await L.text(),J=JSON.parse(re),ue=Array.isArray(J)?J:[J];for(const me of ue)await _.mutateAsync(me);ue.length>1&&r(t("projects.toast.multipleImported",{count:ue.length}),"success")}}catch(te){r(`${t("projects.toast.importFailed")}: ${te.message}`,"error")}G.target.value=""}},N=G=>{l?b.mutate({id:l.id,data:G}):x.mutate(G)},R=G=>{c(G),o(!0)},A=G=>{e(`/projects/${G.id}`)},D=G=>{p(G)},$=()=>{m!==null&&v.mutate(m)},U=f?.reduce((G,L)=>(G[L.status]=(G[L.status]||0)+1,G.all=(G.all||0)+1,G),{})||{};return i.jsxs("div",{className:"p-4 md:p-8 space-y-8",children:[i.jsx("input",{ref:k,type:"file",accept:".json,.zip",onChange:T,className:"hidden"}),i.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[i.jsxs("div",{children:[i.jsxs("h1",{className:"text-2xl font-bold text-white flex items-center gap-3",children:[i.jsx("div",{className:"p-2.5 bg-bambu-green/10 rounded-xl",children:i.jsx(fs,{className:"w-6 h-6 text-bambu-green"})}),t("projects.title")]}),i.jsx("p",{className:"text-sm text-bambu-gray mt-2 ml-14",children:t("projects.subtitle")})]}),i.jsxs("div",{className:"flex gap-2",children:[i.jsxs(Fe,{variant:"secondary",onClick:C,disabled:!a("projects:create"),title:a("projects:create")?t("projects.importProject"):t("projects.noImportPermission"),children:[i.jsx(Si,{className:"w-4 h-4 mr-2"}),t("projects.import")]}),i.jsxs(Fe,{variant:"secondary",onClick:P,disabled:!a("projects:read"),title:a("projects:read")?t("projects.exportAll"):t("projects.noExportPermission"),children:[i.jsx(pi,{className:"w-4 h-4 mr-2"}),t("projects.export")]}),i.jsxs(Fe,{onClick:()=>o(!0),className:"sm:w-auto w-full",disabled:!a("projects:create"),title:a("projects:create")?void 0:t("projects.noCreatePermission"),children:[i.jsx(sr,{className:"w-4 h-4 mr-2"}),t("projects.newProject")]})]})]}),i.jsx("div",{className:"flex gap-1 p-1 bg-bambu-dark rounded-xl w-fit",children:[{key:"active",label:t("projects.statusActive"),icon:er},{key:"completed",label:t("projects.statusCompleted"),icon:Eb},{key:"archived",label:t("projects.statusArchived"),icon:Fs},{key:"all",label:t("common.all"),icon:fs}].map(({key:G,label:L,icon:te})=>i.jsxs("button",{onClick:()=>u(G),className:`flex items-center gap-2 px-4 py-2 text-sm rounded-lg transition-all ${d===G?"bg-bambu-card text-white shadow-sm":"text-bambu-gray hover:text-white"}`,children:[i.jsx(te,{className:"w-4 h-4"}),i.jsx("span",{children:L}),U[G]>0&&i.jsx("span",{className:`text-xs px-1.5 py-0.5 rounded-full ${d===G?"bg-bambu-green/20 text-bambu-green":"bg-bambu-dark-tertiary"}`,children:U[G]})]},G))}),y?i.jsx("div",{className:"flex items-center justify-center py-20",children:i.jsxs("div",{className:"flex flex-col items-center gap-3",children:[i.jsx(ct,{className:"w-8 h-8 animate-spin text-bambu-green"}),i.jsx("p",{className:"text-sm text-bambu-gray",children:t("projects.loading")})]})}):f?.length===0?i.jsxs("div",{className:"flex flex-col items-center justify-center py-20 px-4",children:[i.jsx("div",{className:"p-4 bg-bambu-dark rounded-2xl mb-4",children:i.jsx(fs,{className:"w-12 h-12 text-bambu-gray/50"})}),i.jsx("h3",{className:"text-lg font-medium text-white mb-2",children:d==="all"?t("projects.noProjects"):t("projects.noProjectsFiltered",{status:d})}),i.jsx("p",{className:"text-bambu-gray text-center max-w-md mb-6",children:d==="all"?t("projects.createFirst"):t("projects.noProjectsFilteredHelp",{status:d})}),d==="all"&&i.jsxs(Fe,{onClick:()=>o(!0),disabled:!a("projects:create"),title:a("projects:create")?void 0:t("projects.noCreatePermission"),children:[i.jsx(sr,{className:"w-4 h-4 mr-2"}),t("projects.createFirstButton")]})]}):i.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-8",children:f?.map(G=>i.jsx(KJe,{project:G,onClick:()=>A(G),onEdit:()=>R(G),onDelete:()=>D(G.id),hasPermission:a,t},G.id))}),m!==null&&i.jsx(Nn,{title:t("projects.deleteProject"),message:t("projects.deleteConfirm"),confirmText:t("projects.deleteProject"),variant:"danger",onConfirm:$,onCancel:()=>p(null)}),s&&i.jsx(Ose,{project:l,onClose:()=>{o(!1),c(void 0)},onSave:N,isLoading:x.isPending||b.isPending,t})]})}function XJe(t){return t>=1e3?`${(t/1e3).toFixed(2)}kg`:`${Math.round(t)}g`}function QJe({status:t,t:e}){const n={active:"bg-bambu-green/20 text-bambu-green",completed:"bg-blue-500/20 text-blue-400",archived:"bg-bambu-gray/20 text-bambu-gray"},r=n[t]||n.active,a={active:e("projectDetail.status.active"),completed:e("projectDetail.status.completed"),archived:e("projectDetail.status.archived")};return i.jsx("span",{className:`px-2 py-1 rounded text-sm font-medium ${r}`,children:a[t]||t.charAt(0).toUpperCase()+t.slice(1)})}function jK({icon:t,label:e,value:n,subValue:r,hint:a,color:s="text-bambu-gray"}){return i.jsx(Tt,{children:i.jsx(Pt,{className:"p-4",children:i.jsxs("div",{className:"flex items-center gap-3",title:a,children:[i.jsx("div",{className:`p-2 rounded-lg bg-bambu-dark ${s}`,children:i.jsx(t,{className:"w-5 h-5"})}),i.jsxs("div",{children:[i.jsx("p",{className:"text-sm text-bambu-gray",children:e}),i.jsx("p",{className:"text-xl font-semibold text-white",children:n}),r&&i.jsx("p",{className:"text-xs text-bambu-gray/70",children:r})]})]})})})}function ZJe({archives:t,t:e}){return t.length===0?i.jsxs("div",{className:"text-center py-8 text-bambu-gray",children:[i.jsx(sa,{className:"w-12 h-12 mx-auto mb-2 opacity-50"}),i.jsx("p",{children:e("projectDetail.noPrints")})]}):i.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6 gap-3",children:t.map(n=>i.jsxs(Js,{to:`/archives?search=${encodeURIComponent(n.print_name||"")}`,className:"group relative aspect-square rounded-lg bg-bambu-dark border border-bambu-dark-tertiary overflow-hidden hover:border-bambu-green transition-colors",children:[n.thumbnail_path?i.jsx("img",{src:be.getArchiveThumbnail(n.id),alt:n.print_name||"Print",className:"w-full h-full object-cover"}):i.jsx("div",{className:"w-full h-full flex items-center justify-center text-bambu-gray",children:i.jsx(sa,{className:"w-8 h-8"})}),n.status==="failed"&&i.jsx("div",{className:"absolute inset-0 bg-red-500/30 flex items-center justify-center",children:i.jsx(qi,{className:"w-8 h-8 text-white"})}),n.status==="completed"&&i.jsx("div",{className:"absolute top-1 right-1",children:i.jsx(fr,{className:"w-4 h-4 text-bambu-green"})}),i.jsx("div",{className:"absolute inset-x-0 bottom-0 bg-gradient-to-t from-black/80 to-transparent p-2 opacity-0 group-hover:opacity-100 transition-opacity",children:i.jsx("p",{className:"text-xs text-white truncate",children:n.print_name||"Unknown"})})]},n.id))})}function JJe({priority:t,t:e}){const n={low:{color:"bg-gray-500/20 text-gray-400",label:e("projectDetail.priority.low")},normal:{color:"bg-blue-500/20 text-blue-400",label:e("projectDetail.priority.normal")},high:{color:"bg-orange-500/20 text-orange-400",label:e("projectDetail.priority.high")},urgent:{color:"bg-red-500/20 text-red-400",label:e("projectDetail.priority.urgent")}},{color:r,label:a}=n[t]||n.normal;return i.jsxs("span",{className:`px-2 py-1 rounded text-xs font-medium flex items-center gap-1 ${r}`,children:[t==="urgent"&&i.jsx(En,{className:"w-3 h-3"}),a]})}function Jj(t,e){if(!t)return null;const n=Jn(t);if(!n)return null;const r=new Date,a=Math.ceil((n.getTime()-r.getTime())/(1e3*60*60*24));return a<0?{color:"text-red-400",label:e("projectDetail.dueDate.overdue")}:a===0?{color:"text-orange-400",label:e("projectDetail.dueDate.today")}:a<=3?{color:"text-yellow-400",label:e("projectDetail.dueDate.daysLeft",{count:a})}:{color:"text-bambu-gray",label:e("projectDetail.dueDate.daysLeft",{count:a})}}function eet(){const{id:t}=M0(),e=Ml(),{t:n}=Mt(),r=tn(),{showToast:a}=bn(),{hasPermission:s}=Rr(),[o,l]=w.useState(!1),[c,d]=w.useState(!1),[u,m]=w.useState(""),p=parseInt(t||"0",10),{data:f,isLoading:y,error:x}=Je({queryKey:["project",p],queryFn:()=>be.getProject(p),enabled:p>0}),{data:b,isLoading:v}=Je({queryKey:["project-archives",p],queryFn:()=>be.getProjectArchives(p),enabled:p>0}),{data:_,isLoading:k}=Je({queryKey:["project-bom",p],queryFn:()=>be.getProjectBOM(p),enabled:p>0}),{data:P,isLoading:C}=Je({queryKey:["project-timeline",p],queryFn:()=>be.getProjectTimeline(p,20),enabled:p>0}),{data:T}=Je({queryKey:["settings"],queryFn:be.getSettings}),{data:N}=Je({queryKey:["project-folders",p],queryFn:()=>be.getLibraryFoldersByProject(p),enabled:p>0}),R=al(T?.currency||"USD"),A=T?.time_format||"system",D=ut({mutationFn:Me=>be.updateProject(p,Me),onSuccess:()=>{r.invalidateQueries({queryKey:["project",p]}),r.invalidateQueries({queryKey:["projects"]}),l(!1),d(!1),a(n("projectDetail.toast.projectUpdated"),"success")},onError:Me=>{a(Me.message,"error")}}),$=()=>{m(f?.notes||""),d(!0)},U=()=>{D.mutate({notes:u})},G=()=>{d(!1),m("")},[L,te]=w.useState(""),[re,J]=w.useState(1),[ue,me]=w.useState(""),[ge,X]=w.useState(""),[ie,le]=w.useState(""),[pe,Ce]=w.useState(!1),[q,Z]=w.useState(!1),[j,E]=w.useState(null),[I,W]=w.useState(""),[B,ae]=w.useState(1),[z,V]=w.useState(""),[ee,K]=w.useState(""),[ne,se]=w.useState(""),[ce,fe]=w.useState({isOpen:!1,title:"",message:"",onConfirm:()=>{}}),oe=ut({mutationFn:Me=>be.createBOMItem(p,Me),onSuccess:()=>{r.invalidateQueries({queryKey:["project-bom",p]}),r.invalidateQueries({queryKey:["project",p]}),te(""),J(1),me(""),X(""),le(""),Ce(!1),a(n("projectDetail.toast.partAdded"),"success")},onError:Me=>a(Me.message,"error")}),O=ut({mutationFn:({itemId:Me,data:Ge})=>be.updateBOMItem(p,Me,Ge),onSuccess:()=>{r.invalidateQueries({queryKey:["project-bom",p]}),r.invalidateQueries({queryKey:["project",p]}),E(null)},onError:Me=>a(Me.message,"error")}),F=ut({mutationFn:Me=>be.deleteBOMItem(p,Me),onSuccess:()=>{r.invalidateQueries({queryKey:["project-bom",p]}),r.invalidateQueries({queryKey:["project",p]}),a(n("projectDetail.toast.partRemoved"),"success")},onError:Me=>a(Me.message,"error")}),Q=Me=>{Me.preventDefault(),L.trim()&&oe.mutate({name:L.trim(),quantity_needed:re,unit_price:ue?parseFloat(ue):void 0,sourcing_url:ge.trim()||void 0,remarks:ie.trim()||void 0})},ve=Me=>{const Ge=Me.is_complete?0:Me.quantity_needed;O.mutate({itemId:Me.id,data:{quantity_acquired:Ge}})},he=(Me,Ge)=>{fe({isOpen:!0,title:n("projectDetail.bom.deletePart"),message:n("projectDetail.bom.deleteConfirm",{name:Ge}),onConfirm:()=>{fe(xe=>({...xe,isOpen:!1})),F.mutate(Me)}})},de=Me=>{E(Me),W(Me.name),ae(Me.quantity_needed),V(Me.unit_price?.toString()||""),K(Me.sourcing_url||""),se(Me.remarks||"")},Ae=Me=>{Me.preventDefault(),!(!j||!I.trim())&&O.mutate({itemId:j.id,data:{name:I.trim(),quantity_needed:B,unit_price:z?parseFloat(z):void 0,sourcing_url:ee.trim()||void 0,remarks:ne.trim()||void 0}})},_e=()=>{E(null)},ze=async()=>{try{const{blob:Me,filename:Ge}=await be.exportProjectZip(Number(p)),xe=URL.createObjectURL(Me),He=document.createElement("a");He.href=xe,He.download=Ge||`${f?.name||"project"}_${new Date().toISOString().split("T")[0]}.zip`,He.click(),URL.revokeObjectURL(xe),a(n("projectDetail.toast.projectExported"),"success")}catch(Me){a(Me.message,"error")}},Be=ut({mutationFn:()=>be.createTemplateFromProject(p),onSuccess:()=>{r.invalidateQueries({queryKey:["projects"]}),a(n("projectDetail.toast.templateCreated"),"success")},onError:Me=>a(Me.message,"error")}),Ue=Me=>Wp(Me,A,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"});if(y)return i.jsx("div",{className:"flex items-center justify-center py-24",children:i.jsx(ct,{className:"w-8 h-8 animate-spin text-bambu-green"})});if(x||!f)return i.jsxs("div",{className:"text-center py-24",children:[i.jsx("p",{className:"text-bambu-gray",children:x?`${n("common.error")}: ${x.message}`:n("projectDetail.notFound")}),i.jsx(Fe,{variant:"secondary",className:"mt-4",onClick:()=>e("/projects"),children:n("projectDetail.backToProjects")})]});const Ne=f.stats,Ee=Ne?.progress_percent??0,ke=Ne?.parts_progress_percent??0;return i.jsxs("div",{className:"p-4 md:p-8 space-y-8",children:[i.jsxs("div",{className:"flex items-center gap-2 text-sm text-bambu-gray",children:[i.jsx(Js,{to:"/projects",className:"hover:text-white transition-colors",children:n("navigation.projects")}),i.jsx(pa,{className:"w-4 h-4"}),i.jsx("span",{className:"text-white",children:f.name})]}),i.jsxs("div",{className:"flex items-start justify-between",children:[i.jsxs("div",{className:"flex items-center gap-4",children:[i.jsx("button",{onClick:()=>e("/projects"),className:"p-2 rounded-lg bg-bambu-card hover:bg-bambu-dark-tertiary transition-colors",children:i.jsx(UY,{className:"w-5 h-5 text-bambu-gray"})}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"w-4 h-4 rounded-full flex-shrink-0",style:{backgroundColor:f.color||"#6b7280"}}),i.jsxs("div",{children:[i.jsx("h1",{className:"text-2xl font-bold text-white",children:f.name}),f.description&&i.jsx("p",{className:"text-bambu-gray mt-1",children:f.description})]})]}),i.jsx(QJe,{status:f.status,t:n})]}),i.jsxs("div",{className:"flex gap-2",children:[i.jsxs(Fe,{variant:"secondary",onClick:ze,disabled:!s("projects:read"),title:s("projects:read")?n("projectDetail.exportProject"):n("projectDetail.noExportPermission"),children:[i.jsx(pi,{className:"w-4 h-4 mr-2"}),n("projectDetail.export")]}),i.jsxs(Fe,{onClick:()=>l(!0),disabled:!s("projects:update"),title:s("projects:update")?void 0:n("projectDetail.noEditPermission"),children:[i.jsx($p,{className:"w-4 h-4 mr-2"}),n("common.edit")]})]})]}),(f.target_count||f.target_parts_count)&&i.jsx(Tt,{children:i.jsxs(Pt,{className:"p-4 space-y-4",children:[f.target_count&&i.jsxs("div",{children:[i.jsxs("div",{className:"flex items-center justify-between mb-2",children:[i.jsx("span",{className:"text-sm text-bambu-gray",children:n("projectDetail.progress.platesProgress")}),i.jsxs("span",{className:"text-sm font-medium text-white",children:[Ne?.total_archives||0," / ",f.target_count," ",n("projectDetail.progress.printJobs")]})]}),i.jsx("div",{className:"h-3 bg-bambu-dark rounded-full overflow-hidden",children:i.jsx("div",{className:"h-full transition-all duration-500",style:{width:`${Math.min(Ee,100)}%`,backgroundColor:Ee>=100?"#22c55e":f.color||"#6b7280"}})}),i.jsxs("div",{className:"flex justify-between mt-1",children:[i.jsx("span",{className:"text-xs text-bambu-gray/70",children:n("projectDetail.progress.percentComplete",{percent:Ee.toFixed(0)})}),Ne?.remaining_prints!=null&&Ne.remaining_prints>0&&i.jsx("span",{className:"text-xs text-bambu-gray/70",children:n("projectDetail.progress.remaining",{count:Ne.remaining_prints})})]})]}),f.target_parts_count&&i.jsxs("div",{children:[i.jsxs("div",{className:"flex items-center justify-between mb-2",children:[i.jsx("span",{className:"text-sm text-bambu-gray",children:n("projectDetail.progress.partsProgress")}),i.jsxs("span",{className:"text-sm font-medium text-white",children:[Ne?.completed_prints||0," / ",f.target_parts_count," ",n("projectDetail.progress.parts")]})]}),i.jsx("div",{className:"h-3 bg-bambu-dark rounded-full overflow-hidden",children:i.jsx("div",{className:"h-full transition-all duration-500",style:{width:`${Math.min(ke,100)}%`,backgroundColor:ke>=100?"#22c55e":f.color||"#6b7280"}})}),i.jsxs("div",{className:"flex justify-between mt-1",children:[i.jsx("span",{className:"text-xs text-bambu-gray/70",children:n("projectDetail.progress.percentComplete",{percent:ke.toFixed(0)})}),Ne?.remaining_parts!=null&&Ne.remaining_parts>0&&i.jsx("span",{className:"text-xs text-bambu-gray/70",children:n("projectDetail.progress.remaining",{count:Ne.remaining_parts})})]})]})]})}),Ne&&i.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[i.jsx(Tt,{children:i.jsx(Pt,{className:"p-4",children:i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"p-2 rounded-lg bg-bambu-dark text-bambu-green",children:i.jsx(sa,{className:"w-5 h-5"})}),i.jsxs("div",{children:[i.jsx("p",{className:"text-sm text-bambu-gray",children:n("projectDetail.stats.printJobs")}),i.jsxs("p",{className:"text-xl font-semibold text-white",children:[Ne.total_archives," ",i.jsx("span",{className:"text-sm font-normal text-bambu-gray",children:n("projectDetail.stats.total")})]}),Ne.failed_prints>0&&i.jsx("p",{className:"text-sm text-status-error",children:n("projectDetail.stats.failed",{count:Ne.failed_prints})}),i.jsx("p",{className:"text-sm text-bambu-gray",children:n("projectDetail.stats.partsPrinted",{count:Ne.completed_prints})})]})]})})}),i.jsx(jK,{icon:er,label:n("projectDetail.stats.printTime"),value:fbe(Ne.total_print_time_hours),color:"text-yellow-400"}),i.jsx(jK,{icon:kr,label:n("projectDetail.stats.filamentUsed"),value:XJe(Ne.total_filament_grams),color:"text-purple-400"})]}),Ne&&(Ne.estimated_cost>0||f.budget)&&i.jsx(Tt,{children:i.jsxs(Pt,{className:"p-4",children:[i.jsx("h2",{className:"text-lg font-semibold text-white mb-3",children:n("projectDetail.cost.title")}),i.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-xs text-bambu-gray uppercase",children:n("projectDetail.cost.filamentCost")}),i.jsxs("p",{className:"text-lg font-semibold text-white",children:[R,Ne.estimated_cost.toFixed(2)]})]}),Ne.total_energy_kwh>0&&i.jsxs("div",{children:[i.jsx("p",{className:"text-xs text-bambu-gray uppercase",children:n("projectDetail.cost.energy")}),i.jsxs("p",{className:"text-lg font-semibold text-white",children:[Ne.total_energy_kwh.toFixed(3)," kWh",Ne.total_energy_cost>0&&i.jsxs("span",{className:"text-sm text-bambu-gray ml-1",children:["(",R,Ne.total_energy_cost.toFixed(2),")"]})]})]}),f.budget&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-xs text-bambu-gray uppercase",children:n("projectDetail.cost.budget")}),i.jsxs("p",{className:"text-lg font-semibold text-white",children:[R,f.budget.toFixed(2)]})]}),i.jsxs("div",{children:[i.jsx("p",{className:"text-xs text-bambu-gray uppercase",children:n("projectDetail.cost.remaining")}),i.jsxs("p",{className:`text-lg font-semibold ${f.budget-Ne.estimated_cost>=0?"text-bambu-green":"text-red-400"}`,children:[R,(f.budget-Ne.estimated_cost).toFixed(2)]})]})]})]})]})}),f.children&&f.children.length>0&&i.jsx(Tt,{children:i.jsxs(Pt,{className:"p-4",children:[i.jsxs("h2",{className:"text-lg font-semibold text-white flex items-center gap-2 mb-3",children:[i.jsx(upe,{className:"w-5 h-5"}),n("projectDetail.subProjects.title",{count:f.children.length})]}),i.jsx("div",{className:"space-y-2",children:f.children.map(Me=>i.jsxs(Js,{to:`/projects/${Me.id}`,className:"flex items-center justify-between p-3 bg-bambu-dark rounded-lg hover:bg-bambu-dark-tertiary transition-colors",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:Me.color||"#6b7280"}}),i.jsx("span",{className:"text-white",children:Me.name}),i.jsx("span",{className:`text-xs px-2 py-0.5 rounded ${Me.status==="completed"?"bg-status-ok/20 text-status-ok":Me.status==="archived"?"bg-bambu-gray/20 text-bambu-gray":"bg-blue-500/20 text-blue-400"}`,children:Me.status})]}),Me.progress_percent!==null&&i.jsxs("span",{className:"text-sm text-bambu-gray",children:[Me.progress_percent.toFixed(0),"%"]})]},Me.id))})]})}),f.parent_id&&f.parent_name&&i.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[i.jsx(Vi,{className:"w-4 h-4 text-bambu-gray"}),i.jsx("span",{className:"text-bambu-gray",children:n("projectDetail.partOf")}),i.jsx(Js,{to:`/projects/${f.parent_id}`,className:"text-bambu-green hover:underline",children:f.parent_name})]}),(f.tags||f.due_date||f.priority!=="normal")&&i.jsxs("div",{className:"flex flex-wrap items-center gap-4",children:[f.priority&&f.priority!=="normal"&&i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"text-xs text-bambu-gray uppercase",children:n("projectDetail.priorityLabel")}),i.jsx(JJe,{priority:f.priority,t:n})]}),f.due_date&&i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(Xr,{className:"w-4 h-4 text-bambu-gray"}),i.jsx("span",{className:"text-sm text-white",children:Gp(f.due_date,{year:"numeric",month:"short",day:"numeric"})}),Jj(f.due_date,n)&&i.jsxs("span",{className:`text-xs ${Jj(f.due_date,n).color}`,children:["(",Jj(f.due_date,n).label,")"]})]}),f.tags&&i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(cu,{className:"w-4 h-4 text-bambu-gray"}),i.jsx("div",{className:"flex flex-wrap gap-1",children:f.tags.split(",").map((Me,Ge)=>i.jsx("span",{className:"px-2 py-0.5 bg-bambu-dark-tertiary text-bambu-gray text-xs rounded",children:Me.trim()},Ge))})]})]}),i.jsx(Tt,{children:i.jsxs(Pt,{className:"p-4",children:[i.jsxs("div",{className:"flex items-center justify-between mb-3",children:[i.jsxs("h2",{className:"text-lg font-semibold text-white flex items-center gap-2",children:[i.jsx(Es,{className:"w-5 h-5"}),n("projectDetail.notes.title")]}),c?i.jsxs("div",{className:"flex gap-2",children:[i.jsxs(Fe,{variant:"secondary",size:"sm",onClick:G,disabled:D.isPending,children:[i.jsx(zt,{className:"w-4 h-4 mr-1"}),n("common.cancel")]}),i.jsxs(Fe,{size:"sm",onClick:U,disabled:D.isPending,children:[D.isPending?i.jsx(ct,{className:"w-4 h-4 animate-spin mr-1"}):i.jsx(ps,{className:"w-4 h-4 mr-1"}),n("common.save")]})]}):i.jsxs(Fe,{variant:"secondary",size:"sm",onClick:$,disabled:!s("projects:update"),title:s("projects:update")?void 0:n("projectDetail.notes.noEditPermission"),children:[i.jsx($p,{className:"w-4 h-4 mr-1"}),n("common.edit")]})]}),c?i.jsx(xF,{content:u,onChange:m,placeholder:n("projectDetail.notes.placeholder")}):f.notes?i.jsx("div",{className:"prose prose-invert prose-sm max-w-none",dangerouslySetInnerHTML:{__html:f.notes}}):i.jsx("p",{className:"text-bambu-gray/70 text-sm italic",children:n("projectDetail.notes.empty")})]})}),i.jsx(Tt,{children:i.jsxs(Pt,{className:"p-4",children:[i.jsx("div",{className:"flex items-center justify-between mb-3",children:i.jsxs("h2",{className:"text-lg font-semibold text-white flex items-center gap-2",children:[i.jsx(nc,{className:"w-5 h-5"}),n("projectDetail.files.title")]})}),i.jsxs("p",{className:"text-xs text-bambu-gray mb-3",children:[i.jsx(Js,{to:"/files",className:"text-bambu-green hover:underline",children:n("projectDetail.files.linkFolders")})," ",n("projectDetail.files.forQuickAccess")]}),N&&N.length>0?i.jsx("div",{className:"space-y-2",children:N.map(Me=>i.jsxs(Js,{to:`/files?folder=${Me.id}`,className:"flex items-center justify-between p-3 bg-bambu-dark rounded-lg hover:bg-bambu-dark-tertiary transition-colors",children:[i.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[i.jsx(nc,{className:"w-5 h-5 text-bambu-green flex-shrink-0"}),i.jsxs("div",{className:"min-w-0",children:[i.jsx("p",{className:"text-sm text-white truncate",children:Me.name}),i.jsx("p",{className:"text-xs text-bambu-gray",children:n("projectDetail.files.fileCount",{count:Me.file_count})})]})]}),i.jsx(pa,{className:"w-4 h-4 text-bambu-gray flex-shrink-0"})]},Me.id))}):i.jsx("p",{className:"text-bambu-gray/70 text-sm italic",children:n("projectDetail.files.empty")})]})}),i.jsx(Tt,{children:i.jsxs(Pt,{className:"p-4",children:[i.jsxs("div",{className:"flex items-center justify-between mb-4",children:[i.jsxs("h2",{className:"text-lg font-semibold text-white flex items-center gap-2",children:[i.jsx(QY,{className:"w-5 h-5"}),n("projectDetail.bom.title"),Ne&&Ne.bom_total_items>0&&i.jsxs("span",{className:"text-sm font-normal text-bambu-gray",children:["(",n("projectDetail.bom.acquired",{completed:Ne.bom_completed_items,total:Ne.bom_total_items}),")"]})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[_&&_.some(Me=>Me.is_complete)&&i.jsx("button",{onClick:()=>Z(!q),className:`text-xs px-2 py-1 rounded transition-colors ${q?"bg-bambu-green/20 text-bambu-green":"bg-bambu-dark text-bambu-gray hover:text-white"}`,children:n(q?"projectDetail.bom.showAll":"projectDetail.bom.hideDone")}),!pe&&i.jsxs(Fe,{variant:"secondary",size:"sm",onClick:()=>Ce(!0),disabled:!s("projects:update"),title:s("projects:update")?void 0:n("projectDetail.bom.noAddPermission"),children:[i.jsx(sr,{className:"w-4 h-4 mr-1"}),n("projectDetail.bom.addPart")]})]})]}),pe&&i.jsxs("form",{onSubmit:Q,className:"bg-bambu-dark rounded-lg p-4 mb-4 space-y-3",children:[i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[i.jsx("input",{type:"text",value:L,onChange:Me=>te(Me.target.value),className:"bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded px-3 py-2 text-sm text-white placeholder-bambu-gray focus:outline-none focus:border-bambu-green",placeholder:n("projectDetail.bom.partNamePlaceholder"),autoFocus:!0}),i.jsxs("div",{className:"flex gap-2",children:[i.jsx("input",{type:"number",value:re,onChange:Me=>J(parseInt(Me.target.value)||1),className:"w-20 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded px-3 py-2 text-sm text-white focus:outline-none focus:border-bambu-green",min:"1",placeholder:n("projectDetail.bom.qty")}),i.jsx("input",{type:"number",step:"0.01",value:ue,onChange:Me=>me(Me.target.value),className:"flex-1 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded px-3 py-2 text-sm text-white placeholder-bambu-gray focus:outline-none focus:border-bambu-green",placeholder:n("projectDetail.bom.price",{currency:R})})]})]}),i.jsx("input",{type:"url",value:ge,onChange:Me=>X(Me.target.value),className:"w-full bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded px-3 py-2 text-sm text-white placeholder-bambu-gray focus:outline-none focus:border-bambu-green",placeholder:n("projectDetail.bom.sourcingUrlPlaceholder")}),i.jsx("input",{type:"text",value:ie,onChange:Me=>le(Me.target.value),className:"w-full bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded px-3 py-2 text-sm text-white placeholder-bambu-gray focus:outline-none focus:border-bambu-green",placeholder:n("projectDetail.bom.remarksPlaceholder")}),i.jsxs("div",{className:"flex justify-end gap-2",children:[i.jsx(Fe,{type:"button",variant:"secondary",size:"sm",onClick:()=>Ce(!1),children:n("common.cancel")}),i.jsx(Fe,{type:"submit",size:"sm",disabled:!L.trim()||oe.isPending,children:oe.isPending?i.jsx(ct,{className:"w-4 h-4 animate-spin"}):n("projectDetail.bom.addPart")})]})]}),k?i.jsx("div",{className:"flex items-center justify-center py-4",children:i.jsx(ct,{className:"w-6 h-6 animate-spin text-bambu-green"})}):_&&_.length>0?i.jsxs("div",{className:"space-y-2",children:[_.filter(Me=>!q||!Me.is_complete).map(Me=>i.jsx("div",{className:`p-3 rounded-lg transition-colors ${Me.is_complete?"bg-status-ok/10":"bg-bambu-dark"}`,children:j?.id===Me.id?i.jsxs("form",{onSubmit:Ae,className:"space-y-3",children:[i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[i.jsx("input",{type:"text",value:I,onChange:Ge=>W(Ge.target.value),className:"bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded px-3 py-2 text-sm text-white placeholder-bambu-gray focus:outline-none focus:border-bambu-green",placeholder:n("projectDetail.bom.partName"),autoFocus:!0}),i.jsxs("div",{className:"flex gap-2",children:[i.jsx("input",{type:"number",value:B,onChange:Ge=>ae(parseInt(Ge.target.value)||1),className:"w-20 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded px-3 py-2 text-sm text-white focus:outline-none focus:border-bambu-green",min:"1",placeholder:n("projectDetail.bom.qty")}),i.jsx("input",{type:"number",step:"0.01",value:z,onChange:Ge=>V(Ge.target.value),className:"flex-1 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded px-3 py-2 text-sm text-white placeholder-bambu-gray focus:outline-none focus:border-bambu-green",placeholder:n("projectDetail.bom.price",{currency:R})})]})]}),i.jsx("input",{type:"url",value:ee,onChange:Ge=>K(Ge.target.value),className:"w-full bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded px-3 py-2 text-sm text-white placeholder-bambu-gray focus:outline-none focus:border-bambu-green",placeholder:n("projectDetail.bom.sourcingUrlPlaceholder")}),i.jsx("input",{type:"text",value:ne,onChange:Ge=>se(Ge.target.value),className:"w-full bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded px-3 py-2 text-sm text-white placeholder-bambu-gray focus:outline-none focus:border-bambu-green",placeholder:n("projectDetail.bom.remarksPlaceholder")}),i.jsxs("div",{className:"flex justify-end gap-2",children:[i.jsx(Fe,{type:"button",variant:"secondary",size:"sm",onClick:_e,children:n("common.cancel")}),i.jsx(Fe,{type:"submit",size:"sm",disabled:!I.trim()||O.isPending,children:O.isPending?i.jsx(ct,{className:"w-4 h-4 animate-spin"}):n("common.save")})]})]}):i.jsxs("div",{className:"flex items-start gap-3",children:[i.jsx("button",{onClick:()=>s("projects:update")&&ve(Me),disabled:O.isPending||!s("projects:update"),title:s("projects:update")?void 0:n("projectDetail.bom.noUpdatePermission"),className:`w-5 h-5 mt-0.5 rounded border-2 flex items-center justify-center transition-colors flex-shrink-0 ${Me.is_complete?"bg-status-ok border-status-ok text-white":s("projects:update")?"border-bambu-gray hover:border-bambu-green":"border-bambu-gray/50 cursor-not-allowed"}`,children:Me.is_complete&&i.jsx(fr,{className:"w-3 h-3"})}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsxs("div",{className:"flex items-center justify-between gap-2",children:[i.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[i.jsxs("p",{className:`text-sm font-medium ${Me.is_complete?"text-bambu-gray line-through":"text-white"}`,children:[Me.name,i.jsxs("span",{className:"text-bambu-gray font-normal ml-2",children:["x",Me.quantity_needed]})]}),Me.unit_price!==null&&i.jsxs("span",{className:"text-xs text-bambu-green whitespace-nowrap",children:[R,(Me.unit_price*Me.quantity_needed).toFixed(2)]})]}),i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx("button",{onClick:()=>s("projects:update")&&de(Me),disabled:!s("projects:update"),className:`p-1 rounded transition-colors flex-shrink-0 ${s("projects:update")?"hover:bg-bambu-dark-tertiary text-bambu-gray hover:text-white":"text-bambu-gray/50 cursor-not-allowed"}`,title:s("projects:update")?n("common.edit"):n("projectDetail.bom.noEditPermission"),children:i.jsx(Wi,{className:"w-4 h-4"})}),i.jsx("button",{onClick:()=>s("projects:update")&&he(Me.id,Me.name),disabled:!s("projects:update"),className:`p-1 rounded transition-colors flex-shrink-0 ${s("projects:update")?"hover:bg-bambu-dark-tertiary text-bambu-gray hover:text-red-400":"text-bambu-gray/50 cursor-not-allowed"}`,title:s("projects:update")?n("common.delete"):n("projectDetail.bom.noDeletePermission"),children:i.jsx(Qt,{className:"w-4 h-4"})})]})]}),Me.sourcing_url&&i.jsxs("a",{href:Me.sourcing_url,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 mt-1 text-xs text-blue-400 hover:text-blue-300 transition-colors",onClick:Ge=>Ge.stopPropagation(),children:[i.jsx(ei,{className:"w-3 h-3 flex-shrink-0"}),i.jsx("span",{className:"truncate",children:(()=>{try{return new URL(Me.sourcing_url).hostname.replace("www.","")}catch{return Me.sourcing_url}})()})]}),Me.remarks&&i.jsx("p",{className:"mt-1 text-xs text-bambu-gray/80 italic",children:Me.remarks})]})]})},Me.id)),_.some(Me=>Me.unit_price!==null)&&i.jsxs("div",{className:"pt-2 mt-2 border-t border-bambu-dark-tertiary flex justify-between text-sm",children:[i.jsx("span",{className:"text-bambu-gray",children:n("projectDetail.bom.totalCost")}),i.jsxs("span",{className:"text-white font-medium",children:[R,_.reduce((Me,Ge)=>Me+(Ge.unit_price||0)*Ge.quantity_needed,0).toFixed(2)]})]})]}):i.jsx("p",{className:"text-bambu-gray/70 text-sm italic",children:n("projectDetail.bom.empty")})]})}),i.jsx(Tt,{children:i.jsxs(Pt,{className:"p-4",children:[i.jsx("div",{className:"flex items-center justify-between mb-3",children:i.jsxs("h2",{className:"text-lg font-semibold text-white flex items-center gap-2",children:[i.jsx(Fv,{className:"w-5 h-5"}),n("projectDetail.timeline.title")]})}),C?i.jsx("div",{className:"flex items-center justify-center py-4",children:i.jsx(ct,{className:"w-6 h-6 animate-spin text-bambu-green"})}):P&&P.length>0?i.jsx("div",{className:"space-y-3",children:P.slice(0,10).map((Me,Ge)=>i.jsxs("div",{className:"flex gap-3",children:[i.jsxs("div",{className:`w-8 h-8 rounded-full flex items-center justify-center flex-shrink-0 ${Me.event_type==="print_completed"?"bg-status-ok/20 text-status-ok":Me.event_type==="print_failed"?"bg-status-error/20 text-status-error":Me.event_type==="print_started"?"bg-yellow-500/20 text-yellow-400":"bg-bambu-dark-tertiary text-bambu-gray"}`,children:[Me.event_type==="print_completed"&&i.jsx(fr,{className:"w-4 h-4"}),Me.event_type==="print_failed"&&i.jsx(qi,{className:"w-4 h-4"}),Me.event_type==="print_started"&&i.jsx(kr,{className:"w-4 h-4"}),Me.event_type==="queued"&&i.jsx(CD,{className:"w-4 h-4"}),Me.event_type==="project_created"&&i.jsx(sr,{className:"w-4 h-4"})]}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsx("p",{className:"text-sm text-white",children:Me.title}),Me.description&&i.jsx("p",{className:"text-xs text-bambu-gray truncate",children:Me.description}),i.jsx("p",{className:"text-xs text-bambu-gray/70",children:Ue(Me.timestamp)})]})]},Ge))}):i.jsx("p",{className:"text-bambu-gray/70 text-sm italic",children:n("projectDetail.timeline.empty")})]})}),!f.is_template&&i.jsx("div",{className:"flex justify-end",children:i.jsxs(Fe,{variant:"secondary",size:"sm",onClick:()=>Be.mutate(),disabled:Be.isPending||!s("projects:create"),title:s("projects:create")?void 0:n("projectDetail.template.noCreatePermission"),children:[Be.isPending?i.jsx(ct,{className:"w-4 h-4 animate-spin mr-2"}):i.jsx(wl,{className:"w-4 h-4 mr-2"}),n("projectDetail.template.saveAsTemplate")]})}),Ne&&(Ne.queued_prints>0||Ne.in_progress_prints>0)&&i.jsx(Tt,{children:i.jsxs(Pt,{className:"p-4",children:[i.jsxs("div",{className:"flex items-center justify-between mb-3",children:[i.jsxs("h2",{className:"text-lg font-semibold text-white flex items-center gap-2",children:[i.jsx(CD,{className:"w-5 h-5"}),n("projectDetail.queue.title")]}),i.jsx(Js,{to:`/queue?project=${p}`,className:"text-sm text-bambu-green hover:underline",children:n("projectDetail.queue.viewAll")})]}),i.jsxs("div",{className:"flex items-center gap-4 text-sm",children:[Ne.in_progress_prints>0&&i.jsx("span",{className:"text-yellow-400",children:n("projectDetail.queue.printing",{count:Ne.in_progress_prints})}),Ne.queued_prints>0&&i.jsx("span",{className:"text-bambu-gray",children:n("projectDetail.queue.queued",{count:Ne.queued_prints})})]})]})}),i.jsxs("div",{children:[i.jsx("div",{className:"flex items-center justify-between mb-4",children:i.jsxs("h2",{className:"text-lg font-semibold text-white flex items-center gap-2",children:[i.jsx(sa,{className:"w-5 h-5"}),n("projectDetail.prints.title",{count:b?.length||0})]})}),v?i.jsx("div",{className:"flex items-center justify-center py-8",children:i.jsx(ct,{className:"w-6 h-6 animate-spin text-bambu-green"})}):i.jsx(ZJe,{archives:b||[],t:n})]}),o&&i.jsx(Ose,{t:n,project:{...f,archive_count:Ne?.total_archives||0,total_items:Ne?.total_items||0,completed_count:Ne?.completed_prints||0,failed_count:Ne?.failed_prints||0,queue_count:Ne?.queued_prints||0,progress_percent:Ne?.progress_percent||null,archives:[]},onClose:()=>l(!1),onSave:Me=>D.mutate(Me),isLoading:D.isPending}),ce.isOpen&&i.jsx(Nn,{title:ce.title,message:ce.message,confirmText:n("common.delete"),variant:"danger",onConfirm:ce.onConfirm,onCancel:()=>fe(Me=>({...Me,isOpen:!1}))})]})}function tet({parentId:t,onClose:e,onSave:n,isLoading:r,t:a}){const[s,o]=w.useState(""),l=c=>{c.preventDefault(),n({name:s.trim(),parent_id:t})};return i.jsx("div",{className:"fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-4",children:i.jsxs("div",{className:"bg-bambu-dark-secondary rounded-lg w-full max-w-sm border border-bambu-dark-tertiary",children:[i.jsx("div",{className:"p-4 border-b border-bambu-dark-tertiary",children:i.jsx("h2",{className:"text-lg font-semibold text-white",children:a("fileManager.newFolder")})}),i.jsxs("form",{onSubmit:l,className:"p-4 space-y-4",children:[i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-white mb-1",children:a("fileManager.folderName")}),i.jsx("input",{type:"text",value:s,onChange:c=>o(c.target.value),className:"w-full bg-bambu-dark border border-bambu-dark-tertiary rounded px-3 py-2 text-white placeholder-bambu-gray focus:outline-none focus:border-bambu-green",placeholder:a("fileManager.folderNamePlaceholder"),autoFocus:!0,required:!0})]}),i.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[i.jsx(Fe,{type:"button",variant:"secondary",onClick:e,children:a("common.cancel")}),i.jsx(Fe,{type:"submit",disabled:!s.trim()||r,children:r?i.jsx(ct,{className:"w-4 h-4 animate-spin"}):a("common.create")})]})]})]})})}function net({type:t,currentName:e,onClose:n,onSave:r,isLoading:a,t:s}){const[o,l]=w.useState(e),c=d=>{d.preventDefault(),o.trim()&&o.trim()!==e&&r(o.trim())};return i.jsx("div",{className:"fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-4",children:i.jsxs("div",{className:"bg-bambu-dark-secondary rounded-lg w-full max-w-sm border border-bambu-dark-tertiary",children:[i.jsx("div",{className:"p-4 border-b border-bambu-dark-tertiary",children:i.jsx("h2",{className:"text-lg font-semibold text-white",children:s(t==="file"?"fileManager.renameFile":"fileManager.renameFolder")})}),i.jsxs("form",{onSubmit:c,className:"p-4 space-y-4",children:[i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-white mb-1",children:s("common.name")}),i.jsx("input",{type:"text",value:o,onChange:d=>l(d.target.value),className:"w-full bg-bambu-dark border border-bambu-dark-tertiary rounded px-3 py-2 text-white placeholder-bambu-gray focus:outline-none focus:border-bambu-green",autoFocus:!0,required:!0})]}),i.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[i.jsx(Fe,{type:"button",variant:"secondary",onClick:n,children:s("common.cancel")}),i.jsx(Fe,{type:"submit",disabled:!o.trim()||o.trim()===e||a,children:a?i.jsx(ct,{className:"w-4 h-4 animate-spin"}):s("common.rename")})]})]})]})})}function ret({folders:t,selectedFiles:e,currentFolderId:n,onClose:r,onMove:a,isLoading:s,t:o}){const[l,c]=w.useState(null),d=(m,p=0)=>{const f=[];for(const y of m)f.push({id:y.id,name:y.name,depth:p}),y.children.length>0&&f.push(...d(y.children,p+1));return f},u=[{id:null,name:o("fileManager.rootNoFolder"),depth:0},...d(t)];return i.jsx("div",{className:"fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-4",children:i.jsxs("div",{className:"bg-bambu-dark-secondary rounded-lg w-full max-w-sm border border-bambu-dark-tertiary",children:[i.jsx("div",{className:"p-4 border-b border-bambu-dark-tertiary",children:i.jsx("h2",{className:"text-lg font-semibold text-white",children:o("fileManager.moveFiles",{count:e.length})})}),i.jsxs("div",{className:"p-4 space-y-4",children:[i.jsx("div",{className:"max-h-64 overflow-y-auto space-y-1",children:u.map(m=>i.jsxs("button",{onClick:()=>c(m.id),disabled:m.id===n,className:`w-full text-left px-3 py-2 rounded transition-colors flex items-center gap-2 ${l===m.id?"bg-bambu-green/20 text-bambu-green":m.id===n?"opacity-50 cursor-not-allowed text-bambu-gray":"hover:bg-bambu-dark text-white"}`,style:{paddingLeft:`${12+m.depth*16}px`},children:[i.jsx(nc,{className:"w-4 h-4"}),m.name,m.id===n&&i.jsxs("span",{className:"text-xs text-bambu-gray ml-auto",children:["(",o("fileManager.current"),")"]})]},m.id??"root"))}),i.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[i.jsx(Fe,{type:"button",variant:"secondary",onClick:r,children:o("common.cancel")}),i.jsx(Fe,{onClick:()=>a(l),disabled:s,children:s?i.jsx(ct,{className:"w-4 h-4 animate-spin"}):o("common.move")})]})]})]})})}function iet({folder:t,onClose:e,onLink:n,isLoading:r,t:a}){const[s,o]=w.useState("project"),[l,c]=w.useState(t.project_id||t.archive_id||null);w.useState(()=>{t.archive_id&&o("archive")});const{data:d}=Je({queryKey:["projects"],queryFn:()=>be.getProjects()}),{data:u}=Je({queryKey:["archives-for-link"],queryFn:()=>be.getArchives(void 0,void 0,100)}),m=()=>{n(s==="project"?{project_id:l,archive_id:0}:{project_id:0,archive_id:l})},p=()=>{n({project_id:0,archive_id:0})},f=t.project_id||t.archive_id;return i.jsx("div",{className:"fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-4",children:i.jsxs("div",{className:"bg-bambu-dark-secondary rounded-lg w-full max-w-md border border-bambu-dark-tertiary",children:[i.jsxs("div",{className:"p-4 border-b border-bambu-dark-tertiary flex items-center justify-between",children:[i.jsxs("h2",{className:"text-lg font-semibold text-white flex items-center gap-2",children:[i.jsx(Vm,{className:"w-5 h-5 text-bambu-green"}),a("fileManager.linkFolder")]}),i.jsx("button",{onClick:e,className:"p-1 hover:bg-bambu-dark rounded",children:i.jsx(zt,{className:"w-5 h-5 text-bambu-gray"})})]}),i.jsxs("div",{className:"p-4 space-y-4",children:[i.jsx("p",{className:"text-sm text-bambu-gray",children:a("fileManager.linkFolderDescription",{name:t.name})}),i.jsxs("div",{className:"flex gap-2",children:[i.jsxs("button",{onClick:()=>{o("project"),c(null)},className:`flex-1 flex items-center justify-center gap-2 px-3 py-2 rounded-lg border transition-colors ${s==="project"?"border-bambu-green bg-bambu-green/10 text-bambu-green":"border-bambu-dark-tertiary text-bambu-gray hover:text-white"}`,children:[i.jsx(BY,{className:"w-4 h-4"}),a("fileManager.project")]}),i.jsxs("button",{onClick:()=>{o("archive"),c(null)},className:`flex-1 flex items-center justify-center gap-2 px-3 py-2 rounded-lg border transition-colors ${s==="archive"?"border-bambu-green bg-bambu-green/10 text-bambu-green":"border-bambu-dark-tertiary text-bambu-gray hover:text-white"}`,children:[i.jsx(Fs,{className:"w-4 h-4"}),a("fileManager.archive")]})]}),i.jsx("div",{className:"max-h-64 overflow-y-auto space-y-1 bg-bambu-dark rounded-lg p-2",children:s==="project"?d&&d.length>0?d.map(y=>i.jsxs("button",{onClick:()=>c(y.id),className:`w-full text-left px-3 py-2 rounded transition-colors flex items-center gap-2 ${l===y.id?"bg-bambu-green/20 text-bambu-green":"hover:bg-bambu-dark-tertiary text-white"}`,children:[i.jsx("div",{className:"w-3 h-3 rounded-full flex-shrink-0",style:{backgroundColor:y.color||"#00ae42"}}),i.jsx("span",{className:"truncate",children:y.name})]},y.id)):i.jsx("p",{className:"text-sm text-bambu-gray text-center py-4",children:a("fileManager.noProjectsFound")}):u&&u.length>0?u.map(y=>i.jsxs("button",{onClick:()=>c(y.id),className:`w-full text-left px-3 py-2 rounded transition-colors flex items-center gap-2 ${l===y.id?"bg-bambu-green/20 text-bambu-green":"hover:bg-bambu-dark-tertiary text-white"}`,children:[i.jsx(Cp,{className:"w-4 h-4 text-bambu-gray flex-shrink-0"}),i.jsx("span",{className:"truncate",children:y.print_name||y.filename})]},y.id)):i.jsx("p",{className:"text-sm text-bambu-gray text-center py-4",children:a("fileManager.noArchivesFound")})})]}),i.jsxs("div",{className:"p-4 border-t border-bambu-dark-tertiary flex justify-between",children:[f&&i.jsxs(Fe,{variant:"danger",onClick:p,disabled:r,children:[i.jsx(Ov,{className:"w-4 h-4 mr-2"}),a("fileManager.unlink")]}),i.jsxs("div",{className:`flex gap-2 ${f?"":"ml-auto"}`,children:[i.jsx(Fe,{variant:"secondary",onClick:e,children:a("common.cancel")}),i.jsx(Fe,{onClick:m,disabled:!l||r,children:r?i.jsx(ct,{className:"w-4 h-4 animate-spin"}):a("fileManager.link")})]})]})]})})}function Ise({folder:t,selectedFolderId:e,onSelect:n,onDelete:r,onLink:a,onRename:s,depth:o=0,wrapNames:l=!1,hasPermission:c,t:d}){const[u,m]=w.useState(!0),[p,f]=w.useState(!1),y=t.children.length>0,x=t.project_id||t.archive_id;return i.jsxs("div",{children:[i.jsxs("div",{className:`group flex items-center gap-1 px-2 py-1.5 rounded cursor-pointer transition-colors ${e===t.id?"bg-bambu-green/20 text-bambu-green":"hover:bg-bambu-dark text-white"}`,style:{paddingLeft:`${8+o*12}px`},onClick:()=>n(t.id),children:[y?i.jsx("button",{onClick:b=>{b.stopPropagation(),m(!u)},className:"p-0.5 hover:bg-bambu-dark-tertiary rounded",children:i.jsx(pa,{className:`w-3.5 h-3.5 transition-transform ${u?"rotate-90":""}`})}):i.jsx("div",{className:"w-4.5"}),i.jsx(nc,{className:"w-4 h-4 text-bambu-green flex-shrink-0"}),i.jsx("span",{className:`text-sm flex-1 min-w-0 ${l?"break-all":"truncate"}`,title:t.name,children:t.name}),x&&i.jsxs("button",{onClick:b=>{b.stopPropagation(),a(t)},className:"flex-shrink-0 flex items-center gap-1 text-xs px-1.5 py-0.5 rounded bg-blue-500/20 text-blue-400 hover:bg-blue-500/30 transition-colors",title:`${t.project_name?`Project: ${t.project_name}`:`Archive: ${t.archive_name}`} (click to change)`,children:[i.jsx(Vm,{className:"w-3 h-3"}),t.project_name?i.jsx(BY,{className:"w-3 h-3"}):i.jsx(Fs,{className:"w-3 h-3"})]}),t.file_count>0&&i.jsx("span",{className:"flex-shrink-0 text-xs text-bambu-gray",children:t.file_count}),!x&&i.jsx("button",{onClick:b=>{b.stopPropagation(),a(t)},className:"flex-shrink-0 p-1 rounded hover:bg-bambu-dark-tertiary",title:d("fileManager.linkToProjectOrArchive"),children:i.jsx(Vm,{className:"w-3.5 h-3.5 text-bambu-gray hover:text-bambu-green"})}),i.jsx("div",{className:`flex-shrink-0 flex items-center gap-0.5 transition-opacity ${l?"":"opacity-0 group-hover:opacity-100"}`,onClick:b=>b.stopPropagation(),children:i.jsxs("div",{className:"relative",children:[i.jsx("button",{onClick:()=>f(!p),className:"p-1 rounded hover:bg-bambu-dark-tertiary",children:i.jsx(Bm,{className:"w-3.5 h-3.5 text-bambu-gray"})}),p&&i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"fixed inset-0 z-10",onClick:()=>f(!1)}),i.jsxs("div",{className:"absolute right-0 top-full mt-1 z-20 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg shadow-xl py-1 min-w-[120px]",children:[i.jsxs("button",{className:`w-full px-3 py-1.5 text-left text-sm flex items-center gap-2 ${c("library:update_all")?"text-white hover:bg-bambu-dark":"text-bambu-gray cursor-not-allowed"}`,onClick:()=>{c("library:update_all")&&(s(t),f(!1))},disabled:!c("library:update_all"),title:c("library:update_all")?void 0:d("fileManager.noPermissionRenameFolder"),children:[i.jsx(Wi,{className:"w-3.5 h-3.5"}),d("common.rename")]}),i.jsxs("button",{className:`w-full px-3 py-1.5 text-left text-sm flex items-center gap-2 ${c("library:update_all")?"text-white hover:bg-bambu-dark":"text-bambu-gray cursor-not-allowed"}`,onClick:()=>{c("library:update_all")&&(a(t),f(!1))},disabled:!c("library:update_all"),title:c("library:update_all")?void 0:d("fileManager.noPermissionLinkFolder"),children:[i.jsx(Vm,{className:"w-3.5 h-3.5"}),d(x?"fileManager.changeLink":"fileManager.linkTo")]}),i.jsxs("button",{className:`w-full px-3 py-1.5 text-left text-sm flex items-center gap-2 ${c("library:delete_all")?"text-red-400 hover:bg-bambu-dark":"text-bambu-gray cursor-not-allowed"}`,onClick:()=>{c("library:delete_all")&&(r(t.id),f(!1))},disabled:!c("library:delete_all"),title:c("library:delete_all")?void 0:d("fileManager.noPermissionDeleteFolder"),children:[i.jsx(Qt,{className:"w-3.5 h-3.5"}),d("common.delete")]})]})]})]})})]}),y&&u&&i.jsx("div",{children:t.children.map(b=>i.jsx(Ise,{folder:b,selectedFolderId:e,onSelect:n,onDelete:r,onLink:a,onRename:s,depth:o+1,wrapNames:l,hasPermission:c,t:d},b.id))})]})}function CF(t){const e=t.toLowerCase();return e.endsWith(".gcode")||e.includes(".gcode.")}function aet({file:t,isSelected:e,isMobile:n,onSelect:r,onDelete:a,onDownload:s,onAddToQueue:o,onPrint:l,onPreview3d:c,onRename:d,onGenerateThumbnail:u,thumbnailVersion:m,hasPermission:p,canModify:f,authEnabled:y,t:x}){const[b,v]=w.useState(!1);return i.jsxs("div",{className:`group relative bg-bambu-dark-secondary rounded-lg border transition-all cursor-pointer overflow-hidden ${e?"border-bambu-green ring-1 ring-bambu-green":"border-bambu-dark-tertiary hover:border-bambu-green/50"}`,onClick:()=>r(t.id),children:[i.jsxs("div",{className:"aspect-square bg-bambu-dark flex items-center justify-center overflow-hidden",children:[t.thumbnail_path?i.jsx("img",{src:`${be.getLibraryFileThumbnailUrl(t.id)}${m?`?v=${m}`:""}`,alt:t.filename,className:"w-full h-full object-cover"}):i.jsx(Cp,{className:"w-12 h-12 text-bambu-gray/30"}),i.jsx("div",{className:`absolute top-2 right-2 text-xs px-1.5 py-0.5 rounded font-medium ${t.file_type==="3mf"?"bg-bambu-green/90 text-white":t.file_type==="gcode"?"bg-blue-500/90 text-white":t.file_type==="stl"?"bg-purple-500/90 text-white":"bg-bambu-gray/90 text-white"}`,children:t.file_type.toUpperCase()})]}),i.jsxs("div",{className:"p-3",children:[i.jsx("h3",{className:"text-sm font-medium text-white truncate",title:t.print_name||t.filename,children:t.print_name||t.filename}),i.jsxs("div",{className:"flex items-center gap-3 mt-1 text-xs text-bambu-gray",children:[i.jsx("span",{children:no(t.file_size)}),t.print_time_seconds&&i.jsxs("span",{className:"flex items-center gap-1",children:[i.jsx(er,{className:"w-3 h-3"}),Ms(t.print_time_seconds)]})]}),t.sliced_for_model&&i.jsxs("div",{className:"mt-1 text-xs text-bambu-gray flex items-center gap-1",children:[i.jsx(kr,{className:"w-3 h-3"}),t.sliced_for_model]}),t.print_count>0&&i.jsx("div",{className:"mt-1 text-xs text-bambu-green",children:x("fileManager.printedCount",{count:t.print_count})}),y&&t.created_by_username&&i.jsxs("div",{className:"mt-1 text-xs text-bambu-gray flex items-center gap-1",children:[i.jsx(du,{className:"w-3 h-3"}),t.created_by_username]})]}),i.jsxs("div",{className:`absolute bottom-2 right-2 transition-opacity ${n?"opacity-100":"opacity-0 group-hover:opacity-100"}`,onClick:_=>_.stopPropagation(),children:[i.jsx("button",{onClick:()=>v(!b),className:"p-1.5 rounded bg-bambu-dark-secondary/90 hover:bg-bambu-dark-tertiary",children:i.jsx(Bm,{className:"w-4 h-4 text-bambu-gray"})}),b&&i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"fixed inset-0 z-10",onClick:()=>v(!1)}),i.jsxs("div",{className:"absolute right-0 bottom-8 z-20 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg shadow-xl py-1 min-w-[140px]",children:[l&&CF(t.filename)&&i.jsxs("button",{className:`w-full px-3 py-1.5 text-left text-sm flex items-center gap-2 ${p("printers:control")?"text-bambu-green hover:bg-bambu-dark":"text-bambu-gray cursor-not-allowed"}`,onClick:()=>{p("printers:control")&&(l(t),v(!1))},disabled:!p("printers:control"),title:p("printers:control")?void 0:x("fileManager.noPermissionPrint"),children:[i.jsx(kr,{className:"w-3.5 h-3.5"}),x("common.print")]}),o&&CF(t.filename)&&i.jsxs("button",{className:`w-full px-3 py-1.5 text-left text-sm flex items-center gap-2 ${p("queue:create")?"text-white hover:bg-bambu-dark":"text-bambu-gray cursor-not-allowed"}`,onClick:()=>{p("queue:create")&&(o(t.id),v(!1))},disabled:!p("queue:create"),title:p("queue:create")?void 0:x("fileManager.noPermissionAddToQueue"),children:[i.jsx(er,{className:"w-3.5 h-3.5"}),x("fileManager.schedulePrint")]}),c&&(t.file_type==="3mf"||t.file_type==="gcode"||t.file_type==="stl")&&i.jsxs("button",{className:`w-full px-3 py-1.5 text-left text-sm flex items-center gap-2 ${p("library:read")?"text-white hover:bg-bambu-dark":"text-bambu-gray cursor-not-allowed"}`,onClick:()=>{p("library:read")&&(c(t),v(!1))},disabled:!p("library:read"),title:p("library:read")?void 0:"You do not have permission to preview files",children:[i.jsx(ra,{className:"w-3.5 h-3.5"}),"3D Preview"]}),i.jsxs("button",{className:`w-full px-3 py-1.5 text-left text-sm flex items-center gap-2 ${p("library:read")?"text-white hover:bg-bambu-dark":"text-bambu-gray cursor-not-allowed"}`,onClick:()=>{p("library:read")&&(s(t.id),v(!1))},disabled:!p("library:read"),title:p("library:read")?void 0:x("fileManager.noPermissionDownload"),children:[i.jsx(pi,{className:"w-3.5 h-3.5"}),x("common.download")]}),d&&i.jsxs("button",{className:`w-full px-3 py-1.5 text-left text-sm flex items-center gap-2 ${f("library","update",t.created_by_id)?"text-white hover:bg-bambu-dark":"text-bambu-gray cursor-not-allowed"}`,onClick:()=>{f("library","update",t.created_by_id)&&(d(t),v(!1))},disabled:!f("library","update",t.created_by_id),title:f("library","update",t.created_by_id)?void 0:x("fileManager.noPermissionRenameFile"),children:[i.jsx(Wi,{className:"w-3.5 h-3.5"}),x("common.rename")]}),u&&t.file_type==="stl"&&i.jsxs("button",{className:`w-full px-3 py-1.5 text-left text-sm flex items-center gap-2 ${f("library","update",t.created_by_id)?"text-white hover:bg-bambu-dark":"text-bambu-gray cursor-not-allowed"}`,onClick:()=>{f("library","update",t.created_by_id)&&(u(t),v(!1))},disabled:!f("library","update",t.created_by_id),title:f("library","update",t.created_by_id)?void 0:x("fileManager.noPermissionGenerateThumbnail"),children:[i.jsx(ou,{className:"w-3.5 h-3.5"}),x("fileManager.generateThumbnail")]}),i.jsxs("button",{className:`w-full px-3 py-1.5 text-left text-sm flex items-center gap-2 ${f("library","delete",t.created_by_id)?"text-red-400 hover:bg-bambu-dark":"text-bambu-gray cursor-not-allowed"}`,onClick:()=>{f("library","delete",t.created_by_id)&&(a(t.id),v(!1))},disabled:!f("library","delete",t.created_by_id),title:f("library","delete",t.created_by_id)?void 0:x("fileManager.noPermissionDeleteFile"),children:[i.jsx(Qt,{className:"w-3.5 h-3.5"}),x("common.delete")]})]})]})]}),i.jsx("div",{className:`absolute top-2 left-2 w-5 h-5 rounded border-2 flex items-center justify-center transition-all ${e?"bg-bambu-green border-bambu-green":`border-white/30 bg-black/30 ${n?"opacity-100":"opacity-0 group-hover:opacity-100"}`}`,children:e&&i.jsx("div",{className:"w-2 h-2 bg-white rounded-sm"})})]})}function set(){const{t}=Mt(),e=tn(),{showToast:n}=bn(),{hasPermission:r,hasAnyPermission:a,canModify:s,authEnabled:o}=Rr(),[l]=OF(),c=l.get("folder"),d=c?parseInt(c,10):null,[u,m]=w.useState(d),[p,f]=w.useState([]),[y,x]=w.useState(!1),[b,v]=w.useState(!1),[_,k]=w.useState(!1),[P,C]=w.useState(null),[T,N]=w.useState(null),[R,A]=w.useState(null),[D,$]=w.useState(null),[U,G]=w.useState(null),[L,te]=w.useState(null),[re,J]=w.useState({}),[ue,me]=w.useState(null),[ge,X]=w.useState(()=>localStorage.getItem("library-view-mode")||"grid"),[ie,le]=w.useState(()=>localStorage.getItem("library-wrap-folders")==="true"),[pe,Ce]=w.useState(()=>{const qe=localStorage.getItem("library-sidebar-width");return qe?parseInt(qe,10):256}),[q,Z]=w.useState(!1),j=w.useRef(null);w.useEffect(()=>{if(!q)return;document.body.style.userSelect="none",document.body.style.cursor="col-resize";const qe=yt=>{if(!j.current)return;const Bt=j.current.parentElement?.getBoundingClientRect();if(!Bt)return;const Yt=yt.clientX-Bt.left,xn=Math.min(500,Math.max(200,Yt));Ce(xn)},ht=()=>{Z(!1),document.body.style.userSelect="",document.body.style.cursor="",localStorage.setItem("library-sidebar-width",String(pe))};return document.addEventListener("mousemove",qe),document.addEventListener("mouseup",ht),()=>{document.removeEventListener("mousemove",qe),document.removeEventListener("mouseup",ht),document.body.style.userSelect="",document.body.style.cursor=""}},[q,pe]);const[E,I]=w.useState(""),[W,B]=w.useState("all"),[ae,z]=w.useState(""),[V,ee]=w.useState(()=>localStorage.getItem("library-sort-field")||"name"),[K,ne]=w.useState(()=>localStorage.getItem("library-sort-direction")||"asc"),se=are();w.useEffect(()=>{const qe=l.get("folder");if(qe){const ht=parseInt(qe,10);m(ht)}},[l]);const{data:ce}=Je({queryKey:["settings"],queryFn:()=>be.getSettings()}),{data:fe,isLoading:oe}=Je({queryKey:["library-folders"],queryFn:()=>be.getLibraryFolders()}),{data:O,isLoading:F}=Je({queryKey:["library-files",u],queryFn:()=>be.getLibraryFiles(u,u===null)}),{data:Q}=Je({queryKey:["library-stats"],queryFn:()=>be.getLibraryStats()}),{data:ve}=Je({queryKey:["users"],queryFn:()=>be.getUsers()}),he=w.useMemo(()=>{if(!O)return[];const qe=new Set(O.map(ht=>ht.file_type));return Array.from(qe).sort()},[O]),de=w.useMemo(()=>{if(!O)return[];let qe=[...O];if(E.trim()){const ht=E.toLowerCase();qe=qe.filter(yt=>yt.filename.toLowerCase().includes(ht)||yt.print_name&&yt.print_name.toLowerCase().includes(ht))}if(W!=="all"&&(qe=qe.filter(ht=>ht.file_type===W)),ae.trim()){const ht=ae.toLowerCase();qe=qe.filter(yt=>yt.created_by_username&&yt.created_by_username.toLowerCase().includes(ht))}return qe.sort((ht,yt)=>{let Bt=0;switch(V){case"name":Bt=(ht.print_name||ht.filename).localeCompare(yt.print_name||yt.filename);break;case"date":Bt=(Jn(ht.created_at)?.getTime()??0)-(Jn(yt.created_at)?.getTime()??0);break;case"size":Bt=ht.file_size-yt.file_size;break;case"type":Bt=ht.file_type.localeCompare(yt.file_type);break;case"prints":Bt=ht.print_count-yt.print_count;break}return K==="asc"?Bt:-Bt}),qe},[O,E,W,ae,V,K]),Ae=w.useMemo(()=>{if(!Q||!ce)return!1;const qe=(ce.library_disk_warning_gb||5)*1024*1024*1024;return Q.disk_free_bytes<qe},[Q,ce]),_e=ut({mutationFn:qe=>be.createLibraryFolder(qe),onSuccess:()=>{e.invalidateQueries({queryKey:["library-folders"]}),x(!1),n(t("fileManager.toast.folderCreated"),"success")},onError:qe=>n(qe.message,"error")}),ze=ut({mutationFn:qe=>be.deleteLibraryFolder(qe),onSuccess:()=>{e.invalidateQueries({queryKey:["library-folders"]}),e.invalidateQueries({queryKey:["library-files"]}),e.invalidateQueries({queryKey:["library-stats"]}),u===T?.id&&m(null),N(null),n(t("fileManager.toast.folderDeleted"),"success")},onError:qe=>{N(null),n(qe.message,"error")}}),Be=ut({mutationFn:qe=>be.deleteLibraryFile(qe),onSuccess:()=>{e.invalidateQueries({queryKey:["library-files"]}),e.invalidateQueries({queryKey:["library-folders"]}),e.invalidateQueries({queryKey:["library-stats"]}),f(qe=>qe.filter(ht=>ht!==T?.id)),N(null),n(t("fileManager.toast.fileDeleted"),"success")},onError:qe=>{N(null),n(qe.message,"error")}}),Ue=ut({mutationFn:qe=>be.bulkDeleteLibrary(qe,[]),onSuccess:(qe,ht)=>{e.invalidateQueries({queryKey:["library-files"]}),e.invalidateQueries({queryKey:["library-folders"]}),e.invalidateQueries({queryKey:["library-stats"]}),n(t("fileManager.toast.filesDeleted",{count:ht.length}),"success"),f([]),N(null)},onError:qe=>{N(null),n(qe.message,"error")}}),Ne=ut({mutationFn:({fileIds:qe,folderId:ht})=>be.moveLibraryFiles(qe,ht),onSuccess:()=>{e.invalidateQueries({queryKey:["library-files"]}),e.invalidateQueries({queryKey:["library-folders"]}),f([]),v(!1),n(t("fileManager.toast.filesMoved"),"success")},onError:qe=>n(qe.message,"error")}),Ee=ut({mutationFn:({id:qe,data:ht})=>be.updateLibraryFolder(qe,ht),onSuccess:(qe,ht)=>{e.invalidateQueries({queryKey:["library-folders"]}),e.invalidateQueries({queryKey:["project-folders"]}),e.invalidateQueries({queryKey:["archive-folders"]}),C(null);const yt=ht.data.project_id===0&&ht.data.archive_id===0;n(t(yt?"fileManager.toast.folderUnlinked":"fileManager.toast.folderLinked"),"success")},onError:qe=>n(qe.message,"error")}),ke=ut({mutationFn:({id:qe,filename:ht})=>be.updateLibraryFile(qe,{filename:ht}),onSuccess:()=>{e.invalidateQueries({queryKey:["library-files"]}),te(null),n(t("fileManager.toast.fileRenamed"),"success")},onError:qe=>{te(null),n(qe.message,"error")}}),Me=ut({mutationFn:({id:qe,name:ht})=>be.updateLibraryFolder(qe,{name:ht}),onSuccess:()=>{e.invalidateQueries({queryKey:["library-folders"]}),e.invalidateQueries({queryKey:["library-files"]}),te(null),n(t("fileManager.toast.folderRenamed"),"success")},onError:qe=>{te(null),n(qe.message,"error")}}),Ge=ut({mutationFn:()=>be.batchGenerateStlThumbnails({all_missing:!0}),onSuccess:qe=>{if(e.invalidateQueries({queryKey:["library-files"]}),qe.succeeded>0){const ht=Date.now(),yt={};qe.results.forEach(Bt=>{Bt.success&&(yt[Bt.file_id]=ht)}),J(Bt=>({...Bt,...yt}))}qe.succeeded>0&&qe.failed===0?n(t("fileManager.toast.thumbnailsGenerated",{count:qe.succeeded}),"success"):qe.succeeded>0&&qe.failed>0?n(t("fileManager.toast.thumbnailsGeneratedPartial",{succeeded:qe.succeeded,failed:qe.failed}),"success"):qe.processed===0?n(t("fileManager.toast.noStlMissingThumbnails"),"info"):n(t("fileManager.toast.failedToGenerateThumbnails",{error:qe.results[0]?.error||"Unknown error"}),"error")},onError:qe=>n(qe.message,"error")}),xe=ut({mutationFn:qe=>be.batchGenerateStlThumbnails({file_ids:[qe]}),onSuccess:qe=>{if(e.invalidateQueries({queryKey:["library-files"]}),qe.succeeded>0){const ht=qe.results[0]?.file_id;ht&&J(yt=>({...yt,[ht]:Date.now()})),n(t("fileManager.toast.thumbnailGenerated"),"success")}else n(t("fileManager.toast.failedToGenerateThumbnail",{error:qe.results[0]?.error||"Unknown error"}),"error")},onError:qe=>n(qe.message,"error")}),He=w.useCallback(qe=>{const ht=qe.toLowerCase();return ht.endsWith(".gcode")||ht.includes(".gcode.")},[]),Pe=w.useMemo(()=>O?O.filter(qe=>p.includes(qe.id)&&He(qe.filename)):[],[O,p,He]),Ve=w.useCallback(qe=>{f(ht=>ht.includes(qe)?ht.filter(yt=>yt!==qe):[...ht,qe])},[]),je=w.useCallback(()=>{de.length>0&&f(de.map(qe=>qe.id))},[de]),ye=w.useCallback(()=>{f([])},[]),$e=()=>{e.invalidateQueries({queryKey:["library-files"]}),e.invalidateQueries({queryKey:["library-folders"]}),e.invalidateQueries({queryKey:["library-stats"]})},Ye=qe=>{be.downloadLibraryFile(qe).catch(ht=>{console.error("Library file download failed:",ht)})},lt=()=>{T&&(T.type==="file"?Be.mutate(T.id):T.type==="folder"?ze.mutate(T.id):T.type==="bulk"&&Ue.mutate(p))},St=ze.isPending||Be.isPending||Ue.isPending,ot=qe=>{X(qe),localStorage.setItem("library-view-mode",qe)},ft=oe||F;return i.jsxs("div",{className:"p-4 md:p-8 min-h-[calc(100vh-64px)] lg:h-[calc(100vh-64px)] flex flex-col",children:[i.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4 mb-6",children:[i.jsxs("div",{children:[i.jsxs("h1",{className:"text-2xl font-bold text-white flex items-center gap-3",children:[i.jsx("div",{className:"p-2.5 bg-bambu-green/10 rounded-xl",children:i.jsx(nc,{className:"w-6 h-6 text-bambu-green"})}),t("fileManager.title")]}),i.jsx("p",{className:"text-sm text-bambu-gray mt-2 ml-14",children:t("fileManager.subtitle")})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs("div",{className:"flex items-center bg-bambu-dark rounded-lg p-1",children:[i.jsx("button",{onClick:()=>ot("grid"),className:`p-1.5 rounded transition-colors ${ge==="grid"?"bg-bambu-dark-secondary text-white":"text-bambu-gray hover:text-white"}`,title:t("fileManager.gridView"),children:i.jsx(R0,{className:"w-4 h-4"})}),i.jsx("button",{onClick:()=>ot("list"),className:`p-1.5 rounded transition-colors ${ge==="list"?"bg-bambu-dark-secondary text-white":"text-bambu-gray hover:text-white"}`,title:t("fileManager.listView"),children:i.jsx(mC,{className:"w-4 h-4"})})]}),i.jsxs(Fe,{variant:"secondary",onClick:()=>Ge.mutate(),disabled:Ge.isPending||!a("library:update_own","library:update_all"),title:a("library:update_own","library:update_all")?t("fileManager.generateThumbnailsForMissing"):t("fileManager.noPermissionGenerateThumbnail"),children:[Ge.isPending?i.jsx(ct,{className:"w-4 h-4 mr-2 animate-spin"}):i.jsx(ou,{className:"w-4 h-4 mr-2"}),t("fileManager.generateThumbnails")]}),i.jsxs(Fe,{variant:"secondary",onClick:()=>x(!0),disabled:!r("library:upload"),title:r("library:upload")?void 0:t("fileManager.noPermissionCreateFolder"),children:[i.jsx(cpe,{className:"w-4 h-4 mr-2"}),t("fileManager.newFolder")]}),i.jsxs(Fe,{onClick:()=>k(!0),disabled:!r("library:upload"),title:r("library:upload")?void 0:t("fileManager.noPermissionUpload"),children:[i.jsx(Si,{className:"w-4 h-4 mr-2"}),t("common.upload")]})]})]}),Ae&&Q&&ce&&i.jsxs("div",{className:"flex items-center gap-3 mb-4 p-3 bg-amber-500/10 border border-amber-500/30 rounded-lg",children:[i.jsx(En,{className:"w-5 h-5 text-amber-500 flex-shrink-0"}),i.jsxs("div",{className:"flex-1",children:[i.jsx("p",{className:"text-sm text-amber-500 font-medium",children:t("fileManager.lowDiskSpaceWarning")}),i.jsx("p",{className:"text-xs text-amber-500/80",children:t("fileManager.lowDiskSpaceDetails",{free:no(Q.disk_free_bytes),total:no(Q.disk_total_bytes),threshold:ce.library_disk_warning_gb})})]})]}),Q&&i.jsxs("div",{className:"flex flex-wrap items-center gap-3 sm:gap-6 mb-6 p-3 bg-bambu-dark-secondary rounded-lg border border-bambu-dark-tertiary",children:[i.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[i.jsx(cC,{className:"w-4 h-4 text-bambu-green"}),i.jsxs("span",{className:"text-bambu-gray",children:[t("fileManager.files"),":"]}),i.jsx("span",{className:"text-white font-medium",children:Q.total_files})]}),i.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[i.jsx(nc,{className:"w-4 h-4 text-blue-400"}),i.jsxs("span",{className:"text-bambu-gray",children:[t("fileManager.folders"),":"]}),i.jsx("span",{className:"text-white font-medium",children:Q.total_folders})]}),i.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[i.jsx(cx,{className:"w-4 h-4 text-amber-400"}),i.jsxs("span",{className:"text-bambu-gray",children:[t("fileManager.size"),":"]}),i.jsx("span",{className:"text-white font-medium",children:no(Q.total_size_bytes)})]}),i.jsxs("div",{className:"flex items-center gap-2 text-sm sm:ml-auto",children:[i.jsxs("span",{className:"text-bambu-gray",children:[t("fileManager.free"),":"]}),i.jsx("span",{className:`font-medium ${Ae?"text-amber-500":"text-white"}`,children:no(Q.disk_free_bytes)})]})]}),i.jsxs("div",{className:"flex-1 flex flex-col lg:flex-row gap-4 lg:gap-6 min-h-0",children:[i.jsx("div",{className:"lg:hidden",children:i.jsxs("select",{value:u??"",onChange:qe=>m(qe.target.value?parseInt(qe.target.value,10):null),className:"w-full bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg px-3 py-2.5 text-white focus:outline-none focus:border-bambu-green",children:[i.jsxs("option",{value:"",children:["📁 ",t("fileManager.allFiles")]}),fe&&(()=>{const qe=(ht,yt=0)=>{const Bt=[];for(const Yt of ht)Bt.push({id:Yt.id,name:Yt.name,fileCount:Yt.file_count,depth:yt}),Yt.children.length>0&&Bt.push(...qe(Yt.children,yt+1));return Bt};return qe(fe).map(ht=>i.jsxs("option",{value:ht.id,children:["│ ".repeat(ht.depth),"📂 ",ht.name," ",ht.fileCount>0?`(${ht.fileCount})`:""]},ht.id))})()]})}),i.jsxs("div",{ref:j,className:"hidden lg:flex flex-shrink-0 bg-bambu-dark-secondary rounded-lg border border-bambu-dark-tertiary overflow-hidden flex-col relative",style:{width:`${pe}px`},children:[i.jsx("div",{className:`absolute right-0 top-0 bottom-0 w-1.5 cursor-col-resize z-10 group/resize flex items-center justify-center transition-colors ${q?"bg-bambu-green":"hover:bg-bambu-green/50"}`,onMouseDown:qe=>{qe.preventDefault(),Z(!0)},onDoubleClick:()=>{Ce(256),localStorage.setItem("library-sidebar-width","256")},title:t("fileManager.dragToResizeTooltip"),children:i.jsxs("div",{className:`flex flex-col gap-1 opacity-0 group-hover/resize:opacity-100 transition-opacity ${q?"opacity-100":""}`,children:[i.jsx("div",{className:"w-0.5 h-0.5 rounded-full bg-white/70"}),i.jsx("div",{className:"w-0.5 h-0.5 rounded-full bg-white/70"}),i.jsx("div",{className:"w-0.5 h-0.5 rounded-full bg-white/70"})]})}),i.jsxs("div",{className:"p-3 border-b border-bambu-dark-tertiary flex items-center justify-between",children:[i.jsx("h2",{className:"text-sm font-medium text-white",children:t("fileManager.folders")}),i.jsx("button",{onClick:()=>{const qe=!ie;le(qe),localStorage.setItem("library-wrap-folders",String(qe))},className:`text-xs px-1.5 py-0.5 rounded transition-colors ${ie?"bg-bambu-green/20 text-bambu-green":"text-bambu-gray hover:text-white hover:bg-bambu-dark"}`,title:t(ie?"fileManager.disableTextWrapping":"fileManager.enableTextWrapping"),children:t("fileManager.wrap")})]}),i.jsxs("div",{className:"flex-1 overflow-y-auto p-2",children:[i.jsxs("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded cursor-pointer transition-colors ${u===null?"bg-bambu-green/20 text-bambu-green":"hover:bg-bambu-dark text-white"}`,onClick:()=>m(null),children:[i.jsx(Cp,{className:"w-4 h-4"}),i.jsx("span",{className:"text-sm",children:t("fileManager.allFiles")})]}),fe?.map(qe=>i.jsx(Ise,{folder:qe,selectedFolderId:u,onSelect:m,onDelete:ht=>N({type:"folder",id:ht}),onLink:C,onRename:ht=>te({type:"folder",id:ht.id,name:ht.name}),wrapNames:ie,hasPermission:r,t},qe.id))]})]}),i.jsxs("div",{className:"flex-1 flex flex-col min-w-0 min-h-0",children:[O&&O.length>0&&i.jsxs("div",{className:"flex flex-wrap items-center gap-2 sm:gap-3 mb-4 p-2 sm:p-3 bg-bambu-dark-secondary rounded-lg border border-bambu-dark-tertiary sticky top-0 z-10 lg:static",children:[i.jsxs("div",{className:"relative w-full sm:w-auto sm:flex-1 sm:max-w-xs",children:[i.jsx(Dr,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray"}),i.jsx("input",{type:"text",placeholder:t("fileManager.searchFiles"),value:E,onChange:qe=>I(qe.target.value),className:"w-full pl-9 pr-3 py-1.5 bg-bambu-dark border border-bambu-dark-tertiary rounded text-sm text-white placeholder-bambu-gray focus:outline-none focus:border-bambu-green"})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(dC,{className:"w-4 h-4 text-bambu-gray hidden sm:block"}),i.jsxs("select",{value:W,onChange:qe=>B(qe.target.value),className:"bg-bambu-dark border border-bambu-dark-tertiary rounded px-2 py-1.5 text-sm text-white focus:outline-none focus:border-bambu-green",children:[i.jsx("option",{value:"all",children:t("fileManager.allTypes")}),he.map(qe=>i.jsx("option",{value:qe,children:qe.toUpperCase()},qe))]})]}),o&&i.jsxs("div",{className:"relative",children:[i.jsx("input",{type:"text",placeholder:t("fileManager.filterByUser",{defaultValue:"Filter by user"}),value:ae,onChange:qe=>z(qe.target.value),list:"usernames-list",className:`w-32 sm:w-40 px-2 py-1.5 bg-bambu-dark border border-bambu-dark-tertiary rounded text-sm text-white placeholder-bambu-gray focus:outline-none focus:border-bambu-green ${ae?"pr-7":""}`,style:ae?{WebkitAppearance:"none",MozAppearance:"textfield"}:void 0}),ae&&i.jsx("button",{onClick:()=>z(""),className:"absolute right-2 top-1/2 -translate-y-1/2 text-bambu-gray hover:text-white z-10",children:i.jsx(zt,{className:"w-3 h-3"})}),i.jsx("datalist",{id:"usernames-list",children:ve?.map(qe=>i.jsx("option",{value:qe.username},qe.id))})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs("select",{value:V,onChange:qe=>{const ht=qe.target.value;ee(ht),localStorage.setItem("library-sort-field",ht)},className:"bg-bambu-dark border border-bambu-dark-tertiary rounded px-2 py-1.5 text-sm text-white focus:outline-none focus:border-bambu-green",children:[i.jsx("option",{value:"name",children:t("common.name")}),i.jsx("option",{value:"date",children:t("common.date")}),i.jsx("option",{value:"size",children:t("fileManager.size")}),i.jsx("option",{value:"type",children:t("common.type")}),i.jsx("option",{value:"prints",children:t("fileManager.prints")})]}),i.jsx("button",{onClick:()=>ne(qe=>{const ht=qe==="asc"?"desc":"asc";return localStorage.setItem("library-sort-direction",ht),ht}),className:"p-1.5 rounded bg-bambu-dark border border-bambu-dark-tertiary hover:border-bambu-green transition-colors",title:t(K==="asc"?"fileManager.ascending":"fileManager.descending"),children:K==="asc"?i.jsx(Tme,{className:"w-4 h-4 text-white"}):i.jsx(vme,{className:"w-4 h-4 text-white"})})]}),(E||W!=="all"||ae)&&i.jsx("span",{className:"text-sm text-bambu-gray hidden sm:inline",children:t("fileManager.resultsCount",{showing:de.length,total:O.length})})]}),de.length>0&&i.jsxs("div",{className:"flex flex-wrap items-center gap-2 mb-4 p-2 bg-bambu-dark-secondary rounded-lg border border-bambu-dark-tertiary sticky top-[52px] z-10 lg:static",children:[p.length===de.length&&p.length>0?i.jsxs(Fe,{variant:"secondary",size:"sm",onClick:ye,children:[i.jsx(Sl,{className:"w-4 h-4 sm:mr-1"}),i.jsx("span",{className:"hidden sm:inline",children:t("fileManager.deselectAll")})]}):i.jsxs(Fe,{variant:"secondary",size:"sm",onClick:je,children:[i.jsx(mo,{className:"w-4 h-4 sm:mr-1"}),i.jsx("span",{className:"hidden sm:inline",children:t("fileManager.selectAll")})]}),p.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"text-sm text-bambu-gray ml-2",children:t("fileManager.selected",{count:p.length})}),i.jsx("div",{className:"hidden sm:block flex-1"}),i.jsxs("div",{className:"w-full sm:w-auto flex flex-wrap items-center gap-2 mt-2 sm:mt-0",children:[Pe.length===1&&i.jsxs(Fe,{variant:"primary",size:"sm",onClick:()=>$(Pe[0]),disabled:!r("printers:control"),title:r("printers:control")?void 0:t("fileManager.noPermissionPrint"),children:[i.jsx(co,{className:"w-4 h-4 sm:mr-1"}),i.jsx("span",{className:"hidden sm:inline",children:t("common.print")})]}),Pe.length===1&&i.jsxs(Fe,{variant:"secondary",size:"sm",onClick:()=>G(Pe[0]),disabled:!r("queue:create"),title:r("queue:create")?void 0:t("fileManager.noPermissionAddToQueue"),children:[i.jsx(er,{className:"w-4 h-4 sm:mr-1"}),i.jsx("span",{className:"hidden sm:inline",children:t("fileManager.schedulePrint")})]}),i.jsxs(Fe,{variant:"secondary",size:"sm",onClick:()=>v(!0),disabled:!a("library:update_own","library:update_all"),title:a("library:update_own","library:update_all")?void 0:t("fileManager.noPermissionMoveFiles"),children:[i.jsx(xfe,{className:"w-4 h-4 sm:mr-1"}),i.jsx("span",{className:"hidden sm:inline",children:t("common.move")})]}),i.jsxs(Fe,{variant:"danger",size:"sm",onClick:()=>{p.length===1?N({type:"file",id:p[0]}):N({type:"bulk",id:0,count:p.length})},disabled:!a("library:delete_own","library:delete_all"),title:a("library:delete_own","library:delete_all")?void 0:t("fileManager.noPermissionDeleteFiles"),children:[i.jsx(Qt,{className:"w-4 h-4 sm:mr-1"}),i.jsx("span",{className:"hidden sm:inline",children:t("common.delete")})]}),i.jsxs(Fe,{variant:"secondary",size:"sm",onClick:ye,children:[i.jsx(zt,{className:"w-4 h-4 sm:mr-1"}),i.jsx("span",{className:"hidden sm:inline",children:t("common.clear")})]})]})]})]}),ft?i.jsx("div",{className:"flex-1 flex items-center justify-center",children:i.jsxs("div",{className:"flex flex-col items-center gap-3",children:[i.jsx(ct,{className:"w-8 h-8 animate-spin text-bambu-green"}),i.jsx("p",{className:"text-sm text-bambu-gray",children:t("fileManager.loadingFiles")})]})}):O?.length===0?i.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center",children:[i.jsx("div",{className:"p-4 bg-bambu-dark rounded-2xl mb-4",children:i.jsx(Cp,{className:"w-12 h-12 text-bambu-gray/50"})}),i.jsx("h3",{className:"text-lg font-medium text-white mb-2",children:t(u!==null?"fileManager.folderIsEmpty":"fileManager.noFilesYet")}),i.jsx("p",{className:"text-bambu-gray text-center max-w-md mb-6",children:t(u!==null?"fileManager.folderEmptyDescription":"fileManager.noFilesDescription")}),i.jsxs(Fe,{onClick:()=>k(!0),disabled:!r("library:upload"),title:r("library:upload")?void 0:t("fileManager.noPermissionUpload"),children:[i.jsx(sr,{className:"w-4 h-4 mr-2"}),t("fileManager.uploadFiles")]})]}):de.length===0?i.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center",children:[i.jsx("div",{className:"p-4 bg-bambu-dark rounded-2xl mb-4",children:i.jsx(Dr,{className:"w-12 h-12 text-bambu-gray/50"})}),i.jsx("h3",{className:"text-lg font-medium text-white mb-2",children:t("fileManager.noMatchingFiles")}),i.jsx("p",{className:"text-bambu-gray text-center max-w-md mb-6",children:t("fileManager.noMatchingFilesDescription")}),i.jsx(Fe,{variant:"secondary",onClick:()=>{I(""),B("all")},children:t("fileManager.clearFilters")})]}):ge==="grid"?i.jsx("div",{className:"flex-1 lg:overflow-y-auto",children:i.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5 2xl:grid-cols-6 gap-4",children:de.map(qe=>i.jsx(aet,{file:qe,isSelected:p.includes(qe.id),isMobile:se,t,onSelect:Ve,onDelete:ht=>N({type:"file",id:ht}),onDownload:Ye,onAddToQueue:ht=>{const yt=O?.find(Bt=>Bt.id===ht);yt&&G(yt)},onPrint:A,onPreview3d:me,onRename:ht=>te({type:"file",id:ht.id,name:ht.filename}),onGenerateThumbnail:ht=>xe.mutate(ht.id),thumbnailVersion:re[qe.id],hasPermission:r,canModify:s,authEnabled:o},qe.id))})}):i.jsx("div",{className:"flex-1 lg:overflow-y-auto",children:i.jsxs("div",{className:"bg-bambu-dark-secondary rounded-lg border border-bambu-dark-tertiary overflow-hidden",children:[i.jsxs("div",{className:`hidden sm:grid ${o?"grid-cols-[auto_1fr_120px_100px_100px_100px_80px]":"grid-cols-[auto_1fr_100px_100px_100px_80px]"} gap-4 px-4 py-2 bg-bambu-dark-secondary border-b border-bambu-dark-tertiary text-xs text-bambu-gray font-medium`,children:[i.jsx("div",{className:"w-6"}),i.jsx("div",{children:t("common.name")}),o&&i.jsx("div",{children:t("fileManager.uploadedBy",{defaultValue:"Uploaded By"})}),i.jsx("div",{children:t("common.type")}),i.jsx("div",{children:t("fileManager.size")}),i.jsx("div",{children:t("fileManager.prints")}),i.jsx("div",{})]}),de.map(qe=>i.jsxs("div",{className:`grid ${o?"grid-cols-[auto_1fr_120px_100px_100px_100px_80px]":"grid-cols-[auto_1fr_100px_100px_100px_80px]"} gap-4 px-4 py-3 items-center border-b border-bambu-dark-tertiary last:border-b-0 cursor-pointer hover:bg-bambu-dark/50 transition-colors ${p.includes(qe.id)?"bg-bambu-green/10":""}`,onClick:()=>Ve(qe.id),children:[i.jsx("div",{className:`w-5 h-5 rounded border-2 flex items-center justify-center ${p.includes(qe.id)?"bg-bambu-green border-bambu-green":"border-bambu-gray/50"}`,children:p.includes(qe.id)&&i.jsx("div",{className:"w-2 h-2 bg-white rounded-sm"})}),i.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[i.jsxs("div",{className:"relative group/thumb",children:[i.jsx("div",{className:"w-10 h-10 rounded bg-bambu-dark flex-shrink-0 overflow-hidden",children:qe.thumbnail_path?i.jsx("img",{src:`${be.getLibraryFileThumbnailUrl(qe.id)}${re[qe.id]?`?v=${re[qe.id]}`:""}`,alt:"",className:"w-full h-full object-cover"}):i.jsx("div",{className:"w-full h-full flex items-center justify-center",children:i.jsx(Cp,{className:"w-5 h-5 text-bambu-gray/50"})})}),qe.thumbnail_path&&i.jsx("div",{className:"absolute left-0 top-full mt-2 z-50 hidden group-hover/thumb:block",children:i.jsx("div",{className:"w-48 h-48 rounded-lg bg-bambu-dark-secondary border border-bambu-dark-tertiary shadow-xl overflow-hidden",children:i.jsx("img",{src:`${be.getLibraryFileThumbnailUrl(qe.id)}${re[qe.id]?`?v=${re[qe.id]}`:""}`,alt:qe.filename,className:"w-full h-full object-contain"})})})]}),i.jsx("div",{className:"min-w-0",children:i.jsx("div",{className:"text-sm text-white truncate",children:qe.print_name||qe.filename})})]}),o&&i.jsx("div",{className:"text-sm text-bambu-gray flex items-center gap-1",children:qe.created_by_username?i.jsxs(i.Fragment,{children:[i.jsx(du,{className:"w-3 h-3"}),i.jsx("span",{className:"truncate",children:qe.created_by_username})]}):"-"}),i.jsx("div",{children:i.jsx("span",{className:`text-xs px-1.5 py-0.5 rounded font-medium ${qe.file_type==="3mf"?"bg-bambu-green/20 text-bambu-green":qe.file_type==="gcode"?"bg-blue-500/20 text-blue-400":qe.file_type==="stl"?"bg-purple-500/20 text-purple-400":"bg-bambu-gray/20 text-bambu-gray"}`,children:qe.file_type.toUpperCase()})}),i.jsx("div",{className:"text-sm text-bambu-gray",children:no(qe.file_size)}),i.jsx("div",{className:"text-sm text-bambu-gray",children:qe.print_count>0?`${qe.print_count}x`:"-"}),i.jsxs("div",{className:"flex items-center gap-1",onClick:ht=>ht.stopPropagation(),children:[CF(qe.filename)&&i.jsxs(i.Fragment,{children:[i.jsx("button",{onClick:()=>r("printers:control")&&A(qe),className:`p-1.5 rounded transition-colors ${r("printers:control")?"hover:bg-bambu-dark text-bambu-gray hover:text-bambu-green":"text-bambu-gray/50 cursor-not-allowed"}`,title:r("printers:control")?t("common.print"):t("fileManager.noPermissionPrint"),disabled:!r("printers:control"),children:i.jsx(kr,{className:"w-4 h-4"})}),i.jsx("button",{onClick:()=>{r("queue:create")&&G(qe)},className:`p-1.5 rounded transition-colors ${r("queue:create")?"hover:bg-bambu-dark text-bambu-gray hover:text-white":"text-bambu-gray/50 cursor-not-allowed"}`,title:r("queue:create")?t("fileManager.schedulePrint"):t("fileManager.noPermissionAddToQueue"),disabled:!r("queue:create"),children:i.jsx(er,{className:"w-4 h-4"})})]}),(qe.file_type==="3mf"||qe.file_type==="gcode"||qe.file_type==="stl")&&i.jsx("button",{onClick:()=>r("library:read")&&me(qe),className:`p-1.5 rounded transition-colors ${r("library:read")?"hover:bg-bambu-dark text-bambu-gray hover:text-bambu-green":"text-bambu-gray/50 cursor-not-allowed"}`,title:r("library:read")?"3D Preview":"You do not have permission to preview files",disabled:!r("library:read"),children:i.jsx(ra,{className:"w-4 h-4"})}),i.jsx("button",{onClick:()=>r("library:read")&&Ye(qe.id),className:`p-1.5 rounded transition-colors ${r("library:read")?"hover:bg-bambu-dark text-bambu-gray hover:text-white":"text-bambu-gray/50 cursor-not-allowed"}`,title:r("library:read")?t("common.download"):t("fileManager.noPermissionDownload"),disabled:!r("library:read"),children:i.jsx(pi,{className:"w-4 h-4"})}),i.jsx("button",{onClick:()=>s("library","update",qe.created_by_id)&&te({type:"file",id:qe.id,name:qe.filename}),className:`p-1.5 rounded transition-colors ${s("library","update",qe.created_by_id)?"hover:bg-bambu-dark text-bambu-gray hover:text-white":"text-bambu-gray/50 cursor-not-allowed"}`,title:s("library","update",qe.created_by_id)?t("common.rename"):t("fileManager.noPermissionRenameFile"),disabled:!s("library","update",qe.created_by_id),children:i.jsx(Wi,{className:"w-4 h-4"})}),qe.file_type==="stl"&&i.jsx("button",{onClick:()=>s("library","update",qe.created_by_id)&&xe.mutate(qe.id),className:`p-1.5 rounded transition-colors ${s("library","update",qe.created_by_id)?"hover:bg-bambu-dark text-bambu-gray hover:text-bambu-green":"text-bambu-gray/50 cursor-not-allowed"}`,title:s("library","update",qe.created_by_id)?t("fileManager.generateThumbnail"):t("fileManager.noPermissionGenerateThumbnail"),disabled:xe.isPending||!s("library","update",qe.created_by_id),children:i.jsx(ou,{className:"w-4 h-4"})}),i.jsx("button",{onClick:()=>s("library","delete",qe.created_by_id)&&N({type:"file",id:qe.id}),className:`p-1.5 rounded transition-colors ${s("library","delete",qe.created_by_id)?"hover:bg-bambu-dark text-bambu-gray hover:text-red-400":"text-bambu-gray/50 cursor-not-allowed"}`,title:s("library","delete",qe.created_by_id)?t("common.delete"):t("fileManager.noPermissionDeleteFile"),disabled:!s("library","delete",qe.created_by_id),children:i.jsx(Qt,{className:"w-4 h-4"})})]})]},qe.id))]})})]})]}),y&&i.jsx(tet,{parentId:u,onClose:()=>x(!1),onSave:qe=>_e.mutate(qe),isLoading:_e.isPending,t}),b&&fe&&i.jsx(ret,{folders:fe,selectedFiles:p,currentFolderId:u,onClose:()=>v(!1),onMove:qe=>Ne.mutate({fileIds:p,folderId:qe}),isLoading:Ne.isPending,t}),_&&i.jsx(Zne,{folderId:u,onClose:()=>k(!1),onUploadComplete:$e}),P&&i.jsx(iet,{folder:P,onClose:()=>C(null),onLink:qe=>Ee.mutate({id:P.id,data:qe}),isLoading:Ee.isPending,t}),T&&i.jsx(Nn,{title:T.type==="folder"?t("fileManager.deleteFolder"):T.type==="bulk"?t("fileManager.deleteFilesCount",{count:T.count}):t("fileManager.deleteFile"),message:T.type==="folder"?t("fileManager.deleteFolderConfirm"):T.type==="bulk"?t("fileManager.deleteFilesConfirm",{count:T.count}):t("fileManager.deleteFileConfirm"),confirmText:t("common.delete"),variant:"danger",isLoading:St,loadingText:t("fileManager.deleting"),onConfirm:lt,onCancel:()=>N(null)}),R&&i.jsx($c,{mode:"reprint",libraryFileId:R.id,archiveName:R.print_name||R.filename,onClose:()=>A(null),onSuccess:()=>{A(null),e.invalidateQueries({queryKey:["library-files"]}),e.invalidateQueries({queryKey:["archives"]})}}),D&&i.jsx($c,{mode:"reprint",libraryFileId:D.id,archiveName:D.print_name||D.filename,onClose:()=>$(null),onSuccess:()=>{$(null),f([]),e.invalidateQueries({queryKey:["library-files"]}),e.invalidateQueries({queryKey:["archives"]})}}),U&&i.jsx($c,{mode:"add-to-queue",libraryFileId:U.id,archiveName:U.print_name||U.filename,onClose:()=>G(null),onSuccess:()=>{G(null),f([]),e.invalidateQueries({queryKey:["library-files"]}),e.invalidateQueries({queryKey:["queue"]}),e.invalidateQueries({queryKey:["archives"]})}}),ue&&i.jsx(L4,{libraryFileId:ue.id,title:ue.print_name||ue.filename,fileType:ue.file_type,onClose:()=>me(null)}),L&&i.jsx(net,{type:L.type,currentName:L.name,onClose:()=>te(null),onSave:qe=>{L.type==="file"?ke.mutate({id:L.id,filename:qe}):Me.mutate({id:L.id,name:qe})},isLoading:ke.isPending||Me.isPending,t})]})}const eD=5,oet=2e3,cet=3e4,det=5e3;function uet(){const{t}=Mt(),e=tn(),{showToast:n}=bn(),{hasPermission:r}=Rr(),{printerId:a}=M0(),s=parseInt(a||"0",10),[o,l]=w.useState("stream"),[c,d]=w.useState(!1),[u,m]=w.useState(!1),[p,f]=w.useState(!0),[y,x]=w.useState(Date.now()),[b,v]=w.useState(!1),[_,k]=w.useState(!1),[P,C]=w.useState(0),[T,N]=w.useState(!1),[R,A]=w.useState(0),[D,$]=w.useState(1),[U,G]=w.useState({x:0,y:0}),[L,te]=w.useState(!1),[re,J]=w.useState({x:0,y:0}),[ue,me]=w.useState(null),[ge,X]=w.useState(null),ie=w.useRef(null),le=w.useRef(null),pe=w.useRef(null),Ce=w.useRef(null),q=w.useRef(null),{data:Z}=Je({queryKey:["printer",s],queryFn:()=>be.getPrinter(s),enabled:s>0}),{data:j}=Je({queryKey:["printerStatus",s],queryFn:()=>be.getPrinterStatus(s),refetchInterval:3e4,enabled:s>0}),E=ut({mutationFn:Ne=>be.setChamberLight(s,Ne),onMutate:async Ne=>{await e.cancelQueries({queryKey:["printerStatus",s]});const Ee=e.getQueryData(["printerStatus",s]);return e.setQueryData(["printerStatus",s],ke=>({...ke,chamber_light:Ne})),{previousStatus:Ee}},onSuccess:(Ne,Ee)=>{n(`Chamber light ${Ee?"on":"off"}`)},onError:(Ne,Ee,ke)=>{ke?.previousStatus&&e.setQueryData(["printerStatus",s],ke.previousStatus),n(Ne.message||t("printers.toast.failedToControlChamberLight"),"error")}}),I=(j?.state==="RUNNING"||j?.state==="PAUSE")&&(j?.printable_objects_count??0)>=2;w.useEffect(()=>(Z&&(document.title=`${Z.name} - Camera`),()=>{document.title="Bambuddy"}),[Z]);const W=w.useRef(!1);w.useEffect(()=>{const Ne=`/api/v1/printers/${s}/camera/stop`;W.current=!1;const Ee=()=>{if(s>0&&!W.current){W.current=!0;const Ge={},xe=uu();xe&&(Ge.Authorization=`Bearer ${xe}`),fetch(Ne,{method:"POST",keepalive:!0,headers:Ge}).catch(()=>{})}},ke=()=>{Ee()};window.addEventListener("beforeunload",ke);const Me=ie.current;return()=>{window.removeEventListener("beforeunload",ke),Me&&(Me.src=""),Ee()}},[s]),w.useEffect(()=>{if(p&&!b){const Ee=setTimeout(()=>{f(!1)},o==="stream"?3e3:2e4);return()=>clearTimeout(Ee)}},[o,p,y,b]),w.useEffect(()=>{const Ne=()=>{const Ee=!!document.fullscreenElement;k(Ee),$(1),G({x:0,y:0}),o==="stream"&&!b&&(ie.current&&(ie.current.src=""),setTimeout(()=>{f(!0),x(Date.now())},200))};return document.addEventListener("fullscreenchange",Ne),()=>document.removeEventListener("fullscreenchange",Ne)},[o,b]),w.useEffect(()=>{let Ne;const Ee=()=>{clearTimeout(Ne),Ne=setTimeout(()=>{localStorage.setItem("cameraWindowState",JSON.stringify({width:window.outerWidth,height:window.outerHeight,left:window.screenX,top:window.screenY}))},500)};return window.addEventListener("resize",Ee),()=>{clearTimeout(Ne),window.removeEventListener("resize",Ee)}},[]),w.useEffect(()=>()=>{pe.current&&clearTimeout(pe.current),Ce.current&&clearInterval(Ce.current),q.current&&clearInterval(q.current)},[]);const B=w.useCallback(()=>{if(P>=eD){N(!1),m(!0);return}const Ne=Math.min(oet*Math.pow(2,P),cet);N(!0),A(Math.ceil(Ne/1e3)),Ce.current=setInterval(()=>{A(Ee=>Ee<=1?(Ce.current&&clearInterval(Ce.current),0):Ee-1)},1e3),pe.current=setTimeout(()=>{C(Ee=>Ee+1),N(!1),f(!0),m(!1),ie.current&&(ie.current.src=""),x(Date.now())},Ne)},[P]);w.useEffect(()=>{if(o!=="stream"||p||T||b){q.current&&(clearInterval(q.current),q.current=null);return}return q.current=setInterval(async()=>{try{const Ne=await be.getCameraStatus(s);(Ne.stalled||!Ne.active&&!u)&&(console.log(`Stream issue detected: stalled=${Ne.stalled}, active=${Ne.active}, reconnecting...`),q.current&&(clearInterval(q.current),q.current=null),f(!1),B())}catch{}},det),()=>{q.current&&(clearInterval(q.current),q.current=null)}},[o,p,u,T,b,s,B]);const ae=()=>{f(!1),o==="stream"&&P<eD?B():m(!0)},z=()=>{if(f(!1),m(!1),C(0),N(!1),pe.current&&clearTimeout(pe.current),Ce.current&&clearInterval(Ce.current),ie.current&&!localStorage.getItem("cameraWindowState")){const Ne=ie.current,Ee=Ne.naturalWidth,ke=Ne.naturalHeight;if(Ee>0&&ke>0){const xe=window.outerWidth-window.innerWidth,He=window.outerHeight-window.innerHeight,Pe=Ee+16+xe,Ve=ke+45+16+He;try{window.resizeTo(Pe,Ve)}catch{}}}},V=()=>{if(s>0){const Ne={},Ee=uu();Ee&&(Ne.Authorization=`Bearer ${Ee}`),fetch(`/api/v1/printers/${s}/camera/stop`,{method:"POST",headers:Ne}).catch(()=>{})}},ee=Ne=>{o===Ne||b||(v(!0),f(!0),m(!1),C(0),N(!1),$(1),G({x:0,y:0}),pe.current&&clearTimeout(pe.current),Ce.current&&clearInterval(Ce.current),ie.current&&(ie.current.src=""),o==="stream"&&V(),setTimeout(()=>{l(Ne),x(Date.now()),v(!1)},100))},K=()=>{b||(v(!0),f(!0),m(!1),C(0),N(!1),pe.current&&clearTimeout(pe.current),Ce.current&&clearInterval(Ce.current),ie.current&&(ie.current.src=""),o==="stream"&&V(),setTimeout(()=>{x(Date.now()),v(!1)},100))},ne=()=>{le.current&&(document.fullscreenElement?document.exitFullscreen():le.current.requestFullscreen())},se=()=>{$(Ne=>Math.min(Ne+.5,4))},ce=()=>{$(Ne=>{const Ee=Math.max(Ne-.5,1);return Ee===1&&G({x:0,y:0}),Ee})},fe=Ne=>{Ne.preventDefault(),Ne.deltaY<0?se():ce()},oe=Ne=>{D>1&&(Ne.preventDefault(),te(!0),J({x:Ne.clientX-U.x,y:Ne.clientY-U.y}))},O=w.useCallback(()=>{if(!le.current)return{x:300,y:200};const Ne=le.current.getBoundingClientRect(),Ee=Ne.width*(D-1)/2,ke=Ne.height*(D-1)/2;return{x:Math.max(50,Ee),y:Math.max(50,ke)}},[D]),F=Ne=>{if(L&&D>1){const Ee=Ne.clientX-re.x,ke=Ne.clientY-re.y,Me=O();G({x:Math.max(-Me.x,Math.min(Me.x,Ee)),y:Math.max(-Me.y,Math.min(Me.y,ke))})}},Q=()=>{te(!1)},ve=Ne=>{if(Ne.length<2)return 0;const Ee=Ne[0].clientX-Ne[1].clientX,ke=Ne[0].clientY-Ne[1].clientY;return Math.sqrt(Ee*Ee+ke*ke)},he=Ne=>Ne.length<2?{x:Ne[0].clientX,y:Ne[0].clientY}:{x:(Ne[0].clientX+Ne[1].clientX)/2,y:(Ne[0].clientY+Ne[1].clientY)/2},de=Ne=>{Ne.touches.length===2?(Ne.preventDefault(),me(ve(Ne.touches)),X(he(Ne.touches))):Ne.touches.length===1&&D>1&&(Ne.preventDefault(),te(!0),J({x:Ne.touches[0].clientX-U.x,y:Ne.touches[0].clientY-U.y}))},Ae=Ne=>{if(Ne.touches.length===2&&ue!==null){Ne.preventDefault();const Ee=ve(Ne.touches),ke=Ee/ue;$(Ge=>{const xe=Math.max(1,Math.min(4,Ge*ke));return xe===1&&G({x:0,y:0}),xe}),me(Ee);const Me=he(Ne.touches);if(ge){const Ge=O();G(xe=>({x:Math.max(-Ge.x,Math.min(Ge.x,xe.x+(Me.x-ge.x))),y:Math.max(-Ge.y,Math.min(Ge.y,xe.y+(Me.y-ge.y)))}))}X(Me)}else if(Ne.touches.length===1&&L&&D>1){Ne.preventDefault();const Ee=Ne.touches[0].clientX-re.x,ke=Ne.touches[0].clientY-re.y,Me=O();G({x:Math.max(-Me.x,Math.min(Me.x,Ee)),y:Math.max(-Me.y,Math.min(Me.y,ke))})}},_e=Ne=>{Ne.touches.length<2&&(me(null),X(null)),Ne.touches.length===0&&te(!1)},ze=()=>{$(1),G({x:0,y:0})},Be=b?"":o==="stream"?`/api/v1/printers/${s}/camera/stream?fps=15&t=${y}`:`/api/v1/printers/${s}/camera/snapshot?t=${y}`,Ue=p||b||T;return s?i.jsxs("div",{ref:le,className:"min-h-screen bg-black flex flex-col",children:[i.jsxs("div",{className:"flex items-center justify-between px-4 py-2 bg-bambu-dark-secondary border-b border-bambu-dark-tertiary",children:[i.jsxs("h1",{className:"text-sm font-medium text-white flex items-center gap-2",children:[i.jsx(Mb,{className:"w-4 h-4"}),Z?.name||`Printer ${s}`]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs("div",{className:"flex bg-bambu-dark rounded p-0.5",children:[i.jsx("button",{onClick:()=>ee("stream"),disabled:Ue,className:`px-3 py-1 text-xs rounded transition-colors ${o==="stream"?"bg-bambu-green text-white":"text-bambu-gray hover:text-white disabled:opacity-50"}`,children:t("camera.live")}),i.jsx("button",{onClick:()=>ee("snapshot"),disabled:Ue,className:`px-3 py-1 text-xs rounded transition-colors ${o==="snapshot"?"bg-bambu-green text-white":"text-bambu-gray hover:text-white disabled:opacity-50"}`,children:t("camera.snapshot")})]}),i.jsx("button",{onClick:()=>E.mutate(!j?.chamber_light),disabled:!j?.connected||E.isPending||!r("printers:control"),className:`p-1.5 rounded disabled:opacity-50 ${j?.chamber_light?"bg-yellow-500/20 hover:bg-yellow-500/30":"hover:bg-bambu-dark-tertiary"}`,title:r("printers:control")?t("camera.chamberLight"):t("printers.permission.noControl"),children:i.jsx(AL,{on:j?.chamber_light??!1,className:"w-4 h-4"})}),i.jsx("button",{onClick:()=>d(!0),disabled:!I||!r("printers:control"),className:`p-1.5 rounded disabled:opacity-50 ${I&&r("printers:control")?"hover:bg-bambu-dark-tertiary":""}`,title:r("printers:control")?t(I?"printers.skipObjects.tooltip":"printers.skipObjects.onlyWhilePrinting"):t("printers.permission.noControl"),children:i.jsx(MC,{className:"w-4 h-4 text-bambu-gray"})}),i.jsx("button",{onClick:K,disabled:Ue,className:"p-1.5 hover:bg-bambu-dark-tertiary rounded disabled:opacity-50",title:t(o==="stream"?"camera.restartStream":"camera.refreshSnapshot"),children:i.jsx(_r,{className:`w-4 h-4 text-bambu-gray ${Ue?"animate-spin":""}`})}),i.jsx("button",{onClick:ne,className:"p-1.5 hover:bg-bambu-dark-tertiary rounded",title:t(_?"camera.exitFullscreen":"camera.fullscreen"),children:_?i.jsx(YY,{className:"w-4 h-4 text-bambu-gray"}):i.jsx(sfe,{className:"w-4 h-4 text-bambu-gray"})})]})]}),i.jsx("div",{className:"flex-1 flex items-center justify-center p-2 overflow-hidden",onWheel:fe,onMouseMove:F,onMouseUp:Q,onMouseLeave:Q,onTouchStart:de,onTouchMove:Ae,onTouchEnd:_e,style:{touchAction:"none"},children:i.jsxs("div",{className:"relative w-full h-full flex items-center justify-center",children:[(p||b)&&!T&&i.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/50 z-10",children:i.jsxs("div",{className:"text-center",children:[i.jsx(_r,{className:"w-8 h-8 text-bambu-gray animate-spin mx-auto mb-2"}),i.jsx("p",{className:"text-sm text-bambu-gray",children:t(o==="stream"?"camera.connectingToCamera":"camera.capturingSnapshot")})]})}),T&&i.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/80 z-10",children:i.jsxs("div",{className:"text-center p-4",children:[i.jsx(rh,{className:"w-10 h-10 text-orange-400 mx-auto mb-3"}),i.jsx("p",{className:"text-white mb-2",children:t("camera.connectionLost")}),i.jsx("p",{className:"text-sm text-bambu-gray mb-3",children:t("camera.reconnecting",{countdown:R,attempt:P+1,max:eD})}),i.jsx("button",{onClick:K,className:"px-4 py-2 bg-bambu-green text-white text-sm rounded hover:bg-bambu-green/80 transition-colors",children:t("camera.reconnectNow")})]})}),u&&!T&&i.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black z-10",children:i.jsxs("div",{className:"text-center p-4",children:[i.jsx(En,{className:"w-12 h-12 text-orange-400 mx-auto mb-3"}),i.jsx("p",{className:"text-white mb-2",children:t("camera.cameraUnavailable")}),i.jsx("p",{className:"text-xs text-bambu-gray mb-4 max-w-md",children:t("camera.cameraUnavailableDesc")}),i.jsx("button",{onClick:K,className:"px-4 py-2 bg-bambu-green text-white rounded hover:bg-bambu-green/80 transition-colors",children:t("camera.retry")})]})}),i.jsx("img",{ref:ie,src:Be,alt:t("camera.cameraStream"),className:"max-w-full max-h-full object-contain select-none",style:{transform:`scale(${D}) translate(${U.x/D}px, ${U.y/D}px)`,cursor:D>1?L?"grabbing":"grab":"default"},onError:Be?ae:void 0,onLoad:Be?z:void 0,onMouseDown:oe,draggable:!1},y),i.jsxs("div",{className:"absolute bottom-4 left-4 flex items-center gap-1.5 bg-black/60 rounded-lg px-2 py-1.5",children:[i.jsx("button",{onClick:ce,disabled:D<=1,className:"p-1.5 hover:bg-white/10 rounded disabled:opacity-30",title:t("camera.zoomOut"),children:i.jsx(JF,{className:"w-4 h-4 text-white"})}),i.jsxs("button",{onClick:ze,className:"px-2 py-1 text-sm text-white hover:bg-white/10 rounded min-w-[48px]",title:t("camera.resetZoom"),children:[Math.round(D*100),"%"]}),i.jsx("button",{onClick:se,disabled:D>=4,className:"p-1.5 hover:bg-white/10 rounded disabled:opacity-30",title:t("camera.zoomIn"),children:i.jsx(ZF,{className:"w-4 h-4 text-white"})})]})]})}),i.jsx(ML,{printerId:s,isOpen:c,onClose:()=>d(!1)})]}):i.jsx("div",{className:"min-h-screen bg-black flex items-center justify-center",children:i.jsx("p",{className:"text-white",children:t("camera.invalidPrinterId")})})}function met(t){const e=t.get("show")?.split(",")||["progress","layers","eta","filename","status"],n=parseInt(t.get("fps")||"15",10),r=Math.min(Math.max(isNaN(n)?15:n,1),30),a=t.get("camera"),s=a!=="false"&&a!=="0";return{size:t.get("size")||"medium",fps:r,showCamera:s,showProgress:e.includes("progress"),showLayers:e.includes("layers"),showEta:e.includes("eta"),showFilename:e.includes("filename"),showStatus:e.includes("status"),showPrinter:e.includes("printer")}}function het(t,e){if(t.stg_cur_name)return t.stg_cur_name;switch(t.state){case"RUNNING":return e("streamOverlay.status.printing");case"PAUSE":return e("streamOverlay.status.paused");case"FINISH":return e("streamOverlay.status.finished");case"FAILED":return e("streamOverlay.status.failed");case"IDLE":return e("streamOverlay.status.idle");default:return t.state||e("streamOverlay.status.unknown")}}function pet(t){switch(t){case"small":return{container:"p-3",text:"text-sm",textLarge:"text-lg",progressHeight:"h-2",icon:"w-3 h-3",gap:"gap-2",logoHeight:"h-12"};case"large":return{container:"p-6",text:"text-xl",textLarge:"text-3xl",progressHeight:"h-4",icon:"w-6 h-6",gap:"gap-4",logoHeight:"h-24"};default:return{container:"p-4",text:"text-base",textLarge:"text-xl",progressHeight:"h-3",icon:"w-4 h-4",gap:"gap-3",logoHeight:"h-16"}}}function fet(){const{printerId:t}=M0(),[e]=OF(),{t:n}=Mt(),r=tn(),a=parseInt(t||"0",10),[s,o]=w.useState(Date.now()),l=w.useMemo(()=>met(e),[e]),c=pet(l.size),{data:d}=Je({queryKey:["printer",a],queryFn:()=>be.getPrinter(a),enabled:a>0}),{data:u}=Je({queryKey:["printerStatus",a],queryFn:()=>be.getPrinterStatus(a),enabled:a>0,refetchInterval:2e3}),{data:m}=Je({queryKey:["settings"],queryFn:be.getSettings}),p=m?.time_format||"system";w.useEffect(()=>{if(!a)return;const _=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/api/v1/ws`,k=new WebSocket(_);return k.onmessage=P=>{try{const C=JSON.parse(P.data);C.type==="printer_status"&&C.printer_id===a&&r.setQueryData(["printerStatus",a],C.status)}catch{}},k.onerror=()=>{},()=>{k.close()}},[a,r]),w.useEffect(()=>(document.title=d?`${d.name} - ${n("streamOverlay.title")}`:n("streamOverlay.title"),()=>{document.title="Bambuddy"}),[d,n]);const f=()=>{setTimeout(()=>{o(Date.now())},3e3)};if(!a)return i.jsx("div",{className:"min-h-screen bg-black flex items-center justify-center",children:i.jsx("p",{className:"text-white",children:n("streamOverlay.invalidPrinterId")})});if(!u)return i.jsx("div",{className:"min-h-screen bg-black flex items-center justify-center",children:i.jsx("p",{className:"text-gray-400",children:n("common.loading")})});const y=u.state==="RUNNING"||u.state==="PAUSE",x=u.progress||0,b=`/api/v1/printers/${a}/camera/stream?fps=${l.fps}&t=${s}`;return i.jsxs("div",{className:"min-h-screen bg-black relative overflow-hidden",children:[l.showCamera&&i.jsx("img",{src:b,alt:n("streamOverlay.cameraStream"),className:"absolute inset-0 w-full h-full object-contain",onError:f},s),i.jsx("a",{href:"https://github.com/maziggy/bambuddy",target:"_blank",rel:"noopener noreferrer",className:"absolute top-4 right-4 z-10",children:i.jsx("img",{src:"/img/bambuddy_logo_dark_transparent.png",alt:"Bambuddy",className:`${c.logoHeight} object-contain drop-shadow-lg hover:scale-105 transition-transform`})}),i.jsx("div",{className:"absolute bottom-0 left-0 right-0 z-10 bg-gradient-to-t from-black/80 via-black/60 to-transparent",children:i.jsxs("div",{className:`${c.container}`,children:[l.showPrinter&&d&&i.jsxs("div",{className:`flex items-center ${c.gap} mb-2`,children:[i.jsx(kr,{className:`${c.icon} text-white/70`}),i.jsx("span",{className:`${c.text} text-white font-medium`,children:d.name})]}),l.showFilename&&u.current_print&&i.jsx("div",{className:`${c.textLarge} text-white font-semibold mb-2 truncate drop-shadow-md`,children:u.current_print.replace(/\.gcode\.3mf$|\.3mf$|\.gcode$/i,"")}),l.showStatus&&i.jsx("div",{className:`${c.text} text-white/70 mb-2`,children:het(u,n)}),l.showProgress&&y&&i.jsxs("div",{className:"mb-3",children:[i.jsxs("div",{className:`flex items-center justify-between mb-1 ${c.text}`,children:[i.jsx("span",{className:"text-white/70",children:n("streamOverlay.progress")}),i.jsxs("span",{className:"text-white font-bold",children:[Math.round(x),"%"]})]}),i.jsx("div",{className:`w-full bg-white/20 rounded-full ${c.progressHeight}`,children:i.jsx("div",{className:`bg-bambu-green ${c.progressHeight} rounded-full transition-all duration-500`,style:{width:`${x}%`}})})]}),y&&(l.showLayers||l.showEta)&&i.jsxs("div",{className:`flex items-center ${c.gap} flex-wrap`,children:[l.showLayers&&u.layer_num!=null&&u.total_layers!=null&&u.total_layers>0&&i.jsxs("div",{className:`flex items-center ${c.gap} text-white/70`,children:[i.jsx(Vi,{className:c.icon}),i.jsxs("span",{className:c.text,children:[i.jsx("span",{className:"text-white",children:u.layer_num}),i.jsx("span",{className:"mx-1",children:"/"}),i.jsx("span",{children:u.total_layers})]})]}),l.showEta&&u.remaining_time!=null&&u.remaining_time>0&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:`flex items-center ${c.gap} text-white/70`,children:[i.jsx(qd,{className:c.icon}),i.jsx("span",{className:`${c.text} text-white`,children:Ms(u.remaining_time*60)})]}),i.jsxs("div",{className:`flex items-center ${c.gap} text-white/70`,children:[i.jsx(er,{className:c.icon}),i.jsxs("span",{className:`${c.text} text-white`,children:[n("streamOverlay.eta")," ",eL(u.remaining_time,p,n)]})]})]})]}),!y&&i.jsx("div",{className:`${c.text} text-white/70 py-2`,children:u.connected?n("streamOverlay.printerIdle"):n("streamOverlay.printerOffline")})]})})]})}function get(){const{t}=Mt(),{id:e}=M0(),{mode:n}=bf(),{data:r,isLoading:a,error:s}=Je({queryKey:["external-link",e],queryFn:()=>be.getExternalLink(Number(e)),enabled:!!e});return a?i.jsx("div",{className:"flex items-center justify-center h-full",children:i.jsx(ct,{className:"w-8 h-8 text-bambu-green animate-spin"})}):s||!r?i.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-4 text-bambu-gray",children:[i.jsx(En,{className:"w-12 h-12"}),i.jsx("p",{children:t("common.linkNotFound")})]}):i.jsx("iframe",{src:r.url,className:"h-full w-full border-0",style:{colorScheme:n},title:r.name,sandbox:"allow-scripts allow-same-origin allow-forms allow-popups allow-popups-to-escape-sandbox"})}function DK(){const{id:t}=M0(),e=Ml(),n=tn(),{t:r}=Mt(),{showToast:a}=bn(),s=!!t,[o,l]=w.useState(""),[c,d]=w.useState(""),[u,m]=w.useState([]),[p,f]=w.useState(""),[y,x]=w.useState(!1),{data:b,isLoading:v}=Je({queryKey:["group",t],queryFn:()=>be.getGroup(Number(t)),enabled:s}),{data:_,isLoading:k}=Je({queryKey:["permissions"],queryFn:()=>be.getPermissions()});s&&b&&!y&&(l(b.name),d(b.description||""),m(b.permissions),x(!0));const P=ut({mutationFn:J=>be.createGroup(J),onSuccess:()=>{n.invalidateQueries({queryKey:["groups"]}),a(r("groups.toast.created")),e("/settings?tab=users")},onError:J=>{a(J.message,"error")}}),C=ut({mutationFn:J=>be.updateGroup(Number(t),J),onSuccess:()=>{n.invalidateQueries({queryKey:["groups"]}),a(r("groups.toast.updated")),e("/settings?tab=users")},onError:J=>{a(J.message,"error")}}),T=P.isPending||C.isPending,N=()=>{if(!o.trim()){a(r("groups.toast.enterGroupName"),"error");return}s?C.mutate({name:o!==b?.name?o:void 0,description:c,permissions:u}):P.mutate({name:o,description:c||void 0,permissions:u})},R=J=>{m(ue=>ue.includes(J)?ue.filter(me=>me!==J):[...ue,J])},A=(J,ue)=>{const me=J.permissions.map(ge=>ge.value);m(ge=>{const X=ge.filter(ie=>!me.includes(ie));return ue?[...X,...me]:X})},D=J=>J.permissions.every(ue=>u.includes(ue.value)),$=J=>{const ue=J.permissions.filter(me=>u.includes(me.value)).length;return ue>0&&ue<J.permissions.length},U=()=>{_&&m(_.all_permissions)},G=()=>{m([])},L=p.toLowerCase(),te=w.useMemo(()=>_?L?_.categories.map(J=>({...J,permissions:J.permissions.filter(ue=>ue.label.toLowerCase().includes(L))})).filter(J=>J.permissions.length>0):_.categories:[],[_,L]),re=_?.all_permissions.length??0;return v||k?i.jsx("div",{className:"flex items-center justify-center py-16",children:i.jsx(ct,{className:"w-8 h-8 text-bambu-green animate-spin"})}):i.jsxs("div",{className:"space-y-6 max-w-5xl mx-auto",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("button",{onClick:()=>e("/settings?tab=users"),className:"p-2 rounded-lg hover:bg-bambu-dark-tertiary text-bambu-gray hover:text-white transition-colors",children:i.jsx(UY,{className:"w-5 h-5"})}),i.jsx("h1",{className:"text-xl font-bold text-white",children:r(s?"groups.editor.title":"groups.editor.createTitle")})]}),s&&b?.is_system&&i.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 rounded-lg bg-yellow-500/10 border border-yellow-500/20 text-yellow-400 text-sm",children:[i.jsx(En,{className:"w-4 h-4 shrink-0"}),r("groups.form.systemGroupWarning")]}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-white mb-2",children:r("groups.form.groupName")}),i.jsx("input",{type:"text",value:o,onChange:J=>l(J.target.value),disabled:s&&b?.is_system,className:"w-full px-4 py-3 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:border-bambu-green transition-colors disabled:opacity-50",placeholder:r("groups.form.groupNamePlaceholder")})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-white mb-2",children:r("groups.form.description")}),i.jsx("input",{type:"text",value:c,onChange:J=>d(J.target.value),className:"w-full px-4 py-3 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:border-bambu-green transition-colors",placeholder:r("groups.form.descriptionPlaceholder")})]})]}),i.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-3",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsxs("span",{className:"text-sm text-bambu-gray",children:[r("groups.editor.permissionsSelected",{count:u.length})," / ",re]}),i.jsx(Fe,{size:"sm",variant:"ghost",onClick:U,children:r("groups.editor.selectAll")}),i.jsx(Fe,{size:"sm",variant:"ghost",onClick:G,children:r("groups.editor.clearAll")})]}),i.jsxs("div",{className:"relative",children:[i.jsx(Dr,{className:"w-4 h-4 absolute left-3 top-1/2 -translate-y-1/2 text-bambu-gray"}),i.jsx("input",{type:"text",value:p,onChange:J=>f(J.target.value),placeholder:r("groups.editor.search"),className:"pl-9 pr-4 py-2 text-sm bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:border-bambu-green transition-colors w-64"})]})]}),te.length===0?i.jsx("div",{className:"text-center py-12 text-bambu-gray",children:r("groups.editor.noResults")}):i.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:te.map(J=>{const ue=_.categories.find(le=>le.name===J.name),me=ue.permissions.filter(le=>u.includes(le.value)).length,ge=ue.permissions.length,X=D(ue),ie=$(ue);return i.jsxs(Tt,{children:[i.jsxs("div",{className:"sticky top-0 z-10 flex items-center justify-between px-4 py-3 bg-bambu-dark-secondary border-b border-bambu-dark-tertiary rounded-t-xl",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsxs("button",{type:"button",onClick:()=>A(ue,!X),className:`w-5 h-5 rounded border flex items-center justify-center transition-colors shrink-0 ${X?"bg-bambu-green border-bambu-green":ie?"bg-bambu-green/50 border-bambu-green":"border-bambu-gray hover:border-white"}`,children:[X&&i.jsx(Vr,{className:"w-3 h-3 text-white"}),ie&&!X&&i.jsx(V1,{className:"w-3 h-3 text-white"})]}),i.jsx(AD,{className:"w-4 h-4 text-bambu-gray shrink-0"}),i.jsx("span",{className:"text-white font-medium text-sm",children:J.name})]}),i.jsxs("span",{className:"text-xs text-bambu-gray tabular-nums",children:[me,"/",ge]})]}),i.jsx("div",{className:"p-3 space-y-1",children:J.permissions.map(le=>i.jsxs("label",{className:"flex items-center gap-3 px-2 py-1.5 rounded hover:bg-bambu-dark-secondary cursor-pointer",children:[i.jsx("input",{type:"checkbox",checked:u.includes(le.value),onChange:()=>R(le.value),className:"w-4 h-4 rounded border-bambu-gray text-bambu-green focus:ring-bambu-green focus:ring-offset-0 bg-bambu-dark-secondary"}),i.jsx("span",{className:"text-sm text-bambu-gray",children:le.label})]},le.value))})]},J.name)})}),i.jsx("div",{className:"h-16"}),i.jsxs("div",{className:"fixed bottom-0 left-0 right-0 z-20 px-6 py-3 bg-bambu-dark-secondary border-t border-bambu-dark-tertiary flex items-center justify-center gap-3",children:[i.jsx(Fe,{variant:"secondary",onClick:()=>e("/settings?tab=users"),children:r("common.cancel")}),i.jsx(Fe,{onClick:N,disabled:T||!o.trim(),children:T?i.jsxs(i.Fragment,{children:[i.jsx(ct,{className:"w-4 h-4 animate-spin"}),r("common.saving")]}):i.jsxs(i.Fragment,{children:[i.jsx(ps,{className:"w-4 h-4"}),r("common.save")]})})]})]})}const RK={material:"",subtype:"",brand:"",color_name:"",rgba:"808080FF",label_weight:1e3,core_weight:250,core_weight_catalog_id:null,weight_used:0,slicer_filament:"",note:"",cost_per_kg:null};function bet(t,e=!1){const n={};return e?(t.material||(n.material="Material is required"),{isValid:Object.keys(n).length===0,errors:n}):(t.slicer_filament||(n.slicer_filament="Slicer preset is required"),t.material||(n.material="Material is required"),t.brand||(n.brand="Brand is required"),t.subtype||(n.subtype="Subtype is required"),{isValid:Object.keys(n).length===0,errors:n})}const xet=["PLA","PETG","ABS","TPU","ASA","PC","PA","PVA","HIPS","PA-CF","PETG-CF","PLA-CF"],yet=["Bambu","PolyLite","PolyTerra","eSUN","Overture","Fiberon","SUNLU","Inland","Hatchbox","Generic"],Mv=["Basic","Matte","Silk","Tough","HF","High Flow","Engineering","Galaxy","Glow","Marble","Metal","Rainbow","Sparkle","Wood","Translucent","Transparent","Clear","Lite","Pro","Plus","Max","Super","Ultra","Flex","Soft","Hard","Strong","Impact","Heat Resistant","UV Resistant","ESD","Conductive","Magnetic","Gradient","Dual Color","Tri Color","Multicolor"],zse=[{name:"Black",hex:"000000"},{name:"White",hex:"FFFFFF"},{name:"Gray",hex:"808080"},{name:"Red",hex:"FF0000"},{name:"Orange",hex:"FFA500"},{name:"Yellow",hex:"FFFF00"},{name:"Green",hex:"00AE42"},{name:"Blue",hex:"0066FF"},{name:"Purple",hex:"8B00FF"},{name:"Pink",hex:"FF69B4"},{name:"Brown",hex:"8B4513"},{name:"Silver",hex:"C0C0C0"}],vet=[{name:"Dark Red",hex:"8B0000"},{name:"Crimson",hex:"DC143C"},{name:"Coral",hex:"FF7F50"},{name:"Salmon",hex:"FA8072"},{name:"Dark Orange",hex:"FF8C00"},{name:"Peach",hex:"FFDAB9"},{name:"Gold",hex:"FFD700"},{name:"Khaki",hex:"F0E68C"},{name:"Lemon",hex:"FFF44F"},{name:"Lime",hex:"32CD32"},{name:"Forest Green",hex:"228B22"},{name:"Olive",hex:"808000"},{name:"Mint",hex:"98FF98"},{name:"Teal",hex:"008080"},{name:"Navy",hex:"000080"},{name:"Sky Blue",hex:"87CEEB"},{name:"Royal Blue",hex:"4169E1"},{name:"Cyan",hex:"00FFFF"},{name:"Turquoise",hex:"40E0D0"},{name:"Violet",hex:"EE82EE"},{name:"Magenta",hex:"FF00FF"},{name:"Indigo",hex:"4B0082"},{name:"Lavender",hex:"E6E6FA"},{name:"Plum",hex:"DDA0DD"},{name:"Hot Pink",hex:"FF69B4"},{name:"Rose",hex:"FF007F"},{name:"Blush",hex:"FFB6C1"},{name:"Chocolate",hex:"D2691E"},{name:"Tan",hex:"D2B48C"},{name:"Beige",hex:"F5F5DC"},{name:"Maroon",hex:"800000"},{name:"Dark Gray",hex:"404040"},{name:"Light Gray",hex:"D3D3D3"},{name:"Charcoal",hex:"36454F"},{name:"Ivory",hex:"FFFFF0"},{name:"Bambu Green",hex:"00AE42"},{name:"Jade White",hex:"E8E8E8"},{name:"Titan Gray",hex:"5A5A5A"}],FK=[...zse,...vet],Use="bambuddy-recent-colors",wet=8,_et=[{code:"GFL00",name:"Bambu PLA Basic",displayName:"Bambu PLA Basic",isCustom:!1,allCodes:["GFL00"]},{code:"GFL01",name:"Bambu PLA Matte",displayName:"Bambu PLA Matte",isCustom:!1,allCodes:["GFL01"]},{code:"GFL05",name:"Generic PLA",displayName:"Generic PLA",isCustom:!1,allCodes:["GFL05"]},{code:"GFG00",name:"Bambu PETG Basic",displayName:"Bambu PETG Basic",isCustom:!1,allCodes:["GFG00"]},{code:"GFG05",name:"Generic PETG",displayName:"Generic PETG",isCustom:!1,allCodes:["GFG05"]},{code:"GFB00",name:"Bambu ABS Basic",displayName:"Bambu ABS Basic",isCustom:!1,allCodes:["GFB00"]},{code:"GFB05",name:"Generic ABS",displayName:"Generic ABS",isCustom:!1,allCodes:["GFB05"]},{code:"GFA00",name:"Bambu ASA Basic",displayName:"Bambu ASA Basic",isCustom:!1,allCodes:["GFA00"]},{code:"GFU00",name:"Bambu TPU 95A",displayName:"Bambu TPU 95A",isCustom:!1,allCodes:["GFU00"]},{code:"GFU05",name:"Generic TPU",displayName:"Generic TPU",isCustom:!1,allCodes:["GFU05"]},{code:"GFC00",name:"Bambu PC Basic",displayName:"Bambu PC Basic",isCustom:!1,allCodes:["GFC00"]},{code:"GFN00",name:"Bambu PA Basic",displayName:"Bambu PA Basic",isCustom:!1,allCodes:["GFN00"]},{code:"GFN05",name:"Generic PA",displayName:"Generic PA",isCustom:!1,allCodes:["GFN05"]},{code:"GFS00",name:"Bambu PLA-CF",displayName:"Bambu PLA-CF",isCustom:!1,allCodes:["GFS00"]},{code:"GFT00",name:"Bambu PETG-CF",displayName:"Bambu PETG-CF",isCustom:!1,allCodes:["GFT00"]},{code:"GFNC0",name:"Bambu PA-CF",displayName:"Bambu PA-CF",isCustom:!1,allCodes:["GFNC0"]},{code:"GFV00",name:"Bambu PVA",displayName:"Bambu PVA",isCustom:!1,allCodes:["GFV00"]}];function ix(t){let e=t.replace(/@.*$/,"").trim();e=e.replace(/\(Custom\)/i,"").trim(),e=e.replace(/^[#*]+\s*/,"").trim();const n=["PLA-CF","PETG-CF","ABS-GF","ASA-CF","PA-CF","PAHT-CF","PA6-CF","PA6-GF","PPA-CF","PPA-GF","PET-CF","PPS-CF","PC-CF","PC-ABS","ABS-GF","PCTG","PETG","PLA","ABS","ASA","PC","PA","TPU","PVA","HIPS","BVOH","PPS","PEEK","PEI"];let r="",a=-1;for(const c of n){const d=e.toUpperCase().indexOf(c.toUpperCase());if(d!==-1){r=c,a=d;break}}let s="";a>0&&(s=e.substring(0,a).trim(),s=s.replace(/[-_\s]+$/,""));let o="";a!==-1&&r&&(o=e.substring(a+r.length).trim(),o=o.replace(/^[-_\s]+/,""));let l="";for(const c of Mv)if(o.toLowerCase().includes(c.toLowerCase())){l=c;break}if(!l&&s)for(const c of Mv){const d=new RegExp(`\\s+${c}$`,"i");if(d.test(s)){l=c,s=s.replace(d,"").trim();break}}return{brand:s,material:r,variant:l}}function ket(t,e){const n=new Set(yet);for(const r of t){const{brand:a}=ix(r.name);a&&a.length>1&&n.add(a)}if(e)for(const r of e)if(r.filament_vendor&&r.filament_vendor.length>1)n.add(r.filament_vendor);else{const{brand:a}=ix(r.name);a&&a.length>1&&n.add(a)}return Array.from(n).sort((r,a)=>r.localeCompare(a))}function Net(t){const e=t.filter(r=>r.preset_type==="filament");if(e.length===0)return[];const n=new Map;for(const r of e){const a=r.name.replace(/@.*$/,"").trim(),s=n.get(a);if(s)s.allCodes.push(String(r.id));else{const o=r.filament_type||String(r.id);n.set(a,{code:o,name:a,displayName:a,isCustom:!1,allCodes:[o]})}}return Array.from(n.values()).sort((r,a)=>r.displayName.localeCompare(a.displayName))}function Cet(t,e,n){if(t.length>0){const r=[],a=new Map;for(const s of t)if(s.is_custom){const o=s.name.toUpperCase();(e.size===0||Array.from(e).some(c=>o.includes(c))||!o.includes("@"))&&r.push({code:s.setting_id,name:s.name,displayName:`${s.name} (Custom)`,isCustom:!0,allCodes:[s.setting_id]})}else{const o=s.name.replace(/@.*$/,"").trim(),l=a.get(o);l?l.allCodes.push(s.setting_id):a.set(o,{code:s.setting_id,name:o,displayName:o,isCustom:!1,allCodes:[s.setting_id]})}return[...r,...Array.from(a.values())].sort((s,o)=>s.displayName.localeCompare(o.displayName))}if(n&&n.length>0){const r=Net(n);if(r.length>0)return r}return _et}function Tet(t,e){if(!t)return;let n=e.find(r=>r.code===t);if(n||(n=e.find(r=>r.allCodes.includes(t))),!n){const r=t.toLowerCase();n=e.find(a=>a.code.toLowerCase()===r||a.allCodes.some(s=>s.toLowerCase()===r))}return n}function Pet(){try{const t=localStorage.getItem(Use);if(t)return JSON.parse(t)}catch{}return[]}function Aet(t,e){const n=e.filter(a=>a.hex.toUpperCase()!==t.hex.toUpperCase()),r=[t,...n].slice(0,wet);try{localStorage.setItem(Use,JSON.stringify(r))}catch{}return r}function tD(t,e){if(!e.material)return!1;const r=(t.name||"").replace(/^High Flow[_\s]+/i,"").replace(/^Standard[_\s]+/i,"").replace(/^HF[_\s]+/i,"").replace(/^S[_\s]+/i,"").trim(),a=ix(r);return!(!(a.material.toUpperCase()===e.material.toUpperCase())||e.brand&&!(a.brand.toLowerCase().includes(e.brand.toLowerCase())||e.brand.toLowerCase().includes(a.brand.toLowerCase()))||e.subtype&&!(a.variant.toLowerCase().includes(e.subtype.toLowerCase())||e.subtype.toLowerCase().includes(a.variant.toLowerCase())||r.toLowerCase().includes(e.subtype.toLowerCase())))}function Met({formData:t,updateField:e,cloudAuthenticated:n,loadingCloudPresets:r,presetInputValue:a,setPresetInputValue:s,selectedPresetOption:o,filamentOptions:l,availableBrands:c,availableMaterials:d,quickAdd:u,quantity:m,onQuantityChange:p,errors:f}){const{t:y}=Mt(),[x,b]=w.useState(!1),[v,_]=w.useState(!1),[k,P]=w.useState(!1),[C,T]=w.useState(!1),[N,R]=w.useState(""),[A,D]=w.useState(""),[$,U]=w.useState(""),[G,L]=w.useState(String(t.label_weight)),[te,re]=w.useState(!1),J=w.useRef(null),ue=w.useRef(null),me=w.useRef(null),ge=w.useRef(null);w.useEffect(()=>{const q=Z=>{J.current&&!J.current.contains(Z.target)&&b(!1),ge.current&&!ge.current.contains(Z.target)&&T(!1),ue.current&&!ue.current.contains(Z.target)&&_(!1),me.current&&!me.current.contains(Z.target)&&P(!1)};return document.addEventListener("mousedown",q),()=>document.removeEventListener("mousedown",q)},[]);const X=w.useMemo(()=>{if(!a)return l;const q=a.toLowerCase();return l.filter(Z=>Z.displayName.toLowerCase().includes(q)||Z.code.toLowerCase().includes(q))},[l,a]),ie=w.useMemo(()=>{if(!N)return c;const q=N.toLowerCase();return c.filter(j=>j.toLowerCase().includes(q)).sort((j,E)=>{const I=j.toLowerCase()===q,W=E.toLowerCase()===q;return I&&!W?-1:!I&&W?1:j.localeCompare(E)})},[c,N]),le=w.useMemo(()=>{if(!A)return Mv;const q=A.toLowerCase();return Mv.filter(Z=>Z.toLowerCase().includes(q))},[A]),pe=w.useMemo(()=>{if(!$)return d;const q=$.toLowerCase();return d.filter(j=>j.toLowerCase().includes(q)).sort((j,E)=>{const I=j.toLowerCase()===q,W=E.toLowerCase()===q;return I&&!W?-1:!I&&W?1:j.localeCompare(E)})},[$,d]);w.useEffect(()=>{te||L(String(t.label_weight))},[t.label_weight,te]);const Ce=q=>{e("slicer_filament",q.code),s(q.displayName),b(!1);const Z=ix(q.name);Z.material&&e("material",Z.material),Z.brand&&e("brand",Z.brand),Z.variant&&e("subtype",Z.variant)};return i.jsxs("div",{className:"space-y-4",children:[!u&&i.jsx("div",{className:"flex items-center gap-2 text-xs text-bambu-gray",children:r?i.jsxs(i.Fragment,{children:[i.jsx(ct,{className:"w-3 h-3 animate-spin"})," ",y("inventory.loadingPresets")]}):n?i.jsxs(i.Fragment,{children:[i.jsx(lx,{className:"w-3 h-3 text-bambu-green"})," ",y("inventory.cloudConnected")]}):i.jsxs(i.Fragment,{children:[i.jsx(xhe,{className:"w-3 h-3"})," ",y("inventory.cloudNotConnected")]})}),!u&&i.jsxs("div",{children:[i.jsxs("label",{className:"block text-sm font-medium text-bambu-gray mb-1",children:[y("inventory.slicerPreset")," *"]}),i.jsxs("div",{className:"relative",ref:J,children:[i.jsx(Dr,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray/50 pointer-events-none"}),i.jsx("input",{type:"text",className:"w-full pl-9 pr-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm placeholder:text-bambu-gray/50 focus:outline-none focus:border-bambu-green",placeholder:y("inventory.searchPresets"),value:a,onChange:q=>{s(q.target.value),b(!0)},onFocus:()=>{b(!0),s("")}}),x&&i.jsx("div",{className:"absolute z-50 w-full mt-1 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg shadow-lg max-h-64 overflow-y-auto",children:X.length===0?i.jsx("div",{className:"px-3 py-2 text-sm text-bambu-gray",children:y("inventory.noPresetsFound")}):X.map(q=>i.jsx("button",{type:"button",className:`w-full px-3 py-2 text-left text-sm hover:bg-bambu-dark-tertiary truncate ${o?.code===q.code?"bg-bambu-green/10 text-bambu-green":"text-white"}`,onClick:()=>Ce(q),children:q.displayName},q.code))})]}),o&&i.jsxs("div",{className:"mt-1 text-xs text-bambu-gray",children:[y("inventory.selectedPreset"),": ",i.jsx("span",{className:"font-mono text-bambu-green",children:o.code})]}),f?.slicer_filament&&i.jsx("p",{className:"mt-1 text-xs text-red-400",children:f.slicer_filament})]}),i.jsxs("div",{children:[i.jsxs("label",{className:"block text-sm font-medium text-bambu-gray mb-1",children:[y("inventory.material")," *"]}),i.jsxs("div",{className:"relative",ref:ge,children:[i.jsx("input",{type:"text",className:"w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm placeholder:text-bambu-gray/50 focus:outline-none focus:border-bambu-green",placeholder:y("inventory.selectMaterial"),value:C?$:t.material,onChange:q=>{U(q.target.value),T(!0)},onFocus:()=>{T(!0),U("")}}),i.jsx(In,{className:"absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray/50 pointer-events-none"}),C&&i.jsxs("div",{className:"absolute z-50 w-full mt-1 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg shadow-lg max-h-48 overflow-y-auto",children:[pe.length===0?i.jsx("div",{className:"px-3 py-2 text-sm text-bambu-gray",children:y("inventory.noResults")}):pe.map(q=>i.jsx("button",{type:"button",className:`w-full px-3 py-2 text-left text-sm hover:bg-bambu-dark-tertiary ${t.material===q?"bg-bambu-green/10 text-bambu-green":"text-white"}`,onClick:()=>{e("material",q),T(!1),U("")},children:q},q)),$&&!pe.includes($)&&i.jsx("button",{type:"button",className:"w-full px-3 py-2 text-left text-sm hover:bg-bambu-dark-tertiary text-bambu-green border-t border-bambu-dark-tertiary",onClick:()=>{e("material",$),T(!1),U("")},children:y("inventory.useCustomMaterial",{material:$})})]})]}),f?.material&&i.jsx("p",{className:"mt-1 text-xs text-red-400",children:f.material})]}),i.jsxs("div",{children:[i.jsxs("label",{className:"block text-sm font-medium text-bambu-gray mb-1",children:[y("inventory.brand"),!u&&" *"]}),i.jsxs("div",{className:"relative",ref:ue,children:[i.jsx("input",{type:"text",className:"w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm placeholder:text-bambu-gray/50 focus:outline-none focus:border-bambu-green",placeholder:y("inventory.searchBrand"),value:v?N:t.brand,onChange:q=>{R(q.target.value),_(!0)},onFocus:()=>{_(!0),R("")}}),i.jsx(In,{className:"absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray/50 pointer-events-none"}),v&&i.jsxs("div",{className:"absolute z-50 w-full mt-1 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg shadow-lg max-h-48 overflow-y-auto",children:[ie.length===0?i.jsx("div",{className:"px-3 py-2 text-sm text-bambu-gray",children:y("inventory.noResults")}):ie.map(q=>i.jsx("button",{type:"button",className:`w-full px-3 py-2 text-left text-sm hover:bg-bambu-dark-tertiary ${t.brand===q?"bg-bambu-green/10 text-bambu-green":"text-white"}`,onClick:()=>{e("brand",q),_(!1),R("")},children:q},q)),N&&!ie.includes(N)&&i.jsx("button",{type:"button",className:"w-full px-3 py-2 text-left text-sm hover:bg-bambu-dark-tertiary text-bambu-green border-t border-bambu-dark-tertiary",onClick:()=>{e("brand",N),_(!1),R("")},children:y("inventory.useCustomBrand",{brand:N})})]})]}),f?.brand&&i.jsx("p",{className:"mt-1 text-xs text-red-400",children:f.brand})]}),i.jsxs("div",{children:[i.jsxs("label",{className:"block text-sm font-medium text-bambu-gray mb-1",children:[y("inventory.subtype"),!u&&" *"]}),i.jsxs("div",{className:"relative",ref:me,children:[i.jsx("input",{type:"text",value:k?A:t.subtype,onChange:q=>{D(q.target.value),P(!0)},onFocus:()=>{P(!0),D("")},placeholder:"Basic, Matte, Silk...",className:"w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm placeholder:text-bambu-gray/50 focus:outline-none focus:border-bambu-green"}),i.jsx(In,{className:"absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray/50 pointer-events-none"}),k&&i.jsxs("div",{className:"absolute z-50 w-full mt-1 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg shadow-lg max-h-48 overflow-y-auto",children:[le.length===0?i.jsx("div",{className:"px-3 py-2 text-sm text-bambu-gray",children:y("inventory.noResults")}):le.map(q=>i.jsx("button",{type:"button",className:`w-full px-3 py-2 text-left text-sm hover:bg-bambu-dark-tertiary ${t.subtype===q?"bg-bambu-green/10 text-bambu-green":"text-white"}`,onClick:()=>{e("subtype",q),P(!1),D("")},children:q},q)),A&&!Mv.some(q=>q.toLowerCase()===A.toLowerCase().trim())&&i.jsx("button",{type:"button",className:"w-full px-3 py-2 text-left text-sm hover:bg-bambu-dark-tertiary text-bambu-green border-t border-bambu-dark-tertiary",onClick:()=>{e("subtype",A),P(!1),D("")},children:y("inventory.useCustomBrand",{brand:A})})]})]}),f?.subtype&&i.jsx("p",{className:"mt-1 text-xs text-red-400",children:f.subtype})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-bambu-gray mb-1",children:y("inventory.labelWeight")}),i.jsxs("div",{className:"relative",children:[i.jsx("input",{type:"number",className:"w-full px-3 py-2 pr-7 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm focus:outline-none focus:border-bambu-green",value:G,min:0,onFocus:()=>re(!0),onChange:q=>L(q.target.value),onBlur:()=>{re(!1);const q=G.trim(),Z=Number(q);if(!q||!Number.isFinite(Z)||Z<0){L(String(t.label_weight));return}const j=Math.round(Z);e("label_weight",j),L(String(j))}}),i.jsx("span",{className:"absolute right-2 top-1/2 -translate-y-1/2 text-xs text-bambu-gray",children:"g"})]})]}),u&&i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-bambu-gray mb-1",children:y("inventory.quantity")}),i.jsx("input",{type:"number",className:"w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm focus:outline-none focus:border-bambu-green",value:m,min:1,max:100,onChange:q=>{const Z=Math.max(1,Math.min(100,parseInt(q.target.value)||1));p(Z)}})]})]})}function Eet({formData:t,updateField:e,recentColors:n,onColorUsed:r,catalogColors:a}){const{t:s}=Mt(),[o,l]=w.useState(!1),[c,d]=w.useState(""),u=t.rgba.replace("#","").substring(0,6),m=v=>u.toUpperCase()===v.toUpperCase(),p=(v,_)=>{e("rgba",v.toUpperCase()+"FF"),e("color_name",_),r({name:_,hex:v})},f=w.useMemo(()=>{if(a.length===0)return[];const v=t.brand?.trim(),_=t.material?.toLowerCase().trim(),k=t.subtype?.toLowerCase().trim();if(!v&&!_)return[];const P=v?v.toLowerCase().split(/[\s\-_]+/).filter(N=>N.length>=2):[],C=N=>{if(P.length===0)return!0;const R=N.toLowerCase();return P.some(A=>R.includes(A))};if(v&&!_){const N=a.filter(R=>C(R.manufacturer));if(N.length>0)return N.map(R=>({name:R.color_name,hex:R.hex_color.replace("#","").substring(0,6),manufacturer:R.manufacturer,material:typeof R.material=="string"?R.material:void 0}))}const T=_&&k?`${_} ${k}`:"";if(T){const N=a.filter(A=>C(A.manufacturer)&&A.material?.toLowerCase()===T);if(N.length>0)return N.map(A=>({name:A.color_name,hex:A.hex_color.replace("#","").substring(0,6),manufacturer:A.manufacturer,material:typeof A.material=="string"?A.material:void 0}));const R=T.replace(/\+$/,"");if(R!==T){const A=a.filter(D=>C(D.manufacturer)&&D.material?.toLowerCase()===R);if(A.length>0)return A.map(D=>({name:D.color_name,hex:D.hex_color.replace("#","").substring(0,6),manufacturer:D.manufacturer,material:typeof D.material=="string"?D.material:void 0}))}}if(_){const N=a.filter(R=>C(R.manufacturer)&&(!R.material||R.material.toLowerCase().startsWith(_)));if(N.length>0)return N.map(R=>({name:R.color_name,hex:R.hex_color.replace("#","").substring(0,6),manufacturer:R.manufacturer,material:typeof R.material=="string"?R.material:void 0}))}return[]},[a,t.brand,t.material,t.subtype]),y=w.useMemo(()=>{if(!c)return f;if(f.length===0)return[];const v=c.toLowerCase();return f.filter(k=>k.name.toLowerCase().includes(v)||(k.manufacturer?.toLowerCase().includes(v)??!1)||(k.material?.toLowerCase().includes(v)??!1))},[c,f]),x=f.length>0,b=w.useMemo(()=>c?FK.filter(v=>v.name.toLowerCase().includes(c.toLowerCase())):o?FK:zse,[c,o]);return i.jsxs("div",{className:"space-y-3",children:[i.jsx("div",{className:"h-10 rounded-lg border border-bambu-dark-tertiary",style:{backgroundColor:`#${u}`}}),n.length>0&&i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-bambu-gray shrink-0",children:[i.jsx(er,{className:"w-3 h-3"}),i.jsx("span",{children:s("inventory.recentColors")})]}),i.jsx("div",{className:"flex flex-wrap gap-1.5",children:n.map(v=>i.jsx("button",{type:"button",onClick:()=>p(v.hex,v.name),className:`w-6 h-6 rounded border-2 transition-all hover:scale-110 ${m(v.hex)?"border-bambu-green ring-1 ring-bambu-green/30 scale-110":"border-bambu-dark-tertiary"}`,style:{backgroundColor:`#${v.hex}`},title:v.name},v.hex))})]}),i.jsxs("div",{className:"relative",children:[i.jsx(Dr,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray/50 pointer-events-none"}),i.jsx("input",{type:"text",className:"w-full pl-9 pr-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm placeholder:text-bambu-gray/50 focus:outline-none focus:border-bambu-green",placeholder:s("inventory.searchColors"),value:c,onChange:v=>d(v.target.value)})]}),x?i.jsxs("div",{className:"space-y-1.5",children:[i.jsx("span",{className:"text-xs text-bambu-gray",children:c?s("inventory.searchResults"):`${t.brand}${t.material?` ${t.material}`:""}`}),i.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[y.map(v=>i.jsx("button",{type:"button",onClick:()=>p(v.hex,v.name),className:`w-6 h-6 rounded border-2 transition-all hover:scale-110 hover:z-20 relative group ${m(v.hex)?"border-bambu-green ring-1 ring-bambu-green/30 scale-110":"border-bambu-dark-tertiary"}`,style:{backgroundColor:`#${v.hex}`},title:v.manufacturer&&v.material?`${v.name} (${v.manufacturer} — ${v.material})`:v.manufacturer?`${v.name} (${v.manufacturer})`:v.name,children:i.jsx("span",{className:"absolute -bottom-7 left-1/2 -translate-x-1/2 px-2 py-0.5 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded text-xs whitespace-nowrap opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none z-20 shadow-lg text-white",children:v.manufacturer&&v.material?`${v.name} (${v.manufacturer} — ${v.material})`:v.manufacturer?`${v.name} (${v.manufacturer})`:v.name})},`${v.hex}-${v.name}-${v.manufacturer??""}`)),y.length===0&&i.jsx("p",{className:"text-sm text-bambu-gray py-1",children:s("inventory.noColorsFound")})]})]}):i.jsxs("div",{className:"space-y-1.5",children:[i.jsxs("div",{className:"flex items-center justify-between text-xs text-bambu-gray",children:[i.jsx("span",{children:s(c?"inventory.searchResults":o?"inventory.allColors":"inventory.commonColors")}),!c&&i.jsx("button",{type:"button",onClick:()=>l(!o),className:"flex items-center gap-1 hover:text-white transition-colors",children:o?i.jsxs(i.Fragment,{children:[s("inventory.showLess")," ",i.jsx(vl,{className:"w-3 h-3"})]}):i.jsxs(i.Fragment,{children:[s("inventory.showAll")," ",i.jsx(In,{className:"w-3 h-3"})]})})]}),i.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[b.map(v=>i.jsx("button",{type:"button",onClick:()=>p(v.hex,v.name),className:`w-6 h-6 rounded border-2 transition-all hover:scale-110 hover:z-20 relative group ${m(v.hex)?"border-bambu-green ring-1 ring-bambu-green/30 scale-110":"border-bambu-dark-tertiary"}`,style:{backgroundColor:`#${v.hex}`},title:v.name,children:i.jsx("span",{className:"absolute -bottom-7 left-1/2 -translate-x-1/2 px-2 py-0.5 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded text-xs whitespace-nowrap opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none z-20 shadow-lg text-white",children:v.name})},v.hex)),b.length===0&&i.jsx("p",{className:"text-sm text-bambu-gray py-1",children:s("inventory.noColorsFound")})]})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-bambu-gray mb-1",children:s("inventory.colorName")}),i.jsx("input",{type:"text",className:"w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm placeholder:text-bambu-gray/50 focus:outline-none focus:border-bambu-green",placeholder:s("inventory.colorNamePlaceholder"),value:t.color_name,onChange:v=>e("color_name",v.target.value)})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-bambu-gray mb-1",children:s("inventory.hexColor")}),i.jsxs("div",{className:"flex gap-2",children:[i.jsxs("div",{className:"relative flex-1",children:[i.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-bambu-gray",children:"#"}),i.jsx("input",{type:"text",className:"w-full pl-7 pr-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm font-mono uppercase focus:outline-none focus:border-bambu-green",placeholder:"RRGGBB",value:u.toUpperCase(),onChange:v=>{const _=v.target.value.replace("#","").replace(/[^0-9A-Fa-f]/g,"");_.length<=8&&e("rgba",_.toUpperCase()+(_.length<=6?"FF":""))}})]}),i.jsx("input",{type:"color",className:"w-11 h-[38px] rounded-lg cursor-pointer border border-bambu-dark-tertiary shrink-0 bg-transparent",value:`#${u}`,onChange:v=>{const _=v.target.value.replace("#","").toUpperCase();e("rgba",_+"FF")},title:s("inventory.pickColor")})]})]})]})]})}function jet({catalog:t,value:e,onChange:n,catalogId:r,onCatalogIdChange:a}){const{t:s}=Mt(),[o,l]=w.useState(!1),[c,d]=w.useState(""),u=w.useRef(null),m=w.useRef(null);w.useEffect(()=>{const x=b=>{u.current&&!u.current.contains(b.target)&&l(!1)};return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[]),w.useEffect(()=>{if(t.length===0)return;const x=t.filter(b=>b.weight===e);if(r){const b=t.find(v=>v.id===r);if(b&&b.weight===e)return}x.length===1?a(x[0].id):x.length===0&&r!==null&&a(null)},[e,t,r,a]);const p=w.useMemo(()=>{if(!c)return t;const x=c.toLowerCase();return t.filter(b=>b.name.toLowerCase().includes(x)||b.weight.toString().includes(x))},[t,c]),f=w.useMemo(()=>t.filter(x=>x.weight===e),[t,e]),y=w.useMemo(()=>{if(o)return c;if(r){const x=t.find(b=>b.id===r);if(x)return x.name}return f.length>0?f[0].name:""},[o,c,r,t,f]);return i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-bambu-gray mb-1",children:i.jsxs("span",{className:"flex items-center gap-2",children:[i.jsx(Hfe,{className:"w-3.5 h-3.5 text-bambu-gray"}),s("inventory.coreWeight")]})}),i.jsxs("div",{className:"flex gap-2 items-center",children:[i.jsxs("div",{className:"flex-1 min-w-0 relative",ref:u,children:[i.jsx("input",{ref:m,type:"text",className:"w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm placeholder:text-bambu-gray/50 focus:outline-none focus:border-bambu-green",placeholder:s("inventory.searchSpoolWeight"),value:y,onFocus:()=>{l(!0),d("")},onChange:x=>{d(x.target.value),l(!0)}}),o&&i.jsx("div",{className:"absolute z-50 w-full mt-1 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg shadow-lg max-h-64 overflow-y-auto",children:p.length===0?i.jsx("div",{className:"px-3 py-2 text-sm text-bambu-gray",children:s("inventory.noResults")}):p.map(x=>i.jsxs("button",{type:"button",className:`w-full px-3 py-2 text-left text-sm hover:bg-bambu-dark-tertiary flex justify-between items-center ${(r?x.id===r:x.weight===e)?"bg-bambu-green/10 text-bambu-green":"text-white"}`,onClick:()=>{a(x.id),n(x.weight),l(!1),d("")},children:[i.jsx("span",{className:"truncate",children:x.name}),i.jsxs("span",{className:"font-mono text-xs text-bambu-gray ml-2 shrink-0",children:[x.weight,"g"]})]},x.id))})]}),i.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[i.jsx("input",{type:"number",className:"w-16 px-2 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm text-center font-mono focus:outline-none focus:border-bambu-green",value:e,min:0,max:2e3,onChange:x=>{const b=parseInt(x.target.value);!isNaN(b)&&b>=0&&n(b)}}),i.jsx("span",{className:"text-bambu-gray text-sm",children:"g"})]})]})]})}function Det({formData:t,updateField:e,spoolCatalog:n,currencySymbol:r}){const{t:a}=Mt(),{showToast:s}=bn(),[o,l]=w.useState(""),[c,d]=w.useState(!1),[u,m]=w.useState(""),[p,f]=w.useState(!1),y=Math.max(0,t.label_weight-t.weight_used),x=t.core_weight+y;return w.useEffect(()=>{c||l(String(x))},[c,x]),w.useEffect(()=>{p||m(String(y))},[p,y]),i.jsxs("div",{className:"space-y-4",children:[i.jsx(jet,{catalog:n,value:t.core_weight,onChange:b=>e("core_weight",b),catalogId:t.core_weight_catalog_id,onCatalogIdChange:b=>e("core_weight_catalog_id",b)}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-bambu-gray mb-1",children:a("inventory.currentWeight")}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs("div",{className:"relative flex-1",children:[i.jsx("input",{type:"number",value:u,min:0,max:t.label_weight,onFocus:()=>f(!0),onChange:b=>{m(b.target.value)},onBlur:()=>{f(!1);const b=u.trim(),v=Number(b);if(!b||!Number.isFinite(v)||v<0||v>t.label_weight){m(String(y));return}const _=Math.round(v);e("weight_used",Math.max(0,t.label_weight-_)),m(String(_))},className:"w-full px-3 py-2 pr-7 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm focus:outline-none focus:border-bambu-green"}),i.jsx("span",{className:"absolute right-2 top-1/2 -translate-y-1/2 text-xs text-bambu-gray",children:"g"})]}),i.jsxs("span",{className:"text-xs text-bambu-gray shrink-0",children:["/ ",t.label_weight,"g"]})]})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-bambu-gray mb-1",children:a("inventory.measuredWeight")}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs("div",{className:"relative flex-1",children:[i.jsx("input",{type:"number",value:o,min:0,onFocus:()=>d(!0),onChange:b=>{l(b.target.value)},onBlur:()=>{d(!1);const b=o.trim(),v=Number(b),_=t.core_weight,k=t.core_weight+t.label_weight;if(!b||!Number.isFinite(v)||v<_||v>k){s(a("inventory.measuredWeightError",{min:_,max:k}),"error"),l(String(x));return}const P=Math.round(v),C=Math.max(0,Math.min(t.label_weight,P-t.core_weight));e("weight_used",Math.max(0,t.label_weight-C)),l(String(P))},className:"w-full px-3 py-2 pr-7 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm focus:outline-none focus:border-bambu-green"}),i.jsx("span",{className:"absolute right-2 top-1/2 -translate-y-1/2 text-xs text-bambu-gray",children:"g"})]}),i.jsxs("span",{className:"text-xs text-bambu-gray shrink-0",children:["/ ",t.core_weight+t.label_weight,"g"]})]})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-bambu-gray mb-1",children:a("inventory.costPerKg","Cost per kg")}),i.jsx("div",{className:"flex items-center gap-2",children:i.jsxs("div",{className:"relative flex-1",children:[i.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-bambu-gray text-sm pointer-events-none",children:r}),i.jsx("input",{type:"number",value:t.cost_per_kg??"",min:0,step:.01,placeholder:"0.00",onChange:b=>{const v=b.target.value===""?null:parseFloat(b.target.value);e("cost_per_kg",v)},style:{paddingLeft:`${Math.max(2,r.length*.6+1)}rem`},className:"w-full py-2 pr-3 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm focus:outline-none focus:border-bambu-green"})]})})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-sm font-medium text-bambu-gray mb-1",children:a("inventory.note")}),i.jsx("textarea",{className:"w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm placeholder:text-bambu-gray/50 focus:outline-none focus:border-bambu-green resize-none min-h-[80px]",placeholder:a("inventory.notePlaceholder"),value:t.note,onChange:b=>e("note",b.target.value)})]})]})}function Ret({formData:t,printersWithCalibrations:e,selectedProfiles:n,setSelectedProfiles:r,expandedPrinters:a,setExpandedPrinters:s}){const{t:o}=Mt(),l=p=>{s(f=>{const y=new Set(f);return y.has(p)?y.delete(p):y.add(p),y})},c=(p,f,y)=>{const x=`${p}:${f}:${y??"null"}`,b=`${p}:${y??"null"}`;r(v=>{const _=new Set(v);if(_.has(x))_.delete(x);else{for(const k of Array.from(_)){const P=k.split(":");`${P[0]}:${P[2]}`===b&&_.delete(k)}_.add(x)}return _})},d=()=>{const p=new Set;for(const{printer:f,calibrations:y}of e){if(!f.connected)continue;const x=y.filter(v=>tD(v,t)),b=new Map;for(const v of x){const _=`${v.extruder_id??"null"}`;b.has(_)||b.set(_,[]),b.get(_).push(v)}for(const[v,_]of b)if(_.length>0){const P=[..._].sort((C,T)=>T.k_value-C.k_value)[0];p.add(`${f.id}:${P.cali_idx}:${v}`)}}r(p)};if(!t.material)return i.jsx("div",{className:"p-6 bg-bambu-dark rounded-lg text-center",children:i.jsx("p",{className:"text-bambu-gray",children:o("inventory.selectMaterialFirst")})});if(e.length===0)return i.jsx("div",{className:"p-6 bg-bambu-dark rounded-lg text-center",children:i.jsx("p",{className:"text-bambu-gray",children:o("inventory.noPrintersConfigured")})});const u=e.reduce((p,{printer:f,calibrations:y})=>f.connected?p+y.filter(x=>tD(x,t)).length:p,0),m=(p,f)=>{const y=`${p.id}:${f.cali_idx}:${f.extruder_id??"null"}`,x=n.has(y);return i.jsxs("label",{className:`flex items-center gap-3 p-3 rounded-lg cursor-pointer transition-all border ${x?"bg-bambu-green/10 border-bambu-green/30":"bg-bambu-dark border-transparent hover:bg-bambu-dark/80"}`,children:[i.jsx("input",{type:"checkbox",checked:x,onChange:()=>c(String(p.id),f.cali_idx,f.extruder_id),className:"w-4 h-4 rounded border-bambu-dark-tertiary text-bambu-green focus:ring-bambu-green"}),i.jsx("div",{className:"flex-1 min-w-0",children:i.jsx("span",{className:`text-sm font-medium ${x?"text-bambu-green":"text-white"}`,children:f.name||f.filament_id})}),i.jsx("div",{className:"flex items-center gap-2 shrink-0",children:i.jsxs("span",{className:"text-xs font-mono px-2 py-0.5 rounded bg-bambu-dark text-bambu-gray",children:["K=",f.k_value.toFixed(3)]})})]},`${f.cali_idx}-${f.extruder_id}`)};return i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("p",{className:"text-xs text-bambu-gray",children:[o("inventory.matchingFilter"),": ",t.brand||o("inventory.anyBrand")," / ",t.material," / ",t.subtype||o("inventory.anyVariant")]}),u>0&&i.jsxs("button",{type:"button",onClick:d,className:"flex items-center gap-1.5 px-2 py-1 text-xs bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-bambu-gray hover:text-white hover:border-bambu-green transition-colors",children:[i.jsx(jb,{className:"w-3.5 h-3.5"}),o("inventory.autoSelect")," (",u,")"]})]}),i.jsx("div",{className:"space-y-3",children:e.map(({printer:p,calibrations:f})=>{const y=a.has(String(p.id)),x=f.filter(P=>tD(P,t)),b=x.length,v=x.some(P=>P.extruder_id!==void 0&&P.extruder_id!==null&&P.extruder_id>0),_=x.filter(P=>P.extruder_id===1),k=x.filter(P=>P.extruder_id===0||P.extruder_id===void 0||P.extruder_id===null);return i.jsxs("div",{className:"border border-bambu-dark-tertiary rounded-lg overflow-hidden",children:[i.jsxs("button",{type:"button",onClick:()=>l(String(p.id)),className:"w-full px-4 py-3 flex items-center justify-between bg-bambu-dark-secondary hover:bg-bambu-dark-tertiary transition-colors",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[y?i.jsx(In,{className:"w-4 h-4 text-bambu-gray"}):i.jsx(pa,{className:"w-4 h-4 text-bambu-gray"}),i.jsx("span",{className:"font-medium text-white",children:p.name}),b>0?i.jsxs("span",{className:"text-xs px-2 py-0.5 rounded-full bg-bambu-green/20 text-bambu-green",children:[b," ",o(b!==1?"inventory.matches":"inventory.match")]}):i.jsx("span",{className:"text-xs px-2 py-0.5 rounded-full bg-bambu-dark-tertiary text-bambu-gray",children:o("inventory.noMatches")})]}),i.jsx("span",{className:`text-xs px-2 py-1 rounded-full ${p.connected?"bg-green-500/20 text-green-500":"bg-bambu-gray/20 text-bambu-gray"}`,children:p.connected?o("inventory.connected"):o("inventory.offline")})]}),y&&i.jsx("div",{className:"px-4 py-3 space-y-3 bg-bambu-dark border-t border-bambu-dark-tertiary",children:p.connected?b===0?i.jsx("p",{className:"text-sm text-bambu-gray italic py-2",children:o("inventory.noKProfilesMatch")}):v?i.jsxs(i.Fragment,{children:[_.length>0&&i.jsxs("div",{className:"space-y-2",children:[i.jsx("p",{className:"text-xs font-medium text-bambu-gray uppercase tracking-wide",children:o("inventory.leftNozzle")}),i.jsx("div",{className:"space-y-2",children:_.map(P=>m(p,P))})]}),k.length>0&&i.jsxs("div",{className:"space-y-2",children:[i.jsx("p",{className:"text-xs font-medium text-bambu-gray uppercase tracking-wide",children:o("inventory.rightNozzle")}),i.jsx("div",{className:"space-y-2",children:k.map(P=>m(p,P))})]})]}):i.jsx("div",{className:"space-y-2",children:x.map(P=>m(p,P))}):i.jsx("p",{className:"text-sm text-bambu-gray italic py-2",children:o("inventory.printerOffline")})})]},p.id)})}),n.size>0&&i.jsx("div",{className:"p-3 bg-bambu-green/10 border border-bambu-green/30 rounded-lg",children:i.jsxs("p",{className:"text-sm text-white",children:[i.jsx("span",{className:"font-semibold",children:n.size})," ",o("inventory.profilesSelected")]})})]})}function Fet(t){const e=new Date(t);return e.toLocaleDateString("en-GB",{day:"2-digit",month:"2-digit",year:"2-digit"})+" "+e.toLocaleTimeString("en-GB",{hour:"2-digit",minute:"2-digit"})}const Let={completed:"text-bambu-green",failed:"text-red-400",aborted:"text-yellow-400"};function Oet({spoolId:t}){const{t:e}=Mt(),n=tn(),{showToast:r}=bn(),{data:a,isLoading:s}=Je({queryKey:["spool-usage",t],queryFn:()=>be.getSpoolUsageHistory(t)}),o=ut({mutationFn:()=>be.clearSpoolUsageHistory(t),onSuccess:()=>{n.invalidateQueries({queryKey:["spool-usage",t]}),r(e("inventory.historyCleared"),"success")}});return s?i.jsx("div",{className:"flex justify-center py-4",children:i.jsx(ct,{className:"w-5 h-5 animate-spin text-bambu-green"})}):!a||a.length===0?i.jsxs("div",{className:"text-center py-4 text-bambu-gray text-sm",children:[i.jsx(er,{className:"w-5 h-5 mx-auto mb-2 opacity-50"}),e("inventory.noUsageHistory")]}):i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("h4",{className:"text-sm font-medium text-white",children:e("inventory.usageHistory")}),i.jsxs(Fe,{variant:"ghost",size:"sm",onClick:()=>o.mutate(),disabled:o.isPending,className:"text-xs text-bambu-gray hover:text-red-400",children:[i.jsx(Qt,{className:"w-3 h-3 mr-1"}),e("inventory.clearHistory")]})]}),i.jsx("div",{className:"max-h-48 overflow-y-auto space-y-1",children:a.map(l=>i.jsxs("div",{className:"flex items-center justify-between p-2 rounded bg-bambu-dark/50 text-xs",children:[i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsx("span",{className:"text-bambu-gray",children:Fet(l.created_at)}),l.print_name&&i.jsx("span",{className:"text-white ml-2 truncate",title:l.print_name,children:l.print_name})]}),i.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0 ml-2",children:[i.jsxs("span",{className:"text-white font-medium",children:[l.weight_used.toFixed(1),"g"]}),i.jsxs("span",{className:"text-bambu-gray",children:["(",l.percent_used,"%)"]}),i.jsx("span",{className:Let[l.status]||"text-bambu-gray",children:l.status})]})]},l.id))})]})}function Iet({isOpen:t,onClose:e,spool:n,printersWithCalibrations:r=[],currencySymbol:a}){const{t:s}=Mt(),o=tn(),{showToast:l}=bn(),c=!!n,[d,u]=w.useState(RK),[m,p]=w.useState({}),[f,y]=w.useState("filament"),[x,b]=w.useState(!1),[v,_]=w.useState(!1),[k,P]=w.useState(1),[C,T]=w.useState(!1),[N,R]=w.useState(!1),[A,D]=w.useState([]),[$,U]=w.useState(""),[G,L]=w.useState([]),[te,re]=w.useState([]),[J,ue]=w.useState([]),[me,ge]=w.useState([]),[X,ie]=w.useState([]),[le,pe]=w.useState(new Set),[Ce,q]=w.useState(new Set),Z=r.length>0?r:X,j=w.useMemo(()=>le.size,[le]);w.useEffect(()=>{ge(Pet())},[]),w.useEffect(()=>{t&&((async()=>{R(!0);try{const de=await be.getCloudStatus();if(T(de.is_authenticated),de.is_authenticated){const Ae=await be.getFilamentPresets();D(Ae)}}catch(de){console.error("Failed to fetch cloud presets:",de),T(!1)}finally{R(!1)}})(),be.getSpoolCatalog().then(L).catch(console.error),be.getColorCatalog().then(ue).catch(console.error),be.getLocalPresets().then(de=>re(de.filament)).catch(console.error),r.length===0&&(async()=>{try{const de=await be.getPrinters(),Ae=await Promise.all(de.map(ze=>be.getPrinterStatus(ze.id).catch(()=>null))),_e=[];for(let ze=0;ze<de.length;ze++){const Be=de[ze],Ne=Ae[ze]?.connected??!1;let Ee=[];if(Ne)try{Ee=(await be.getKProfiles(Be.id)).profiles.map(Me=>({cali_idx:Me.slot_id,filament_id:Me.filament_id,setting_id:Me.setting_id||"",name:Me.name,k_value:parseFloat(Me.k_value)||0,n_coef:parseFloat(Me.n_coef)||0,extruder_id:Me.extruder_id,nozzle_diameter:Me.nozzle_diameter}))}catch{}_e.push({printer:{...Be,connected:Ne},calibrations:Ee})}ie(_e)}catch(de){console.error("Failed to fetch printer calibrations:",de)}})())},[t,r.length]);const E=w.useMemo(()=>Cet(A,new Set,te),[A,te]),I=w.useMemo(()=>{const he=ket(A,te),de=J.map(_e=>_e.manufacturer?.trim()).filter(_e=>!!_e),Ae=new Set([...he,...de]);return Array.from(Ae).sort((_e,ze)=>_e.localeCompare(ze))},[A,te,J]),W=w.useMemo(()=>{const he=J.map(Ae=>Ae.material?.trim()).filter(Ae=>!!Ae),de=new Set([...xet,...he]);return Array.from(de).sort((Ae,_e)=>Ae.localeCompare(_e))},[J]),B=w.useMemo(()=>{const he=[];for(const de of J){const Ae=de.manufacturer?.trim(),_e=de.material?.trim();Ae&&_e&&he.push({brand:Ae,material:_e})}for(const de of A){const Ae=ix(de.name);Ae.brand&&Ae.material&&he.push({brand:Ae.brand,material:Ae.material})}for(const de of te){const Ae=ix(de.name),_e=de.filament_vendor?.trim()||Ae.brand,ze=Ae.material;_e&&ze&&he.push({brand:_e,material:ze})}return he},[A,J,te]),ae=w.useMemo(()=>{const he=new Map;for(const de of B){const Ae=de.brand.toLowerCase(),_e=de.material.toLowerCase();he.has(Ae)||he.set(Ae,new Set),he.get(Ae).add(_e)}return he},[B]),z=w.useMemo(()=>{const he=new Map;for(const de of B){const Ae=de.brand.toLowerCase(),_e=de.material.toLowerCase();he.has(_e)||he.set(_e,new Set),he.get(_e).add(Ae)}return he},[B]),V=w.useMemo(()=>{if(!d.material)return I;const he=d.material.toLowerCase(),de=z.get(he);return!de||de.size===0?I:I.filter(Ae=>de.has(Ae.toLowerCase()))},[I,d.material,z]),ee=w.useMemo(()=>{if(!d.brand)return W;const he=d.brand.toLowerCase(),de=ae.get(he);return!de||de.size===0?W:W.filter(Ae=>de.has(Ae.toLowerCase()))},[W,d.brand,ae]),K=w.useMemo(()=>Tet(d.slicer_filament,E),[d.slicer_filament,E]);w.useEffect(()=>{if(t){if(n)if(u({material:n.material||"",subtype:n.subtype||"",brand:n.brand||"",color_name:n.color_name||"",rgba:n.rgba||"808080FF",label_weight:n.label_weight||1e3,core_weight:n.core_weight||250,core_weight_catalog_id:n.core_weight_catalog_id??null,weight_used:n.weight_used||0,slicer_filament:n.slicer_filament||"",note:n.note||"",cost_per_kg:n.cost_per_kg??null}),U(n.slicer_filament_name||n.slicer_filament||""),n.k_profiles&&n.k_profiles.length>0){const he=new Set;for(const de of n.k_profiles)de.cali_idx!==null&&de.cali_idx!==void 0&&he.add(`${de.printer_id}:${de.cali_idx}:${de.extruder??"null"}`);pe(he)}else pe(new Set);else u(RK),U(""),pe(new Set),_(!1),P(1);p({}),y("filament"),b(!1)}},[t,n]),w.useEffect(()=>{t&&Z.length>0&&q(new Set(Z.map(he=>String(he.printer.id))))},[t,Z]);const ne=(he,de)=>{u(Ae=>({...Ae,[he]:de})),he==="weight_used"&&b(!0),m[he]&&p(Ae=>({...Ae,[he]:void 0}))},se=he=>{ge(de=>Aet(he,de))},ce=ut({mutationFn:he=>be.createSpool(he),onSuccess:async he=>{le.size>0&&he?.id&&await F(he.id),await o.invalidateQueries({queryKey:["inventory-spools"]}),l(s("inventory.spoolCreated"),"success"),e()},onError:he=>{l(he.message,"error")}}),fe=ut({mutationFn:({data:he,qty:de})=>be.bulkCreateSpools(he,de),onSuccess:async he=>{if(le.size>0)for(const de of he)await F(de.id);await o.invalidateQueries({queryKey:["inventory-spools"]}),l(s("inventory.spoolsCreated",{count:he.length}),"success"),e()},onError:he=>{l(he.message,"error")}}),oe=ut({mutationFn:he=>be.updateSpool(n.id,he),onSuccess:async()=>{n?.id&&await F(n.id),await o.invalidateQueries({queryKey:["inventory-spools"]}),l(s("inventory.spoolUpdated"),"success"),e()},onError:he=>{l(he.message,"error")}}),O=ut({mutationFn:()=>be.updateSpool(n.id,{tag_uid:null}),onSuccess:async()=>{await o.invalidateQueries({queryKey:["inventory-spools"]}),l(s("inventory.tagDeleted","Tag removed"),"success"),e()},onError:he=>{l(he.message,"error")}}),F=async he=>{if(le.size===0){try{await be.saveSpoolKProfiles(he,[])}catch{}return}const de=[];for(const Ae of le){const[_e,ze,Be]=Ae.split(":"),Ue=parseInt(_e),Ne=parseInt(ze),Ee=Be==="null"?0:parseInt(Be),ke=Z.find(Me=>Me.printer.id===Ue);if(ke){const Me=ke.calibrations.find(Ge=>Ge.cali_idx===Ne);Me&&de.push({printer_id:Ue,extruder:Ee,nozzle_diameter:Me.nozzle_diameter||"0.4",k_value:Me.k_value,name:Me.name||null,cali_idx:Me.cali_idx,setting_id:Me.setting_id||null})}}if(de.length>0)try{await be.saveSpoolKProfiles(he,de)}catch(Ae){console.error("Failed to save K-profiles:",Ae)}};if(w.useEffect(()=>{if(!t)return;const he=de=>{de.key==="Escape"&&e()};return document.addEventListener("keydown",he),()=>document.removeEventListener("keydown",he)},[t,e]),!t)return null;const Q=()=>{const he=bet(d,v);if(!he.isValid){p(he.errors),(he.errors.slicer_filament||he.errors.material||he.errors.brand||he.errors.subtype)&&y("filament");return}const de=K?.displayName||$||null,Ae={material:d.material,subtype:d.subtype||null,brand:d.brand||null,color_name:d.color_name||null,rgba:d.rgba||null,label_weight:d.label_weight,core_weight:d.core_weight,core_weight_catalog_id:d.core_weight_catalog_id,slicer_filament:d.slicer_filament||null,slicer_filament_name:de,nozzle_temp_min:null,nozzle_temp_max:null,note:d.note||null,cost_per_kg:d.cost_per_kg};(!c||x)&&(Ae.weight_used=d.weight_used),c?oe.mutate(Ae):k>1?fe.mutate({data:Ae,qty:k}):ce.mutate(Ae)},ve=ce.isPending||fe.isPending||oe.isPending||O.isPending;return i.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[i.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:e}),i.jsxs("div",{className:"relative w-full max-w-xl mx-4 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-xl shadow-2xl max-h-[90vh] flex flex-col",children:[i.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-bambu-dark-tertiary flex-shrink-0",children:[i.jsx("h2",{className:"text-lg font-semibold text-white",children:s(c?"inventory.editSpool":"inventory.addSpool")}),i.jsx("button",{onClick:e,className:"p-1 text-bambu-gray hover:text-white rounded transition-colors",children:i.jsx(zt,{className:"w-5 h-5"})})]}),!c&&i.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b border-bambu-dark-tertiary flex-shrink-0",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(rc,{className:"w-4 h-4 text-amber-400"}),i.jsx("span",{className:"text-sm text-white",children:s("inventory.quickAdd")})]}),i.jsx("button",{type:"button",onClick:()=>{_(!v),v||y("filament")},className:`relative inline-flex h-5 w-9 items-center rounded-full transition-colors ${v?"bg-bambu-green":"bg-bambu-dark-tertiary"}`,children:i.jsx("span",{className:`inline-block h-3.5 w-3.5 rounded-full bg-white transition-transform ${v?"translate-x-4":"translate-x-0.5"}`})})]}),i.jsxs("div",{className:"flex border-b border-bambu-dark-tertiary flex-shrink-0",children:[i.jsxs("button",{onClick:()=>y("filament"),className:`flex-1 px-4 py-2.5 text-sm font-medium flex items-center justify-center gap-2 transition-colors ${f==="filament"?"text-bambu-green border-b-2 border-bambu-green":"text-bambu-gray hover:text-white"}`,children:[i.jsx(F0,{className:"w-4 h-4"}),s("inventory.filamentInfoTab")]}),!v&&i.jsxs("button",{onClick:()=>y("pa-profile"),className:`flex-1 px-4 py-2.5 text-sm font-medium flex items-center justify-center gap-2 transition-colors ${f==="pa-profile"?"text-bambu-green border-b-2 border-bambu-green":"text-bambu-gray hover:text-white"}`,children:[i.jsx(Mme,{className:"w-4 h-4"}),s("inventory.paProfileTab"),j>0&&i.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded-full bg-bambu-green/20 text-bambu-green",children:j})]})]}),i.jsx("div",{className:"p-4 overflow-y-auto flex-1",style:{scrollbarGutter:"stable"},children:f==="filament"?i.jsxs("div",{className:"space-y-6",children:[i.jsxs("div",{children:[i.jsx("h3",{className:"text-sm font-semibold text-bambu-gray uppercase tracking-wide mb-3",children:s("inventory.filamentInfo")}),i.jsx(Met,{formData:d,updateField:ne,cloudAuthenticated:C,loadingCloudPresets:N,presetInputValue:$,setPresetInputValue:U,selectedPresetOption:K,filamentOptions:E,availableBrands:V,availableMaterials:ee,quickAdd:v,quantity:k,onQuantityChange:P,errors:m})]}),i.jsxs("div",{children:[i.jsx("h3",{className:"text-sm font-semibold text-bambu-gray uppercase tracking-wide mb-3",children:s("inventory.color")}),i.jsx(Eet,{formData:d,updateField:ne,recentColors:me,onColorUsed:se,catalogColors:J})]}),i.jsxs("div",{children:[i.jsx("h3",{className:"text-sm font-semibold text-bambu-gray uppercase tracking-wide mb-3",children:s("inventory.additional")}),i.jsx(Det,{formData:d,updateField:ne,spoolCatalog:G,currencySymbol:a})]}),c&&n&&i.jsx("div",{children:i.jsx(Oet,{spoolId:n.id})})]}):i.jsx(Ret,{formData:d,updateField:ne,printersWithCalibrations:Z,selectedProfiles:le,setSelectedProfiles:pe,expandedPrinters:Ce,setExpandedPrinters:q})}),i.jsxs("div",{className:"flex gap-2 p-4 border-t border-bambu-dark-tertiary flex-shrink-0",children:[c&&i.jsxs(Fe,{variant:"secondary",onClick:()=>O.mutate(),disabled:ve||!n?.tag_uid,className:"mr-auto",children:[i.jsx(cu,{className:"w-4 h-4"}),s("inventory.deleteTag","Delete Tag")]}),i.jsxs("div",{className:"flex gap-2 ml-auto",children:[i.jsx(Fe,{variant:"secondary",onClick:e,children:s("common.cancel")}),i.jsx(Fe,{onClick:Q,disabled:ve,children:ve?i.jsxs(i.Fragment,{children:[i.jsx(ct,{className:"w-4 h-4 animate-spin"}),s("common.saving")]}):i.jsxs(i.Fragment,{children:[i.jsx(ps,{className:"w-4 h-4"}),s(c?"common.save":"inventory.addSpool")]})})]})]})]})]})}function zet({isOpen:t,onClose:e,columns:n,defaultColumns:r,onSave:a}){const{t:s}=Mt(),[o,l]=w.useState(n),[c,d]=w.useState(null),u=w.useRef(null);if(w.useEffect(()=>{t&&l(n.map(P=>({...P})))},[t,n]),w.useEffect(()=>{if(!t)return;const P=C=>{C.key==="Escape"&&e()};return window.addEventListener("keydown",P),()=>window.removeEventListener("keydown",P)},[t,e]),!t)return null;const m=P=>{l(C=>C.map((T,N)=>N===P?{...T,visible:!T.visible}:T))},p=(P,C)=>{C<0||C>=o.length||l(T=>{const N=[...T],[R]=N.splice(P,1);return N.splice(C,0,R),N})},f=(P,C)=>{u.current=C,d(C),P.dataTransfer.effectAllowed="move"},y=(P,C)=>{P.preventDefault(),P.dataTransfer.dropEffect="move";const T=u.current;T!==null&&T!==C&&(p(T,C),u.current=C,d(C))},x=P=>{P.preventDefault()},b=()=>{u.current=null,d(null)},v=()=>{l(r.map(P=>({...P})))},_=()=>{a(o),e()},k=o.filter(P=>P.visible).length;return i.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",onClick:e,children:i.jsx(Tt,{className:"w-full max-w-md max-h-[80vh] flex flex-col",onClick:P=>P.stopPropagation(),children:i.jsxs(Pt,{className:"p-6 flex flex-col min-h-0",children:[i.jsx("h3",{className:"text-lg font-semibold text-white mb-2",children:s("inventory.configureColumns")}),i.jsxs("p",{className:"text-sm text-bambu-gray mb-4",children:[s("inventory.configureColumnsDesc"),i.jsxs("span",{className:"ml-2 text-bambu-gray/60",children:["(",k," ",s("inventory.of")," ",o.length," ",s("inventory.visible"),")"]})]}),i.jsx("div",{className:"space-y-1 overflow-y-auto flex-1 min-h-0 pr-1",children:o.map((P,C)=>i.jsxs("div",{className:`flex items-center gap-2 p-2 rounded-lg border transition-colors ${c===C?"border-bambu-green bg-bambu-green/10":"border-bambu-dark-tertiary bg-bambu-dark-tertiary/50"} ${P.visible?"":"opacity-50"}`,draggable:!0,onDragStart:T=>f(T,C),onDragOver:T=>y(T,C),onDrop:x,onDragEnd:b,children:[i.jsx("div",{className:"cursor-grab text-bambu-gray/50 hover:text-bambu-gray",children:i.jsx(qm,{className:"w-4 h-4"})}),i.jsx("span",{className:"flex-1 font-medium text-sm text-white",children:P.label}),i.jsxs("div",{className:"flex items-center gap-0.5",children:[i.jsx("button",{onClick:()=>p(C,C-1),disabled:C===0,className:"p-1 rounded text-bambu-gray hover:bg-bambu-dark-secondary disabled:opacity-30 disabled:cursor-not-allowed",title:s("inventory.moveUp"),children:i.jsx(vl,{className:"w-4 h-4"})}),i.jsx("button",{onClick:()=>p(C,C+1),disabled:C===o.length-1,className:"p-1 rounded text-bambu-gray hover:bg-bambu-dark-secondary disabled:opacity-30 disabled:cursor-not-allowed",title:s("inventory.moveDown"),children:i.jsx(In,{className:"w-4 h-4"})})]}),i.jsx("button",{onClick:()=>m(C),className:`p-1.5 rounded transition-colors ${P.visible?"text-bambu-green hover:bg-bambu-green/10":"text-bambu-gray/50 hover:bg-bambu-dark-secondary"}`,title:P.visible?s("inventory.hideColumn"):s("inventory.showColumn"),children:P.visible?i.jsx(tc,{className:"w-4 h-4"}):i.jsx(j0,{className:"w-4 h-4"})})]},P.id))}),i.jsxs("div",{className:"flex items-center gap-3 mt-4 pt-4 border-t border-bambu-dark-tertiary",children:[i.jsxs(Fe,{variant:"secondary",onClick:v,className:"mr-auto",children:[i.jsx(uo,{className:"w-4 h-4"}),s("inventory.reset")]}),i.jsx(Fe,{variant:"secondary",onClick:e,children:s("inventory.cancel")}),i.jsx(Fe,{onClick:_,children:s("inventory.applyChanges")})]})]})})})}function LK(t){return`${t.material}|${t.subtype||""}|${t.brand||""}|${t.color_name||""}|${t.rgba||""}|${t.label_weight}`}const Bse="bambuddy-inventory-columns",D1=[{id:"id",label:"#",visible:!0},{id:"added_time",label:"Added",visible:!0},{id:"encode_time",label:"Encoded",visible:!1},{id:"last_used_time",label:"Last Used",visible:!1},{id:"rgba",label:"Color",visible:!0},{id:"material",label:"Material",visible:!0},{id:"subtype",label:"Subtype",visible:!0},{id:"color_name",label:"Color Name",visible:!1},{id:"brand",label:"Brand",visible:!0},{id:"slicer_filament",label:"Slicer Filament",visible:!1},{id:"location",label:"Location",visible:!0},{id:"label_weight",label:"Label",visible:!0},{id:"net",label:"Net",visible:!0},{id:"gross",label:"Gross",visible:!1},{id:"added_full",label:"Full",visible:!1},{id:"used",label:"Used",visible:!1},{id:"printed_total",label:"Printed Total",visible:!1},{id:"printed_since_weight",label:"Printed Since Weight",visible:!1},{id:"note",label:"Note",visible:!1},{id:"pa_k",label:"PA(K)",visible:!0},{id:"tag_id",label:"Tag ID",visible:!1},{id:"data_origin",label:"Data Origin",visible:!1},{id:"tag_type",label:"Linked Tag Type",visible:!1},{id:"stock",label:"Stock",visible:!1},{id:"remaining",label:"Remaining",visible:!0},{id:"cost_per_kg",label:"Cost/kg",visible:!1},{id:"weight_check",label:"Weight Check",visible:!1}];function Uet(){try{const t=localStorage.getItem(Bse);if(t){const e=JSON.parse(t),n=new Set(D1.map(o=>o.id)),r=new Set(e.map(o=>o.id)),a=e.filter(o=>n.has(o.id)),s=D1.filter(o=>!r.has(o.id));return[...a,...s]}}catch{}return D1.map(t=>({...t}))}function Bet(t){try{localStorage.setItem(Bse,JSON.stringify(t))}catch{}}function Oc(t,e=!1){return e&&t>=1e3?`${(t/1e3).toFixed(1)}kg`:`${Math.round(t)}g`}const Het={PLA:"bg-green-500/20 text-green-400",ABS:"bg-red-500/20 text-red-400",PETG:"bg-blue-500/20 text-blue-400",TPU:"bg-purple-500/20 text-purple-400",ASA:"bg-orange-500/20 text-orange-400",PA:"bg-yellow-500/20 text-yellow-400",PC:"bg-cyan-500/20 text-cyan-400",PET:"bg-sky-500/20 text-sky-400"};function nD(t,e="system"){if(!t)return"-";const n=Jn(t);return n?ED(n,e):"-"}const $et={id:()=>"#",added_time:()=>"Added",encode_time:()=>"Encoded",last_used_time:()=>"Last Used",rgba:t=>t("inventory.color"),material:t=>t("inventory.material"),subtype:t=>t("inventory.subtype"),color_name:t=>t("inventory.colorName"),brand:t=>t("inventory.brand"),slicer_filament:t=>t("inventory.slicerFilament"),location:()=>"Location",label_weight:t=>t("inventory.labelWeight"),net:t=>t("inventory.net"),gross:()=>"Gross",added_full:()=>"Full",used:t=>t("inventory.weightUsed"),printed_total:()=>"Printed Total",printed_since_weight:()=>"Printed Since Weight",note:t=>t("inventory.note"),pa_k:()=>"PA(K)",tag_id:()=>"Tag ID",data_origin:()=>"Data Origin",tag_type:()=>"Linked Tag Type",stock:t=>t("inventory.stock"),remaining:t=>t("inventory.remaining"),cost_per_kg:t=>t("inventory.costPerKg"),weight_check:t=>t("inventory.weightCheck")},TF={id:({spool:t})=>i.jsx("span",{className:"text-sm font-medium text-white",children:t.id}),added_time:({spool:t,dateFormat:e})=>i.jsx("span",{className:"text-sm text-bambu-gray",children:nD(t.created_at,e)}),encode_time:({spool:t,dateFormat:e})=>i.jsx("span",{className:"text-sm text-bambu-gray",children:nD(t.encode_time,e)}),last_used_time:({spool:t,dateFormat:e})=>i.jsx("span",{className:"text-sm text-bambu-gray",children:t.last_used?nD(t.last_used,e):"Never"}),rgba:({spool:t})=>i.jsx("div",{className:"flex items-center justify-center",children:i.jsx("span",{className:"w-5 h-5 rounded-full border border-white/20 flex-shrink-0",style:{backgroundColor:t.rgba?`#${t.rgba.substring(0,6)}`:"#808080"},title:t.rgba?`#${t.rgba.substring(0,6)}`:void 0})}),material:({spool:t})=>i.jsx("span",{className:"text-sm text-white",children:t.material}),subtype:({spool:t})=>i.jsx("span",{className:"text-sm text-bambu-gray",children:t.subtype||"-"}),color_name:({spool:t})=>i.jsx("span",{className:"text-sm text-bambu-gray",children:D4(t.color_name,t.rgba)||"-"}),brand:({spool:t})=>i.jsx("span",{className:"text-sm text-bambu-gray",children:t.brand||"-"}),slicer_filament:({spool:t})=>i.jsx("span",{className:"text-sm text-bambu-gray",title:t.slicer_filament||void 0,children:t.slicer_filament_name||t.slicer_filament||"-"}),location:({spool:t,assignmentMap:e})=>{const n=e[t.id];if(!n)return i.jsx("span",{className:"text-sm text-bambu-gray",children:"-"});const r=n.printer_name||`Printer ${n.printer_id}`,a=n.ams_id===254||n.ams_id===255,s=!a&&n.ams_id>=128,o=F4(n.ams_id,n.tray_id,s,a);return i.jsxs("span",{className:"inline-flex items-center px-1.5 py-0.5 rounded text-xs font-medium bg-purple-500/20 text-purple-400",children:[r," ",o,n.ams_label?` (${n.ams_label})`:""]})},label_weight:({spool:t})=>i.jsx("span",{className:"text-sm text-white",children:Oc(t.label_weight)}),net:({remaining:t})=>i.jsx("span",{className:"text-sm text-white",children:Oc(t)}),gross:({spool:t,remaining:e})=>i.jsx("span",{className:"text-sm text-bambu-gray",children:Oc(e+t.core_weight)}),added_full:({spool:t})=>i.jsx("span",{className:"text-sm text-bambu-gray",children:t.added_full==null?"-":t.added_full?"Yes":"No"}),used:({spool:t})=>i.jsx("span",{className:"text-sm text-bambu-gray",children:t.weight_used>0?Oc(t.weight_used):"-"}),printed_total:()=>i.jsx("span",{className:"text-sm text-bambu-gray/50",children:"-"}),printed_since_weight:()=>i.jsx("span",{className:"text-sm text-bambu-gray/50",children:"-"}),note:({spool:t})=>i.jsx("span",{className:"text-sm text-bambu-gray max-w-[150px] truncate block",title:t.note||void 0,children:t.note||"-"}),pa_k:({spool:t})=>(t.k_profiles?.length??0)===0?i.jsx("span",{className:"text-sm text-bambu-gray",children:"-"}):i.jsx("span",{className:"inline-flex items-center px-1.5 py-0.5 rounded text-xs font-medium bg-bambu-green/20 text-bambu-green",children:"K"}),tag_id:({spool:t})=>{const e=t.tag_uid||t.tray_uuid;return e?i.jsx("span",{className:"text-sm text-bambu-gray font-mono",title:e,children:e.length>12?`${e.slice(0,6)}...${e.slice(-4)}`:e}):i.jsx("span",{className:"text-sm text-bambu-gray/50",children:"-"})},data_origin:({spool:t})=>i.jsx("span",{className:"text-sm text-bambu-gray",children:t.data_origin||"-"}),tag_type:({spool:t})=>i.jsx("span",{className:"text-sm text-bambu-gray",children:t.tag_type||"-"}),stock:({spool:t,t:e})=>t.slicer_filament?i.jsx("span",{className:"text-sm text-bambu-gray",children:"-"}):i.jsx("span",{className:"inline-flex items-center px-1.5 py-0.5 rounded text-xs font-medium bg-amber-500/20 text-amber-400",children:e("inventory.stock")}),remaining:({remaining:t,pct:e})=>i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("div",{className:"flex-1 h-2 bg-bambu-dark-tertiary rounded-full overflow-hidden",children:i.jsx("div",{className:`h-full rounded-full ${e>50?"bg-bambu-green":e>20?"bg-yellow-500":"bg-red-500"}`,style:{width:`${Math.min(e,100)}%`}})}),i.jsxs("span",{className:"text-xs text-bambu-gray min-w-[40px] text-right",children:[Math.round(t),"g"]})]}),cost_per_kg:({spool:t,currencySymbol:e})=>i.jsx("span",{className:"text-sm text-bambu-gray",children:t.cost_per_kg!=null?`${e}${t.cost_per_kg.toFixed(2)}`:"-"}),weight_check:({spool:t,onSyncWeight:e})=>{const n=t.last_scale_weight;if(n==null)return i.jsx("span",{className:"text-sm text-bambu-gray/50",title:"No scale measurement",children:"-"});const r=t.core_weight||0,a=Math.max(0,t.label_weight-t.weight_used)+r;let s,o;n<r?(s=n-r,o=!0):(s=n-a,o=Math.abs(s)<=50);const l=s>0?`+${Math.round(s)}`:`${Math.round(s)}`,c=o?`Scale: ${Math.round(n)}g
- Calculated: ${Math.round(a)}g
- Difference: ${l}g (within tolerance)`:`Scale: ${Math.round(n)}g
- Calculated: ${Math.round(a)}g
- Difference: ${l}g (mismatch!)`;return i.jsxs("div",{className:`flex items-center gap-1 text-sm font-medium ${o?"text-green-400":"text-yellow-400"}`,title:c,children:[i.jsxs("span",{children:[Math.round(n),"g"]}),o?i.jsx(Vr,{className:"w-3 h-3"}):i.jsxs(i.Fragment,{children:[i.jsx(En,{className:"w-3 h-3"}),e&&i.jsx("button",{type:"button",onClick:d=>{d.stopPropagation(),d.preventDefault(),e(t)},className:"p-1 hover:bg-bambu-green/20 rounded transition-colors text-bambu-green",title:"Sync: trust scale weight and reset tracking",children:i.jsx(_r,{className:"w-3.5 h-3.5"})})]})]})}},rD={id:t=>t.id,added_time:t=>t.created_at||"",encode_time:t=>t.encode_time||"",last_used_time:t=>t.last_used||"",material:t=>(t.material||"").toLowerCase(),subtype:t=>(t.subtype||"").toLowerCase(),color_name:t=>(t.color_name||"").toLowerCase(),brand:t=>(t.brand||"").toLowerCase(),slicer_filament:t=>(t.slicer_filament_name||t.slicer_filament||"").toLowerCase(),location:(t,e)=>{const n=e[t.id];if(!n)return"";const r=n.ams_id===254||n.ams_id===255,a=!r&&n.ams_id>=128,s=n.ams_label?` (${n.ams_label})`:"";return`${n.printer_name||""} ${F4(n.ams_id,n.tray_id,a,r)}${s}`},label_weight:t=>t.label_weight,net:t=>Math.max(0,t.label_weight-t.weight_used),gross:t=>Math.max(0,t.label_weight-t.weight_used)+t.core_weight,used:t=>t.weight_used,remaining:t=>t.label_weight>0?Math.max(0,t.label_weight-t.weight_used)/t.label_weight:0,note:t=>(t.note||"").toLowerCase(),data_origin:t=>(t.data_origin||"").toLowerCase(),tag_type:t=>(t.tag_type||"").toLowerCase(),stock:t=>t.slicer_filament?1:0,cost_per_kg:t=>t.cost_per_kg??0,weight_check:t=>{if(t.last_scale_weight==null)return-1;const e=Math.max(0,t.label_weight-t.weight_used)+t.core_weight;return Math.abs(t.last_scale_weight-e)}},PF="bambuddy-inventory-sort";function qet(){try{const t=localStorage.getItem(PF);if(t)return JSON.parse(t)}catch{}return null}function Vet(t){try{t?localStorage.setItem(PF,JSON.stringify(t)):localStorage.removeItem(PF)}catch{}}function Get(){const{data:t}=Je({queryKey:["spoolman-settings"],queryFn:be.getSpoolmanSettings,staleTime:3e5});return t?.spoolman_enabled==="true"&&t?.spoolman_url?i.jsx("iframe",{src:t.spoolman_url,className:"h-full w-full border-0",title:"Spoolman",sandbox:"allow-scripts allow-same-origin allow-forms allow-popups allow-popups-to-escape-sandbox"}):i.jsx(Wet,{})}function Wet(){const{t}=Mt(),e=tn(),{showToast:n}=bn(),[r,a]=w.useState(null),[s,o]=w.useState(null),[l,c]=w.useState("active"),[d,u]=w.useState("all"),[m,p]=w.useState(""),[f,y]=w.useState(""),[x,b]=w.useState("all"),[v,_]=w.useState(""),[k,P]=w.useState("table"),[C,T]=w.useState(qet),[N,R]=w.useState(Uet),[A,D]=w.useState(!1),[$,U]=w.useState(()=>{try{return localStorage.getItem("bambuddy-inventory-group")==="true"}catch{return!1}}),[G,L]=w.useState(new Set),[te,re]=w.useState(0),[J,ue]=w.useState(()=>{try{const xe=localStorage.getItem("bambuddy-inventory-pageSize");if(xe){const He=Number(xe);if([15,30,50,100,-1].includes(He))return He}}catch{}return 15}),{data:me}=Je({queryKey:["settings"],queryFn:be.getSettings}),ge=me?.date_format||"system",{data:X,isLoading:ie}=Je({queryKey:["inventory-spools"],queryFn:()=>be.getSpools(!0),refetchInterval:3e4}),{data:le}=Je({queryKey:["spool-assignments"],queryFn:()=>be.getAssignments(),refetchInterval:3e4}),pe=ut({mutationFn:xe=>be.deleteSpool(xe),onSuccess:()=>{e.invalidateQueries({queryKey:["inventory-spools"]}),n(t("inventory.spoolDeleted"),"success")}}),Ce=ut({mutationFn:xe=>be.archiveSpool(xe),onSuccess:()=>{e.invalidateQueries({queryKey:["inventory-spools"]}),n(t("inventory.spoolArchived"),"success")}}),q=ut({mutationFn:xe=>be.restoreSpool(xe),onSuccess:()=>{e.invalidateQueries({queryKey:["inventory-spools"]}),n(t("inventory.spoolRestored"),"success")}}),Z=async xe=>{if(xe.last_scale_weight!=null)try{await gs.updateSpoolWeight(xe.id,xe.last_scale_weight),e.invalidateQueries({queryKey:["inventory-spools"]});const He=[xe.brand,xe.material,xe.color_name].filter(Boolean).join(" ");n(`Synced "${He}" to scale weight`,"success")}catch{n("Failed to sync weight","error")}},j=me?.low_stock_threshold??20,[E,I]=w.useState(!1),[W,B]=w.useState(j.toString());w.useEffect(()=>{E||B(j.toString())},[j,E]);const ae=ut({mutationFn:xe=>be.updateSettings({low_stock_threshold:xe}),onSuccess:()=>{e.invalidateQueries({queryKey:["settings"]}),n(t("common.saved"),"success"),I(!1)},onError:()=>{n(t("inventory.lowStockThresholdError"),"error")}}),z=w.useMemo(()=>{if(!X)return null;let xe=0,He=0,Pe=0,Ve=0;const je={};for(const ye of X){if(ye.archived_at)continue;Ve++;const $e=Math.max(0,ye.label_weight-ye.weight_used);xe+=$e,He+=ye.weight_used,(ye.label_weight>0?$e/ye.label_weight*100:0)<j&&Pe++;const lt=ye.material||"Unknown";je[lt]||(je[lt]={count:0,weight:0}),je[lt].count++,je[lt].weight+=$e}return{totalWeight:xe,totalConsumed:He,lowStock:Pe,byMaterial:je,totalSpools:Ve}},[X,j]),V=le?.length??0,ee=al(me?.currency||"USD"),K=w.useMemo(()=>{const xe={};for(const He of le||[])xe[He.spool_id]=He;return xe},[le]),ne=w.useMemo(()=>z?Object.entries(z.byMaterial).sort((xe,He)=>He[1].weight-xe[1].weight).slice(0,4):[],[z]),se=w.useMemo(()=>{let xe=X||[];if(l==="active"?xe=xe.filter(He=>!He.archived_at):xe=xe.filter(He=>!!He.archived_at),d==="used"?xe=xe.filter(He=>He.weight_used>0):d==="new"?xe=xe.filter(He=>He.weight_used===0):d==="lowstock"&&(xe=xe.filter(He=>{const Pe=Math.max(0,He.label_weight-He.weight_used);return(He.label_weight>0?Pe/He.label_weight*100:0)<j})),m&&(xe=xe.filter(He=>He.material===m)),f&&(xe=xe.filter(He=>He.brand===f)),x==="stock"?xe=xe.filter(He=>!He.slicer_filament):x==="configured"&&(xe=xe.filter(He=>!!He.slicer_filament)),v){const He=v.toLowerCase();xe=xe.filter(Pe=>Pe.brand?.toLowerCase().includes(He)||Pe.material.toLowerCase().includes(He)||Pe.color_name?.toLowerCase().includes(He)||Pe.subtype?.toLowerCase().includes(He)||Pe.note?.toLowerCase().includes(He)||Pe.slicer_filament_name?.toLowerCase().includes(He))}return xe},[X,l,d,m,f,x,v,j]),ce=()=>re(0),fe=[...new Set(X?.map(xe=>xe.material)||[])].sort(),oe=[...new Set(X?.map(xe=>xe.brand).filter(Boolean)||[])].sort(),O=l!=="active"||d!=="all"||!!m||!!f||x!=="all"||!!v,F=xe=>{R(xe),Bet(xe)},Q=w.useMemo(()=>N.filter(xe=>xe.visible).map(xe=>xe.id),[N]),ve=xe=>{rD[xe]&&(T(He=>{let Pe;return He?.column===xe?Pe=He.direction==="asc"?{column:xe,direction:"desc"}:null:Pe={column:xe,direction:"asc"},Vet(Pe),Pe}),ce())},he=w.useMemo(()=>{if(!C)return se;const xe=rD[C.column];return xe?[...se].sort((Pe,Ve)=>{const je=xe(Pe,K),ye=xe(Ve,K);return je<ye?C.direction==="asc"?-1:1:je>ye?C.direction==="asc"?1:-1:0}):se},[se,C,K]),de=w.useMemo(()=>{if(!$)return he.map(Ve=>({type:"single",spool:Ve}));const xe=new Map;for(const Ve of he)if(!(Ve.weight_used>0||K[Ve.id])){const je=LK(Ve),ye=xe.get(je);ye?ye.push(Ve):xe.set(je,[Ve])}const He=[],Pe=new Set;for(const Ve of he){if(Ve.weight_used>0||K[Ve.id]){He.push({type:"single",spool:Ve});continue}const je=LK(Ve);if(Pe.has(je))continue;Pe.add(je);const ye=xe.get(je);ye.length===1?He.push({type:"single",spool:ye[0]}):He.push({type:"group",key:je,spools:ye,representative:ye[0]})}return He},[he,$,K]),Ae=J===-1,_e=de.length,ze=Ae?_e||1:J,Be=Math.max(1,Math.ceil(_e/ze)),Ue=Ae?0:Math.min(te,Be-1),Ne=Ae?de:de.slice(Ue*ze,(Ue+1)*ze),Ee=()=>{const xe=!$;U(xe),L(new Set),ce();try{localStorage.setItem("bambuddy-inventory-group",String(xe))}catch{}},ke=xe=>{L(He=>{const Pe=new Set(He);return Pe.has(xe)?Pe.delete(xe):Pe.add(xe),Pe})},Me=xe=>{ue(xe),re(0);try{localStorage.setItem("bambuddy-inventory-pageSize",String(xe))}catch{}},Ge=()=>{c("active"),u("all"),p(""),y(""),b("all"),_(""),ce()};return i.jsxs("div",{className:"p-4 md:p-6 space-y-6",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(sa,{className:"w-6 h-6 text-bambu-green"}),i.jsx("h1",{className:"text-2xl font-bold text-white",children:t("inventory.title")})]}),i.jsx("p",{className:"text-sm text-bambu-gray mt-1 ml-9",children:(t("inventory.noSpools").split(".")[0],"")})]}),i.jsxs(Fe,{onClick:()=>a({spool:null}),children:[i.jsx(sr,{className:"w-4 h-4"}),t("inventory.addSpool")]})]}),z&&!ie&&i.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-5 gap-3",children:[i.jsxs("div",{className:"bg-bambu-dark-secondary rounded-lg p-4",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[i.jsx(sa,{className:"w-4 h-4 text-bambu-green"}),i.jsx("span",{className:"text-xs text-bambu-gray font-medium uppercase tracking-wide",children:t("inventory.totalInventory")})]}),i.jsx("div",{className:"text-xl font-bold text-white",children:Oc(z.totalWeight,!0)}),i.jsxs("div",{className:"text-xs text-bambu-gray mt-1",children:[z.totalSpools," ",z.totalSpools!==1?t("inventory.spools"):t("inventory.spool")]})]}),i.jsxs("div",{className:"bg-bambu-dark-secondary rounded-lg p-4",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[i.jsx(XF,{className:"w-4 h-4 text-blue-400"}),i.jsx("span",{className:"text-xs text-bambu-gray font-medium uppercase tracking-wide",children:t("inventory.totalConsumed")})]}),i.jsx("div",{className:"text-xl font-bold text-white",children:Oc(z.totalConsumed,!0)}),i.jsx("div",{className:"text-xs text-bambu-gray mt-1",children:t("inventory.sinceTracking")})]}),i.jsxs("div",{className:"bg-bambu-dark-secondary rounded-lg p-4",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[i.jsx(Vi,{className:"w-4 h-4 text-green-400"}),i.jsx("span",{className:"text-xs text-bambu-gray font-medium uppercase tracking-wide",children:t("inventory.byMaterial")})]}),i.jsx("div",{className:"flex flex-wrap gap-1.5 mt-1",children:ne.map(([xe,He])=>i.jsxs("span",{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium ${Het[xe]||"bg-bambu-dark-tertiary text-bambu-gray"}`,children:[xe," ",i.jsx("span",{className:"opacity-70",children:Oc(He.weight,!0)})]},xe))})]}),i.jsxs("div",{className:"bg-bambu-dark-secondary rounded-lg p-4",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[i.jsx(kr,{className:"w-4 h-4 text-purple-400"}),i.jsx("span",{className:"text-xs text-bambu-gray font-medium uppercase tracking-wide",children:t("inventory.inPrinter")})]}),i.jsx("div",{className:"text-xl font-bold text-white",children:V}),i.jsx("div",{className:"text-xs text-bambu-gray mt-1",children:t("inventory.loadedInAms")})]}),i.jsxs("div",{className:"bg-bambu-dark-secondary rounded-lg p-4",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[i.jsx(En,{className:"w-4 h-4 text-yellow-400"}),i.jsx("span",{className:"text-xs text-bambu-gray font-medium uppercase tracking-wide",children:t("inventory.lowStock")})]}),i.jsx("div",{className:`text-xl font-bold ${z.lowStock>0?"text-yellow-400":"text-white"}`,children:z.lowStock}),i.jsx("div",{className:"text-xs text-bambu-gray mt-1 flex items-center gap-2",children:E?i.jsxs("form",{onSubmit:xe=>{xe.preventDefault();const He=parseFloat(W);!isNaN(He)&&He>=.1&&He<=99.9?ae.mutate(He):n(t("inventory.lowStockThresholdError"),"error")},className:"flex items-center gap-2",children:[i.jsx("span",{className:"text-xs text-bambu-gray",children:"<"}),i.jsx("input",{type:"text",inputMode:"decimal",pattern:"^\\d{0,2}(\\.\\d?)?$",maxLength:4,value:W,onChange:xe=>{const He=xe.target.value.replace(/[^\d.]/g,"");/^\d{0,2}(\.\d?)?$/.test(He)&&B(He)},className:"px-1.5 py-1 rounded border border-bambu-dark-tertiary text-xs text-white bg-bambu-dark-secondary focus:outline-none focus:border-bambu-green w-14 text-center",onWheel:xe=>xe.currentTarget.blur(),disabled:ae.isPending}),i.jsx("span",{className:"text-xs text-bambu-gray",children:"%"}),i.jsx(Fe,{type:"submit",size:"sm",disabled:ae.isPending,children:t("common.save")}),i.jsx(Fe,{type:"button",size:"sm",variant:"ghost",onClick:()=>I(!1),disabled:ae.isPending,children:t("common.cancel")})]}):i.jsxs(i.Fragment,{children:[i.jsxs("span",{className:"text-bambu-gray",children:["< ",j,"%"]}),i.jsx("button",{className:"p-1.5 text-bambu-gray hover:text-white rounded transition-colors",title:t("common.edit"),onClick:()=>{B(j.toString()),I(!0)},children:i.jsx(Mm,{className:"w-4 h-4"})})]})})]})]}),i.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 items-start sm:items-center justify-between",children:[i.jsxs("div",{className:"relative flex-1 max-w-md",children:[i.jsx(Dr,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray/50"}),i.jsx("input",{type:"text",value:v,onChange:xe=>{_(xe.target.value),ce()},placeholder:t("inventory.search"),className:"w-full pl-10 pr-8 py-2 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white text-sm placeholder:text-bambu-gray/50 focus:outline-none focus:border-bambu-green"}),v&&i.jsx("button",{onClick:()=>{_(""),ce()},className:"absolute right-3 top-1/2 -translate-y-1/2 text-bambu-gray hover:text-white",children:i.jsx(zt,{className:"w-4 h-4"})})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[k==="table"&&i.jsxs("button",{onClick:()=>D(!0),className:"flex items-center gap-1.5 px-3 py-1.5 text-sm font-medium text-bambu-gray border border-bambu-dark-tertiary rounded-lg hover:bg-bambu-dark-tertiary transition-colors",title:t("inventory.configureColumns"),children:[i.jsx(Mhe,{className:"w-4 h-4"}),i.jsx("span",{className:"hidden sm:inline",children:t("inventory.columns")})]}),i.jsxs("button",{onClick:Ee,className:`flex items-center gap-1.5 px-3 py-1.5 text-sm font-medium border rounded-lg transition-colors ${$?"bg-bambu-green/20 text-bambu-green border-bambu-green/30":"text-bambu-gray border-bambu-dark-tertiary hover:bg-bambu-dark-tertiary"}`,title:t("inventory.groupSimilar"),children:[i.jsx(kpe,{className:"w-4 h-4"}),i.jsx("span",{className:"hidden sm:inline",children:t("inventory.groupSimilar")})]}),i.jsxs("div",{className:"flex bg-bambu-dark-primary border border-bambu-dark-tertiary rounded-lg overflow-hidden",children:[i.jsxs("button",{onClick:()=>P("table"),className:`flex items-center gap-1.5 px-3 py-1.5 text-sm font-medium transition-colors ${k==="table"?"bg-bambu-green text-white":"text-bambu-gray hover:bg-bambu-dark-tertiary"}`,children:[i.jsx(fge,{className:"w-4 h-4"}),i.jsx("span",{className:"hidden sm:inline",children:t("inventory.table")})]}),i.jsxs("button",{onClick:()=>P("cards"),className:`flex items-center gap-1.5 px-3 py-1.5 text-sm font-medium transition-colors ${k==="cards"?"bg-bambu-green text-white":"text-bambu-gray hover:bg-bambu-dark-tertiary"}`,children:[i.jsx(R0,{className:"w-4 h-4"}),i.jsx("span",{className:"hidden sm:inline",children:t("inventory.cards")})]})]})]})]}),i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[i.jsxs("div",{className:"flex items-center rounded-lg border border-bambu-dark-tertiary overflow-hidden",children:[i.jsxs("button",{onClick:()=>{c("active"),ce()},className:`flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium transition-colors ${l==="active"?"bg-bambu-green/20 text-bambu-green":"text-bambu-gray hover:bg-bambu-dark-tertiary"}`,children:[i.jsx(sa,{className:"w-3.5 h-3.5"}),t("inventory.active")]}),i.jsxs("button",{onClick:()=>{c("archived"),ce()},className:`flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium transition-colors ${l==="archived"?"bg-bambu-green/20 text-bambu-green":"text-bambu-gray hover:bg-bambu-dark-tertiary"}`,children:[i.jsx(Fs,{className:"w-3.5 h-3.5"}),t("inventory.archived")]})]}),i.jsx("div",{className:"w-px h-5 bg-bambu-dark-tertiary"}),i.jsxs("div",{className:"flex items-center rounded-lg border border-bambu-dark-tertiary overflow-hidden",children:[i.jsx("button",{onClick:()=>{u("all"),ce()},className:`px-3 py-1.5 text-xs font-medium transition-colors ${d==="all"?"bg-bambu-green/20 text-bambu-green":"text-bambu-gray hover:bg-bambu-dark-tertiary"}`,children:t("inventory.all")}),i.jsxs("button",{onClick:()=>{u("used"),ce()},className:`flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium transition-colors ${d==="used"?"bg-bambu-green/20 text-bambu-green":"text-bambu-gray hover:bg-bambu-dark-tertiary"}`,children:[i.jsx(er,{className:"w-3.5 h-3.5"}),t("inventory.used")]}),i.jsx("button",{onClick:()=>{u("new"),ce()},className:`px-3 py-1.5 text-xs font-medium transition-colors ${d==="new"?"bg-bambu-green/20 text-bambu-green":"text-bambu-gray hover:bg-bambu-dark-tertiary"}`,children:t("inventory.new")}),i.jsxs("button",{onClick:()=>{u("lowstock"),ce()},className:`flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium transition-colors ${d==="lowstock"?"bg-yellow-500/20 text-yellow-400":"text-bambu-gray hover:bg-bambu-dark-tertiary"}`,children:[i.jsx(En,{className:"w-3.5 h-3.5"}),t("inventory.lowStock")]})]}),i.jsxs("div",{className:"flex items-center rounded-lg border border-bambu-dark-tertiary overflow-hidden",children:[i.jsx("button",{onClick:()=>{b("all"),ce()},className:`px-3 py-1.5 text-xs font-medium transition-colors ${x==="all"?"bg-bambu-green/20 text-bambu-green":"text-bambu-gray hover:bg-bambu-dark-tertiary"}`,children:t("inventory.all")}),i.jsx("button",{onClick:()=>{b("stock"),ce()},className:`px-3 py-1.5 text-xs font-medium transition-colors ${x==="stock"?"bg-amber-500/20 text-amber-400":"text-bambu-gray hover:bg-bambu-dark-tertiary"}`,children:t("inventory.stock")}),i.jsx("button",{onClick:()=>{b("configured"),ce()},className:`px-3 py-1.5 text-xs font-medium transition-colors ${x==="configured"?"bg-bambu-green/20 text-bambu-green":"text-bambu-gray hover:bg-bambu-dark-tertiary"}`,children:t("inventory.configured")})]}),i.jsx("div",{className:"w-px h-5 bg-bambu-dark-tertiary"}),i.jsxs("select",{value:m,onChange:xe=>{p(xe.target.value),ce()},className:`px-3 py-1.5 rounded-lg border text-xs font-medium transition-colors cursor-pointer focus:outline-none ${m?"bg-bambu-green/20 text-bambu-green border-bambu-green/30":"bg-transparent text-bambu-gray border-bambu-dark-tertiary hover:bg-bambu-dark-tertiary"}`,children:[i.jsx("option",{value:"",children:t("inventory.material")}),fe.map(xe=>i.jsx("option",{value:xe,children:xe},xe))]}),i.jsxs("select",{value:f,onChange:xe=>{y(xe.target.value),ce()},className:`px-3 py-1.5 rounded-lg border text-xs font-medium transition-colors cursor-pointer focus:outline-none ${f?"bg-bambu-green/20 text-bambu-green border-bambu-green/30":"bg-transparent text-bambu-gray border-bambu-dark-tertiary hover:bg-bambu-dark-tertiary"}`,children:[i.jsx("option",{value:"",children:t("inventory.brand")}),oe.map(xe=>i.jsx("option",{value:xe,children:xe},xe))]}),O&&i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"w-px h-5 bg-bambu-dark-tertiary"}),i.jsxs("button",{onClick:Ge,className:"flex items-center gap-1 text-xs text-bambu-gray hover:text-bambu-green transition-colors",children:[i.jsx(zt,{className:"w-3.5 h-3.5"}),t("inventory.clearFilters")]})]}),i.jsxs("span",{className:"ml-auto text-xs text-bambu-gray",children:[he.length," ",he.length!==1?t("inventory.spools"):t("inventory.spool"),$&&_e<he.length&&` (${_e} ${t("inventory.groupedRows")})`]})]}),ie?i.jsx("div",{className:"flex justify-center py-16",children:i.jsx(ct,{className:"w-8 h-8 text-bambu-green animate-spin"})}):k==="cards"?Ne.length>0?i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:Ne.map(xe=>{if(xe.type==="group"){const{key:ye,spools:$e,representative:Ye}=xe,lt=Ye.rgba?`#${Ye.rgba.substring(0,6)}`:"#808080",St=G.has(ye);return i.jsxs("div",{className:"col-span-full",children:[i.jsxs("div",{className:"bg-bambu-dark-secondary rounded-lg overflow-hidden border border-bambu-green/30 hover:border-bambu-green transition-colors cursor-pointer",onClick:()=>ke(ye),children:[i.jsx("div",{className:"h-10 flex items-center px-4 gap-3",style:{backgroundColor:lt},children:i.jsx("span",{className:"bg-white/90 text-gray-800 px-3 py-0.5 rounded-full text-sm font-medium",children:D4(Ye.color_name,Ye.rgba)||"-"})}),i.jsxs("div",{className:"px-4 py-3 flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(In,{className:`w-4 h-4 text-bambu-gray transition-transform ${St?"":"-rotate-90"}`}),i.jsxs("div",{children:[i.jsxs("h3",{className:"font-semibold text-white",children:[Ye.material,Ye.subtype?` ${Ye.subtype}`:""]}),i.jsx("p",{className:"text-sm text-bambu-gray",children:Ye.brand||"-"})]})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"text-sm text-bambu-gray",children:Oc(Ye.label_weight)}),i.jsx("span",{className:"text-xs font-medium bg-bambu-green/20 text-bambu-green px-2 py-0.5 rounded-full",children:t("inventory.groupedSpools",{count:$e.length})})]})]})]}),St&&i.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4 mt-2 ml-4",children:$e.map(ot=>{const ft=Math.max(0,ot.label_weight-ot.weight_used),qe=ot.label_weight>0?ft/ot.label_weight*100:0,ht=ot.rgba?`#${ot.rgba.substring(0,6)}`:"#808080";return i.jsx(OK,{spool:ot,remaining:ft,pct:qe,colorStyle:ht,onClick:()=>a({spool:ot}),t},ot.id)})})]},`group-${ye}`)}const He=xe.spool,Pe=Math.max(0,He.label_weight-He.weight_used),Ve=He.label_weight>0?Pe/He.label_weight*100:0,je=He.rgba?`#${He.rgba.substring(0,6)}`:"#808080";return i.jsx(OK,{spool:He,remaining:Pe,pct:Ve,colorStyle:je,onClick:()=>a({spool:He}),t},He.id)})}),i.jsx(Ket,{pageIndex:Ue,pageSize:J,totalRows:_e,totalPages:Be,onPageChange:re,onPageSizeChange:Me,t})]}):i.jsx(IK,{hasFilters:O,onAddSpool:()=>a({spool:null}),t}):Ne.length>0?i.jsxs("div",{className:"bg-bambu-dark-secondary rounded-lg overflow-hidden border border-bambu-dark-tertiary",children:[i.jsx("div",{className:"overflow-x-auto",children:i.jsxs("table",{className:"w-full",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"border-b border-bambu-dark-tertiary bg-bambu-dark-tertiary/30",children:[Q.map(xe=>{const He=!!rD[xe],Pe=C?.column===xe;return i.jsx("th",{className:`text-left py-3 px-4 text-xs font-medium uppercase tracking-wide select-none ${xe==="remaining"?"min-w-[150px]":""} ${He?"cursor-pointer hover:text-bambu-green transition-colors":""} ${Pe?"text-bambu-green":"text-bambu-gray"}`,onClick:He?()=>ve(xe):void 0,children:i.jsxs("span",{className:"inline-flex items-center gap-1",children:[$et[xe]?.(t)??xe,He&&(Pe?C.direction==="asc"?i.jsx(Hp,{className:"w-3 h-3"}):i.jsx(Pb,{className:"w-3 h-3"}):i.jsx(VF,{className:"w-3 h-3 opacity-30"}))]})},xe)}),i.jsx("th",{className:"text-right py-3 px-4 text-xs font-medium text-bambu-gray uppercase tracking-wide",children:t("common.actions")})]})}),i.jsx("tbody",{children:Ne.map(xe=>{if(xe.type==="group"){const{key:je,spools:ye,representative:$e}=xe,Ye=G.has(je),lt=Math.max(0,$e.label_weight-$e.weight_used),St=$e.label_weight>0?lt/$e.label_weight*100:0;return i.jsx(Yet,{spools:ye,representative:$e,remaining:lt,pct:St,isExpanded:Ye,onToggle:()=>ke(je),onEdit:ot=>a({spool:ot}),onArchive:ot=>o({type:"archive",spoolId:ot}),onDelete:ot=>o({type:"delete",spoolId:ot}),visibleColumns:Q,assignmentMap:K,currencySymbol:ee,dateFormat:ge,t,onSyncWeight:Z},`group-${je}`)}const He=xe.spool,Pe=Math.max(0,He.label_weight-He.weight_used),Ve=He.label_weight>0?Pe/He.label_weight*100:0;return i.jsx(Hse,{spool:He,remaining:Pe,pct:Ve,onEdit:()=>a({spool:He}),onRestore:()=>q.mutate(He.id),onArchive:()=>o({type:"archive",spoolId:He.id}),onDelete:()=>o({type:"delete",spoolId:He.id}),visibleColumns:Q,assignmentMap:K,currencySymbol:ee,dateFormat:ge,t,onSyncWeight:Z},He.id)})})]})}),i.jsxs("div",{className:"flex items-center justify-between px-4 py-3 bg-bambu-dark-tertiary/50 border-t border-bambu-dark-tertiary text-sm",children:[i.jsx("span",{className:"text-bambu-gray",children:Ae?`${_e} ${t(_e!==1?"inventory.spools":"inventory.spool")}`:i.jsxs(i.Fragment,{children:[t("inventory.showing")," ",Ue*ze+1," ",t("inventory.to")," ",Math.min((Ue+1)*ze,_e)," ",t("inventory.of")," ",_e," ",t("inventory.spools")]})}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"text-bambu-gray",children:t("inventory.show")}),i.jsxs("select",{value:J,onChange:xe=>Me(Number(xe.target.value)),className:"px-2 py-1 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded text-white text-sm focus:outline-none focus:border-bambu-green",children:[[15,30,50,100].map(xe=>i.jsx("option",{value:xe,children:xe},xe)),i.jsx("option",{value:-1,children:t("inventory.all")})]}),!Ae&&i.jsxs(i.Fragment,{children:[i.jsx("button",{onClick:()=>re(0),disabled:Ue===0,className:"p-1.5 rounded text-bambu-gray hover:text-white disabled:opacity-30 disabled:cursor-not-allowed transition-colors",title:"First page",children:i.jsx(HY,{className:"w-4 h-4"})}),i.jsx("button",{onClick:()=>re(xe=>Math.max(0,xe-1)),disabled:Ue===0,className:"p-1.5 rounded text-bambu-gray hover:text-white disabled:opacity-30 disabled:cursor-not-allowed transition-colors",children:i.jsx(ec,{className:"w-4 h-4"})}),i.jsxs("span",{className:"text-bambu-gray px-2 whitespace-nowrap",children:[t("inventory.page")," ",Ue+1," ",t("inventory.of")," ",Be]}),i.jsx("button",{onClick:()=>re(xe=>Math.min(Be-1,xe+1)),disabled:Ue>=Be-1,className:"p-1.5 rounded text-bambu-gray hover:text-white disabled:opacity-30 disabled:cursor-not-allowed transition-colors",children:i.jsx(pa,{className:"w-4 h-4"})}),i.jsx("button",{onClick:()=>re(Be-1),disabled:Ue>=Be-1,className:"p-1.5 rounded text-bambu-gray hover:text-white disabled:opacity-30 disabled:cursor-not-allowed transition-colors",title:"Last page",children:i.jsx($Y,{className:"w-4 h-4"})})]})]})]})]}):i.jsx(IK,{hasFilters:O,onAddSpool:()=>a({spool:null}),t}),r!==null&&i.jsx(Iet,{isOpen:!0,onClose:()=>a(null),spool:r.spool,currencySymbol:ee}),s&&i.jsx(Nn,{title:s.type==="delete"?t("common.delete"):t("inventory.archive"),message:s.type==="delete"?t("inventory.deleteConfirm"):t("inventory.archiveConfirm"),confirmText:s.type==="delete"?t("common.delete"):t("inventory.archive"),variant:s.type==="delete"?"danger":"warning",onConfirm:()=>{s.type==="delete"?pe.mutate(s.spoolId):Ce.mutate(s.spoolId),o(null)},onCancel:()=>o(null)}),i.jsx(zet,{isOpen:A,onClose:()=>D(!1),columns:N,defaultColumns:D1,onSave:F})]})}function Ket({pageIndex:t,pageSize:e,totalRows:n,totalPages:r,onPageChange:a,onPageSizeChange:s,t:o}){const l=e===-1;if(r<=1&&!l)return null;const c=l?n||1:e;return i.jsxs("div",{className:"flex items-center justify-between pt-2 text-sm",children:[i.jsx("span",{className:"text-bambu-gray",children:l?`${n} ${o(n!==1?"inventory.spools":"inventory.spool")}`:i.jsxs(i.Fragment,{children:[o("inventory.showing")," ",t*c+1," ",o("inventory.to")," ",Math.min((t+1)*c,n)," ",o("inventory.of")," ",n," ",o("inventory.spools")]})}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"text-bambu-gray",children:o("inventory.show")}),i.jsxs("select",{value:e,onChange:d=>s(Number(d.target.value)),className:"px-2 py-1 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded text-white text-sm focus:outline-none focus:border-bambu-green",children:[[15,30,50,100].map(d=>i.jsx("option",{value:d,children:d},d)),i.jsx("option",{value:-1,children:o("inventory.all")})]}),!l&&i.jsxs(i.Fragment,{children:[i.jsx("button",{onClick:()=>a(0),disabled:t===0,className:"p-1.5 rounded text-bambu-gray hover:text-white disabled:opacity-30 disabled:cursor-not-allowed transition-colors",children:i.jsx(HY,{className:"w-4 h-4"})}),i.jsx("button",{onClick:()=>a(Math.max(0,t-1)),disabled:t===0,className:"p-1.5 rounded text-bambu-gray hover:text-white disabled:opacity-30 disabled:cursor-not-allowed transition-colors",children:i.jsx(ec,{className:"w-4 h-4"})}),i.jsxs("span",{className:"text-bambu-gray px-2 whitespace-nowrap",children:[o("inventory.page")," ",t+1," ",o("inventory.of")," ",r]}),i.jsx("button",{onClick:()=>a(Math.min(r-1,t+1)),disabled:t>=r-1,className:"p-1.5 rounded text-bambu-gray hover:text-white disabled:opacity-30 disabled:cursor-not-allowed transition-colors",children:i.jsx(pa,{className:"w-4 h-4"})}),i.jsx("button",{onClick:()=>a(r-1),disabled:t>=r-1,className:"p-1.5 rounded text-bambu-gray hover:text-white disabled:opacity-30 disabled:cursor-not-allowed transition-colors",children:i.jsx($Y,{className:"w-4 h-4"})})]})]})]})}function OK({spool:t,remaining:e,pct:n,colorStyle:r,onClick:a,t:s}){return i.jsxs("div",{className:`bg-bambu-dark-secondary rounded-lg overflow-hidden border border-bambu-dark-tertiary hover:border-bambu-green transition-colors cursor-pointer ${t.archived_at?"opacity-50":""}`,onClick:a,children:[i.jsx("div",{className:"h-14 flex items-center justify-center",style:{backgroundColor:r},children:i.jsx("span",{className:"bg-white/90 text-gray-800 px-3 py-0.5 rounded-full text-sm font-medium",children:D4(t.color_name,t.rgba)||"-"})}),i.jsxs("div",{className:"p-4 space-y-3",children:[i.jsxs("div",{className:"flex items-start justify-between gap-2",children:[i.jsxs("div",{children:[i.jsxs("h3",{className:"font-semibold text-white",children:[t.material,t.subtype?` ${t.subtype}`:""]}),i.jsx("p",{className:"text-sm text-bambu-gray",children:t.brand||"-"})]}),i.jsxs("span",{className:"text-xs font-mono text-bambu-gray bg-bambu-dark-tertiary px-2 py-1 rounded",children:["#",t.id]})]}),i.jsxs("div",{children:[i.jsxs("div",{className:"flex justify-between text-xs text-bambu-gray mb-1",children:[i.jsx("span",{children:s("inventory.remaining")}),i.jsxs("span",{children:[Math.round(n),"%"]})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("div",{className:"flex-1 h-2 bg-bambu-dark-tertiary rounded-full overflow-hidden",children:i.jsx("div",{className:`h-full rounded-full ${n>50?"bg-bambu-green":n>20?"bg-yellow-500":"bg-red-500"}`,style:{width:`${Math.min(n,100)}%`}})}),i.jsxs("span",{className:"text-xs text-bambu-gray min-w-[40px] text-right",children:[Math.round(e),"g"]})]})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[i.jsxs("div",{children:[i.jsxs("span",{className:"text-bambu-gray/60",children:[s("inventory.labelWeight"),": "]}),i.jsx("span",{className:"text-bambu-gray",children:Oc(t.label_weight)})]}),i.jsxs("div",{children:[i.jsxs("span",{className:"text-bambu-gray/60",children:[s("inventory.weightUsed"),": "]}),i.jsx("span",{className:"text-bambu-gray",children:t.weight_used>0?Oc(t.weight_used):"-"})]})]}),t.note&&i.jsx("div",{className:"text-xs text-bambu-gray/60 pt-2 border-t border-bambu-dark-tertiary truncate",title:t.note,children:t.note})]})]})}function Hse({spool:t,remaining:e,pct:n,onEdit:r,onRestore:a,onArchive:s,onDelete:o,visibleColumns:l,assignmentMap:c,currencySymbol:d,dateFormat:u,t:m,onSyncWeight:p}){return i.jsxs("tr",{className:`border-b border-bambu-dark-tertiary/50 hover:bg-bambu-dark-tertiary/30 transition-colors cursor-pointer ${t.archived_at?"opacity-50":""}`,onClick:r,children:[l.map(f=>i.jsx("td",{className:"py-3 px-4",children:TF[f]?.({spool:t,remaining:e,pct:n,assignmentMap:c,currencySymbol:d,dateFormat:u,t:m,onSyncWeight:p})},f)),i.jsx("td",{className:"py-3 px-4",children:i.jsxs("div",{className:"flex items-center justify-end gap-1",onClick:f=>f.stopPropagation(),children:[i.jsx("button",{onClick:r,className:"p-1.5 text-bambu-gray hover:text-white rounded transition-colors",title:m("common.edit"),children:i.jsx(Mm,{className:"w-4 h-4"})}),t.archived_at?i.jsx("button",{onClick:a,className:"p-1.5 text-bambu-gray hover:text-bambu-green rounded transition-colors",title:m("inventory.restore"),children:i.jsx(uo,{className:"w-4 h-4"})}):i.jsx("button",{onClick:s,className:"p-1.5 text-bambu-gray hover:text-yellow-400 rounded transition-colors",title:m("inventory.archive"),children:i.jsx(Fs,{className:"w-4 h-4"})}),i.jsx("button",{onClick:o,className:"p-1.5 text-bambu-gray hover:text-red-400 rounded transition-colors",title:m("common.delete"),children:i.jsx(Qt,{className:"w-4 h-4"})})]})})]})}function Yet({spools:t,representative:e,remaining:n,pct:r,isExpanded:a,onToggle:s,onEdit:o,onArchive:l,onDelete:c,visibleColumns:d,assignmentMap:u,currencySymbol:m,dateFormat:p,t:f,onSyncWeight:y}){return i.jsxs(i.Fragment,{children:[i.jsxs("tr",{className:"border-b border-bambu-dark-tertiary/50 hover:bg-bambu-dark-tertiary/30 transition-colors cursor-pointer bg-bambu-green/5",onClick:s,children:[d.map((x,b)=>i.jsx("td",{className:"py-3 px-4",children:b===0?i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(In,{className:`w-4 h-4 text-bambu-gray transition-transform ${a?"":"-rotate-90"}`}),TF[x]?.({spool:e,remaining:n,pct:r,assignmentMap:u,currencySymbol:m,dateFormat:p,t:f,onSyncWeight:y})]}):x==="id"?i.jsx("span",{className:"text-xs font-medium bg-bambu-green/20 text-bambu-green px-2 py-0.5 rounded-full",children:f("inventory.groupedSpools",{count:t.length})}):TF[x]?.({spool:e,remaining:n,pct:r,assignmentMap:u,currencySymbol:m,dateFormat:p,t:f,onSyncWeight:y})},x)),i.jsx("td",{className:"py-3 px-4",children:i.jsx("span",{className:"text-xs text-bambu-gray",children:t.map(x=>`#${x.id}`).join(", ")})})]}),a&&t.map(x=>{const b=Math.max(0,x.label_weight-x.weight_used),v=x.label_weight>0?b/x.label_weight*100:0;return i.jsx(Hse,{spool:x,remaining:b,pct:v,onEdit:()=>o(x),onRestore:()=>{},onArchive:()=>l(x.id),onDelete:()=>c(x.id),visibleColumns:d,assignmentMap:u,currencySymbol:m,dateFormat:p,t:f,onSyncWeight:y},x.id)})]})}function IK({hasFilters:t,onAddSpool:e,t:n}){return i.jsxs("div",{className:"flex flex-col items-center justify-center py-16 px-4",children:[i.jsxs("div",{className:"relative mb-6",children:[i.jsx("div",{className:"absolute inset-0 -m-4 bg-bambu-green/5 rounded-full blur-2xl"}),i.jsxs("div",{className:"relative flex items-center justify-center w-24 h-24 rounded-2xl bg-gradient-to-br from-bambu-dark-secondary to-bambu-dark-tertiary border border-bambu-dark-tertiary shadow-lg",children:[i.jsx("div",{className:"absolute -top-1 -right-1 w-3 h-3 rounded-full bg-bambu-green/30"}),i.jsx("div",{className:"absolute -bottom-2 -left-2 w-2 h-2 rounded-full bg-bambu-green/20"}),t?i.jsx(Dr,{className:"w-10 h-10 text-bambu-gray/40",strokeWidth:1.5}):i.jsxs("div",{className:"relative",children:[i.jsx("div",{className:"w-14 h-14 rounded-full border-4 border-bambu-gray/20 flex items-center justify-center",children:i.jsx("div",{className:"w-6 h-6 rounded-full bg-bambu-gray/10 border-2 border-bambu-gray/20"})}),i.jsx("div",{className:"absolute -bottom-1 -right-1 w-6 h-6 rounded-full bg-bambu-green flex items-center justify-center shadow-md",children:i.jsx("span",{className:"text-white text-lg font-bold leading-none",children:"+"})})]})]})]}),i.jsx("h3",{className:"text-lg font-semibold text-white mb-2 text-center",children:t?n("inventory.noSpoolsMatch"):n("inventory.noSpools").split(".")[0]}),i.jsx("p",{className:"text-sm text-bambu-gray text-center max-w-sm mb-6",children:n(t?"inventory.noSpoolsMatchDesc":"inventory.noSpools")}),!t&&i.jsxs(Fe,{onClick:e,children:[i.jsx(sa,{className:"w-4 h-4"}),n("inventory.addSpool")]})]})}const zK=["DEBUG","INFO","WARNING","ERROR"],iD={DEBUG:"text-gray-400",INFO:"text-blue-400",WARNING:"text-yellow-400",ERROR:"text-red-400"},Xet={DEBUG:Ab,INFO:js,WARNING:En,ERROR:Ii};function Qet(){const t=tn(),[e,n]=w.useState(!0),[r,a]=w.useState(new Set),[s,o]=w.useState(""),[l,c]=w.useState("ALL"),[d,u]=w.useState(!1),[m,p]=w.useState(!1),f=w.useRef(null),{data:y,isLoading:x,refetch:b}=Je({queryKey:["application-logs",l,s],queryFn:()=>pb.getLogs({limit:200,level:l==="ALL"?void 0:l,search:s||void 0}),refetchInterval:m?2e3:!1,enabled:d});w.useEffect(()=>{d||p(!1)},[d]);const v=ut({mutationFn:()=>pb.clearLogs(),onSuccess:()=>{t.invalidateQueries({queryKey:["application-logs"]})}});w.useEffect(()=>{e&&f.current&&y?.entries&&(f.current.scrollTop=f.current.scrollHeight)},[y?.entries,e]);const _=N=>{a(R=>{const A=new Set(R);return A.has(N)?A.delete(N):A.add(N),A})},k=N=>{const R=N.split(" ");return R.length>=2?R[1]:N},P=w.useMemo(()=>y?.entries??[],[y?.entries]),C=w.useMemo(()=>[...P].reverse(),[P]),T=({level:N})=>{const R=Xet[N]||js;return i.jsx(R,{className:`w-3.5 h-3.5 ${iD[N]||"text-gray-400"}`})};return i.jsxs("div",{className:"bg-bambu-dark rounded-lg overflow-hidden",children:[i.jsxs("button",{onClick:()=>u(!d),className:"w-full flex items-center justify-between p-4 hover:bg-bambu-dark-tertiary/50 transition-colors",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:`p-2 rounded-lg ${m?"bg-bambu-green/20 text-bambu-green":"bg-bambu-dark-tertiary text-bambu-gray"}`,children:i.jsx(Ab,{className:"w-5 h-5"})}),i.jsxs("div",{className:"text-left",children:[i.jsx("p",{className:"font-medium text-white",children:"Application Logs"}),i.jsx("p",{className:"text-sm text-bambu-gray",children:m?`Live streaming - ${y?.filtered_count??0} entries`:"View and filter application logs"})]})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[m&&i.jsxs("span",{className:"flex items-center gap-1.5 px-2 py-1 bg-bambu-green/20 rounded text-bambu-green text-xs",children:[i.jsx("span",{className:"w-1.5 h-1.5 bg-bambu-green rounded-full animate-pulse"}),"Live"]}),d?i.jsx(vl,{className:"w-5 h-5 text-bambu-gray"}):i.jsx(In,{className:"w-5 h-5 text-bambu-gray"})]})]}),d&&i.jsxs("div",{className:"border-t border-bambu-dark-tertiary",children:[i.jsxs("div",{className:"flex flex-col gap-2 p-4 border-b border-bambu-dark-tertiary",children:[i.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[m?i.jsxs("button",{onClick:N=>{N.stopPropagation(),p(!1)},className:"flex items-center gap-1.5 px-3 py-1.5 text-sm bg-red-500/20 text-red-400 hover:bg-red-500/30 rounded transition-colors",children:[i.jsx(Sl,{className:"w-4 h-4"}),"Stop"]}):i.jsxs("button",{onClick:N=>{N.stopPropagation(),p(!0),b()},className:"flex items-center gap-1.5 px-3 py-1.5 text-sm bg-bambu-green/20 text-bambu-green hover:bg-bambu-green/30 rounded transition-colors",children:[i.jsx(co,{className:"w-4 h-4"}),"Start"]}),i.jsxs("button",{onClick:()=>v.mutate(),disabled:v.isPending||P.length===0,className:"flex items-center gap-1.5 px-3 py-1.5 text-sm bg-bambu-dark-tertiary text-bambu-gray hover:text-white hover:bg-bambu-dark-secondary rounded transition-colors disabled:opacity-50",children:[i.jsx(Qt,{className:"w-4 h-4"}),"Clear"]}),i.jsx("button",{onClick:()=>b(),disabled:x,className:"flex items-center gap-1.5 px-3 py-1.5 text-sm bg-bambu-dark-tertiary text-bambu-gray hover:text-white hover:bg-bambu-dark-secondary rounded transition-colors disabled:opacity-50",children:i.jsx(_r,{className:`w-4 h-4 ${x?"animate-spin":""}`})}),i.jsx("div",{className:"flex-1"}),i.jsxs("label",{className:"flex items-center gap-2 text-sm text-bambu-gray cursor-pointer",children:[i.jsx("input",{type:"checkbox",checked:e,onChange:N=>n(N.target.checked),className:"rounded border-bambu-dark-tertiary bg-bambu-dark-tertiary"}),"Auto-scroll"]}),i.jsxs("span",{className:"text-sm text-bambu-gray",children:[y?.filtered_count??0,"/",y?.total_in_file??0]})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs("div",{className:"relative flex-1",children:[i.jsx(Dr,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray"}),i.jsx("input",{type:"text",placeholder:"Search message or logger name...",value:s,onChange:N=>o(N.target.value),className:"w-full pl-8 pr-8 py-1.5 text-sm bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded text-white placeholder-bambu-gray focus:border-bambu-green focus:outline-none"}),s&&i.jsx("button",{onClick:()=>o(""),className:"absolute right-2 top-1/2 -translate-y-1/2 text-bambu-gray hover:text-white",children:i.jsx(zt,{className:"w-4 h-4"})})]}),i.jsxs("div",{className:"flex items-center gap-1 bg-bambu-dark-secondary rounded border border-bambu-dark-tertiary",children:[i.jsx("button",{onClick:()=>c("ALL"),className:`px-2 py-1.5 text-xs rounded-l transition-colors ${l==="ALL"?"bg-bambu-green text-white":"text-bambu-gray hover:text-white"}`,children:"All"}),zK.map((N,R)=>i.jsx("button",{onClick:()=>c(N),className:`px-2 py-1.5 text-xs transition-colors flex items-center gap-1 ${R===zK.length-1?"rounded-r":""} ${l===N?`${iD[N]} bg-bambu-dark-tertiary`:"text-bambu-gray hover:text-white"}`,children:N},N))]})]})]}),i.jsx("div",{ref:f,className:"overflow-auto font-mono text-xs bg-black min-h-[300px] max-h-[500px]",children:P.length===0?i.jsxs("div",{className:"flex flex-col items-center justify-center h-[300px] text-bambu-gray",children:[i.jsx("p",{className:"mb-2",children:"No log entries found"}),i.jsx("p",{className:"text-sm",children:"Log file may be empty or cleared"})]}):i.jsx("div",{className:"divide-y divide-bambu-dark-tertiary/30",children:C.map((N,R)=>{const A=r.has(R),D=N.message.includes(`
- `);return i.jsx("div",{className:`p-2 cursor-pointer hover:bg-bambu-dark-secondary/50 transition-colors ${A?"bg-bambu-dark-secondary/30":""}`,onClick:()=>D&&_(R),children:i.jsxs("div",{className:"flex items-start gap-2",children:[i.jsx("span",{className:"text-bambu-gray/70 shrink-0 w-20",children:k(N.timestamp)}),i.jsx("span",{className:"shrink-0",children:i.jsx(T,{level:N.level})}),i.jsxs("span",{className:"text-purple-400/80 shrink-0 max-w-[200px] truncate",title:N.logger_name,children:["[",N.logger_name,"]"]}),i.jsx("span",{className:`flex-1 ${iD[N.level]||"text-white/80"} ${!A&&D?"truncate":""}`,children:A?i.jsx("pre",{className:"whitespace-pre-wrap break-all",children:N.message}):N.message.split(`
- `)[0]}),D&&i.jsx("span",{className:"text-bambu-gray/50 shrink-0",children:A?i.jsx(vl,{className:"w-3.5 h-3.5"}):i.jsx(In,{className:"w-3.5 h-3.5"})})]})},R)})})}),i.jsx("div",{className:"flex items-center justify-between p-3 border-t border-bambu-dark-tertiary text-sm text-bambu-gray",children:m?i.jsxs("span",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"w-2 h-2 bg-green-500 rounded-full animate-pulse"}),"Auto-refreshing every 2 seconds"]}):i.jsx("span",{children:"Click Start to enable live log streaming"})})]})]})}function Zet(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:t<1024*1024*1024?`${(t/(1024*1024)).toFixed(1)} MB`:`${(t/(1024*1024*1024)).toFixed(2)} GB`}function Mi({icon:t,label:e,value:n,subValue:r,color:a="text-bambu-green"}){return i.jsxs("div",{className:"flex items-start gap-3 p-4 bg-bambu-dark rounded-lg",children:[i.jsx("div",{className:`p-2 rounded-lg bg-bambu-dark-tertiary ${a}`,children:i.jsx(t,{className:"w-5 h-5"})}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsx("p",{className:"text-sm text-bambu-gray",children:e}),i.jsx("p",{className:"text-lg font-semibold text-white truncate",children:n}),r&&i.jsx("p",{className:"text-xs text-bambu-gray mt-0.5",children:r})]})]})}function UK({percent:t,color:e="bg-bambu-green"}){return i.jsx("div",{className:"w-full h-2 bg-bambu-dark rounded-full overflow-hidden",children:i.jsx("div",{className:`h-full ${e} transition-all duration-300`,style:{width:`${Math.min(100,t)}%`}})})}function um({title:t,icon:e,children:n}){return i.jsxs(Tt,{className:"p-6",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[i.jsx(e,{className:"w-5 h-5 text-bambu-green"}),i.jsx("h2",{className:"text-lg font-semibold text-white",children:t})]}),n]})}function Jet(){const{t}=Mt(),e=tn(),[n,r]=w.useState(null),[a,s]=w.useState(!1),[o,l]=w.useState(!1),{data:c,isLoading:d,refetch:u,isFetching:m}=Je({queryKey:["systemInfo"],queryFn:be.getSystemInfo,refetchInterval:3e4}),{data:p}=Je({queryKey:["debugLogging"],queryFn:pb.getDebugLoggingState,staleTime:10*1e3,refetchInterval:10*1e3}),{data:f}=Je({queryKey:["settings"],queryFn:be.getSettings}),{data:y}=Je({queryKey:["library-stats"],queryFn:be.getLibraryStats}),x=f?.time_format||"system",b=async()=>{l(!0);try{const P=await pb.setDebugLogging(!p?.enabled);e.setQueryData(["debugLogging"],P)}catch(P){console.error("Failed to toggle debug logging:",P)}finally{l(!1)}},v=async()=>{r(null),s(!0);try{await pb.downloadSupportBundle()}catch(P){r(P instanceof Error?P.message:"Failed to download support bundle")}finally{s(!1)}};if(d)return i.jsx("div",{className:"flex items-center justify-center h-64",children:i.jsx(ct,{className:"w-8 h-8 text-bambu-green animate-spin"})});if(!c)return i.jsx("div",{className:"p-6 text-center text-bambu-gray",children:t("system.failedToLoad","Failed to load system information")});const _=c.storage.disk_percent_used>90?"bg-red-500":c.storage.disk_percent_used>75?"bg-yellow-500":"bg-bambu-green",k=c.memory.percent_used>90?"bg-red-500":c.memory.percent_used>75?"bg-yellow-500":"bg-bambu-green";return i.jsxs("div",{className:"p-6 space-y-6",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("h1",{className:"text-2xl font-bold text-white",children:t("system.title","System Information")}),i.jsx("p",{className:"text-bambu-gray mt-1",children:t("system.subtitle","Monitor system resources and database statistics")})]}),i.jsxs("button",{onClick:()=>u(),disabled:m,className:"flex items-center gap-2 px-4 py-2 bg-bambu-dark-secondary hover:bg-bambu-dark-tertiary rounded-lg transition-colors disabled:opacity-50",children:[i.jsx(_r,{className:`w-4 h-4 ${m?"animate-spin":""}`}),t("common.refresh","Refresh")]})]}),i.jsx(um,{title:t("system.application","Application"),icon:ep,children:i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[i.jsx(Mi,{icon:ep,label:t("system.version","Version"),value:`v${c.app.version}`}),i.jsx(Mi,{icon:er,label:t("system.uptime","System Uptime"),value:c.system.uptime_formatted}),i.jsx(Mi,{icon:ep,label:t("system.hostname","Hostname"),value:c.system.hostname})]})}),i.jsx(um,{title:t("support.title","Support & Troubleshooting"),icon:Mpe,children:i.jsxs("div",{className:"space-y-4",children:[i.jsx("p",{className:"text-sm text-bambu-gray",children:t("support.description","Enable debug logging to capture detailed information, then download a support bundle to share when reporting issues.")}),i.jsxs("div",{className:"flex items-center justify-between p-4 bg-bambu-dark rounded-lg",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:`p-2 rounded-lg ${p?.enabled?"bg-amber-500/20 text-amber-500":"bg-bambu-dark-tertiary text-bambu-gray"}`,children:i.jsx(Ab,{className:"w-5 h-5"})}),i.jsxs("div",{children:[i.jsx("p",{className:"font-medium text-white",children:t("support.debugLogging","Debug Logging")}),i.jsxs("p",{className:"text-sm text-bambu-gray",children:[p?.enabled?t("support.debugLoggingEnabled","Capturing detailed logs"):t("support.debugLoggingDisabled","Normal logging level"),p?.enabled&&p.duration_seconds!==null&&i.jsxs("span",{className:"text-amber-400 ml-2",children:["(",Math.floor(p.duration_seconds/60),"m ",p.duration_seconds%60,"s)"]})]})]})]}),i.jsxs("button",{onClick:b,disabled:o,className:`px-4 py-2 rounded-lg font-medium transition-colors flex items-center gap-2 ${p?.enabled?"bg-amber-500/20 text-amber-400 hover:bg-amber-500/30":"bg-bambu-green/20 text-bambu-green hover:bg-bambu-green/30"} disabled:opacity-50`,children:[o&&i.jsx(ct,{className:"w-4 h-4 animate-spin"}),p?.enabled?t("support.disableDebug","Disable"):t("support.enableDebug","Enable")]})]}),i.jsxs("div",{className:"flex items-center justify-between p-4 bg-bambu-dark rounded-lg",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"p-2 rounded-lg bg-bambu-dark-tertiary text-bambu-green",children:i.jsx(pi,{className:"w-5 h-5"})}),i.jsxs("div",{children:[i.jsx("p",{className:"font-medium text-white",children:t("support.supportBundle","Support Bundle")}),i.jsx("p",{className:"text-sm text-bambu-gray",children:t("support.supportBundleDescription","Download system info and logs as a ZIP file")})]})]}),i.jsxs("button",{onClick:v,disabled:a||!p?.enabled,className:"px-4 py-2 rounded-lg font-medium bg-bambu-green/20 text-bambu-green hover:bg-bambu-green/30 transition-colors flex items-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed",title:p?.enabled?void 0:t("support.enableDebugFirst","Enable debug logging first"),children:[a&&i.jsx(ct,{className:"w-4 h-4 animate-spin"}),t("common.download","Download")]})]}),n&&i.jsx("div",{className:"p-3 bg-red-500/20 border border-red-500/30 rounded-lg text-red-400 text-sm",children:n}),!p?.enabled&&i.jsx("div",{className:"p-4 bg-bambu-dark-tertiary/50 rounded-lg",children:i.jsxs("p",{className:"text-sm text-bambu-gray",children:[i.jsx("span",{className:"text-amber-400 font-medium",children:t("support.instructions","To report an issue:")}),i.jsx("br",{}),"1. ",t("support.step1","Enable debug logging"),i.jsx("br",{}),"2. ",t("support.step2","Reproduce the issue"),i.jsx("br",{}),"3. ",t("support.step3","Download the support bundle"),i.jsx("br",{}),"4. ",t("support.step4","Attach the ZIP file to your issue report")]})}),i.jsxs("div",{className:"p-4 bg-bambu-dark rounded-lg space-y-3",children:[i.jsx("p",{className:"text-sm font-medium text-white",children:t("support.privacyTitle","What's in the support bundle?")}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 text-sm",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-bambu-green font-medium mb-1",children:t("support.collected","Collected:")}),i.jsxs("ul",{className:"text-bambu-gray space-y-0.5",children:[i.jsxs("li",{children:["• ",t("support.collectItem1","App version and debug mode")]}),i.jsxs("li",{children:["• ",t("support.collectItem2","OS, architecture, Python version")]}),i.jsxs("li",{children:["• ",t("support.collectItem3","Database statistics (counts only)")]}),i.jsxs("li",{children:["• ",t("support.collectItem4","Printer models and nozzle counts")]}),i.jsxs("li",{children:["• ",t("support.collectItem5","Non-sensitive settings (themes, formats)")]}),i.jsxs("li",{children:["• ",t("support.collectItem6","Debug logs (sanitized)")]}),i.jsxs("li",{children:["• ",t("support.collectItem7","Printer connectivity and firmware versions")]}),i.jsxs("li",{children:["• ",t("support.collectItem8","Integration status (Spoolman, MQTT, HA)")]}),i.jsxs("li",{children:["• ",t("support.collectItem9","Network interfaces (subnets only)")]}),i.jsxs("li",{children:["• ",t("support.collectItem10","Python package versions")]}),i.jsxs("li",{children:["• ",t("support.collectItem11","Database health checks")]}),i.jsxs("li",{children:["• ",t("support.collectItem12","Docker environment details")]})]})]}),i.jsxs("div",{children:[i.jsx("p",{className:"text-red-400 font-medium mb-1",children:t("support.notCollected","NOT collected:")}),i.jsxs("ul",{className:"text-bambu-gray space-y-0.5",children:[i.jsxs("li",{children:["• ",t("support.notItem1","Printer names and serial numbers")]}),i.jsxs("li",{children:["• ",t("support.notItem2","Access codes and passwords")]}),i.jsxs("li",{children:["• ",t("support.notItem3","Email addresses")]}),i.jsxs("li",{children:["• ",t("support.notItem4","API keys and tokens")]}),i.jsxs("li",{children:["• ",t("support.notItem5","Webhook URLs")]}),i.jsxs("li",{children:["• ",t("support.notItem6","Your hostname or username")]}),i.jsxs("li",{children:["• ",t("support.notItem7","IP addresses")]})]})]})]}),i.jsx("p",{className:"text-xs text-bambu-gray/70",children:t("support.privacyNote","Email addresses in logs are replaced with [EMAIL], printer names with [PRINTER], serial numbers with [SERIAL], and IP addresses with [IP].")})]}),i.jsx(Qet,{})]})}),i.jsxs(um,{title:t("system.database","Database"),icon:Ic,children:[i.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 mb-4",children:[i.jsx(Mi,{icon:Fs,label:t("system.totalArchives","Total Archives"),value:c.database.archives}),i.jsx(Mi,{icon:Eb,label:t("system.completed","Completed"),value:c.database.archives_completed,color:"text-green-500"}),i.jsx(Mi,{icon:qi,label:t("system.failed","Failed"),value:c.database.archives_failed,color:"text-red-500"}),i.jsx(Mi,{icon:ct,label:t("system.printing","Printing"),value:c.database.archives_printing,color:"text-yellow-500"})]}),i.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[i.jsx(Mi,{icon:kr,label:t("system.printers","Printers"),value:c.database.printers}),i.jsx(Mi,{icon:F0,label:t("system.filaments","Filaments"),value:c.database.filaments}),i.jsx(Mi,{icon:fs,label:t("system.projects","Projects"),value:c.database.projects}),i.jsx(Mi,{icon:fl,label:t("system.smartPlugs","Smart Plugs"),value:c.database.smart_plugs})]}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mt-4",children:[i.jsx(Mi,{icon:er,label:t("system.totalPrintTime","Total Print Time"),value:c.database.total_print_time_formatted}),i.jsx(Mi,{icon:Fs,label:t("system.totalFilament","Total Filament Used"),value:`${c.database.total_filament_kg} kg`,subValue:`${c.database.total_filament_grams.toLocaleString()} g`})]})]}),i.jsxs(um,{title:t("system.connectedPrinters","Connected Printers"),icon:kr,children:[i.jsxs("div",{className:"flex items-center gap-4 mb-4",children:[i.jsx("div",{className:"text-3xl font-bold text-bambu-green",children:c.printers.connected}),i.jsx("div",{className:"text-bambu-gray",children:t("system.ofTotal","of {{total}} printers connected",{total:c.printers.total})})]}),c.printers.connected_list.length>0?i.jsx("div",{className:"space-y-2",children:c.printers.connected_list.map(P=>i.jsxs("div",{className:"flex items-center justify-between p-3 bg-bambu-dark rounded-lg",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"w-2 h-2 rounded-full bg-bambu-green"}),i.jsx("span",{className:"font-medium text-white",children:P.name})]}),i.jsxs("div",{className:"flex items-center gap-4 text-sm text-bambu-gray",children:[i.jsx("span",{children:P.model}),i.jsx("span",{className:`px-2 py-0.5 rounded ${P.state==="RUNNING"?"bg-bambu-green/20 text-bambu-green":P.state==="IDLE"?"bg-blue-500/20 text-blue-400":"bg-bambu-dark-tertiary"}`,children:P.state})]})]},P.id))}):i.jsx("p",{className:"text-bambu-gray",children:t("system.noPrintersConnected","No printers connected")})]}),i.jsx(um,{title:t("system.storage","Storage"),icon:cx,children:i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{children:[i.jsxs("div",{className:"flex justify-between text-sm mb-1",children:[i.jsx("span",{className:"text-bambu-gray",children:t("system.diskUsage","Disk Usage")}),i.jsxs("span",{className:"text-white",children:[c.storage.disk_used_formatted," / ",c.storage.disk_total_formatted]})]}),i.jsx(UK,{percent:c.storage.disk_percent_used,color:_}),i.jsxs("p",{className:"text-xs text-bambu-gray mt-1",children:[c.storage.disk_free_formatted," ",t("system.free","free")," (",(100-c.storage.disk_percent_used).toFixed(1),"%)"]})]}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[i.jsx(Mi,{icon:Fs,label:t("system.archiveStorage","Archive Storage"),value:c.storage.archive_size_formatted}),i.jsx(Mi,{icon:Ic,label:t("system.databaseSize","Database Size"),value:c.storage.database_size_formatted}),y&&i.jsx(Mi,{icon:nc,label:t("system.fileManagerStorage","File Manager"),value:Zet(y.total_size_bytes),subValue:`${y.total_files} files, ${y.total_folders} folders`})]})]})}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[i.jsx(um,{title:t("system.memory","Memory"),icon:lfe,children:i.jsx("div",{className:"space-y-4",children:i.jsxs("div",{children:[i.jsxs("div",{className:"flex justify-between text-sm mb-1",children:[i.jsx("span",{className:"text-bambu-gray",children:t("system.memoryUsage","Memory Usage")}),i.jsxs("span",{className:"text-white",children:[c.memory.used_formatted," / ",c.memory.total_formatted]})]}),i.jsx(UK,{percent:c.memory.percent_used,color:k}),i.jsxs("p",{className:"text-xs text-bambu-gray mt-1",children:[c.memory.available_formatted," ",t("system.available","available")]})]})})}),i.jsx(um,{title:t("system.cpu","CPU"),icon:_S,children:i.jsx("div",{className:"space-y-4",children:i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsx(Mi,{icon:_S,label:t("system.cores","Cores"),value:c.cpu.count,subValue:`${c.cpu.count_logical} logical`}),i.jsx(Mi,{icon:_S,label:t("system.usage","Usage"),value:`${c.cpu.percent}%`})]})})})]}),i.jsx(um,{title:t("system.systemDetails","System Details"),icon:ep,children:i.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[i.jsx(Mi,{icon:ep,label:t("system.os","Operating System"),value:c.system.platform,subValue:c.system.platform_release}),i.jsx(Mi,{icon:_S,label:t("system.architecture","Architecture"),value:c.system.architecture}),i.jsx(Mi,{icon:ep,label:t("system.python","Python"),value:c.system.python_version}),i.jsx(Mi,{icon:er,label:t("system.bootTime","Boot Time"),value:Wp(c.system.boot_time,x)})]})})]})}function ett(){const t=Ml(),{t:e}=Mt(),{login:n}=Rr(),{showToast:r}=bn(),{mode:a}=bf(),[s,o]=w.useState(""),[l,c]=w.useState(""),[d,u]=w.useState(!1),[m,p]=w.useState(""),{data:f}=Je({queryKey:["advancedAuthStatus"],queryFn:()=>be.getAdvancedAuthStatus()}),y=ut({mutationFn:()=>n(s,l),onSuccess:()=>{r(e("login.loginSuccess")),t("/")},onError:_=>{r(_.message||e("login.loginFailed"),"error")}}),x=ut({mutationFn:_=>be.forgotPassword({email:_}),onSuccess:_=>{r(_.message,"success"),u(!1),p("")},onError:_=>{r(_.message,"error")}}),b=_=>{if(_.preventDefault(),!s||!l){r(e("login.enterCredentials"),"error");return}y.mutate()},v=_=>{if(_.preventDefault(),!m){r("Please enter your email address","error");return}x.mutate(m)};return i.jsxs("div",{className:"min-h-screen flex items-center justify-center bg-bambu-dark p-4",children:[i.jsxs("div",{className:"max-w-md w-full space-y-8 p-8 bg-gradient-to-br from-bambu-card to-bambu-dark-secondary rounded-xl border border-bambu-dark-tertiary shadow-lg",children:[i.jsxs("div",{className:"text-center",children:[i.jsx("div",{className:"flex items-center justify-center mb-6",children:i.jsx("img",{src:a==="dark"?"/img/bambuddy_logo_dark_transparent.png":"/img/bambuddy_logo_light.png",alt:"Bambuddy",className:"h-16"})}),i.jsx("h2",{className:"text-3xl font-bold text-white",children:e("login.title")}),i.jsx("p",{className:"mt-2 text-sm text-bambu-gray",children:e("login.subtitle")})]}),i.jsxs("form",{className:"mt-8 space-y-6",onSubmit:b,children:[i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{children:[i.jsx("label",{htmlFor:"username",className:"block text-sm font-medium text-white mb-2",children:f?.advanced_auth_enabled?e("login.usernameOrEmail")||"Username or Email":e("login.username")}),i.jsx("input",{id:"username",type:"text",required:!0,value:s,onChange:_=>o(_.target.value),className:"block w-full px-4 py-3 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:border-bambu-green transition-colors",placeholder:f?.advanced_auth_enabled?e("login.usernameOrEmailPlaceholder")||"Enter your username or email":e("login.usernamePlaceholder"),autoComplete:"username"})]}),i.jsxs("div",{children:[i.jsx("label",{htmlFor:"password",className:"block text-sm font-medium text-white mb-2",children:e("login.password")}),i.jsx("input",{id:"password",type:"password",required:!0,value:l,onChange:_=>c(_.target.value),className:"block w-full px-4 py-3 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:border-bambu-green transition-colors",placeholder:e("login.passwordPlaceholder"),autoComplete:"current-password"})]})]}),i.jsx("div",{children:i.jsx("button",{type:"submit",disabled:y.isPending,className:"w-full flex justify-center py-3 px-4 bg-bambu-green hover:bg-bambu-green-light text-white font-medium rounded-lg shadow-lg shadow-bambu-green/20 hover:shadow-bambu-green/30 focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:ring-offset-2 focus:ring-offset-bambu-dark-secondary transition-all disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-bambu-green",children:y.isPending?e("login.signingIn"):e("login.signIn")})}),f?.advanced_auth_enabled&&i.jsx("div",{className:"text-center",children:i.jsx("button",{type:"button",onClick:()=>u(!0),className:"text-sm text-bambu-gray hover:text-bambu-green transition-colors",children:e("login.forgotPassword")})})]})]}),d&&i.jsx("div",{className:"fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-4",onClick:()=>u(!1),children:i.jsxs(Tt,{className:"w-full max-w-md",onClick:_=>_.stopPropagation(),children:[i.jsx(Wn,{children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(Lv,{className:"w-5 h-5 text-bambu-green"}),i.jsx("h2",{className:"text-lg font-semibold text-white",children:e("login.forgotPasswordTitle")})]}),i.jsx(Fe,{variant:"ghost",size:"sm",onClick:()=>{u(!1),p("")},children:i.jsx(zt,{className:"w-5 h-5"})})]})}),i.jsx(Pt,{children:f?.advanced_auth_enabled?i.jsxs("form",{onSubmit:v,className:"space-y-4",children:[i.jsx("p",{className:"text-bambu-gray text-sm",children:e("login.forgotPasswordEmailMessage")||"Enter your email address and we'll send you a new password."}),i.jsxs("div",{children:[i.jsx("label",{htmlFor:"forgot-email",className:"block text-sm font-medium text-white mb-2",children:e("login.emailAddress")||"Email Address"}),i.jsx("input",{id:"forgot-email",type:"email",required:!0,value:m,onChange:_=>p(_.target.value),className:"block w-full px-4 py-3 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:border-bambu-green transition-colors",placeholder:e("login.emailPlaceholder")||"your.email@example.com"})]}),i.jsxs("div",{className:"flex gap-2",children:[i.jsx(Fe,{type:"button",variant:"secondary",className:"flex-1",onClick:()=>{u(!1),p("")},children:e("login.cancel")||"Cancel"}),i.jsx(Fe,{type:"submit",className:"flex-1",disabled:x.isPending,children:x.isPending?e("login.sending")||"Sending...":e("login.sendResetEmail")||"Send Reset Email"})]})]}):i.jsxs("div",{className:"space-y-4",children:[i.jsx("p",{className:"text-bambu-gray",children:e("login.forgotPasswordMessage")}),i.jsxs("div",{className:"bg-bambu-dark rounded-lg p-4 space-y-2",children:[i.jsx("p",{className:"text-sm text-white font-medium",children:e("login.howToReset")}),i.jsxs("ol",{className:"text-sm text-bambu-gray space-y-1 list-decimal list-inside",children:[i.jsx("li",{children:e("login.resetStep1")}),i.jsx("li",{children:e("login.resetStep2")}),i.jsx("li",{children:e("login.resetStep3")}),i.jsx("li",{children:e("login.resetStep4")})]})]}),i.jsx(Fe,{variant:"secondary",className:"w-full",onClick:()=>u(!1),children:e("login.gotIt")})]})})]})})]})}function ttt(){const t=Ml(),{t:e}=Mt(),{showToast:n}=bn(),{mode:r}=bf(),{refreshAuth:a}=Rr(),[s,o]=w.useState(!1),[l,c]=w.useState(""),[d,u]=w.useState(""),[m,p]=w.useState(""),f=ut({mutationFn:()=>be.setupAuth({auth_enabled:s,admin_username:s?l:void 0,admin_password:s?d:void 0}),onSuccess:async x=>{await a(),x.auth_enabled?x.admin_created?(n(e("setup.toast.authEnabledAdminCreated")),t("/login")):(n(e("setup.toast.authEnabledExistingAdmins")),t("/login")):(n(e("setup.toast.setupCompleted")),t("/"))},onError:x=>{n(x.message,"error")}}),y=x=>{if(x.preventDefault(),s&&(l||d)){if(!l||!d){n(e("setup.toast.enterBothCredentials"),"error");return}if(d!==m){n(e("setup.toast.passwordsDoNotMatch"),"error");return}if(d.length<6){n(e("setup.toast.passwordTooShort"),"error");return}}f.mutate()};return i.jsx("div",{className:"min-h-screen flex items-center justify-center bg-bambu-dark p-4",children:i.jsxs("div",{className:"max-w-md w-full space-y-8 p-8 bg-gradient-to-br from-bambu-card to-bambu-dark-secondary rounded-xl border border-bambu-dark-tertiary shadow-lg",children:[i.jsxs("div",{className:"text-center",children:[i.jsx("div",{className:"flex items-center justify-center mb-6",children:i.jsx("img",{src:r==="dark"?"/img/bambuddy_logo_dark_transparent.png":"/img/bambuddy_logo_light.png",alt:"Bambuddy",className:"h-16"})}),i.jsx("h2",{className:"text-3xl font-bold text-white",children:e("setup.title")}),i.jsx("p",{className:"mt-2 text-sm text-bambu-gray",children:e("setup.subtitle")})]}),i.jsxs("form",{className:"mt-8 space-y-6",onSubmit:y,children:[i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"flex items-center p-4 bg-bambu-dark-secondary/50 rounded-lg border border-bambu-dark-tertiary",children:[i.jsx("input",{id:"auth-enabled",type:"checkbox",checked:s,onChange:x=>o(x.target.checked),className:"h-4 w-4 text-bambu-green focus:ring-bambu-green border-bambu-dark-tertiary rounded bg-bambu-dark-secondary"}),i.jsx("label",{htmlFor:"auth-enabled",className:"ml-3 block text-sm font-medium text-white",children:e("setup.enableAuth")})]}),s&&i.jsxs("div",{className:"space-y-4 mt-4",children:[i.jsx("div",{className:"p-3 bg-bambu-dark-secondary/50 border border-bambu-dark-tertiary rounded-lg",children:i.jsxs("div",{className:"flex items-start gap-2",children:[i.jsx(js,{className:"w-4 h-4 text-bambu-green mt-0.5 flex-shrink-0"}),i.jsxs("div",{className:"text-sm text-bambu-gray",children:[i.jsx("p",{className:"text-white font-medium mb-1",children:e("setup.adminAccount")}),i.jsx("p",{children:e("setup.adminAccountDesc")})]})]})}),i.jsxs("div",{children:[i.jsxs("label",{htmlFor:"admin-username",className:"block text-sm font-medium text-white mb-2",children:[e("setup.adminUsername")," ",i.jsx("span",{className:"text-bambu-gray text-xs",children:e("setup.optionalIfAdminExists")})]}),i.jsx("input",{id:"admin-username",type:"text",value:l,onChange:x=>c(x.target.value),className:"block w-full px-4 py-3 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:border-bambu-green transition-colors",placeholder:e("setup.adminUsernamePlaceholder"),autoComplete:"username"})]}),i.jsxs("div",{children:[i.jsxs("label",{htmlFor:"admin-password",className:"block text-sm font-medium text-white mb-2",children:[e("setup.adminPassword")," ",i.jsx("span",{className:"text-bambu-gray text-xs",children:e("setup.optionalIfAdminExists")})]}),i.jsx("input",{id:"admin-password",type:"password",value:d,onChange:x=>u(x.target.value),className:"block w-full px-4 py-3 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:border-bambu-green transition-colors",placeholder:e("setup.adminPasswordPlaceholder"),minLength:6,autoComplete:"new-password"})]}),d&&i.jsxs("div",{children:[i.jsx("label",{htmlFor:"confirm-password",className:"block text-sm font-medium text-white mb-2",children:e("setup.confirmPassword")}),i.jsx("input",{id:"confirm-password",type:"password",value:m,onChange:x=>p(x.target.value),className:"block w-full px-4 py-3 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:border-bambu-green transition-colors",placeholder:e("setup.confirmPasswordPlaceholder"),minLength:6,autoComplete:"new-password"})]})]})]}),i.jsx("div",{children:i.jsx("button",{type:"submit",disabled:f.isPending,className:"w-full flex justify-center py-3 px-4 bg-bambu-green hover:bg-bambu-green-light text-white font-medium rounded-lg shadow-lg shadow-bambu-green/20 hover:shadow-bambu-green/30 focus:outline-none focus:ring-2 focus:ring-bambu-green/50 focus:ring-offset-2 focus:ring-offset-bambu-dark-secondary transition-all disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-bambu-green",children:f.isPending?e("setup.settingUp"):e("setup.completeSetup")})})]})]})})}function ntt(){const t=w.useRef(null),e=w.useRef(null),n=tn(),[r,a]=w.useState(!1),s=w.useRef(new Set),o=w.useRef(null),l=w.useRef(new Map),c=w.useRef(null),d=w.useRef([]),u=w.useRef(!1),m=w.useRef(()=>{}),p=w.useCallback(()=>{if(u.current||d.current.length===0)return;u.current=!0;const _=()=>{const k=d.current.shift();k?requestAnimationFrame(()=>{m.current(k),d.current.length>0?setTimeout(_,16):u.current=!1}):u.current=!1};_()},[]),f=w.useCallback(()=>{if(t.current?.readyState===WebSocket.OPEN)return;const k=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/api/v1/ws`,P=new WebSocket(k);let C=null;P.onopen=()=>{console.log("[WebSocket] Connected"),a(!0),C=window.setInterval(()=>{P.readyState===WebSocket.OPEN&&P.send(JSON.stringify({type:"ping"}))},3e4)},P.onmessage=T=>{try{const N=JSON.parse(T.data);N.type==="printer_status"&&N.printer_id!==void 0&&N.data?m.current(N):(d.current.push(N),p())}catch{}},P.onclose=T=>{console.log("[WebSocket] Closed",T.code,T.reason),C&&(clearInterval(C),C=null),a(!1),t.current=null,e.current=window.setTimeout(()=>{f()},3e3)},P.onerror=T=>{console.error("[WebSocket] Error",T),P.close()},t.current=P},[p]),y=w.useCallback((_,k)=>{const P=l.current.get(_)||{};l.current.set(_,{...P,...k}),c.current||(c.current=window.setTimeout(()=>{const C=new Map(l.current);l.current.clear(),c.current=null,requestAnimationFrame(()=>{C.forEach((T,N)=>{n.setQueryData(["printerStatus",N],R=>{const A={...R,...T};return A.wifi_signal==null&&R?.wifi_signal!=null&&(A.wifi_signal=R.wifi_signal),A})})})},100))},[n]),x=w.useCallback(_=>{s.current.add(_),o.current&&clearTimeout(o.current),o.current=window.setTimeout(()=>{const k=Array.from(s.current);s.current.clear(),o.current=null;let P=0;k.forEach(C=>{setTimeout(()=>{requestAnimationFrame(()=>{n.invalidateQueries({queryKey:[C]})})},P),P+=500})},3e3)},[n]),b=w.useCallback(_=>{switch(_.type){case"printer_status":_.printer_id!==void 0&&_.data&&y(_.printer_id,_.data);break;case"print_start":_.printer_id!==void 0&&n.invalidateQueries({queryKey:["printerStatus",_.printer_id]});break;case"print_complete":x("archives"),x("archiveStats");break;case"archive_created":x("archives"),x("archiveStats");break;case"archive_updated":x("archives");break;case"pong":break;case"plate_not_empty":window.dispatchEvent(new CustomEvent("plate-not-empty",{detail:{printer_id:_.printer_id,printer_name:_.printer_name,message:_.message}}));break;case"spool_auto_assigned":x("inventory-spools"),x("spool-assignments");break;case"spool_usage_logged":x("inventory-spools");break;case"unknown_tag":window.dispatchEvent(new CustomEvent("unknown-tag",{detail:{printer_id:_.printer_id,ams_id:_.ams_id,tray_id:_.tray_id,tag_uid:_.tag_uid,tray_uuid:_.tray_uuid}}));break;case"background_dispatch":window.dispatchEvent(new CustomEvent("background-dispatch",{detail:_.data||{}}));break;case"spoolbuddy_weight":window.dispatchEvent(new CustomEvent("spoolbuddy-weight",{detail:_}));break;case"spoolbuddy_tag_matched":window.dispatchEvent(new CustomEvent("spoolbuddy-tag-matched",{detail:_})),x("inventory-spools");break;case"spoolbuddy_unknown_tag":window.dispatchEvent(new CustomEvent("spoolbuddy-unknown-tag",{detail:_}));break;case"spoolbuddy_tag_removed":window.dispatchEvent(new CustomEvent("spoolbuddy-tag-removed",{detail:_}));break;case"spoolbuddy_tag_written":window.dispatchEvent(new CustomEvent("spoolbuddy-tag-written",{detail:_})),x("inventory-spools");break;case"spoolbuddy_tag_write_failed":window.dispatchEvent(new CustomEvent("spoolbuddy-tag-write-failed",{detail:_}));break;case"spoolbuddy_online":window.dispatchEvent(new CustomEvent("spoolbuddy-online",{detail:_}));break;case"spoolbuddy_offline":window.dispatchEvent(new CustomEvent("spoolbuddy-offline",{detail:_}));break}},[n,x,y]);w.useEffect(()=>{m.current=b},[b]),w.useEffect(()=>(f(),()=>{e.current&&clearTimeout(e.current),o.current&&clearTimeout(o.current),c.current&&clearTimeout(c.current),t.current&&t.current.close()}),[f]);const v=w.useCallback(_=>{t.current?.readyState===WebSocket.OPEN&&t.current.send(JSON.stringify(_))},[]);return{isConnected:r,sendMessage:v}}function rtt({selectedPrinterId:t,onPrinterChange:e,deviceOnline:n}){const{t:r}=Mt(),[a,s]=w.useState(new Date),{data:o=[]}=Je({queryKey:["printers"],queryFn:()=>be.getPrinters()}),l=gf({queries:o.map(u=>({queryKey:["printerStatus",u.id],queryFn:()=>be.getPrinterStatus(u.id),refetchInterval:1e4}))}),c=w.useMemo(()=>o.filter((u,m)=>l[m]?.data?.connected),[o,l]);w.useEffect(()=>{const u=c.some(m=>m.id===t);(!t||!u)&&c.length>0&&e(c[0].id)},[c,t,e]);const{data:d}=Je({queryKey:["settings"],queryFn:be.getSettings});return w.useEffect(()=>{const u=setInterval(()=>s(new Date),1e3);return()=>clearInterval(u)},[]),i.jsxs("div",{className:"h-12 bg-bambu-dark-secondary border-b border-bambu-dark-tertiary flex items-center px-3 gap-4 shrink-0",children:[i.jsx("div",{className:"flex items-center shrink-0",children:i.jsx("img",{src:"/img/spoolbuddy_logo_dark_small.png",alt:"SpoolBuddy",width:113,height:28,className:"h-7 w-auto"})}),i.jsx("div",{className:"flex-1 flex justify-center",children:i.jsx("select",{value:t??"",onChange:u=>e(Number(u.target.value)),className:"bg-bambu-dark text-white text-base px-4 py-2 rounded border border-bambu-dark-tertiary focus:outline-none focus:border-bambu-green min-w-[180px]",children:c.length===0?i.jsx("option",{value:"",children:r("spoolbuddy.status.noPrinters","No printers online")}):c.map(u=>i.jsx("option",{value:u.id,children:u.name},u.id))})}),i.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[i.jsx("div",{className:"flex items-center",title:n?r("spoolbuddy.status.backend","Backend"):r("spoolbuddy.status.offline","Offline"),children:n?i.jsx("div",{className:"flex items-end gap-0.5 h-4",children:[1,2,3,4].map(u=>i.jsx("div",{className:`w-1 rounded-sm ${u<=4?"bg-white":"bg-bambu-dark-tertiary"}`,style:{height:`${u*4}px`}},u))}):i.jsx(rh,{className:"w-5 h-5 text-red-400"})}),i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx("div",{className:`w-3 h-3 rounded-full ${n?"bg-bambu-green shadow-[0_0_6px_rgba(34,197,94,0.5)]":"bg-bambu-gray"}`}),i.jsx("span",{className:"text-sm text-white/50",children:n?r("spoolbuddy.status.backend","Backend"):r("spoolbuddy.status.offline","Offline")})]}),i.jsx("span",{className:"text-white/50 text-base font-mono min-w-[50px] text-right",children:cX(a,d?.time_format||"system")})]})]})}const itt=[{to:"/spoolbuddy",labelKey:"spoolbuddy.nav.dashboard",fallback:"Dashboard",icon:i.jsx("svg",{className:"w-6 h-6",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6"})})},{to:"/spoolbuddy/ams",labelKey:"spoolbuddy.nav.ams",fallback:"AMS",icon:i.jsx("svg",{className:"w-6 h-6",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10"})})},{to:"/spoolbuddy/write-tag",labelKey:"spoolbuddy.nav.writeTag",fallback:"Write",icon:i.jsxs("svg",{className:"w-6 h-6",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:[i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8.288 15.038a5.25 5.25 0 017.424 0M5.106 11.856c3.807-3.808 9.98-3.808 13.788 0M1.924 8.674c5.565-5.565 14.587-5.565 20.152 0"}),i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12.53 18.22l-.53.53-.53-.53a.75.75 0 011.06 0z"})]})},{to:"/spoolbuddy/settings",labelKey:"spoolbuddy.nav.settings",fallback:"Settings",icon:i.jsxs("svg",{className:"w-6 h-6",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:[i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.066 2.573c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.573 1.066c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.066-2.573c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]})}];function att(){const{t}=Mt();return i.jsx("nav",{className:"h-14 bg-bambu-dark-secondary border-t border-bambu-dark-tertiary flex items-stretch shrink-0",children:itt.map(e=>i.jsxs(rb,{to:e.to,end:e.to==="/spoolbuddy",className:({isActive:n})=>`flex-1 flex flex-col items-center justify-center gap-1 transition-colors ${n?"text-bambu-green bg-bambu-dark":"text-white/50 hover:text-white/70 hover:bg-bambu-dark-tertiary"}`,children:[e.icon,i.jsx("span",{className:"text-xs font-medium",children:t(e.labelKey,e.fallback)})]},e.to))})}function stt({alert:t}){const{t:e}=Mt(),n=t?t.type==="error"?"bg-red-500":t.type==="warning"?"bg-amber-500":"bg-bambu-green":"bg-bambu-green",r=t?t.type==="error"?"border-red-500":t.type==="warning"?"border-amber-500":"border-bambu-dark-tertiary":"border-bambu-dark-tertiary";return i.jsxs("div",{className:`h-9 bg-bambu-dark-secondary border-t-2 ${r} flex items-center px-3 gap-3 shrink-0`,children:[i.jsx("div",{className:`w-3.5 h-3.5 rounded-full ${n} animate-pulse`}),i.jsx("div",{className:"flex-1 text-sm text-white/50 truncate",children:t?i.jsx("span",{children:t.message}):i.jsx("span",{className:"text-bambu-green",children:e("spoolbuddy.status.systemReady","System Ready")})})]})}const ott={weight:null,weightStable:!1,rawAdc:null,matchedSpool:null,unknownTagUid:null,deviceOnline:!1,deviceId:null};function ltt(t,e){switch(e.type){case"WEIGHT_UPDATE":return{...t,weight:e.weight,weightStable:e.stable,rawAdc:e.rawAdc,deviceId:e.deviceId,deviceOnline:!0};case"TAG_MATCHED":return{...t,matchedSpool:e.spool,unknownTagUid:null,deviceId:e.deviceId};case"UNKNOWN_TAG":return{...t,matchedSpool:null,unknownTagUid:e.tagUid,deviceId:e.deviceId};case"TAG_REMOVED":return{...t,matchedSpool:null,unknownTagUid:null};case"DEVICE_ONLINE":return{...t,deviceOnline:!0,deviceId:e.deviceId};case"DEVICE_OFFLINE":return{...t,deviceOnline:!1,weight:null,weightStable:!1,rawAdc:null};default:return t}}function ctt(){const[t,e]=w.useReducer(ltt,ott),n=w.useCallback(u=>{const m=u.detail;e({type:"WEIGHT_UPDATE",weight:m.weight_grams??m.data?.weight_grams,stable:m.stable??m.data?.stable??!1,rawAdc:m.raw_adc??m.data?.raw_adc??null,deviceId:m.device_id??m.data?.device_id??""})},[]),r=w.useCallback(u=>{const m=u.detail,p=m.spool??m.data?.spool;p&&e({type:"TAG_MATCHED",spool:{id:p.id,tag_uid:m.tag_uid??m.data?.tag_uid??"",material:p.material??"",subtype:p.subtype??null,color_name:p.color_name??null,rgba:p.rgba??null,brand:p.brand??null,label_weight:p.label_weight??0,core_weight:p.core_weight??0,weight_used:p.weight_used??0},deviceId:m.device_id??m.data?.device_id??""})},[]),a=w.useCallback(u=>{const m=u.detail;e({type:"UNKNOWN_TAG",tagUid:m.tag_uid??m.data?.tag_uid??"",deviceId:m.device_id??m.data?.device_id??""})},[]),s=w.useCallback(u=>{const m=u.detail;e({type:"TAG_REMOVED",deviceId:m.device_id??m.data?.device_id??""})},[]),o=w.useCallback(u=>{const m=u.detail;e({type:"DEVICE_ONLINE",deviceId:m.device_id??m.data?.device_id??""})},[]),l=w.useCallback(u=>{const m=u.detail;e({type:"DEVICE_OFFLINE",deviceId:m.device_id??m.data?.device_id??""})},[]);w.useEffect(()=>(window.addEventListener("spoolbuddy-weight",n),window.addEventListener("spoolbuddy-tag-matched",r),window.addEventListener("spoolbuddy-unknown-tag",a),window.addEventListener("spoolbuddy-tag-removed",s),window.addEventListener("spoolbuddy-online",o),window.addEventListener("spoolbuddy-offline",l),()=>{window.removeEventListener("spoolbuddy-weight",n),window.removeEventListener("spoolbuddy-tag-matched",r),window.removeEventListener("spoolbuddy-unknown-tag",a),window.removeEventListener("spoolbuddy-tag-removed",s),window.removeEventListener("spoolbuddy-online",o),window.removeEventListener("spoolbuddy-offline",l)}),[n,r,a,s,o,l]);const c=t.matchedSpool?Math.max(0,t.matchedSpool.label_weight-t.matchedSpool.weight_used):null,d=t.weight!==null&&t.matchedSpool?Math.max(0,t.weight-t.matchedSpool.core_weight):null;return{...t,remainingWeight:c,netWeight:d}}var R1={exports:{}};var dtt=R1.exports,BK;function utt(){return BK||(BK=1,(function(t,e){(function(n,r){t.exports=r(pf())})(dtt,(function(n){return(function(){var r={981:function(){typeof Element>"u"||"remove"in Element.prototype||(Element.prototype.remove=function(){this.parentNode&&this.parentNode.removeChild(this)}),typeof self<"u"&&"document"in self&&((!("classList"in document.createElement("_"))||document.createElementNS&&!("classList"in document.createElementNS("http://www.w3.org/2000/svg","g")))&&(function(l){if("Element"in l){var c="classList",d="prototype",u=l.Element[d],m=Object,p=String[d].trim||function(){return this.replace(/^\s+|\s+$/g,"")},f=Array[d].indexOf||function(P){for(var C=0,T=this.length;C<T;C++)if(C in this&&this[C]===P)return C;return-1},y=function(P,C){this.name=P,this.code=DOMException[P],this.message=C},x=function(P,C){if(C==="")throw new y("SYNTAX_ERR","The token must not be empty.");if(/\s/.test(C))throw new y("INVALID_CHARACTER_ERR","The token must not contain space characters.");return f.call(P,C)},b=function(P){for(var C=p.call(P.getAttribute("class")||""),T=C?C.split(/\s+/):[],N=0,R=T.length;N<R;N++)this.push(T[N]);this._updateClassName=function(){P.setAttribute("class",this.toString())}},v=b[d]=[],_=function(){return new b(this)};if(y[d]=Error[d],v.item=function(P){return this[P]||null},v.contains=function(P){return~x(this,P+"")},v.add=function(){var P,C=arguments,T=0,N=C.length,R=!1;do~x(this,P=C[T]+"")||(this.push(P),R=!0);while(++T<N);R&&this._updateClassName()},v.remove=function(){var P,C,T=arguments,N=0,R=T.length,A=!1;do for(C=x(this,P=T[N]+"");~C;)this.splice(C,1),A=!0,C=x(this,P);while(++N<R);A&&this._updateClassName()},v.toggle=function(P,C){var T=this.contains(P),N=T?C!==!0&&"remove":C!==!1&&"add";return N&&this[N](P),C===!0||C===!1?C:!T},v.replace=function(P,C){var T=x(P+"");~T&&(this.splice(T,1,C),this._updateClassName())},v.toString=function(){return this.join(" ")},m.defineProperty){var k={get:_,enumerable:!0,configurable:!0};try{m.defineProperty(u,c,k)}catch(P){P.number!==void 0&&P.number!==-2146823252||(k.enumerable=!1,m.defineProperty(u,c,k))}}else m[d].__defineGetter__&&u.__defineGetter__(c,_)}})(self),(function(){var l=document.createElement("_");if(l.classList.add("c1","c2"),!l.classList.contains("c2")){var c=function(u){var m=DOMTokenList.prototype[u];DOMTokenList.prototype[u]=function(p){var f,y=arguments.length;for(f=0;f<y;f++)p=arguments[f],m.call(this,p)}};c("add"),c("remove")}if(l.classList.toggle("c3",!1),l.classList.contains("c3")){var d=DOMTokenList.prototype.toggle;DOMTokenList.prototype.toggle=function(u,m){return 1 in arguments&&!this.contains(u)==!m?m:d.call(this,u)}}"replace"in document.createElement("_").classList||(DOMTokenList.prototype.replace=function(u,m){var p=this.toString().split(" "),f=p.indexOf(u+"");~f&&(p=p.slice(f),this.remove.apply(this,p),this.add(m),this.add.apply(this,p.slice(1)))}),l=null})())},548:function(l){l.exports=(function(){var c={9306:function(q,Z,j){var E=j(4901),I=j(6823),W=TypeError;q.exports=function(B){if(E(B))return B;throw new W(I(B)+" is not a function")}},5548:function(q,Z,j){var E=j(3517),I=j(6823),W=TypeError;q.exports=function(B){if(E(B))return B;throw new W(I(B)+" is not a constructor")}},3506:function(q,Z,j){var E=j(3925),I=String,W=TypeError;q.exports=function(B){if(E(B))return B;throw new W("Can't set "+I(B)+" as a prototype")}},6469:function(q,Z,j){var E=j(8227),I=j(2360),W=j(4913).f,B=E("unscopables"),ae=Array.prototype;ae[B]===void 0&&W(ae,B,{configurable:!0,value:I(null)}),q.exports=function(z){ae[B][z]=!0}},7829:function(q,Z,j){var E=j(8183).charAt;q.exports=function(I,W,B){return W+(B?E(I,W).length:1)}},8551:function(q,Z,j){var E=j(34),I=String,W=TypeError;q.exports=function(B){if(E(B))return B;throw new W(I(B)+" is not an object")}},235:function(q,Z,j){var E=j(9213).forEach,I=j(4598)("forEach");q.exports=I?[].forEach:function(W){return E(this,W,arguments.length>1?arguments[1]:void 0)}},7916:function(q,Z,j){var E=j(6080),I=j(9565),W=j(8981),B=j(6319),ae=j(4209),z=j(3517),V=j(6198),ee=j(4659),K=j(4527),ne=j(81),se=j(851),ce=Array;q.exports=function(fe){var oe=W(fe),O=z(this),F=arguments.length,Q=F>1?arguments[1]:void 0,ve=Q!==void 0;ve&&(Q=E(Q,F>2?arguments[2]:void 0));var he,de,Ae,_e,ze,Be,Ue=se(oe),Ne=0;if(!Ue||this===ce&&ae(Ue))for(he=V(oe),de=O?new this(he):ce(he);he>Ne;Ne++)Be=ve?Q(oe[Ne],Ne):oe[Ne],ee(de,Ne,Be);else for(de=O?new this:[],ze=(_e=ne(oe,Ue)).next;!(Ae=I(ze,_e)).done;Ne++)Be=ve?B(_e,Q,[Ae.value,Ne],!0):Ae.value,ee(de,Ne,Be);return K(de,Ne),de}},9617:function(q,Z,j){var E=j(5397),I=j(5610),W=j(6198),B=function(ae){return function(z,V,ee){var K=E(z),ne=W(K);if(ne===0)return!ae&&-1;var se,ce=I(ee,ne);if(ae&&V!=V){for(;ne>ce;)if((se=K[ce++])!=se)return!0}else for(;ne>ce;ce++)if((ae||ce in K)&&K[ce]===V)return ae||ce||0;return!ae&&-1}};q.exports={includes:B(!0),indexOf:B(!1)}},9213:function(q,Z,j){var E=j(6080),I=j(7055),W=j(8981),B=j(6198),ae=j(1469),z=j(4659),V=function(ee){var K=ee===1,ne=ee===2,se=ee===3,ce=ee===4,fe=ee===6,oe=ee===7,O=ee===5||fe;return function(F,Q,ve){for(var he,de,Ae=W(F),_e=I(Ae),ze=B(_e),Be=E(Q,ve),Ue=0,Ne=0,Ee=K?ae(F,ze):ne||oe?ae(F,0):void 0;ze>Ue;Ue++)if((O||Ue in _e)&&(de=Be(he=_e[Ue],Ue,Ae),ee))if(K)z(Ee,Ue,de);else if(de)switch(ee){case 3:return!0;case 5:return he;case 6:return Ue;case 2:z(Ee,Ne++,he)}else switch(ee){case 4:return!1;case 7:z(Ee,Ne++,he)}return fe?-1:se||ce?ce:Ee}};q.exports={forEach:V(0),map:V(1),filter:V(2),some:V(3),every:V(4),find:V(5),findIndex:V(6),filterReject:V(7)}},597:function(q,Z,j){var E=j(9039),I=j(8227),W=j(9519),B=I("species");q.exports=function(ae){return W>=51||!E((function(){var z=[];return(z.constructor={})[B]=function(){return{foo:1}},z[ae](Boolean).foo!==1}))}},4598:function(q,Z,j){var E=j(9039);q.exports=function(I,W){var B=[][I];return!!B&&E((function(){B.call(null,W||function(){return 1},1)}))}},926:function(q,Z,j){var E=j(9306),I=j(8981),W=j(7055),B=j(6198),ae=TypeError,z="Reduce of empty array with no initial value",V=function(ee){return function(K,ne,se,ce){var fe=I(K),oe=W(fe),O=B(fe);if(E(ne),O===0&&se<2)throw new ae(z);var F=ee?O-1:0,Q=ee?-1:1;if(se<2)for(;;){if(F in oe){ce=oe[F],F+=Q;break}if(F+=Q,ee?F<0:O<=F)throw new ae(z)}for(;ee?F>=0:O>F;F+=Q)F in oe&&(ce=ne(ce,oe[F],F,fe));return ce}};q.exports={left:V(!1),right:V(!0)}},4527:function(q,Z,j){var E=j(3724),I=j(4376),W=TypeError,B=Object.getOwnPropertyDescriptor,ae=E&&!(function(){if(this!==void 0)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(z){return z instanceof TypeError}})();q.exports=ae?function(z,V){if(I(z)&&!B(z,"length").writable)throw new W("Cannot set read only .length");return z.length=V}:function(z,V){return z.length=V}},7680:function(q,Z,j){var E=j(9504);q.exports=E([].slice)},4488:function(q,Z,j){var E=j(7680),I=Math.floor,W=function(B,ae){var z=B.length;if(z<8)for(var V,ee,K=1;K<z;){for(ee=K,V=B[K];ee&&ae(B[ee-1],V)>0;)B[ee]=B[--ee];ee!==K++&&(B[ee]=V)}else for(var ne=I(z/2),se=W(E(B,0,ne),ae),ce=W(E(B,ne),ae),fe=se.length,oe=ce.length,O=0,F=0;O<fe||F<oe;)B[O+F]=O<fe&&F<oe?ae(se[O],ce[F])<=0?se[O++]:ce[F++]:O<fe?se[O++]:ce[F++];return B};q.exports=W},7433:function(q,Z,j){var E=j(4376),I=j(3517),W=j(34),B=j(8227)("species"),ae=Array;q.exports=function(z){var V;return E(z)&&(V=z.constructor,(I(V)&&(V===ae||E(V.prototype))||W(V)&&(V=V[B])===null)&&(V=void 0)),V===void 0?ae:V}},1469:function(q,Z,j){var E=j(7433);q.exports=function(I,W){return new(E(I))(W===0?0:W)}},6319:function(q,Z,j){var E=j(8551),I=j(9539);q.exports=function(W,B,ae,z){try{return z?B(E(ae)[0],ae[1]):B(ae)}catch(V){I(W,"throw",V)}}},4428:function(q,Z,j){var E=j(8227)("iterator"),I=!1;try{var W=0,B={next:function(){return{done:!!W++}},return:function(){I=!0}};B[E]=function(){return this},Array.from(B,(function(){throw 2}))}catch{}q.exports=function(ae,z){try{if(!z&&!I)return!1}catch{return!1}var V=!1;try{var ee={};ee[E]=function(){return{next:function(){return{done:V=!0}}}},ae(ee)}catch{}return V}},2195:function(q,Z,j){var E=j(9504),I=E({}.toString),W=E("".slice);q.exports=function(B){return W(I(B),8,-1)}},6955:function(q,Z,j){var E=j(2140),I=j(4901),W=j(2195),B=j(8227)("toStringTag"),ae=Object,z=W((function(){return arguments})())==="Arguments";q.exports=E?W:function(V){var ee,K,ne;return V===void 0?"Undefined":V===null?"Null":typeof(K=(function(se,ce){try{return se[ce]}catch{}})(ee=ae(V),B))=="string"?K:z?W(ee):(ne=W(ee))==="Object"&&I(ee.callee)?"Arguments":ne}},7740:function(q,Z,j){var E=j(9297),I=j(5031),W=j(7347),B=j(4913);q.exports=function(ae,z,V){for(var ee=I(z),K=B.f,ne=W.f,se=0;se<ee.length;se++){var ce=ee[se];E(ae,ce)||V&&E(V,ce)||K(ae,ce,ne(z,ce))}}},1436:function(q,Z,j){var E=j(8227)("match");q.exports=function(I){var W=/./;try{"/./"[I](W)}catch{try{return W[E]=!1,"/./"[I](W)}catch{}}return!1}},2211:function(q,Z,j){var E=j(9039);q.exports=!E((function(){function I(){}return I.prototype.constructor=null,Object.getPrototypeOf(new I)!==I.prototype}))},2529:function(q){q.exports=function(Z,j){return{value:Z,done:j}}},6699:function(q,Z,j){var E=j(3724),I=j(4913),W=j(6980);q.exports=E?function(B,ae,z){return I.f(B,ae,W(1,z))}:function(B,ae,z){return B[ae]=z,B}},6980:function(q){q.exports=function(Z,j){return{enumerable:!(1&Z),configurable:!(2&Z),writable:!(4&Z),value:j}}},4659:function(q,Z,j){var E=j(3724),I=j(4913),W=j(6980);q.exports=function(B,ae,z){E?I.f(B,ae,W(0,z)):B[ae]=z}},3640:function(q,Z,j){var E=j(8551),I=j(4270),W=TypeError;q.exports=function(B){if(E(this),B==="string"||B==="default")B="string";else if(B!=="number")throw new W("Incorrect hint");return I(this,B)}},2106:function(q,Z,j){var E=j(283),I=j(4913);q.exports=function(W,B,ae){return ae.get&&E(ae.get,B,{getter:!0}),ae.set&&E(ae.set,B,{setter:!0}),I.f(W,B,ae)}},6840:function(q,Z,j){var E=j(4901),I=j(4913),W=j(283),B=j(9433);q.exports=function(ae,z,V,ee){ee||(ee={});var K=ee.enumerable,ne=ee.name!==void 0?ee.name:z;if(E(V)&&W(V,ne,ee),ee.global)K?ae[z]=V:B(z,V);else{try{ee.unsafe?ae[z]&&(K=!0):delete ae[z]}catch{}K?ae[z]=V:I.f(ae,z,{value:V,enumerable:!1,configurable:!ee.nonConfigurable,writable:!ee.nonWritable})}return ae}},9433:function(q,Z,j){var E=j(4576),I=Object.defineProperty;q.exports=function(W,B){try{I(E,W,{value:B,configurable:!0,writable:!0})}catch{E[W]=B}return B}},4606:function(q,Z,j){var E=j(6823),I=TypeError;q.exports=function(W,B){if(!delete W[B])throw new I("Cannot delete property "+E(B)+" of "+E(W))}},3724:function(q,Z,j){var E=j(9039);q.exports=!E((function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!==7}))},4055:function(q,Z,j){var E=j(4576),I=j(34),W=E.document,B=I(W)&&I(W.createElement);q.exports=function(ae){return B?W.createElement(ae):{}}},6837:function(q){var Z=TypeError;q.exports=function(j){if(j>9007199254740991)throw Z("Maximum allowed index exceeded");return j}},7400:function(q){q.exports={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0}},9296:function(q,Z,j){var E=j(4055)("span").classList,I=E&&E.constructor&&E.constructor.prototype;q.exports=I===Object.prototype?void 0:I},8727:function(q){q.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},3709:function(q,Z,j){var E=j(2839).match(/firefox\/(\d+)/i);q.exports=!!E&&+E[1]},3763:function(q,Z,j){var E=j(2839);q.exports=/MSIE|Trident/.test(E)},6193:function(q,Z,j){var E=j(4215);q.exports=E==="NODE"},2839:function(q,Z,j){var E=j(4576).navigator,I=E&&E.userAgent;q.exports=I?String(I):""},9519:function(q,Z,j){var E,I,W=j(4576),B=j(2839),ae=W.process,z=W.Deno,V=ae&&ae.versions||z&&z.version,ee=V&&V.v8;ee&&(I=(E=ee.split("."))[0]>0&&E[0]<4?1:+(E[0]+E[1])),!I&&B&&(!(E=B.match(/Edge\/(\d+)/))||E[1]>=74)&&(E=B.match(/Chrome\/(\d+)/))&&(I=+E[1]),q.exports=I},3607:function(q,Z,j){var E=j(2839).match(/AppleWebKit\/(\d+)\./);q.exports=!!E&&+E[1]},4215:function(q,Z,j){var E=j(4576),I=j(2839),W=j(2195),B=function(ae){return I.slice(0,ae.length)===ae};q.exports=B("Bun/")?"BUN":B("Cloudflare-Workers")?"CLOUDFLARE":B("Deno/")?"DENO":B("Node.js/")?"NODE":E.Bun&&typeof Bun.version=="string"?"BUN":E.Deno&&typeof Deno.version=="object"?"DENO":W(E.process)==="process"?"NODE":E.window&&E.document?"BROWSER":"REST"},6518:function(q,Z,j){var E=j(4576),I=j(7347).f,W=j(6699),B=j(6840),ae=j(9433),z=j(7740),V=j(2796);q.exports=function(ee,K){var ne,se,ce,fe,oe,O=ee.target,F=ee.global,Q=ee.stat;if(ne=F?E:Q?E[O]||ae(O,{}):E[O]&&E[O].prototype)for(se in K){if(fe=K[se],ce=ee.dontCallGetSet?(oe=I(ne,se))&&oe.value:ne[se],!V(F?se:O+(Q?".":"#")+se,ee.forced)&&ce!==void 0){if(typeof fe==typeof ce)continue;z(fe,ce)}(ee.sham||ce&&ce.sham)&&W(fe,"sham",!0),B(ne,se,fe,ee)}}},9039:function(q){q.exports=function(Z){try{return!!Z()}catch{return!0}}},9228:function(q,Z,j){j(7495);var E=j(9565),I=j(6840),W=j(7323),B=j(9039),ae=j(8227),z=j(6699),V=ae("species"),ee=RegExp.prototype;q.exports=function(K,ne,se,ce){var fe=ae(K),oe=!B((function(){var ve={};return ve[fe]=function(){return 7},""[K](ve)!==7})),O=oe&&!B((function(){var ve=!1,he=/a/;if(K==="split"){var de={};de[V]=function(){return he},(he={constructor:de,flags:""})[fe]=/./[fe]}return he.exec=function(){return ve=!0,null},he[fe](""),!ve}));if(!oe||!O||se){var F=/./[fe],Q=ne(fe,""[K],(function(ve,he,de,Ae,_e){var ze=he.exec;return ze===W||ze===ee.exec?oe&&!_e?{done:!0,value:E(F,he,de,Ae)}:{done:!0,value:E(ve,de,he,Ae)}:{done:!1}}));I(String.prototype,K,Q[0]),I(ee,fe,Q[1])}ce&&z(ee[fe],"sham",!0)}},8745:function(q,Z,j){var E=j(616),I=Function.prototype,W=I.apply,B=I.call;q.exports=typeof Reflect=="object"&&Reflect.apply||(E?B.bind(W):function(){return B.apply(W,arguments)})},6080:function(q,Z,j){var E=j(7476),I=j(9306),W=j(616),B=E(E.bind);q.exports=function(ae,z){return I(ae),z===void 0?ae:W?B(ae,z):function(){return ae.apply(z,arguments)}}},616:function(q,Z,j){var E=j(9039);q.exports=!E((function(){var I=(function(){}).bind();return typeof I!="function"||I.hasOwnProperty("prototype")}))},566:function(q,Z,j){var E=j(9504),I=j(9306),W=j(34),B=j(9297),ae=j(7680),z=j(616),V=Function,ee=E([].concat),K=E([].join),ne={};q.exports=z?V.bind:function(se){var ce=I(this),fe=ce.prototype,oe=ae(arguments,1),O=function(){var F=ee(oe,ae(arguments));return this instanceof O?(function(Q,ve,he){if(!B(ne,ve)){for(var de=[],Ae=0;Ae<ve;Ae++)de[Ae]="a["+Ae+"]";ne[ve]=V("C,a","return new C("+K(de,",")+")")}return ne[ve](Q,he)})(ce,F.length,F):ce.apply(se,F)};return W(fe)&&(O.prototype=fe),O}},9565:function(q,Z,j){var E=j(616),I=Function.prototype.call;q.exports=E?I.bind(I):function(){return I.apply(I,arguments)}},350:function(q,Z,j){var E=j(3724),I=j(9297),W=Function.prototype,B=E&&Object.getOwnPropertyDescriptor,ae=I(W,"name"),z=ae&&(function(){}).name==="something",V=ae&&(!E||E&&B(W,"name").configurable);q.exports={EXISTS:ae,PROPER:z,CONFIGURABLE:V}},6706:function(q,Z,j){var E=j(9504),I=j(9306);q.exports=function(W,B,ae){try{return E(I(Object.getOwnPropertyDescriptor(W,B)[ae]))}catch{}}},7476:function(q,Z,j){var E=j(2195),I=j(9504);q.exports=function(W){if(E(W)==="Function")return I(W)}},9504:function(q,Z,j){var E=j(616),I=Function.prototype,W=I.call,B=E&&I.bind.bind(W,W);q.exports=E?B:function(ae){return function(){return W.apply(ae,arguments)}}},7751:function(q,Z,j){var E=j(4576),I=j(4901);q.exports=function(W,B){return arguments.length<2?(ae=E[W],I(ae)?ae:void 0):E[W]&&E[W][B];var ae}},851:function(q,Z,j){var E=j(6955),I=j(5966),W=j(4117),B=j(6269),ae=j(8227)("iterator");q.exports=function(z){if(!W(z))return I(z,ae)||I(z,"@@iterator")||B[E(z)]}},81:function(q,Z,j){var E=j(9565),I=j(9306),W=j(8551),B=j(6823),ae=j(851),z=TypeError;q.exports=function(V,ee){var K=arguments.length<2?ae(V):ee;if(I(K))return W(E(K,V));throw new z(B(V)+" is not iterable")}},5966:function(q,Z,j){var E=j(9306),I=j(4117);q.exports=function(W,B){var ae=W[B];return I(ae)?void 0:E(ae)}},2478:function(q,Z,j){var E=j(9504),I=j(8981),W=Math.floor,B=E("".charAt),ae=E("".replace),z=E("".slice),V=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,ee=/\$([$&'`]|\d{1,2})/g;q.exports=function(K,ne,se,ce,fe,oe){var O=se+K.length,F=ce.length,Q=ee;return fe!==void 0&&(fe=I(fe),Q=V),ae(oe,Q,(function(ve,he){var de;switch(B(he,0)){case"$":return"$";case"&":return K;case"`":return z(ne,0,se);case"'":return z(ne,O);case"<":de=fe[z(he,1,-1)];break;default:var Ae=+he;if(Ae===0)return ve;if(Ae>F){var _e=W(Ae/10);return _e===0?ve:_e<=F?ce[_e-1]===void 0?B(he,1):ce[_e-1]+B(he,1):ve}de=ce[Ae-1]}return de===void 0?"":de}))}},4576:function(q,Z,j){var E=function(I){return I&&I.Math===Math&&I};q.exports=E(typeof globalThis=="object"&&globalThis)||E(typeof window=="object"&&window)||E(typeof self=="object"&&self)||E(typeof j.g=="object"&&j.g)||E(typeof this=="object"&&this)||(function(){return this})()||Function("return this")()},9297:function(q,Z,j){var E=j(9504),I=j(8981),W=E({}.hasOwnProperty);q.exports=Object.hasOwn||function(B,ae){return W(I(B),ae)}},421:function(q){q.exports={}},397:function(q,Z,j){var E=j(7751);q.exports=E("document","documentElement")},5917:function(q,Z,j){var E=j(3724),I=j(9039),W=j(4055);q.exports=!E&&!I((function(){return Object.defineProperty(W("div"),"a",{get:function(){return 7}}).a!==7}))},7055:function(q,Z,j){var E=j(9504),I=j(9039),W=j(2195),B=Object,ae=E("".split);q.exports=I((function(){return!B("z").propertyIsEnumerable(0)}))?function(z){return W(z)==="String"?ae(z,""):B(z)}:B},3167:function(q,Z,j){var E=j(4901),I=j(34),W=j(2967);q.exports=function(B,ae,z){var V,ee;return W&&E(V=ae.constructor)&&V!==z&&I(ee=V.prototype)&&ee!==z.prototype&&W(B,ee),B}},3706:function(q,Z,j){var E=j(9504),I=j(4901),W=j(7629),B=E(Function.toString);I(W.inspectSource)||(W.inspectSource=function(ae){return B(ae)}),q.exports=W.inspectSource},1181:function(q,Z,j){var E,I,W,B=j(8622),ae=j(4576),z=j(34),V=j(6699),ee=j(9297),K=j(7629),ne=j(6119),se=j(421),ce="Object already initialized",fe=ae.TypeError,oe=ae.WeakMap;if(B||K.state){var O=K.state||(K.state=new oe);O.get=O.get,O.has=O.has,O.set=O.set,E=function(Q,ve){if(O.has(Q))throw new fe(ce);return ve.facade=Q,O.set(Q,ve),ve},I=function(Q){return O.get(Q)||{}},W=function(Q){return O.has(Q)}}else{var F=ne("state");se[F]=!0,E=function(Q,ve){if(ee(Q,F))throw new fe(ce);return ve.facade=Q,V(Q,F,ve),ve},I=function(Q){return ee(Q,F)?Q[F]:{}},W=function(Q){return ee(Q,F)}}q.exports={set:E,get:I,has:W,enforce:function(Q){return W(Q)?I(Q):E(Q,{})},getterFor:function(Q){return function(ve){var he;if(!z(ve)||(he=I(ve)).type!==Q)throw new fe("Incompatible receiver, "+Q+" required");return he}}}},4209:function(q,Z,j){var E=j(8227),I=j(6269),W=E("iterator"),B=Array.prototype;q.exports=function(ae){return ae!==void 0&&(I.Array===ae||B[W]===ae)}},4376:function(q,Z,j){var E=j(2195);q.exports=Array.isArray||function(I){return E(I)==="Array"}},4901:function(q){var Z=typeof document=="object"&&document.all;q.exports=Z===void 0&&Z!==void 0?function(j){return typeof j=="function"||j===Z}:function(j){return typeof j=="function"}},3517:function(q,Z,j){var E=j(9504),I=j(9039),W=j(4901),B=j(6955),ae=j(7751),z=j(3706),V=function(){},ee=ae("Reflect","construct"),K=/^\s*(?:class|function)\b/,ne=E(K.exec),se=!K.test(V),ce=function(oe){if(!W(oe))return!1;try{return ee(V,[],oe),!0}catch{return!1}},fe=function(oe){if(!W(oe))return!1;switch(B(oe)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return se||!!ne(K,z(oe))}catch{return!0}};fe.sham=!0,q.exports=!ee||I((function(){var oe;return ce(ce.call)||!ce(Object)||!ce((function(){oe=!0}))||oe}))?fe:ce},2796:function(q,Z,j){var E=j(9039),I=j(4901),W=/#|\.prototype\./,B=function(K,ne){var se=z[ae(K)];return se===ee||se!==V&&(I(ne)?E(ne):!!ne)},ae=B.normalize=function(K){return String(K).replace(W,".").toLowerCase()},z=B.data={},V=B.NATIVE="N",ee=B.POLYFILL="P";q.exports=B},2087:function(q,Z,j){var E=j(34),I=Math.floor;q.exports=Number.isInteger||function(W){return!E(W)&&isFinite(W)&&I(W)===W}},4117:function(q){q.exports=function(Z){return Z==null}},34:function(q,Z,j){var E=j(4901);q.exports=function(I){return typeof I=="object"?I!==null:E(I)}},3925:function(q,Z,j){var E=j(34);q.exports=function(I){return E(I)||I===null}},6395:function(q){q.exports=!1},5810:function(q,Z,j){var E=j(34),I=j(1181).get;q.exports=function(W){if(!E(W))return!1;var B=I(W);return!!B&&B.type==="RawJSON"}},788:function(q,Z,j){var E=j(34),I=j(2195),W=j(8227)("match");q.exports=function(B){var ae;return E(B)&&((ae=B[W])!==void 0?!!ae:I(B)==="RegExp")}},757:function(q,Z,j){var E=j(7751),I=j(4901),W=j(1625),B=j(7040),ae=Object;q.exports=B?function(z){return typeof z=="symbol"}:function(z){var V=E("Symbol");return I(V)&&W(V.prototype,ae(z))}},9539:function(q,Z,j){var E=j(9565),I=j(8551),W=j(5966);q.exports=function(B,ae,z){var V,ee;I(B);try{if(!(V=W(B,"return"))){if(ae==="throw")throw z;return z}V=E(V,B)}catch(K){ee=!0,V=K}if(ae==="throw")throw z;if(ee)throw V;return I(V),z}},3994:function(q,Z,j){var E=j(7657).IteratorPrototype,I=j(2360),W=j(6980),B=j(687),ae=j(6269),z=function(){return this};q.exports=function(V,ee,K,ne){var se=ee+" Iterator";return V.prototype=I(E,{next:W(+!ne,K)}),B(V,se,!1,!0),ae[se]=z,V}},1088:function(q,Z,j){var E=j(6518),I=j(9565),W=j(6395),B=j(350),ae=j(4901),z=j(3994),V=j(2787),ee=j(2967),K=j(687),ne=j(6699),se=j(6840),ce=j(8227),fe=j(6269),oe=j(7657),O=B.PROPER,F=B.CONFIGURABLE,Q=oe.IteratorPrototype,ve=oe.BUGGY_SAFARI_ITERATORS,he=ce("iterator"),de="keys",Ae="values",_e="entries",ze=function(){return this};q.exports=function(Be,Ue,Ne,Ee,ke,Me,Ge){z(Ne,Ue,Ee);var xe,He,Pe,Ve=function(ot){if(ot===ke&<)return lt;if(!ve&&ot&&ot in $e)return $e[ot];switch(ot){case de:case Ae:case _e:return function(){return new Ne(this,ot)}}return function(){return new Ne(this)}},je=Ue+" Iterator",ye=!1,$e=Be.prototype,Ye=$e[he]||$e["@@iterator"]||ke&&$e[ke],lt=!ve&&Ye||Ve(ke),St=Ue==="Array"&&$e.entries||Ye;if(St&&(xe=V(St.call(new Be)))!==Object.prototype&&xe.next&&(W||V(xe)===Q||(ee?ee(xe,Q):ae(xe[he])||se(xe,he,ze)),K(xe,je,!0,!0),W&&(fe[je]=ze)),O&&ke===Ae&&Ye&&Ye.name!==Ae&&(!W&&F?ne($e,"name",Ae):(ye=!0,lt=function(){return I(Ye,this)})),ke)if(He={values:Ve(Ae),keys:Me?lt:Ve(de),entries:Ve(_e)},Ge)for(Pe in He)(ve||ye||!(Pe in $e))&&se($e,Pe,He[Pe]);else E({target:Ue,proto:!0,forced:ve||ye},He);return W&&!Ge||$e[he]===lt||se($e,he,lt,{name:ke}),fe[Ue]=lt,He}},7657:function(q,Z,j){var E,I,W,B=j(9039),ae=j(4901),z=j(34),V=j(2360),ee=j(2787),K=j(6840),ne=j(8227),se=j(6395),ce=ne("iterator"),fe=!1;[].keys&&("next"in(W=[].keys())?(I=ee(ee(W)))!==Object.prototype&&(E=I):fe=!0),!z(E)||B((function(){var oe={};return E[ce].call(oe)!==oe}))?E={}:se&&(E=V(E)),ae(E[ce])||K(E,ce,(function(){return this})),q.exports={IteratorPrototype:E,BUGGY_SAFARI_ITERATORS:fe}},6269:function(q){q.exports={}},6198:function(q,Z,j){var E=j(8014);q.exports=function(I){return E(I.length)}},283:function(q,Z,j){var E=j(9504),I=j(9039),W=j(4901),B=j(9297),ae=j(3724),z=j(350).CONFIGURABLE,V=j(3706),ee=j(1181),K=ee.enforce,ne=ee.get,se=String,ce=Object.defineProperty,fe=E("".slice),oe=E("".replace),O=E([].join),F=ae&&!I((function(){return ce((function(){}),"length",{value:8}).length!==8})),Q=String(String).split("String"),ve=q.exports=function(he,de,Ae){fe(se(de),0,7)==="Symbol("&&(de="["+oe(se(de),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),Ae&&Ae.getter&&(de="get "+de),Ae&&Ae.setter&&(de="set "+de),(!B(he,"name")||z&&he.name!==de)&&(ae?ce(he,"name",{value:de,configurable:!0}):he.name=de),F&&Ae&&B(Ae,"arity")&&he.length!==Ae.arity&&ce(he,"length",{value:Ae.arity});try{Ae&&B(Ae,"constructor")&&Ae.constructor?ae&&ce(he,"prototype",{writable:!1}):he.prototype&&(he.prototype=void 0)}catch{}var _e=K(he);return B(_e,"source")||(_e.source=O(Q,typeof de=="string"?de:"")),he};Function.prototype.toString=ve((function(){return W(this)&&ne(this).source||V(this)}),"toString")},741:function(q){var Z=Math.ceil,j=Math.floor;q.exports=Math.trunc||function(E){var I=+E;return(I>0?j:Z)(I)}},7819:function(q,Z,j){var E=j(9039);q.exports=!E((function(){var I="9007199254740993",W=JSON.rawJSON(I);return!JSON.isRawJSON(W)||JSON.stringify(W)!==I}))},5749:function(q,Z,j){var E=j(788),I=TypeError;q.exports=function(W){if(E(W))throw new I("The method doesn't accept regular expressions");return W}},4213:function(q,Z,j){var E=j(3724),I=j(9504),W=j(9565),B=j(9039),ae=j(1072),z=j(3717),V=j(8773),ee=j(8981),K=j(7055),ne=Object.assign,se=Object.defineProperty,ce=I([].concat);q.exports=!ne||B((function(){if(E&&ne({b:1},ne(se({},"a",{enumerable:!0,get:function(){se(this,"b",{value:3,enumerable:!1})}}),{b:2})).b!==1)return!0;var fe={},oe={},O=Symbol("assign detection"),F="abcdefghijklmnopqrst";return fe[O]=7,F.split("").forEach((function(Q){oe[Q]=Q})),ne({},fe)[O]!==7||ae(ne({},oe)).join("")!==F}))?function(fe,oe){for(var O=ee(fe),F=arguments.length,Q=1,ve=z.f,he=V.f;F>Q;)for(var de,Ae=K(arguments[Q++]),_e=ve?ce(ae(Ae),ve(Ae)):ae(Ae),ze=_e.length,Be=0;ze>Be;)de=_e[Be++],E&&!W(he,Ae,de)||(O[de]=Ae[de]);return O}:ne},2360:function(q,Z,j){var E,I=j(8551),W=j(6801),B=j(8727),ae=j(421),z=j(397),V=j(4055),ee=j(6119),K="prototype",ne="script",se=ee("IE_PROTO"),ce=function(){},fe=function(F){return"<"+ne+">"+F+"</"+ne+">"},oe=function(F){F.write(fe("")),F.close();var Q=F.parentWindow.Object;return F=null,Q},O=function(){try{E=new ActiveXObject("htmlfile")}catch{}var F,Q,ve;O=typeof document<"u"?document.domain&&E?oe(E):(Q=V("iframe"),ve="java"+ne+":",Q.style.display="none",z.appendChild(Q),Q.src=String(ve),(F=Q.contentWindow.document).open(),F.write(fe("document.F=Object")),F.close(),F.F):oe(E);for(var he=B.length;he--;)delete O[K][B[he]];return O()};ae[se]=!0,q.exports=Object.create||function(F,Q){var ve;return F!==null?(ce[K]=I(F),ve=new ce,ce[K]=null,ve[se]=F):ve=O(),Q===void 0?ve:W.f(ve,Q)}},6801:function(q,Z,j){var E=j(3724),I=j(8686),W=j(4913),B=j(8551),ae=j(5397),z=j(1072);Z.f=E&&!I?Object.defineProperties:function(V,ee){B(V);for(var K,ne=ae(ee),se=z(ee),ce=se.length,fe=0;ce>fe;)W.f(V,K=se[fe++],ne[K]);return V}},4913:function(q,Z,j){var E=j(3724),I=j(5917),W=j(8686),B=j(8551),ae=j(6969),z=TypeError,V=Object.defineProperty,ee=Object.getOwnPropertyDescriptor,K="enumerable",ne="configurable",se="writable";Z.f=E?W?function(ce,fe,oe){if(B(ce),fe=ae(fe),B(oe),typeof ce=="function"&&fe==="prototype"&&"value"in oe&&se in oe&&!oe[se]){var O=ee(ce,fe);O&&O[se]&&(ce[fe]=oe.value,oe={configurable:ne in oe?oe[ne]:O[ne],enumerable:K in oe?oe[K]:O[K],writable:!1})}return V(ce,fe,oe)}:V:function(ce,fe,oe){if(B(ce),fe=ae(fe),B(oe),I)try{return V(ce,fe,oe)}catch{}if("get"in oe||"set"in oe)throw new z("Accessors not supported");return"value"in oe&&(ce[fe]=oe.value),ce}},7347:function(q,Z,j){var E=j(3724),I=j(9565),W=j(8773),B=j(6980),ae=j(5397),z=j(6969),V=j(9297),ee=j(5917),K=Object.getOwnPropertyDescriptor;Z.f=E?K:function(ne,se){if(ne=ae(ne),se=z(se),ee)try{return K(ne,se)}catch{}if(V(ne,se))return B(!I(W.f,ne,se),ne[se])}},298:function(q,Z,j){var E=j(2195),I=j(5397),W=j(8480).f,B=j(7680),ae=typeof window=="object"&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];q.exports.f=function(z){return ae&&E(z)==="Window"?(function(V){try{return W(V)}catch{return B(ae)}})(z):W(I(z))}},8480:function(q,Z,j){var E=j(1828),I=j(8727).concat("length","prototype");Z.f=Object.getOwnPropertyNames||function(W){return E(W,I)}},3717:function(q,Z){Z.f=Object.getOwnPropertySymbols},2787:function(q,Z,j){var E=j(9297),I=j(4901),W=j(8981),B=j(6119),ae=j(2211),z=B("IE_PROTO"),V=Object,ee=V.prototype;q.exports=ae?V.getPrototypeOf:function(K){var ne=W(K);if(E(ne,z))return ne[z];var se=ne.constructor;return I(se)&&ne instanceof se?se.prototype:ne instanceof V?ee:null}},1625:function(q,Z,j){var E=j(9504);q.exports=E({}.isPrototypeOf)},1828:function(q,Z,j){var E=j(9504),I=j(9297),W=j(5397),B=j(9617).indexOf,ae=j(421),z=E([].push);q.exports=function(V,ee){var K,ne=W(V),se=0,ce=[];for(K in ne)!I(ae,K)&&I(ne,K)&&z(ce,K);for(;ee.length>se;)I(ne,K=ee[se++])&&(~B(ce,K)||z(ce,K));return ce}},1072:function(q,Z,j){var E=j(1828),I=j(8727);q.exports=Object.keys||function(W){return E(W,I)}},8773:function(q,Z){var j={}.propertyIsEnumerable,E=Object.getOwnPropertyDescriptor,I=E&&!j.call({1:2},1);Z.f=I?function(W){var B=E(this,W);return!!B&&B.enumerable}:j},2551:function(q,Z,j){var E=j(6395),I=j(4576),W=j(9039),B=j(3607);q.exports=E||!W((function(){if(!(B&&B<535)){var ae=Math.random();__defineSetter__.call(null,ae,(function(){})),delete I[ae]}}))},2967:function(q,Z,j){var E=j(6706),I=j(34),W=j(7750),B=j(3506);q.exports=Object.setPrototypeOf||("__proto__"in{}?(function(){var ae,z=!1,V={};try{(ae=E(Object.prototype,"__proto__","set"))(V,[]),z=V instanceof Array}catch{}return function(ee,K){return W(ee),B(K),I(ee)&&(z?ae(ee,K):ee.__proto__=K),ee}})():void 0)},3179:function(q,Z,j){var E=j(2140),I=j(6955);q.exports=E?{}.toString:function(){return"[object "+I(this)+"]"}},4270:function(q,Z,j){var E=j(9565),I=j(4901),W=j(34),B=TypeError;q.exports=function(ae,z){var V,ee;if(z==="string"&&I(V=ae.toString)&&!W(ee=E(V,ae))||I(V=ae.valueOf)&&!W(ee=E(V,ae))||z!=="string"&&I(V=ae.toString)&&!W(ee=E(V,ae)))return ee;throw new B("Can't convert object to primitive value")}},5031:function(q,Z,j){var E=j(7751),I=j(9504),W=j(8480),B=j(3717),ae=j(8551),z=I([].concat);q.exports=E("Reflect","ownKeys")||function(V){var ee=W.f(ae(V)),K=B.f;return K?z(ee,K(V)):ee}},8235:function(q,Z,j){var E=j(9504),I=j(9297),W=SyntaxError,B=parseInt,ae=String.fromCharCode,z=E("".charAt),V=E("".slice),ee=E(/./.exec),K={'\\"':'"',"\\\\":"\\","\\/":"/","\\b":"\b","\\f":"\f","\\n":`
- `,"\\r":"\r","\\t":" "},ne=/^[\da-f]{4}$/i,se=/^[\u0000-\u001F]$/;q.exports=function(ce,fe){for(var oe=!0,O="";fe<ce.length;){var F=z(ce,fe);if(F==="\\"){var Q=V(ce,fe,fe+2);if(I(K,Q))O+=K[Q],fe+=2;else{if(Q!=="\\u")throw new W('Unknown escape sequence: "'+Q+'"');var ve=V(ce,fe+=2,fe+4);if(!ee(ne,ve))throw new W("Bad Unicode escape at: "+fe);O+=ae(B(ve,16)),fe+=4}}else{if(F==='"'){oe=!1,fe++;break}if(ee(se,F))throw new W("Bad control character in string literal at: "+fe);O+=F,fe++}}if(oe)throw new W("Unterminated string at: "+fe);return{value:O,end:fe}}},9167:function(q,Z,j){var E=j(4576);q.exports=E},1056:function(q,Z,j){var E=j(4913).f;q.exports=function(I,W,B){B in I||E(I,B,{configurable:!0,get:function(){return W[B]},set:function(ae){W[B]=ae}})}},6682:function(q,Z,j){var E=j(9565),I=j(8551),W=j(4901),B=j(2195),ae=j(7323),z=TypeError;q.exports=function(V,ee){var K=V.exec;if(W(K)){var ne=E(K,V,ee);return ne!==null&&I(ne),ne}if(B(V)==="RegExp")return E(ae,V,ee);throw new z("RegExp#exec called on incompatible receiver")}},7323:function(q,Z,j){var E,I,W=j(9565),B=j(9504),ae=j(655),z=j(7979),V=j(8429),ee=j(5745),K=j(2360),ne=j(1181).get,se=j(3635),ce=j(8814),fe=ee("native-string-replace",String.prototype.replace),oe=RegExp.prototype.exec,O=oe,F=B("".charAt),Q=B("".indexOf),ve=B("".replace),he=B("".slice),de=(I=/b*/g,W(oe,E=/a/,"a"),W(oe,I,"a"),E.lastIndex!==0||I.lastIndex!==0),Ae=V.BROKEN_CARET,_e=/()??/.exec("")[1]!==void 0;(de||_e||Ae||se||ce)&&(O=function(ze){var Be,Ue,Ne,Ee,ke,Me,Ge,xe=this,He=ne(xe),Pe=ae(ze),Ve=He.raw;if(Ve)return Ve.lastIndex=xe.lastIndex,Be=W(O,Ve,Pe),xe.lastIndex=Ve.lastIndex,Be;var je=He.groups,ye=Ae&&xe.sticky,$e=W(z,xe),Ye=xe.source,lt=0,St=Pe;if(ye&&($e=ve($e,"y",""),Q($e,"g")===-1&&($e+="g"),St=he(Pe,xe.lastIndex),xe.lastIndex>0&&(!xe.multiline||xe.multiline&&F(Pe,xe.lastIndex-1)!==`
- `)&&(Ye="(?: "+Ye+")",St=" "+St,lt++),Ue=new RegExp("^(?:"+Ye+")",$e)),_e&&(Ue=new RegExp("^"+Ye+"$(?!\\s)",$e)),de&&(Ne=xe.lastIndex),Ee=W(oe,ye?Ue:xe,St),ye?Ee?(Ee.input=he(Ee.input,lt),Ee[0]=he(Ee[0],lt),Ee.index=xe.lastIndex,xe.lastIndex+=Ee[0].length):xe.lastIndex=0:de&&Ee&&(xe.lastIndex=xe.global?Ee.index+Ee[0].length:Ne),_e&&Ee&&Ee.length>1&&W(fe,Ee[0],Ue,(function(){for(ke=1;ke<arguments.length-2;ke++)arguments[ke]===void 0&&(Ee[ke]=void 0)})),Ee&&je)for(Ee.groups=Me=K(null),ke=0;ke<je.length;ke++)Me[(Ge=je[ke])[0]]=Ee[Ge[1]];return Ee}),q.exports=O},5213:function(q,Z,j){var E=j(4576),I=j(9039),W=E.RegExp,B=!I((function(){var ae=!0;try{W(".","d")}catch{ae=!1}var z={},V="",ee=ae?"dgimsy":"gimsy",K=function(ce,fe){Object.defineProperty(z,ce,{get:function(){return V+=fe,!0}})},ne={dotAll:"s",global:"g",ignoreCase:"i",multiline:"m",sticky:"y"};for(var se in ae&&(ne.hasIndices="d"),ne)K(se,ne[se]);return Object.getOwnPropertyDescriptor(W.prototype,"flags").get.call(z)!==ee||V!==ee}));q.exports={correct:B}},7979:function(q,Z,j){var E=j(8551);q.exports=function(){var I=E(this),W="";return I.hasIndices&&(W+="d"),I.global&&(W+="g"),I.ignoreCase&&(W+="i"),I.multiline&&(W+="m"),I.dotAll&&(W+="s"),I.unicode&&(W+="u"),I.unicodeSets&&(W+="v"),I.sticky&&(W+="y"),W}},1034:function(q,Z,j){var E=j(9565),I=j(9297),W=j(1625),B=j(5213),ae=j(7979),z=RegExp.prototype;q.exports=B.correct?function(V){return V.flags}:function(V){return B.correct||!W(z,V)||I(V,"flags")?V.flags:E(ae,V)}},8429:function(q,Z,j){var E=j(9039),I=j(4576).RegExp,W=E((function(){var z=I("a","y");return z.lastIndex=2,z.exec("abcd")!==null})),B=W||E((function(){return!I("a","y").sticky})),ae=W||E((function(){var z=I("^r","gy");return z.lastIndex=2,z.exec("str")!==null}));q.exports={BROKEN_CARET:ae,MISSED_STICKY:B,UNSUPPORTED_Y:W}},3635:function(q,Z,j){var E=j(9039),I=j(4576).RegExp;q.exports=E((function(){var W=I(".","s");return!(W.dotAll&&W.test(`
- `)&&W.flags==="s")}))},8814:function(q,Z,j){var E=j(9039),I=j(4576).RegExp;q.exports=E((function(){var W=I("(?<a>b)","g");return W.exec("b").groups.a!=="b"||"b".replace(W,"$<a>c")!=="bc"}))},7750:function(q,Z,j){var E=j(4117),I=TypeError;q.exports=function(W){if(E(W))throw new I("Can't call method on "+W);return W}},7633:function(q,Z,j){var E=j(7751),I=j(2106),W=j(8227),B=j(3724),ae=W("species");q.exports=function(z){var V=E(z);B&&V&&!V[ae]&&I(V,ae,{configurable:!0,get:function(){return this}})}},687:function(q,Z,j){var E=j(4913).f,I=j(9297),W=j(8227)("toStringTag");q.exports=function(B,ae,z){B&&!z&&(B=B.prototype),B&&!I(B,W)&&E(B,W,{configurable:!0,value:ae})}},6119:function(q,Z,j){var E=j(5745),I=j(3392),W=E("keys");q.exports=function(B){return W[B]||(W[B]=I(B))}},7629:function(q,Z,j){var E=j(6395),I=j(4576),W=j(9433),B="__core-js_shared__",ae=q.exports=I[B]||W(B,{});(ae.versions||(ae.versions=[])).push({version:"3.48.0",mode:E?"pure":"global",copyright:"© 2013–2025 Denis Pushkarev (zloirock.ru), 2025–2026 CoreJS Company (core-js.io). All rights reserved.",license:"https://github.com/zloirock/core-js/blob/v3.48.0/LICENSE",source:"https://github.com/zloirock/core-js"})},5745:function(q,Z,j){var E=j(7629);q.exports=function(I,W){return E[I]||(E[I]=W||{})}},2293:function(q,Z,j){var E=j(8551),I=j(5548),W=j(4117),B=j(8227)("species");q.exports=function(ae,z){var V,ee=E(ae).constructor;return ee===void 0||W(V=E(ee)[B])?z:I(V)}},8183:function(q,Z,j){var E=j(9504),I=j(1291),W=j(655),B=j(7750),ae=E("".charAt),z=E("".charCodeAt),V=E("".slice),ee=function(K){return function(ne,se){var ce,fe,oe=W(B(ne)),O=I(se),F=oe.length;return O<0||O>=F?K?"":void 0:(ce=z(oe,O))<55296||ce>56319||O+1===F||(fe=z(oe,O+1))<56320||fe>57343?K?ae(oe,O):ce:K?V(oe,O,O+2):fe-56320+(ce-55296<<10)+65536}};q.exports={codeAt:ee(!1),charAt:ee(!0)}},706:function(q,Z,j){var E=j(350).PROPER,I=j(9039),W=j(7452);q.exports=function(B){return I((function(){return!!W[B]()||"
"[B]()!=="
"||E&&W[B].name!==B}))}},3802:function(q,Z,j){var E=j(9504),I=j(7750),W=j(655),B=j(7452),ae=E("".replace),z=RegExp("^["+B+"]+"),V=RegExp("(^|[^"+B+"])["+B+"]+$"),ee=function(K){return function(ne){var se=W(I(ne));return 1&K&&(se=ae(se,z,"")),2&K&&(se=ae(se,V,"$1")),se}};q.exports={start:ee(1),end:ee(2),trim:ee(3)}},4495:function(q,Z,j){var E=j(9519),I=j(9039),W=j(4576).String;q.exports=!!Object.getOwnPropertySymbols&&!I((function(){var B=Symbol("symbol detection");return!W(B)||!(Object(B)instanceof Symbol)||!Symbol.sham&&E&&E<41}))},8242:function(q,Z,j){var E=j(9565),I=j(7751),W=j(8227),B=j(6840);q.exports=function(){var ae=I("Symbol"),z=ae&&ae.prototype,V=z&&z.valueOf,ee=W("toPrimitive");z&&!z[ee]&&B(z,ee,(function(K){return E(V,this)}),{arity:1})}},1296:function(q,Z,j){var E=j(4495);q.exports=E&&!!Symbol.for&&!!Symbol.keyFor},1240:function(q,Z,j){var E=j(9504);q.exports=E(1.1.valueOf)},5610:function(q,Z,j){var E=j(1291),I=Math.max,W=Math.min;q.exports=function(B,ae){var z=E(B);return z<0?I(z+ae,0):W(z,ae)}},5397:function(q,Z,j){var E=j(7055),I=j(7750);q.exports=function(W){return E(I(W))}},1291:function(q,Z,j){var E=j(741);q.exports=function(I){var W=+I;return W!=W||W===0?0:E(W)}},8014:function(q,Z,j){var E=j(1291),I=Math.min;q.exports=function(W){var B=E(W);return B>0?I(B,9007199254740991):0}},8981:function(q,Z,j){var E=j(7750),I=Object;q.exports=function(W){return I(E(W))}},2777:function(q,Z,j){var E=j(9565),I=j(34),W=j(757),B=j(5966),ae=j(4270),z=j(8227),V=TypeError,ee=z("toPrimitive");q.exports=function(K,ne){if(!I(K)||W(K))return K;var se,ce=B(K,ee);if(ce){if(ne===void 0&&(ne="default"),se=E(ce,K,ne),!I(se)||W(se))return se;throw new V("Can't convert object to primitive value")}return ne===void 0&&(ne="number"),ae(K,ne)}},6969:function(q,Z,j){var E=j(2777),I=j(757);q.exports=function(W){var B=E(W,"string");return I(B)?B:B+""}},2140:function(q,Z,j){var E={};E[j(8227)("toStringTag")]="z",q.exports=String(E)==="[object z]"},655:function(q,Z,j){var E=j(6955),I=String;q.exports=function(W){if(E(W)==="Symbol")throw new TypeError("Cannot convert a Symbol value to a string");return I(W)}},6823:function(q){var Z=String;q.exports=function(j){try{return Z(j)}catch{return"Object"}}},3392:function(q,Z,j){var E=j(9504),I=0,W=Math.random(),B=E(1.1.toString);q.exports=function(ae){return"Symbol("+(ae===void 0?"":ae)+")_"+B(++I+W,36)}},7040:function(q,Z,j){var E=j(4495);q.exports=E&&!Symbol.sham&&typeof Symbol.iterator=="symbol"},8686:function(q,Z,j){var E=j(3724),I=j(9039);q.exports=E&&I((function(){return Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype!==42}))},8622:function(q,Z,j){var E=j(4576),I=j(4901),W=E.WeakMap;q.exports=I(W)&&/native code/.test(String(W))},511:function(q,Z,j){var E=j(9167),I=j(9297),W=j(1951),B=j(4913).f;q.exports=function(ae){var z=E.Symbol||(E.Symbol={});I(z,ae)||B(z,ae,{value:W.f(ae)})}},1951:function(q,Z,j){var E=j(8227);Z.f=E},8227:function(q,Z,j){var E=j(4576),I=j(5745),W=j(9297),B=j(3392),ae=j(4495),z=j(7040),V=E.Symbol,ee=I("wks"),K=z?V.for||V:V&&V.withoutSetter||B;q.exports=function(ne){return W(ee,ne)||(ee[ne]=ae&&W(V,ne)?V[ne]:K("Symbol."+ne)),ee[ne]}},7452:function(q){q.exports=`
- \v\f\r \u2028\u2029\uFEFF`},8706:function(q,Z,j){var E=j(6518),I=j(9039),W=j(4376),B=j(34),ae=j(8981),z=j(6198),V=j(6837),ee=j(4659),K=j(4527),ne=j(1469),se=j(597),ce=j(8227),fe=j(9519),oe=ce("isConcatSpreadable"),O=fe>=51||!I((function(){var Q=[];return Q[oe]=!1,Q.concat()[0]!==Q})),F=function(Q){if(!B(Q))return!1;var ve=Q[oe];return ve!==void 0?!!ve:W(Q)};E({target:"Array",proto:!0,arity:1,forced:!O||!se("concat")},{concat:function(Q){var ve,he,de,Ae,_e,ze=ae(this),Be=ne(ze,0),Ue=0;for(ve=-1,de=arguments.length;ve<de;ve++)if(F(_e=ve===-1?ze:arguments[ve]))for(Ae=z(_e),V(Ue+Ae),he=0;he<Ae;he++,Ue++)he in _e&&ee(Be,Ue,_e[he]);else V(Ue+1),ee(Be,Ue++,_e);return K(Be,Ue),Be}})},2008:function(q,Z,j){var E=j(6518),I=j(9213).filter;E({target:"Array",proto:!0,forced:!j(597)("filter")},{filter:function(W){return I(this,W,arguments.length>1?arguments[1]:void 0)}})},3418:function(q,Z,j){var E=j(6518),I=j(7916);E({target:"Array",stat:!0,forced:!j(4428)((function(W){Array.from(W)}))},{from:I})},4423:function(q,Z,j){var E=j(6518),I=j(9617).includes,W=j(9039),B=j(6469);E({target:"Array",proto:!0,forced:W((function(){return!Array(1).includes()}))},{includes:function(ae){return I(this,ae,arguments.length>1?arguments[1]:void 0)}}),B("includes")},5276:function(q,Z,j){var E=j(6518),I=j(7476),W=j(9617).indexOf,B=j(4598),ae=I([].indexOf),z=!!ae&&1/ae([1],1,-0)<0;E({target:"Array",proto:!0,forced:z||!B("indexOf")},{indexOf:function(V){var ee=arguments.length>1?arguments[1]:void 0;return z?ae(this,V,ee)||0:W(this,V,ee)}})},3792:function(q,Z,j){var E=j(5397),I=j(6469),W=j(6269),B=j(1181),ae=j(4913).f,z=j(1088),V=j(2529),ee=j(6395),K=j(3724),ne="Array Iterator",se=B.set,ce=B.getterFor(ne);q.exports=z(Array,"Array",(function(oe,O){se(this,{type:ne,target:E(oe),index:0,kind:O})}),(function(){var oe=ce(this),O=oe.target,F=oe.index++;if(!O||F>=O.length)return oe.target=null,V(void 0,!0);switch(oe.kind){case"keys":return V(F,!1);case"values":return V(O[F],!1)}return V([F,O[F]],!1)}),"values");var fe=W.Arguments=W.Array;if(I("keys"),I("values"),I("entries"),!ee&&K&&fe.name!=="values")try{ae(fe,"name",{value:"values"})}catch{}},8598:function(q,Z,j){var E=j(6518),I=j(9504),W=j(7055),B=j(5397),ae=j(4598),z=I([].join);E({target:"Array",proto:!0,forced:W!==Object||!ae("join",",")},{join:function(V){return z(B(this),V===void 0?",":V)}})},2062:function(q,Z,j){var E=j(6518),I=j(9213).map;E({target:"Array",proto:!0,forced:!j(597)("map")},{map:function(W){return I(this,W,arguments.length>1?arguments[1]:void 0)}})},2712:function(q,Z,j){var E=j(6518),I=j(926).left,W=j(4598),B=j(9519);E({target:"Array",proto:!0,forced:!j(6193)&&B>79&&B<83||!W("reduce")},{reduce:function(ae){var z=arguments.length;return I(this,ae,z,z>1?arguments[1]:void 0)}})},4782:function(q,Z,j){var E=j(6518),I=j(4376),W=j(3517),B=j(34),ae=j(5610),z=j(6198),V=j(5397),ee=j(4659),K=j(4527),ne=j(8227),se=j(597),ce=j(7680),fe=se("slice"),oe=ne("species"),O=Array,F=Math.max;E({target:"Array",proto:!0,forced:!fe},{slice:function(Q,ve){var he,de,Ae,_e=V(this),ze=z(_e),Be=ae(Q,ze),Ue=ae(ve===void 0?ze:ve,ze);if(I(_e)&&(he=_e.constructor,(W(he)&&(he===O||I(he.prototype))||B(he)&&(he=he[oe])===null)&&(he=void 0),he===O||he===void 0))return ce(_e,Be,Ue);for(de=new(he===void 0?O:he)(F(Ue-Be,0)),Ae=0;Be<Ue;Be++,Ae++)Be in _e&&ee(de,Ae,_e[Be]);return K(de,Ae),de}})},6910:function(q,Z,j){var E=j(6518),I=j(9504),W=j(9306),B=j(8981),ae=j(6198),z=j(4606),V=j(655),ee=j(9039),K=j(4488),ne=j(4598),se=j(3709),ce=j(3763),fe=j(9519),oe=j(3607),O=[],F=I(O.sort),Q=I(O.push),ve=ee((function(){O.sort(void 0)})),he=ee((function(){O.sort(null)})),de=ne("sort"),Ae=!ee((function(){if(fe)return fe<70;if(!(se&&se>3)){if(ce)return!0;if(oe)return oe<603;var _e,ze,Be,Ue,Ne="";for(_e=65;_e<76;_e++){switch(ze=String.fromCharCode(_e),_e){case 66:case 69:case 70:case 72:Be=3;break;case 68:case 71:Be=4;break;default:Be=2}for(Ue=0;Ue<47;Ue++)O.push({k:ze+Ue,v:Be})}for(O.sort((function(Ee,ke){return ke.v-Ee.v})),Ue=0;Ue<O.length;Ue++)ze=O[Ue].k.charAt(0),Ne.charAt(Ne.length-1)!==ze&&(Ne+=ze);return Ne!=="DGBEFHACIJK"}}));E({target:"Array",proto:!0,forced:ve||!he||!de||!Ae},{sort:function(_e){_e!==void 0&&W(_e);var ze=B(this);if(Ae)return _e===void 0?F(ze):F(ze,_e);var Be,Ue,Ne=[],Ee=ae(ze);for(Ue=0;Ue<Ee;Ue++)Ue in ze&&Q(Ne,ze[Ue]);for(K(Ne,(function(ke){return function(Me,Ge){return Ge===void 0?-1:Me===void 0?1:ke!==void 0?+ke(Me,Ge)||0:V(Me)>V(Ge)?1:-1}})(_e)),Be=ae(Ne),Ue=0;Ue<Be;)ze[Ue]=Ne[Ue++];for(;Ue<Ee;)z(ze,Ue++);return ze}})},4554:function(q,Z,j){var E=j(6518),I=j(8981),W=j(5610),B=j(1291),ae=j(6198),z=j(4527),V=j(6837),ee=j(1469),K=j(4659),ne=j(4606),se=j(597)("splice"),ce=Math.max,fe=Math.min;E({target:"Array",proto:!0,forced:!se},{splice:function(oe,O){var F,Q,ve,he,de,Ae,_e=I(this),ze=ae(_e),Be=W(oe,ze),Ue=arguments.length;for(Ue===0?F=Q=0:Ue===1?(F=0,Q=ze-Be):(F=Ue-2,Q=fe(ce(B(O),0),ze-Be)),V(ze+F-Q),ve=ee(_e,Q),he=0;he<Q;he++)(de=Be+he)in _e&&K(ve,he,_e[de]);if(z(ve,Q),F<Q){for(he=Be;he<ze-Q;he++)Ae=he+F,(de=he+Q)in _e?_e[Ae]=_e[de]:ne(_e,Ae);for(he=ze;he>ze-Q+F;he--)ne(_e,he-1)}else if(F>Q)for(he=ze-Q;he>Be;he--)Ae=he+F-1,(de=he+Q-1)in _e?_e[Ae]=_e[de]:ne(_e,Ae);for(he=0;he<F;he++)_e[he+Be]=arguments[he+2];return z(_e,ze-Q+F),ve}})},739:function(q,Z,j){var E=j(6518),I=j(9039),W=j(8981),B=j(2777);E({target:"Date",proto:!0,arity:1,forced:I((function(){return new Date(NaN).toJSON()!==null||Date.prototype.toJSON.call({toISOString:function(){return 1}})!==1}))},{toJSON:function(ae){var z=W(this),V=B(z,"number");return typeof V!="number"||isFinite(V)?z.toISOString():null}})},9572:function(q,Z,j){var E=j(9297),I=j(6840),W=j(3640),B=j(8227)("toPrimitive"),ae=Date.prototype;E(ae,B)||I(ae,B,W)},2010:function(q,Z,j){var E=j(3724),I=j(350).EXISTS,W=j(9504),B=j(2106),ae=Function.prototype,z=W(ae.toString),V=/function\b(?:\s|\/\*[\S\s]*?\*\/|\/\/[^\n\r]*[\n\r]+)*([^\s(/]*)/,ee=W(V.exec);E&&!I&&B(ae,"name",{configurable:!0,get:function(){try{return ee(V,z(this))[1]}catch{return""}}})},3110:function(q,Z,j){var E=j(6518),I=j(7751),W=j(8745),B=j(9565),ae=j(9504),z=j(9039),V=j(4376),ee=j(4901),K=j(5810),ne=j(757),se=j(2195),ce=j(655),fe=j(7680),oe=j(8235),O=j(3392),F=j(4495),Q=j(7819),ve=String,he=I("JSON","stringify"),de=ae(/./.exec),Ae=ae("".charAt),_e=ae("".charCodeAt),ze=ae("".replace),Be=ae("".slice),Ue=ae([].push),Ne=ae(1.1.toString),Ee=/[\uD800-\uDFFF]/g,ke=/^[\uD800-\uDBFF]$/,Me=/^[\uDC00-\uDFFF]$/,Ge=O(),xe=Ge.length,He=!F||z((function(){var $e=I("Symbol")("stringify detection");return he([$e])!=="[null]"||he({a:$e})!=="{}"||he(Object($e))!=="{}"})),Pe=z((function(){return he("\uDF06\uD834")!=='"\\udf06\\ud834"'||he("\uDEAD")!=='"\\udead"'})),Ve=He?function($e,Ye){var lt=fe(arguments),St=ye(Ye);if(ee(St)||$e!==void 0&&!ne($e))return lt[1]=function(ot,ft){if(ee(St)&&(ft=B(St,this,ve(ot),ft)),!ne(ft))return ft},W(he,null,lt)}:he,je=function($e,Ye,lt){var St=Ae(lt,Ye-1),ot=Ae(lt,Ye+1);return de(ke,$e)&&!de(Me,ot)||de(Me,$e)&&!de(ke,St)?"\\u"+Ne(_e($e,0),16):$e},ye=function($e){if(ee($e))return $e;if(V($e)){for(var Ye=$e.length,lt=[],St=0;St<Ye;St++){var ot=$e[St];typeof ot=="string"?Ue(lt,ot):typeof ot!="number"&&se(ot)!=="Number"&&se(ot)!=="String"||Ue(lt,ce(ot))}var ft=lt.length,qe=!0;return function(ht,yt){if(qe)return qe=!1,yt;if(V(this))return yt;for(var Bt=0;Bt<ft;Bt++)if(lt[Bt]===ht)return yt}}};he&&E({target:"JSON",stat:!0,arity:3,forced:He||Pe||!Q},{stringify:function($e,Ye,lt){var St=ye(Ye),ot=[],ft=Ve($e,(function(Xt,$t){var nn=ee(St)?B(St,this,ve(Xt),$t):$t;return!Q&&K(nn)?Ge+(Ue(ot,nn.rawJSON)-1):nn}),lt);if(typeof ft!="string"||(Pe&&(ft=ze(ft,Ee,je)),Q))return ft;for(var qe="",ht=ft.length,yt=0;yt<ht;yt++){var Bt=Ae(ft,yt);if(Bt==='"'){var Yt=oe(ft,++yt).end-1,xn=Be(ft,yt,Yt);qe+=Be(xn,0,xe)===Ge?ot[Be(xn,xe)]:'"'+xn+'"',yt=Yt}else qe+=Bt}return qe}})},2892:function(q,Z,j){var E=j(6518),I=j(6395),W=j(3724),B=j(4576),ae=j(9167),z=j(9504),V=j(2796),ee=j(9297),K=j(3167),ne=j(1625),se=j(757),ce=j(2777),fe=j(9039),oe=j(8480).f,O=j(7347).f,F=j(4913).f,Q=j(1240),ve=j(3802).trim,he="Number",de=B[he],Ae=ae[he],_e=de.prototype,ze=B.TypeError,Be=z("".slice),Ue=z("".charCodeAt),Ne=function(Ge){var xe,He,Pe,Ve,je,ye,$e,Ye,lt=ce(Ge,"number");if(se(lt))throw new ze("Cannot convert a Symbol value to a number");if(typeof lt=="string"&<.length>2){if(lt=ve(lt),(xe=Ue(lt,0))===43||xe===45){if((He=Ue(lt,2))===88||He===120)return NaN}else if(xe===48){switch(Ue(lt,1)){case 66:case 98:Pe=2,Ve=49;break;case 79:case 111:Pe=8,Ve=55;break;default:return+lt}for(ye=(je=Be(lt,2)).length,$e=0;$e<ye;$e++)if((Ye=Ue(je,$e))<48||Ye>Ve)return NaN;return parseInt(je,Pe)}}return+lt},Ee=V(he,!de(" 0o1")||!de("0b1")||de("+0x1")),ke=function(Ge){var xe,He=arguments.length<1?0:de((function(Pe){var Ve=ce(Pe,"number");return typeof Ve=="bigint"?Ve:Ne(Ve)})(Ge));return ne(_e,xe=this)&&fe((function(){Q(xe)}))?K(Object(He),this,ke):He};ke.prototype=_e,Ee&&!I&&(_e.constructor=ke),E({global:!0,constructor:!0,wrap:!0,forced:Ee},{Number:ke});var Me=function(Ge,xe){for(var He,Pe=W?oe(xe):"MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,isFinite,isInteger,isNaN,isSafeInteger,parseFloat,parseInt,fromString,range".split(","),Ve=0;Pe.length>Ve;Ve++)ee(xe,He=Pe[Ve])&&!ee(Ge,He)&&F(Ge,He,O(xe,He))};I&&Ae&&Me(ae[he],Ae),(Ee||I)&&Me(ae[he],de)},2637:function(q,Z,j){j(6518)({target:"Number",stat:!0},{isInteger:j(2087)})},9085:function(q,Z,j){var E=j(6518),I=j(4213);E({target:"Object",stat:!0,arity:2,forced:Object.assign!==I},{assign:I})},7427:function(q,Z,j){var E=j(6518),I=j(3724),W=j(2551),B=j(9306),ae=j(8981),z=j(4913);I&&E({target:"Object",proto:!0,forced:W},{__defineGetter__:function(V,ee){z.f(ae(this),V,{get:B(ee),enumerable:!0,configurable:!0})}})},3851:function(q,Z,j){var E=j(6518),I=j(9039),W=j(5397),B=j(7347).f,ae=j(3724);E({target:"Object",stat:!0,forced:!ae||I((function(){B(1)})),sham:!ae},{getOwnPropertyDescriptor:function(z,V){return B(W(z),V)}})},1278:function(q,Z,j){var E=j(6518),I=j(3724),W=j(5031),B=j(5397),ae=j(7347),z=j(4659);E({target:"Object",stat:!0,sham:!I},{getOwnPropertyDescriptors:function(V){for(var ee,K,ne=B(V),se=ae.f,ce=W(ne),fe={},oe=0;ce.length>oe;)(K=se(ne,ee=ce[oe++]))!==void 0&&z(fe,ee,K);return fe}})},1480:function(q,Z,j){var E=j(6518),I=j(9039),W=j(298).f;E({target:"Object",stat:!0,forced:I((function(){return!Object.getOwnPropertyNames(1)}))},{getOwnPropertyNames:W})},9773:function(q,Z,j){var E=j(6518),I=j(4495),W=j(9039),B=j(3717),ae=j(8981);E({target:"Object",stat:!0,forced:!I||W((function(){B.f(1)}))},{getOwnPropertySymbols:function(z){var V=B.f;return V?V(ae(z)):[]}})},9432:function(q,Z,j){var E=j(6518),I=j(8981),W=j(1072);E({target:"Object",stat:!0,forced:j(9039)((function(){W(1)}))},{keys:function(B){return W(I(B))}})},6099:function(q,Z,j){var E=j(2140),I=j(6840),W=j(3179);E||I(Object.prototype,"toString",W,{unsafe:!0})},825:function(q,Z,j){var E=j(6518),I=j(7751),W=j(8745),B=j(566),ae=j(5548),z=j(8551),V=j(34),ee=j(2360),K=j(9039),ne=I("Reflect","construct"),se=Object.prototype,ce=[].push,fe=K((function(){function F(){}return!(ne((function(){}),[],F)instanceof F)})),oe=!K((function(){ne((function(){}))})),O=fe||oe;E({target:"Reflect",stat:!0,forced:O,sham:O},{construct:function(F,Q){ae(F),z(Q);var ve=arguments.length<3?F:ae(arguments[2]);if(oe&&!fe)return ne(F,Q,ve);if(F===ve){switch(Q.length){case 0:return new F;case 1:return new F(Q[0]);case 2:return new F(Q[0],Q[1]);case 3:return new F(Q[0],Q[1],Q[2]);case 4:return new F(Q[0],Q[1],Q[2],Q[3])}var he=[null];return W(ce,he,Q),new(W(B,F,he))}var de=ve.prototype,Ae=ee(V(de)?de:se),_e=W(F,Ae,Q);return V(_e)?_e:Ae}})},4864:function(q,Z,j){var E=j(3724),I=j(4576),W=j(9504),B=j(2796),ae=j(3167),z=j(6699),V=j(2360),ee=j(8480).f,K=j(1625),ne=j(788),se=j(655),ce=j(1034),fe=j(8429),oe=j(1056),O=j(6840),F=j(9039),Q=j(9297),ve=j(1181).enforce,he=j(7633),de=j(8227),Ae=j(3635),_e=j(8814),ze=de("match"),Be=I.RegExp,Ue=Be.prototype,Ne=I.SyntaxError,Ee=W(Ue.exec),ke=W("".charAt),Me=W("".replace),Ge=W("".indexOf),xe=W("".slice),He=/^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/,Pe=/a/g,Ve=/a/g,je=new Be(Pe)!==Pe,ye=fe.MISSED_STICKY,$e=fe.UNSUPPORTED_Y;if(B("RegExp",E&&(!je||ye||Ae||_e||F((function(){return Ve[ze]=!1,Be(Pe)!==Pe||Be(Ve)===Ve||String(Be(Pe,"i"))!=="/a/i"}))))){for(var Ye=function(ot,ft){var qe,ht,yt,Bt,Yt,xn,Xt=K(Ue,this),$t=ne(ot),nn=ft===void 0,on=[],cn=ot;if(!Xt&&$t&&nn&&ot.constructor===Ye)return ot;if(($t||K(Ue,ot))&&(ot=ot.source,nn&&(ft=ce(cn))),ot=ot===void 0?"":se(ot),ft=ft===void 0?"":se(ft),cn=ot,Ae&&"dotAll"in Pe&&(ht=!!ft&&Ge(ft,"s")>-1)&&(ft=Me(ft,/s/g,"")),qe=ft,ye&&"sticky"in Pe&&(yt=!!ft&&Ge(ft,"y")>-1)&&$e&&(ft=Me(ft,/y/g,"")),_e&&(Bt=(function(pn){for(var Ie,De=pn.length,Xe=0,at="",Ke=[],It=V(null),Te=!1,We=!1,et=0,Ze="";Xe<De;Xe++){if((Ie=ke(pn,Xe))==="\\")Ie+=ke(pn,++Xe);else if(Ie==="]")Te=!1;else if(!Te)switch(!0){case Ie==="[":Te=!0;break;case Ie==="(":if(at+=Ie,xe(pn,Xe+1,Xe+3)==="?:")continue;Ee(He,xe(pn,Xe+1))&&(Xe+=2,We=!0),et++;continue;case(Ie===">"&&We):if(Ze===""||Q(It,Ze))throw new Ne("Invalid capture group name");It[Ze]=!0,Ke[Ke.length]=[Ze,et],We=!1,Ze="";continue}We?Ze+=Ie:at+=Ie}return[at,Ke]})(ot),ot=Bt[0],on=Bt[1]),Yt=ae(Be(ot,ft),Xt?this:Ue,Ye),(ht||yt||on.length)&&(xn=ve(Yt),ht&&(xn.dotAll=!0,xn.raw=Ye((function(pn){for(var Ie,De=pn.length,Xe=0,at="",Ke=!1;Xe<De;Xe++)(Ie=ke(pn,Xe))!=="\\"?Ke||Ie!=="."?(Ie==="["?Ke=!0:Ie==="]"&&(Ke=!1),at+=Ie):at+="[\\s\\S]":at+=Ie+ke(pn,++Xe);return at})(ot),qe)),yt&&(xn.sticky=!0),on.length&&(xn.groups=on)),ot!==cn)try{z(Yt,"source",cn===""?"(?:)":cn)}catch{}return Yt},lt=ee(Be),St=0;lt.length>St;)oe(Ye,Be,lt[St++]);Ue.constructor=Ye,Ye.prototype=Ue,O(I,"RegExp",Ye,{constructor:!0})}he("RegExp")},7495:function(q,Z,j){var E=j(6518),I=j(7323);E({target:"RegExp",proto:!0,forced:/./.exec!==I},{exec:I})},8781:function(q,Z,j){var E=j(350).PROPER,I=j(6840),W=j(8551),B=j(655),ae=j(9039),z=j(1034),V="toString",ee=RegExp.prototype,K=ee[V],ne=ae((function(){return K.call({source:"a",flags:"b"})!=="/a/b"})),se=E&&K.name!==V;(ne||se)&&I(ee,V,(function(){var ce=W(this);return"/"+B(ce.source)+"/"+B(z(ce))}),{unsafe:!0})},1699:function(q,Z,j){var E=j(6518),I=j(9504),W=j(5749),B=j(7750),ae=j(655),z=j(1436),V=I("".indexOf);E({target:"String",proto:!0,forced:!z("includes")},{includes:function(ee){return!!~V(ae(B(this)),ae(W(ee)),arguments.length>1?arguments[1]:void 0)}})},7764:function(q,Z,j){var E=j(8183).charAt,I=j(655),W=j(1181),B=j(1088),ae=j(2529),z="String Iterator",V=W.set,ee=W.getterFor(z);B(String,"String",(function(K){V(this,{type:z,string:I(K),index:0})}),(function(){var K,ne=ee(this),se=ne.string,ce=ne.index;return ce>=se.length?ae(void 0,!0):(K=E(se,ce),ne.index+=K.length,ae(K,!1))}))},8543:function(q,Z,j){var E=j(6518),I=j(9565),W=j(7476),B=j(3994),ae=j(2529),z=j(7750),V=j(8014),ee=j(655),K=j(8551),ne=j(34),se=j(2195),ce=j(788),fe=j(1034),oe=j(5966),O=j(6840),F=j(9039),Q=j(8227),ve=j(2293),he=j(7829),de=j(6682),Ae=j(1181),_e=j(6395),ze=Q("matchAll"),Be="RegExp String",Ue=Be+" Iterator",Ne=Ae.set,Ee=Ae.getterFor(Ue),ke=RegExp.prototype,Me=TypeError,Ge=W("".indexOf),xe=W("".matchAll),He=!!xe&&!F((function(){xe("a",/./)})),Pe=B((function(je,ye,$e,Ye){Ne(this,{type:Ue,regexp:je,string:ye,global:$e,unicode:Ye,done:!1})}),Be,(function(){var je=Ee(this);if(je.done)return ae(void 0,!0);var ye=je.regexp,$e=je.string,Ye=de(ye,$e);return Ye===null?(je.done=!0,ae(void 0,!0)):je.global?(ee(Ye[0])===""&&(ye.lastIndex=he($e,V(ye.lastIndex),je.unicode)),ae(Ye,!1)):(je.done=!0,ae(Ye,!1))})),Ve=function(je){var ye,$e,Ye,lt=K(this),St=ee(je),ot=ve(lt,RegExp),ft=ee(fe(lt));return ye=new ot(ot===RegExp?lt.source:lt,ft),$e=!!~Ge(ft,"g"),Ye=!!~Ge(ft,"u"),ye.lastIndex=V(lt.lastIndex),new Pe(ye,St,$e,Ye)};E({target:"String",proto:!0,forced:He},{matchAll:function(je){var ye,$e,Ye,lt,St=z(this);if(ne(je)){if(ce(je)&&(ye=ee(z(fe(je))),!~Ge(ye,"g")))throw new Me("`.matchAll` does not allow non-global regexes");if(He)return xe(St,je);if((Ye=oe(je,ze))===void 0&&_e&&se(je)==="RegExp"&&(Ye=Ve),Ye)return I(Ye,je,St)}else if(He)return xe(St,je);return $e=ee(St),lt=new RegExp(je,"g"),_e?I(Ve,lt,$e):lt[ze]($e)}}),_e||ze in ke||O(ke,ze,Ve)},1761:function(q,Z,j){var E=j(9565),I=j(9504),W=j(9228),B=j(8551),ae=j(34),z=j(8014),V=j(655),ee=j(7750),K=j(5966),ne=j(7829),se=j(1034),ce=j(6682),fe=I("".indexOf);W("match",(function(oe,O,F){return[function(Q){var ve=ee(this),he=ae(Q)?K(Q,oe):void 0;return he?E(he,Q,ve):new RegExp(Q)[oe](V(ve))},function(Q){var ve=B(this),he=V(Q),de=F(O,ve,he);if(de.done)return de.value;var Ae=V(se(ve));if(fe(Ae,"g")===-1)return ce(ve,he);var _e=fe(Ae,"u")!==-1;ve.lastIndex=0;for(var ze,Be=[],Ue=0;(ze=ce(ve,he))!==null;){var Ne=V(ze[0]);Be[Ue]=Ne,Ne===""&&(ve.lastIndex=ne(he,z(ve.lastIndex),_e)),Ue++}return Ue===0?null:Be}]}))},5440:function(q,Z,j){var E=j(8745),I=j(9565),W=j(9504),B=j(9228),ae=j(9039),z=j(8551),V=j(4901),ee=j(34),K=j(1291),ne=j(8014),se=j(655),ce=j(7750),fe=j(7829),oe=j(5966),O=j(2478),F=j(1034),Q=j(6682),ve=j(8227)("replace"),he=Math.max,de=Math.min,Ae=W([].concat),_e=W([].push),ze=W("".indexOf),Be=W("".slice),Ue="a".replace(/./,"$0")==="$0",Ne=!!/./[ve]&&/./[ve]("a","$0")==="";B("replace",(function(Ee,ke,Me){var Ge=Ne?"$":"$0";return[function(xe,He){var Pe=ce(this),Ve=ee(xe)?oe(xe,ve):void 0;return Ve?I(Ve,xe,Pe,He):I(ke,se(Pe),xe,He)},function(xe,He){var Pe=z(this),Ve=se(xe);if(typeof He=="string"&&ze(He,Ge)===-1&&ze(He,"$<")===-1){var je=Me(ke,Pe,Ve,He);if(je.done)return je.value}var ye=V(He);ye||(He=se(He));var $e,Ye=se(F(Pe)),lt=ze(Ye,"g")!==-1;lt&&($e=ze(Ye,"u")!==-1,Pe.lastIndex=0);for(var St,ot=[];(St=Q(Pe,Ve))!==null&&(_e(ot,St),lt);)se(St[0])===""&&(Pe.lastIndex=fe(Ve,ne(Pe.lastIndex),$e));for(var ft,qe="",ht=0,yt=0;yt<ot.length;yt++){for(var Bt,Yt=se((St=ot[yt])[0]),xn=he(de(K(St.index),Ve.length),0),Xt=[],$t=1;$t<St.length;$t++)_e(Xt,(ft=St[$t])===void 0?ft:String(ft));var nn=St.groups;if(ye){var on=Ae([Yt],Xt,xn,Ve);nn!==void 0&&_e(on,nn),Bt=se(E(He,void 0,on))}else Bt=O(Yt,Ve,xn,Xt,nn,He);xn>=ht&&(qe+=Be(Ve,ht,xn)+Bt,ht=xn+Yt.length)}return qe+Be(Ve,ht)}]}),!!ae((function(){var Ee=/./;return Ee.exec=function(){var ke=[];return ke.groups={a:"7"},ke},"".replace(Ee,"$<a>")!=="7"}))||!Ue||Ne)},744:function(q,Z,j){var E=j(9565),I=j(9504),W=j(9228),B=j(8551),ae=j(34),z=j(7750),V=j(2293),ee=j(7829),K=j(8014),ne=j(655),se=j(5966),ce=j(6682),fe=j(8429),oe=j(9039),O=fe.UNSUPPORTED_Y,F=Math.min,Q=I([].push),ve=I("".slice),he=!oe((function(){var Ae=/(?:)/,_e=Ae.exec;Ae.exec=function(){return _e.apply(this,arguments)};var ze="ab".split(Ae);return ze.length!==2||ze[0]!=="a"||ze[1]!=="b"})),de="abbc".split(/(b)*/)[1]==="c"||"test".split(/(?:)/,-1).length!==4||"ab".split(/(?:ab)*/).length!==2||".".split(/(.?)(.?)/).length!==4||".".split(/()()/).length>1||"".split(/.?/).length;W("split",(function(Ae,_e,ze){var Be="0".split(void 0,0).length?function(Ue,Ne){return Ue===void 0&&Ne===0?[]:E(_e,this,Ue,Ne)}:_e;return[function(Ue,Ne){var Ee=z(this),ke=ae(Ue)?se(Ue,Ae):void 0;return ke?E(ke,Ue,Ee,Ne):E(Be,ne(Ee),Ue,Ne)},function(Ue,Ne){var Ee=B(this),ke=ne(Ue);if(!de){var Me=ze(Be,Ee,ke,Ne,Be!==_e);if(Me.done)return Me.value}var Ge=V(Ee,RegExp),xe=Ee.unicode,He=(Ee.ignoreCase?"i":"")+(Ee.multiline?"m":"")+(Ee.unicode?"u":"")+(O?"g":"y"),Pe=new Ge(O?"^(?:"+Ee.source+")":Ee,He),Ve=Ne===void 0?4294967295:Ne>>>0;if(Ve===0)return[];if(ke.length===0)return ce(Pe,ke)===null?[ke]:[];for(var je=0,ye=0,$e=[];ye<ke.length;){Pe.lastIndex=O?0:ye;var Ye,lt=ce(Pe,O?ve(ke,ye):ke);if(lt===null||(Ye=F(K(Pe.lastIndex+(O?ye:0)),ke.length))===je)ye=ee(ke,ye,xe);else{if(Q($e,ve(ke,je,ye)),$e.length===Ve)return $e;for(var St=1;St<=lt.length-1;St++)if(Q($e,lt[St]),$e.length===Ve)return $e;ye=je=Ye}}return Q($e,ve(ke,je)),$e}]}),de||!he,O)},2762:function(q,Z,j){var E=j(6518),I=j(3802).trim;E({target:"String",proto:!0,forced:j(706)("trim")},{trim:function(){return I(this)}})},6761:function(q,Z,j){var E=j(6518),I=j(4576),W=j(9565),B=j(9504),ae=j(6395),z=j(3724),V=j(4495),ee=j(9039),K=j(9297),ne=j(1625),se=j(8551),ce=j(5397),fe=j(6969),oe=j(655),O=j(6980),F=j(2360),Q=j(1072),ve=j(8480),he=j(298),de=j(3717),Ae=j(7347),_e=j(4913),ze=j(6801),Be=j(8773),Ue=j(6840),Ne=j(2106),Ee=j(5745),ke=j(6119),Me=j(421),Ge=j(3392),xe=j(8227),He=j(1951),Pe=j(511),Ve=j(8242),je=j(687),ye=j(1181),$e=j(9213).forEach,Ye=ke("hidden"),lt="Symbol",St="prototype",ot=ye.set,ft=ye.getterFor(lt),qe=Object[St],ht=I.Symbol,yt=ht&&ht[St],Bt=I.RangeError,Yt=I.TypeError,xn=I.QObject,Xt=Ae.f,$t=_e.f,nn=he.f,on=Be.f,cn=B([].push),pn=Ee("symbols"),Ie=Ee("op-symbols"),De=Ee("wks"),Xe=!xn||!xn[St]||!xn[St].findChild,at=function(st,tt,Nt){var Rt=Xt(qe,tt);Rt&&delete qe[tt],$t(st,tt,Nt),Rt&&st!==qe&&$t(qe,tt,Rt)},Ke=z&&ee((function(){return F($t({},"a",{get:function(){return $t(this,"a",{value:7}).a}})).a!==7}))?at:$t,It=function(st,tt){var Nt=pn[st]=F(yt);return ot(Nt,{type:lt,tag:st,description:tt}),z||(Nt.description=tt),Nt},Te=function(st,tt,Nt){st===qe&&Te(Ie,tt,Nt),se(st);var Rt=fe(tt);return se(Nt),K(pn,Rt)?(Nt.enumerable?(K(st,Ye)&&st[Ye][Rt]&&(st[Ye][Rt]=!1),Nt=F(Nt,{enumerable:O(0,!1)})):(K(st,Ye)||$t(st,Ye,O(1,F(null))),st[Ye][Rt]=!0),Ke(st,Rt,Nt)):$t(st,Rt,Nt)},We=function(st,tt){se(st);var Nt=ce(tt),Rt=Q(Nt).concat(mt(Nt));return $e(Rt,(function(jt){z&&!W(et,Nt,jt)||Te(st,jt,Nt[jt])})),st},et=function(st){var tt=fe(st),Nt=W(on,this,tt);return!(this===qe&&K(pn,tt)&&!K(Ie,tt))&&(!(Nt||!K(this,tt)||!K(pn,tt)||K(this,Ye)&&this[Ye][tt])||Nt)},Ze=function(st,tt){var Nt=ce(st),Rt=fe(tt);if(Nt!==qe||!K(pn,Rt)||K(Ie,Rt)){var jt=Xt(Nt,Rt);return!jt||!K(pn,Rt)||K(Nt,Ye)&&Nt[Ye][Rt]||(jt.enumerable=!0),jt}},Le=function(st){var tt=nn(ce(st)),Nt=[];return $e(tt,(function(Rt){K(pn,Rt)||K(Me,Rt)||cn(Nt,Rt)})),Nt},mt=function(st){var tt=st===qe,Nt=nn(tt?Ie:ce(st)),Rt=[];return $e(Nt,(function(jt){!K(pn,jt)||tt&&!K(qe,jt)||cn(Rt,pn[jt])})),Rt};V||(ht=function(){if(ne(yt,this))throw new Yt("Symbol is not a constructor");var st=arguments.length&&arguments[0]!==void 0?oe(arguments[0]):void 0,tt=Ge(st),Nt=function(Rt){var jt=this===void 0?I:this;jt===qe&&W(Nt,Ie,Rt),K(jt,Ye)&&K(jt[Ye],tt)&&(jt[Ye][tt]=!1);var Ft=O(1,Rt);try{Ke(jt,tt,Ft)}catch(mn){if(!(mn instanceof Bt))throw mn;at(jt,tt,Ft)}};return z&&Xe&&Ke(qe,tt,{configurable:!0,set:Nt}),It(tt,st)},Ue(yt=ht[St],"toString",(function(){return ft(this).tag})),Ue(ht,"withoutSetter",(function(st){return It(Ge(st),st)})),Be.f=et,_e.f=Te,ze.f=We,Ae.f=Ze,ve.f=he.f=Le,de.f=mt,He.f=function(st){return It(xe(st),st)},z&&(Ne(yt,"description",{configurable:!0,get:function(){return ft(this).description}}),ae||Ue(qe,"propertyIsEnumerable",et,{unsafe:!0}))),E({global:!0,constructor:!0,wrap:!0,forced:!V,sham:!V},{Symbol:ht}),$e(Q(De),(function(st){Pe(st)})),E({target:lt,stat:!0,forced:!V},{useSetter:function(){Xe=!0},useSimple:function(){Xe=!1}}),E({target:"Object",stat:!0,forced:!V,sham:!z},{create:function(st,tt){return tt===void 0?F(st):We(F(st),tt)},defineProperty:Te,defineProperties:We,getOwnPropertyDescriptor:Ze}),E({target:"Object",stat:!0,forced:!V},{getOwnPropertyNames:Le}),Ve(),je(ht,lt),Me[Ye]=!0},9463:function(q,Z,j){var E=j(6518),I=j(3724),W=j(4576),B=j(9504),ae=j(9297),z=j(4901),V=j(1625),ee=j(655),K=j(2106),ne=j(7740),se=W.Symbol,ce=se&&se.prototype;if(I&&z(se)&&(!("description"in ce)||se().description!==void 0)){var fe={},oe=function(){var Ae=arguments.length<1||arguments[0]===void 0?void 0:ee(arguments[0]),_e=V(ce,this)?new se(Ae):Ae===void 0?se():se(Ae);return Ae===""&&(fe[_e]=!0),_e};ne(oe,se),oe.prototype=ce,ce.constructor=oe;var O=String(se("description detection"))==="Symbol(description detection)",F=B(ce.valueOf),Q=B(ce.toString),ve=/^Symbol\((.*)\)[^)]+$/,he=B("".replace),de=B("".slice);K(ce,"description",{configurable:!0,get:function(){var Ae=F(this);if(ae(fe,Ae))return"";var _e=Q(Ae),ze=O?de(_e,7,-1):he(_e,ve,"$1");return ze===""?void 0:ze}}),E({global:!0,constructor:!0,forced:!0},{Symbol:oe})}},1510:function(q,Z,j){var E=j(6518),I=j(7751),W=j(9297),B=j(655),ae=j(5745),z=j(1296),V=ae("string-to-symbol-registry"),ee=ae("symbol-to-string-registry");E({target:"Symbol",stat:!0,forced:!z},{for:function(K){var ne=B(K);if(W(V,ne))return V[ne];var se=I("Symbol")(ne);return V[ne]=se,ee[se]=ne,se}})},2259:function(q,Z,j){j(511)("iterator")},2675:function(q,Z,j){j(6761),j(1510),j(7812),j(3110),j(9773)},7812:function(q,Z,j){var E=j(6518),I=j(9297),W=j(757),B=j(6823),ae=j(5745),z=j(1296),V=ae("symbol-to-string-registry");E({target:"Symbol",stat:!0,forced:!z},{keyFor:function(ee){if(!W(ee))throw new TypeError(B(ee)+" is not a symbol");if(I(V,ee))return V[ee]}})},5700:function(q,Z,j){var E=j(511),I=j(8242);E("toPrimitive"),I()},8344:function(q,Z,j){j(8543)},3500:function(q,Z,j){var E=j(4576),I=j(7400),W=j(9296),B=j(235),ae=j(6699),z=function(ee){if(ee&&ee.forEach!==B)try{ae(ee,"forEach",B)}catch{ee.forEach=B}};for(var V in I)I[V]&&z(E[V]&&E[V].prototype);z(W)},2953:function(q,Z,j){var E=j(4576),I=j(7400),W=j(9296),B=j(3792),ae=j(6699),z=j(687),V=j(8227)("iterator"),ee=B.values,K=function(se,ce){if(se){if(se[V]!==ee)try{ae(se,V,ee)}catch{se[V]=ee}if(z(se,ce,!0),I[ce]){for(var fe in B)if(se[fe]!==B[fe])try{ae(se,fe,B[fe])}catch{se[fe]=B[fe]}}}};for(var ne in I)K(E[ne]&&E[ne].prototype,ne);K(W,"DOMTokenList")}},d={};function u(q){var Z=d[q];if(Z!==void 0)return Z.exports;var j=d[q]={exports:{}};return c[q].call(j.exports,j,j.exports,u),j.exports}u.d=function(q,Z){for(var j in Z)u.o(Z,j)&&!u.o(q,j)&&Object.defineProperty(q,j,{enumerable:!0,get:Z[j]})},u.g=(function(){if(typeof globalThis=="object")return globalThis;try{return this||new Function("return this")()}catch{if(typeof window=="object")return window}})(),u.o=function(q,Z){return Object.prototype.hasOwnProperty.call(q,Z)},u.r=function(q){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(q,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(q,"__esModule",{value:!0})};var m={};function p(q){return(function(Z){if(Array.isArray(Z))return y(Z)})(q)||(function(Z){if(typeof Symbol<"u"&&Z[Symbol.iterator]!=null||Z["@@iterator"]!=null)return Array.from(Z)})(q)||f(q)||(function(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)})()}function f(q,Z){if(q){if(typeof q=="string")return y(q,Z);var j={}.toString.call(q).slice(8,-1);return j==="Object"&&q.constructor&&(j=q.constructor.name),j==="Map"||j==="Set"?Array.from(q):j==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(j)?y(q,Z):void 0}}function y(q,Z){(Z==null||Z>q.length)&&(Z=q.length);for(var j=0,E=Array(Z);j<Z;j++)E[j]=q[j];return E}function x(q){return x=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(Z){return typeof Z}:function(Z){return Z&&typeof Symbol=="function"&&Z.constructor===Symbol&&Z!==Symbol.prototype?"symbol":typeof Z},x(q)}function b(q,Z){for(var j=0;j<Z.length;j++){var E=Z[j];E.enumerable=E.enumerable||!1,E.configurable=!0,"value"in E&&(E.writable=!0),Object.defineProperty(q,_(E.key),E)}}function v(q,Z,j){return(Z=_(Z))in q?Object.defineProperty(q,Z,{value:j,enumerable:!0,configurable:!0,writable:!0}):q[Z]=j,q}function _(q){var Z=(function(j,E){if(x(j)!="object"||!j)return j;var I=j[Symbol.toPrimitive];if(I!==void 0){var W=I.call(j,E);if(x(W)!="object")return W;throw new TypeError("@@toPrimitive must return a primitive value.")}return(E==="string"?String:Number)(j)})(q,"string");return x(Z)=="symbol"?Z:Z+""}u.r(m),u.d(m,{SimpleKeyboard:function(){return pe},default:function(){return Ce}}),u(5276),u(8598),u(4782),u(4554),u(2010),u(7427),u(6099),u(7495),u(8781),u(5440),u(744),u(2762),typeof Element>"u"||"remove"in Element.prototype||(Element.prototype.remove=function(){this.parentNode&&this.parentNode.removeChild(this)}),typeof self<"u"&&"document"in self&&((!("classList"in document.createElement("_"))||document.createElementNS&&!("classList"in document.createElementNS("http://www.w3.org/2000/svg","g")))&&(function(q){if("Element"in q){var Z="classList",j="prototype",E=q.Element[j],I=Object,W=String[j].trim||function(){return this.replace(/^\s+|\s+$/g,"")},B=Array[j].indexOf||function(se){for(var ce=0,fe=this.length;ce<fe;ce++)if(ce in this&&this[ce]===se)return ce;return-1},ae=function(se,ce){this.name=se,this.code=DOMException[se],this.message=ce},z=function(se,ce){if(ce==="")throw new ae("SYNTAX_ERR","The token must not be empty.");if(/\s/.test(ce))throw new ae("INVALID_CHARACTER_ERR","The token must not contain space characters.");return B.call(se,ce)},V=function(se){for(var ce=W.call(se.getAttribute("class")||""),fe=ce?ce.split(/\s+/):[],oe=0,O=fe.length;oe<O;oe++)this.push(fe[oe]);this._updateClassName=function(){se.setAttribute("class",this.toString())}},ee=V[j]=[],K=function(){return new V(this)};if(ae[j]=Error[j],ee.item=function(se){return this[se]||null},ee.contains=function(se){return~z(this,se+"")},ee.add=function(){var se,ce=arguments,fe=0,oe=ce.length,O=!1;do~z(this,se=ce[fe]+"")||(this.push(se),O=!0);while(++fe<oe);O&&this._updateClassName()},ee.remove=function(){var se,ce,fe=arguments,oe=0,O=fe.length,F=!1;do for(ce=z(this,se=fe[oe]+"");~ce;)this.splice(ce,1),F=!0,ce=z(this,se);while(++oe<O);F&&this._updateClassName()},ee.toggle=function(se,ce){var fe=this.contains(se),oe=fe?ce!==!0&&"remove":ce!==!1&&"add";return oe&&this[oe](se),ce===!0||ce===!1?ce:!fe},ee.replace=function(se,ce){var fe=z(se+"");~fe&&(this.splice(fe,1,ce),this._updateClassName())},ee.toString=function(){return this.join(" ")},I.defineProperty){var ne={get:K,enumerable:!0,configurable:!0};try{I.defineProperty(E,Z,ne)}catch(se){se.number!==void 0&&se.number!==-2146823252||(ne.enumerable=!1,I.defineProperty(E,Z,ne))}}else I[j].__defineGetter__&&E.__defineGetter__(Z,K)}})(self),(function(){var q=document.createElement("_");if(q.classList.add("c1","c2"),!q.classList.contains("c2")){var Z=function(E){var I=DOMTokenList.prototype[E];DOMTokenList.prototype[E]=function(W){var B,ae=arguments.length;for(B=0;B<ae;B++)W=arguments[B],I.call(this,W)}};Z("add"),Z("remove")}if(q.classList.toggle("c3",!1),q.classList.contains("c3")){var j=DOMTokenList.prototype.toggle;DOMTokenList.prototype.toggle=function(E,I){return 1 in arguments&&!this.contains(E)==!I?I:j.call(this,E)}}"replace"in document.createElement("_").classList||(DOMTokenList.prototype.replace=function(E,I){var W=this.toString().split(" "),B=W.indexOf(E+"");~B&&(W=W.slice(B),this.remove.apply(this,W),this.add(I),this.add.apply(this,W.slice(1)))}),q=null})()),u(2675),u(9463),u(2259),u(5700),u(8706),u(2008),u(3418),u(4423),u(3792),u(2062),u(6910),u(739),u(9572),u(2892),u(9085),u(3851),u(1278),u(9432),u(4864),u(1699),u(7764),u(8344),u(3500),u(2953),u(2712),u(2637),u(1480),u(825),u(1761);var k=(function(){return q=function E(I){var W=I.getOptions,B=I.getCaretPosition,ae=I.getCaretPositionEnd,z=I.dispatch;(function(V,ee){if(!(V instanceof ee))throw new TypeError("Cannot call a class as a function")})(this,E),v(this,"getOptions",void 0),v(this,"getCaretPosition",void 0),v(this,"getCaretPositionEnd",void 0),v(this,"dispatch",void 0),v(this,"maxLengthReached",void 0),v(this,"isStandardButton",(function(V){return V&&!(V[0]==="{"&&V[V.length-1]==="}")})),this.getOptions=W,this.getCaretPosition=B,this.getCaretPositionEnd=ae,this.dispatch=z,E.bindMethods(E,this)},Z=[{key:"getButtonType",value:function(E){return E.includes("{")&&E.includes("}")&&E!=="{//}"?"functionBtn":"standardBtn"}},{key:"getButtonClass",value:function(E){var I=this.getButtonType(E),W=E.replace("{","").replace("}",""),B="";return I!=="standardBtn"&&(B=" hg-button-".concat(W)),"hg-".concat(I).concat(B)}},{key:"getDefaultDiplay",value:function(){return{"{bksp}":"backspace","{backspace}":"backspace","{enter}":"< enter","{shift}":"shift","{shiftleft}":"shift","{shiftright}":"shift","{alt}":"alt","{s}":"shift","{tab}":"tab","{lock}":"caps","{capslock}":"caps","{accept}":"Submit","{space}":" ","{//}":" ","{esc}":"esc","{escape}":"esc","{f1}":"f1","{f2}":"f2","{f3}":"f3","{f4}":"f4","{f5}":"f5","{f6}":"f6","{f7}":"f7","{f8}":"f8","{f9}":"f9","{f10}":"f10","{f11}":"f11","{f12}":"f12","{numpaddivide}":"/","{numlock}":"lock","{arrowup}":"↑","{arrowleft}":"←","{arrowdown}":"↓","{arrowright}":"→","{prtscr}":"print","{scrolllock}":"scroll","{pause}":"pause","{insert}":"ins","{home}":"home","{pageup}":"up","{delete}":"del","{forwarddelete}":"del","{end}":"end","{pagedown}":"down","{numpadmultiply}":"*","{numpadsubtract}":"-","{numpadadd}":"+","{numpadenter}":"enter","{period}":".","{numpaddecimal}":".","{numpad0}":"0","{numpad1}":"1","{numpad2}":"2","{numpad3}":"3","{numpad4}":"4","{numpad5}":"5","{numpad6}":"6","{numpad7}":"7","{numpad8}":"8","{numpad9}":"9"}}},{key:"getButtonDisplayName",value:function(E,I){return(I=arguments.length>2&&arguments[2]!==void 0&&arguments[2]?Object.assign({},this.getDefaultDiplay(),I):I||this.getDefaultDiplay())[E]||E}},{key:"getUpdatedInput",value:function(E,I,W){var B=arguments.length>3&&arguments[3]!==void 0?arguments[3]:W,ae=arguments.length>4&&arguments[4]!==void 0&&arguments[4],z=this.getOptions(),V=[W,B,ae],ee=I;return(E==="{bksp}"||E==="{backspace}")&&ee.length>0?ee=this.removeAt.apply(this,[ee].concat(V)):(E==="{delete}"||E==="{forwarddelete}")&&ee.length>0?ee=this.removeForwardsAt.apply(this,[ee].concat(V)):E==="{space}"?ee=this.addStringAt.apply(this,[ee," "].concat(V)):E!=="{tab}"||typeof z.tabCharOnTab=="boolean"&&z.tabCharOnTab===!1?E!=="{enter}"&&E!=="{numpadenter}"||!z.newLineOnEnter?E.includes("numpad")&&Number.isInteger(Number(E[E.length-2]))?ee=this.addStringAt.apply(this,[ee,E[E.length-2]].concat(V)):E==="{numpaddivide}"?ee=this.addStringAt.apply(this,[ee,"/"].concat(V)):E==="{numpadmultiply}"?ee=this.addStringAt.apply(this,[ee,"*"].concat(V)):E==="{numpadsubtract}"?ee=this.addStringAt.apply(this,[ee,"-"].concat(V)):E==="{numpadadd}"?ee=this.addStringAt.apply(this,[ee,"+"].concat(V)):E==="{numpaddecimal}"?ee=this.addStringAt.apply(this,[ee,"."].concat(V)):E==="{"||E==="}"?ee=this.addStringAt.apply(this,[ee,E].concat(V)):E.includes("{")||E.includes("}")||(ee=this.addStringAt.apply(this,[ee,E].concat(V))):ee=this.addStringAt.apply(this,[ee,`
- `].concat(V)):ee=this.addStringAt.apply(this,[ee," "].concat(V)),z.debug&&console.log("Input will be: "+ee),ee}},{key:"updateCaretPos",value:function(E){var I=arguments.length>1&&arguments[1]!==void 0&&arguments[1],W=this.updateCaretPosAction(E,I);this.dispatch((function(B){B.setCaretPosition(W)}))}},{key:"updateCaretPosAction",value:function(E){var I=arguments.length>1&&arguments[1]!==void 0&&arguments[1],W=this.getOptions(),B=this.getCaretPosition();return B!=null&&(I?B>0&&(B-=E):B+=E),W.debug&&console.log("Caret at:",B),B}},{key:"addStringAt",value:function(E,I){var W,B=arguments.length>2&&arguments[2]!==void 0?arguments[2]:E.length,ae=arguments.length>3&&arguments[3]!==void 0?arguments[3]:E.length,z=arguments.length>4&&arguments[4]!==void 0&&arguments[4];return B||B===0?(W=[E.slice(0,B),I,E.slice(ae)].join(""),this.isMaxLengthReached()||z&&this.updateCaretPos(I.length)):W=E+I,W}},{key:"removeAt",value:function(E){var I,W=arguments.length>1&&arguments[1]!==void 0?arguments[1]:E.length,B=arguments.length>2&&arguments[2]!==void 0?arguments[2]:E.length,ae=arguments.length>3&&arguments[3]!==void 0&&arguments[3];if(W===0&&B===0)return E;if(W===B){var z=/([\uD800-\uDBFF][\uDC00-\uDFFF])/g;W&&W>=0?E.substring(W-2,W).match(z)?(I=E.substr(0,W-2)+E.substr(W),ae&&this.updateCaretPos(2,!0)):(I=E.substr(0,W-1)+E.substr(W),ae&&this.updateCaretPos(1,!0)):E.slice(-2).match(z)?(I=E.slice(0,-2),ae&&this.updateCaretPos(2,!0)):(I=E.slice(0,-1),ae&&this.updateCaretPos(1,!0))}else I=E.slice(0,W)+E.slice(B),ae&&this.dispatch((function(V){V.setCaretPosition(W)}));return I}},{key:"removeForwardsAt",value:function(E){var I,W=arguments.length>1&&arguments[1]!==void 0?arguments[1]:E.length,B=arguments.length>2&&arguments[2]!==void 0?arguments[2]:E.length,ae=arguments.length>3&&arguments[3]!==void 0&&arguments[3];return E!=null&&E.length&&W!==null?(W===B?I=E.substring(W,W+2).match(/([\uD800-\uDBFF][\uDC00-\uDFFF])/g)?E.substr(0,W)+E.substr(W+2):E.substr(0,W)+E.substr(W+1):(I=E.slice(0,W)+E.slice(B),ae&&this.dispatch((function(z){z.setCaretPosition(W)}))),I):E}},{key:"handleMaxLength",value:function(E,I){var W=this.getOptions(),B=W.maxLength,ae=E[W.inputName||"default"],z=I.length-1>=B;if(I.length<=ae.length)return!1;if(Number.isInteger(B))return W.debug&&console.log("maxLength (num) reached:",z),z?(this.maxLengthReached=!0,!0):(this.maxLengthReached=!1,!1);if(x(B)==="object"){var V=I.length-1>=B[W.inputName||"default"];return W.debug&&console.log("maxLength (obj) reached:",V),V?(this.maxLengthReached=!0,!0):(this.maxLengthReached=!1,!1)}}},{key:"isMaxLengthReached",value:function(){return!!this.maxLengthReached}},{key:"isTouchDevice",value:function(){return"ontouchstart"in window||navigator.maxTouchPoints}},{key:"pointerEventsSupported",value:function(){return!!window.PointerEvent}},{key:"camelCase",value:function(E){return E?E.toLowerCase().trim().split(/[.\-_\s]/g).reduce((function(I,W){return W.length?I+W[0].toUpperCase()+W.slice(1):I})):""}},{key:"chunkArray",value:function(E,I){return p(Array(Math.ceil(E.length/I))).map((function(W,B){return E.slice(I*B,I+I*B)}))}},{key:"escapeRegex",value:function(E){return E.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}},{key:"getRtlOffset",value:function(E,I){var W=E,B=I.indexOf("");return B<E&&B!=-1&&W--,I.indexOf("")<E&&B!=-1&&W--,W<0?0:W}},{key:"isConstructor",value:function(E){try{Reflect.construct(String,[],E)}catch{return!1}return!0}}],j=[{key:"bindMethods",value:function(E,I){var W,B=(function(z,V){var ee=typeof Symbol<"u"&&z[Symbol.iterator]||z["@@iterator"];if(!ee){if(Array.isArray(z)||(ee=f(z))||V){ee&&(z=ee);var K=0,ne=function(){};return{s:ne,n:function(){return K>=z.length?{done:!0}:{done:!1,value:z[K++]}},e:function(oe){throw oe},f:ne}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var se,ce=!0,fe=!1;return{s:function(){ee=ee.call(z)},n:function(){var oe=ee.next();return ce=oe.done,oe},e:function(oe){fe=!0,se=oe},f:function(){try{ce||ee.return==null||ee.return()}finally{if(fe)throw se}}}})(Object.getOwnPropertyNames(E.prototype));try{for(B.s();!(W=B.n()).done;){var ae=W.value;ae==="constructor"||ae==="bindMethods"||(I[ae]=I[ae].bind(I))}}catch(z){B.e(z)}finally{B.f()}}}],Z&&b(q.prototype,Z),j&&b(q,j),Object.defineProperty(q,"prototype",{writable:!1}),q;var q,Z,j})();v(k,"noop",(function(){}));var P=k;function C(q){return C=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(Z){return typeof Z}:function(Z){return Z&&typeof Symbol=="function"&&Z.constructor===Symbol&&Z!==Symbol.prototype?"symbol":typeof Z},C(q)}function T(q,Z){for(var j=0;j<Z.length;j++){var E=Z[j];E.enumerable=E.enumerable||!1,E.configurable=!0,"value"in E&&(E.writable=!0),Object.defineProperty(q,R(E.key),E)}}function N(q,Z,j){return(Z=R(Z))in q?Object.defineProperty(q,Z,{value:j,enumerable:!0,configurable:!0,writable:!0}):q[Z]=j,q}function R(q){var Z=(function(j,E){if(C(j)!="object"||!j)return j;var I=j[Symbol.toPrimitive];if(I!==void 0){var W=I.call(j,E);if(C(W)!="object")return W;throw new TypeError("@@toPrimitive must return a primitive value.")}return(E==="string"?String:Number)(j)})(q,"string");return C(Z)=="symbol"?Z:Z+""}var A=(function(){return q=function E(I){var W=this,B=I.dispatch,ae=I.getOptions;(function(z,V){if(!(z instanceof V))throw new TypeError("Cannot call a class as a function")})(this,E),N(this,"getOptions",void 0),N(this,"dispatch",void 0),N(this,"isModifierKey",(function(z){return z.altKey||z.ctrlKey||z.shiftKey||["Tab","CapsLock","Esc","ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(z.code||z.key||W.keyCodeToKey(z?.keyCode))})),this.dispatch=B,this.getOptions=ae,P.bindMethods(E,this)},Z=[{key:"handleHighlightKeyDown",value:function(E){var I=this.getOptions();I.physicalKeyboardHighlightPreventDefault&&this.isModifierKey(E)&&(E.preventDefault(),E.stopImmediatePropagation());var W=this.getSimpleKeyboardLayoutKey(E);this.dispatch((function(B){var ae,z,V=B.getButtonElement(W),ee=B.getButtonElement("{".concat(W,"}"));if(V)ae=V,z=W;else{if(!ee)return;ae=ee,z="{".concat(W,"}")}var K,ne,se,ce,fe=function(O){O.style.background=I.physicalKeyboardHighlightBgColor||"#dadce4",O.style.color=I.physicalKeyboardHighlightTextColor||"black"};if(ae)if(Array.isArray(ae)){if(ae.forEach((function(O){return fe(O)})),I.physicalKeyboardHighlightPress)if(I.physicalKeyboardHighlightPressUsePointerEvents)(K=ae[0])===null||K===void 0||(ne=K.onpointerdown)===null||ne===void 0||ne.call(K,E);else if(I.physicalKeyboardHighlightPressUseClick){var oe;(oe=ae[0])===null||oe===void 0||oe.click()}else B.handleButtonClicked(z,E)}else fe(ae),I.physicalKeyboardHighlightPress&&(I.physicalKeyboardHighlightPressUsePointerEvents?(se=ae)===null||se===void 0||(ce=se.onpointerdown)===null||ce===void 0||ce.call(se,E):I.physicalKeyboardHighlightPressUseClick?ae.click():B.handleButtonClicked(z,E))}))}},{key:"handleHighlightKeyUp",value:function(E){var I=this.getOptions();I.physicalKeyboardHighlightPreventDefault&&this.isModifierKey(E)&&(E.preventDefault(),E.stopImmediatePropagation());var W=this.getSimpleKeyboardLayoutKey(E);this.dispatch((function(B){var ae,z,V,ee=B.getButtonElement(W)||B.getButtonElement("{".concat(W,"}")),K=function(ne){ne.removeAttribute&&ne.removeAttribute("style")};ee&&(Array.isArray(ee)?(ee.forEach((function(ne){return K(ne)})),I.physicalKeyboardHighlightPressUsePointerEvents&&((ae=ee[0])===null||ae===void 0||(z=ae.onpointerup)===null||z===void 0||z.call(ae,E))):(K(ee),I.physicalKeyboardHighlightPressUsePointerEvents&&(ee==null||(V=ee.onpointerup)===null||V===void 0||V.call(ee,E))))}))}},{key:"getSimpleKeyboardLayoutKey",value:function(E){var I,W="",B=E.code||E.key||this.keyCodeToKey(E?.keyCode);return(W=B!=null&&B.includes("Numpad")||B!=null&&B.includes("Shift")||B!=null&&B.includes("Space")||B!=null&&B.includes("Backspace")||B!=null&&B.includes("Control")||B!=null&&B.includes("Alt")||B!=null&&B.includes("Meta")?E.code||"":E.key||this.keyCodeToKey(E?.keyCode)||"").length>1?(I=W)===null||I===void 0?void 0:I.toLowerCase():W}},{key:"keyCodeToKey",value:function(E){return{8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",48:"0",49:"1",50:"2",51:"3",52:"4",53:"5",54:"6",55:"7",56:"8",57:"9",65:"A",66:"B",67:"C",68:"D",69:"E",70:"F",71:"G",72:"H",73:"I",74:"J",75:"K",76:"L",77:"M",78:"N",79:"O",80:"P",81:"Q",82:"R",83:"S",84:"T",85:"U",86:"V",87:"W",88:"X",89:"Y",90:"Z",91:"Meta",96:"Numpad0",97:"Numpad1",98:"Numpad2",99:"Numpad3",100:"Numpad4",101:"Numpad5",102:"Numpad6",103:"Numpad7",104:"Numpad8",105:"Numpad9",106:"NumpadMultiply",107:"NumpadAdd",109:"NumpadSubtract",110:"NumpadDecimal",111:"NumpadDivide",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",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"}[E]||""}}],Z&&T(q.prototype,Z),j&&T(q,j),Object.defineProperty(q,"prototype",{writable:!1}),q;var q,Z,j})();function D(q){return D=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(Z){return typeof Z}:function(Z){return Z&&typeof Symbol=="function"&&Z.constructor===Symbol&&Z!==Symbol.prototype?"symbol":typeof Z},D(q)}function $(q,Z){for(var j=0;j<Z.length;j++){var E=Z[j];E.enumerable=E.enumerable||!1,E.configurable=!0,"value"in E&&(E.writable=!0),Object.defineProperty(q,G(E.key),E)}}function U(q,Z,j){return(Z=G(Z))in q?Object.defineProperty(q,Z,{value:j,enumerable:!0,configurable:!0,writable:!0}):q[Z]=j,q}function G(q){var Z=(function(j,E){if(D(j)!="object"||!j)return j;var I=j[Symbol.toPrimitive];if(I!==void 0){var W=I.call(j,E);if(D(W)!="object")return W;throw new TypeError("@@toPrimitive must return a primitive value.")}return(E==="string"?String:Number)(j)})(q,"string");return D(Z)=="symbol"?Z:Z+""}var L=(function(){return q=function E(I){var W=I.utilities,B=I.options;(function(ae,z){if(!(ae instanceof z))throw new TypeError("Cannot call a class as a function")})(this,E),U(this,"utilities",void 0),U(this,"options",void 0),U(this,"candidateBoxElement",void 0),U(this,"pageIndex",0),U(this,"pageSize",void 0),this.utilities=W,this.options=B,P.bindMethods(E,this),this.pageSize=this.utilities.getOptions().layoutCandidatesPageSize||5},Z=[{key:"destroy",value:function(){this.candidateBoxElement&&(this.candidateBoxElement.remove(),this.pageIndex=0)}},{key:"show",value:function(E){var I=this,W=E.candidateValue,B=E.targetElement,ae=E.onSelect;if(W&&W.length){var z=this.utilities.chunkArray(W.split(" "),this.pageSize);this.renderPage({candidateListPages:z,targetElement:B,pageIndex:this.pageIndex,nbPages:z.length,onItemSelected:function(V,ee){ae(V,ee),I.destroy()}})}}},{key:"renderPage",value:function(E){var I,W=this,B=E.candidateListPages,ae=E.targetElement,z=E.pageIndex,V=E.nbPages,ee=E.onItemSelected;(I=this.candidateBoxElement)===null||I===void 0||I.remove(),this.candidateBoxElement=document.createElement("div"),this.candidateBoxElement.className="hg-candidate-box";var K=document.createElement("ul");K.className="hg-candidate-box-list",B[z].forEach((function(F){var Q,ve=document.createElement("li"),he=function(){var de=new(W.options.useTouchEvents?TouchEvent:MouseEvent)("click");return Object.defineProperty(de,"target",{value:ve}),de};ve.className="hg-candidate-box-list-item",ve.innerHTML=((Q=W.options.display)===null||Q===void 0?void 0:Q[F])||F,W.options.useTouchEvents?ve.ontouchstart=function(de){return ee(F,de||he())}:ve.onclick=function(){var de=arguments.length>0&&arguments[0]!==void 0?arguments[0]:he();return ee(F,de)},K.appendChild(ve)}));var ne=z>0,se=document.createElement("div");se.classList.add("hg-candidate-box-prev"),ne&&se.classList.add("hg-candidate-box-btn-active");var ce=function(){ne&&W.renderPage({candidateListPages:B,targetElement:ae,pageIndex:z-1,nbPages:V,onItemSelected:ee})};this.options.useTouchEvents?se.ontouchstart=ce:se.onclick=ce,this.candidateBoxElement.appendChild(se),this.candidateBoxElement.appendChild(K);var fe=z<V-1,oe=document.createElement("div");oe.classList.add("hg-candidate-box-next"),fe&&oe.classList.add("hg-candidate-box-btn-active");var O=function(){fe&&W.renderPage({candidateListPages:B,targetElement:ae,pageIndex:z+1,nbPages:V,onItemSelected:ee})};this.options.useTouchEvents?oe.ontouchstart=O:oe.onclick=O,this.candidateBoxElement.appendChild(oe),ae.prepend(this.candidateBoxElement)}}],Z&&$(q.prototype,Z),j&&$(q,j),Object.defineProperty(q,"prototype",{writable:!1}),q;var q,Z,j})(),te=L;function re(q){return(function(Z){if(Array.isArray(Z))return J(Z)})(q)||(function(Z){if(typeof Symbol<"u"&&Z[Symbol.iterator]!=null||Z["@@iterator"]!=null)return Array.from(Z)})(q)||(function(Z,j){if(Z){if(typeof Z=="string")return J(Z,j);var E={}.toString.call(Z).slice(8,-1);return E==="Object"&&Z.constructor&&(E=Z.constructor.name),E==="Map"||E==="Set"?Array.from(Z):E==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(E)?J(Z,j):void 0}})(q)||(function(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)})()}function J(q,Z){(Z==null||Z>q.length)&&(Z=q.length);for(var j=0,E=Array(Z);j<Z;j++)E[j]=q[j];return E}function ue(q){return ue=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(Z){return typeof Z}:function(Z){return Z&&typeof Symbol=="function"&&Z.constructor===Symbol&&Z!==Symbol.prototype?"symbol":typeof Z},ue(q)}function me(q,Z){var j=Object.keys(q);if(Object.getOwnPropertySymbols){var E=Object.getOwnPropertySymbols(q);Z&&(E=E.filter((function(I){return Object.getOwnPropertyDescriptor(q,I).enumerable}))),j.push.apply(j,E)}return j}function ge(q,Z){for(var j=0;j<Z.length;j++){var E=Z[j];E.enumerable=E.enumerable||!1,E.configurable=!0,"value"in E&&(E.writable=!0),Object.defineProperty(q,ie(E.key),E)}}function X(q,Z,j){return(Z=ie(Z))in q?Object.defineProperty(q,Z,{value:j,enumerable:!0,configurable:!0,writable:!0}):q[Z]=j,q}function ie(q){var Z=(function(j,E){if(ue(j)!="object"||!j)return j;var I=j[Symbol.toPrimitive];if(I!==void 0){var W=I.call(j,E);if(ue(W)!="object")return W;throw new TypeError("@@toPrimitive must return a primitive value.")}return(E==="string"?String:Number)(j)})(q,"string");return ue(Z)=="symbol"?Z:Z+""}var le=(function(){return q=function E(I,W){var B=this;if((function(ce,fe){if(!(ce instanceof fe))throw new TypeError("Cannot call a class as a function")})(this,E),X(this,"input",void 0),X(this,"options",void 0),X(this,"utilities",void 0),X(this,"caretPosition",void 0),X(this,"caretPositionEnd",void 0),X(this,"keyboardDOM",void 0),X(this,"keyboardPluginClasses",void 0),X(this,"keyboardDOMClass",void 0),X(this,"buttonElements",void 0),X(this,"currentInstanceName",void 0),X(this,"allKeyboardInstances",void 0),X(this,"keyboardInstanceNames",void 0),X(this,"isFirstKeyboardInstance",void 0),X(this,"physicalKeyboard",void 0),X(this,"modules",void 0),X(this,"activeButtonClass",void 0),X(this,"holdInteractionTimeout",void 0),X(this,"holdTimeout",void 0),X(this,"isMouseHold",void 0),X(this,"initialized",void 0),X(this,"candidateBox",void 0),X(this,"keyboardRowsDOM",void 0),X(this,"defaultName","default"),X(this,"activeInputElement",null),X(this,"handleParams",(function(ce,fe){var oe,O,F;if(typeof ce=="string")oe=ce.split(".").join(""),O=document.querySelector(".".concat(oe)),F=fe;else if(ce instanceof HTMLDivElement){if(!ce.className)throw console.warn("Any DOM element passed as parameter must have a class."),new Error("KEYBOARD_DOM_CLASS_ERROR");oe=ce.className.split(" ")[0],O=ce,F=fe}else oe="simple-keyboard",O=document.querySelector(".".concat(oe)),F=ce;return{keyboardDOMClass:oe,keyboardDOM:O,options:F}})),X(this,"getOptions",(function(){return B.options})),X(this,"getCaretPosition",(function(){return B.caretPosition})),X(this,"getCaretPositionEnd",(function(){return B.caretPositionEnd})),X(this,"registerModule",(function(ce,fe){B.modules[ce]||(B.modules[ce]={}),fe(B.modules[ce])})),X(this,"getKeyboardClassString",(function(){for(var ce=arguments.length,fe=new Array(ce),oe=0;oe<ce;oe++)fe[oe]=arguments[oe];return[B.keyboardDOMClass].concat(fe).filter((function(O){return!!O})).join(" ")})),typeof window<"u"){var ae=this.handleParams(I,W),z=ae.keyboardDOMClass,V=ae.keyboardDOM,ee=ae.options,K=ee===void 0?{}:ee;this.utilities=new P({getOptions:this.getOptions,getCaretPosition:this.getCaretPosition,getCaretPositionEnd:this.getCaretPositionEnd,dispatch:this.dispatch}),this.caretPosition=null,this.caretPositionEnd=null,this.keyboardDOM=V,this.options=(function(ce){for(var fe=1;fe<arguments.length;fe++){var oe=arguments[fe]!=null?arguments[fe]:{};fe%2?me(Object(oe),!0).forEach((function(O){X(ce,O,oe[O])})):Object.getOwnPropertyDescriptors?Object.defineProperties(ce,Object.getOwnPropertyDescriptors(oe)):me(Object(oe)).forEach((function(O){Object.defineProperty(ce,O,Object.getOwnPropertyDescriptor(oe,O))}))}return ce})({layoutName:"default",theme:"hg-theme-default",inputName:"default",preventMouseDownDefault:!1,enableLayoutCandidates:!0,excludeFromLayout:{}},K),this.keyboardPluginClasses="",P.bindMethods(E,this);var ne=this.options.inputName,se=ne===void 0?this.defaultName:ne;if(this.input={},this.input[se]="",this.keyboardDOMClass=z,this.buttonElements={},window.SimpleKeyboardInstances||(window.SimpleKeyboardInstances={}),this.currentInstanceName=this.utilities.camelCase(this.keyboardDOMClass),window.SimpleKeyboardInstances[this.currentInstanceName]=this,this.allKeyboardInstances=window.SimpleKeyboardInstances,this.keyboardInstanceNames=Object.keys(window.SimpleKeyboardInstances),this.isFirstKeyboardInstance=this.keyboardInstanceNames[0]===this.currentInstanceName,this.physicalKeyboard=new A({dispatch:this.dispatch,getOptions:this.getOptions}),this.candidateBox=this.options.enableLayoutCandidates?new te({utilities:this.utilities,options:this.options}):null,!this.keyboardDOM)throw console.warn('".'.concat(z,'" was not found in the DOM.')),new Error("KEYBOARD_DOM_ERROR");this.render(),this.modules={},this.loadModules()}},Z=[{key:"setCaretPosition",value:function(E){var I=arguments.length>1&&arguments[1]!==void 0?arguments[1]:E;this.caretPosition=E,this.caretPositionEnd=I}},{key:"getInputCandidates",value:function(E){var I=this,W=this.options,B=W.layoutCandidates,ae=W.layoutCandidatesCaseSensitiveMatch;if(!B||ue(B)!=="object")return{};var z=Object.keys(B).filter((function(K){var ne=E.substring(0,I.getCaretPositionEnd()||0)||E,se=new RegExp("".concat(I.utilities.escapeRegex(K),"$"),ae?"g":"gi");return!!re(ne.matchAll(se)).length}));if(z.length>1){var V=z.sort((function(K,ne){return ne.length-K.length}))[0];return{candidateKey:V,candidateValue:B[V]}}if(z.length){var ee=z[0];return{candidateKey:ee,candidateValue:B[ee]}}return{}}},{key:"showCandidatesBox",value:function(E,I,W){var B=this;this.candidateBox&&this.candidateBox.show({candidateValue:I,targetElement:W,onSelect:function(ae,z){var V=B.options,ee=V.layoutCandidatesCaseSensitiveMatch,K=V.disableCandidateNormalization,ne=V.enableLayoutCandidatesKeyPress,se=ae;K||(se=ae.normalize("NFD")),typeof B.options.beforeInputUpdate=="function"&&B.options.beforeInputUpdate(B);var ce=B.getInput(B.options.inputName,!0),fe=B.getCaretPositionEnd()||0,oe=ce.substring(0,fe||0)||ce,O=new RegExp("".concat(B.utilities.escapeRegex(E),"$"),ee?"g":"gi"),F=oe.replace(O,se),Q=ce.replace(oe,F),ve=F.length-oe.length,he=(fe||ce.length)+ve;he<0&&(he=0),B.setInput(Q,B.options.inputName,!0),B.setCaretPosition(he),ne&&typeof B.options.onKeyPress=="function"&&B.options.onKeyPress(ae,z),typeof B.options.onChange=="function"&&B.options.onChange(B.getInput(B.options.inputName,!0),z),typeof B.options.onChangeAll=="function"&&B.options.onChangeAll(B.getAllInputs(),z)}})}},{key:"handleButtonClicked",value:function(E,I){var W=this.options,B=W.inputName,ae=B===void 0?this.defaultName:B,z=W.debug;if(E!=="{//}"){this.input[ae]||(this.input[ae]=""),typeof this.options.beforeInputUpdate=="function"&&this.options.beforeInputUpdate(this);var V=this.utilities.getUpdatedInput(E,this.input[ae],this.caretPosition,this.caretPositionEnd);if(this.utilities.isStandardButton(E)&&this.activeInputElement&&this.input[ae]&&this.input[ae]===V&&this.caretPosition===0&&this.caretPositionEnd===V.length)return this.setInput("",this.options.inputName,!0),this.setCaretPosition(0),this.activeInputElement.value="",this.activeInputElement.setSelectionRange(0,0),void this.handleButtonClicked(E,I);if(typeof this.options.onKeyPress=="function"&&this.options.onKeyPress(E,I),this.input[ae]!==V&&(!this.options.inputPattern||this.options.inputPattern&&this.inputPatternIsValid(V))){if(this.options.maxLength&&this.utilities.handleMaxLength(this.input,V))return;var ee=this.utilities.getUpdatedInput(E,this.input[ae],this.caretPosition,this.caretPositionEnd,!0);if(this.setInput(ee,this.options.inputName,!0),z&&console.log("Input changed:",this.getAllInputs()),this.options.debug&&console.log("Caret at: ",this.getCaretPosition(),this.getCaretPositionEnd(),"(".concat(this.keyboardDOMClass,")"),I?.type),this.options.syncInstanceInputs&&this.syncInstanceInputs(),typeof this.options.onChange=="function"&&this.options.onChange(this.getInput(this.options.inputName,!0),I),typeof this.options.onChangeAll=="function"&&this.options.onChangeAll(this.getAllInputs(),I),I!=null&&I.target&&this.options.enableLayoutCandidates){var K,ne=this.getInputCandidates(V),se=ne.candidateKey,ce=ne.candidateValue;se&&ce?this.showCandidatesBox(se,ce,this.keyboardDOM):(K=this.candidateBox)===null||K===void 0||K.destroy()}}this.caretPositionEnd&&this.caretPosition!==this.caretPositionEnd&&(this.setCaretPosition(this.caretPositionEnd,this.caretPositionEnd),this.activeInputElement&&this.activeInputElement.setSelectionRange(this.caretPositionEnd,this.caretPositionEnd),this.options.debug&&console.log("Caret position aligned",this.caretPosition)),z&&console.log("Key pressed:",E)}}},{key:"getMouseHold",value:function(){return this.isMouseHold}},{key:"setMouseHold",value:function(E){this.options.syncInstanceInputs?this.dispatch((function(I){I.isMouseHold=E})):this.isMouseHold=E}},{key:"handleButtonMouseDown",value:function(E,I){var W=this;I&&(this.options.preventMouseDownDefault&&I.preventDefault(),this.options.stopMouseDownPropagation&&I.stopPropagation(),I.target.classList.add(this.activeButtonClass)),this.holdInteractionTimeout&&clearTimeout(this.holdInteractionTimeout),this.holdTimeout&&clearTimeout(this.holdTimeout),this.setMouseHold(!0),this.options.disableButtonHold||(this.holdTimeout=window.setTimeout((function(){(W.getMouseHold()&&(!E.includes("{")&&!E.includes("}")||E==="{delete}"||E==="{backspace}"||E==="{bksp}"||E==="{space}"||E==="{tab}")||E==="{arrowright}"||E==="{arrowleft}"||E==="{arrowup}"||E==="{arrowdown}")&&(W.options.debug&&console.log("Button held:",E),W.handleButtonHold(E)),clearTimeout(W.holdTimeout)}),500))}},{key:"handleButtonMouseUp",value:function(E,I){var W=this;I&&(this.options.preventMouseUpDefault&&I.preventDefault&&I.preventDefault(),this.options.stopMouseUpPropagation&&I.stopPropagation&&I.stopPropagation(),!(I.target===this.keyboardDOM||I.target&&this.keyboardDOM.contains(I.target)||this.candidateBox&&this.candidateBox.candidateBoxElement&&(I.target===this.candidateBox.candidateBoxElement||I.target&&this.candidateBox.candidateBoxElement.contains(I.target)))&&this.candidateBox&&this.candidateBox.destroy()),this.recurseButtons((function(B){B.classList.remove(W.activeButtonClass)})),this.setMouseHold(!1),this.holdInteractionTimeout&&clearTimeout(this.holdInteractionTimeout),E&&typeof this.options.onKeyReleased=="function"&&this.options.onKeyReleased(E,I)}},{key:"handleKeyboardContainerMouseDown",value:function(E){this.options.preventMouseDownDefault&&E.preventDefault()}},{key:"handleButtonHold",value:function(E){var I=this;this.holdInteractionTimeout&&clearTimeout(this.holdInteractionTimeout),this.holdInteractionTimeout=window.setTimeout((function(){I.getMouseHold()?(I.handleButtonClicked(E),I.handleButtonHold(E)):clearTimeout(I.holdInteractionTimeout)}),100)}},{key:"syncInstanceInputs",value:function(){var E=this;this.dispatch((function(I){I.replaceInput(E.input),I.setCaretPosition(E.caretPosition,E.caretPositionEnd)}))}},{key:"clearInput",value:function(){var E=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.options.inputName||this.defaultName;this.input[E]="",this.setCaretPosition(0),this.options.syncInstanceInputs&&this.syncInstanceInputs()}},{key:"getInput",value:function(){var E=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.options.inputName||this.defaultName,I=arguments.length>1&&arguments[1]!==void 0&&arguments[1];return this.options.syncInstanceInputs&&!I&&this.syncInstanceInputs(),this.options.rtl?""+this.input[E].replace("","").replace("","")+"":this.input[E]}},{key:"getAllInputs",value:function(){var E=this,I={};return Object.keys(this.input).forEach((function(W){I[W]=E.getInput(W,!0)})),I}},{key:"setInput",value:function(E){var I=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.options.inputName||this.defaultName,W=arguments.length>2?arguments[2]:void 0;this.input[I]=E,!W&&this.options.syncInstanceInputs&&this.syncInstanceInputs()}},{key:"replaceInput",value:function(E){this.input=E}},{key:"setOptions",value:function(){var E=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},I=this.changedOptions(E);this.options=Object.assign(this.options,E),I.length&&(this.options.debug&&console.log("changedOptions",I),this.onSetOptions(I),this.render())}},{key:"changedOptions",value:function(E){var I=this;return Object.keys(E).filter((function(W){return JSON.stringify(E[W])!==JSON.stringify(I.options[W])}))}},{key:"onSetOptions",value:function(){var E=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];E.includes("layoutName")&&this.candidateBox&&this.candidateBox.destroy(),(E.includes("layoutCandidatesPageSize")||E.includes("layoutCandidates"))&&this.candidateBox&&(this.candidateBox.destroy(),this.candidateBox=new te({utilities:this.utilities,options:this.options}))}},{key:"resetRows",value:function(){this.keyboardRowsDOM&&this.keyboardRowsDOM.remove(),this.keyboardDOM.className=this.keyboardDOMClass,this.keyboardDOM.setAttribute("data-skInstance",this.currentInstanceName),this.buttonElements={}}},{key:"dispatch",value:function(E){if(!window.SimpleKeyboardInstances)throw console.warn("SimpleKeyboardInstances is not defined. Dispatch cannot be called."),new Error("INSTANCES_VAR_ERROR");return Object.keys(window.SimpleKeyboardInstances).forEach((function(I){E(window.SimpleKeyboardInstances[I],I)}))}},{key:"addButtonTheme",value:function(E,I){var W=this;I&&E&&(E.split(" ").forEach((function(B){I.split(" ").forEach((function(ae){W.options.buttonTheme||(W.options.buttonTheme=[]);var z=!1;W.options.buttonTheme.map((function(V){if(V!=null&&V.class.split(" ").includes(ae)){z=!0;var ee=V.buttons.split(" ");ee.includes(B)||(z=!0,ee.push(B),V.buttons=ee.join(" "))}return V})),z||W.options.buttonTheme.push({class:ae,buttons:E})}))})),this.render())}},{key:"removeButtonTheme",value:function(E,I){var W=this;if(!E&&!I)return this.options.buttonTheme=[],void this.render();E&&Array.isArray(this.options.buttonTheme)&&this.options.buttonTheme.length&&(E.split(" ").forEach((function(B){var ae;(ae=W.options)===null||ae===void 0||(ae=ae.buttonTheme)===null||ae===void 0||ae.map((function(z,V){if(z&&I&&I.includes(z.class)||!I){var ee,K,ne=(ee=z)===null||ee===void 0?void 0:ee.buttons.split(" ").filter((function(se){return se!==B}));z&&ne!=null&&ne.length?z.buttons=ne.join(" "):((K=W.options.buttonTheme)===null||K===void 0||K.splice(V,1),z=null)}return z}))})),this.render())}},{key:"getButtonElement",value:function(E){var I,W=this.buttonElements[E];return W&&(I=W.length>1?W:W[0]),I}},{key:"inputPatternIsValid",value:function(E){var I,W=this.options.inputPattern;if((I=W instanceof RegExp?W:W[this.options.inputName||this.defaultName])&&E){var B=I.test(E);return this.options.debug&&console.log('inputPattern ("'.concat(I,'"): ').concat(B?"passed":"did not pass!")),B}return!0}},{key:"setEventListeners",value:function(){if(this.isFirstKeyboardInstance||!this.allKeyboardInstances){this.options.debug&&console.log("Caret handling started (".concat(this.keyboardDOMClass,")"));var E=this.options.physicalKeyboardHighlightPreventDefault,I=E!==void 0&&E;document.addEventListener("keyup",this.handleKeyUp,I),document.addEventListener("keydown",this.handleKeyDown,I),document.addEventListener("mouseup",this.handleMouseUp),document.addEventListener("touchend",this.handleTouchEnd),this.options.updateCaretOnSelectionChange&&document.addEventListener("selectionchange",this.handleSelectionChange),document.addEventListener("select",this.handleSelect)}}},{key:"handleKeyUp",value:function(E){this.caretEventHandler(E),this.options.physicalKeyboardHighlight&&this.physicalKeyboard.handleHighlightKeyUp(E)}},{key:"handleKeyDown",value:function(E){this.options.physicalKeyboardHighlight&&this.physicalKeyboard.handleHighlightKeyDown(E)}},{key:"handleMouseUp",value:function(E){this.caretEventHandler(E)}},{key:"handleTouchEnd",value:function(E){this.caretEventHandler(E)}},{key:"handleSelect",value:function(E){this.caretEventHandler(E)}},{key:"handleSelectionChange",value:function(E){navigator.userAgent.includes("Firefox")||this.caretEventHandler(E)}},{key:"caretEventHandler",value:function(E){var I,W=this;E.target.tagName&&(I=E.target.tagName.toLowerCase()),this.dispatch((function(B){var ae=E.target===B.keyboardDOM||E.target&&B.keyboardDOM.contains(E.target);if(W.options.syncInstanceInputs&&Array.isArray(E.path)&&(ae=E.path.some((function(ee){var K;return ee==null||(K=ee.hasAttribute)===null||K===void 0?void 0:K.call(ee,"data-skInstance")}))),(I==="textarea"||I==="input"&&["text","search","url","tel","password"].includes(E.target.type))&&!B.options.disableCaretPositioning){var z=E.target.selectionStart,V=E.target.selectionEnd;B.options.rtl&&(z=B.utilities.getRtlOffset(z,B.getInput()),V=B.utilities.getRtlOffset(V,B.getInput())),B.setCaretPosition(z,V),B.activeInputElement=E.target,B.options.debug&&console.log("Caret at: ",B.getCaretPosition(),B.getCaretPositionEnd(),E&&E.target.tagName.toLowerCase(),"(".concat(B.keyboardDOMClass,")"),E?.type)}else!B.options.disableCaretPositioning&&ae||E?.type==="selectionchange"||(B.setCaretPosition(null),B.activeInputElement=null,B.options.debug&&console.log('Caret position reset due to "'.concat(E?.type,'" event'),E))}))}},{key:"recurseButtons",value:function(E){var I=this;E&&Object.keys(this.buttonElements).forEach((function(W){return I.buttonElements[W].forEach(E)}))}},{key:"destroy",value:function(){this.options.debug&&console.log("Destroying simple-keyboard instance: ".concat(this.currentInstanceName));var E=this.options.physicalKeyboardHighlightPreventDefault,I=E!==void 0&&E;document.removeEventListener("keyup",this.handleKeyUp,I),document.removeEventListener("keydown",this.handleKeyDown,I),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("touchend",this.handleTouchEnd),document.removeEventListener("select",this.handleSelect),this.options.updateCaretOnSelectionChange&&document.removeEventListener("selectionchange",this.handleSelectionChange),document.onpointerup=null,document.ontouchend=null,document.ontouchcancel=null,document.onmouseup=null,this.recurseButtons((function(W){W&&(W.onpointerdown=null,W.onpointerup=null,W.onpointercancel=null,W.ontouchstart=null,W.ontouchend=null,W.ontouchcancel=null,W.onclick=null,W.onmousedown=null,W.onmouseup=null,W.remove(),W=null)})),this.keyboardDOM.onpointerdown=null,this.keyboardDOM.ontouchstart=null,this.keyboardDOM.onmousedown=null,this.resetRows(),this.candidateBox&&(this.candidateBox.destroy(),this.candidateBox=null),this.activeInputElement=null,this.keyboardDOM.removeAttribute("data-skInstance"),this.keyboardDOM.innerHTML="",window.SimpleKeyboardInstances[this.currentInstanceName]=null,delete window.SimpleKeyboardInstances[this.currentInstanceName],this.initialized=!1}},{key:"getButtonThemeClasses",value:function(E){var I=this.options.buttonTheme,W=[];return Array.isArray(I)&&I.forEach((function(B){if(B&&B.class&&typeof B.class=="string"&&B.buttons&&typeof B.buttons=="string"){var ae=B.class.split(" ");B.buttons.split(" ").includes(E)&&(W=[].concat(re(W),re(ae)))}else console.warn('Incorrect "buttonTheme". Please check the documentation.',B)})),W}},{key:"setDOMButtonAttributes",value:function(E,I){var W=this.options.buttonAttributes;Array.isArray(W)&&W.forEach((function(B){B.attribute&&typeof B.attribute=="string"&&B.value&&typeof B.value=="string"?B.buttons&&typeof B.buttons=="string"?B.buttons.split(" ").includes(E)&&I(B.attribute,B.value):I(B.attribute,B.value):console.warn('Incorrect "buttonAttributes". Please check the documentation.',B)}))}},{key:"onTouchDeviceDetected",value:function(){this.processAutoTouchEvents(),this.disableContextualWindow()}},{key:"disableContextualWindow",value:function(){window.oncontextmenu=function(E){var I;if((I=E.target.classList)!==null&&I!==void 0&&I.contains("hg-button"))return E.preventDefault(),E.stopPropagation(),!1}}},{key:"processAutoTouchEvents",value:function(){this.options.autoUseTouchEvents&&(this.options.useTouchEvents=!0,this.options.debug&&console.log("autoUseTouchEvents: Touch device detected, useTouchEvents enabled."))}},{key:"onInit",value:function(){this.options.debug&&console.log("".concat(this.keyboardDOMClass," Initialized")),this.setEventListeners(),typeof this.options.onInit=="function"&&this.options.onInit(this)}},{key:"beforeFirstRender",value:function(){this.utilities.isTouchDevice()&&this.onTouchDeviceDetected(),typeof this.options.beforeFirstRender=="function"&&this.options.beforeFirstRender(this),this.isFirstKeyboardInstance&&this.utilities.pointerEventsSupported()&&!this.options.useTouchEvents&&!this.options.useMouseEvents&&this.options.debug&&console.log("Using PointerEvents as it is supported by this browser"),this.options.useTouchEvents&&this.options.debug&&console.log("useTouchEvents has been enabled. Only touch events will be used.")}},{key:"beforeRender",value:function(){typeof this.options.beforeRender=="function"&&this.options.beforeRender(this)}},{key:"onRender",value:function(){typeof this.options.onRender=="function"&&this.options.onRender(this)}},{key:"onModulesLoaded",value:function(){typeof this.options.onModulesLoaded=="function"&&this.options.onModulesLoaded(this)}},{key:"loadModules",value:function(){var E=this;Array.isArray(this.options.modules)&&(this.options.modules.forEach((function(I){var W=E.utilities.isConstructor(I)?new I(E):I(E);W.init&&W.init(E)})),this.keyboardPluginClasses="modules-loaded",this.render(),this.onModulesLoaded())}},{key:"getModuleProp",value:function(E,I){return!!this.modules[E]&&this.modules[E][I]}},{key:"getModulesList",value:function(){return Object.keys(this.modules)}},{key:"parseRowDOMContainers",value:function(E,I,W,B){var ae=this,z=Array.from(E.children),V=0;return z.length&&W.forEach((function(ee,K){var ne=B[K];if(!(ne&&ne>ee))return!1;var se=ee-V,ce=ne-V,fe=document.createElement("div");fe.className+="hg-button-container";var oe="".concat(ae.options.layoutName,"-r").concat(I,"c").concat(K);fe.setAttribute("data-skUID",oe);var O=z.splice(se,ce-se+1);V+=ce-se,O.forEach((function(F){return fe.appendChild(F)})),z.splice(se,0,fe),E.innerHTML="",z.forEach((function(F){return E.appendChild(F)})),ae.options.debug&&console.log("rowDOMContainer",O,se,ce,V+1)})),E}},{key:"render",value:function(){var E=this;this.resetRows(),this.initialized||this.beforeFirstRender(),this.beforeRender();var I="hg-layout-".concat(this.options.layoutName),W=this.options.layout||{default:["` 1 2 3 4 5 6 7 8 9 0 - = {bksp}","{tab} q w e r t y u i o p [ ] \\","{lock} a s d f g h j k l ; ' {enter}","{shift} z x c v b n m , . / {shift}",".com @ {space}"],shift:["~ ! @ # $ % ^ & * ( ) _ + {bksp}","{tab} Q W E R T Y U I O P { } |",'{lock} A S D F G H J K L : " {enter}',"{shift} Z X C V B N M < > ? {shift}",".com @ {space}"]},B=this.options.useTouchEvents||!1,ae=B?"hg-touch-events":"",z=this.options.useMouseEvents||!1,V=this.options.disableRowButtonContainers;this.keyboardDOM.className=this.getKeyboardClassString(this.options.theme,I,this.keyboardPluginClasses,ae),this.keyboardDOM.setAttribute("data-skInstance",this.currentInstanceName),this.keyboardRowsDOM=document.createElement("div"),this.keyboardRowsDOM.className="hg-rows",W[this.options.layoutName||this.defaultName].forEach((function(ee,K){var ne=ee.split(" ");E.options.excludeFromLayout&&E.options.excludeFromLayout[E.options.layoutName||E.defaultName]&&(ne=ne.filter((function(oe){return E.options.excludeFromLayout&&!E.options.excludeFromLayout[E.options.layoutName||E.defaultName].includes(oe)})));var se=document.createElement("div");se.className+="hg-row";var ce=[],fe=[];ne.forEach((function(oe,O){var F,Q=!V&&typeof oe=="string"&&oe.length>1&&oe.indexOf("[")===0,ve=!V&&typeof oe=="string"&&oe.length>1&&oe.indexOf("]")===oe.length-1;Q&&(ce.push(O),oe=oe.replace(/\[/g,"")),ve&&(fe.push(O),oe=oe.replace(/\]/g,""));var he=E.utilities.getButtonClass(oe),de=E.utilities.getButtonDisplayName(oe,E.options.display,E.options.mergeDisplay),Ae=E.options.useButtonTag?"button":"div",_e=document.createElement(Ae);_e.className+="hg-button ".concat(he),(F=_e.classList).add.apply(F,re(E.getButtonThemeClasses(oe))),E.setDOMButtonAttributes(oe,(function(Ue,Ne){_e.setAttribute(Ue,Ne)})),E.activeButtonClass="hg-activeButton",!E.utilities.pointerEventsSupported()||B||z?B?(_e.ontouchstart=function(Ue){E.handleButtonClicked(oe,Ue),E.handleButtonMouseDown(oe,Ue)},_e.ontouchend=function(Ue){E.handleButtonMouseUp(oe,Ue)},_e.ontouchcancel=function(Ue){E.handleButtonMouseUp(oe,Ue)}):(_e.onclick=function(Ue){E.setMouseHold(!1),typeof E.options.onKeyReleased=="function"||E.options.useMouseEvents&&E.options.clickOnMouseDown||E.handleButtonClicked(oe,Ue)},_e.onmousedown=function(Ue){(typeof E.options.onKeyReleased=="function"||E.options.useMouseEvents&&E.options.clickOnMouseDown)&&!E.isMouseHold&&E.handleButtonClicked(oe,Ue),E.handleButtonMouseDown(oe,Ue)},_e.onmouseup=function(Ue){E.handleButtonMouseUp(oe,Ue)}):(_e.onpointerdown=function(Ue){E.handleButtonClicked(oe,Ue),E.handleButtonMouseDown(oe,Ue)},_e.onpointerup=function(Ue){E.handleButtonMouseUp(oe,Ue)},_e.onpointercancel=function(Ue){E.handleButtonMouseUp(oe,Ue)}),_e.setAttribute("data-skBtn",oe);var ze="".concat(E.options.layoutName,"-r").concat(K,"b").concat(O);_e.setAttribute("data-skBtnUID",ze);var Be=document.createElement("span");Be.innerHTML=de,_e.appendChild(Be),E.buttonElements[oe]||(E.buttonElements[oe]=[]),E.buttonElements[oe].push(_e),se.appendChild(_e)})),se=E.parseRowDOMContainers(se,K,ce,fe),E.keyboardRowsDOM.appendChild(se)})),this.keyboardDOM.appendChild(this.keyboardRowsDOM),this.onRender(),this.initialized||(this.initialized=!0,!this.utilities.pointerEventsSupported()||B||z?B?(document.ontouchend=function(ee){return E.handleButtonMouseUp(void 0,ee)},document.ontouchcancel=function(ee){return E.handleButtonMouseUp(void 0,ee)},this.keyboardDOM.ontouchstart=function(ee){return E.handleKeyboardContainerMouseDown(ee)}):B||(document.onmouseup=function(ee){return E.handleButtonMouseUp(void 0,ee)},this.keyboardDOM.onmousedown=function(ee){return E.handleKeyboardContainerMouseDown(ee)}):(document.onpointerup=function(ee){return E.handleButtonMouseUp(void 0,ee)},this.keyboardDOM.onpointerdown=function(ee){return E.handleKeyboardContainerMouseDown(ee)}),this.onInit())}}],Z&&ge(q.prototype,Z),j&&ge(q,j),Object.defineProperty(q,"prototype",{writable:!1}),q;var q,Z,j})(),pe=le,Ce=pe;return m})()},442:function(l){l.exports=n}},a={};function s(l){var c=a[l];if(c!==void 0)return c.exports;var d=a[l]={exports:{}};return r[l].call(d.exports,d,d.exports,s),d.exports}s.n=function(l){var c=l&&l.__esModule?function(){return l.default}:function(){return l};return s.d(c,{a:c}),c},s.d=function(l,c){for(var d in c)s.o(c,d)&&!s.o(l,d)&&Object.defineProperty(l,d,{enumerable:!0,get:c[d]})},s.o=function(l,c){return Object.prototype.hasOwnProperty.call(l,c)},s.r=function(l){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(l,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(l,"__esModule",{value:!0})};var o={};return(function(){s.r(o),s.d(o,{KeyboardReact:function(){return x},default:function(){return b}}),s(981);var l=s(442),c=s(548),d=s.n(c);function u(v){return u=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(_){return typeof _}:function(_){return _&&typeof Symbol=="function"&&_.constructor===Symbol&&_!==Symbol.prototype?"symbol":typeof _},u(v)}function m(v,_){var k=Object.keys(v);if(Object.getOwnPropertySymbols){var P=Object.getOwnPropertySymbols(v);_&&(P=P.filter((function(C){return Object.getOwnPropertyDescriptor(v,C).enumerable}))),k.push.apply(k,P)}return k}function p(v){for(var _=1;_<arguments.length;_++){var k=arguments[_]!=null?arguments[_]:{};_%2?m(Object(k),!0).forEach((function(P){f(v,P,k[P])})):Object.getOwnPropertyDescriptors?Object.defineProperties(v,Object.getOwnPropertyDescriptors(k)):m(Object(k)).forEach((function(P){Object.defineProperty(v,P,Object.getOwnPropertyDescriptor(k,P))}))}return v}function f(v,_,k){return(_=(function(P){var C=(function(T,N){if(u(T)!="object"||!T)return T;var R=T[Symbol.toPrimitive];if(R!==void 0){var A=R.call(T,N);if(u(A)!="object")return A;throw new TypeError("@@toPrimitive must return a primitive value.")}return(N==="string"?String:Number)(T)})(P,"string");return u(C)=="symbol"?C:C+""})(_))in v?Object.defineProperty(v,_,{value:k,enumerable:!0,configurable:!0,writable:!0}):v[_]=k,v}var y=function(v){return p(p({},v),{},{keyboardRef:null})},x=function(v){var _=v.baseClass||"react-simple-keyboard",k=l.useRef(null),P=l.useRef(null),C=l.useRef(null),T=l.useRef(v);return l.useEffect((function(){return function(){C.current&&C.current.destroy(),k.current=!1}}),[]),l.useEffect((function(){var N=(function(U){return p(p({},U),{},{theme:"simple-keyboard ".concat(U.theme||"hg-theme-default")})})(v);if(!k.current){k.current=!0,N.debug&&console.log("ReactSimpleKeyboard: Init");var R=P.current,A=".".concat(_);C.current=new(d())(R||A,N),N.keyboardRef&&N.keyboardRef(C.current)}var D=(function(U,G){var L=y(G),te=y(U);return Object.keys(L).filter((function(re){return L[re]!==te[re]}))})(T.current,N);if(D.length){var $=C.current;T.current=N,$?.setOptions(N),N.debug&&console.log("ReactSimpleKeyboard - setOptions called due to updated props:",D)}}),[k,_,T,v]),l.createElement("div",{className:_,ref:P})},b=x})(),o})()}))})(R1)),R1.exports}var mtt=utt();const htt=Pl(mtt),ptt=new Set(["text","password","email","search","url"]);function aD(t,e){(Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,"value")?.set??Object.getOwnPropertyDescriptor(HTMLTextAreaElement.prototype,"value")?.set)?.call(t,e),t.dispatchEvent(new Event("input",{bubbles:!0}))}function ftt(){const[t,e]=w.useState(!1),[n,r]=w.useState(!1),a=w.useRef(!1),[s,o]=w.useState("default"),l=w.useRef(null),c=w.useRef(null),d=w.useRef(null),u=w.useCallback(y=>{if(a.current)return;const x=y.target;if(!x.closest('[data-vkb="false"]')){if(x instanceof HTMLInputElement){if(!ptt.has(x.type))return}else if(!(x instanceof HTMLTextAreaElement))return;l.current=x,e(!0),o("default"),c.current?.setInput?.(l.current.value),setTimeout(()=>{x.scrollIntoView({behavior:"smooth",block:"center"})},100)}},[]),m=w.useCallback(()=>{setTimeout(()=>{const y=document.activeElement;y&&(d.current?.contains(y)||y===l.current)||(e(!1),l.current=null)},150)},[]);w.useEffect(()=>(document.addEventListener("focusin",u),document.addEventListener("focusout",m),()=>{document.removeEventListener("focusin",u),document.removeEventListener("focusout",m)}),[u,m]);const p=w.useCallback(()=>{a.current=!0,r(!0),l.current?.blur(),l.current=null,setTimeout(()=>{e(!1),r(!1),a.current=!1},400)},[]),f=w.useCallback(y=>{const x=l.current;if(x){if(y==="{shift}"){o(b=>b==="default"?"shift":"default");return}if(y==="{lock}"){o(b=>b==="default"?"shift":"default");return}if(y==="{close}"){p();return}y==="{bksp}"?aD(x,x.value.slice(0,-1)):y==="{space}"?aD(x,x.value+" "):(aD(x,x.value+y),s==="shift"&&o("default")),x.focus(),c.current?.setInput?.(x.value)}},[s,p]);return t?i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"fixed inset-0 z-[9998] bg-transparent",onMouseDown:y=>{y.preventDefault(),y.stopPropagation(),n||p()},onTouchStart:y=>{y.preventDefault(),y.stopPropagation(),n||p()},onClick:y=>{y.preventDefault(),y.stopPropagation()}}),!n&&i.jsx("div",{ref:d,className:"fixed bottom-0 left-0 right-0 z-[9999]",onMouseDown:y=>y.preventDefault(),onTouchStart:y=>{y.target.closest(".hg-button")||y.preventDefault()},children:i.jsx(htt,{keyboardRef:y=>{c.current=y},layoutName:s,onKeyPress:f,theme:"simple-keyboard vkb-theme",layout:{default:["1 2 3 4 5 6 7 8 9 0 {bksp}","q w e r t y u i o p","{lock} a s d f g h j k l","{shift} z x c v b n m . @","{space} {close}"],shift:["! @ # $ % ^ & * ( ) {bksp}","Q W E R T Y U I O P","{lock} A S D F G H J K L","{shift} Z X C V B N M , _","{space} {close}"]},display:{"{bksp}":"⌫","{close}":"✕ Close","{shift}":"⇧","{lock}":"⇪","{space}":" "}})})]}):null}function gtt(){const[t,e]=w.useState(null),[n,r]=w.useState(null),[a,s]=w.useState(!1),[o,l]=w.useState(100),[c,d]=w.useState(0),u=w.useRef(Date.now()),{i18n:m}=Mt(),p=ctt(),{data:f}=Je({queryKey:["settings"],queryFn:be.getSettings});w.useEffect(()=>{f?.language&&f.language!==m.language&&m.changeLanguage(f.language)},[f?.language,m]);const{data:y=[]}=Je({queryKey:["spoolbuddy-devices"],queryFn:()=>gs.getDevices(),refetchInterval:3e4}),x=y[0],b=w.useRef(!1);w.useEffect(()=>{x&&!b.current&&(l(x.display_brightness),d(x.display_blank_timeout),b.current=!0)},[x]),w.useEffect(()=>{const k=document.documentElement,P=k.classList.contains("dark");return k.classList.add("dark"),()=>{P||k.classList.remove("dark")}},[]),w.useEffect(()=>{p.deviceOnline?r(null):r({type:"warning",message:"SpoolBuddy device disconnected"})},[p.deviceOnline]);const v=w.useCallback(()=>{u.current=Date.now(),s(!1)},[]);w.useEffect(()=>(window.addEventListener("pointerdown",v),window.addEventListener("keydown",v),()=>{window.removeEventListener("pointerdown",v),window.removeEventListener("keydown",v)}),[v]),w.useEffect(()=>{if(c<=0)return;const k=setInterval(()=>{Date.now()-u.current>=c*1e3&&s(!0)},1e3);return()=>clearInterval(k)},[c]);const _=o<100?{filter:`brightness(${o/100})`}:void 0;return i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"w-screen h-screen bg-bambu-dark text-white flex flex-col overflow-hidden",style:_,children:[i.jsx(rtt,{selectedPrinterId:t,onPrinterChange:e,deviceOnline:p.deviceOnline}),i.jsx("main",{className:"flex-1 overflow-y-auto",children:i.jsx(xY,{context:{selectedPrinterId:t,setSelectedPrinterId:e,sbState:p,setAlert:r,displayBrightness:o,setDisplayBrightness:l,displayBlankTimeout:c,setDisplayBlankTimeout:d}})}),i.jsx(stt,{alert:n}),i.jsx(att,{}),i.jsx(ftt,{})]}),a&&i.jsx("div",{className:"fixed inset-0 bg-black z-[9999]",onPointerDown:k=>{k.stopPropagation(),v()}})]})}function EI({color:t,isEmpty:e,size:n=32}){return e?i.jsx("div",{className:"rounded-full border-2 border-dashed border-zinc-500 flex items-center justify-center",style:{width:n,height:n},children:i.jsx("div",{className:"w-2 h-2 rounded-full bg-zinc-600"})}):i.jsxs("svg",{width:n,height:n,viewBox:"0 0 32 32",children:[i.jsx("circle",{cx:"16",cy:"16",r:"14",fill:t,stroke:"white",strokeWidth:"1.5",strokeOpacity:"0.7"}),i.jsx("circle",{cx:"16",cy:"16",r:"11",fill:t,style:{filter:"brightness(0.85)"}})]})}const btt="spoolbuddy-default-core-weight";function $se(){try{const t=localStorage.getItem(btt);if(t){const e=parseInt(t,10);if(e>=0&&e<=500)return e}}catch{}return 250}function xtt({spool:t,scaleWeight:e,onClose:n,onSyncWeight:r,onAssignToAms:a}){const{t:s}=Mt(),[o,l]=w.useState(!1),[c,d]=w.useState(!1),u=t.rgba?`#${t.rgba.slice(0,6)}`:"#808080",m=t.core_weight&&t.core_weight>0?t.core_weight:$se(),p=e!==null?Math.round(Math.max(0,e)):null,f=p!==null?Math.round(Math.max(0,p-m)):null,y=Math.round(t.label_weight||1e3),x=f!==null?Math.min(100,Math.round(f/y*100)):null,b=x!==null?x>50?"#22c55e":x>20?"#eab308":"#ef4444":"#808080",_=Math.max(0,(t.label_weight||0)-(t.weight_used||0))+m,k=p!==null?p-_:null,P=k!==null?Math.abs(k)<=50:null,C=async()=>{if(e!==null){l(!0);try{await gs.updateSpoolWeight(t.id,Math.round(e)),d(!0),r?.(),setTimeout(()=>d(!1),3e3)}catch(T){console.error("Failed to sync weight:",T)}finally{l(!1)}}};return i.jsxs("div",{className:"flex flex-col items-center space-y-4 max-w-md",children:[i.jsxs("div",{className:"flex items-start gap-5",children:[i.jsxs("div",{className:"relative shrink-0",children:[i.jsx(EI,{color:u,isEmpty:!1,size:100}),x!==null&&i.jsxs("div",{className:"absolute -bottom-2 -right-2 px-2 py-0.5 rounded-full text-xs font-bold text-white shadow-lg",style:{backgroundColor:b},children:[x,"%"]})]}),i.jsxs("div",{className:"flex-1 min-w-0 pt-1",children:[i.jsx("h3",{className:"text-lg font-semibold text-zinc-100",children:t.color_name||"Unknown color"}),i.jsxs("p",{className:"text-sm text-zinc-400",children:[t.brand," • ",t.material,t.subtype&&` ${t.subtype}`]}),f!==null&&i.jsxs("div",{className:"mt-3",children:[i.jsxs("div",{className:"flex items-baseline gap-2",children:[i.jsxs("span",{className:"text-3xl font-bold font-mono text-zinc-100",children:[f,"g"]}),i.jsxs("span",{className:"text-sm text-zinc-500",children:["/ ",y,"g"]})]}),i.jsx("p",{className:"text-xs text-zinc-500 mt-0.5",children:s("spoolbuddy.spool.remaining","Remaining")}),i.jsx("div",{className:"mt-2 max-w-xs",children:i.jsx("div",{className:"h-2 bg-zinc-700 rounded-full overflow-hidden",children:i.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${x}%`,backgroundColor:b}})})})]})]})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-x-6 gap-y-2 text-sm bg-zinc-800 rounded-lg p-4 w-full",children:[i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-zinc-500",children:s("spoolbuddy.dashboard.grossWeight","Gross weight")}),i.jsx("span",{className:"font-mono text-zinc-300",children:p!==null?`${p}g`:"—"})]}),i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-zinc-500",children:s("spoolbuddy.spool.coreWeight","Core")}),i.jsxs("span",{className:"font-mono text-zinc-300",children:[m,"g"]})]}),i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-zinc-500",children:s("spoolbuddy.dashboard.spoolSize","Spool size")}),i.jsxs("span",{className:"font-mono text-zinc-300",children:[y,"g"]})]}),i.jsxs("div",{className:"flex justify-between items-center",children:[i.jsx("span",{className:"text-zinc-500",children:s("spoolbuddy.spool.scaleWeight","Scale")}),p!==null?i.jsxs("span",{className:`flex items-center gap-1 font-mono ${P?"text-green-500":"text-yellow-500"}`,children:[p,"g",P?i.jsx(Vr,{className:"w-3.5 h-3.5"}):i.jsxs(i.Fragment,{children:[i.jsx(En,{className:"w-3.5 h-3.5"}),i.jsx("button",{onClick:C,className:"p-1 hover:bg-green-500/20 rounded transition-colors text-green-500",title:s("spoolbuddy.dashboard.syncWeight","Sync Weight"),children:i.jsx(_r,{className:"w-4 h-4"})})]})]}):i.jsx("span",{className:"text-zinc-500",children:"—"})]}),i.jsxs("div",{className:"flex justify-between items-center",children:[i.jsx("span",{className:"text-zinc-500",children:s("spoolbuddy.dashboard.tagId","Tag")}),i.jsx("span",{className:"font-mono text-xs text-zinc-400 truncate max-w-[120px]",title:t.tag_uid||"",children:t.tag_uid?t.tag_uid.slice(-8):"—"})]})]}),i.jsxs("div",{className:"flex gap-2 justify-center",children:[a&&i.jsx("button",{onClick:a,className:"px-5 py-2.5 rounded-lg text-sm font-medium bg-green-600 text-white hover:bg-green-700 transition-colors min-h-[44px]",children:s("spoolbuddy.modal.assignToAms","Assign to AMS")}),i.jsx("button",{onClick:C,disabled:e===null||o,className:`px-5 py-2.5 rounded-lg text-sm font-medium transition-colors min-h-[44px] ${c?"bg-green-600/20 text-green-400":a?"bg-zinc-700 text-zinc-300 hover:bg-zinc-600 disabled:opacity-40 disabled:cursor-not-allowed":"bg-green-600 text-white hover:bg-green-700 disabled:opacity-40 disabled:cursor-not-allowed"}`,children:o?"...":c?s("spoolbuddy.dashboard.weightSynced","Synced!"):s("spoolbuddy.dashboard.syncWeight","Sync Weight")}),n&&i.jsx("button",{onClick:n,className:"px-5 py-2.5 rounded-lg text-sm font-medium bg-zinc-700 text-zinc-300 hover:bg-zinc-600 transition-colors min-h-[44px]",children:s("spoolbuddy.dashboard.close","Close")})]})]})}function ytt({tagUid:t,scaleWeight:e,coreWeight:n,onLinkSpool:r,onAddToInventory:a,onClose:s}){const{t:o}=Mt(),l=n??$se(),c=e!==null?Math.round(Math.max(0,e)):null,d=c!==null?Math.round(Math.max(0,c-l)):null;return i.jsxs("div",{className:"flex flex-col items-center text-center space-y-5",children:[i.jsx("div",{className:"w-20 h-20 rounded-2xl bg-green-500/15 flex items-center justify-center",children:i.jsx("svg",{className:"w-10 h-10 text-green-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M7 7h.01M7 3h5c.512 0 1.024.195 1.414.586l7 7a2 2 0 010 2.828l-7 7a2 2 0 01-2.828 0l-7-7A2 2 0 013 12V7a4 4 0 014-4z"})})}),i.jsxs("div",{children:[i.jsx("h3",{className:"text-lg font-semibold text-zinc-100",children:o("spoolbuddy.dashboard.newTag","New Tag Detected")}),i.jsx("p",{className:"text-sm text-zinc-500 font-mono mt-1",children:t})]}),c!==null&&i.jsxs("div",{className:"text-sm text-zinc-400",children:[i.jsxs("span",{className:"font-mono font-semibold",children:[c,"g"]})," ",o("spoolbuddy.dashboard.onScale","on scale"),d!==null&&d>0&&i.jsxs("span",{className:"text-zinc-500",children:[" • ~",d,"g filament"]})]}),i.jsxs("div",{className:"flex flex-wrap gap-2 justify-center",children:[a&&i.jsx("button",{onClick:a,className:"px-5 py-2.5 rounded-lg text-sm font-medium bg-green-600 text-white hover:bg-green-700 transition-colors min-h-[44px]",children:o("spoolbuddy.modal.addToInventory","Add to Inventory")}),r&&i.jsxs("button",{onClick:r,className:"px-5 py-2.5 rounded-lg text-sm font-medium bg-zinc-700 text-zinc-300 hover:bg-zinc-600 transition-colors min-h-[44px]",children:[i.jsx("svg",{className:"w-4 h-4 inline-block mr-1.5 -mt-0.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M13.828 10.172a4 4 0 00-5.656 0l-4 4a4 4 0 105.656 5.656l1.102-1.101m-.758-4.899a4 4 0 005.656 0l4-4a4 4 0 00-5.656-5.656l-1.1 1.1"})}),o("spoolbuddy.dashboard.linkSpool","Link to Spool")]}),s&&i.jsx("button",{onClick:s,className:"px-5 py-2.5 rounded-lg text-sm font-medium bg-zinc-700 text-zinc-300 hover:bg-zinc-600 transition-colors min-h-[44px]",children:o("spoolbuddy.dashboard.close","Close")})]})]})}function vtt(t){return t?`#${t.slice(0,6)}`:"#808080"}function qse(t){return!t.tray_type||t.tray_type===""}function wtt(t){return t<=3?`AMS ${String.fromCharCode(65+t)}`:t>=128&&t<=135?`AMS HT ${String.fromCharCode(65+t-128)}`:`AMS ${t}`}function Stt({className:t}){return i.jsx("svg",{className:t,viewBox:"0 0 36 54",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:i.jsx("path",{d:"M17.8131 0.00538C18.4463 -0.15091 20.3648 3.14642 20.8264 3.84781C25.4187 10.816 35.3089 26.9368 35.9383 34.8694C37.4182 53.5822 11.882 61.3357 2.53721 45.3789C-1.73471 38.0791 0.016 32.2049 3.178 25.0232C6.99221 16.3662 12.6411 7.90372 17.8131 0.00538ZM18.3738 7.24807L17.5881 7.48441C14.4452 12.9431 10.917 18.2341 8.19369 23.9368C4.6808 31.29 1.18317 38.5479 7.69403 45.5657C17.3058 55.9228 34.9847 46.8808 31.4604 32.8681C29.2558 24.0969 22.4207 15.2913 18.3776 7.24807H18.3738Z",fill:"#C3C2C1"})})}function _tt({className:t}){return i.jsxs("svg",{className:t,viewBox:"0 0 35 53",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[i.jsx("path",{d:"M17.3165 0.0038C17.932 -0.14959 19.7971 3.08645 20.2458 3.77481C24.7103 10.6135 34.3251 26.4346 34.937 34.2198C36.3757 52.5848 11.5505 60.1942 2.46584 44.534C-1.68714 37.3735 0.0148 31.6085 3.08879 24.5603C6.79681 16.0605 12.2884 7.75907 17.3165 0.0038ZM17.8615 7.11561L17.0977 7.34755C14.0423 12.7048 10.6124 17.8974 7.96483 23.4941C4.54975 30.7107 1.14949 37.8337 7.47908 44.721C16.8233 54.8856 34.01 46.0117 30.5838 32.2595C28.4405 23.6512 21.7957 15.0093 17.8652 7.11561H17.8615Z",fill:"#C3C2C1"}),i.jsx("path",{d:"M5.03547 30.112C9.64453 30.4936 11.632 35.7985 16.4154 35.791C19.6339 35.7873 20.2161 33.2283 22.3853 31.6197C31.6776 24.7286 33.5835 37.4894 27.9881 44.4254C18.1878 56.5653 -1.16063 44.6013 5.03917 30.1158L5.03547 30.112Z",fill:"#1F8FEB"})]})}function ktt({className:t}){return i.jsxs("svg",{className:t,viewBox:"0 0 36 54",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[i.jsx("path",{d:"M17.9625 4.48059L4.77216 26.3154L2.08228 40.2175L10.0224 50.8414H23.1594L33.3246 42.1693V30.2455L17.9625 4.48059Z",fill:"#1F8FEB"}),i.jsx("path",{d:"M17.7948 0.00538C18.4273 -0.15091 20.3438 3.14642 20.8048 3.84781C25.3921 10.816 35.2715 26.9368 35.9001 34.8694C37.3784 53.5822 11.8702 61.3357 2.53562 45.3789C-1.73163 38.0829 0.0134 32.2087 3.1757 25.027C6.98574 16.3662 12.6284 7.90372 17.7948 0.00538ZM18.3549 7.24807L17.57 7.48441C14.4306 12.9431 10.9063 18.2341 8.1859 23.9368C4.67686 31.29 1.18305 38.5479 7.68679 45.5657C17.2881 55.9228 34.9476 46.8808 31.4271 32.8681C29.2249 24.0969 22.3974 15.2913 18.3587 7.24807H18.3549Z",fill:"#C3C2C1"})]})}function Ntt({className:t}){return i.jsxs("svg",{className:t,viewBox:"0 0 12 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[i.jsx("path",{d:"M6 0.5C4.6 0.5 3.5 1.6 3.5 3V12.1C2.6 12.8 2 13.9 2 15C2 17.2 3.8 19 6 19C8.2 19 10 17.2 10 15C10 13.9 9.4 12.8 8.5 12.1V3C8.5 1.6 7.4 0.5 6 0.5Z",stroke:"#C3C2C1",strokeWidth:"1",fill:"none"}),i.jsx("circle",{cx:"6",cy:"15",r:"2.5",stroke:"#C3C2C1",strokeWidth:"1",fill:"none"})]})}function Ctt({className:t}){return i.jsxs("svg",{className:t,viewBox:"0 0 12 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[i.jsx("rect",{x:"4.5",y:"8",width:"3",height:"4.5",fill:"#d4a017",rx:"0.5"}),i.jsx("circle",{cx:"6",cy:"15",r:"2",fill:"#d4a017"}),i.jsx("path",{d:"M6 0.5C4.6 0.5 3.5 1.6 3.5 3V12.1C2.6 12.8 2 13.9 2 15C2 17.2 3.8 19 6 19C8.2 19 10 17.2 10 15C10 13.9 9.4 12.8 8.5 12.1V3C8.5 1.6 7.4 0.5 6 0.5Z",stroke:"#C3C2C1",strokeWidth:"1",fill:"none"})]})}function Ttt({className:t}){return i.jsxs("svg",{className:t,viewBox:"0 0 12 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[i.jsx("rect",{x:"4.5",y:"3",width:"3",height:"9.5",fill:"#c62828",rx:"0.5"}),i.jsx("circle",{cx:"6",cy:"15",r:"2",fill:"#c62828"}),i.jsx("path",{d:"M6 0.5C4.6 0.5 3.5 1.6 3.5 3V12.1C2.6 12.8 2 13.9 2 15C2 17.2 3.8 19 6 19C8.2 19 10 17.2 10 15C10 13.9 9.4 12.8 8.5 12.1V3C8.5 1.6 7.4 0.5 6 0.5Z",stroke:"#C3C2C1",strokeWidth:"1",fill:"none"})]})}function Vse({humidity:t,goodThreshold:e=40,fairThreshold:n=60}){let r,a;return t<=e?(r="#22a352",a=Stt):t<=n?(r="#d4a017",a=_tt):(r="#c62828",a=ktt),i.jsxs("div",{className:"flex items-center gap-0.5",children:[i.jsx(a,{className:"w-3 h-3.5"}),i.jsxs("span",{className:"font-medium tabular-nums text-xs",style:{color:r},children:[t,"%"]})]})}function Gse({temp:t,goodThreshold:e=28,fairThreshold:n=35}){let r,a;return t<=e?(r="#22a352",a=Ntt):t<=n?(r="#d4a017",a=Ctt):(r="#c62828",a=Ttt),i.jsxs("div",{className:"flex items-center gap-0.5",children:[i.jsx(a,{className:"w-3 h-3.5"}),i.jsxs("span",{className:"font-medium tabular-nums text-xs",style:{color:r},children:[t,"°C"]})]})}function jI({side:t}){return i.jsx("span",{className:"inline-flex items-center justify-center w-4 h-4 text-[9px] font-bold rounded",style:{backgroundColor:"#1a4d2e",color:"#00ae42"},children:t})}function Ptt({tray:t,slotIndex:e,isActive:n,fillOverride:r,onClick:a}){const s=qse(t),o=vtt(t.tray_color),l=t.remain!==null&&t.remain!==void 0&&t.remain>=0?t.remain:null,c=r??l;return i.jsxs("div",{className:`relative flex flex-col items-center p-2.5 rounded-lg transition-all ${n?"ring-2 ring-bambu-green":""} ${a?"cursor-pointer hover:bg-white/5":""}`,onClick:a,children:[i.jsxs("div",{className:"relative w-16 h-16 mb-1",children:[s?i.jsx("div",{className:"w-full h-full rounded-full border-2 border-dashed border-gray-500 flex items-center justify-center",children:i.jsx("div",{className:"w-3 h-3 rounded-full bg-gray-600"})}):i.jsxs("svg",{viewBox:"0 0 56 56",className:"w-full h-full",children:[i.jsx("circle",{cx:"28",cy:"28",r:"26",fill:o}),i.jsx("circle",{cx:"28",cy:"28",r:"20",fill:o,style:{filter:"brightness(0.85)"}}),i.jsx("ellipse",{cx:"20",cy:"20",rx:"6",ry:"4",fill:"white",opacity:"0.3"}),i.jsx("circle",{cx:"28",cy:"28",r:"8",fill:"#2d2d2d"}),i.jsx("circle",{cx:"28",cy:"28",r:"5",fill:"#1a1a1a"})]}),n&&i.jsx("div",{className:"absolute -bottom-1 left-1/2 -translate-x-1/2 w-2.5 h-2.5 bg-bambu-green rounded-full"})]}),i.jsx("span",{className:"text-sm text-white/70 truncate max-w-full",children:s?"Empty":t.tray_type||"Unknown"}),!s&&c!==null&&c>=0&&i.jsx("div",{className:"w-full h-1 bg-bambu-dark-tertiary rounded-full overflow-hidden mt-1",children:i.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${c}%`,backgroundColor:c>50?"#22c55e":c>20?"#f59e0b":"#ef4444"}})}),i.jsx("span",{className:"absolute top-1 right-1 text-xs text-white/30",children:e+1})]})}function Wse({unit:t,activeSlot:e,onConfigureSlot:n,isDualNozzle:r,nozzleSide:a,thresholds:s,fillOverrides:o}){const l=t.tray||[],c=t.is_ams_ht,d=c?1:4;return i.jsxs("div",{className:"bg-bambu-dark-secondary rounded-lg p-3",children:[i.jsxs("div",{className:"flex items-center justify-between mb-2",children:[i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx("span",{className:"text-white font-medium text-base",children:wtt(t.id)}),r&&a&&i.jsx(jI,{side:a})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[t.temp!=null&&i.jsx(Gse,{temp:t.temp,goodThreshold:s?.tempGood,fairThreshold:s?.tempFair}),t.humidity!=null&&i.jsx(Vse,{humidity:t.humidity,goodThreshold:s?.humidityGood,fairThreshold:s?.humidityFair})]})]}),i.jsx("div",{className:`grid ${c?"grid-cols-1 max-w-[100px] mx-auto":"grid-cols-4"} gap-2`,children:Array.from({length:d}).map((u,m)=>{const p=l[m]||{id:m,tray_color:null,tray_type:"",tray_sub_brands:null,tray_id_name:null,tray_info_idx:null,remain:-1,k:null,cali_idx:null,tag_uid:null,tray_uuid:null,nozzle_temp_min:null,nozzle_temp_max:null};return i.jsx(Ptt,{tray:p,slotIndex:m,isActive:e===m,fillOverride:o?.[`${t.id}-${m}`]??null,onClick:n?()=>n(t.id,m,qse(p)?null:p):void 0},m)})})]})}function Att(t){return t<=3?`AMS ${String.fromCharCode(65+t)}`:t>=128&&t<=135?`AMS HT ${String.fromCharCode(65+t-128)}`:`AMS ${t}`}function HK(t){return!t.tray_type||t.tray_type===""}function Mtt(t){return t?`#${t.slice(0,6)}`:"#808080"}function Ett({isOpen:t,onClose:e,spool:n,printerId:r}){const{t:a}=Mt(),s=tn(),[o,l]=w.useState(null),[c,d]=w.useState(null);w.useEffect(()=>{t&&(l(null),d(null))},[t]);const u=w.useCallback($=>{$.key==="Escape"&&e()},[e]);w.useEffect(()=>(t&&document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)),[t,u]);const{data:m}=Je({queryKey:["printerStatus",r],queryFn:()=>be.getPrinterStatus(r),enabled:t&&r!==null,refetchInterval:5e3}),{data:p}=Je({queryKey:["printer",r],queryFn:()=>be.getPrinter(r),enabled:t&&r!==null}),f=m?.connected??!1,y=w.useMemo(()=>m?.ams??[],[m?.ams]),x=w.useMemo(()=>y.filter($=>!$.is_ams_ht),[y]),b=w.useMemo(()=>y.filter($=>$.is_ams_ht),[y]),v=w.useMemo(()=>[...m?.vt_tray??[]].sort(($,U)=>($.id??254)-(U.id??254)),[m?.vt_tray]),_=p?.nozzle_count===2||m?.temperatures?.nozzle_2!==void 0,k=w.useRef({});w.useEffect(()=>{m?.ams_extruder_map&&Object.keys(m.ams_extruder_map).length>0&&(k.current=m.ams_extruder_map)},[m?.ams_extruder_map]);const P=m?.ams_extruder_map&&Object.keys(m.ams_extruder_map).length>0?m.ams_extruder_map:k.current,C=w.useCallback($=>{if(!_)return null;const U=P[String($)],G=$>=128?$-128:$;return(U!==void 0?U:G)===1?"L":"R"},[_,P]),T=ut({mutationFn:async({amsId:$,trayId:U})=>{if(!r)throw new Error("No printer selected");if(await be.assignSpool({spool_id:n.id,printer_id:r,ams_id:$,tray_id:U}),n.slicer_filament){const G=n.slicer_filament.includes("_")?n.slicer_filament.split("_")[0]:n.slicer_filament,L=G.startsWith("GF")&&!G.startsWith("GFS")?"GFS"+G.slice(2):G,te=n.subtype?`${n.material} ${n.subtype}`:n.material;try{await be.saveSlotPreset(r,$,U,L,te,"cloud")}catch(re){console.warn("Failed to save slot preset mapping:",re)}}},onSuccess:()=>{d("success"),l(a("spoolbuddy.modal.assignSuccess","Assigned!")),s.invalidateQueries({queryKey:["slotPresets"]}),setTimeout(()=>e(),1500)},onError:$=>{d("error"),l($ instanceof Error?$.message:a("spoolbuddy.modal.assignError","Failed to assign spool."))}}),N=T.isPending,R=w.useCallback(($,U)=>{N||(d("info"),l(a("spoolbuddy.modal.assigning","Configuring slot...")),T.mutate({amsId:$,trayId:U}))},[N,T,a]),A=w.useMemo(()=>{const $=[];for(const U of b){const G=U.tray?.[0]||{id:0,tray_color:null,tray_type:"",tray_sub_brands:null,tray_id_name:null,tray_info_idx:null,remain:-1,k:null,cali_idx:null,tag_uid:null,tray_uuid:null,nozzle_temp_min:null,nozzle_temp_max:null};$.push({key:`ht-${U.id}`,label:Att(U.id),amsId:U.id,trayId:0,tray:G,isEmpty:HK(G),nozzleSide:C(U.id)})}for(const U of v){const G=U.id??254;$.push({key:`ext-${G}`,label:_?G===254?a("printers.extL","Ext-L"):a("printers.extR","Ext-R"):a("printers.ext","Ext"),amsId:255,trayId:G-254,tray:U,isEmpty:HK(U),nozzleSide:_?G===254?"L":"R":null})}return $},[b,v,_,a,C]);if(!t)return null;const D=n.rgba?`#${n.rgba.slice(0,6)}`:"#808080";return i.jsxs("div",{className:"fixed inset-0 z-[60] bg-bambu-dark flex flex-col",children:[i.jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-zinc-800 shrink-0",children:[i.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[i.jsx("div",{className:"w-7 h-7 rounded-full shrink-0",style:{backgroundColor:D}}),i.jsx("div",{className:"min-w-0",children:i.jsxs("h2",{className:"text-sm font-semibold text-zinc-100 truncate",children:[a("spoolbuddy.modal.assignToAmsTitle","Assign to AMS"),i.jsxs("span",{className:"font-normal text-zinc-500 ml-2",children:[n.color_name||"Unknown"," • ",n.brand," ",n.material,n.subtype&&` ${n.subtype}`]})]})})]}),i.jsx("button",{onClick:e,disabled:N,className:"p-2 rounded-lg text-zinc-500 hover:text-zinc-300 hover:bg-zinc-800 transition-colors shrink-0 disabled:opacity-50",children:i.jsx(zt,{className:"w-5 h-5"})})]}),o&&i.jsxs("div",{className:`mx-5 mt-3 p-3 rounded-lg flex items-center gap-3 border shrink-0 ${c==="info"?"bg-blue-500/10 border-blue-500/40":c==="success"?"bg-green-500/10 border-green-500/40":"bg-red-500/10 border-red-500/40"}`,children:[c==="info"&&i.jsx(ct,{className:"w-4 h-4 text-blue-400 animate-spin shrink-0"}),c==="success"&&i.jsx(fr,{className:"w-4 h-4 text-green-400 shrink-0"}),c==="error"&&i.jsx(qi,{className:"w-4 h-4 text-red-400 shrink-0"}),i.jsx("span",{className:`text-sm ${c==="info"?"text-blue-300":c==="success"?"text-green-300":"text-red-300"}`,children:o})]}),i.jsx("div",{className:"flex-1 flex flex-col gap-3 p-4 min-h-0",children:!f&&r?i.jsx("div",{className:"flex-1 flex items-center justify-center",children:i.jsx("div",{className:"text-center text-white/50",children:i.jsx("p",{className:"text-lg mb-2",children:a("spoolbuddy.ams.printerDisconnected","Printer disconnected")})})}):y.length===0&&v.length===0?i.jsx("div",{className:"flex-1 flex items-center justify-center",children:i.jsxs("div",{className:"text-center text-white/50",children:[i.jsx(Vi,{className:"w-12 h-12 mx-auto mb-3 opacity-50"}),i.jsx("p",{className:"text-lg mb-2",children:a("spoolbuddy.ams.noData","No AMS detected")}),i.jsx("p",{className:"text-sm",children:a("spoolbuddy.ams.connectAms","Connect an AMS to see filament slots")})]})}):i.jsxs(i.Fragment,{children:[x.length>0&&i.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3 flex-1 min-h-0",children:x.map($=>i.jsx(Wse,{unit:$,activeSlot:null,onConfigureSlot:(U,G)=>R($.id,G),isDualNozzle:_,nozzleSide:C($.id)},$.id))}),A.length>0&&i.jsx("div",{className:"flex gap-2 shrink-0",children:A.map(({key:$,label:U,amsId:G,trayId:L,tray:te,isEmpty:re,nozzleSide:J})=>{const ue=Mtt(te.tray_color);return i.jsxs("div",{onClick:()=>R(G,L),className:`bg-bambu-dark-secondary rounded-lg px-3 py-2 cursor-pointer hover:bg-bambu-dark-secondary/80 transition-all flex items-center gap-2 ${N?"opacity-50 pointer-events-none":""}`,children:[i.jsx("div",{className:"relative w-10 h-10 shrink-0",children:re?i.jsx("div",{className:"w-full h-full rounded-full border-2 border-dashed border-gray-500 flex items-center justify-center",children:i.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-gray-600"})}):i.jsxs("svg",{viewBox:"0 0 56 56",className:"w-full h-full",children:[i.jsx("circle",{cx:"28",cy:"28",r:"26",fill:ue}),i.jsx("circle",{cx:"28",cy:"28",r:"20",fill:ue,style:{filter:"brightness(0.85)"}}),i.jsx("ellipse",{cx:"20",cy:"20",rx:"6",ry:"4",fill:"white",opacity:"0.3"}),i.jsx("circle",{cx:"28",cy:"28",r:"8",fill:"#2d2d2d"}),i.jsx("circle",{cx:"28",cy:"28",r:"5",fill:"#1a1a1a"})]})}),i.jsxs("div",{className:"min-w-0",children:[i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx("span",{className:"text-xs text-white/50 font-medium",children:U}),J&&i.jsx(jI,{side:J})]}),i.jsx("div",{className:"text-sm text-white/80 truncate",children:re?"Empty":te.tray_type||"?"})]}),!re&&te.remain!=null&&te.remain>=0&&i.jsx("div",{className:"w-1.5 h-8 bg-bambu-dark-tertiary rounded-full overflow-hidden shrink-0 flex flex-col-reverse",children:i.jsx("div",{className:"w-full rounded-full",style:{height:`${te.remain}%`,backgroundColor:te.remain>50?"#22c55e":te.remain>20?"#f59e0b":"#ef4444"}})})]},$)})})]})}),i.jsx("div",{className:"flex justify-end gap-3 px-5 py-3 border-t border-zinc-800 shrink-0",children:i.jsx("button",{onClick:e,disabled:N,className:"px-5 py-2.5 rounded-lg text-sm font-medium bg-zinc-800 text-zinc-300 hover:bg-zinc-700 transition-colors min-h-[44px] disabled:opacity-50",children:c==="success"?a("spoolbuddy.dashboard.close","Close"):a("spoolbuddy.modal.cancel","Cancel")})})]})}function jtt({isOpen:t,onClose:e,tagId:n,untaggedSpools:r,onLink:a}){const{t:s}=Mt(),[o,l]=w.useState(null),c=w.useCallback(()=>{l(null),e()},[e]),d=w.useCallback(m=>{m.key==="Escape"&&c()},[c]);if(w.useEffect(()=>(t&&(document.addEventListener("keydown",d),document.body.style.overflow="hidden"),()=>{document.removeEventListener("keydown",d),document.body.style.overflow=""}),[t,d]),!t)return null;const u=()=>{o&&(a(o),l(null))};return i.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/70 animate-fade-in",onClick:c,children:i.jsxs("div",{className:"bg-zinc-800 rounded-xl shadow-2xl w-full max-w-lg mx-4 animate-slide-up",onClick:m=>m.stopPropagation(),children:[i.jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-zinc-700",children:[i.jsxs("div",{children:[i.jsx("h2",{className:"text-base font-semibold text-zinc-100",children:s("spoolbuddy.dashboard.linkTagTitle","Link Tag to Spool")}),i.jsx("p",{className:"text-sm text-zinc-500 font-mono",children:n})]}),i.jsx("button",{onClick:c,className:"p-2 rounded-lg text-zinc-500 hover:text-zinc-300 hover:bg-zinc-700 transition-colors",children:i.jsx(zt,{className:"w-5 h-5"})})]}),i.jsxs("div",{className:"px-5 py-4 space-y-3 max-h-[400px] overflow-y-auto",children:[i.jsx("p",{className:"text-sm text-zinc-400",children:s("spoolbuddy.dashboard.selectSpool","Select a spool to link this tag to:")}),r.length===0?i.jsx("div",{className:"text-center py-8 text-zinc-500",children:s("spoolbuddy.dashboard.noUntagged","No spools without tags found")}):i.jsx("div",{className:"space-y-2",children:r.map(m=>i.jsxs("button",{type:"button",onClick:()=>l(m),className:`w-full flex items-center gap-3 p-3 rounded-lg border-2 transition-all text-left ${o?.id===m.id?"border-green-500 bg-green-500/10":"border-zinc-700 hover:border-green-500/50 hover:bg-zinc-700/50"}`,children:[i.jsx(EI,{color:m.rgba?`#${m.rgba.slice(0,6)}`:"#808080",isEmpty:!1,size:40}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsx("div",{className:"font-medium text-zinc-100 truncate",children:m.color_name||"Unknown color"}),i.jsxs("div",{className:"text-sm text-zinc-400 truncate",children:[m.brand," • ",m.material,m.subtype&&` ${m.subtype}`]})]}),i.jsxs("div",{className:"text-sm font-mono text-zinc-500",children:[Math.max(0,m.label_weight-m.weight_used),"g"]})]},m.id))})]}),i.jsxs("div",{className:"flex justify-end gap-2 px-5 py-4 border-t border-zinc-700",children:[i.jsx("button",{onClick:c,className:"px-4 py-2.5 rounded-lg text-sm font-medium bg-zinc-700 text-zinc-300 hover:bg-zinc-600 transition-colors min-h-[44px]",children:s("common.cancel","Cancel")}),i.jsx("button",{onClick:u,disabled:!o,className:"px-4 py-2.5 rounded-lg text-sm font-medium bg-green-600 text-white hover:bg-green-700 disabled:opacity-40 disabled:cursor-not-allowed transition-colors min-h-[44px]",children:s("spoolbuddy.dashboard.linkTag","Link Tag")})]})]})})}const $K=["#00AE42","#FF6B35","#3B82F6","#EF4444","#A855F7","#FBBF24","#14B8A6","#EC4899","#F97316","#22C55E"];function Dtt(){const{t}=Mt(),[e,n]=w.useState(0);w.useEffect(()=>{const a=setInterval(()=>{n(s=>(s+1)%$K.length)},2e3);return()=>clearInterval(a)},[]);const r=$K[e];return i.jsxs("div",{className:"flex flex-col items-center text-center",children:[i.jsxs("div",{className:"relative mb-6 flex items-center justify-center",style:{width:160,height:160},children:[i.jsx("div",{className:"absolute w-24 h-24 rounded-full border-2 border-green-500/30 animate-ping",style:{animationDuration:"2.5s"}}),i.jsx("div",{className:"absolute w-32 h-32 rounded-full border border-green-500/20 animate-ping",style:{animationDuration:"2.5s",animationDelay:"0.4s"}}),i.jsx("div",{className:"absolute w-40 h-40 rounded-full border border-green-500/10 animate-ping",style:{animationDuration:"2.5s",animationDelay:"0.8s"}}),i.jsxs("div",{className:"relative",children:[i.jsx("div",{className:"absolute -inset-4 rounded-full blur-2xl opacity-30 transition-colors duration-1000",style:{backgroundColor:r}}),i.jsx("div",{className:"transition-all duration-1000",children:i.jsx(EI,{color:r,isEmpty:!1,size:100})})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("p",{className:"text-xl font-medium text-zinc-300",children:t("spoolbuddy.dashboard.readyToScan","Ready to scan")}),i.jsx("p",{className:"text-sm text-zinc-500",children:t("spoolbuddy.dashboard.idleMessage","Place a spool on the scale to identify it")})]}),i.jsxs("div",{className:"mt-6 flex items-center gap-2 text-sm text-zinc-600",children:[i.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),i.jsx("span",{children:t("spoolbuddy.dashboard.nfcHint","NFC tag will be read automatically")})]})]})}function Rtt(){const{t}=Mt();return i.jsxs("div",{className:"flex flex-col items-center text-center",children:[i.jsx("div",{className:"relative mb-6 flex items-center justify-center",style:{width:160,height:160},children:i.jsx("div",{className:"w-24 h-24 rounded-full bg-zinc-800 flex items-center justify-center",children:i.jsx("svg",{className:"w-12 h-12 text-zinc-600",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",d:"M18.364 5.636a9 9 0 010 12.728m0 0l-12.728-12.728m12.728 12.728L5.636 5.636m12.728 0a9 9 0 00-12.728 0m0 12.728a9 9 0 010-12.728"})})})}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("p",{className:"text-lg font-medium text-zinc-500",children:t("spoolbuddy.status.deviceOffline","Device Offline")}),i.jsx("p",{className:"text-sm text-zinc-600",children:t("spoolbuddy.status.connectDisplay","Connect the SpoolBuddy display to scan spools")})]}),i.jsxs("div",{className:"mt-6 flex items-center gap-2 text-xs text-zinc-600",children:[i.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M8.111 16.404a5.5 5.5 0 017.778 0M12 20h.01m-7.08-7.071c3.904-3.905 10.236-3.905 14.14 0M1.394 9.393c5.857-5.857 15.355-5.857 21.213 0"})}),i.jsx("span",{children:t("spoolbuddy.status.waitingConnection","Waiting for device connection...")})]})]})}function Ftt(){const{sbState:t,selectedPrinterId:e}=A0(),{t:n}=Mt(),{data:r=[],refetch:a}=Je({queryKey:["inventory-spools"],queryFn:()=>be.getSpools(!1)}),{data:s=[]}=Je({queryKey:["printers"],queryFn:()=>be.getPrinters()}),o=gf({queries:s.map(X=>({queryKey:["printerStatus",X.id],queryFn:()=>be.getPrinterStatus(X.id),refetchInterval:1e4}))}),[l,c]=w.useState(null),[d,u]=w.useState(null),[m,p]=w.useState(null),[f,y]=w.useState(!1),[x,b]=w.useState(!1),[v,_]=w.useState(!1),[k,P]=w.useState(!1),C=t.matchedSpool?.tag_uid??t.unknownTagUid??null,T=t.weight,N=t.weightStable,R=w.useRef(null);T===null?R.current=null:(R.current===null||Math.abs(T-R.current)>=3||N)&&(R.current=T);const D=R.current,$=w.useMemo(()=>l?r.find(X=>X.tag_uid===l)??null:null,[l,r]),U=w.useMemo(()=>r.filter(X=>!X.tag_uid&&!X.archived_at),[r]);w.useEffect(()=>{if(C){const X=m===C;(l!==null&&l!==C||!X&&l!==C)&&(c(C),u(null),p(null)),!X&&T!==null&&N&&u(Math.round(Math.max(0,T)))}else m&&(c(null),p(null),u(null))},[C,T,N,l,m]);const G=()=>{p(l)},L=async X=>{if(l)try{await be.linkTagToSpool(X.id,{tag_uid:l,tag_type:"generic",data_origin:"nfc_link"}),y(!1),a()}catch(ie){console.error("Failed to link tag:",ie)}},te=async()=>{if(l){P(!0);try{const X=J??d;await be.createSpool({material:"PLA",subtype:null,color_name:null,rgba:null,brand:null,label_weight:1e3,core_weight:250,core_weight_catalog_id:null,weight_used:0,slicer_filament:null,slicer_filament_name:null,nozzle_temp_min:null,nozzle_temp_max:null,note:null,added_full:null,last_used:null,encode_time:null,tag_uid:l,tray_uuid:null,data_origin:"spoolbuddy",tag_type:"generic",cost_per_kg:null,last_scale_weight:X,last_weighed_at:X!==null?new Date().toISOString():null}),_(!1),a()}catch(X){console.error("Failed to quick-add spool:",X)}finally{P(!1)}}},J=T!==null&&(C===l||C===null&&l!==null)?T:null,ue=r.length,me=new Set(r.map(X=>X.material)).size,ge=new Set(r.filter(X=>X.brand).map(X=>X.brand)).size;return i.jsxs("div",{className:"h-full flex flex-col p-4",children:[i.jsxs("div",{className:"flex items-center gap-6 px-4 py-1.5 bg-zinc-800/50 rounded-xl border border-zinc-700/50 mb-3 shrink-0",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"text-xl font-bold text-zinc-100",children:ue}),i.jsx("span",{className:"text-sm text-zinc-500",children:n("spoolbuddy.inventory.spools","Spools")})]}),i.jsx("div",{className:"w-px h-5 bg-zinc-700"}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"text-xl font-bold text-zinc-100",children:me}),i.jsx("span",{className:"text-sm text-zinc-500",children:n("spoolbuddy.spool.material","Materials")})]}),i.jsx("div",{className:"w-px h-5 bg-zinc-700"}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"text-xl font-bold text-zinc-100",children:ge}),i.jsx("span",{className:"text-sm text-zinc-500",children:n("spoolbuddy.spool.brand","Brands")})]})]}),i.jsxs("div",{className:"flex-1 flex gap-4 min-h-0",children:[i.jsxs("div",{className:"w-5/12 flex flex-col min-h-0",children:[i.jsxs("div",{className:"border border-dashed border-zinc-700/50 rounded-xl p-4",children:[i.jsx("h2",{className:"text-sm font-semibold text-zinc-400 uppercase tracking-wide mb-3",children:n("spoolbuddy.dashboard.device","Device")}),i.jsxs("div",{className:"space-y-2.5",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:`w-2.5 h-2.5 rounded-full ${t.deviceOnline?"bg-green-500 animate-pulse":"bg-red-500"}`}),i.jsx("span",{className:"text-base text-zinc-400",children:t.deviceOnline?n("spoolbuddy.status.online","Online"):n("spoolbuddy.status.offline","Disconnected")})]}),i.jsxs("div",{className:"flex items-center justify-between p-3 bg-zinc-800/50 rounded-lg",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("svg",{className:`w-4 h-4 ${t.deviceOnline?"text-green-500":"text-zinc-500"}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M3 6l3 1m0 0l-3 9a5.002 5.002 0 006.001 0M6 7l3 9M6 7l6-2m6 2l3-1m-3 1l-3 9a5.002 5.002 0 006.001 0M18 7l3 9m-3-9l-6-2m0-2v2m0 16V5m0 16H9m3 0h3"})}),i.jsx("span",{className:"text-sm text-zinc-500",children:n("spoolbuddy.spool.scaleWeight","Scale")})]}),i.jsx("span",{className:"text-lg font-mono font-semibold text-zinc-100",children:D!==null?`${Math.abs(D)<=20?0:Math.round(Math.max(0,D))}g`:"—"})]}),i.jsxs("div",{className:"flex items-center justify-between p-3 bg-zinc-800/50 rounded-lg",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("svg",{className:`w-4 h-4 ${t.deviceOnline?"text-green-500":"text-zinc-500"}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M7 7h.01M7 3h5c.512 0 1.024.195 1.414.586l7 7a2 2 0 010 2.828l-7 7a2 2 0 01-2.828 0l-7-7A2 2 0 013 12V7a4 4 0 014-4z"})}),i.jsx("span",{className:"text-sm text-zinc-500",children:"NFC"})]}),i.jsx("span",{className:`text-sm font-medium ${C?"text-green-500":"text-zinc-500"}`,children:C?n("spoolbuddy.dashboard.tagDetected","Tag detected"):n("spoolbuddy.dashboard.noTag","No tag")})]})]})]}),s.length>0&&i.jsxs("div",{className:"mt-3 border border-dashed border-zinc-700/50 rounded-xl p-4",children:[i.jsx("h2",{className:"text-sm font-semibold text-zinc-400 uppercase tracking-wide mb-2.5",children:n("spoolbuddy.dashboard.printers","Printers")}),i.jsx("div",{className:"flex flex-wrap gap-2 overflow-hidden",children:s.map((X,ie)=>{const le=o[ie]?.data?.connected??!1;return i.jsxs("div",{className:"flex items-center gap-1.5 px-2.5 py-1 bg-zinc-800/50 rounded-lg",title:`${X.name} — ${le?"Online":"Offline"}`,children:[i.jsx("div",{className:`w-2 h-2 rounded-full shrink-0 ${le?"bg-green-500":"bg-zinc-600"}`}),i.jsx("span",{className:"text-xs text-zinc-400 truncate max-w-[100px]",children:X.name})]},X.id)})})]})]}),i.jsx("div",{className:"w-7/12 min-h-0",children:i.jsxs("div",{className:"border border-dashed border-zinc-700/50 rounded-xl p-6 h-full flex flex-col",children:[i.jsx("h2",{className:"text-sm font-semibold text-zinc-400 uppercase tracking-wide mb-4 shrink-0",children:n("spoolbuddy.dashboard.currentSpool","Current Spool")}),i.jsx("div",{className:"flex-1 flex items-center justify-center min-h-0",children:t.deviceOnline?$&&l&&m!==l?i.jsx(xtt,{spool:{id:$.id,tag_uid:l,material:$.material,subtype:$.subtype,color_name:$.color_name,rgba:$.rgba,brand:$.brand,label_weight:$.label_weight,core_weight:$.core_weight,weight_used:$.weight_used},scaleWeight:J??d,onSyncWeight:()=>a(),onAssignToAms:()=>b(!0),onClose:G}):l&&!$&&m!==l?i.jsx(ytt,{tagUid:l,scaleWeight:J??d,onLinkSpool:U.length>0?()=>y(!0):void 0,onAddToInventory:()=>_(!0),onClose:G}):i.jsx(Dtt,{}):i.jsx(Rtt,{})})]})})]}),$&&l&&i.jsx(Ett,{isOpen:x,onClose:()=>b(!1),spool:$,printerId:e}),l&&i.jsx(jtt,{isOpen:f,onClose:()=>y(!1),tagId:l,untaggedSpools:U,onLink:L}),v&&l&&i.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",children:i.jsxs("div",{className:"bg-zinc-800 rounded-2xl p-6 mx-4 max-w-sm w-full border border-zinc-700",children:[i.jsx("h3",{className:"text-lg font-semibold text-zinc-100 mb-3",children:n("spoolbuddy.modal.addToInventory","Add to Inventory")}),i.jsxs("div",{className:"flex gap-2.5 p-3 bg-amber-500/10 border border-amber-500/20 rounded-lg mb-4",children:[i.jsx("svg",{className:"w-5 h-5 text-amber-500 shrink-0 mt-0.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),i.jsx("p",{className:"text-sm text-amber-200/80",children:n("spoolbuddy.modal.quickAddHint",'For best results, add the spool in the Bambuddy web interface first (with material, color, brand), then use "Link to Spool" here to assign the NFC tag.')})]}),i.jsx("p",{className:"text-sm text-zinc-400 mb-1",children:n("spoolbuddy.modal.quickAddDesc","This will create a basic PLA spool entry with this NFC tag. You can edit the details later in Bambuddy.")}),i.jsx("p",{className:"text-xs text-zinc-500 font-mono mb-5",children:l}),i.jsxs("div",{className:"flex gap-3",children:[i.jsx("button",{onClick:()=>_(!1),className:"flex-1 px-4 py-2.5 rounded-lg text-sm font-medium bg-zinc-700 text-zinc-300 hover:bg-zinc-600 transition-colors min-h-[44px]",children:n("common.cancel","Cancel")}),i.jsx("button",{onClick:te,disabled:k,className:"flex-1 px-4 py-2.5 rounded-lg text-sm font-medium bg-green-600 text-white hover:bg-green-700 disabled:opacity-50 transition-colors min-h-[44px]",children:k?n("common.saving","Saving..."):n("spoolbuddy.modal.addAnyway","Add Anyway")})]})]})})]})}function qK(t){return t<=3?`AMS ${String.fromCharCode(65+t)}`:t>=128&&t<=135?`AMS HT ${String.fromCharCode(65+t-128)}`:`AMS ${t}`}function Ltt(t){return t?{O1D:"H2D",O1E:"H2D Pro",O2D:"H2D Pro",O1C:"H2C",O1C2:"H2C",O1S:"H2S","BL-P001":"X1C","BL-P002":"X1","BL-P003":"X1E",C11:"P1S",C12:"P1P",C13:"P2S",N2S:"A1",N1:"A1 Mini",X1C:"X1C",X1:"X1",X1E:"X1E",P1S:"P1S",P1P:"P1P",P2S:"P2S",A1:"A1","A1 Mini":"A1 Mini",H2D:"H2D","H2D Pro":"H2D Pro",H2C:"H2C",H2S:"H2S"}[t]||t:""}function sD(t){return!t.tray_type||t.tray_type===""}function Ott(t){return t?`#${t.slice(0,6)}`:"#808080"}function Itt(){const{selectedPrinterId:t,setAlert:e}=A0(),{t:n}=Mt(),r=tn(),{data:a}=Je({queryKey:["printerStatus",t],queryFn:()=>be.getPrinterStatus(t),enabled:t!==null,staleTime:30*1e3}),{data:s}=Je({queryKey:["printer",t],queryFn:()=>be.getPrinter(t),enabled:t!==null,staleTime:60*1e3}),{data:o}=Je({queryKey:["slotPresets",t],queryFn:()=>be.getSlotPresets(t),enabled:t!==null,staleTime:120*1e3}),{data:l}=Je({queryKey:["settings"],queryFn:()=>be.getSettings(),staleTime:300*1e3}),{data:c}=Je({queryKey:["spool-assignments",t],queryFn:()=>be.getAssignments(t),enabled:t!==null,staleTime:30*1e3}),d=w.useMemo(()=>{const $={};if(!c)return $;for(const U of c){const G=U.spool;if(G&&G.label_weight>0&&G.weight_used!=null){const L=Math.round(Math.max(0,G.label_weight-G.weight_used)/G.label_weight*100);$[`${U.ams_id}-${U.tray_id}`]=L}}return $},[c]),u=a?.connected??!1,m=w.useMemo(()=>a?.ams??[],[a?.ams]),p=w.useMemo(()=>m.filter($=>!$.is_ams_ht),[m]),f=w.useMemo(()=>m.filter($=>$.is_ams_ht),[m]),y=a?.tray_now??255,x=s?.nozzle_count===2||a?.temperatures?.nozzle_2!==void 0,b=w.useMemo(()=>[...a?.vt_tray??[]].sort(($,U)=>($.id??254)-(U.id??254)),[a?.vt_tray]),v=l?{humidityGood:Number(l.ams_humidity_good)||40,humidityFair:Number(l.ams_humidity_fair)||60,tempGood:Number(l.ams_temp_good)||28,tempFair:Number(l.ams_temp_fair)||35}:void 0,_=w.useRef({});w.useEffect(()=>{a?.ams_extruder_map&&Object.keys(a.ams_extruder_map).length>0&&(_.current=a.ams_extruder_map)},[a?.ams_extruder_map]);const k=a?.ams_extruder_map&&Object.keys(a.ams_extruder_map).length>0?a.ams_extruder_map:_.current,P=w.useCallback($=>{if(!x)return null;const U=k[String($)],G=$>=128?$-128:$;return(U!==void 0?U:G)===1?"L":"R"},[x,k]),[C,T]=w.useState(null),N=w.useCallback($=>{if(y===255||y===254)return null;if($<=3&&Math.floor(y/4)===$)return y%4;if($>=128&&$<=135){const U=$-128;if(y===16+U)return 0}return null},[y]),R=w.useCallback(($,U,G)=>{const L=$>=128?($-128)*4+U+64:$*4+U,te=o?.[L],re=k[String($)],J=$>=128?$-128:$,ue=re!==void 0?re:J;T({amsId:$,trayId:U,trayCount:G&&$>=128?1:4,trayType:G?.tray_type||void 0,trayColor:G?.tray_color||void 0,traySubBrands:G?.tray_sub_brands||void 0,trayInfoIdx:G?.tray_info_idx||void 0,extruderId:x?ue:void 0,caliIdx:G?.cali_idx,savedPresetId:te?.preset_id})},[o,k,x]),A=w.useCallback($=>{const U=$.id??254,G=U-254,L=o?.[1020+G];T({amsId:255,trayId:G,trayCount:1,trayType:$.tray_type||void 0,trayColor:$.tray_color||void 0,traySubBrands:$.tray_sub_brands||void 0,trayInfoIdx:$.tray_info_idx||void 0,extruderId:x?U===254?1:0:void 0,caliIdx:$.cali_idx,savedPresetId:L?.preset_id})},[o,x]);w.useEffect(()=>{if(!u&&t){e({type:"warning",message:n("spoolbuddy.ams.printerDisconnected","Printer disconnected")});return}for(const $ of m)for(const U of $.tray||[])if(U.remain!==null&&U.remain>=0&&U.remain<15&&U.tray_type){e({type:"warning",message:`Low Filament: ${U.tray_type} (${qK($.id)}) - ${U.remain}% remaining`});return}e(null)},[m,u,t,e,n]);const D=w.useMemo(()=>{const $=[];for(const U of f){const G=U.tray?.[0]||{id:0,tray_color:null,tray_type:"",tray_sub_brands:null,tray_id_name:null,tray_info_idx:null,remain:-1,k:null,cali_idx:null,tag_uid:null,tray_uuid:null,nozzle_temp_min:null,nozzle_temp_max:null},L=d[`${U.id}-0`]??null,te=G.remain!=null&&G.remain>=0?G.remain:null;$.push({key:`ht-${U.id}`,label:qK(U.id),tray:G,isEmpty:sD(G),isActive:N(U.id)===0,temp:U.temp,humidity:U.humidity,nozzleSide:P(U.id),effectiveFill:L??te,onClick:()=>R(U.id,0,sD(G)?null:G)})}for(const U of b){const G=U.id??254,L=y===255?!1:x&&y===254?G===254&&a?.active_extruder===1||G===255&&a?.active_extruder===0:y===G,te=G-254,re=d[`255-${te}`]??null,J=U.remain!=null&&U.remain>=0?U.remain:null;$.push({key:`ext-${G}`,label:x?G===254?n("printers.extL","Ext-L"):n("printers.extR","Ext-R"):n("printers.ext","Ext"),tray:U,isEmpty:sD(U),isActive:L,nozzleSide:null,effectiveFill:re??J,onClick:()=>A(U)})}return $},[f,b,x,y,a?.active_extruder,n,N,P,R,A,d]);return i.jsxs("div",{className:"h-full flex flex-col p-4",children:[i.jsx("div",{className:"flex-1 min-h-0",children:t?u?m.length===0&&b.length===0?i.jsx("div",{className:"flex-1 flex items-center justify-center h-full",children:i.jsxs("div",{className:"text-center text-white/50",children:[i.jsx(Vi,{className:"w-12 h-12 mx-auto mb-3 opacity-50"}),i.jsx("p",{className:"text-lg mb-2",children:n("spoolbuddy.ams.noData","No AMS detected")}),i.jsx("p",{className:"text-sm",children:n("spoolbuddy.ams.connectAms","Connect an AMS to see filament slots")})]})}):i.jsxs("div",{className:"flex flex-col gap-3 h-full",children:[i.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:p.map($=>i.jsx(Wse,{unit:$,activeSlot:N($.id),onConfigureSlot:R,isDualNozzle:x,nozzleSide:P($.id),thresholds:v,fillOverrides:d},$.id))}),D.length>0&&i.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:D.map(({key:$,label:U,tray:G,isEmpty:L,isActive:te,temp:re,humidity:J,nozzleSide:ue,effectiveFill:me,onClick:ge})=>{const X=Ott(G.tray_color);return i.jsxs("div",{className:`bg-bambu-dark-secondary rounded-lg px-3 py-2 cursor-pointer hover:bg-bambu-dark-secondary/80 transition-all flex items-center gap-3 ${te?"ring-2 ring-bambu-green":""}`,onClick:ge,children:[i.jsxs("div",{className:"relative w-10 h-10 flex-shrink-0",children:[L?i.jsx("div",{className:"w-full h-full rounded-full border-2 border-dashed border-gray-500 flex items-center justify-center",children:i.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-gray-600"})}):i.jsxs("svg",{viewBox:"0 0 56 56",className:"w-full h-full",children:[i.jsx("circle",{cx:"28",cy:"28",r:"26",fill:X}),i.jsx("circle",{cx:"28",cy:"28",r:"20",fill:X,style:{filter:"brightness(0.85)"}}),i.jsx("ellipse",{cx:"20",cy:"20",rx:"6",ry:"4",fill:"white",opacity:"0.3"}),i.jsx("circle",{cx:"28",cy:"28",r:"8",fill:"#2d2d2d"}),i.jsx("circle",{cx:"28",cy:"28",r:"5",fill:"#1a1a1a"})]}),te&&i.jsx("div",{className:"absolute -bottom-0.5 left-1/2 -translate-x-1/2 w-1.5 h-1.5 bg-bambu-green rounded-full"})]}),i.jsxs("div",{className:"min-w-0",children:[i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx("span",{className:"text-xs text-white/50 font-medium truncate",children:U}),ue&&i.jsx(jI,{side:ue})]}),i.jsx("div",{className:"text-sm text-white/80 truncate",children:L?"Empty":G.tray_type||"?"}),(re!=null||J!=null)&&i.jsxs("div",{className:"flex items-center gap-1.5",children:[re!=null&&i.jsx(Gse,{temp:re,goodThreshold:v?.tempGood,fairThreshold:v?.tempFair}),J!=null&&i.jsx(Vse,{humidity:J,goodThreshold:v?.humidityGood,fairThreshold:v?.humidityFair})]})]}),!L&&me!=null&&me>=0&&i.jsx("div",{className:"w-1.5 h-8 bg-bambu-dark-tertiary rounded-full overflow-hidden flex-shrink-0 flex flex-col-reverse",children:i.jsx("div",{className:"w-full rounded-full",style:{height:`${me}%`,backgroundColor:me>50?"#22c55e":me>20?"#f59e0b":"#ef4444"}})})]},$)})})]}):i.jsx("div",{className:"flex-1 flex items-center justify-center h-full",children:i.jsx("div",{className:"text-center text-white/50",children:i.jsx("p",{className:"text-lg mb-2",children:n("spoolbuddy.ams.printerDisconnected","Printer disconnected")})})}):i.jsx("div",{className:"flex-1 flex items-center justify-center h-full",children:i.jsxs("div",{className:"text-center text-white/50",children:[i.jsx("p",{className:"text-lg mb-2",children:n("spoolbuddy.ams.noPrinter","No printer selected")}),i.jsx("p",{className:"text-sm",children:n("spoolbuddy.ams.selectPrinter","Select a printer from the top bar")})]})})}),C&&t&&i.jsx(Qne,{isOpen:!!C,onClose:()=>T(null),printerId:t,slotInfo:C,printerModel:Ltt(s?.model??null)||void 0,fullScreen:!0,onSuccess:()=>{r.invalidateQueries({queryKey:["slotPresets",t]}),r.invalidateQueries({queryKey:["printerStatus",t]})}})]})}function ztt(t){if(t<60)return`${t}s`;if(t<3600)return`${Math.floor(t/60)}m`;const e=Math.floor(t/3600),n=Math.floor(t%3600/60);return`${e}h ${n}m`}function Utt(t){if(!t)return"-";try{const e=new Date(t);return e.toLocaleDateString(void 0,{month:"short",day:"numeric"})+" "+e.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"})}catch{return"-"}}const Btt=[{label:"Off",value:0},{label:"1m",value:60},{label:"2m",value:120},{label:"5m",value:300},{label:"10m",value:600},{label:"30m",value:1800}];function Htt({device:t}){const{t:e}=Mt();return i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"bg-zinc-800 rounded-lg p-4",children:[i.jsx("div",{className:"flex items-center gap-3 mb-2",children:i.jsx("img",{src:"/img/spoolbuddy_logo_dark_small.png",alt:"SpoolBuddy",className:"h-7 w-auto"})}),i.jsx("p",{className:"text-xs text-zinc-500 mb-1",children:"Part of Bambuddy"}),i.jsx("span",{className:"text-xs text-zinc-500",children:"github.com/maziggy/bambuddy"})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[i.jsxs("div",{className:"bg-zinc-800 rounded-lg p-3",children:[i.jsx("h3",{className:"text-sm font-semibold text-zinc-300 mb-2",children:e("spoolbuddy.settings.nfcReader","NFC Reader")}),i.jsxs("div",{className:"space-y-1.5 text-xs",children:[i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-zinc-500",children:e("spoolbuddy.settings.type","Type")}),i.jsx("span",{className:"text-zinc-300 font-mono",children:t.nfc_reader_type||"N/A"})]}),i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-zinc-500",children:e("spoolbuddy.settings.connection","Connection")}),i.jsx("span",{className:"text-zinc-300 font-mono",children:t.nfc_connection||"N/A"})]}),i.jsxs("div",{className:"flex justify-between items-center",children:[i.jsx("span",{className:"text-zinc-500",children:e("spoolbuddy.status.status","Status")}),i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx("div",{className:`w-2 h-2 rounded-full ${t.nfc_ok?"bg-green-500":t.nfc_reader_type?"bg-red-500":"bg-zinc-600"}`}),i.jsx("span",{className:t.nfc_ok?"text-green-400":t.nfc_reader_type?"text-red-400":"text-zinc-500",children:t.nfc_ok?e("spoolbuddy.status.nfcReady","Ready"):t.nfc_reader_type?e("common.error","Error"):e("spoolbuddy.settings.notConnected","N/A")})]})]})]})]}),i.jsxs("div",{className:"bg-zinc-800 rounded-lg p-3",children:[i.jsx("h3",{className:"text-sm font-semibold text-zinc-300 mb-2",children:e("spoolbuddy.settings.deviceInfo","Device Info")}),i.jsxs("div",{className:"space-y-1.5 text-xs",children:[i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-zinc-500",children:e("spoolbuddy.settings.hostname","Host")}),i.jsx("span",{className:"text-zinc-300 truncate ml-2",children:t.hostname})]}),i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-zinc-500",children:"IP"}),i.jsx("span",{className:"text-zinc-300",children:t.ip_address})]}),i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-zinc-500",children:e("spoolbuddy.settings.uptime","Uptime")}),i.jsx("span",{className:"text-zinc-300",children:ztt(t.uptime_s)})]}),i.jsxs("div",{className:"flex justify-between items-center",children:[i.jsx("span",{className:"text-zinc-500",children:e("spoolbuddy.status.status","Status")}),i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx("div",{className:`w-2 h-2 rounded-full ${t.online?"bg-green-500":"bg-zinc-600"}`}),i.jsx("span",{className:t.online?"text-green-400":"text-zinc-500",children:t.online?e("spoolbuddy.status.online","Online"):e("spoolbuddy.status.offline","Offline")})]})]})]})]})]}),i.jsxs("div",{className:"bg-zinc-800 rounded-lg px-3 py-2 flex justify-between items-center text-xs",children:[i.jsx("span",{className:"text-zinc-500",children:"Device ID"}),i.jsx("span",{className:"text-zinc-400 font-mono",children:t.device_id})]})]})}function $tt({device:t,onBrightnessChange:e,onBlankTimeoutChange:n}){const{t:r}=Mt(),[a,s]=w.useState(t.display_brightness),[o,l]=w.useState(t.display_blank_timeout),[c,d]=w.useState(!1),u=w.useRef(void 0),m=w.useRef(void 0);w.useEffect(()=>{s(t.display_brightness),l(t.display_blank_timeout)},[t.display_brightness,t.display_blank_timeout]);const p=w.useCallback(()=>{d(!0),m.current&&clearTimeout(m.current),m.current=setTimeout(()=>d(!1),1500)},[]),f=w.useCallback((b,v)=>{u.current&&clearTimeout(u.current),u.current=setTimeout(()=>{gs.updateDisplay(t.device_id,b,v).then(()=>p()).catch(_=>console.error("Failed to update display:",_))},300)},[t.device_id,p]),y=b=>{s(b),e(b),f(b,o)},x=b=>{l(b),n(b),f(a,b)};return i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"bg-zinc-800 rounded-lg p-4",children:[i.jsxs("div",{className:"flex items-center justify-between mb-3",children:[i.jsx("h3",{className:"text-sm font-semibold text-zinc-300",children:r("spoolbuddy.settings.brightness","Brightness")}),c&&i.jsxs("span",{className:"text-xs text-green-400 flex items-center gap-1 animate-pulse",children:[i.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:3,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),r("spoolbuddy.settings.saved","Saved")]})]}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("svg",{className:"w-4 h-4 text-zinc-500 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707M16 12a4 4 0 11-8 0 4 4 0 018 0z"})}),i.jsx("input",{type:"range",min:0,max:100,value:a,onChange:b=>y(parseInt(b.target.value)),className:"flex-1 h-2 bg-zinc-700 rounded-lg appearance-none cursor-pointer accent-green-500"}),i.jsxs("span",{className:"text-sm font-mono text-zinc-400 w-10 text-right",children:[a,"%"]})]}),!t.has_backlight&&i.jsx("p",{className:"text-xs text-zinc-600 mt-2",children:r("spoolbuddy.settings.noBacklight","No DSI backlight detected. Brightness control requires a DSI display.")})]}),i.jsxs("div",{className:"bg-zinc-800 rounded-lg p-4",children:[i.jsx("h3",{className:"text-sm font-semibold text-zinc-300 mb-1",children:r("spoolbuddy.settings.screenBlank","Screen Blank Timeout")}),i.jsx("p",{className:"text-xs text-zinc-500 mb-3",children:r("spoolbuddy.settings.screenBlankDesc","Screen turns off after inactivity. Touch to wake.")}),i.jsx("div",{className:"grid grid-cols-3 gap-2",children:Btt.map(b=>i.jsx("button",{onClick:()=>x(b.value),className:`px-3 py-2 rounded-lg text-sm font-medium transition-colors min-h-[40px] ${o===b.value?"bg-green-600 text-white":"bg-zinc-700 text-zinc-300 hover:bg-zinc-600"}`,children:b.label},b.value))})]}),i.jsx("p",{className:"text-xs text-zinc-600 text-center",children:r("spoolbuddy.settings.displayNote","Brightness is applied as a software filter.")})]})}function qtt({step:t,labels:e}){return i.jsxs("div",{className:"flex flex-col items-center w-16 shrink-0 pt-1",children:[i.jsx("div",{className:`flex items-center justify-center w-7 h-7 rounded-full text-xs font-bold ${t==="tare"?"bg-green-600 text-white":"bg-green-600/20 text-green-400"}`,children:t==="weight"?i.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:3,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}):"1"}),i.jsx("span",{className:`text-[10px] mt-0.5 ${t==="tare"?"text-green-400 font-medium":"text-green-400/60"}`,children:e.tare}),i.jsx("div",{className:`w-px h-5 my-1 ${t==="weight"?"bg-green-600/40":"bg-zinc-700"}`}),i.jsx("div",{className:`flex items-center justify-center w-7 h-7 rounded-full text-xs font-bold ${t==="weight"?"bg-green-600 text-white":"bg-zinc-700 text-zinc-500"}`,children:"2"}),i.jsx("span",{className:`text-[10px] mt-0.5 ${t==="weight"?"text-green-400 font-medium":"text-zinc-600"}`,children:e.weight})]})}function Vtt({device:t,weight:e,weightStable:n,rawAdc:r}){const{t:a}=Mt(),[s,o]=w.useState("idle"),[l,c]=w.useState("500"),[d,u]=w.useState(null),[m,p]=w.useState(!1),[f,y]=w.useState(null),x=_=>{_==="backspace"?c(k=>k.slice(0,-1)||""):_==="."&&!l.includes(".")?c(k=>k+"."):_>="0"&&_<="9"&&c(k=>k==="0"?_:k+_)},b=async()=>{p(!0),y(null);try{await gs.tare(t.device_id),y({type:"ok",msg:a("spoolbuddy.settings.tareSet","Tare command sent. Waiting for device...")})}catch{y({type:"error",msg:a("spoolbuddy.settings.tareFailed","Failed to send tare command")})}finally{p(!1)}},v=async()=>{if(s==="tare"){p(!0),y(null);try{u(r),await gs.tare(t.device_id),y({type:"ok",msg:a("spoolbuddy.settings.zeroSet","Zero point set. Place known weight on scale.")}),o("weight")}catch{y({type:"error",msg:a("spoolbuddy.settings.tareFailed","Failed to send tare command")})}finally{p(!1)}}else if(s==="weight"){const _=parseFloat(l);if(r===null||!_||_<=0)return;p(!0),y(null);try{await gs.setCalibrationFactor(t.device_id,_,r,d??void 0),y({type:"ok",msg:a("spoolbuddy.settings.calibrationDone","Calibration complete!")}),o("idle")}catch{y({type:"error",msg:a("spoolbuddy.settings.calibrationFailed","Calibration failed")})}finally{p(!1)}}};return s==="idle"?i.jsxs("div",{className:"flex flex-col h-full",children:[i.jsxs("div",{className:"bg-zinc-800 rounded-lg p-3 mb-3",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("div",{className:`w-2 h-2 rounded-full ${n?"bg-green-500":"bg-amber-500 animate-pulse"}`}),i.jsx("span",{className:"text-lg font-mono text-zinc-200",children:e!==null?`${e.toFixed(1)} g`:"-- g"})]}),i.jsxs("div",{className:"text-xs text-zinc-500 text-right",children:[i.jsxs("span",{children:[a("spoolbuddy.settings.tareOffset","Tare"),": ",t.tare_offset]}),i.jsx("span",{className:"mx-1.5",children:"·"}),i.jsxs("span",{children:[a("spoolbuddy.settings.calFactor","Factor"),": ",t.calibration_factor.toFixed(2)]})]})]}),t.last_calibrated_at&&i.jsxs("div",{className:"text-xs text-zinc-600 mt-1",children:[a("spoolbuddy.settings.lastCalibrated","Last calibrated"),": ",Utt(t.last_calibrated_at)]})]}),f&&i.jsx("div",{className:`rounded-lg px-3 py-2 mb-3 text-sm ${f.type==="ok"?"bg-green-900/30 text-green-300 border border-green-800":"bg-red-900/30 text-red-300 border border-red-800"}`,children:f.msg}),i.jsxs("div",{className:"flex gap-2",children:[i.jsxs("button",{onClick:b,disabled:m,className:"flex-1 px-4 py-2.5 rounded-lg text-sm font-medium bg-zinc-700 text-zinc-200 hover:bg-zinc-600 disabled:opacity-40 transition-colors min-h-[44px] flex items-center justify-center gap-2",children:[m&&i.jsxs("svg",{className:"w-4 h-4 animate-spin",viewBox:"0 0 24 24",fill:"none",children:[i.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),i.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),a("spoolbuddy.weight.tare","Tare")]}),i.jsx("button",{onClick:()=>{o("tare"),y(null)},className:"flex-1 px-4 py-2.5 rounded-lg text-sm font-medium bg-green-600 text-white hover:bg-green-700 transition-colors min-h-[44px]",children:a("spoolbuddy.weight.calibrate","Calibrate")})]})]}):i.jsxs("div",{className:"flex gap-3",children:[i.jsx(qtt,{step:s,labels:{tare:a("spoolbuddy.weight.tare","Tare"),weight:a("spoolbuddy.settings.knownWeight","Known weight")}}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsxs("div",{className:"flex items-center gap-2 bg-zinc-800 rounded-lg px-3 py-1.5 mb-1.5",children:[i.jsx("div",{className:`w-2 h-2 rounded-full shrink-0 ${n?"bg-green-500":"bg-amber-500 animate-pulse"}`}),i.jsx("span",{className:"text-sm font-mono text-zinc-200",children:e!==null?`${e.toFixed(1)} g`:"-- g"}),i.jsx("span",{className:`text-xs ml-auto ${n?"text-green-400":"text-amber-400"}`,children:n?a("spoolbuddy.settings.stable","Stable"):a("spoolbuddy.settings.settling","Settling...")})]}),f&&i.jsx("div",{className:`rounded-lg px-3 py-1.5 mb-1.5 text-xs ${f.type==="ok"?"bg-green-900/30 text-green-300 border border-green-800":"bg-red-900/30 text-red-300 border border-red-800"}`,children:f.msg}),s==="tare"?i.jsx("p",{className:"text-sm text-zinc-300 mb-3",children:a("spoolbuddy.settings.calStep1","Remove all items from the scale and press Set Zero.")}):i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[i.jsx("span",{className:"text-xs text-zinc-400 shrink-0",children:a("spoolbuddy.settings.knownWeight","Known weight")}),i.jsxs("div",{className:"flex-1 bg-zinc-900 border border-zinc-600 rounded px-3 py-1 text-right text-lg font-mono text-zinc-100",children:[l||"0",i.jsx("span",{className:"text-zinc-500 ml-1",children:"g"})]})]}),i.jsx("div",{className:"grid grid-cols-4 gap-1 mb-1.5",children:["7","8","9","backspace","4","5","6",".","1","2","3","0"].map(_=>i.jsx("button",{onClick:()=>x(_),className:`rounded text-lg font-medium transition-colors h-[48px] active:scale-95 ${_==="backspace"?"bg-zinc-700 text-zinc-300 hover:bg-zinc-600":"bg-zinc-800 text-zinc-100 hover:bg-zinc-700 border border-zinc-700"}`,children:_==="backspace"?"⌫":_},_))})]}),i.jsxs("div",{className:"flex gap-2",children:[i.jsx("button",{onClick:()=>{o("idle"),y(null)},className:"flex-1 px-4 py-2 rounded-lg text-sm bg-zinc-700 text-zinc-300 hover:bg-zinc-600 transition-colors h-[40px]",children:a("common.cancel","Cancel")}),i.jsxs("button",{onClick:v,disabled:m,className:"flex-1 px-4 py-2 rounded-lg text-sm font-medium bg-green-600 text-white hover:bg-green-700 disabled:opacity-40 transition-colors h-[40px] flex items-center justify-center gap-2",children:[m&&i.jsxs("svg",{className:"w-4 h-4 animate-spin",viewBox:"0 0 24 24",fill:"none",children:[i.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),i.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),s==="tare"?a("spoolbuddy.settings.setZero","Set Zero"):a("spoolbuddy.settings.calibrateNow","Calibrate")]})]})]})]})}function Gtt({device:t}){const{t:e}=Mt(),[n,r]=w.useState(!1),[a,s]=w.useState(null),[o,l]=w.useState(null),[c,d]=w.useState(()=>{try{return localStorage.getItem("spoolbuddy-include-beta")==="true"}catch{return!1}}),u=()=>{const f=!c;d(f);try{localStorage.setItem("spoolbuddy-include-beta",String(f))}catch{}s(null),l(null)},m=async()=>{r(!0),s(null),l(null);try{const f=await gs.checkDaemonUpdate(t.device_id,c);s(f)}catch(f){l(f instanceof Error?f.message:"Failed to check for updates")}finally{r(!1)}},p=t.firmware_version||(a?.current_version&&a.current_version!=="0.0.0"?a.current_version:null);return i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"bg-zinc-800 rounded-lg p-4",children:[i.jsx("h3",{className:"text-sm font-semibold text-zinc-300 mb-3",children:e("spoolbuddy.settings.daemonVersion","Daemon Version")}),i.jsxs("div",{className:"flex justify-between items-center text-sm",children:[i.jsx("span",{className:"text-zinc-500",children:e("spoolbuddy.settings.currentVersion","Current")}),i.jsx("span",{className:"text-zinc-200 font-mono",children:p||i.jsx("span",{className:"text-zinc-500 italic",children:e("spoolbuddy.settings.versionPending","Waiting for daemon...")})})]})]}),i.jsxs("div",{className:"bg-zinc-800 rounded-lg p-4 space-y-3",children:[i.jsxs("button",{onClick:m,disabled:n,className:"w-full px-4 py-2.5 rounded-lg text-sm font-medium bg-zinc-700 text-zinc-200 hover:bg-zinc-600 disabled:opacity-40 transition-colors min-h-[44px] flex items-center justify-center gap-2",children:[n&&i.jsxs("svg",{className:"w-4 h-4 animate-spin",viewBox:"0 0 24 24",fill:"none",children:[i.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),i.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),n?e("spoolbuddy.settings.checking","Checking..."):e("spoolbuddy.settings.checkUpdates","Check for Updates")]}),o&&i.jsx("div",{className:"rounded-lg p-3 text-sm bg-red-900/30 border border-red-800",children:i.jsx("p",{className:"text-red-300",children:o})}),a&&i.jsx("div",{className:`rounded-lg p-3 text-sm ${a.update_available?"bg-green-900/30 border border-green-800":"bg-zinc-700/50"}`,children:a.update_available?i.jsxs("div",{className:"space-y-1",children:[i.jsxs("p",{className:"text-green-300 font-medium",children:[e("spoolbuddy.settings.updateAvailable","Update available"),": v",a.latest_version]}),i.jsx("p",{className:"text-xs text-zinc-400",children:e("spoolbuddy.settings.updateInstructions","Update via SSH: run the SpoolBuddy install script to upgrade.")})]}):i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("svg",{className:"w-4 h-4 text-green-400 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),i.jsx("p",{className:"text-zinc-300",children:e("spoolbuddy.settings.upToDate","Up to date")})]})}),i.jsxs("div",{className:"flex items-center justify-between pt-1",children:[i.jsx("span",{className:"text-xs text-zinc-500",children:e("spoolbuddy.settings.includeBeta","Include beta versions")}),i.jsx("button",{onClick:u,className:`relative w-10 h-5 rounded-full transition-colors ${c?"bg-green-600":"bg-zinc-600"}`,children:i.jsx("div",{className:`absolute top-0.5 w-4 h-4 bg-white rounded-full transition-transform ${c?"translate-x-5":"translate-x-0.5"}`})})]})]})]})}function Wtt(){const{sbState:t,setDisplayBrightness:e,setDisplayBlankTimeout:n}=A0(),{t:r}=Mt(),[a,s]=w.useState("device"),{data:o=[]}=Je({queryKey:["spoolbuddy-devices"],queryFn:()=>gs.getDevices(),refetchInterval:1e4}),l=t.deviceId?o.find(d=>d.device_id===t.deviceId)??o[0]:o[0],c=[{id:"device",label:r("spoolbuddy.settings.tabDevice","Device")},{id:"display",label:r("spoolbuddy.settings.tabDisplay","Display")},{id:"scale",label:r("spoolbuddy.settings.tabScale","Scale")},{id:"updates",label:r("spoolbuddy.settings.tabUpdates","Updates")}];return i.jsxs("div",{className:"h-full flex flex-col p-4",children:[i.jsx("h1",{className:"text-xl font-semibold text-zinc-100 mb-3",children:r("spoolbuddy.nav.settings","Settings")}),i.jsx("div",{className:"flex gap-1 bg-zinc-800/50 rounded-lg p-1 mb-4",children:c.map(d=>i.jsx("button",{onClick:()=>s(d.id),className:`flex-1 px-2 py-2 rounded-md text-sm font-medium transition-colors min-h-[36px] ${a===d.id?"bg-zinc-700 text-zinc-100":"text-zinc-500 hover:text-zinc-300"}`,children:d.label},d.id))}),i.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto",children:l?i.jsxs(i.Fragment,{children:[a==="device"&&i.jsx(Htt,{device:l}),a==="display"&&i.jsx($tt,{device:l,onBrightnessChange:e,onBlankTimeoutChange:n}),a==="scale"&&i.jsx(Vtt,{device:l,weight:t.weight,weightStable:t.weightStable,rawAdc:t.rawAdc}),a==="updates"&&i.jsx(Gtt,{device:l})]}):i.jsx("div",{className:"flex items-center justify-center h-32",children:i.jsx("div",{className:"text-center text-zinc-500",children:i.jsx("p",{className:"text-sm",children:r("spoolbuddy.settings.noDevice","No SpoolBuddy device found")})})})})]})}function Ktt({device:t,weight:e,weightStable:n,rawAdc:r}){const{t:a}=Mt(),[s,o]=w.useState(!1),[l,c]=w.useState("idle"),[d,u]=w.useState("500"),[m,p]=w.useState(null),[f,y]=w.useState(!1),x=k=>{k==="backspace"?u(P=>P.slice(0,-1)||""):k==="."&&!d.includes(".")?u(P=>P+"."):k>="0"&&k<="9"&&u(P=>P==="0"?k:P+k)},b=async()=>{y(!0);try{await gs.tare(t.device_id)}catch(k){console.error("Failed to tare:",k)}finally{y(!1)}},v=()=>{c("tare")},_=async()=>{if(l==="tare"){o(!0);try{p(r),await gs.tare(t.device_id),c("weight")}catch(k){console.error("Failed to tare:",k)}finally{o(!1)}}else if(l==="weight"){const k=parseFloat(d);if(r===null||!k||k<=0)return;o(!0);try{await gs.setCalibrationFactor(t.device_id,k,r,m??void 0),c("idle")}catch(P){console.error("Failed to calibrate:",P)}finally{o(!1)}}};return i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"bg-zinc-800 rounded-lg p-4",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("span",{className:"text-sm text-zinc-400",children:a("spoolbuddy.settings.currentWeight","Current weight")}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("div",{className:`w-2 h-2 rounded-full ${n?"bg-green-500":"bg-amber-500 animate-pulse"}`}),i.jsx("span",{className:"text-lg font-mono text-zinc-200",children:e!==null?`${e.toFixed(1)} g`:"-- g"})]})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-4 mt-3 text-xs",children:[i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-zinc-500",children:a("spoolbuddy.settings.tareOffset","Tare offset")}),i.jsx("span",{className:"text-zinc-400 font-mono",children:t.tare_offset})]}),i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{className:"text-zinc-500",children:a("spoolbuddy.settings.calFactor","Cal. factor")}),i.jsx("span",{className:"text-zinc-400 font-mono",children:t.calibration_factor.toFixed(2)})]})]})]}),l==="idle"?i.jsxs("div",{className:"flex gap-2",children:[i.jsx("button",{onClick:b,disabled:f,className:"flex-1 px-4 py-2.5 rounded-lg text-sm font-medium bg-zinc-700 text-zinc-200 hover:bg-zinc-600 disabled:opacity-40 transition-colors min-h-[44px]",children:f?"...":a("spoolbuddy.weight.tare","Tare")}),i.jsx("button",{onClick:v,className:"flex-1 px-4 py-2.5 rounded-lg text-sm font-medium bg-green-600 text-white hover:bg-green-700 transition-colors min-h-[44px]",children:a("spoolbuddy.weight.calibrate","Calibrate")})]}):i.jsxs("div",{className:"bg-zinc-800 border border-zinc-700 rounded-lg p-3 space-y-2",children:[i.jsx("div",{className:"text-sm font-medium text-zinc-200",children:l==="tare"?a("spoolbuddy.settings.calStep1","Step 1: Remove all items from the scale"):a("spoolbuddy.settings.calStep2","Step 2: Place known weight on scale")}),l==="weight"&&i.jsxs("div",{className:"space-y-1.5",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"text-xs text-zinc-400",children:a("spoolbuddy.settings.knownWeight","Known weight (g)")}),i.jsxs("div",{className:"flex-1 bg-zinc-900 border border-zinc-600 rounded px-3 py-1.5 text-right text-base font-mono text-zinc-100",children:[d||"0",i.jsx("span",{className:"text-zinc-500 ml-1",children:"g"})]})]}),i.jsx("div",{className:"grid grid-cols-4 gap-1",children:["7","8","9","backspace","4","5","6",".","1","2","3","0"].map(k=>i.jsx("button",{onClick:()=>x(k),className:`py-2 rounded text-sm font-medium transition-colors min-h-[36px] ${k==="backspace"?"bg-zinc-700 text-zinc-300 hover:bg-zinc-600":"bg-zinc-800 text-zinc-100 hover:bg-zinc-700 border border-zinc-700"}`,children:k==="backspace"?"⌫":k},k))})]}),i.jsxs("div",{className:"flex gap-2",children:[i.jsx("button",{onClick:()=>c("idle"),className:"flex-1 px-4 py-2 rounded-lg text-sm bg-zinc-700 text-zinc-300 hover:bg-zinc-600 transition-colors min-h-[40px]",children:a("common.cancel","Cancel")}),i.jsx("button",{onClick:_,disabled:s,className:"flex-1 px-4 py-2 rounded-lg text-sm font-medium bg-green-600 text-white hover:bg-green-700 disabled:opacity-40 transition-colors min-h-[40px]",children:s?"...":l==="tare"?a("spoolbuddy.settings.setZero","Set Zero"):a("spoolbuddy.settings.calibrateNow","Calibrate")})]})]})]})}function Ytt(){const{sbState:t}=A0(),{t:e}=Mt(),n=Ml(),{data:r=[]}=Je({queryKey:["spoolbuddy-devices"],queryFn:()=>gs.getDevices(),refetchInterval:1e4}),a=t.deviceId?r.find(s=>s.device_id===t.deviceId)??r[0]:r[0];return i.jsxs("div",{className:"h-full flex flex-col p-4",children:[i.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[i.jsx("button",{onClick:()=>n("/spoolbuddy/settings"),className:"p-1.5 rounded-lg text-zinc-400 hover:text-zinc-200 hover:bg-zinc-800 transition-colors",children:i.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 19l-7-7 7-7"})})}),i.jsx("h1",{className:"text-xl font-semibold text-zinc-100",children:e("spoolbuddy.settings.scaleCalibration","Scale Calibration")})]}),i.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto",children:a?i.jsx(Ktt,{device:a,weight:t.weight,weightStable:t.weightStable,rawAdc:t.rawAdc}):i.jsx("div",{className:"flex items-center justify-center h-32",children:i.jsx("div",{className:"text-center text-zinc-500",children:i.jsx("p",{className:"text-sm",children:e("spoolbuddy.settings.noDevice","No SpoolBuddy device found")})})})})]})}const Xtt=["PLA","PETG","ABS","ASA","TPU","PA","PC","PVA","HIPS"];function Qtt(){const{t}=Mt(),{sbState:e}=A0(),[n,r]=w.useState("existing"),[a,s]=w.useState(null),[o,l]=w.useState(""),[c,d]=w.useState("idle"),[u,m]=w.useState(""),[p,f]=w.useState(!1),[y,x]=w.useState(null),[b,v]=w.useState("PLA"),[_,k]=w.useState(""),[P,C]=w.useState("#00AE42"),[T,N]=w.useState(""),[R,A]=w.useState(1e3),[D,$]=w.useState(!1),{data:U=[],refetch:G}=Je({queryKey:["inventory-spools"],queryFn:()=>be.getSpools(!1),refetchInterval:1e4}),{data:L=[]}=Je({queryKey:["spoolbuddy-devices"],queryFn:()=>gs.getDevices(),refetchInterval:5e3}),te=L[0],re=e.deviceOnline,J=w.useMemo(()=>{let Z;if(n==="existing")Z=U.filter(j=>!j.tag_uid&&!j.archived_at);else if(n==="replace")Z=U.filter(j=>j.tag_uid&&!j.archived_at);else return[];if(o){const j=o.toLowerCase();Z=Z.filter(E=>E.material?.toLowerCase().includes(j)||E.color_name?.toLowerCase().includes(j)||E.brand?.toLowerCase().includes(j)||E.subtype?.toLowerCase().includes(j))}return Z},[U,n,o]),ue=w.useCallback(Z=>{const j=Z.detail;(j.sak??j.data?.sak)===0&&(f(!0),x(j.tag_uid??j.data?.tag_uid??null))},[]),me=w.useCallback(Z=>{const j=Z.detail;f(!0),x(j.tag_uid??j.data?.tag_uid??null)},[]),ge=w.useCallback(()=>{f(!1),x(null)},[]),X=w.useCallback(Z=>{const j=Z.detail;(j.spool_id===a?.id||j.data?.spool_id===a?.id)&&(d("success"),m(t("spoolbuddy.writeTag.writeSuccess","Tag written successfully!")),G(),setTimeout(()=>{d("idle"),s(null),m("")},5e3))},[a,t,G]),ie=w.useCallback(Z=>{const j=Z.detail;(j.spool_id===a?.id||j.data?.spool_id===a?.id)&&(d("error"),m(j.message??j.data?.message??t("spoolbuddy.writeTag.writeFailed","Write failed")))},[a,t]);w.useEffect(()=>(window.addEventListener("spoolbuddy-unknown-tag",ue),window.addEventListener("spoolbuddy-tag-matched",me),window.addEventListener("spoolbuddy-tag-removed",ge),window.addEventListener("spoolbuddy-tag-written",X),window.addEventListener("spoolbuddy-tag-write-failed",ie),()=>{window.removeEventListener("spoolbuddy-unknown-tag",ue),window.removeEventListener("spoolbuddy-tag-matched",me),window.removeEventListener("spoolbuddy-tag-removed",ge),window.removeEventListener("spoolbuddy-tag-written",X),window.removeEventListener("spoolbuddy-tag-write-failed",ie)}),[ue,me,ge,X,ie]),w.useEffect(()=>{s(null),d("idle"),m(""),l("")},[n]);const le=async()=>{if(!(!a||!te)){d("writing"),m(t("spoolbuddy.writeTag.waiting","Waiting for SpoolBuddy..."));try{await gs.writeTag(te.device_id,a.id)}catch{d("error"),m(t("spoolbuddy.writeTag.queueFailed","Failed to queue write command"))}}},pe=async()=>{if(te){try{await gs.cancelWrite(te.device_id)}catch{}d("idle"),m("")}},Ce=async()=>{$(!0);try{const Z=P.replace("#","")+"FF",j=await be.createSpool({material:b,subtype:null,color_name:_||null,rgba:Z,brand:T||null,label_weight:R,core_weight:250,core_weight_catalog_id:null,weight_used:0,slicer_filament:null,slicer_filament_name:null,nozzle_temp_min:null,nozzle_temp_max:null,note:null,added_full:!0,last_used:null,encode_time:null,tag_uid:null,tray_uuid:null,data_origin:null,tag_type:null,cost_per_kg:null,last_scale_weight:null,last_weighed_at:null});s(j),G()}catch{m(t("spoolbuddy.writeTag.createFailed","Failed to create spool")),d("error")}finally{$(!1)}},q=a&&re&&c!=="writing"&&c!=="success";return i.jsxs("div",{className:"flex flex-col h-full",children:[i.jsx("div",{className:"flex border-b border-bambu-dark-tertiary shrink-0",children:[{key:"existing",label:t("spoolbuddy.writeTag.tabExisting","Existing Spool")},{key:"new",label:t("spoolbuddy.writeTag.tabNew","New Spool")},{key:"replace",label:t("spoolbuddy.writeTag.tabReplace","Replace Tag")}].map(Z=>i.jsx("button",{onClick:()=>r(Z.key),className:`flex-1 py-3 text-sm font-medium transition-colors ${n===Z.key?"text-bambu-green border-b-2 border-bambu-green bg-bambu-dark":"text-zinc-400 hover:text-zinc-200 hover:bg-bambu-dark-tertiary"}`,children:Z.label},Z.key))}),i.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[i.jsx("div",{className:"flex-1 flex flex-col overflow-hidden border-r border-bambu-dark-tertiary",children:n==="new"?i.jsx(Jtt,{material:b,setMaterial:v,colorName:_,setColorName:k,colorHex:P,setColorHex:C,brand:T,setBrand:N,weight:R,setWeight:A,creating:D,onSubmit:Ce,selectedSpool:a,t}):i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"p-3 shrink-0",children:i.jsx("input",{type:"text",value:o,onChange:Z=>l(Z.target.value),placeholder:t("spoolbuddy.writeTag.searchPlaceholder","Search by material, color, brand..."),className:"w-full px-3 py-2 bg-bambu-dark-tertiary border border-bambu-dark-tertiary rounded text-sm text-white placeholder-zinc-500 focus:outline-none focus:border-bambu-green"})}),i.jsx("div",{className:"flex-1 overflow-y-auto px-3 pb-3 space-y-2",children:J.length===0?i.jsx("div",{className:"text-center text-zinc-500 py-8 text-sm",children:n==="existing"?t("spoolbuddy.writeTag.noUntaggedSpools","No spools without tags"):t("spoolbuddy.writeTag.noTaggedSpools","No spools with tags")}):J.map(Z=>i.jsx(Ztt,{spool:Z,selected:a?.id===Z.id,showTag:n==="replace",onClick:()=>{s(Z),d("idle"),m("")}},Z.id))})]})}),i.jsx("div",{className:"w-[340px] flex flex-col items-center justify-center p-6 shrink-0",children:i.jsx(ent,{writeStatus:c,writeMessage:u,selectedSpool:a,tagOnReader:p,tagUid:y,deviceOnline:re,canWrite:!!q,isReplace:n==="replace",onWrite:le,onCancel:pe,onRetry:()=>{d("idle"),m("")},t})})]})]})}function Ztt({spool:t,selected:e,showTag:n,onClick:r}){const a=t.rgba?`#${t.rgba.slice(0,6)}`:"#666",s=Math.max(0,t.label_weight-t.weight_used),o=t.label_weight>0?Math.round(s/t.label_weight*100):0;return i.jsxs("button",{onClick:r,className:`w-full flex items-center gap-3 p-3 rounded-lg text-left transition-colors ${e?"bg-bambu-green/15 border border-bambu-green/50":"bg-bambu-dark-secondary hover:bg-bambu-dark-tertiary border border-transparent"}`,children:[i.jsx("div",{className:"w-8 h-8 rounded-full shrink-0 border border-white/10",style:{backgroundColor:a}}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsx("div",{className:"flex items-center gap-2",children:i.jsxs("span",{className:"text-sm font-medium text-white truncate",children:[t.brand?`${t.brand} `:"",t.material,t.subtype?` ${t.subtype}`:""]})}),i.jsxs("div",{className:"flex items-center gap-2 text-xs text-zinc-400",children:[t.color_name&&i.jsx("span",{children:t.color_name}),i.jsxs("span",{children:[s,"g / ",t.label_weight,"g (",o,"%)"]})]}),n&&t.tag_uid&&i.jsx("div",{className:"text-xs text-zinc-500 mt-0.5 font-mono",children:t.tag_uid})]}),e&&i.jsx("svg",{className:"w-5 h-5 text-bambu-green shrink-0",fill:"currentColor",viewBox:"0 0 20 20",children:i.jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})})]})}function Jtt({material:t,setMaterial:e,colorName:n,setColorName:r,colorHex:a,setColorHex:s,brand:o,setBrand:l,weight:c,setWeight:d,creating:u,onSubmit:m,selectedSpool:p,t:f}){return p?i.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-6 text-center",children:[i.jsx("div",{className:"w-12 h-12 rounded-full mb-4 border border-white/10",style:{backgroundColor:p.rgba?`#${p.rgba.slice(0,6)}`:"#666"}}),i.jsxs("p",{className:"text-white font-medium",children:[p.brand?`${p.brand} `:"",p.material]}),p.color_name&&i.jsx("p",{className:"text-zinc-400 text-sm",children:p.color_name}),i.jsxs("p",{className:"text-zinc-500 text-xs mt-1",children:[p.label_weight,"g"]}),i.jsx("p",{className:"text-bambu-green text-sm mt-4",children:f("spoolbuddy.writeTag.spoolCreated","Spool created! Ready to write.")})]}):i.jsxs("div",{className:"p-4 space-y-4 overflow-y-auto",children:[i.jsxs("div",{children:[i.jsx("label",{className:"block text-xs text-zinc-400 mb-1",children:f("spoolbuddy.writeTag.material","Material")}),i.jsx("select",{value:t,onChange:y=>e(y.target.value),className:"w-full px-3 py-2 bg-bambu-dark-tertiary border border-bambu-dark-tertiary rounded text-sm text-white focus:outline-none focus:border-bambu-green",children:Xtt.map(y=>i.jsx("option",{value:y,children:y},y))})]}),i.jsxs("div",{className:"flex gap-3",children:[i.jsxs("div",{className:"flex-1",children:[i.jsx("label",{className:"block text-xs text-zinc-400 mb-1",children:f("spoolbuddy.writeTag.colorName","Color Name")}),i.jsx("input",{type:"text",value:n,onChange:y=>r(y.target.value),placeholder:"Jade White",className:"w-full px-3 py-2 bg-bambu-dark-tertiary border border-bambu-dark-tertiary rounded text-sm text-white placeholder-zinc-500 focus:outline-none focus:border-bambu-green"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-xs text-zinc-400 mb-1",children:f("spoolbuddy.writeTag.color","Color")}),i.jsx("input",{type:"color",value:a,onChange:y=>s(y.target.value),className:"w-10 h-9 bg-transparent border border-bambu-dark-tertiary rounded cursor-pointer"})]})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-xs text-zinc-400 mb-1",children:f("spoolbuddy.writeTag.brand","Brand")}),i.jsx("input",{type:"text",value:o,onChange:y=>l(y.target.value),placeholder:"Polymaker",className:"w-full px-3 py-2 bg-bambu-dark-tertiary border border-bambu-dark-tertiary rounded text-sm text-white placeholder-zinc-500 focus:outline-none focus:border-bambu-green"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-xs text-zinc-400 mb-1",children:f("spoolbuddy.writeTag.weight","Weight (g)")}),i.jsx("input",{type:"number",value:c,onChange:y=>d(parseInt(y.target.value)||0),min:0,max:1e4,className:"w-full px-3 py-2 bg-bambu-dark-tertiary border border-bambu-dark-tertiary rounded text-sm text-white focus:outline-none focus:border-bambu-green"})]}),i.jsx("button",{onClick:m,disabled:u||!t,className:"w-full py-2.5 bg-bambu-green hover:bg-bambu-green/80 disabled:opacity-50 disabled:cursor-not-allowed text-white text-sm font-medium rounded transition-colors",children:u?f("spoolbuddy.writeTag.creating","Creating..."):f("spoolbuddy.writeTag.createSpool","Create Spool")})]})}function ent({writeStatus:t,writeMessage:e,selectedSpool:n,tagOnReader:r,tagUid:a,deviceOnline:s,canWrite:o,isReplace:l,onWrite:c,onCancel:d,onRetry:u,t:m}){if(t==="success")return i.jsxs("div",{className:"flex flex-col items-center text-center space-y-4",children:[i.jsx("div",{className:"w-16 h-16 rounded-full bg-green-500/20 flex items-center justify-center",children:i.jsx("svg",{className:"w-8 h-8 text-green-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}),i.jsx("p",{className:"text-green-400 font-medium",children:e}),n&&i.jsxs("p",{className:"text-zinc-400 text-sm",children:[n.brand?`${n.brand} `:"",n.material,n.color_name?` - ${n.color_name}`:""]})]});if(t==="error")return i.jsxs("div",{className:"flex flex-col items-center text-center space-y-4",children:[i.jsx("div",{className:"w-16 h-16 rounded-full bg-red-500/20 flex items-center justify-center",children:i.jsx("svg",{className:"w-8 h-8 text-red-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}),i.jsx("p",{className:"text-red-400 font-medium",children:e}),i.jsx("button",{onClick:u,className:"px-4 py-2 bg-bambu-dark-tertiary hover:bg-bambu-dark-secondary text-white text-sm rounded transition-colors",children:m("spoolbuddy.writeTag.tryAgain","Try Again")})]});if(t==="writing")return i.jsxs("div",{className:"flex flex-col items-center text-center space-y-4",children:[i.jsxs("div",{className:"relative w-16 h-16",children:[i.jsx("div",{className:"absolute inset-0 rounded-full border-2 border-bambu-green/30 animate-ping"}),i.jsx("div",{className:"absolute inset-2 rounded-full border-2 border-bambu-green/50 animate-pulse"}),i.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:i.jsx(qy,{className:"w-8 h-8 text-bambu-green"})})]}),i.jsx("p",{className:"text-bambu-green font-medium",children:m("spoolbuddy.writeTag.writing","Writing tag...")}),i.jsx("p",{className:"text-zinc-500 text-xs",children:e}),i.jsx("button",{onClick:d,className:"px-4 py-2 bg-bambu-dark-tertiary hover:bg-bambu-dark-secondary text-zinc-400 text-sm rounded transition-colors",children:m("spoolbuddy.writeTag.cancel","Cancel")})]});if(!s)return i.jsxs("div",{className:"flex flex-col items-center text-center space-y-3",children:[i.jsx(qy,{className:"w-12 h-12 text-zinc-600"}),i.jsx("p",{className:"text-zinc-500 text-sm",children:m("spoolbuddy.writeTag.deviceOffline","SpoolBuddy is offline")})]});if(!n)return i.jsxs("div",{className:"flex flex-col items-center text-center space-y-3",children:[i.jsx(qy,{className:"w-12 h-12 text-zinc-600"}),i.jsx("p",{className:"text-zinc-400 text-sm",children:m("spoolbuddy.writeTag.selectSpool","Select a spool, then place a blank NTAG on the reader")})]});const p=n.rgba?`#${n.rgba.slice(0,6)}`:"#666";return i.jsxs("div",{className:"flex flex-col items-center text-center space-y-4 w-full",children:[i.jsx("div",{className:"relative w-16 h-16",children:r?i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"absolute inset-0 rounded-full bg-bambu-green/10"}),i.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:i.jsx(qy,{className:"w-8 h-8 text-bambu-green"})})]}):i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"absolute inset-0 rounded-full border-2 border-zinc-600 animate-pulse"}),i.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:i.jsx(qy,{className:"w-8 h-8 text-zinc-500"})})]})}),r?i.jsxs("div",{className:"space-y-1",children:[i.jsx("p",{className:"text-bambu-green text-sm font-medium",children:m("spoolbuddy.writeTag.tagReady","Tag detected — ready to write")}),a&&i.jsx("p",{className:"text-zinc-500 text-xs font-mono",children:a})]}):i.jsx("p",{className:"text-zinc-400 text-sm",children:m("spoolbuddy.writeTag.placeTag","Place an NTAG on the reader")}),i.jsxs("div",{className:"w-full bg-bambu-dark-secondary rounded-lg p-3 space-y-2",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"w-8 h-8 rounded-full border border-white/10 shrink-0",style:{backgroundColor:p}}),i.jsxs("div",{className:"text-left min-w-0",children:[i.jsxs("p",{className:"text-white text-sm font-medium truncate",children:[n.brand?`${n.brand} `:"",n.material]}),n.color_name&&i.jsx("p",{className:"text-zinc-400 text-xs",children:n.color_name})]})]}),i.jsxs("div",{className:"text-xs text-zinc-500",children:[n.label_weight,"g"]})]}),l&&n.tag_uid&&i.jsx("p",{className:"text-yellow-500/80 text-xs",children:m("spoolbuddy.writeTag.replaceWarning","Old tag will be unlinked. New tag will replace it.")}),i.jsx("button",{onClick:c,disabled:!o,className:"w-full py-3 bg-bambu-green hover:bg-bambu-green/80 disabled:opacity-40 disabled:cursor-not-allowed text-white font-medium rounded-lg transition-colors text-sm",children:l?m("spoolbuddy.writeTag.replaceTag","Replace Tag"):m("spoolbuddy.writeTag.writeTag","Write Tag")})]})}function qy({className:t}){return i.jsxs("svg",{className:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,children:[i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8.288 15.038a5.25 5.25 0 017.424 0M5.106 11.856c3.807-3.808 9.98-3.808 13.788 0M1.924 8.674c5.565-5.565 14.587-5.565 20.152 0"}),i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12.53 18.22l-.53.53-.53-.53a.75.75 0 011.06 0z"})]})}const tnt=new sme({defaultOptions:{queries:{staleTime:1e3*60,retry:1}}});function VK({children:t}){return ntt(),i.jsx(i.Fragment,{children:t})}function GK({children:t}){const{authEnabled:e,loading:n,user:r}=Rr();return n?i.jsx("div",{className:"min-h-screen flex items-center justify-center",children:"Loading..."}):e&&!r?i.jsx(Tb,{to:"/login",replace:!0}):i.jsx(i.Fragment,{children:t})}function oD({children:t}){const{authEnabled:e,loading:n,user:r,isAdmin:a}=Rr();return n?i.jsx("div",{className:"min-h-screen flex items-center justify-center",children:"Loading..."}):e?r?a?i.jsx(i.Fragment,{children:t}):i.jsx(Tb,{to:"/",replace:!0}):i.jsx(Tb,{to:"/login",replace:!0}):i.jsx(i.Fragment,{children:t})}function nnt({children:t}){const{authEnabled:e,loading:n}=Rr();return n?i.jsx("div",{className:"min-h-screen flex items-center justify-center",children:"Loading..."}):e?i.jsx(Tb,{to:"/login",replace:!0}):i.jsx(i.Fragment,{children:t})}function rnt(){return i.jsx(tbe,{children:i.jsx(cbe,{children:i.jsx(ome,{client:tnt,children:i.jsx(obe,{children:i.jsx(Cue,{children:i.jsxs(tue,{children:[i.jsx(Mr,{path:"/setup",element:i.jsx(nnt,{children:i.jsx(ttt,{})})}),i.jsx(Mr,{path:"/login",element:i.jsx(ett,{})}),i.jsx(Mr,{path:"/camera/:printerId",element:i.jsx(uet,{})}),i.jsx(Mr,{path:"/overlay/:printerId",element:i.jsx(fet,{})}),i.jsxs(Mr,{element:i.jsx(GK,{children:i.jsx(VK,{children:i.jsx(gtt,{})})}),children:[i.jsx(Mr,{path:"spoolbuddy",element:i.jsx(Ftt,{})}),i.jsx(Mr,{path:"spoolbuddy/ams",element:i.jsx(Itt,{})}),i.jsx(Mr,{path:"spoolbuddy/write-tag",element:i.jsx(Qtt,{})}),i.jsx(Mr,{path:"spoolbuddy/settings",element:i.jsx(Wtt,{})}),i.jsx(Mr,{path:"spoolbuddy/calibration",element:i.jsx(Ytt,{})})]}),i.jsxs(Mr,{element:i.jsx(GK,{children:i.jsx(VK,{children:i.jsx(_be,{})})}),children:[i.jsx(Mr,{index:!0,element:i.jsx(Nqe,{})}),i.jsx(Mr,{path:"archives",element:i.jsx(XXe,{})}),i.jsx(Mr,{path:"queue",element:i.jsx(RZe,{})}),i.jsx(Mr,{path:"stats",element:i.jsx(ZZe,{})}),i.jsx(Mr,{path:"profiles",element:i.jsx(HJe,{})}),i.jsx(Mr,{path:"maintenance",element:i.jsx(WJe,{})}),i.jsx(Mr,{path:"projects",element:i.jsx(YJe,{})}),i.jsx(Mr,{path:"projects/:id",element:i.jsx(eet,{})}),i.jsx(Mr,{path:"inventory",element:i.jsx(Get,{})}),i.jsx(Mr,{path:"files",element:i.jsx(set,{})}),i.jsx(Mr,{path:"settings",element:i.jsx(oD,{children:i.jsx(PJe,{})})}),i.jsx(Mr,{path:"groups/new",element:i.jsx(oD,{children:i.jsx(DK,{})})}),i.jsx(Mr,{path:"groups/:id/edit",element:i.jsx(oD,{children:i.jsx(DK,{})})}),i.jsx(Mr,{path:"users",element:i.jsx(Tb,{to:"/settings?tab=users",replace:!0})}),i.jsx(Mr,{path:"groups",element:i.jsx(Tb,{to:"/settings?tab=users",replace:!0})}),i.jsx(Mr,{path:"system",element:i.jsx(Jet,{})}),i.jsx(Mr,{path:"external/:id",element:i.jsx(get,{})})]})]})})})})})})}Xle.createRoot(document.getElementById("root")).render(i.jsx(w.StrictMode,{children:i.jsx(rnt,{})}));
|