@tresjs_cientos.js 534 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706
  1. import {
  2. $,
  3. L,
  4. dt,
  5. j
  6. } from "./chunk-ZUTZQNJG.js";
  7. import {
  8. AmbientLight,
  9. AnimationClip,
  10. AnimationMixer,
  11. Bone,
  12. Box3,
  13. BoxGeometry,
  14. BufferAttribute,
  15. BufferGeometry,
  16. ClampToEdgeWrapping,
  17. Color,
  18. CubeReflectionMapping,
  19. CubeTextureLoader,
  20. Curve,
  21. CylinderGeometry,
  22. DataTextureLoader,
  23. DataUtils,
  24. DirectionalLight,
  25. DoubleSide,
  26. EquirectangularReflectionMapping,
  27. Euler,
  28. EventDispatcher,
  29. ExtrudeGeometry,
  30. FileLoader,
  31. Float32BufferAttribute,
  32. FloatType,
  33. FrontSide,
  34. Group,
  35. HalfFloatType,
  36. ImageBitmapLoader,
  37. InterleavedBuffer,
  38. InterleavedBufferAttribute,
  39. Interpolant,
  40. InterpolateDiscrete,
  41. InterpolateLinear,
  42. Line,
  43. LineBasicMaterial,
  44. LineLoop,
  45. LineSegments,
  46. LinearEncoding,
  47. LinearFilter,
  48. LinearMipmapLinearFilter,
  49. LinearMipmapNearestFilter,
  50. Loader,
  51. LoaderUtils,
  52. MOUSE,
  53. Material,
  54. MathUtils,
  55. Matrix3,
  56. Matrix4,
  57. Mesh,
  58. MeshBasicMaterial,
  59. MeshLambertMaterial,
  60. MeshPhongMaterial,
  61. MeshPhysicalMaterial,
  62. MeshStandardMaterial,
  63. MirroredRepeatWrapping,
  64. NearestFilter,
  65. NearestMipmapLinearFilter,
  66. NearestMipmapNearestFilter,
  67. NumberKeyframeTrack,
  68. Object3D,
  69. OctahedronGeometry,
  70. OrthographicCamera,
  71. PerspectiveCamera,
  72. PlaneGeometry,
  73. PointLight,
  74. Points,
  75. PointsMaterial,
  76. PropertyBinding,
  77. QuadraticBezierCurve3,
  78. Quaternion,
  79. QuaternionKeyframeTrack,
  80. Raycaster,
  81. RepeatWrapping,
  82. ShapePath,
  83. Skeleton,
  84. SkinnedMesh,
  85. Sphere,
  86. SphereGeometry,
  87. Spherical,
  88. SpotLight,
  89. TOUCH,
  90. TangentSpaceNormalMap,
  91. Texture,
  92. TextureLoader,
  93. TorusGeometry,
  94. TriangleFanDrawMode,
  95. TriangleStripDrawMode,
  96. Uint16BufferAttribute,
  97. Vector2,
  98. Vector3,
  99. Vector4,
  100. VectorKeyframeTrack,
  101. sRGBEncoding
  102. } from "./chunk-UMTEG5DH.js";
  103. import {
  104. computed,
  105. createBaseVNode,
  106. createCommentVNode,
  107. createElementBlock,
  108. defineComponent,
  109. getCurrentInstance,
  110. getCurrentScope,
  111. inject,
  112. mergeProps,
  113. nextTick,
  114. onMounted,
  115. onScopeDispose,
  116. onUnmounted,
  117. openBlock,
  118. ref,
  119. renderSlot,
  120. shallowReactive,
  121. shallowRef,
  122. unref,
  123. useSlots,
  124. watch,
  125. watchEffect,
  126. withAsyncContext
  127. } from "./chunk-LZPJ5JBW.js";
  128. import "./chunk-JC4IRQUL.js";
  129. // node_modules/.pnpm/@tresjs+cientos@2.0.0-alpha.5_three@0.151.3/node_modules/@tresjs/cientos/dist/trescientos.js
  130. function Np(b, i) {
  131. for (var r = 0; r < i.length; r++) {
  132. const s = i[r];
  133. if (typeof s != "string" && !Array.isArray(s)) {
  134. for (const a in s)
  135. if (a !== "default" && !(a in b)) {
  136. const c = Object.getOwnPropertyDescriptor(s, a);
  137. c && Object.defineProperty(b, a, c.get ? c : {
  138. enumerable: true,
  139. get: () => s[a]
  140. });
  141. }
  142. }
  143. }
  144. return Object.freeze(Object.defineProperty(b, Symbol.toStringTag, { value: "Module" }));
  145. }
  146. function Zi(b) {
  147. return Zi = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(i) {
  148. return typeof i;
  149. } : function(i) {
  150. return i && typeof Symbol == "function" && i.constructor === Symbol && i !== Symbol.prototype ? "symbol" : typeof i;
  151. }, Zi(b);
  152. }
  153. function Fp(b, i) {
  154. if (Zi(b) !== "object" || b === null)
  155. return b;
  156. var r = b[Symbol.toPrimitive];
  157. if (r !== void 0) {
  158. var s = r.call(b, i || "default");
  159. if (Zi(s) !== "object")
  160. return s;
  161. throw new TypeError("@@toPrimitive must return a primitive value.");
  162. }
  163. return (i === "string" ? String : Number)(b);
  164. }
  165. function Bp(b) {
  166. var i = Fp(b, "string");
  167. return Zi(i) === "symbol" ? i : String(i);
  168. }
  169. function T(b, i, r) {
  170. return i = Bp(i), i in b ? Object.defineProperty(b, i, {
  171. value: r,
  172. enumerable: true,
  173. configurable: true,
  174. writable: true
  175. }) : b[i] = r, b;
  176. }
  177. var ut = Uint8Array;
  178. var rn = Uint16Array;
  179. var oo = Uint32Array;
  180. var ja = new ut([
  181. 0,
  182. 0,
  183. 0,
  184. 0,
  185. 0,
  186. 0,
  187. 0,
  188. 0,
  189. 1,
  190. 1,
  191. 1,
  192. 1,
  193. 2,
  194. 2,
  195. 2,
  196. 2,
  197. 3,
  198. 3,
  199. 3,
  200. 3,
  201. 4,
  202. 4,
  203. 4,
  204. 4,
  205. 5,
  206. 5,
  207. 5,
  208. 5,
  209. 0,
  210. /* unused */
  211. 0,
  212. 0,
  213. /* impossible */
  214. 0
  215. ]);
  216. var za = new ut([
  217. 0,
  218. 0,
  219. 0,
  220. 0,
  221. 1,
  222. 1,
  223. 2,
  224. 2,
  225. 3,
  226. 3,
  227. 4,
  228. 4,
  229. 5,
  230. 5,
  231. 6,
  232. 6,
  233. 7,
  234. 7,
  235. 8,
  236. 8,
  237. 9,
  238. 9,
  239. 10,
  240. 10,
  241. 11,
  242. 11,
  243. 12,
  244. 12,
  245. 13,
  246. 13,
  247. /* unused */
  248. 0,
  249. 0
  250. ]);
  251. var jp = new ut([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]);
  252. var Ua = function(b, i) {
  253. for (var r = new rn(31), s = 0; s < 31; ++s)
  254. r[s] = i += 1 << b[s - 1];
  255. for (var a = new oo(r[30]), s = 1; s < 30; ++s)
  256. for (var c = r[s]; c < r[s + 1]; ++c)
  257. a[c] = c - r[s] << 5 | s;
  258. return [r, a];
  259. };
  260. var Ga = Ua(ja, 2);
  261. var Ha = Ga[0];
  262. var zp = Ga[1];
  263. Ha[28] = 258, zp[258] = 28;
  264. var Up = Ua(za, 0);
  265. var Gp = Up[0];
  266. var ao = new rn(32768);
  267. for (Ce = 0; Ce < 32768; ++Ce) {
  268. tn = (Ce & 43690) >>> 1 | (Ce & 21845) << 1;
  269. tn = (tn & 52428) >>> 2 | (tn & 13107) << 2, tn = (tn & 61680) >>> 4 | (tn & 3855) << 4, ao[Ce] = ((tn & 65280) >>> 8 | (tn & 255) << 8) >>> 1;
  270. }
  271. var tn;
  272. var Ce;
  273. var Xi = function(b, i, r) {
  274. for (var s = b.length, a = 0, c = new rn(i); a < s; ++a)
  275. ++c[b[a] - 1];
  276. var u = new rn(i);
  277. for (a = 0; a < i; ++a)
  278. u[a] = u[a - 1] + c[a - 1] << 1;
  279. var h;
  280. if (r) {
  281. h = new rn(1 << i);
  282. var d = 15 - i;
  283. for (a = 0; a < s; ++a)
  284. if (b[a])
  285. for (var g = a << 4 | b[a], w = i - b[a], _ = u[b[a] - 1]++ << w, y = _ | (1 << w) - 1; _ <= y; ++_)
  286. h[ao[_] >>> d] = g;
  287. } else
  288. for (h = new rn(s), a = 0; a < s; ++a)
  289. b[a] && (h[a] = ao[u[b[a] - 1]++] >>> 15 - b[a]);
  290. return h;
  291. };
  292. var es = new ut(288);
  293. for (Ce = 0; Ce < 144; ++Ce)
  294. es[Ce] = 8;
  295. var Ce;
  296. for (Ce = 144; Ce < 256; ++Ce)
  297. es[Ce] = 9;
  298. var Ce;
  299. for (Ce = 256; Ce < 280; ++Ce)
  300. es[Ce] = 7;
  301. var Ce;
  302. for (Ce = 280; Ce < 288; ++Ce)
  303. es[Ce] = 8;
  304. var Ce;
  305. var Ka = new ut(32);
  306. for (Ce = 0; Ce < 32; ++Ce)
  307. Ka[Ce] = 5;
  308. var Ce;
  309. var Hp = Xi(es, 9, 1);
  310. var Kp = Xi(Ka, 5, 1);
  311. var Yr = function(b) {
  312. for (var i = b[0], r = 1; r < b.length; ++r)
  313. b[r] > i && (i = b[r]);
  314. return i;
  315. };
  316. var _t = function(b, i, r) {
  317. var s = i / 8 | 0;
  318. return (b[s] | b[s + 1] << 8) >> (i & 7) & r;
  319. };
  320. var qr = function(b, i) {
  321. var r = i / 8 | 0;
  322. return (b[r] | b[r + 1] << 8 | b[r + 2] << 16) >> (i & 7);
  323. };
  324. var $p = function(b) {
  325. return (b / 8 | 0) + (b & 7 && 1);
  326. };
  327. var Xp = function(b, i, r) {
  328. (i == null || i < 0) && (i = 0), (r == null || r > b.length) && (r = b.length);
  329. var s = new (b instanceof rn ? rn : b instanceof oo ? oo : ut)(r - i);
  330. return s.set(b.subarray(i, r)), s;
  331. };
  332. var Yp = function(b, i, r) {
  333. var s = b.length;
  334. if (!s || r && !r.l && s < 5)
  335. return i || new ut(0);
  336. var a = !i || r, c = !r || r.i;
  337. r || (r = {}), i || (i = new ut(s * 3));
  338. var u = function(Ve) {
  339. var Ne = i.length;
  340. if (Ve > Ne) {
  341. var we = new ut(Math.max(Ne * 2, Ve));
  342. we.set(i), i = we;
  343. }
  344. }, h = r.f || 0, d = r.p || 0, g = r.b || 0, w = r.l, _ = r.d, y = r.m, C = r.n, I = s * 8;
  345. do {
  346. if (!w) {
  347. r.f = h = _t(b, d, 1);
  348. var S = _t(b, d + 1, 3);
  349. if (d += 3, S)
  350. if (S == 1)
  351. w = Hp, _ = Kp, y = 9, C = 5;
  352. else if (S == 2) {
  353. var V = _t(b, d, 31) + 257, D = _t(b, d + 10, 15) + 4, Y = V + _t(b, d + 5, 31) + 1;
  354. d += 14;
  355. for (var G = new ut(Y), N = new ut(19), O = 0; O < D; ++O)
  356. N[jp[O]] = _t(b, d + O * 3, 7);
  357. d += D * 3;
  358. for (var H = Yr(N), K = (1 << H) - 1, q = Xi(N, H, 1), O = 0; O < Y; ) {
  359. var ue = q[_t(b, d, K)];
  360. d += ue & 15;
  361. var R = ue >>> 4;
  362. if (R < 16)
  363. G[O++] = R;
  364. else {
  365. var ge = 0, ce = 0;
  366. for (R == 16 ? (ce = 3 + _t(b, d, 3), d += 2, ge = G[O - 1]) : R == 17 ? (ce = 3 + _t(b, d, 7), d += 3) : R == 18 && (ce = 11 + _t(b, d, 127), d += 7); ce--; )
  367. G[O++] = ge;
  368. }
  369. }
  370. var me = G.subarray(0, V), he = G.subarray(V);
  371. y = Yr(me), C = Yr(he), w = Xi(me, y, 1), _ = Xi(he, C, 1);
  372. } else
  373. throw "invalid block type";
  374. else {
  375. var R = $p(d) + 4, j2 = b[R - 4] | b[R - 3] << 8, F = R + j2;
  376. if (F > s) {
  377. if (c)
  378. throw "unexpected EOF";
  379. break;
  380. }
  381. a && u(g + j2), i.set(b.subarray(R, F), g), r.b = g += j2, r.p = d = F * 8;
  382. continue;
  383. }
  384. if (d > I) {
  385. if (c)
  386. throw "unexpected EOF";
  387. break;
  388. }
  389. }
  390. a && u(g + 131072);
  391. for (var ee = (1 << y) - 1, X = (1 << C) - 1, Pe = d; ; Pe = d) {
  392. var ge = w[qr(b, d) & ee], fe = ge >>> 4;
  393. if (d += ge & 15, d > I) {
  394. if (c)
  395. throw "unexpected EOF";
  396. break;
  397. }
  398. if (!ge)
  399. throw "invalid length/literal";
  400. if (fe < 256)
  401. i[g++] = fe;
  402. else if (fe == 256) {
  403. Pe = d, w = null;
  404. break;
  405. } else {
  406. var ae = fe - 254;
  407. if (fe > 264) {
  408. var O = fe - 257, ne = ja[O];
  409. ae = _t(b, d, (1 << ne) - 1) + Ha[O], d += ne;
  410. }
  411. var be = _[qr(b, d) & X], M = be >>> 4;
  412. if (!be)
  413. throw "invalid distance";
  414. d += be & 15;
  415. var he = Gp[M];
  416. if (M > 3) {
  417. var ne = za[M];
  418. he += qr(b, d) & (1 << ne) - 1, d += ne;
  419. }
  420. if (d > I) {
  421. if (c)
  422. throw "unexpected EOF";
  423. break;
  424. }
  425. a && u(g + 131072);
  426. for (var le = g + ae; g < le; g += 4)
  427. i[g] = i[g - he], i[g + 1] = i[g + 1 - he], i[g + 2] = i[g + 2 - he], i[g + 3] = i[g + 3 - he];
  428. g = le;
  429. }
  430. }
  431. r.l = w, r.p = Pe, r.b = g, w && (h = 1, r.m = y, r.d = _, r.n = C);
  432. } while (!h);
  433. return g == i.length ? i : Xp(i, 0, g);
  434. };
  435. var qp = new ut(0);
  436. var Qp = function(b) {
  437. if ((b[0] & 15) != 8 || b[0] >>> 4 > 7 || (b[0] << 8 | b[1]) % 31)
  438. throw "invalid zlib data";
  439. if (b[1] & 32)
  440. throw "invalid zlib data: preset dictionaries not supported";
  441. };
  442. function Zp(b, i) {
  443. return Yp((Qp(b), b.subarray(2, -4)), i);
  444. }
  445. var Wp = typeof TextDecoder < "u" && new TextDecoder();
  446. var Jp = 0;
  447. try {
  448. Wp.decode(qp, { stream: true }), Jp = 1;
  449. } catch {
  450. }
  451. var eu = class extends Object3D {
  452. // events
  453. constructor(i, r) {
  454. super(), T(this, "isTransformControls", true), T(this, "visible", false), T(this, "domElement", void 0), T(this, "raycaster", new Raycaster()), T(this, "gizmo", void 0), T(this, "plane", void 0), T(this, "tempVector", new Vector3()), T(this, "tempVector2", new Vector3()), T(this, "tempQuaternion", new Quaternion()), T(this, "unit", {
  455. X: new Vector3(1, 0, 0),
  456. Y: new Vector3(0, 1, 0),
  457. Z: new Vector3(0, 0, 1)
  458. }), T(this, "pointStart", new Vector3()), T(this, "pointEnd", new Vector3()), T(this, "offset", new Vector3()), T(this, "rotationAxis", new Vector3()), T(this, "startNorm", new Vector3()), T(this, "endNorm", new Vector3()), T(this, "rotationAngle", 0), T(this, "cameraPosition", new Vector3()), T(this, "cameraQuaternion", new Quaternion()), T(this, "cameraScale", new Vector3()), T(this, "parentPosition", new Vector3()), T(this, "parentQuaternion", new Quaternion()), T(this, "parentQuaternionInv", new Quaternion()), T(this, "parentScale", new Vector3()), T(this, "worldPositionStart", new Vector3()), T(this, "worldQuaternionStart", new Quaternion()), T(this, "worldScaleStart", new Vector3()), T(this, "worldPosition", new Vector3()), T(this, "worldQuaternion", new Quaternion()), T(this, "worldQuaternionInv", new Quaternion()), T(this, "worldScale", new Vector3()), T(this, "eye", new Vector3()), T(this, "positionStart", new Vector3()), T(this, "quaternionStart", new Quaternion()), T(this, "scaleStart", new Vector3()), T(this, "camera", void 0), T(this, "object", void 0), T(this, "enabled", true), T(this, "axis", null), T(this, "mode", "translate"), T(this, "translationSnap", null), T(this, "rotationSnap", null), T(this, "scaleSnap", null), T(this, "space", "world"), T(this, "size", 1), T(this, "dragging", false), T(this, "showX", true), T(this, "showY", true), T(this, "showZ", true), T(this, "changeEvent", {
  459. type: "change"
  460. }), T(this, "mouseDownEvent", {
  461. type: "mouseDown",
  462. mode: this.mode
  463. }), T(this, "mouseUpEvent", {
  464. type: "mouseUp",
  465. mode: this.mode
  466. }), T(this, "objectChangeEvent", {
  467. type: "objectChange"
  468. }), T(this, "intersectObjectWithRay", (a, c, u) => {
  469. const h = c.intersectObject(a, true);
  470. for (let d = 0; d < h.length; d++)
  471. if (h[d].object.visible || u)
  472. return h[d];
  473. return false;
  474. }), T(this, "attach", (a) => (this.object = a, this.visible = true, this)), T(this, "detach", () => (this.object = void 0, this.visible = false, this.axis = null, this)), T(this, "reset", () => this.enabled ? (this.dragging && this.object !== void 0 && (this.object.position.copy(this.positionStart), this.object.quaternion.copy(this.quaternionStart), this.object.scale.copy(this.scaleStart), this.dispatchEvent(this.changeEvent), this.dispatchEvent(this.objectChangeEvent), this.pointStart.copy(this.pointEnd)), this) : this), T(this, "updateMatrixWorld", () => {
  475. this.object !== void 0 && (this.object.updateMatrixWorld(), this.object.parent === null ? console.error("TransformControls: The attached 3D object must be a part of the scene graph.") : this.object.parent.matrixWorld.decompose(this.parentPosition, this.parentQuaternion, this.parentScale), this.object.matrixWorld.decompose(this.worldPosition, this.worldQuaternion, this.worldScale), this.parentQuaternionInv.copy(this.parentQuaternion).invert(), this.worldQuaternionInv.copy(this.worldQuaternion).invert()), this.camera.updateMatrixWorld(), this.camera.matrixWorld.decompose(this.cameraPosition, this.cameraQuaternion, this.cameraScale), this.eye.copy(this.cameraPosition).sub(this.worldPosition).normalize(), super.updateMatrixWorld();
  476. }), T(this, "pointerHover", (a) => {
  477. if (this.object === void 0 || this.dragging === true)
  478. return;
  479. this.raycaster.setFromCamera(a, this.camera);
  480. const c = this.intersectObjectWithRay(this.gizmo.picker[this.mode], this.raycaster);
  481. c ? this.axis = c.object.name : this.axis = null;
  482. }), T(this, "pointerDown", (a) => {
  483. if (!(this.object === void 0 || this.dragging === true || a.button !== 0) && this.axis !== null) {
  484. this.raycaster.setFromCamera(a, this.camera);
  485. const c = this.intersectObjectWithRay(this.plane, this.raycaster, true);
  486. if (c) {
  487. let u = this.space;
  488. if (this.mode === "scale" ? u = "local" : (this.axis === "E" || this.axis === "XYZE" || this.axis === "XYZ") && (u = "world"), u === "local" && this.mode === "rotate") {
  489. const h = this.rotationSnap;
  490. this.axis === "X" && h && (this.object.rotation.x = Math.round(this.object.rotation.x / h) * h), this.axis === "Y" && h && (this.object.rotation.y = Math.round(this.object.rotation.y / h) * h), this.axis === "Z" && h && (this.object.rotation.z = Math.round(this.object.rotation.z / h) * h);
  491. }
  492. this.object.updateMatrixWorld(), this.object.parent && this.object.parent.updateMatrixWorld(), this.positionStart.copy(this.object.position), this.quaternionStart.copy(this.object.quaternion), this.scaleStart.copy(this.object.scale), this.object.matrixWorld.decompose(this.worldPositionStart, this.worldQuaternionStart, this.worldScaleStart), this.pointStart.copy(c.point).sub(this.worldPositionStart);
  493. }
  494. this.dragging = true, this.mouseDownEvent.mode = this.mode, this.dispatchEvent(this.mouseDownEvent);
  495. }
  496. }), T(this, "pointerMove", (a) => {
  497. const c = this.axis, u = this.mode, h = this.object;
  498. let d = this.space;
  499. if (u === "scale" ? d = "local" : (c === "E" || c === "XYZE" || c === "XYZ") && (d = "world"), h === void 0 || c === null || this.dragging === false || a.button !== -1)
  500. return;
  501. this.raycaster.setFromCamera(a, this.camera);
  502. const g = this.intersectObjectWithRay(this.plane, this.raycaster, true);
  503. if (g) {
  504. if (this.pointEnd.copy(g.point).sub(this.worldPositionStart), u === "translate")
  505. this.offset.copy(this.pointEnd).sub(this.pointStart), d === "local" && c !== "XYZ" && this.offset.applyQuaternion(this.worldQuaternionInv), c.indexOf("X") === -1 && (this.offset.x = 0), c.indexOf("Y") === -1 && (this.offset.y = 0), c.indexOf("Z") === -1 && (this.offset.z = 0), d === "local" && c !== "XYZ" ? this.offset.applyQuaternion(this.quaternionStart).divide(this.parentScale) : this.offset.applyQuaternion(this.parentQuaternionInv).divide(this.parentScale), h.position.copy(this.offset).add(this.positionStart), this.translationSnap && (d === "local" && (h.position.applyQuaternion(this.tempQuaternion.copy(this.quaternionStart).invert()), c.search("X") !== -1 && (h.position.x = Math.round(h.position.x / this.translationSnap) * this.translationSnap), c.search("Y") !== -1 && (h.position.y = Math.round(h.position.y / this.translationSnap) * this.translationSnap), c.search("Z") !== -1 && (h.position.z = Math.round(h.position.z / this.translationSnap) * this.translationSnap), h.position.applyQuaternion(this.quaternionStart)), d === "world" && (h.parent && h.position.add(this.tempVector.setFromMatrixPosition(h.parent.matrixWorld)), c.search("X") !== -1 && (h.position.x = Math.round(h.position.x / this.translationSnap) * this.translationSnap), c.search("Y") !== -1 && (h.position.y = Math.round(h.position.y / this.translationSnap) * this.translationSnap), c.search("Z") !== -1 && (h.position.z = Math.round(h.position.z / this.translationSnap) * this.translationSnap), h.parent && h.position.sub(this.tempVector.setFromMatrixPosition(h.parent.matrixWorld))));
  506. else if (u === "scale") {
  507. if (c.search("XYZ") !== -1) {
  508. let w = this.pointEnd.length() / this.pointStart.length();
  509. this.pointEnd.dot(this.pointStart) < 0 && (w *= -1), this.tempVector2.set(w, w, w);
  510. } else
  511. this.tempVector.copy(this.pointStart), this.tempVector2.copy(this.pointEnd), this.tempVector.applyQuaternion(this.worldQuaternionInv), this.tempVector2.applyQuaternion(this.worldQuaternionInv), this.tempVector2.divide(this.tempVector), c.search("X") === -1 && (this.tempVector2.x = 1), c.search("Y") === -1 && (this.tempVector2.y = 1), c.search("Z") === -1 && (this.tempVector2.z = 1);
  512. h.scale.copy(this.scaleStart).multiply(this.tempVector2), this.scaleSnap && this.object && (c.search("X") !== -1 && (this.object.scale.x = Math.round(h.scale.x / this.scaleSnap) * this.scaleSnap || this.scaleSnap), c.search("Y") !== -1 && (h.scale.y = Math.round(h.scale.y / this.scaleSnap) * this.scaleSnap || this.scaleSnap), c.search("Z") !== -1 && (h.scale.z = Math.round(h.scale.z / this.scaleSnap) * this.scaleSnap || this.scaleSnap));
  513. } else if (u === "rotate") {
  514. this.offset.copy(this.pointEnd).sub(this.pointStart);
  515. const w = 20 / this.worldPosition.distanceTo(this.tempVector.setFromMatrixPosition(this.camera.matrixWorld));
  516. c === "E" ? (this.rotationAxis.copy(this.eye), this.rotationAngle = this.pointEnd.angleTo(this.pointStart), this.startNorm.copy(this.pointStart).normalize(), this.endNorm.copy(this.pointEnd).normalize(), this.rotationAngle *= this.endNorm.cross(this.startNorm).dot(this.eye) < 0 ? 1 : -1) : c === "XYZE" ? (this.rotationAxis.copy(this.offset).cross(this.eye).normalize(), this.rotationAngle = this.offset.dot(this.tempVector.copy(this.rotationAxis).cross(this.eye)) * w) : (c === "X" || c === "Y" || c === "Z") && (this.rotationAxis.copy(this.unit[c]), this.tempVector.copy(this.unit[c]), d === "local" && this.tempVector.applyQuaternion(this.worldQuaternion), this.rotationAngle = this.offset.dot(this.tempVector.cross(this.eye).normalize()) * w), this.rotationSnap && (this.rotationAngle = Math.round(this.rotationAngle / this.rotationSnap) * this.rotationSnap), d === "local" && c !== "E" && c !== "XYZE" ? (h.quaternion.copy(this.quaternionStart), h.quaternion.multiply(this.tempQuaternion.setFromAxisAngle(this.rotationAxis, this.rotationAngle)).normalize()) : (this.rotationAxis.applyQuaternion(this.parentQuaternionInv), h.quaternion.copy(this.tempQuaternion.setFromAxisAngle(this.rotationAxis, this.rotationAngle)), h.quaternion.multiply(this.quaternionStart).normalize());
  517. }
  518. this.dispatchEvent(this.changeEvent), this.dispatchEvent(this.objectChangeEvent);
  519. }
  520. }), T(this, "pointerUp", (a) => {
  521. a.button === 0 && (this.dragging && this.axis !== null && (this.mouseUpEvent.mode = this.mode, this.dispatchEvent(this.mouseUpEvent)), this.dragging = false, this.axis = null);
  522. }), T(this, "getPointer", (a) => {
  523. var c;
  524. if (this.domElement && (c = this.domElement.ownerDocument) !== null && c !== void 0 && c.pointerLockElement)
  525. return {
  526. x: 0,
  527. y: 0,
  528. button: a.button
  529. };
  530. {
  531. var u;
  532. const h = a.changedTouches ? a.changedTouches[0] : a, d = (u = this.domElement) === null || u === void 0 ? void 0 : u.getBoundingClientRect();
  533. return {
  534. x: (h.clientX - d.left) / d.width * 2 - 1,
  535. y: -(h.clientY - d.top) / d.height * 2 + 1,
  536. button: a.button
  537. };
  538. }
  539. }), T(this, "onPointerHover", (a) => {
  540. if (this.enabled)
  541. switch (a.pointerType) {
  542. case "mouse":
  543. case "pen":
  544. this.pointerHover(this.getPointer(a));
  545. break;
  546. }
  547. }), T(this, "onPointerDown", (a) => {
  548. !this.enabled || !this.domElement || (this.domElement.style.touchAction = "none", this.domElement.ownerDocument.addEventListener("pointermove", this.onPointerMove), this.pointerHover(this.getPointer(a)), this.pointerDown(this.getPointer(a)));
  549. }), T(this, "onPointerMove", (a) => {
  550. this.enabled && this.pointerMove(this.getPointer(a));
  551. }), T(this, "onPointerUp", (a) => {
  552. !this.enabled || !this.domElement || (this.domElement.style.touchAction = "", this.domElement.ownerDocument.removeEventListener("pointermove", this.onPointerMove), this.pointerUp(this.getPointer(a)));
  553. }), T(this, "getMode", () => this.mode), T(this, "setMode", (a) => {
  554. this.mode = a;
  555. }), T(this, "setTranslationSnap", (a) => {
  556. this.translationSnap = a;
  557. }), T(this, "setRotationSnap", (a) => {
  558. this.rotationSnap = a;
  559. }), T(this, "setScaleSnap", (a) => {
  560. this.scaleSnap = a;
  561. }), T(this, "setSize", (a) => {
  562. this.size = a;
  563. }), T(this, "setSpace", (a) => {
  564. this.space = a;
  565. }), T(this, "update", () => {
  566. console.warn("THREE.TransformControls: update function has no more functionality and therefore has been deprecated.");
  567. }), T(this, "connect", (a) => {
  568. a === document && console.error('THREE.OrbitControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.'), this.domElement = a, this.domElement.addEventListener("pointerdown", this.onPointerDown), this.domElement.addEventListener("pointermove", this.onPointerHover), this.domElement.ownerDocument.addEventListener("pointerup", this.onPointerUp);
  569. }), T(this, "dispose", () => {
  570. var a, c, u, h, d, g;
  571. (a = this.domElement) === null || a === void 0 || a.removeEventListener("pointerdown", this.onPointerDown), (c = this.domElement) === null || c === void 0 || c.removeEventListener("pointermove", this.onPointerHover), (u = this.domElement) === null || u === void 0 || (h = u.ownerDocument) === null || h === void 0 || h.removeEventListener("pointermove", this.onPointerMove), (d = this.domElement) === null || d === void 0 || (g = d.ownerDocument) === null || g === void 0 || g.removeEventListener("pointerup", this.onPointerUp), this.traverse((w) => {
  572. const _ = w;
  573. _.geometry && _.geometry.dispose(), _.material && _.material.dispose();
  574. });
  575. }), this.domElement = r, this.camera = i, this.gizmo = new tu(), this.add(this.gizmo), this.plane = new nu(), this.add(this.plane);
  576. const s = (a, c) => {
  577. let u = c;
  578. Object.defineProperty(this, a, {
  579. get: function() {
  580. return u !== void 0 ? u : c;
  581. },
  582. set: function(h) {
  583. u !== h && (u = h, this.plane[a] = h, this.gizmo[a] = h, this.dispatchEvent({
  584. type: a + "-changed",
  585. value: h
  586. }), this.dispatchEvent(this.changeEvent));
  587. }
  588. }), this[a] = c, this.plane[a] = c, this.gizmo[a] = c;
  589. };
  590. s("camera", this.camera), s("object", this.object), s("enabled", this.enabled), s("axis", this.axis), s("mode", this.mode), s("translationSnap", this.translationSnap), s("rotationSnap", this.rotationSnap), s("scaleSnap", this.scaleSnap), s("space", this.space), s("size", this.size), s("dragging", this.dragging), s("showX", this.showX), s("showY", this.showY), s("showZ", this.showZ), s("worldPosition", this.worldPosition), s("worldPositionStart", this.worldPositionStart), s("worldQuaternion", this.worldQuaternion), s("worldQuaternionStart", this.worldQuaternionStart), s("cameraPosition", this.cameraPosition), s("cameraQuaternion", this.cameraQuaternion), s("pointStart", this.pointStart), s("pointEnd", this.pointEnd), s("rotationAxis", this.rotationAxis), s("rotationAngle", this.rotationAngle), s("eye", this.eye), r !== void 0 && this.connect(r);
  591. }
  592. };
  593. var tu = class extends Object3D {
  594. // these are set from parent class TransformControls
  595. constructor() {
  596. super(), T(this, "isTransformControlsGizmo", true), T(this, "type", "TransformControlsGizmo"), T(this, "tempVector", new Vector3(0, 0, 0)), T(this, "tempEuler", new Euler()), T(this, "alignVector", new Vector3(0, 1, 0)), T(this, "zeroVector", new Vector3(0, 0, 0)), T(this, "lookAtMatrix", new Matrix4()), T(this, "tempQuaternion", new Quaternion()), T(this, "tempQuaternion2", new Quaternion()), T(this, "identityQuaternion", new Quaternion()), T(this, "unitX", new Vector3(1, 0, 0)), T(this, "unitY", new Vector3(0, 1, 0)), T(this, "unitZ", new Vector3(0, 0, 1)), T(this, "gizmo", void 0), T(this, "picker", void 0), T(this, "helper", void 0), T(this, "rotationAxis", new Vector3()), T(this, "cameraPosition", new Vector3()), T(this, "worldPositionStart", new Vector3()), T(this, "worldQuaternionStart", new Quaternion()), T(this, "worldPosition", new Vector3()), T(this, "worldQuaternion", new Quaternion()), T(this, "eye", new Vector3()), T(this, "camera", null), T(this, "enabled", true), T(this, "axis", null), T(this, "mode", "translate"), T(this, "space", "world"), T(this, "size", 1), T(this, "dragging", false), T(this, "showX", true), T(this, "showY", true), T(this, "showZ", true), T(this, "updateMatrixWorld", () => {
  597. let fe = this.space;
  598. this.mode === "scale" && (fe = "local");
  599. const ae = fe === "local" ? this.worldQuaternion : this.identityQuaternion;
  600. this.gizmo.translate.visible = this.mode === "translate", this.gizmo.rotate.visible = this.mode === "rotate", this.gizmo.scale.visible = this.mode === "scale", this.helper.translate.visible = this.mode === "translate", this.helper.rotate.visible = this.mode === "rotate", this.helper.scale.visible = this.mode === "scale";
  601. let ne = [];
  602. ne = ne.concat(this.picker[this.mode].children), ne = ne.concat(this.gizmo[this.mode].children), ne = ne.concat(this.helper[this.mode].children);
  603. for (let be = 0; be < ne.length; be++) {
  604. const M = ne[be];
  605. M.visible = true, M.rotation.set(0, 0, 0), M.position.copy(this.worldPosition);
  606. let le;
  607. if (this.camera.isOrthographicCamera ? le = (this.camera.top - this.camera.bottom) / this.camera.zoom : le = this.worldPosition.distanceTo(this.cameraPosition) * Math.min(1.9 * Math.tan(Math.PI * this.camera.fov / 360) / this.camera.zoom, 7), M.scale.set(1, 1, 1).multiplyScalar(le * this.size / 7), M.tag === "helper") {
  608. M.visible = false, M.name === "AXIS" ? (M.position.copy(this.worldPositionStart), M.visible = !!this.axis, this.axis === "X" && (this.tempQuaternion.setFromEuler(this.tempEuler.set(0, 0, 0)), M.quaternion.copy(ae).multiply(this.tempQuaternion), Math.abs(this.alignVector.copy(this.unitX).applyQuaternion(ae).dot(this.eye)) > 0.9 && (M.visible = false)), this.axis === "Y" && (this.tempQuaternion.setFromEuler(this.tempEuler.set(0, 0, Math.PI / 2)), M.quaternion.copy(ae).multiply(this.tempQuaternion), Math.abs(this.alignVector.copy(this.unitY).applyQuaternion(ae).dot(this.eye)) > 0.9 && (M.visible = false)), this.axis === "Z" && (this.tempQuaternion.setFromEuler(this.tempEuler.set(0, Math.PI / 2, 0)), M.quaternion.copy(ae).multiply(this.tempQuaternion), Math.abs(this.alignVector.copy(this.unitZ).applyQuaternion(ae).dot(this.eye)) > 0.9 && (M.visible = false)), this.axis === "XYZE" && (this.tempQuaternion.setFromEuler(this.tempEuler.set(0, Math.PI / 2, 0)), this.alignVector.copy(this.rotationAxis), M.quaternion.setFromRotationMatrix(this.lookAtMatrix.lookAt(this.zeroVector, this.alignVector, this.unitY)), M.quaternion.multiply(this.tempQuaternion), M.visible = this.dragging), this.axis === "E" && (M.visible = false)) : M.name === "START" ? (M.position.copy(this.worldPositionStart), M.visible = this.dragging) : M.name === "END" ? (M.position.copy(this.worldPosition), M.visible = this.dragging) : M.name === "DELTA" ? (M.position.copy(this.worldPositionStart), M.quaternion.copy(this.worldQuaternionStart), this.tempVector.set(1e-10, 1e-10, 1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1), this.tempVector.applyQuaternion(this.worldQuaternionStart.clone().invert()), M.scale.copy(this.tempVector), M.visible = this.dragging) : (M.quaternion.copy(ae), this.dragging ? M.position.copy(this.worldPositionStart) : M.position.copy(this.worldPosition), this.axis && (M.visible = this.axis.search(M.name) !== -1));
  609. continue;
  610. }
  611. M.quaternion.copy(ae), this.mode === "translate" || this.mode === "scale" ? ((M.name === "X" || M.name === "XYZX") && Math.abs(this.alignVector.copy(this.unitX).applyQuaternion(ae).dot(this.eye)) > 0.99 && (M.scale.set(1e-10, 1e-10, 1e-10), M.visible = false), (M.name === "Y" || M.name === "XYZY") && Math.abs(this.alignVector.copy(this.unitY).applyQuaternion(ae).dot(this.eye)) > 0.99 && (M.scale.set(1e-10, 1e-10, 1e-10), M.visible = false), (M.name === "Z" || M.name === "XYZZ") && Math.abs(this.alignVector.copy(this.unitZ).applyQuaternion(ae).dot(this.eye)) > 0.99 && (M.scale.set(1e-10, 1e-10, 1e-10), M.visible = false), M.name === "XY" && Math.abs(this.alignVector.copy(this.unitZ).applyQuaternion(ae).dot(this.eye)) < 0.2 && (M.scale.set(1e-10, 1e-10, 1e-10), M.visible = false), M.name === "YZ" && Math.abs(this.alignVector.copy(this.unitX).applyQuaternion(ae).dot(this.eye)) < 0.2 && (M.scale.set(1e-10, 1e-10, 1e-10), M.visible = false), M.name === "XZ" && Math.abs(this.alignVector.copy(this.unitY).applyQuaternion(ae).dot(this.eye)) < 0.2 && (M.scale.set(1e-10, 1e-10, 1e-10), M.visible = false), M.name.search("X") !== -1 && (this.alignVector.copy(this.unitX).applyQuaternion(ae).dot(this.eye) < 0 ? M.tag === "fwd" ? M.visible = false : M.scale.x *= -1 : M.tag === "bwd" && (M.visible = false)), M.name.search("Y") !== -1 && (this.alignVector.copy(this.unitY).applyQuaternion(ae).dot(this.eye) < 0 ? M.tag === "fwd" ? M.visible = false : M.scale.y *= -1 : M.tag === "bwd" && (M.visible = false)), M.name.search("Z") !== -1 && (this.alignVector.copy(this.unitZ).applyQuaternion(ae).dot(this.eye) < 0 ? M.tag === "fwd" ? M.visible = false : M.scale.z *= -1 : M.tag === "bwd" && (M.visible = false))) : this.mode === "rotate" && (this.tempQuaternion2.copy(ae), this.alignVector.copy(this.eye).applyQuaternion(this.tempQuaternion.copy(ae).invert()), M.name.search("E") !== -1 && M.quaternion.setFromRotationMatrix(this.lookAtMatrix.lookAt(this.eye, this.zeroVector, this.unitY)), M.name === "X" && (this.tempQuaternion.setFromAxisAngle(this.unitX, Math.atan2(-this.alignVector.y, this.alignVector.z)), this.tempQuaternion.multiplyQuaternions(this.tempQuaternion2, this.tempQuaternion), M.quaternion.copy(this.tempQuaternion)), M.name === "Y" && (this.tempQuaternion.setFromAxisAngle(this.unitY, Math.atan2(this.alignVector.x, this.alignVector.z)), this.tempQuaternion.multiplyQuaternions(this.tempQuaternion2, this.tempQuaternion), M.quaternion.copy(this.tempQuaternion)), M.name === "Z" && (this.tempQuaternion.setFromAxisAngle(this.unitZ, Math.atan2(this.alignVector.y, this.alignVector.x)), this.tempQuaternion.multiplyQuaternions(this.tempQuaternion2, this.tempQuaternion), M.quaternion.copy(this.tempQuaternion))), M.visible = M.visible && (M.name.indexOf("X") === -1 || this.showX), M.visible = M.visible && (M.name.indexOf("Y") === -1 || this.showY), M.visible = M.visible && (M.name.indexOf("Z") === -1 || this.showZ), M.visible = M.visible && (M.name.indexOf("E") === -1 || this.showX && this.showY && this.showZ), M.material.tempOpacity = M.material.tempOpacity || M.material.opacity, M.material.tempColor = M.material.tempColor || M.material.color.clone(), M.material.color.copy(M.material.tempColor), M.material.opacity = M.material.tempOpacity, this.enabled ? this.axis && (M.name === this.axis ? (M.material.opacity = 1, M.material.color.lerp(new Color(1, 1, 1), 0.5)) : this.axis.split("").some(function(Ve) {
  612. return M.name === Ve;
  613. }) ? (M.material.opacity = 1, M.material.color.lerp(new Color(1, 1, 1), 0.5)) : (M.material.opacity *= 0.25, M.material.color.lerp(new Color(1, 1, 1), 0.5))) : (M.material.opacity *= 0.5, M.material.color.lerp(new Color(1, 1, 1), 0.5));
  614. }
  615. super.updateMatrixWorld();
  616. });
  617. const i = new MeshBasicMaterial({
  618. depthTest: false,
  619. depthWrite: false,
  620. transparent: true,
  621. side: DoubleSide,
  622. fog: false,
  623. toneMapped: false
  624. }), r = new LineBasicMaterial({
  625. depthTest: false,
  626. depthWrite: false,
  627. transparent: true,
  628. linewidth: 1,
  629. fog: false,
  630. toneMapped: false
  631. }), s = i.clone();
  632. s.opacity = 0.15;
  633. const a = i.clone();
  634. a.opacity = 0.33;
  635. const c = i.clone();
  636. c.color.set(16711680);
  637. const u = i.clone();
  638. u.color.set(65280);
  639. const h = i.clone();
  640. h.color.set(255);
  641. const d = i.clone();
  642. d.opacity = 0.25;
  643. const g = d.clone();
  644. g.color.set(16776960);
  645. const w = d.clone();
  646. w.color.set(65535);
  647. const _ = d.clone();
  648. _.color.set(16711935), i.clone().color.set(16776960);
  649. const C = r.clone();
  650. C.color.set(16711680);
  651. const I = r.clone();
  652. I.color.set(65280);
  653. const S = r.clone();
  654. S.color.set(255);
  655. const R = r.clone();
  656. R.color.set(65535);
  657. const j2 = r.clone();
  658. j2.color.set(16711935);
  659. const F = r.clone();
  660. F.color.set(16776960);
  661. const V = r.clone();
  662. V.color.set(7895160);
  663. const D = F.clone();
  664. D.opacity = 0.25;
  665. const Y = new CylinderGeometry(0, 0.05, 0.2, 12, 1, false), G = new BoxGeometry(0.125, 0.125, 0.125), N = new BufferGeometry();
  666. N.setAttribute("position", new Float32BufferAttribute([0, 0, 0, 1, 0, 0], 3));
  667. const O = (fe, ae) => {
  668. const ne = new BufferGeometry(), be = [];
  669. for (let M = 0; M <= 64 * ae; ++M)
  670. be.push(0, Math.cos(M / 32 * Math.PI) * fe, Math.sin(M / 32 * Math.PI) * fe);
  671. return ne.setAttribute("position", new Float32BufferAttribute(be, 3)), ne;
  672. }, H = () => {
  673. const fe = new BufferGeometry();
  674. return fe.setAttribute("position", new Float32BufferAttribute([0, 0, 0, 1, 1, 1], 3)), fe;
  675. }, K = {
  676. X: [[new Mesh(Y, c), [1, 0, 0], [0, 0, -Math.PI / 2], null, "fwd"], [new Mesh(Y, c), [1, 0, 0], [0, 0, Math.PI / 2], null, "bwd"], [new Line(N, C)]],
  677. Y: [[new Mesh(Y, u), [0, 1, 0], null, null, "fwd"], [new Mesh(Y, u), [0, 1, 0], [Math.PI, 0, 0], null, "bwd"], [new Line(N, I), null, [0, 0, Math.PI / 2]]],
  678. Z: [[new Mesh(Y, h), [0, 0, 1], [Math.PI / 2, 0, 0], null, "fwd"], [new Mesh(Y, h), [0, 0, 1], [-Math.PI / 2, 0, 0], null, "bwd"], [new Line(N, S), null, [0, -Math.PI / 2, 0]]],
  679. XYZ: [[new Mesh(new OctahedronGeometry(0.1, 0), d.clone()), [0, 0, 0], [0, 0, 0]]],
  680. XY: [[new Mesh(new PlaneGeometry(0.295, 0.295), g.clone()), [0.15, 0.15, 0]], [new Line(N, F), [0.18, 0.3, 0], null, [0.125, 1, 1]], [new Line(N, F), [0.3, 0.18, 0], [0, 0, Math.PI / 2], [0.125, 1, 1]]],
  681. YZ: [[new Mesh(new PlaneGeometry(0.295, 0.295), w.clone()), [0, 0.15, 0.15], [0, Math.PI / 2, 0]], [new Line(N, R), [0, 0.18, 0.3], [0, 0, Math.PI / 2], [0.125, 1, 1]], [new Line(N, R), [0, 0.3, 0.18], [0, -Math.PI / 2, 0], [0.125, 1, 1]]],
  682. XZ: [[new Mesh(new PlaneGeometry(0.295, 0.295), _.clone()), [0.15, 0, 0.15], [-Math.PI / 2, 0, 0]], [new Line(N, j2), [0.18, 0, 0.3], null, [0.125, 1, 1]], [new Line(N, j2), [0.3, 0, 0.18], [0, -Math.PI / 2, 0], [0.125, 1, 1]]]
  683. }, q = {
  684. X: [[new Mesh(new CylinderGeometry(0.2, 0, 1, 4, 1, false), s), [0.6, 0, 0], [0, 0, -Math.PI / 2]]],
  685. Y: [[new Mesh(new CylinderGeometry(0.2, 0, 1, 4, 1, false), s), [0, 0.6, 0]]],
  686. Z: [[new Mesh(new CylinderGeometry(0.2, 0, 1, 4, 1, false), s), [0, 0, 0.6], [Math.PI / 2, 0, 0]]],
  687. XYZ: [[new Mesh(new OctahedronGeometry(0.2, 0), s)]],
  688. XY: [[new Mesh(new PlaneGeometry(0.4, 0.4), s), [0.2, 0.2, 0]]],
  689. YZ: [[new Mesh(new PlaneGeometry(0.4, 0.4), s), [0, 0.2, 0.2], [0, Math.PI / 2, 0]]],
  690. XZ: [[new Mesh(new PlaneGeometry(0.4, 0.4), s), [0.2, 0, 0.2], [-Math.PI / 2, 0, 0]]]
  691. }, ue = {
  692. START: [[new Mesh(new OctahedronGeometry(0.01, 2), a), null, null, null, "helper"]],
  693. END: [[new Mesh(new OctahedronGeometry(0.01, 2), a), null, null, null, "helper"]],
  694. DELTA: [[new Line(H(), a), null, null, null, "helper"]],
  695. X: [[new Line(N, a.clone()), [-1e3, 0, 0], null, [1e6, 1, 1], "helper"]],
  696. Y: [[new Line(N, a.clone()), [0, -1e3, 0], [0, 0, Math.PI / 2], [1e6, 1, 1], "helper"]],
  697. Z: [[new Line(N, a.clone()), [0, 0, -1e3], [0, -Math.PI / 2, 0], [1e6, 1, 1], "helper"]]
  698. }, ge = {
  699. X: [[new Line(O(1, 0.5), C)], [new Mesh(new OctahedronGeometry(0.04, 0), c), [0, 0, 0.99], null, [1, 3, 1]]],
  700. Y: [[new Line(O(1, 0.5), I), null, [0, 0, -Math.PI / 2]], [new Mesh(new OctahedronGeometry(0.04, 0), u), [0, 0, 0.99], null, [3, 1, 1]]],
  701. Z: [[new Line(O(1, 0.5), S), null, [0, Math.PI / 2, 0]], [new Mesh(new OctahedronGeometry(0.04, 0), h), [0.99, 0, 0], null, [1, 3, 1]]],
  702. E: [[new Line(O(1.25, 1), D), null, [0, Math.PI / 2, 0]], [new Mesh(new CylinderGeometry(0.03, 0, 0.15, 4, 1, false), D), [1.17, 0, 0], [0, 0, -Math.PI / 2], [1, 1, 1e-3]], [new Mesh(new CylinderGeometry(0.03, 0, 0.15, 4, 1, false), D), [-1.17, 0, 0], [0, 0, Math.PI / 2], [1, 1, 1e-3]], [new Mesh(new CylinderGeometry(0.03, 0, 0.15, 4, 1, false), D), [0, -1.17, 0], [Math.PI, 0, 0], [1, 1, 1e-3]], [new Mesh(new CylinderGeometry(0.03, 0, 0.15, 4, 1, false), D), [0, 1.17, 0], [0, 0, 0], [1, 1, 1e-3]]],
  703. XYZE: [[new Line(O(1, 1), V), null, [0, Math.PI / 2, 0]]]
  704. }, ce = {
  705. AXIS: [[new Line(N, a.clone()), [-1e3, 0, 0], null, [1e6, 1, 1], "helper"]]
  706. }, me = {
  707. X: [[new Mesh(new TorusGeometry(1, 0.1, 4, 24), s), [0, 0, 0], [0, -Math.PI / 2, -Math.PI / 2]]],
  708. Y: [[new Mesh(new TorusGeometry(1, 0.1, 4, 24), s), [0, 0, 0], [Math.PI / 2, 0, 0]]],
  709. Z: [[new Mesh(new TorusGeometry(1, 0.1, 4, 24), s), [0, 0, 0], [0, 0, -Math.PI / 2]]],
  710. E: [[new Mesh(new TorusGeometry(1.25, 0.1, 2, 24), s)]],
  711. XYZE: [[new Mesh(new SphereGeometry(0.7, 10, 8), s)]]
  712. }, he = {
  713. X: [[new Mesh(G, c), [0.8, 0, 0], [0, 0, -Math.PI / 2]], [new Line(N, C), null, null, [0.8, 1, 1]]],
  714. Y: [[new Mesh(G, u), [0, 0.8, 0]], [new Line(N, I), null, [0, 0, Math.PI / 2], [0.8, 1, 1]]],
  715. Z: [[new Mesh(G, h), [0, 0, 0.8], [Math.PI / 2, 0, 0]], [new Line(N, S), null, [0, -Math.PI / 2, 0], [0.8, 1, 1]]],
  716. XY: [[new Mesh(G, g), [0.85, 0.85, 0], null, [2, 2, 0.2]], [new Line(N, F), [0.855, 0.98, 0], null, [0.125, 1, 1]], [new Line(N, F), [0.98, 0.855, 0], [0, 0, Math.PI / 2], [0.125, 1, 1]]],
  717. YZ: [[new Mesh(G, w), [0, 0.85, 0.85], null, [0.2, 2, 2]], [new Line(N, R), [0, 0.855, 0.98], [0, 0, Math.PI / 2], [0.125, 1, 1]], [new Line(N, R), [0, 0.98, 0.855], [0, -Math.PI / 2, 0], [0.125, 1, 1]]],
  718. XZ: [[new Mesh(G, _), [0.85, 0, 0.85], null, [2, 0.2, 2]], [new Line(N, j2), [0.855, 0, 0.98], null, [0.125, 1, 1]], [new Line(N, j2), [0.98, 0, 0.855], [0, -Math.PI / 2, 0], [0.125, 1, 1]]],
  719. XYZX: [[new Mesh(new BoxGeometry(0.125, 0.125, 0.125), d.clone()), [1.1, 0, 0]]],
  720. XYZY: [[new Mesh(new BoxGeometry(0.125, 0.125, 0.125), d.clone()), [0, 1.1, 0]]],
  721. XYZZ: [[new Mesh(new BoxGeometry(0.125, 0.125, 0.125), d.clone()), [0, 0, 1.1]]]
  722. }, ee = {
  723. X: [[new Mesh(new CylinderGeometry(0.2, 0, 0.8, 4, 1, false), s), [0.5, 0, 0], [0, 0, -Math.PI / 2]]],
  724. Y: [[new Mesh(new CylinderGeometry(0.2, 0, 0.8, 4, 1, false), s), [0, 0.5, 0]]],
  725. Z: [[new Mesh(new CylinderGeometry(0.2, 0, 0.8, 4, 1, false), s), [0, 0, 0.5], [Math.PI / 2, 0, 0]]],
  726. XY: [[new Mesh(G, s), [0.85, 0.85, 0], null, [3, 3, 0.2]]],
  727. YZ: [[new Mesh(G, s), [0, 0.85, 0.85], null, [0.2, 3, 3]]],
  728. XZ: [[new Mesh(G, s), [0.85, 0, 0.85], null, [3, 0.2, 3]]],
  729. XYZX: [[new Mesh(new BoxGeometry(0.2, 0.2, 0.2), s), [1.1, 0, 0]]],
  730. XYZY: [[new Mesh(new BoxGeometry(0.2, 0.2, 0.2), s), [0, 1.1, 0]]],
  731. XYZZ: [[new Mesh(new BoxGeometry(0.2, 0.2, 0.2), s), [0, 0, 1.1]]]
  732. }, X = {
  733. X: [[new Line(N, a.clone()), [-1e3, 0, 0], null, [1e6, 1, 1], "helper"]],
  734. Y: [[new Line(N, a.clone()), [0, -1e3, 0], [0, 0, Math.PI / 2], [1e6, 1, 1], "helper"]],
  735. Z: [[new Line(N, a.clone()), [0, 0, -1e3], [0, -Math.PI / 2, 0], [1e6, 1, 1], "helper"]]
  736. }, Pe = (fe) => {
  737. const ae = new Object3D();
  738. for (let ne in fe)
  739. for (let be = fe[ne].length; be--; ) {
  740. const M = fe[ne][be][0].clone(), le = fe[ne][be][1], Ve = fe[ne][be][2], Ne = fe[ne][be][3], we = fe[ne][be][4];
  741. M.name = ne, M.tag = we, le && M.position.set(le[0], le[1], le[2]), Ve && M.rotation.set(Ve[0], Ve[1], Ve[2]), Ne && M.scale.set(Ne[0], Ne[1], Ne[2]), M.updateMatrix();
  742. const it = M.geometry.clone();
  743. it.applyMatrix4(M.matrix), M.geometry = it, M.renderOrder = 1 / 0, M.position.set(0, 0, 0), M.rotation.set(0, 0, 0), M.scale.set(1, 1, 1), ae.add(M);
  744. }
  745. return ae;
  746. };
  747. this.gizmo = {}, this.picker = {}, this.helper = {}, this.add(this.gizmo.translate = Pe(K)), this.add(this.gizmo.rotate = Pe(ge)), this.add(this.gizmo.scale = Pe(he)), this.add(this.picker.translate = Pe(q)), this.add(this.picker.rotate = Pe(me)), this.add(this.picker.scale = Pe(ee)), this.add(this.helper.translate = Pe(ue)), this.add(this.helper.rotate = Pe(ce)), this.add(this.helper.scale = Pe(X)), this.picker.translate.visible = false, this.picker.rotate.visible = false, this.picker.scale.visible = false;
  748. }
  749. // updateMatrixWorld will update transformations and appearance of individual handles
  750. };
  751. var nu = class extends Mesh {
  752. constructor() {
  753. super(new PlaneGeometry(1e5, 1e5, 2, 2), new MeshBasicMaterial({
  754. visible: false,
  755. wireframe: true,
  756. side: DoubleSide,
  757. transparent: true,
  758. opacity: 0.1,
  759. toneMapped: false
  760. })), T(this, "isTransformControlsPlane", true), T(this, "type", "TransformControlsPlane"), T(this, "unitX", new Vector3(1, 0, 0)), T(this, "unitY", new Vector3(0, 1, 0)), T(this, "unitZ", new Vector3(0, 0, 1)), T(this, "tempVector", new Vector3()), T(this, "dirVector", new Vector3()), T(this, "alignVector", new Vector3()), T(this, "tempMatrix", new Matrix4()), T(this, "identityQuaternion", new Quaternion()), T(this, "cameraQuaternion", new Quaternion()), T(this, "worldPosition", new Vector3()), T(this, "worldQuaternion", new Quaternion()), T(this, "eye", new Vector3()), T(this, "axis", null), T(this, "mode", "translate"), T(this, "space", "world"), T(this, "updateMatrixWorld", () => {
  761. let i = this.space;
  762. switch (this.position.copy(this.worldPosition), this.mode === "scale" && (i = "local"), this.unitX.set(1, 0, 0).applyQuaternion(i === "local" ? this.worldQuaternion : this.identityQuaternion), this.unitY.set(0, 1, 0).applyQuaternion(i === "local" ? this.worldQuaternion : this.identityQuaternion), this.unitZ.set(0, 0, 1).applyQuaternion(i === "local" ? this.worldQuaternion : this.identityQuaternion), this.alignVector.copy(this.unitY), this.mode) {
  763. case "translate":
  764. case "scale":
  765. switch (this.axis) {
  766. case "X":
  767. this.alignVector.copy(this.eye).cross(this.unitX), this.dirVector.copy(this.unitX).cross(this.alignVector);
  768. break;
  769. case "Y":
  770. this.alignVector.copy(this.eye).cross(this.unitY), this.dirVector.copy(this.unitY).cross(this.alignVector);
  771. break;
  772. case "Z":
  773. this.alignVector.copy(this.eye).cross(this.unitZ), this.dirVector.copy(this.unitZ).cross(this.alignVector);
  774. break;
  775. case "XY":
  776. this.dirVector.copy(this.unitZ);
  777. break;
  778. case "YZ":
  779. this.dirVector.copy(this.unitX);
  780. break;
  781. case "XZ":
  782. this.alignVector.copy(this.unitZ), this.dirVector.copy(this.unitY);
  783. break;
  784. case "XYZ":
  785. case "E":
  786. this.dirVector.set(0, 0, 0);
  787. break;
  788. }
  789. break;
  790. case "rotate":
  791. default:
  792. this.dirVector.set(0, 0, 0);
  793. }
  794. this.dirVector.length() === 0 ? this.quaternion.copy(this.cameraQuaternion) : (this.tempMatrix.lookAt(this.tempVector.set(0, 0, 0), this.dirVector, this.alignVector), this.quaternion.setFromRotationMatrix(this.tempMatrix)), super.updateMatrixWorld();
  795. });
  796. }
  797. };
  798. var oa = (b, i) => (b % i + i) % i;
  799. var iu = class extends EventDispatcher {
  800. // Set to false to disable this control
  801. // "target" sets the location of focus, where the object orbits around
  802. // How far you can dolly in and out ( PerspectiveCamera only )
  803. // How far you can zoom in and out ( OrthographicCamera only )
  804. // How far you can orbit vertically, upper and lower limits.
  805. // Range is 0 to Math.PI radians.
  806. // radians
  807. // radians
  808. // How far you can orbit horizontally, upper and lower limits.
  809. // If set, the interval [ min, max ] must be a sub-interval of [ - 2 PI, 2 PI ], with ( max - min < 2 PI )
  810. // radians
  811. // radians
  812. // Set to true to enable damping (inertia)
  813. // If damping is enabled, you must call controls.update() in your animation loop
  814. // This option actually enables dollying in and out; left as "zoom" for backwards compatibility.
  815. // Set to false to disable zooming
  816. // Set to false to disable rotating
  817. // Set to false to disable panning
  818. // if false, pan orthogonal to world-space direction camera.up
  819. // pixels moved per arrow key push
  820. // Set to true to automatically rotate around the target
  821. // If auto-rotate is enabled, you must call controls.update() in your animation loop
  822. // 30 seconds per orbit when fps is 60
  823. // true if you want to reverse the orbit to mouse drag from left to right = orbits left
  824. // The four arrow keys
  825. // Mouse buttons
  826. // Touch fingers
  827. // the target DOM element for key events
  828. constructor(i, r) {
  829. super(), T(this, "object", void 0), T(this, "domElement", void 0), T(this, "enabled", true), T(this, "target", new Vector3()), T(this, "minDistance", 0), T(this, "maxDistance", 1 / 0), T(this, "minZoom", 0), T(this, "maxZoom", 1 / 0), T(this, "minPolarAngle", 0), T(this, "maxPolarAngle", Math.PI), T(this, "minAzimuthAngle", -1 / 0), T(this, "maxAzimuthAngle", 1 / 0), T(this, "enableDamping", false), T(this, "dampingFactor", 0.05), T(this, "enableZoom", true), T(this, "zoomSpeed", 1), T(this, "enableRotate", true), T(this, "rotateSpeed", 1), T(this, "enablePan", true), T(this, "panSpeed", 1), T(this, "screenSpacePanning", true), T(this, "keyPanSpeed", 7), T(this, "autoRotate", false), T(this, "autoRotateSpeed", 2), T(this, "reverseOrbit", false), T(this, "keys", {
  830. LEFT: "ArrowLeft",
  831. UP: "ArrowUp",
  832. RIGHT: "ArrowRight",
  833. BOTTOM: "ArrowDown"
  834. }), T(this, "mouseButtons", {
  835. LEFT: MOUSE.ROTATE,
  836. MIDDLE: MOUSE.DOLLY,
  837. RIGHT: MOUSE.PAN
  838. }), T(this, "touches", {
  839. ONE: TOUCH.ROTATE,
  840. TWO: TOUCH.DOLLY_PAN
  841. }), T(this, "target0", void 0), T(this, "position0", void 0), T(this, "zoom0", void 0), T(this, "_domElementKeyEvents", null), T(this, "getPolarAngle", void 0), T(this, "getAzimuthalAngle", void 0), T(this, "setPolarAngle", void 0), T(this, "setAzimuthalAngle", void 0), T(this, "getDistance", void 0), T(this, "listenToKeyEvents", void 0), T(this, "saveState", void 0), T(this, "reset", void 0), T(this, "update", void 0), T(this, "connect", void 0), T(this, "dispose", void 0), this.object = i, this.domElement = r, this.target0 = this.target.clone(), this.position0 = this.object.position.clone(), this.zoom0 = this.object instanceof PerspectiveCamera ? this.object.zoom : 1, this.getPolarAngle = () => w.phi, this.getAzimuthalAngle = () => w.theta, this.setPolarAngle = (A) => {
  842. let U = oa(A, 2 * Math.PI), W = w.phi;
  843. W < 0 && (W += 2 * Math.PI), U < 0 && (U += 2 * Math.PI);
  844. let ie = Math.abs(U - W);
  845. 2 * Math.PI - ie < ie && (U < W ? U += 2 * Math.PI : W += 2 * Math.PI), _.phi = U - W, s.update();
  846. }, this.setAzimuthalAngle = (A) => {
  847. let U = oa(A, 2 * Math.PI), W = w.theta;
  848. W < 0 && (W += 2 * Math.PI), U < 0 && (U += 2 * Math.PI);
  849. let ie = Math.abs(U - W);
  850. 2 * Math.PI - ie < ie && (U < W ? U += 2 * Math.PI : W += 2 * Math.PI), _.theta = U - W, s.update();
  851. }, this.getDistance = () => s.object.position.distanceTo(s.target), this.listenToKeyEvents = (A) => {
  852. A.addEventListener("keydown", yt), this._domElementKeyEvents = A;
  853. }, this.saveState = () => {
  854. s.target0.copy(s.target), s.position0.copy(s.object.position), s.zoom0 = s.object instanceof PerspectiveCamera ? s.object.zoom : 1;
  855. }, this.reset = () => {
  856. s.target.copy(s.target0), s.object.position.copy(s.position0), s.object instanceof PerspectiveCamera && (s.object.zoom = s.zoom0, s.object.updateProjectionMatrix()), s.dispatchEvent(a), s.update(), d = h.NONE;
  857. }, this.update = (() => {
  858. const A = new Vector3(), U = new Quaternion().setFromUnitVectors(i.up, new Vector3(0, 1, 0)), W = U.clone().invert(), ie = new Vector3(), ye = new Quaternion(), De = 2 * Math.PI;
  859. return function() {
  860. const pn = s.object.position;
  861. A.copy(pn).sub(s.target), A.applyQuaternion(U), w.setFromVector3(A), s.autoRotate && d === h.NONE && ue(K()), s.enableDamping ? (w.theta += _.theta * s.dampingFactor, w.phi += _.phi * s.dampingFactor) : (w.theta += _.theta, w.phi += _.phi);
  862. let Ue = s.minAzimuthAngle, Ge = s.maxAzimuthAngle;
  863. return isFinite(Ue) && isFinite(Ge) && (Ue < -Math.PI ? Ue += De : Ue > Math.PI && (Ue -= De), Ge < -Math.PI ? Ge += De : Ge > Math.PI && (Ge -= De), Ue <= Ge ? w.theta = Math.max(Ue, Math.min(Ge, w.theta)) : w.theta = w.theta > (Ue + Ge) / 2 ? Math.max(Ue, w.theta) : Math.min(Ge, w.theta)), w.phi = Math.max(s.minPolarAngle, Math.min(s.maxPolarAngle, w.phi)), w.makeSafe(), w.radius *= y, w.radius = Math.max(s.minDistance, Math.min(s.maxDistance, w.radius)), s.enableDamping === true ? s.target.addScaledVector(C, s.dampingFactor) : s.target.add(C), A.setFromSpherical(w), A.applyQuaternion(W), pn.copy(s.target).add(A), s.object.lookAt(s.target), s.enableDamping === true ? (_.theta *= 1 - s.dampingFactor, _.phi *= 1 - s.dampingFactor, C.multiplyScalar(1 - s.dampingFactor)) : (_.set(0, 0, 0), C.set(0, 0, 0)), y = 1, I || ie.distanceToSquared(s.object.position) > g || 8 * (1 - ye.dot(s.object.quaternion)) > g ? (s.dispatchEvent(a), ie.copy(s.object.position), ye.copy(s.object.quaternion), I = false, true) : false;
  864. };
  865. })(), this.connect = (A) => {
  866. A === document && console.error('THREE.OrbitControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.'), s.domElement = A, s.domElement.style.touchAction = "none", s.domElement.addEventListener("contextmenu", cn), s.domElement.addEventListener("pointerdown", st), s.domElement.addEventListener("pointercancel", zn), s.domElement.addEventListener("wheel", Gn);
  867. }, this.dispose = () => {
  868. var A, U, W, ie, ye, De;
  869. (A = s.domElement) === null || A === void 0 || A.removeEventListener("contextmenu", cn), (U = s.domElement) === null || U === void 0 || U.removeEventListener("pointerdown", st), (W = s.domElement) === null || W === void 0 || W.removeEventListener("pointercancel", zn), (ie = s.domElement) === null || ie === void 0 || ie.removeEventListener("wheel", Gn), (ye = s.domElement) === null || ye === void 0 || ye.ownerDocument.removeEventListener("pointermove", ln), (De = s.domElement) === null || De === void 0 || De.ownerDocument.removeEventListener("pointerup", mt), s._domElementKeyEvents !== null && s._domElementKeyEvents.removeEventListener("keydown", yt);
  870. };
  871. const s = this, a = {
  872. type: "change"
  873. }, c = {
  874. type: "start"
  875. }, u = {
  876. type: "end"
  877. }, h = {
  878. NONE: -1,
  879. ROTATE: 0,
  880. DOLLY: 1,
  881. PAN: 2,
  882. TOUCH_ROTATE: 3,
  883. TOUCH_PAN: 4,
  884. TOUCH_DOLLY_PAN: 5,
  885. TOUCH_DOLLY_ROTATE: 6
  886. };
  887. let d = h.NONE;
  888. const g = 1e-6, w = new Spherical(), _ = new Spherical();
  889. let y = 1;
  890. const C = new Vector3();
  891. let I = false;
  892. const S = new Vector2(), R = new Vector2(), j2 = new Vector2(), F = new Vector2(), V = new Vector2(), D = new Vector2(), Y = new Vector2(), G = new Vector2(), N = new Vector2(), O = [], H = {};
  893. function K() {
  894. return 2 * Math.PI / 60 / 60 * s.autoRotateSpeed;
  895. }
  896. function q() {
  897. return Math.pow(0.95, s.zoomSpeed);
  898. }
  899. function ue(A) {
  900. s.reverseOrbit ? _.theta += A : _.theta -= A;
  901. }
  902. function ge(A) {
  903. s.reverseOrbit ? _.phi += A : _.phi -= A;
  904. }
  905. const ce = (() => {
  906. const A = new Vector3();
  907. return function(W, ie) {
  908. A.setFromMatrixColumn(ie, 0), A.multiplyScalar(-W), C.add(A);
  909. };
  910. })(), me = (() => {
  911. const A = new Vector3();
  912. return function(W, ie) {
  913. s.screenSpacePanning === true ? A.setFromMatrixColumn(ie, 1) : (A.setFromMatrixColumn(ie, 0), A.crossVectors(s.object.up, A)), A.multiplyScalar(W), C.add(A);
  914. };
  915. })(), he = (() => {
  916. const A = new Vector3();
  917. return function(W, ie) {
  918. const ye = s.domElement;
  919. if (ye && s.object instanceof PerspectiveCamera && s.object.isPerspectiveCamera) {
  920. const De = s.object.position;
  921. A.copy(De).sub(s.target);
  922. let Ut = A.length();
  923. Ut *= Math.tan(s.object.fov / 2 * Math.PI / 180), ce(2 * W * Ut / ye.clientHeight, s.object.matrix), me(2 * ie * Ut / ye.clientHeight, s.object.matrix);
  924. } else
  925. ye && s.object instanceof OrthographicCamera && s.object.isOrthographicCamera ? (ce(W * (s.object.right - s.object.left) / s.object.zoom / ye.clientWidth, s.object.matrix), me(ie * (s.object.top - s.object.bottom) / s.object.zoom / ye.clientHeight, s.object.matrix)) : (console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."), s.enablePan = false);
  926. };
  927. })();
  928. function ee(A) {
  929. s.object instanceof PerspectiveCamera && s.object.isPerspectiveCamera ? y /= A : s.object instanceof OrthographicCamera && s.object.isOrthographicCamera ? (s.object.zoom = Math.max(s.minZoom, Math.min(s.maxZoom, s.object.zoom * A)), s.object.updateProjectionMatrix(), I = true) : (console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."), s.enableZoom = false);
  930. }
  931. function X(A) {
  932. s.object instanceof PerspectiveCamera && s.object.isPerspectiveCamera ? y *= A : s.object instanceof OrthographicCamera && s.object.isOrthographicCamera ? (s.object.zoom = Math.max(s.minZoom, Math.min(s.maxZoom, s.object.zoom / A)), s.object.updateProjectionMatrix(), I = true) : (console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."), s.enableZoom = false);
  933. }
  934. function Pe(A) {
  935. S.set(A.clientX, A.clientY);
  936. }
  937. function fe(A) {
  938. Y.set(A.clientX, A.clientY);
  939. }
  940. function ae(A) {
  941. F.set(A.clientX, A.clientY);
  942. }
  943. function ne(A) {
  944. R.set(A.clientX, A.clientY), j2.subVectors(R, S).multiplyScalar(s.rotateSpeed);
  945. const U = s.domElement;
  946. U && (ue(2 * Math.PI * j2.x / U.clientHeight), ge(2 * Math.PI * j2.y / U.clientHeight)), S.copy(R), s.update();
  947. }
  948. function be(A) {
  949. G.set(A.clientX, A.clientY), N.subVectors(G, Y), N.y > 0 ? ee(q()) : N.y < 0 && X(q()), Y.copy(G), s.update();
  950. }
  951. function M(A) {
  952. V.set(A.clientX, A.clientY), D.subVectors(V, F).multiplyScalar(s.panSpeed), he(D.x, D.y), F.copy(V), s.update();
  953. }
  954. function le(A) {
  955. A.deltaY < 0 ? X(q()) : A.deltaY > 0 && ee(q()), s.update();
  956. }
  957. function Ve(A) {
  958. let U = false;
  959. switch (A.code) {
  960. case s.keys.UP:
  961. he(0, s.keyPanSpeed), U = true;
  962. break;
  963. case s.keys.BOTTOM:
  964. he(0, -s.keyPanSpeed), U = true;
  965. break;
  966. case s.keys.LEFT:
  967. he(s.keyPanSpeed, 0), U = true;
  968. break;
  969. case s.keys.RIGHT:
  970. he(-s.keyPanSpeed, 0), U = true;
  971. break;
  972. }
  973. U && (A.preventDefault(), s.update());
  974. }
  975. function Ne() {
  976. if (O.length == 1)
  977. S.set(O[0].pageX, O[0].pageY);
  978. else {
  979. const A = 0.5 * (O[0].pageX + O[1].pageX), U = 0.5 * (O[0].pageY + O[1].pageY);
  980. S.set(A, U);
  981. }
  982. }
  983. function we() {
  984. if (O.length == 1)
  985. F.set(O[0].pageX, O[0].pageY);
  986. else {
  987. const A = 0.5 * (O[0].pageX + O[1].pageX), U = 0.5 * (O[0].pageY + O[1].pageY);
  988. F.set(A, U);
  989. }
  990. }
  991. function it() {
  992. const A = O[0].pageX - O[1].pageX, U = O[0].pageY - O[1].pageY, W = Math.sqrt(A * A + U * U);
  993. Y.set(0, W);
  994. }
  995. function Bn() {
  996. s.enableZoom && it(), s.enablePan && we();
  997. }
  998. function Xe() {
  999. s.enableZoom && it(), s.enableRotate && Ne();
  1000. }
  1001. function jn(A) {
  1002. if (O.length == 1)
  1003. R.set(A.pageX, A.pageY);
  1004. else {
  1005. const W = At(A), ie = 0.5 * (A.pageX + W.x), ye = 0.5 * (A.pageY + W.y);
  1006. R.set(ie, ye);
  1007. }
  1008. j2.subVectors(R, S).multiplyScalar(s.rotateSpeed);
  1009. const U = s.domElement;
  1010. U && (ue(2 * Math.PI * j2.x / U.clientHeight), ge(2 * Math.PI * j2.y / U.clientHeight)), S.copy(R);
  1011. }
  1012. function an(A) {
  1013. if (O.length == 1)
  1014. V.set(A.pageX, A.pageY);
  1015. else {
  1016. const U = At(A), W = 0.5 * (A.pageX + U.x), ie = 0.5 * (A.pageY + U.y);
  1017. V.set(W, ie);
  1018. }
  1019. D.subVectors(V, F).multiplyScalar(s.panSpeed), he(D.x, D.y), F.copy(V);
  1020. }
  1021. function dt2(A) {
  1022. const U = At(A), W = A.pageX - U.x, ie = A.pageY - U.y, ye = Math.sqrt(W * W + ie * ie);
  1023. G.set(0, ye), N.set(0, Math.pow(G.y / Y.y, s.zoomSpeed)), ee(N.y), Y.copy(G);
  1024. }
  1025. function Mt(A) {
  1026. s.enableZoom && dt2(A), s.enablePan && an(A);
  1027. }
  1028. function ze(A) {
  1029. s.enableZoom && dt2(A), s.enableRotate && jn(A);
  1030. }
  1031. function st(A) {
  1032. if (s.enabled !== false) {
  1033. if (O.length === 0) {
  1034. var U, W;
  1035. (U = s.domElement) === null || U === void 0 || U.ownerDocument.addEventListener("pointermove", ln), (W = s.domElement) === null || W === void 0 || W.ownerDocument.addEventListener("pointerup", mt);
  1036. }
  1037. Kn(A), A.pointerType === "touch" ? St(A) : hi(A);
  1038. }
  1039. }
  1040. function ln(A) {
  1041. s.enabled !== false && (A.pointerType === "touch" ? Hn(A) : Un(A));
  1042. }
  1043. function mt(A) {
  1044. if (xt(A), O.length === 0) {
  1045. var U, W, ie;
  1046. (U = s.domElement) === null || U === void 0 || U.releasePointerCapture(A.pointerId), (W = s.domElement) === null || W === void 0 || W.ownerDocument.removeEventListener("pointermove", ln), (ie = s.domElement) === null || ie === void 0 || ie.ownerDocument.removeEventListener("pointerup", mt);
  1047. }
  1048. s.dispatchEvent(u), d = h.NONE;
  1049. }
  1050. function zn(A) {
  1051. xt(A);
  1052. }
  1053. function hi(A) {
  1054. let U;
  1055. switch (A.button) {
  1056. case 0:
  1057. U = s.mouseButtons.LEFT;
  1058. break;
  1059. case 1:
  1060. U = s.mouseButtons.MIDDLE;
  1061. break;
  1062. case 2:
  1063. U = s.mouseButtons.RIGHT;
  1064. break;
  1065. default:
  1066. U = -1;
  1067. }
  1068. switch (U) {
  1069. case MOUSE.DOLLY:
  1070. if (s.enableZoom === false)
  1071. return;
  1072. fe(A), d = h.DOLLY;
  1073. break;
  1074. case MOUSE.ROTATE:
  1075. if (A.ctrlKey || A.metaKey || A.shiftKey) {
  1076. if (s.enablePan === false)
  1077. return;
  1078. ae(A), d = h.PAN;
  1079. } else {
  1080. if (s.enableRotate === false)
  1081. return;
  1082. Pe(A), d = h.ROTATE;
  1083. }
  1084. break;
  1085. case MOUSE.PAN:
  1086. if (A.ctrlKey || A.metaKey || A.shiftKey) {
  1087. if (s.enableRotate === false)
  1088. return;
  1089. Pe(A), d = h.ROTATE;
  1090. } else {
  1091. if (s.enablePan === false)
  1092. return;
  1093. ae(A), d = h.PAN;
  1094. }
  1095. break;
  1096. default:
  1097. d = h.NONE;
  1098. }
  1099. d !== h.NONE && s.dispatchEvent(c);
  1100. }
  1101. function Un(A) {
  1102. if (s.enabled !== false)
  1103. switch (d) {
  1104. case h.ROTATE:
  1105. if (s.enableRotate === false)
  1106. return;
  1107. ne(A);
  1108. break;
  1109. case h.DOLLY:
  1110. if (s.enableZoom === false)
  1111. return;
  1112. be(A);
  1113. break;
  1114. case h.PAN:
  1115. if (s.enablePan === false)
  1116. return;
  1117. M(A);
  1118. break;
  1119. }
  1120. }
  1121. function Gn(A) {
  1122. s.enabled === false || s.enableZoom === false || d !== h.NONE && d !== h.ROTATE || (A.preventDefault(), s.dispatchEvent(c), le(A), s.dispatchEvent(u));
  1123. }
  1124. function yt(A) {
  1125. s.enabled === false || s.enablePan === false || Ve(A);
  1126. }
  1127. function St(A) {
  1128. switch (ft(A), O.length) {
  1129. case 1:
  1130. switch (s.touches.ONE) {
  1131. case TOUCH.ROTATE:
  1132. if (s.enableRotate === false)
  1133. return;
  1134. Ne(), d = h.TOUCH_ROTATE;
  1135. break;
  1136. case TOUCH.PAN:
  1137. if (s.enablePan === false)
  1138. return;
  1139. we(), d = h.TOUCH_PAN;
  1140. break;
  1141. default:
  1142. d = h.NONE;
  1143. }
  1144. break;
  1145. case 2:
  1146. switch (s.touches.TWO) {
  1147. case TOUCH.DOLLY_PAN:
  1148. if (s.enableZoom === false && s.enablePan === false)
  1149. return;
  1150. Bn(), d = h.TOUCH_DOLLY_PAN;
  1151. break;
  1152. case TOUCH.DOLLY_ROTATE:
  1153. if (s.enableZoom === false && s.enableRotate === false)
  1154. return;
  1155. Xe(), d = h.TOUCH_DOLLY_ROTATE;
  1156. break;
  1157. default:
  1158. d = h.NONE;
  1159. }
  1160. break;
  1161. default:
  1162. d = h.NONE;
  1163. }
  1164. d !== h.NONE && s.dispatchEvent(c);
  1165. }
  1166. function Hn(A) {
  1167. switch (ft(A), d) {
  1168. case h.TOUCH_ROTATE:
  1169. if (s.enableRotate === false)
  1170. return;
  1171. jn(A), s.update();
  1172. break;
  1173. case h.TOUCH_PAN:
  1174. if (s.enablePan === false)
  1175. return;
  1176. an(A), s.update();
  1177. break;
  1178. case h.TOUCH_DOLLY_PAN:
  1179. if (s.enableZoom === false && s.enablePan === false)
  1180. return;
  1181. Mt(A), s.update();
  1182. break;
  1183. case h.TOUCH_DOLLY_ROTATE:
  1184. if (s.enableZoom === false && s.enableRotate === false)
  1185. return;
  1186. ze(A), s.update();
  1187. break;
  1188. default:
  1189. d = h.NONE;
  1190. }
  1191. }
  1192. function cn(A) {
  1193. s.enabled !== false && A.preventDefault();
  1194. }
  1195. function Kn(A) {
  1196. O.push(A);
  1197. }
  1198. function xt(A) {
  1199. delete H[A.pointerId];
  1200. for (let U = 0; U < O.length; U++)
  1201. if (O[U].pointerId == A.pointerId) {
  1202. O.splice(U, 1);
  1203. return;
  1204. }
  1205. }
  1206. function ft(A) {
  1207. let U = H[A.pointerId];
  1208. U === void 0 && (U = new Vector2(), H[A.pointerId] = U), U.set(A.pageX, A.pageY);
  1209. }
  1210. function At(A) {
  1211. const U = A.pointerId === O[0].pointerId ? O[1] : O[0];
  1212. return H[U.pointerId];
  1213. }
  1214. r !== void 0 && this.connect(r), this.update();
  1215. }
  1216. };
  1217. var su = class extends Loader {
  1218. constructor(i) {
  1219. super(i), this.dracoLoader = null, this.ktx2Loader = null, this.meshoptDecoder = null, this.pluginCallbacks = [], this.register(function(r) {
  1220. return new cu(r);
  1221. }), this.register(function(r) {
  1222. return new vu(r);
  1223. }), this.register(function(r) {
  1224. return new bu(r);
  1225. }), this.register(function(r) {
  1226. return new uu(r);
  1227. }), this.register(function(r) {
  1228. return new hu(r);
  1229. }), this.register(function(r) {
  1230. return new du(r);
  1231. }), this.register(function(r) {
  1232. return new mu(r);
  1233. }), this.register(function(r) {
  1234. return new lu(r);
  1235. }), this.register(function(r) {
  1236. return new fu(r);
  1237. }), this.register(function(r) {
  1238. return new pu(r);
  1239. }), this.register(function(r) {
  1240. return new ou(r);
  1241. }), this.register(function(r) {
  1242. return new gu(r);
  1243. });
  1244. }
  1245. load(i, r, s, a) {
  1246. const c = this;
  1247. let u;
  1248. this.resourcePath !== "" ? u = this.resourcePath : this.path !== "" ? u = this.path : u = LoaderUtils.extractUrlBase(i), this.manager.itemStart(i);
  1249. const h = function(g) {
  1250. a ? a(g) : console.error(g), c.manager.itemError(i), c.manager.itemEnd(i);
  1251. }, d = new FileLoader(this.manager);
  1252. d.setPath(this.path), d.setResponseType("arraybuffer"), d.setRequestHeader(this.requestHeader), d.setWithCredentials(this.withCredentials), d.load(i, function(g) {
  1253. try {
  1254. c.parse(g, u, function(w) {
  1255. r(w), c.manager.itemEnd(i);
  1256. }, h);
  1257. } catch (w) {
  1258. h(w);
  1259. }
  1260. }, s, h);
  1261. }
  1262. setDRACOLoader(i) {
  1263. return this.dracoLoader = i, this;
  1264. }
  1265. setDDSLoader() {
  1266. throw new Error('THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".');
  1267. }
  1268. setKTX2Loader(i) {
  1269. return this.ktx2Loader = i, this;
  1270. }
  1271. setMeshoptDecoder(i) {
  1272. return this.meshoptDecoder = i, this;
  1273. }
  1274. register(i) {
  1275. return this.pluginCallbacks.indexOf(i) === -1 && this.pluginCallbacks.push(i), this;
  1276. }
  1277. unregister(i) {
  1278. return this.pluginCallbacks.indexOf(i) !== -1 && this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(i), 1), this;
  1279. }
  1280. parse(i, r, s, a) {
  1281. let c;
  1282. const u = {}, h = {};
  1283. if (typeof i == "string")
  1284. c = i;
  1285. else if (LoaderUtils.decodeText(new Uint8Array(i, 0, 4)) === $a) {
  1286. try {
  1287. u[re.KHR_BINARY_GLTF] = new _u(i);
  1288. } catch (_) {
  1289. a && a(_);
  1290. return;
  1291. }
  1292. c = u[re.KHR_BINARY_GLTF].content;
  1293. } else
  1294. c = LoaderUtils.decodeText(new Uint8Array(i));
  1295. const d = JSON.parse(c);
  1296. if (d.asset === void 0 || d.asset.version[0] < 2) {
  1297. a && a(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));
  1298. return;
  1299. }
  1300. const g = new Ru(d, {
  1301. path: r || this.resourcePath || "",
  1302. crossOrigin: this.crossOrigin,
  1303. requestHeader: this.requestHeader,
  1304. manager: this.manager,
  1305. ktx2Loader: this.ktx2Loader,
  1306. meshoptDecoder: this.meshoptDecoder
  1307. });
  1308. g.fileLoader.setRequestHeader(this.requestHeader);
  1309. for (let w = 0; w < this.pluginCallbacks.length; w++) {
  1310. const _ = this.pluginCallbacks[w](g);
  1311. h[_.name] = _, u[_.name] = true;
  1312. }
  1313. if (d.extensionsUsed)
  1314. for (let w = 0; w < d.extensionsUsed.length; ++w) {
  1315. const _ = d.extensionsUsed[w], y = d.extensionsRequired || [];
  1316. switch (_) {
  1317. case re.KHR_MATERIALS_UNLIT:
  1318. u[_] = new au();
  1319. break;
  1320. case re.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:
  1321. u[_] = new xu();
  1322. break;
  1323. case re.KHR_DRACO_MESH_COMPRESSION:
  1324. u[_] = new wu(d, this.dracoLoader);
  1325. break;
  1326. case re.KHR_TEXTURE_TRANSFORM:
  1327. u[_] = new yu();
  1328. break;
  1329. case re.KHR_MESH_QUANTIZATION:
  1330. u[_] = new Eu();
  1331. break;
  1332. default:
  1333. y.indexOf(_) >= 0 && h[_] === void 0 && console.warn('THREE.GLTFLoader: Unknown extension "' + _ + '".');
  1334. }
  1335. }
  1336. g.setExtensions(u), g.setPlugins(h), g.parse(s, a);
  1337. }
  1338. parseAsync(i, r) {
  1339. const s = this;
  1340. return new Promise(function(a, c) {
  1341. s.parse(i, r, a, c);
  1342. });
  1343. }
  1344. };
  1345. function ru() {
  1346. let b = {};
  1347. return {
  1348. get: function(i) {
  1349. return b[i];
  1350. },
  1351. add: function(i, r) {
  1352. b[i] = r;
  1353. },
  1354. remove: function(i) {
  1355. delete b[i];
  1356. },
  1357. removeAll: function() {
  1358. b = {};
  1359. }
  1360. };
  1361. }
  1362. var re = {
  1363. KHR_BINARY_GLTF: "KHR_binary_glTF",
  1364. KHR_DRACO_MESH_COMPRESSION: "KHR_draco_mesh_compression",
  1365. KHR_LIGHTS_PUNCTUAL: "KHR_lights_punctual",
  1366. KHR_MATERIALS_CLEARCOAT: "KHR_materials_clearcoat",
  1367. KHR_MATERIALS_IOR: "KHR_materials_ior",
  1368. KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS: "KHR_materials_pbrSpecularGlossiness",
  1369. KHR_MATERIALS_SHEEN: "KHR_materials_sheen",
  1370. KHR_MATERIALS_SPECULAR: "KHR_materials_specular",
  1371. KHR_MATERIALS_TRANSMISSION: "KHR_materials_transmission",
  1372. KHR_MATERIALS_IRIDESCENCE: "KHR_materials_iridescence",
  1373. KHR_MATERIALS_UNLIT: "KHR_materials_unlit",
  1374. KHR_MATERIALS_VOLUME: "KHR_materials_volume",
  1375. KHR_TEXTURE_BASISU: "KHR_texture_basisu",
  1376. KHR_TEXTURE_TRANSFORM: "KHR_texture_transform",
  1377. KHR_MESH_QUANTIZATION: "KHR_mesh_quantization",
  1378. KHR_MATERIALS_EMISSIVE_STRENGTH: "KHR_materials_emissive_strength",
  1379. EXT_TEXTURE_WEBP: "EXT_texture_webp",
  1380. EXT_MESHOPT_COMPRESSION: "EXT_meshopt_compression"
  1381. };
  1382. var ou = class {
  1383. constructor(i) {
  1384. this.parser = i, this.name = re.KHR_LIGHTS_PUNCTUAL, this.cache = {
  1385. refs: {},
  1386. uses: {}
  1387. };
  1388. }
  1389. _markDefs() {
  1390. const i = this.parser, r = this.parser.json.nodes || [];
  1391. for (let s = 0, a = r.length; s < a; s++) {
  1392. const c = r[s];
  1393. c.extensions && c.extensions[this.name] && c.extensions[this.name].light !== void 0 && i._addNodeRef(this.cache, c.extensions[this.name].light);
  1394. }
  1395. }
  1396. _loadLight(i) {
  1397. const r = this.parser, s = "light:" + i;
  1398. let a = r.cache.get(s);
  1399. if (a)
  1400. return a;
  1401. const c = r.json, d = ((c.extensions && c.extensions[this.name] || {}).lights || [])[i];
  1402. let g;
  1403. const w = new Color(16777215);
  1404. d.color !== void 0 && w.fromArray(d.color);
  1405. const _ = d.range !== void 0 ? d.range : 0;
  1406. switch (d.type) {
  1407. case "directional":
  1408. g = new DirectionalLight(w), g.target.position.set(0, 0, -1), g.add(g.target);
  1409. break;
  1410. case "point":
  1411. g = new PointLight(w), g.distance = _;
  1412. break;
  1413. case "spot":
  1414. g = new SpotLight(w), g.distance = _, d.spot = d.spot || {}, d.spot.innerConeAngle = d.spot.innerConeAngle !== void 0 ? d.spot.innerConeAngle : 0, d.spot.outerConeAngle = d.spot.outerConeAngle !== void 0 ? d.spot.outerConeAngle : Math.PI / 4, g.angle = d.spot.outerConeAngle, g.penumbra = 1 - d.spot.innerConeAngle / d.spot.outerConeAngle, g.target.position.set(0, 0, -1), g.add(g.target);
  1415. break;
  1416. default:
  1417. throw new Error("THREE.GLTFLoader: Unexpected light type: " + d.type);
  1418. }
  1419. return g.position.set(0, 0, 0), g.decay = 2, d.intensity !== void 0 && (g.intensity = d.intensity), g.name = r.createUniqueName(d.name || "light_" + i), a = Promise.resolve(g), r.cache.add(s, a), a;
  1420. }
  1421. createNodeAttachment(i) {
  1422. const r = this, s = this.parser, c = s.json.nodes[i], h = (c.extensions && c.extensions[this.name] || {}).light;
  1423. return h === void 0 ? null : this._loadLight(h).then(function(d) {
  1424. return s._getNodeRef(r.cache, h, d);
  1425. });
  1426. }
  1427. };
  1428. var au = class {
  1429. constructor() {
  1430. this.name = re.KHR_MATERIALS_UNLIT;
  1431. }
  1432. getMaterialType() {
  1433. return MeshBasicMaterial;
  1434. }
  1435. extendParams(i, r, s) {
  1436. const a = [];
  1437. i.color = new Color(1, 1, 1), i.opacity = 1;
  1438. const c = r.pbrMetallicRoughness;
  1439. if (c) {
  1440. if (Array.isArray(c.baseColorFactor)) {
  1441. const u = c.baseColorFactor;
  1442. i.color.fromArray(u), i.opacity = u[3];
  1443. }
  1444. c.baseColorTexture !== void 0 && a.push(s.assignTexture(i, "map", c.baseColorTexture, sRGBEncoding));
  1445. }
  1446. return Promise.all(a);
  1447. }
  1448. };
  1449. var lu = class {
  1450. constructor(i) {
  1451. this.parser = i, this.name = re.KHR_MATERIALS_EMISSIVE_STRENGTH;
  1452. }
  1453. extendMaterialParams(i, r) {
  1454. const a = this.parser.json.materials[i];
  1455. if (!a.extensions || !a.extensions[this.name])
  1456. return Promise.resolve();
  1457. const c = a.extensions[this.name].emissiveStrength;
  1458. return c !== void 0 && (r.emissiveIntensity = c), Promise.resolve();
  1459. }
  1460. };
  1461. var cu = class {
  1462. constructor(i) {
  1463. this.parser = i, this.name = re.KHR_MATERIALS_CLEARCOAT;
  1464. }
  1465. getMaterialType(i) {
  1466. const s = this.parser.json.materials[i];
  1467. return !s.extensions || !s.extensions[this.name] ? null : MeshPhysicalMaterial;
  1468. }
  1469. extendMaterialParams(i, r) {
  1470. const s = this.parser, a = s.json.materials[i];
  1471. if (!a.extensions || !a.extensions[this.name])
  1472. return Promise.resolve();
  1473. const c = [], u = a.extensions[this.name];
  1474. if (u.clearcoatFactor !== void 0 && (r.clearcoat = u.clearcoatFactor), u.clearcoatTexture !== void 0 && c.push(s.assignTexture(r, "clearcoatMap", u.clearcoatTexture)), u.clearcoatRoughnessFactor !== void 0 && (r.clearcoatRoughness = u.clearcoatRoughnessFactor), u.clearcoatRoughnessTexture !== void 0 && c.push(s.assignTexture(r, "clearcoatRoughnessMap", u.clearcoatRoughnessTexture)), u.clearcoatNormalTexture !== void 0 && (c.push(s.assignTexture(r, "clearcoatNormalMap", u.clearcoatNormalTexture)), u.clearcoatNormalTexture.scale !== void 0)) {
  1475. const h = u.clearcoatNormalTexture.scale;
  1476. r.clearcoatNormalScale = new Vector2(h, h);
  1477. }
  1478. return Promise.all(c);
  1479. }
  1480. };
  1481. var pu = class {
  1482. constructor(i) {
  1483. this.parser = i, this.name = re.KHR_MATERIALS_IRIDESCENCE;
  1484. }
  1485. getMaterialType(i) {
  1486. const s = this.parser.json.materials[i];
  1487. return !s.extensions || !s.extensions[this.name] ? null : MeshPhysicalMaterial;
  1488. }
  1489. extendMaterialParams(i, r) {
  1490. const s = this.parser, a = s.json.materials[i];
  1491. if (!a.extensions || !a.extensions[this.name])
  1492. return Promise.resolve();
  1493. const c = [], u = a.extensions[this.name];
  1494. return u.iridescenceFactor !== void 0 && (r.iridescence = u.iridescenceFactor), u.iridescenceTexture !== void 0 && c.push(s.assignTexture(r, "iridescenceMap", u.iridescenceTexture)), u.iridescenceIor !== void 0 && (r.iridescenceIOR = u.iridescenceIor), r.iridescenceThicknessRange === void 0 && (r.iridescenceThicknessRange = [100, 400]), u.iridescenceThicknessMinimum !== void 0 && (r.iridescenceThicknessRange[0] = u.iridescenceThicknessMinimum), u.iridescenceThicknessMaximum !== void 0 && (r.iridescenceThicknessRange[1] = u.iridescenceThicknessMaximum), u.iridescenceThicknessTexture !== void 0 && c.push(s.assignTexture(r, "iridescenceThicknessMap", u.iridescenceThicknessTexture)), Promise.all(c);
  1495. }
  1496. };
  1497. var uu = class {
  1498. constructor(i) {
  1499. this.parser = i, this.name = re.KHR_MATERIALS_SHEEN;
  1500. }
  1501. getMaterialType(i) {
  1502. const s = this.parser.json.materials[i];
  1503. return !s.extensions || !s.extensions[this.name] ? null : MeshPhysicalMaterial;
  1504. }
  1505. extendMaterialParams(i, r) {
  1506. const s = this.parser, a = s.json.materials[i];
  1507. if (!a.extensions || !a.extensions[this.name])
  1508. return Promise.resolve();
  1509. const c = [];
  1510. r.sheenColor = new Color(0, 0, 0), r.sheenRoughness = 0, r.sheen = 1;
  1511. const u = a.extensions[this.name];
  1512. return u.sheenColorFactor !== void 0 && r.sheenColor.fromArray(u.sheenColorFactor), u.sheenRoughnessFactor !== void 0 && (r.sheenRoughness = u.sheenRoughnessFactor), u.sheenColorTexture !== void 0 && c.push(s.assignTexture(r, "sheenColorMap", u.sheenColorTexture, sRGBEncoding)), u.sheenRoughnessTexture !== void 0 && c.push(s.assignTexture(r, "sheenRoughnessMap", u.sheenRoughnessTexture)), Promise.all(c);
  1513. }
  1514. };
  1515. var hu = class {
  1516. constructor(i) {
  1517. this.parser = i, this.name = re.KHR_MATERIALS_TRANSMISSION;
  1518. }
  1519. getMaterialType(i) {
  1520. const s = this.parser.json.materials[i];
  1521. return !s.extensions || !s.extensions[this.name] ? null : MeshPhysicalMaterial;
  1522. }
  1523. extendMaterialParams(i, r) {
  1524. const s = this.parser, a = s.json.materials[i];
  1525. if (!a.extensions || !a.extensions[this.name])
  1526. return Promise.resolve();
  1527. const c = [], u = a.extensions[this.name];
  1528. return u.transmissionFactor !== void 0 && (r.transmission = u.transmissionFactor), u.transmissionTexture !== void 0 && c.push(s.assignTexture(r, "transmissionMap", u.transmissionTexture)), Promise.all(c);
  1529. }
  1530. };
  1531. var du = class {
  1532. constructor(i) {
  1533. this.parser = i, this.name = re.KHR_MATERIALS_VOLUME;
  1534. }
  1535. getMaterialType(i) {
  1536. const s = this.parser.json.materials[i];
  1537. return !s.extensions || !s.extensions[this.name] ? null : MeshPhysicalMaterial;
  1538. }
  1539. extendMaterialParams(i, r) {
  1540. const s = this.parser, a = s.json.materials[i];
  1541. if (!a.extensions || !a.extensions[this.name])
  1542. return Promise.resolve();
  1543. const c = [], u = a.extensions[this.name];
  1544. r.thickness = u.thicknessFactor !== void 0 ? u.thicknessFactor : 0, u.thicknessTexture !== void 0 && c.push(s.assignTexture(r, "thicknessMap", u.thicknessTexture)), r.attenuationDistance = u.attenuationDistance || 1 / 0;
  1545. const h = u.attenuationColor || [1, 1, 1];
  1546. return r.attenuationColor = new Color(h[0], h[1], h[2]), Promise.all(c);
  1547. }
  1548. };
  1549. var mu = class {
  1550. constructor(i) {
  1551. this.parser = i, this.name = re.KHR_MATERIALS_IOR;
  1552. }
  1553. getMaterialType(i) {
  1554. const s = this.parser.json.materials[i];
  1555. return !s.extensions || !s.extensions[this.name] ? null : MeshPhysicalMaterial;
  1556. }
  1557. extendMaterialParams(i, r) {
  1558. const a = this.parser.json.materials[i];
  1559. if (!a.extensions || !a.extensions[this.name])
  1560. return Promise.resolve();
  1561. const c = a.extensions[this.name];
  1562. return r.ior = c.ior !== void 0 ? c.ior : 1.5, Promise.resolve();
  1563. }
  1564. };
  1565. var fu = class {
  1566. constructor(i) {
  1567. this.parser = i, this.name = re.KHR_MATERIALS_SPECULAR;
  1568. }
  1569. getMaterialType(i) {
  1570. const s = this.parser.json.materials[i];
  1571. return !s.extensions || !s.extensions[this.name] ? null : MeshPhysicalMaterial;
  1572. }
  1573. extendMaterialParams(i, r) {
  1574. const s = this.parser, a = s.json.materials[i];
  1575. if (!a.extensions || !a.extensions[this.name])
  1576. return Promise.resolve();
  1577. const c = [], u = a.extensions[this.name];
  1578. r.specularIntensity = u.specularFactor !== void 0 ? u.specularFactor : 1, u.specularTexture !== void 0 && c.push(s.assignTexture(r, "specularIntensityMap", u.specularTexture));
  1579. const h = u.specularColorFactor || [1, 1, 1];
  1580. return r.specularColor = new Color(h[0], h[1], h[2]), u.specularColorTexture !== void 0 && c.push(s.assignTexture(r, "specularColorMap", u.specularColorTexture, sRGBEncoding)), Promise.all(c);
  1581. }
  1582. };
  1583. var vu = class {
  1584. constructor(i) {
  1585. this.parser = i, this.name = re.KHR_TEXTURE_BASISU;
  1586. }
  1587. loadTexture(i) {
  1588. const r = this.parser, s = r.json, a = s.textures[i];
  1589. if (!a.extensions || !a.extensions[this.name])
  1590. return null;
  1591. const c = a.extensions[this.name], u = r.options.ktx2Loader;
  1592. if (!u) {
  1593. if (s.extensionsRequired && s.extensionsRequired.indexOf(this.name) >= 0)
  1594. throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");
  1595. return null;
  1596. }
  1597. return r.loadTextureImage(i, c.source, u);
  1598. }
  1599. };
  1600. var bu = class {
  1601. constructor(i) {
  1602. this.parser = i, this.name = re.EXT_TEXTURE_WEBP, this.isSupported = null;
  1603. }
  1604. loadTexture(i) {
  1605. const r = this.name, s = this.parser, a = s.json, c = a.textures[i];
  1606. if (!c.extensions || !c.extensions[r])
  1607. return null;
  1608. const u = c.extensions[r], h = a.images[u.source];
  1609. let d = s.textureLoader;
  1610. if (h.uri) {
  1611. const g = s.options.manager.getHandler(h.uri);
  1612. g !== null && (d = g);
  1613. }
  1614. return this.detectSupport().then(function(g) {
  1615. if (g)
  1616. return s.loadTextureImage(i, u.source, d);
  1617. if (a.extensionsRequired && a.extensionsRequired.indexOf(r) >= 0)
  1618. throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");
  1619. return s.loadTexture(i);
  1620. });
  1621. }
  1622. detectSupport() {
  1623. return this.isSupported || (this.isSupported = new Promise(function(i) {
  1624. const r = new Image();
  1625. r.src = "data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA", r.onload = r.onerror = function() {
  1626. i(r.height === 1);
  1627. };
  1628. })), this.isSupported;
  1629. }
  1630. };
  1631. var gu = class {
  1632. constructor(i) {
  1633. this.name = re.EXT_MESHOPT_COMPRESSION, this.parser = i;
  1634. }
  1635. loadBufferView(i) {
  1636. const r = this.parser.json, s = r.bufferViews[i];
  1637. if (s.extensions && s.extensions[this.name]) {
  1638. const a = s.extensions[this.name], c = this.parser.getDependency("buffer", a.buffer), u = this.parser.options.meshoptDecoder;
  1639. if (!u || !u.supported) {
  1640. if (r.extensionsRequired && r.extensionsRequired.indexOf(this.name) >= 0)
  1641. throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");
  1642. return null;
  1643. }
  1644. return c.then(function(h) {
  1645. const d = a.byteOffset || 0, g = a.byteLength || 0, w = a.count, _ = a.byteStride, y = new Uint8Array(h, d, g);
  1646. return u.decodeGltfBufferAsync ? u.decodeGltfBufferAsync(w, _, y, a.mode, a.filter).then(function(C) {
  1647. return C.buffer;
  1648. }) : u.ready.then(function() {
  1649. const C = new ArrayBuffer(w * _);
  1650. return u.decodeGltfBuffer(new Uint8Array(C), w, _, y, a.mode, a.filter), C;
  1651. });
  1652. });
  1653. } else
  1654. return null;
  1655. }
  1656. };
  1657. var $a = "glTF";
  1658. var Gi = 12;
  1659. var aa = {
  1660. JSON: 1313821514,
  1661. BIN: 5130562
  1662. };
  1663. var _u = class {
  1664. constructor(i) {
  1665. this.name = re.KHR_BINARY_GLTF, this.content = null, this.body = null;
  1666. const r = new DataView(i, 0, Gi);
  1667. if (this.header = {
  1668. magic: LoaderUtils.decodeText(new Uint8Array(i.slice(0, 4))),
  1669. version: r.getUint32(4, true),
  1670. length: r.getUint32(8, true)
  1671. }, this.header.magic !== $a)
  1672. throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");
  1673. if (this.header.version < 2)
  1674. throw new Error("THREE.GLTFLoader: Legacy binary file detected.");
  1675. const s = this.header.length - Gi, a = new DataView(i, Gi);
  1676. let c = 0;
  1677. for (; c < s; ) {
  1678. const u = a.getUint32(c, true);
  1679. c += 4;
  1680. const h = a.getUint32(c, true);
  1681. if (c += 4, h === aa.JSON) {
  1682. const d = new Uint8Array(i, Gi + c, u);
  1683. this.content = LoaderUtils.decodeText(d);
  1684. } else if (h === aa.BIN) {
  1685. const d = Gi + c;
  1686. this.body = i.slice(d, d + u);
  1687. }
  1688. c += u;
  1689. }
  1690. if (this.content === null)
  1691. throw new Error("THREE.GLTFLoader: JSON content not found.");
  1692. }
  1693. };
  1694. var wu = class {
  1695. constructor(i, r) {
  1696. if (!r)
  1697. throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");
  1698. this.name = re.KHR_DRACO_MESH_COMPRESSION, this.json = i, this.dracoLoader = r, this.dracoLoader.preload();
  1699. }
  1700. decodePrimitive(i, r) {
  1701. const s = this.json, a = this.dracoLoader, c = i.extensions[this.name].bufferView, u = i.extensions[this.name].attributes, h = {}, d = {}, g = {};
  1702. for (const w in u) {
  1703. const _ = co[w] || w.toLowerCase();
  1704. h[_] = u[w];
  1705. }
  1706. for (const w in i.attributes) {
  1707. const _ = co[w] || w.toLowerCase();
  1708. if (u[w] !== void 0) {
  1709. const y = s.accessors[i.attributes[w]], C = Wi[y.componentType];
  1710. g[_] = C.name, d[_] = y.normalized === true;
  1711. }
  1712. }
  1713. return r.getDependency("bufferView", c).then(function(w) {
  1714. return new Promise(function(_) {
  1715. a.decodeDracoFile(w, function(y) {
  1716. for (const C in y.attributes) {
  1717. const I = y.attributes[C], S = d[C];
  1718. S !== void 0 && (I.normalized = S);
  1719. }
  1720. _(y);
  1721. }, h, g);
  1722. });
  1723. });
  1724. }
  1725. };
  1726. var yu = class {
  1727. constructor() {
  1728. this.name = re.KHR_TEXTURE_TRANSFORM;
  1729. }
  1730. extendTexture(i, r) {
  1731. return r.texCoord !== void 0 && console.warn('THREE.GLTFLoader: Custom UV sets in "' + this.name + '" extension not yet supported.'), r.offset === void 0 && r.rotation === void 0 && r.scale === void 0 || (i = i.clone(), r.offset !== void 0 && i.offset.fromArray(r.offset), r.rotation !== void 0 && (i.rotation = r.rotation), r.scale !== void 0 && i.repeat.fromArray(r.scale), i.needsUpdate = true), i;
  1732. }
  1733. };
  1734. var lo = class extends MeshStandardMaterial {
  1735. constructor(i) {
  1736. super(), this.isGLTFSpecularGlossinessMaterial = true;
  1737. const r = ["#ifdef USE_SPECULARMAP", " uniform sampler2D specularMap;", "#endif"].join(`
  1738. `), s = ["#ifdef USE_GLOSSINESSMAP", " uniform sampler2D glossinessMap;", "#endif"].join(`
  1739. `), a = ["vec3 specularFactor = specular;", "#ifdef USE_SPECULARMAP", " vec4 texelSpecular = texture2D( specularMap, vUv );", " // reads channel RGB, compatible with a glTF Specular-Glossiness (RGBA) texture", " specularFactor *= texelSpecular.rgb;", "#endif"].join(`
  1740. `), c = ["float glossinessFactor = glossiness;", "#ifdef USE_GLOSSINESSMAP", " vec4 texelGlossiness = texture2D( glossinessMap, vUv );", " // reads channel A, compatible with a glTF Specular-Glossiness (RGBA) texture", " glossinessFactor *= texelGlossiness.a;", "#endif"].join(`
  1741. `), u = ["PhysicalMaterial material;", "material.diffuseColor = diffuseColor.rgb * ( 1. - max( specularFactor.r, max( specularFactor.g, specularFactor.b ) ) );", "vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );", "float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );", "material.roughness = max( 1.0 - glossinessFactor, 0.0525 ); // 0.0525 corresponds to the base mip of a 256 cubemap.", "material.roughness += geometryRoughness;", "material.roughness = min( material.roughness, 1.0 );", "material.specularColor = specularFactor;"].join(`
  1742. `), h = {
  1743. specular: {
  1744. value: new Color().setHex(16777215)
  1745. },
  1746. glossiness: {
  1747. value: 1
  1748. },
  1749. specularMap: {
  1750. value: null
  1751. },
  1752. glossinessMap: {
  1753. value: null
  1754. }
  1755. };
  1756. this._extraUniforms = h, this.onBeforeCompile = function(d) {
  1757. for (const g in h)
  1758. d.uniforms[g] = h[g];
  1759. d.fragmentShader = d.fragmentShader.replace("uniform float roughness;", "uniform vec3 specular;").replace("uniform float metalness;", "uniform float glossiness;").replace("#include <roughnessmap_pars_fragment>", r).replace("#include <metalnessmap_pars_fragment>", s).replace("#include <roughnessmap_fragment>", a).replace("#include <metalnessmap_fragment>", c).replace("#include <lights_physical_fragment>", u);
  1760. }, Object.defineProperties(this, {
  1761. specular: {
  1762. get: function() {
  1763. return h.specular.value;
  1764. },
  1765. set: function(d) {
  1766. h.specular.value = d;
  1767. }
  1768. },
  1769. specularMap: {
  1770. get: function() {
  1771. return h.specularMap.value;
  1772. },
  1773. set: function(d) {
  1774. h.specularMap.value = d, d ? this.defines.USE_SPECULARMAP = "" : delete this.defines.USE_SPECULARMAP;
  1775. }
  1776. },
  1777. glossiness: {
  1778. get: function() {
  1779. return h.glossiness.value;
  1780. },
  1781. set: function(d) {
  1782. h.glossiness.value = d;
  1783. }
  1784. },
  1785. glossinessMap: {
  1786. get: function() {
  1787. return h.glossinessMap.value;
  1788. },
  1789. set: function(d) {
  1790. h.glossinessMap.value = d, d ? (this.defines.USE_GLOSSINESSMAP = "", this.defines.USE_UV = "") : (delete this.defines.USE_GLOSSINESSMAP, delete this.defines.USE_UV);
  1791. }
  1792. }
  1793. }), delete this.metalness, delete this.roughness, delete this.metalnessMap, delete this.roughnessMap, this.setValues(i);
  1794. }
  1795. copy(i) {
  1796. return super.copy(i), this.specularMap = i.specularMap, this.specular.copy(i.specular), this.glossinessMap = i.glossinessMap, this.glossiness = i.glossiness, delete this.metalness, delete this.roughness, delete this.metalnessMap, delete this.roughnessMap, this;
  1797. }
  1798. };
  1799. var xu = class {
  1800. constructor() {
  1801. this.name = re.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS, this.specularGlossinessParams = ["color", "map", "lightMap", "lightMapIntensity", "aoMap", "aoMapIntensity", "emissive", "emissiveIntensity", "emissiveMap", "bumpMap", "bumpScale", "normalMap", "normalMapType", "displacementMap", "displacementScale", "displacementBias", "specularMap", "specular", "glossinessMap", "glossiness", "alphaMap", "envMap", "envMapIntensity", "refractionRatio"];
  1802. }
  1803. getMaterialType() {
  1804. return lo;
  1805. }
  1806. extendParams(i, r, s) {
  1807. const a = r.extensions[this.name];
  1808. i.color = new Color(1, 1, 1), i.opacity = 1;
  1809. const c = [];
  1810. if (Array.isArray(a.diffuseFactor)) {
  1811. const u = a.diffuseFactor;
  1812. i.color.fromArray(u), i.opacity = u[3];
  1813. }
  1814. if (a.diffuseTexture !== void 0 && c.push(s.assignTexture(i, "map", a.diffuseTexture, sRGBEncoding)), i.emissive = new Color(0, 0, 0), i.glossiness = a.glossinessFactor !== void 0 ? a.glossinessFactor : 1, i.specular = new Color(1, 1, 1), Array.isArray(a.specularFactor) && i.specular.fromArray(a.specularFactor), a.specularGlossinessTexture !== void 0) {
  1815. const u = a.specularGlossinessTexture;
  1816. c.push(s.assignTexture(i, "glossinessMap", u)), c.push(s.assignTexture(i, "specularMap", u, sRGBEncoding));
  1817. }
  1818. return Promise.all(c);
  1819. }
  1820. createMaterial(i) {
  1821. const r = new lo(i);
  1822. return r.fog = true, r.color = i.color, r.map = i.map === void 0 ? null : i.map, r.lightMap = null, r.lightMapIntensity = 1, r.aoMap = i.aoMap === void 0 ? null : i.aoMap, r.aoMapIntensity = 1, r.emissive = i.emissive, r.emissiveIntensity = i.emissiveIntensity === void 0 ? 1 : i.emissiveIntensity, r.emissiveMap = i.emissiveMap === void 0 ? null : i.emissiveMap, r.bumpMap = i.bumpMap === void 0 ? null : i.bumpMap, r.bumpScale = 1, r.normalMap = i.normalMap === void 0 ? null : i.normalMap, r.normalMapType = TangentSpaceNormalMap, i.normalScale && (r.normalScale = i.normalScale), r.displacementMap = null, r.displacementScale = 1, r.displacementBias = 0, r.specularMap = i.specularMap === void 0 ? null : i.specularMap, r.specular = i.specular, r.glossinessMap = i.glossinessMap === void 0 ? null : i.glossinessMap, r.glossiness = i.glossiness, r.alphaMap = null, r.envMap = i.envMap === void 0 ? null : i.envMap, r.envMapIntensity = 1, r.refractionRatio = 0.98, r;
  1823. }
  1824. };
  1825. var Eu = class {
  1826. constructor() {
  1827. this.name = re.KHR_MESH_QUANTIZATION;
  1828. }
  1829. };
  1830. var Xa = class extends Interpolant {
  1831. constructor(i, r, s, a) {
  1832. super(i, r, s, a);
  1833. }
  1834. copySampleValue_(i) {
  1835. const r = this.resultBuffer, s = this.sampleValues, a = this.valueSize, c = i * a * 3 + a;
  1836. for (let u = 0; u !== a; u++)
  1837. r[u] = s[c + u];
  1838. return r;
  1839. }
  1840. interpolate_(i, r, s, a) {
  1841. const c = this.resultBuffer, u = this.sampleValues, h = this.valueSize, d = h * 2, g = h * 3, w = a - r, _ = (s - r) / w, y = _ * _, C = y * _, I = i * g, S = I - g, R = -2 * C + 3 * y, j2 = C - y, F = 1 - R, V = j2 - y + _;
  1842. for (let D = 0; D !== h; D++) {
  1843. const Y = u[S + D + h], G = u[S + D + d] * w, N = u[I + D + h], O = u[I + D] * w;
  1844. c[D] = F * Y + V * G + R * N + j2 * O;
  1845. }
  1846. return c;
  1847. }
  1848. };
  1849. var Cu = new Quaternion();
  1850. var Pu = class extends Xa {
  1851. interpolate_(i, r, s, a) {
  1852. const c = super.interpolate_(i, r, s, a);
  1853. return Cu.fromArray(c).normalize().toArray(c), c;
  1854. }
  1855. };
  1856. var Bt = {
  1857. FLOAT: 5126,
  1858. //FLOAT_MAT2: 35674,
  1859. FLOAT_MAT3: 35675,
  1860. FLOAT_MAT4: 35676,
  1861. FLOAT_VEC2: 35664,
  1862. FLOAT_VEC3: 35665,
  1863. FLOAT_VEC4: 35666,
  1864. LINEAR: 9729,
  1865. REPEAT: 10497,
  1866. SAMPLER_2D: 35678,
  1867. POINTS: 0,
  1868. LINES: 1,
  1869. LINE_LOOP: 2,
  1870. LINE_STRIP: 3,
  1871. TRIANGLES: 4,
  1872. TRIANGLE_STRIP: 5,
  1873. TRIANGLE_FAN: 6,
  1874. UNSIGNED_BYTE: 5121,
  1875. UNSIGNED_SHORT: 5123
  1876. };
  1877. var Wi = {
  1878. 5120: Int8Array,
  1879. 5121: Uint8Array,
  1880. 5122: Int16Array,
  1881. 5123: Uint16Array,
  1882. 5125: Uint32Array,
  1883. 5126: Float32Array
  1884. };
  1885. var la = {
  1886. 9728: NearestFilter,
  1887. 9729: LinearFilter,
  1888. 9984: NearestMipmapNearestFilter,
  1889. 9985: LinearMipmapNearestFilter,
  1890. 9986: NearestMipmapLinearFilter,
  1891. 9987: LinearMipmapLinearFilter
  1892. };
  1893. var ca = {
  1894. 33071: ClampToEdgeWrapping,
  1895. 33648: MirroredRepeatWrapping,
  1896. 10497: RepeatWrapping
  1897. };
  1898. var pa = {
  1899. SCALAR: 1,
  1900. VEC2: 2,
  1901. VEC3: 3,
  1902. VEC4: 4,
  1903. MAT2: 4,
  1904. MAT3: 9,
  1905. MAT4: 16
  1906. };
  1907. var co = {
  1908. POSITION: "position",
  1909. NORMAL: "normal",
  1910. TANGENT: "tangent",
  1911. TEXCOORD_0: "uv",
  1912. TEXCOORD_1: "uv2",
  1913. COLOR_0: "color",
  1914. WEIGHTS_0: "skinWeight",
  1915. JOINTS_0: "skinIndex"
  1916. };
  1917. var nn = {
  1918. scale: "scale",
  1919. translation: "position",
  1920. rotation: "quaternion",
  1921. weights: "morphTargetInfluences"
  1922. };
  1923. var Tu = {
  1924. CUBICSPLINE: void 0,
  1925. // We use a custom interpolant (GLTFCubicSplineInterpolation) for CUBICSPLINE tracks. Each
  1926. // keyframe track will be initialized with a default interpolation type, then modified.
  1927. LINEAR: InterpolateLinear,
  1928. STEP: InterpolateDiscrete
  1929. };
  1930. var Qr = {
  1931. OPAQUE: "OPAQUE",
  1932. MASK: "MASK",
  1933. BLEND: "BLEND"
  1934. };
  1935. function ku(b) {
  1936. return b.DefaultMaterial === void 0 && (b.DefaultMaterial = new MeshStandardMaterial({
  1937. color: 16777215,
  1938. emissive: 0,
  1939. metalness: 1,
  1940. roughness: 1,
  1941. transparent: false,
  1942. depthTest: true,
  1943. side: FrontSide
  1944. })), b.DefaultMaterial;
  1945. }
  1946. function Hi(b, i, r) {
  1947. for (const s in r.extensions)
  1948. b[s] === void 0 && (i.userData.gltfExtensions = i.userData.gltfExtensions || {}, i.userData.gltfExtensions[s] = r.extensions[s]);
  1949. }
  1950. function In(b, i) {
  1951. i.extras !== void 0 && (typeof i.extras == "object" ? Object.assign(b.userData, i.extras) : console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, " + i.extras));
  1952. }
  1953. function Mu(b, i, r) {
  1954. let s = false, a = false, c = false;
  1955. for (let g = 0, w = i.length; g < w; g++) {
  1956. const _ = i[g];
  1957. if (_.POSITION !== void 0 && (s = true), _.NORMAL !== void 0 && (a = true), _.COLOR_0 !== void 0 && (c = true), s && a && c)
  1958. break;
  1959. }
  1960. if (!s && !a && !c)
  1961. return Promise.resolve(b);
  1962. const u = [], h = [], d = [];
  1963. for (let g = 0, w = i.length; g < w; g++) {
  1964. const _ = i[g];
  1965. if (s) {
  1966. const y = _.POSITION !== void 0 ? r.getDependency("accessor", _.POSITION) : b.attributes.position;
  1967. u.push(y);
  1968. }
  1969. if (a) {
  1970. const y = _.NORMAL !== void 0 ? r.getDependency("accessor", _.NORMAL) : b.attributes.normal;
  1971. h.push(y);
  1972. }
  1973. if (c) {
  1974. const y = _.COLOR_0 !== void 0 ? r.getDependency("accessor", _.COLOR_0) : b.attributes.color;
  1975. d.push(y);
  1976. }
  1977. }
  1978. return Promise.all([Promise.all(u), Promise.all(h), Promise.all(d)]).then(function(g) {
  1979. const w = g[0], _ = g[1], y = g[2];
  1980. return s && (b.morphAttributes.position = w), a && (b.morphAttributes.normal = _), c && (b.morphAttributes.color = y), b.morphTargetsRelative = true, b;
  1981. });
  1982. }
  1983. function Su(b, i) {
  1984. if (b.updateMorphTargets(), i.weights !== void 0)
  1985. for (let r = 0, s = i.weights.length; r < s; r++)
  1986. b.morphTargetInfluences[r] = i.weights[r];
  1987. if (i.extras && Array.isArray(i.extras.targetNames)) {
  1988. const r = i.extras.targetNames;
  1989. if (b.morphTargetInfluences.length === r.length) {
  1990. b.morphTargetDictionary = {};
  1991. for (let s = 0, a = r.length; s < a; s++)
  1992. b.morphTargetDictionary[r[s]] = s;
  1993. } else
  1994. console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.");
  1995. }
  1996. }
  1997. function Au(b) {
  1998. const i = b.extensions && b.extensions[re.KHR_DRACO_MESH_COMPRESSION];
  1999. let r;
  2000. return i ? r = "draco:" + i.bufferView + ":" + i.indices + ":" + ua(i.attributes) : r = b.indices + ":" + ua(b.attributes) + ":" + b.mode, r;
  2001. }
  2002. function ua(b) {
  2003. let i = "";
  2004. const r = Object.keys(b).sort();
  2005. for (let s = 0, a = r.length; s < a; s++)
  2006. i += r[s] + ":" + b[r[s]] + ";";
  2007. return i;
  2008. }
  2009. function po(b) {
  2010. switch (b) {
  2011. case Int8Array:
  2012. return 1 / 127;
  2013. case Uint8Array:
  2014. return 1 / 255;
  2015. case Int16Array:
  2016. return 1 / 32767;
  2017. case Uint16Array:
  2018. return 1 / 65535;
  2019. default:
  2020. throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.");
  2021. }
  2022. }
  2023. function Lu(b) {
  2024. return b.search(/\.jpe?g($|\?)/i) > 0 || b.search(/^data\:image\/jpeg/) === 0 ? "image/jpeg" : b.search(/\.webp($|\?)/i) > 0 || b.search(/^data\:image\/webp/) === 0 ? "image/webp" : "image/png";
  2025. }
  2026. var Ru = class {
  2027. constructor(i = {}, r = {}) {
  2028. var s, a;
  2029. this.json = i, this.extensions = {}, this.plugins = {}, this.options = r, this.cache = new ru(), this.associations = /* @__PURE__ */ new Map(), this.primitiveCache = {}, this.meshCache = {
  2030. refs: {},
  2031. uses: {}
  2032. }, this.cameraCache = {
  2033. refs: {},
  2034. uses: {}
  2035. }, this.lightCache = {
  2036. refs: {},
  2037. uses: {}
  2038. }, this.sourceCache = {}, this.textureCache = {}, this.nodeNamesUsed = {};
  2039. const c = typeof navigator < "u" && /^((?!chrome|android).)*safari/i.test(navigator.userAgent) === true, u = typeof navigator < "u" && ((s = navigator.userAgent) === null || s === void 0 ? void 0 : s.indexOf("Firefox")) > -1, h = typeof navigator < "u" && u ? (a = navigator.userAgent) === null || a === void 0 ? void 0 : a.match(/Firefox\/([0-9]+)\./)[1] : -1;
  2040. typeof createImageBitmap > "u" || c || u && h < 98 ? this.textureLoader = new TextureLoader(this.options.manager) : this.textureLoader = new ImageBitmapLoader(this.options.manager), this.textureLoader.setCrossOrigin(this.options.crossOrigin), this.textureLoader.setRequestHeader(this.options.requestHeader), this.fileLoader = new FileLoader(this.options.manager), this.fileLoader.setResponseType("arraybuffer"), this.options.crossOrigin === "use-credentials" && this.fileLoader.setWithCredentials(true);
  2041. }
  2042. setExtensions(i) {
  2043. this.extensions = i;
  2044. }
  2045. setPlugins(i) {
  2046. this.plugins = i;
  2047. }
  2048. parse(i, r) {
  2049. const s = this, a = this.json, c = this.extensions;
  2050. this.cache.removeAll(), this._invokeAll(function(u) {
  2051. return u._markDefs && u._markDefs();
  2052. }), Promise.all(this._invokeAll(function(u) {
  2053. return u.beforeRoot && u.beforeRoot();
  2054. })).then(function() {
  2055. return Promise.all([s.getDependencies("scene"), s.getDependencies("animation"), s.getDependencies("camera")]);
  2056. }).then(function(u) {
  2057. const h = {
  2058. scene: u[0][a.scene || 0],
  2059. scenes: u[0],
  2060. animations: u[1],
  2061. cameras: u[2],
  2062. asset: a.asset,
  2063. parser: s,
  2064. userData: {}
  2065. };
  2066. Hi(c, h, a), In(h, a), Promise.all(s._invokeAll(function(d) {
  2067. return d.afterRoot && d.afterRoot(h);
  2068. })).then(function() {
  2069. i(h);
  2070. });
  2071. }).catch(r);
  2072. }
  2073. /**
  2074. * Marks the special nodes/meshes in json for efficient parse.
  2075. */
  2076. _markDefs() {
  2077. const i = this.json.nodes || [], r = this.json.skins || [], s = this.json.meshes || [];
  2078. for (let a = 0, c = r.length; a < c; a++) {
  2079. const u = r[a].joints;
  2080. for (let h = 0, d = u.length; h < d; h++)
  2081. i[u[h]].isBone = true;
  2082. }
  2083. for (let a = 0, c = i.length; a < c; a++) {
  2084. const u = i[a];
  2085. u.mesh !== void 0 && (this._addNodeRef(this.meshCache, u.mesh), u.skin !== void 0 && (s[u.mesh].isSkinnedMesh = true)), u.camera !== void 0 && this._addNodeRef(this.cameraCache, u.camera);
  2086. }
  2087. }
  2088. /**
  2089. * Counts references to shared node / Object3D resources. These resources
  2090. * can be reused, or "instantiated", at multiple nodes in the scene
  2091. * hierarchy. Mesh, Camera, and Light instances are instantiated and must
  2092. * be marked. Non-scenegraph resources (like Materials, Geometries, and
  2093. * Textures) can be reused directly and are not marked here.
  2094. *
  2095. * Example: CesiumMilkTruck sample model reuses "Wheel" meshes.
  2096. */
  2097. _addNodeRef(i, r) {
  2098. r !== void 0 && (i.refs[r] === void 0 && (i.refs[r] = i.uses[r] = 0), i.refs[r]++);
  2099. }
  2100. /** Returns a reference to a shared resource, cloning it if necessary. */
  2101. _getNodeRef(i, r, s) {
  2102. if (i.refs[r] <= 1)
  2103. return s;
  2104. const a = s.clone(), c = (u, h) => {
  2105. const d = this.associations.get(u);
  2106. d != null && this.associations.set(h, d);
  2107. for (const [g, w] of u.children.entries())
  2108. c(w, h.children[g]);
  2109. };
  2110. return c(s, a), a.name += "_instance_" + i.uses[r]++, a;
  2111. }
  2112. _invokeOne(i) {
  2113. const r = Object.values(this.plugins);
  2114. r.push(this);
  2115. for (let s = 0; s < r.length; s++) {
  2116. const a = i(r[s]);
  2117. if (a)
  2118. return a;
  2119. }
  2120. return null;
  2121. }
  2122. _invokeAll(i) {
  2123. const r = Object.values(this.plugins);
  2124. r.unshift(this);
  2125. const s = [];
  2126. for (let a = 0; a < r.length; a++) {
  2127. const c = i(r[a]);
  2128. c && s.push(c);
  2129. }
  2130. return s;
  2131. }
  2132. /**
  2133. * Requests the specified dependency asynchronously, with caching.
  2134. * @param {string} type
  2135. * @param {number} index
  2136. * @return {Promise<Object3D|Material|THREE.Texture|AnimationClip|ArrayBuffer|Object>}
  2137. */
  2138. getDependency(i, r) {
  2139. const s = i + ":" + r;
  2140. let a = this.cache.get(s);
  2141. if (!a) {
  2142. switch (i) {
  2143. case "scene":
  2144. a = this.loadScene(r);
  2145. break;
  2146. case "node":
  2147. a = this.loadNode(r);
  2148. break;
  2149. case "mesh":
  2150. a = this._invokeOne(function(c) {
  2151. return c.loadMesh && c.loadMesh(r);
  2152. });
  2153. break;
  2154. case "accessor":
  2155. a = this.loadAccessor(r);
  2156. break;
  2157. case "bufferView":
  2158. a = this._invokeOne(function(c) {
  2159. return c.loadBufferView && c.loadBufferView(r);
  2160. });
  2161. break;
  2162. case "buffer":
  2163. a = this.loadBuffer(r);
  2164. break;
  2165. case "material":
  2166. a = this._invokeOne(function(c) {
  2167. return c.loadMaterial && c.loadMaterial(r);
  2168. });
  2169. break;
  2170. case "texture":
  2171. a = this._invokeOne(function(c) {
  2172. return c.loadTexture && c.loadTexture(r);
  2173. });
  2174. break;
  2175. case "skin":
  2176. a = this.loadSkin(r);
  2177. break;
  2178. case "animation":
  2179. a = this._invokeOne(function(c) {
  2180. return c.loadAnimation && c.loadAnimation(r);
  2181. });
  2182. break;
  2183. case "camera":
  2184. a = this.loadCamera(r);
  2185. break;
  2186. default:
  2187. throw new Error("Unknown type: " + i);
  2188. }
  2189. this.cache.add(s, a);
  2190. }
  2191. return a;
  2192. }
  2193. /**
  2194. * Requests all dependencies of the specified type asynchronously, with caching.
  2195. * @param {string} type
  2196. * @return {Promise<Array<Object>>}
  2197. */
  2198. getDependencies(i) {
  2199. let r = this.cache.get(i);
  2200. if (!r) {
  2201. const s = this, a = this.json[i + (i === "mesh" ? "es" : "s")] || [];
  2202. r = Promise.all(a.map(function(c, u) {
  2203. return s.getDependency(i, u);
  2204. })), this.cache.add(i, r);
  2205. }
  2206. return r;
  2207. }
  2208. /**
  2209. * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#buffers-and-buffer-views
  2210. * @param {number} bufferIndex
  2211. * @return {Promise<ArrayBuffer>}
  2212. */
  2213. loadBuffer(i) {
  2214. const r = this.json.buffers[i], s = this.fileLoader;
  2215. if (r.type && r.type !== "arraybuffer")
  2216. throw new Error("THREE.GLTFLoader: " + r.type + " buffer type is not supported.");
  2217. if (r.uri === void 0 && i === 0)
  2218. return Promise.resolve(this.extensions[re.KHR_BINARY_GLTF].body);
  2219. const a = this.options;
  2220. return new Promise(function(c, u) {
  2221. s.load(LoaderUtils.resolveURL(r.uri, a.path), c, void 0, function() {
  2222. u(new Error('THREE.GLTFLoader: Failed to load buffer "' + r.uri + '".'));
  2223. });
  2224. });
  2225. }
  2226. /**
  2227. * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#buffers-and-buffer-views
  2228. * @param {number} bufferViewIndex
  2229. * @return {Promise<ArrayBuffer>}
  2230. */
  2231. loadBufferView(i) {
  2232. const r = this.json.bufferViews[i];
  2233. return this.getDependency("buffer", r.buffer).then(function(s) {
  2234. const a = r.byteLength || 0, c = r.byteOffset || 0;
  2235. return s.slice(c, c + a);
  2236. });
  2237. }
  2238. /**
  2239. * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#accessors
  2240. * @param {number} accessorIndex
  2241. * @return {Promise<BufferAttribute|InterleavedBufferAttribute>}
  2242. */
  2243. loadAccessor(i) {
  2244. const r = this, s = this.json, a = this.json.accessors[i];
  2245. if (a.bufferView === void 0 && a.sparse === void 0)
  2246. return Promise.resolve(null);
  2247. const c = [];
  2248. return a.bufferView !== void 0 ? c.push(this.getDependency("bufferView", a.bufferView)) : c.push(null), a.sparse !== void 0 && (c.push(this.getDependency("bufferView", a.sparse.indices.bufferView)), c.push(this.getDependency("bufferView", a.sparse.values.bufferView))), Promise.all(c).then(function(u) {
  2249. const h = u[0], d = pa[a.type], g = Wi[a.componentType], w = g.BYTES_PER_ELEMENT, _ = w * d, y = a.byteOffset || 0, C = a.bufferView !== void 0 ? s.bufferViews[a.bufferView].byteStride : void 0, I = a.normalized === true;
  2250. let S, R;
  2251. if (C && C !== _) {
  2252. const j2 = Math.floor(y / C), F = "InterleavedBuffer:" + a.bufferView + ":" + a.componentType + ":" + j2 + ":" + a.count;
  2253. let V = r.cache.get(F);
  2254. V || (S = new g(h, j2 * C, a.count * C / w), V = new InterleavedBuffer(S, C / w), r.cache.add(F, V)), R = new InterleavedBufferAttribute(V, d, y % C / w, I);
  2255. } else
  2256. h === null ? S = new g(a.count * d) : S = new g(h, y, a.count * d), R = new BufferAttribute(S, d, I);
  2257. if (a.sparse !== void 0) {
  2258. const j2 = pa.SCALAR, F = Wi[a.sparse.indices.componentType], V = a.sparse.indices.byteOffset || 0, D = a.sparse.values.byteOffset || 0, Y = new F(u[1], V, a.sparse.count * j2), G = new g(u[2], D, a.sparse.count * d);
  2259. h !== null && (R = new BufferAttribute(R.array.slice(), R.itemSize, R.normalized));
  2260. for (let N = 0, O = Y.length; N < O; N++) {
  2261. const H = Y[N];
  2262. if (R.setX(H, G[N * d]), d >= 2 && R.setY(H, G[N * d + 1]), d >= 3 && R.setZ(H, G[N * d + 2]), d >= 4 && R.setW(H, G[N * d + 3]), d >= 5)
  2263. throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.");
  2264. }
  2265. }
  2266. return R;
  2267. });
  2268. }
  2269. /**
  2270. * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#textures
  2271. * @param {number} textureIndex
  2272. * @return {Promise<THREE.Texture>}
  2273. */
  2274. loadTexture(i) {
  2275. const r = this.json, s = this.options, c = r.textures[i].source, u = r.images[c];
  2276. let h = this.textureLoader;
  2277. if (u.uri) {
  2278. const d = s.manager.getHandler(u.uri);
  2279. d !== null && (h = d);
  2280. }
  2281. return this.loadTextureImage(i, c, h);
  2282. }
  2283. loadTextureImage(i, r, s) {
  2284. const a = this, c = this.json, u = c.textures[i], h = c.images[r], d = (h.uri || h.bufferView) + ":" + u.sampler;
  2285. if (this.textureCache[d])
  2286. return this.textureCache[d];
  2287. const g = this.loadImageSource(r, s).then(function(w) {
  2288. w.flipY = false, u.name && (w.name = u.name);
  2289. const y = (c.samplers || {})[u.sampler] || {};
  2290. return w.magFilter = la[y.magFilter] || LinearFilter, w.minFilter = la[y.minFilter] || LinearMipmapLinearFilter, w.wrapS = ca[y.wrapS] || RepeatWrapping, w.wrapT = ca[y.wrapT] || RepeatWrapping, a.associations.set(w, {
  2291. textures: i
  2292. }), w;
  2293. }).catch(function() {
  2294. return null;
  2295. });
  2296. return this.textureCache[d] = g, g;
  2297. }
  2298. loadImageSource(i, r) {
  2299. const s = this, a = this.json, c = this.options;
  2300. if (this.sourceCache[i] !== void 0)
  2301. return this.sourceCache[i].then((_) => _.clone());
  2302. const u = a.images[i], h = self.URL || self.webkitURL;
  2303. let d = u.uri || "", g = false;
  2304. if (u.bufferView !== void 0)
  2305. d = s.getDependency("bufferView", u.bufferView).then(function(_) {
  2306. g = true;
  2307. const y = new Blob([_], {
  2308. type: u.mimeType
  2309. });
  2310. return d = h.createObjectURL(y), d;
  2311. });
  2312. else if (u.uri === void 0)
  2313. throw new Error("THREE.GLTFLoader: Image " + i + " is missing URI and bufferView");
  2314. const w = Promise.resolve(d).then(function(_) {
  2315. return new Promise(function(y, C) {
  2316. let I = y;
  2317. r.isImageBitmapLoader === true && (I = function(S) {
  2318. const R = new Texture(S);
  2319. R.needsUpdate = true, y(R);
  2320. }), r.load(LoaderUtils.resolveURL(_, c.path), I, void 0, C);
  2321. });
  2322. }).then(function(_) {
  2323. return g === true && h.revokeObjectURL(d), _.userData.mimeType = u.mimeType || Lu(u.uri), _;
  2324. }).catch(function(_) {
  2325. throw console.error("THREE.GLTFLoader: Couldn't load texture", d), _;
  2326. });
  2327. return this.sourceCache[i] = w, w;
  2328. }
  2329. /**
  2330. * Asynchronously assigns a texture to the given material parameters.
  2331. * @param {Object} materialParams
  2332. * @param {string} mapName
  2333. * @param {Object} mapDef
  2334. * @return {Promise<Texture>}
  2335. */
  2336. assignTexture(i, r, s, a) {
  2337. const c = this;
  2338. return this.getDependency("texture", s.index).then(function(u) {
  2339. if (s.texCoord !== void 0 && s.texCoord != 0 && !(r === "aoMap" && s.texCoord == 1) && console.warn("THREE.GLTFLoader: Custom UV set " + s.texCoord + " for texture " + r + " not yet supported."), c.extensions[re.KHR_TEXTURE_TRANSFORM]) {
  2340. const h = s.extensions !== void 0 ? s.extensions[re.KHR_TEXTURE_TRANSFORM] : void 0;
  2341. if (h) {
  2342. const d = c.associations.get(u);
  2343. u = c.extensions[re.KHR_TEXTURE_TRANSFORM].extendTexture(u, h), c.associations.set(u, d);
  2344. }
  2345. }
  2346. return a !== void 0 && (u.encoding = a), i[r] = u, u;
  2347. });
  2348. }
  2349. /**
  2350. * Assigns final material to a Mesh, Line, or Points instance. The instance
  2351. * already has a material (generated from the glTF material options alone)
  2352. * but reuse of the same glTF material may require multiple threejs materials
  2353. * to accommodate different primitive types, defines, etc. New materials will
  2354. * be created if necessary, and reused from a cache.
  2355. * @param {Object3D} mesh Mesh, Line, or Points instance.
  2356. */
  2357. assignFinalMaterial(i) {
  2358. const r = i.geometry;
  2359. let s = i.material;
  2360. const a = r.attributes.tangent === void 0, c = r.attributes.color !== void 0, u = r.attributes.normal === void 0;
  2361. if (i.isPoints) {
  2362. const h = "PointsMaterial:" + s.uuid;
  2363. let d = this.cache.get(h);
  2364. d || (d = new PointsMaterial(), Material.prototype.copy.call(d, s), d.color.copy(s.color), d.map = s.map, d.sizeAttenuation = false, this.cache.add(h, d)), s = d;
  2365. } else if (i.isLine) {
  2366. const h = "LineBasicMaterial:" + s.uuid;
  2367. let d = this.cache.get(h);
  2368. d || (d = new LineBasicMaterial(), Material.prototype.copy.call(d, s), d.color.copy(s.color), this.cache.add(h, d)), s = d;
  2369. }
  2370. if (a || c || u) {
  2371. let h = "ClonedMaterial:" + s.uuid + ":";
  2372. s.isGLTFSpecularGlossinessMaterial && (h += "specular-glossiness:"), a && (h += "derivative-tangents:"), c && (h += "vertex-colors:"), u && (h += "flat-shading:");
  2373. let d = this.cache.get(h);
  2374. d || (d = s.clone(), c && (d.vertexColors = true), u && (d.flatShading = true), a && (d.normalScale && (d.normalScale.y *= -1), d.clearcoatNormalScale && (d.clearcoatNormalScale.y *= -1)), this.cache.add(h, d), this.associations.set(d, this.associations.get(s))), s = d;
  2375. }
  2376. s.aoMap && r.attributes.uv2 === void 0 && r.attributes.uv !== void 0 && r.setAttribute("uv2", r.attributes.uv), i.material = s;
  2377. }
  2378. getMaterialType() {
  2379. return MeshStandardMaterial;
  2380. }
  2381. /**
  2382. * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#materials
  2383. * @param {number} materialIndex
  2384. * @return {Promise<Material>}
  2385. */
  2386. loadMaterial(i) {
  2387. const r = this, s = this.json, a = this.extensions, c = s.materials[i];
  2388. let u;
  2389. const h = {}, d = c.extensions || {}, g = [];
  2390. if (d[re.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS]) {
  2391. const _ = a[re.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS];
  2392. u = _.getMaterialType(), g.push(_.extendParams(h, c, r));
  2393. } else if (d[re.KHR_MATERIALS_UNLIT]) {
  2394. const _ = a[re.KHR_MATERIALS_UNLIT];
  2395. u = _.getMaterialType(), g.push(_.extendParams(h, c, r));
  2396. } else {
  2397. const _ = c.pbrMetallicRoughness || {};
  2398. if (h.color = new Color(1, 1, 1), h.opacity = 1, Array.isArray(_.baseColorFactor)) {
  2399. const y = _.baseColorFactor;
  2400. h.color.fromArray(y), h.opacity = y[3];
  2401. }
  2402. _.baseColorTexture !== void 0 && g.push(r.assignTexture(h, "map", _.baseColorTexture, sRGBEncoding)), h.metalness = _.metallicFactor !== void 0 ? _.metallicFactor : 1, h.roughness = _.roughnessFactor !== void 0 ? _.roughnessFactor : 1, _.metallicRoughnessTexture !== void 0 && (g.push(r.assignTexture(h, "metalnessMap", _.metallicRoughnessTexture)), g.push(r.assignTexture(h, "roughnessMap", _.metallicRoughnessTexture))), u = this._invokeOne(function(y) {
  2403. return y.getMaterialType && y.getMaterialType(i);
  2404. }), g.push(Promise.all(this._invokeAll(function(y) {
  2405. return y.extendMaterialParams && y.extendMaterialParams(i, h);
  2406. })));
  2407. }
  2408. c.doubleSided === true && (h.side = DoubleSide);
  2409. const w = c.alphaMode || Qr.OPAQUE;
  2410. if (w === Qr.BLEND ? (h.transparent = true, h.depthWrite = false) : (h.transparent = false, w === Qr.MASK && (h.alphaTest = c.alphaCutoff !== void 0 ? c.alphaCutoff : 0.5)), c.normalTexture !== void 0 && u !== MeshBasicMaterial && (g.push(r.assignTexture(h, "normalMap", c.normalTexture)), h.normalScale = new Vector2(1, 1), c.normalTexture.scale !== void 0)) {
  2411. const _ = c.normalTexture.scale;
  2412. h.normalScale.set(_, _);
  2413. }
  2414. return c.occlusionTexture !== void 0 && u !== MeshBasicMaterial && (g.push(r.assignTexture(h, "aoMap", c.occlusionTexture)), c.occlusionTexture.strength !== void 0 && (h.aoMapIntensity = c.occlusionTexture.strength)), c.emissiveFactor !== void 0 && u !== MeshBasicMaterial && (h.emissive = new Color().fromArray(c.emissiveFactor)), c.emissiveTexture !== void 0 && u !== MeshBasicMaterial && g.push(r.assignTexture(h, "emissiveMap", c.emissiveTexture, sRGBEncoding)), Promise.all(g).then(function() {
  2415. let _;
  2416. return u === lo ? _ = a[re.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].createMaterial(h) : _ = new u(h), c.name && (_.name = c.name), In(_, c), r.associations.set(_, {
  2417. materials: i
  2418. }), c.extensions && Hi(a, _, c), _;
  2419. });
  2420. }
  2421. /** When Object3D instances are targeted by animation, they need unique names. */
  2422. createUniqueName(i) {
  2423. const r = PropertyBinding.sanitizeNodeName(i || "");
  2424. let s = r;
  2425. for (let a = 1; this.nodeNamesUsed[s]; ++a)
  2426. s = r + "_" + a;
  2427. return this.nodeNamesUsed[s] = true, s;
  2428. }
  2429. /**
  2430. * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#geometry
  2431. *
  2432. * Creates BufferGeometries from primitives.
  2433. *
  2434. * @param {Array<GLTF.Primitive>} primitives
  2435. * @return {Promise<Array<BufferGeometry>>}
  2436. */
  2437. loadGeometries(i) {
  2438. const r = this, s = this.extensions, a = this.primitiveCache;
  2439. function c(h) {
  2440. return s[re.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(h, r).then(function(d) {
  2441. return ha(d, h, r);
  2442. });
  2443. }
  2444. const u = [];
  2445. for (let h = 0, d = i.length; h < d; h++) {
  2446. const g = i[h], w = Au(g), _ = a[w];
  2447. if (_)
  2448. u.push(_.promise);
  2449. else {
  2450. let y;
  2451. g.extensions && g.extensions[re.KHR_DRACO_MESH_COMPRESSION] ? y = c(g) : y = ha(new BufferGeometry(), g, r), a[w] = {
  2452. primitive: g,
  2453. promise: y
  2454. }, u.push(y);
  2455. }
  2456. }
  2457. return Promise.all(u);
  2458. }
  2459. /**
  2460. * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#meshes
  2461. * @param {number} meshIndex
  2462. * @return {Promise<Group|Mesh|SkinnedMesh>}
  2463. */
  2464. loadMesh(i) {
  2465. const r = this, s = this.json, a = this.extensions, c = s.meshes[i], u = c.primitives, h = [];
  2466. for (let d = 0, g = u.length; d < g; d++) {
  2467. const w = u[d].material === void 0 ? ku(this.cache) : this.getDependency("material", u[d].material);
  2468. h.push(w);
  2469. }
  2470. return h.push(r.loadGeometries(u)), Promise.all(h).then(function(d) {
  2471. const g = d.slice(0, d.length - 1), w = d[d.length - 1], _ = [];
  2472. for (let C = 0, I = w.length; C < I; C++) {
  2473. const S = w[C], R = u[C];
  2474. let j2;
  2475. const F = g[C];
  2476. if (R.mode === Bt.TRIANGLES || R.mode === Bt.TRIANGLE_STRIP || R.mode === Bt.TRIANGLE_FAN || R.mode === void 0)
  2477. j2 = c.isSkinnedMesh === true ? new SkinnedMesh(S, F) : new Mesh(S, F), j2.isSkinnedMesh === true && !j2.geometry.attributes.skinWeight.normalized && j2.normalizeSkinWeights(), R.mode === Bt.TRIANGLE_STRIP ? j2.geometry = da(j2.geometry, TriangleStripDrawMode) : R.mode === Bt.TRIANGLE_FAN && (j2.geometry = da(j2.geometry, TriangleFanDrawMode));
  2478. else if (R.mode === Bt.LINES)
  2479. j2 = new LineSegments(S, F);
  2480. else if (R.mode === Bt.LINE_STRIP)
  2481. j2 = new Line(S, F);
  2482. else if (R.mode === Bt.LINE_LOOP)
  2483. j2 = new LineLoop(S, F);
  2484. else if (R.mode === Bt.POINTS)
  2485. j2 = new Points(S, F);
  2486. else
  2487. throw new Error("THREE.GLTFLoader: Primitive mode unsupported: " + R.mode);
  2488. Object.keys(j2.geometry.morphAttributes).length > 0 && Su(j2, c), j2.name = r.createUniqueName(c.name || "mesh_" + i), In(j2, c), R.extensions && Hi(a, j2, R), r.assignFinalMaterial(j2), _.push(j2);
  2489. }
  2490. for (let C = 0, I = _.length; C < I; C++)
  2491. r.associations.set(_[C], {
  2492. meshes: i,
  2493. primitives: C
  2494. });
  2495. if (_.length === 1)
  2496. return _[0];
  2497. const y = new Group();
  2498. r.associations.set(y, {
  2499. meshes: i
  2500. });
  2501. for (let C = 0, I = _.length; C < I; C++)
  2502. y.add(_[C]);
  2503. return y;
  2504. });
  2505. }
  2506. /**
  2507. * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#cameras
  2508. * @param {number} cameraIndex
  2509. * @return {Promise<THREE.Camera>}
  2510. */
  2511. loadCamera(i) {
  2512. let r;
  2513. const s = this.json.cameras[i], a = s[s.type];
  2514. if (!a) {
  2515. console.warn("THREE.GLTFLoader: Missing camera parameters.");
  2516. return;
  2517. }
  2518. return s.type === "perspective" ? r = new PerspectiveCamera(MathUtils.radToDeg(a.yfov), a.aspectRatio || 1, a.znear || 1, a.zfar || 2e6) : s.type === "orthographic" && (r = new OrthographicCamera(-a.xmag, a.xmag, a.ymag, -a.ymag, a.znear, a.zfar)), s.name && (r.name = this.createUniqueName(s.name)), In(r, s), Promise.resolve(r);
  2519. }
  2520. /**
  2521. * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#skins
  2522. * @param {number} skinIndex
  2523. * @return {Promise<Object>}
  2524. */
  2525. loadSkin(i) {
  2526. const r = this.json.skins[i], s = {
  2527. joints: r.joints
  2528. };
  2529. return r.inverseBindMatrices === void 0 ? Promise.resolve(s) : this.getDependency("accessor", r.inverseBindMatrices).then(function(a) {
  2530. return s.inverseBindMatrices = a, s;
  2531. });
  2532. }
  2533. /**
  2534. * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#animations
  2535. * @param {number} animationIndex
  2536. * @return {Promise<AnimationClip>}
  2537. */
  2538. loadAnimation(i) {
  2539. const s = this.json.animations[i], a = [], c = [], u = [], h = [], d = [];
  2540. for (let g = 0, w = s.channels.length; g < w; g++) {
  2541. const _ = s.channels[g], y = s.samplers[_.sampler], C = _.target, I = C.node, S = s.parameters !== void 0 ? s.parameters[y.input] : y.input, R = s.parameters !== void 0 ? s.parameters[y.output] : y.output;
  2542. a.push(this.getDependency("node", I)), c.push(this.getDependency("accessor", S)), u.push(this.getDependency("accessor", R)), h.push(y), d.push(C);
  2543. }
  2544. return Promise.all([Promise.all(a), Promise.all(c), Promise.all(u), Promise.all(h), Promise.all(d)]).then(function(g) {
  2545. const w = g[0], _ = g[1], y = g[2], C = g[3], I = g[4], S = [];
  2546. for (let j2 = 0, F = w.length; j2 < F; j2++) {
  2547. const V = w[j2], D = _[j2], Y = y[j2], G = C[j2], N = I[j2];
  2548. if (V === void 0)
  2549. continue;
  2550. V.updateMatrix();
  2551. let O;
  2552. switch (nn[N.path]) {
  2553. case nn.weights:
  2554. O = NumberKeyframeTrack;
  2555. break;
  2556. case nn.rotation:
  2557. O = QuaternionKeyframeTrack;
  2558. break;
  2559. case nn.position:
  2560. case nn.scale:
  2561. default:
  2562. O = VectorKeyframeTrack;
  2563. break;
  2564. }
  2565. const H = V.name ? V.name : V.uuid, K = G.interpolation !== void 0 ? Tu[G.interpolation] : InterpolateLinear, q = [];
  2566. nn[N.path] === nn.weights ? V.traverse(function(ge) {
  2567. ge.morphTargetInfluences && q.push(ge.name ? ge.name : ge.uuid);
  2568. }) : q.push(H);
  2569. let ue = Y.array;
  2570. if (Y.normalized) {
  2571. const ge = po(ue.constructor), ce = new Float32Array(ue.length);
  2572. for (let me = 0, he = ue.length; me < he; me++)
  2573. ce[me] = ue[me] * ge;
  2574. ue = ce;
  2575. }
  2576. for (let ge = 0, ce = q.length; ge < ce; ge++) {
  2577. const me = new O(q[ge] + "." + nn[N.path], D.array, ue, K);
  2578. G.interpolation === "CUBICSPLINE" && (me.createInterpolant = function(ee) {
  2579. const X = this instanceof QuaternionKeyframeTrack ? Pu : Xa;
  2580. return new X(this.times, this.values, this.getValueSize() / 3, ee);
  2581. }, me.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline = true), S.push(me);
  2582. }
  2583. }
  2584. const R = s.name ? s.name : "animation_" + i;
  2585. return new AnimationClip(R, void 0, S);
  2586. });
  2587. }
  2588. createNodeMesh(i) {
  2589. const r = this.json, s = this, a = r.nodes[i];
  2590. return a.mesh === void 0 ? null : s.getDependency("mesh", a.mesh).then(function(c) {
  2591. const u = s._getNodeRef(s.meshCache, a.mesh, c);
  2592. return a.weights !== void 0 && u.traverse(function(h) {
  2593. if (h.isMesh)
  2594. for (let d = 0, g = a.weights.length; d < g; d++)
  2595. h.morphTargetInfluences[d] = a.weights[d];
  2596. }), u;
  2597. });
  2598. }
  2599. /**
  2600. * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#nodes-and-hierarchy
  2601. * @param {number} nodeIndex
  2602. * @return {Promise<Object3D>}
  2603. */
  2604. loadNode(i) {
  2605. const r = this.json, s = this.extensions, a = this, c = r.nodes[i], u = c.name ? a.createUniqueName(c.name) : "";
  2606. return function() {
  2607. const h = [], d = a._invokeOne(function(g) {
  2608. return g.createNodeMesh && g.createNodeMesh(i);
  2609. });
  2610. return d && h.push(d), c.camera !== void 0 && h.push(a.getDependency("camera", c.camera).then(function(g) {
  2611. return a._getNodeRef(a.cameraCache, c.camera, g);
  2612. })), a._invokeAll(function(g) {
  2613. return g.createNodeAttachment && g.createNodeAttachment(i);
  2614. }).forEach(function(g) {
  2615. h.push(g);
  2616. }), Promise.all(h);
  2617. }().then(function(h) {
  2618. let d;
  2619. if (c.isBone === true ? d = new Bone() : h.length > 1 ? d = new Group() : h.length === 1 ? d = h[0] : d = new Object3D(), d !== h[0])
  2620. for (let g = 0, w = h.length; g < w; g++)
  2621. d.add(h[g]);
  2622. if (c.name && (d.userData.name = c.name, d.name = u), In(d, c), c.extensions && Hi(s, d, c), c.matrix !== void 0) {
  2623. const g = new Matrix4();
  2624. g.fromArray(c.matrix), d.applyMatrix4(g);
  2625. } else
  2626. c.translation !== void 0 && d.position.fromArray(c.translation), c.rotation !== void 0 && d.quaternion.fromArray(c.rotation), c.scale !== void 0 && d.scale.fromArray(c.scale);
  2627. return a.associations.has(d) || a.associations.set(d, {}), a.associations.get(d).nodes = i, d;
  2628. });
  2629. }
  2630. /**
  2631. * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#scenes
  2632. * @param {number} sceneIndex
  2633. * @return {Promise<Group>}
  2634. */
  2635. loadScene(i) {
  2636. const r = this.json, s = this.extensions, a = this.json.scenes[i], c = this, u = new Group();
  2637. a.name && (u.name = c.createUniqueName(a.name)), In(u, a), a.extensions && Hi(s, u, a);
  2638. const h = a.nodes || [], d = [];
  2639. for (let g = 0, w = h.length; g < w; g++)
  2640. d.push(Ya(h[g], u, r, c));
  2641. return Promise.all(d).then(function() {
  2642. const g = (w) => {
  2643. const _ = /* @__PURE__ */ new Map();
  2644. for (const [y, C] of c.associations)
  2645. (y instanceof Material || y instanceof Texture) && _.set(y, C);
  2646. return w.traverse((y) => {
  2647. const C = c.associations.get(y);
  2648. C != null && _.set(y, C);
  2649. }), _;
  2650. };
  2651. return c.associations = g(u), u;
  2652. });
  2653. }
  2654. };
  2655. function Ya(b, i, r, s) {
  2656. const a = r.nodes[b];
  2657. return s.getDependency("node", b).then(function(c) {
  2658. if (a.skin === void 0)
  2659. return c;
  2660. let u;
  2661. return s.getDependency("skin", a.skin).then(function(h) {
  2662. u = h;
  2663. const d = [];
  2664. for (let g = 0, w = u.joints.length; g < w; g++)
  2665. d.push(s.getDependency("node", u.joints[g]));
  2666. return Promise.all(d);
  2667. }).then(function(h) {
  2668. return c.traverse(function(d) {
  2669. if (!d.isMesh)
  2670. return;
  2671. const g = [], w = [];
  2672. for (let _ = 0, y = h.length; _ < y; _++) {
  2673. const C = h[_];
  2674. if (C) {
  2675. g.push(C);
  2676. const I = new Matrix4();
  2677. u.inverseBindMatrices !== void 0 && I.fromArray(u.inverseBindMatrices.array, _ * 16), w.push(I);
  2678. } else
  2679. console.warn('THREE.GLTFLoader: Joint "%s" could not be found.', u.joints[_]);
  2680. }
  2681. d.bind(new Skeleton(g, w), d.matrixWorld);
  2682. }), c;
  2683. });
  2684. }).then(function(c) {
  2685. i.add(c);
  2686. const u = [];
  2687. if (a.children) {
  2688. const h = a.children;
  2689. for (let d = 0, g = h.length; d < g; d++) {
  2690. const w = h[d];
  2691. u.push(Ya(w, c, r, s));
  2692. }
  2693. }
  2694. return Promise.all(u);
  2695. });
  2696. }
  2697. function Iu(b, i, r) {
  2698. const s = i.attributes, a = new Box3();
  2699. if (s.POSITION !== void 0) {
  2700. const h = r.json.accessors[s.POSITION], d = h.min, g = h.max;
  2701. if (d !== void 0 && g !== void 0) {
  2702. if (a.set(new Vector3(d[0], d[1], d[2]), new Vector3(g[0], g[1], g[2])), h.normalized) {
  2703. const w = po(Wi[h.componentType]);
  2704. a.min.multiplyScalar(w), a.max.multiplyScalar(w);
  2705. }
  2706. } else {
  2707. console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");
  2708. return;
  2709. }
  2710. } else
  2711. return;
  2712. const c = i.targets;
  2713. if (c !== void 0) {
  2714. const h = new Vector3(), d = new Vector3();
  2715. for (let g = 0, w = c.length; g < w; g++) {
  2716. const _ = c[g];
  2717. if (_.POSITION !== void 0) {
  2718. const y = r.json.accessors[_.POSITION], C = y.min, I = y.max;
  2719. if (C !== void 0 && I !== void 0) {
  2720. if (d.setX(Math.max(Math.abs(C[0]), Math.abs(I[0]))), d.setY(Math.max(Math.abs(C[1]), Math.abs(I[1]))), d.setZ(Math.max(Math.abs(C[2]), Math.abs(I[2]))), y.normalized) {
  2721. const S = po(Wi[y.componentType]);
  2722. d.multiplyScalar(S);
  2723. }
  2724. h.max(d);
  2725. } else
  2726. console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");
  2727. }
  2728. }
  2729. a.expandByVector(h);
  2730. }
  2731. b.boundingBox = a;
  2732. const u = new Sphere();
  2733. a.getCenter(u.center), u.radius = a.min.distanceTo(a.max) / 2, b.boundingSphere = u;
  2734. }
  2735. function ha(b, i, r) {
  2736. const s = i.attributes, a = [];
  2737. function c(u, h) {
  2738. return r.getDependency("accessor", u).then(function(d) {
  2739. b.setAttribute(h, d);
  2740. });
  2741. }
  2742. for (const u in s) {
  2743. const h = co[u] || u.toLowerCase();
  2744. h in b.attributes || a.push(c(s[u], h));
  2745. }
  2746. if (i.indices !== void 0 && !b.index) {
  2747. const u = r.getDependency("accessor", i.indices).then(function(h) {
  2748. b.setIndex(h);
  2749. });
  2750. a.push(u);
  2751. }
  2752. return In(b, i), Iu(b, i, r), Promise.all(a).then(function() {
  2753. return i.targets !== void 0 ? Mu(b, i.targets, r) : b;
  2754. });
  2755. }
  2756. function da(b, i) {
  2757. let r = b.getIndex();
  2758. if (r === null) {
  2759. const u = [], h = b.getAttribute("position");
  2760. if (h !== void 0) {
  2761. for (let d = 0; d < h.count; d++)
  2762. u.push(d);
  2763. b.setIndex(u), r = b.getIndex();
  2764. } else
  2765. return console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."), b;
  2766. }
  2767. const s = r.count - 2, a = [];
  2768. if (i === TriangleFanDrawMode)
  2769. for (let u = 1; u <= s; u++)
  2770. a.push(r.getX(0)), a.push(r.getX(u)), a.push(r.getX(u + 1));
  2771. else
  2772. for (let u = 0; u < s; u++)
  2773. u % 2 === 0 ? (a.push(r.getX(u)), a.push(r.getX(u + 1)), a.push(r.getX(u + 2))) : (a.push(r.getX(u + 2)), a.push(r.getX(u + 1)), a.push(r.getX(u)));
  2774. a.length / 3 !== s && console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");
  2775. const c = b.clone();
  2776. return c.setIndex(a), c;
  2777. }
  2778. var Vu = class extends ExtrudeGeometry {
  2779. constructor(i, r = {}) {
  2780. const {
  2781. bevelEnabled: s = false,
  2782. bevelSize: a = 8,
  2783. bevelThickness: c = 10,
  2784. font: u,
  2785. height: h = 50,
  2786. size: d = 100,
  2787. lineHeight: g = 1,
  2788. letterSpacing: w = 0,
  2789. ..._
  2790. } = r;
  2791. if (u === void 0)
  2792. super();
  2793. else {
  2794. const y = u.generateShapes(i, d, {
  2795. lineHeight: g,
  2796. letterSpacing: w
  2797. });
  2798. super(y, {
  2799. ..._,
  2800. bevelEnabled: s,
  2801. bevelSize: a,
  2802. bevelThickness: c,
  2803. depth: h
  2804. });
  2805. }
  2806. this.type = "TextGeometry";
  2807. }
  2808. };
  2809. function qa(b, i, r) {
  2810. const s = r.length - b - 1;
  2811. if (i >= r[s])
  2812. return s - 1;
  2813. if (i <= r[b])
  2814. return b;
  2815. let a = b, c = s, u = Math.floor((a + c) / 2);
  2816. for (; i < r[u] || i >= r[u + 1]; )
  2817. i < r[u] ? c = u : a = u, u = Math.floor((a + c) / 2);
  2818. return u;
  2819. }
  2820. function Du(b, i, r, s) {
  2821. const a = [], c = [], u = [];
  2822. a[0] = 1;
  2823. for (let h = 1; h <= r; ++h) {
  2824. c[h] = i - s[b + 1 - h], u[h] = s[b + h] - i;
  2825. let d = 0;
  2826. for (let g = 0; g < h; ++g) {
  2827. const w = u[g + 1], _ = c[h - g], y = a[g] / (w + _);
  2828. a[g] = d + w * y, d = _ * y;
  2829. }
  2830. a[h] = d;
  2831. }
  2832. return a;
  2833. }
  2834. function Ou(b, i, r, s) {
  2835. const a = qa(b, s, i), c = Du(a, s, b, i), u = new Vector4(0, 0, 0, 0);
  2836. for (let h = 0; h <= b; ++h) {
  2837. const d = r[a - b + h], g = c[h], w = d.w * g;
  2838. u.x += d.x * w, u.y += d.y * w, u.z += d.z * w, u.w += d.w * g;
  2839. }
  2840. return u;
  2841. }
  2842. function Nu(b, i, r, s, a) {
  2843. const c = [];
  2844. for (let y = 0; y <= r; ++y)
  2845. c[y] = 0;
  2846. const u = [];
  2847. for (let y = 0; y <= s; ++y)
  2848. u[y] = c.slice(0);
  2849. const h = [];
  2850. for (let y = 0; y <= r; ++y)
  2851. h[y] = c.slice(0);
  2852. h[0][0] = 1;
  2853. const d = c.slice(0), g = c.slice(0);
  2854. for (let y = 1; y <= r; ++y) {
  2855. d[y] = i - a[b + 1 - y], g[y] = a[b + y] - i;
  2856. let C = 0;
  2857. for (let I = 0; I < y; ++I) {
  2858. const S = g[I + 1], R = d[y - I];
  2859. h[y][I] = S + R;
  2860. const j2 = h[I][y - 1] / h[y][I];
  2861. h[I][y] = C + S * j2, C = R * j2;
  2862. }
  2863. h[y][y] = C;
  2864. }
  2865. for (let y = 0; y <= r; ++y)
  2866. u[0][y] = h[y][r];
  2867. for (let y = 0; y <= r; ++y) {
  2868. let C = 0, I = 1;
  2869. const S = [];
  2870. for (let R = 0; R <= r; ++R)
  2871. S[R] = c.slice(0);
  2872. S[0][0] = 1;
  2873. for (let R = 1; R <= s; ++R) {
  2874. let j2 = 0;
  2875. const F = y - R, V = r - R;
  2876. y >= R && (S[I][0] = S[C][0] / h[V + 1][F], j2 = S[I][0] * h[F][V]);
  2877. const D = F >= -1 ? 1 : -F, Y = y - 1 <= V ? R - 1 : r - y;
  2878. for (let G = D; G <= Y; ++G)
  2879. S[I][G] = (S[C][G] - S[C][G - 1]) / h[V + 1][F + G], j2 += S[I][G] * h[F + G][V];
  2880. y <= V && (S[I][R] = -S[C][R - 1] / h[V + 1][y], j2 += S[I][R] * h[y][V]), u[R][y] = j2;
  2881. var w = C;
  2882. C = I, I = w;
  2883. }
  2884. }
  2885. var _ = r;
  2886. for (let y = 1; y <= s; ++y) {
  2887. for (let C = 0; C <= r; ++C)
  2888. u[y][C] *= _;
  2889. _ *= r - y;
  2890. }
  2891. return u;
  2892. }
  2893. function Fu(b, i, r, s, a) {
  2894. const c = a < b ? a : b, u = [], h = qa(b, s, i), d = Nu(h, s, b, c, i), g = [];
  2895. for (let _ = 0; _ < r.length; ++_) {
  2896. var w = r[_].clone();
  2897. const y = w.w;
  2898. w.x *= y, w.y *= y, w.z *= y, g[_] = w;
  2899. }
  2900. for (let _ = 0; _ <= c; ++_) {
  2901. var w = g[h - b].clone().multiplyScalar(d[_][0]);
  2902. for (let C = 1; C <= b; ++C)
  2903. w.add(g[h - b + C].clone().multiplyScalar(d[_][C]));
  2904. u[_] = w;
  2905. }
  2906. for (let _ = c + 1; _ <= a + 1; ++_)
  2907. u[_] = new Vector4(0, 0, 0);
  2908. return u;
  2909. }
  2910. function Bu(b, i) {
  2911. let r = 1;
  2912. for (let a = 2; a <= b; ++a)
  2913. r *= a;
  2914. let s = 1;
  2915. for (let a = 2; a <= i; ++a)
  2916. s *= a;
  2917. for (let a = 2; a <= b - i; ++a)
  2918. s *= a;
  2919. return r / s;
  2920. }
  2921. function ju(b) {
  2922. const i = b.length, r = [], s = [];
  2923. for (let c = 0; c < i; ++c) {
  2924. const u = b[c];
  2925. r[c] = new Vector3(u.x, u.y, u.z), s[c] = u.w;
  2926. }
  2927. const a = [];
  2928. for (let c = 0; c < i; ++c) {
  2929. const u = r[c].clone();
  2930. for (let h = 1; h <= c; ++h)
  2931. u.sub(a[c - h].clone().multiplyScalar(Bu(c, h) * s[h]));
  2932. a[c] = u.divideScalar(s[0]);
  2933. }
  2934. return a;
  2935. }
  2936. function zu(b, i, r, s, a) {
  2937. const c = Fu(b, i, r, s, a);
  2938. return ju(c);
  2939. }
  2940. var ma = class extends Curve {
  2941. constructor(i, r, s, a, c) {
  2942. super(), this.degree = i, this.knots = r, this.controlPoints = [], this.startKnot = a || 0, this.endKnot = c || this.knots.length - 1;
  2943. for (let u = 0; u < s.length; ++u) {
  2944. const h = s[u];
  2945. this.controlPoints[u] = new Vector4(h.x, h.y, h.z, h.w);
  2946. }
  2947. }
  2948. getPoint(i, r) {
  2949. const s = r || new Vector3(), a = this.knots[this.startKnot] + i * (this.knots[this.endKnot] - this.knots[this.startKnot]), c = Ou(this.degree, this.knots, this.controlPoints, a);
  2950. return c.w != 1 && c.divideScalar(c.w), s.set(c.x, c.y, c.z);
  2951. }
  2952. getTangent(i, r) {
  2953. const s = r || new Vector3(), a = this.knots[0] + i * (this.knots[this.knots.length - 1] - this.knots[0]), c = zu(this.degree, this.knots, this.controlPoints, a, 1);
  2954. return s.copy(c[1]).normalize(), s;
  2955. }
  2956. };
  2957. var se;
  2958. var Ae;
  2959. var We;
  2960. var Uu = class extends Loader {
  2961. constructor(i) {
  2962. super(i);
  2963. }
  2964. load(i, r, s, a) {
  2965. const c = this, u = c.path === "" ? LoaderUtils.extractUrlBase(i) : c.path, h = new FileLoader(this.manager);
  2966. h.setPath(c.path), h.setResponseType("arraybuffer"), h.setRequestHeader(c.requestHeader), h.setWithCredentials(c.withCredentials), h.load(i, function(d) {
  2967. try {
  2968. r(c.parse(d, u));
  2969. } catch (g) {
  2970. a ? a(g) : console.error(g), c.manager.itemError(i);
  2971. }
  2972. }, s, a);
  2973. }
  2974. parse(i, r) {
  2975. if (Yu(i))
  2976. se = new Xu().parse(i);
  2977. else {
  2978. const a = Ja(i);
  2979. if (!qu(a))
  2980. throw new Error("THREE.FBXLoader: Unknown format.");
  2981. if (va(a) < 7e3)
  2982. throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: " + va(a));
  2983. se = new $u().parse(a);
  2984. }
  2985. const s = new TextureLoader(this.manager).setPath(this.resourcePath || r).setCrossOrigin(this.crossOrigin);
  2986. return new Gu(s, this.manager).parse(se);
  2987. }
  2988. };
  2989. var Gu = class {
  2990. constructor(i, r) {
  2991. this.textureLoader = i, this.manager = r;
  2992. }
  2993. parse() {
  2994. Ae = this.parseConnections();
  2995. const i = this.parseImages(), r = this.parseTextures(i), s = this.parseMaterials(r), a = this.parseDeformers(), c = new Hu().parse(a);
  2996. return this.parseScene(a, c, s), We;
  2997. }
  2998. // Parses FBXTree.Connections which holds parent-child connections between objects (e.g. material -> texture, model->geometry )
  2999. // and details the connection type
  3000. parseConnections() {
  3001. const i = /* @__PURE__ */ new Map();
  3002. return "Connections" in se && se.Connections.connections.forEach(function(s) {
  3003. const a = s[0], c = s[1], u = s[2];
  3004. i.has(a) || i.set(a, {
  3005. parents: [],
  3006. children: []
  3007. });
  3008. const h = {
  3009. ID: c,
  3010. relationship: u
  3011. };
  3012. i.get(a).parents.push(h), i.has(c) || i.set(c, {
  3013. parents: [],
  3014. children: []
  3015. });
  3016. const d = {
  3017. ID: a,
  3018. relationship: u
  3019. };
  3020. i.get(c).children.push(d);
  3021. }), i;
  3022. }
  3023. // Parse FBXTree.Objects.Video for embedded image data
  3024. // These images are connected to textures in FBXTree.Objects.Textures
  3025. // via FBXTree.Connections.
  3026. parseImages() {
  3027. const i = {}, r = {};
  3028. if ("Video" in se.Objects) {
  3029. const s = se.Objects.Video;
  3030. for (const a in s) {
  3031. const c = s[a], u = parseInt(a);
  3032. if (i[u] = c.RelativeFilename || c.Filename, "Content" in c) {
  3033. const h = c.Content instanceof ArrayBuffer && c.Content.byteLength > 0, d = typeof c.Content == "string" && c.Content !== "";
  3034. if (h || d) {
  3035. const g = this.parseImage(s[a]);
  3036. r[c.RelativeFilename || c.Filename] = g;
  3037. }
  3038. }
  3039. }
  3040. }
  3041. for (const s in i) {
  3042. const a = i[s];
  3043. r[a] !== void 0 ? i[s] = r[a] : i[s] = i[s].split("\\").pop();
  3044. }
  3045. return i;
  3046. }
  3047. // Parse embedded image data in FBXTree.Video.Content
  3048. parseImage(i) {
  3049. const r = i.Content, s = i.RelativeFilename || i.Filename, a = s.slice(s.lastIndexOf(".") + 1).toLowerCase();
  3050. let c;
  3051. switch (a) {
  3052. case "bmp":
  3053. c = "image/bmp";
  3054. break;
  3055. case "jpg":
  3056. case "jpeg":
  3057. c = "image/jpeg";
  3058. break;
  3059. case "png":
  3060. c = "image/png";
  3061. break;
  3062. case "tif":
  3063. c = "image/tiff";
  3064. break;
  3065. case "tga":
  3066. this.manager.getHandler(".tga") === null && console.warn("FBXLoader: TGA loader not found, skipping ", s), c = "image/tga";
  3067. break;
  3068. default:
  3069. console.warn('FBXLoader: Image type "' + a + '" is not supported.');
  3070. return;
  3071. }
  3072. if (typeof r == "string")
  3073. return "data:" + c + ";base64," + r;
  3074. {
  3075. const u = new Uint8Array(r);
  3076. return window.URL.createObjectURL(new Blob([u], {
  3077. type: c
  3078. }));
  3079. }
  3080. }
  3081. // Parse nodes in FBXTree.Objects.Texture
  3082. // These contain details such as UV scaling, cropping, rotation etc and are connected
  3083. // to images in FBXTree.Objects.Video
  3084. parseTextures(i) {
  3085. const r = /* @__PURE__ */ new Map();
  3086. if ("Texture" in se.Objects) {
  3087. const s = se.Objects.Texture;
  3088. for (const a in s) {
  3089. const c = this.parseTexture(s[a], i);
  3090. r.set(parseInt(a), c);
  3091. }
  3092. }
  3093. return r;
  3094. }
  3095. // Parse individual node in FBXTree.Objects.Texture
  3096. parseTexture(i, r) {
  3097. const s = this.loadTexture(i, r);
  3098. s.ID = i.id, s.name = i.attrName;
  3099. const a = i.WrapModeU, c = i.WrapModeV, u = a !== void 0 ? a.value : 0, h = c !== void 0 ? c.value : 0;
  3100. if (s.wrapS = u === 0 ? RepeatWrapping : ClampToEdgeWrapping, s.wrapT = h === 0 ? RepeatWrapping : ClampToEdgeWrapping, "Scaling" in i) {
  3101. const d = i.Scaling.value;
  3102. s.repeat.x = d[0], s.repeat.y = d[1];
  3103. }
  3104. return s;
  3105. }
  3106. // load a texture specified as a blob or data URI, or via an external URL using TextureLoader
  3107. loadTexture(i, r) {
  3108. let s;
  3109. const a = this.textureLoader.path, c = Ae.get(i.id).children;
  3110. c !== void 0 && c.length > 0 && r[c[0].ID] !== void 0 && (s = r[c[0].ID], (s.indexOf("blob:") === 0 || s.indexOf("data:") === 0) && this.textureLoader.setPath(void 0));
  3111. let u;
  3112. const h = i.FileName.slice(-3).toLowerCase();
  3113. if (h === "tga") {
  3114. const d = this.manager.getHandler(".tga");
  3115. d === null ? (console.warn("FBXLoader: TGA loader not found, creating placeholder texture for", i.RelativeFilename), u = new Texture()) : (d.setPath(this.textureLoader.path), u = d.load(s));
  3116. } else
  3117. h === "psd" ? (console.warn("FBXLoader: PSD textures are not supported, creating placeholder texture for", i.RelativeFilename), u = new Texture()) : u = this.textureLoader.load(s);
  3118. return this.textureLoader.setPath(a), u;
  3119. }
  3120. // Parse nodes in FBXTree.Objects.Material
  3121. parseMaterials(i) {
  3122. const r = /* @__PURE__ */ new Map();
  3123. if ("Material" in se.Objects) {
  3124. const s = se.Objects.Material;
  3125. for (const a in s) {
  3126. const c = this.parseMaterial(s[a], i);
  3127. c !== null && r.set(parseInt(a), c);
  3128. }
  3129. }
  3130. return r;
  3131. }
  3132. // Parse single node in FBXTree.Objects.Material
  3133. // Materials are connected to texture maps in FBXTree.Objects.Textures
  3134. // FBX format currently only supports Lambert and Phong shading models
  3135. parseMaterial(i, r) {
  3136. const s = i.id, a = i.attrName;
  3137. let c = i.ShadingModel;
  3138. if (typeof c == "object" && (c = c.value), !Ae.has(s))
  3139. return null;
  3140. const u = this.parseParameters(i, r, s);
  3141. let h;
  3142. switch (c.toLowerCase()) {
  3143. case "phong":
  3144. h = new MeshPhongMaterial();
  3145. break;
  3146. case "lambert":
  3147. h = new MeshLambertMaterial();
  3148. break;
  3149. default:
  3150. console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.', c), h = new MeshPhongMaterial();
  3151. break;
  3152. }
  3153. return h.setValues(u), h.name = a, h;
  3154. }
  3155. // Parse FBX material and return parameters suitable for a three.js material
  3156. // Also parse the texture map and return any textures associated with the material
  3157. parseParameters(i, r, s) {
  3158. const a = {};
  3159. i.BumpFactor && (a.bumpScale = i.BumpFactor.value), i.Diffuse ? a.color = new Color().fromArray(i.Diffuse.value) : i.DiffuseColor && (i.DiffuseColor.type === "Color" || i.DiffuseColor.type === "ColorRGB") && (a.color = new Color().fromArray(i.DiffuseColor.value)), i.DisplacementFactor && (a.displacementScale = i.DisplacementFactor.value), i.Emissive ? a.emissive = new Color().fromArray(i.Emissive.value) : i.EmissiveColor && (i.EmissiveColor.type === "Color" || i.EmissiveColor.type === "ColorRGB") && (a.emissive = new Color().fromArray(i.EmissiveColor.value)), i.EmissiveFactor && (a.emissiveIntensity = parseFloat(i.EmissiveFactor.value)), i.Opacity && (a.opacity = parseFloat(i.Opacity.value)), a.opacity < 1 && (a.transparent = true), i.ReflectionFactor && (a.reflectivity = i.ReflectionFactor.value), i.Shininess && (a.shininess = i.Shininess.value), i.Specular ? a.specular = new Color().fromArray(i.Specular.value) : i.SpecularColor && i.SpecularColor.type === "Color" && (a.specular = new Color().fromArray(i.SpecularColor.value));
  3160. const c = this;
  3161. return Ae.get(s).children.forEach(function(u) {
  3162. const h = u.relationship;
  3163. switch (h) {
  3164. case "Bump":
  3165. a.bumpMap = c.getTexture(r, u.ID);
  3166. break;
  3167. case "Maya|TEX_ao_map":
  3168. a.aoMap = c.getTexture(r, u.ID);
  3169. break;
  3170. case "DiffuseColor":
  3171. case "Maya|TEX_color_map":
  3172. a.map = c.getTexture(r, u.ID), a.map !== void 0 && (a.map.encoding = sRGBEncoding);
  3173. break;
  3174. case "DisplacementColor":
  3175. a.displacementMap = c.getTexture(r, u.ID);
  3176. break;
  3177. case "EmissiveColor":
  3178. a.emissiveMap = c.getTexture(r, u.ID), a.emissiveMap !== void 0 && (a.emissiveMap.encoding = sRGBEncoding);
  3179. break;
  3180. case "NormalMap":
  3181. case "Maya|TEX_normal_map":
  3182. a.normalMap = c.getTexture(r, u.ID);
  3183. break;
  3184. case "ReflectionColor":
  3185. a.envMap = c.getTexture(r, u.ID), a.envMap !== void 0 && (a.envMap.mapping = EquirectangularReflectionMapping, a.envMap.encoding = sRGBEncoding);
  3186. break;
  3187. case "SpecularColor":
  3188. a.specularMap = c.getTexture(r, u.ID), a.specularMap !== void 0 && (a.specularMap.encoding = sRGBEncoding);
  3189. break;
  3190. case "TransparentColor":
  3191. case "TransparencyFactor":
  3192. a.alphaMap = c.getTexture(r, u.ID), a.transparent = true;
  3193. break;
  3194. case "AmbientColor":
  3195. case "ShininessExponent":
  3196. case "SpecularFactor":
  3197. case "VectorDisplacementColor":
  3198. default:
  3199. console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.", h);
  3200. break;
  3201. }
  3202. }), a;
  3203. }
  3204. // get a texture from the textureMap for use by a material.
  3205. getTexture(i, r) {
  3206. return "LayeredTexture" in se.Objects && r in se.Objects.LayeredTexture && (console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."), r = Ae.get(r).children[0].ID), i.get(r);
  3207. }
  3208. // Parse nodes in FBXTree.Objects.Deformer
  3209. // Deformer node can contain skinning or Vertex Cache animation data, however only skinning is supported here
  3210. // Generates map of Skeleton-like objects for use later when generating and binding skeletons.
  3211. parseDeformers() {
  3212. const i = {}, r = {};
  3213. if ("Deformer" in se.Objects) {
  3214. const s = se.Objects.Deformer;
  3215. for (const a in s) {
  3216. const c = s[a], u = Ae.get(parseInt(a));
  3217. if (c.attrType === "Skin") {
  3218. const h = this.parseSkeleton(u, s);
  3219. h.ID = a, u.parents.length > 1 && console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."), h.geometryID = u.parents[0].ID, i[a] = h;
  3220. } else if (c.attrType === "BlendShape") {
  3221. const h = {
  3222. id: a
  3223. };
  3224. h.rawTargets = this.parseMorphTargets(u, s), h.id = a, u.parents.length > 1 && console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."), r[a] = h;
  3225. }
  3226. }
  3227. }
  3228. return {
  3229. skeletons: i,
  3230. morphTargets: r
  3231. };
  3232. }
  3233. // Parse single nodes in FBXTree.Objects.Deformer
  3234. // The top level skeleton node has type 'Skin' and sub nodes have type 'Cluster'
  3235. // Each skin node represents a skeleton and each cluster node represents a bone
  3236. parseSkeleton(i, r) {
  3237. const s = [];
  3238. return i.children.forEach(function(a) {
  3239. const c = r[a.ID];
  3240. if (c.attrType !== "Cluster")
  3241. return;
  3242. const u = {
  3243. ID: a.ID,
  3244. indices: [],
  3245. weights: [],
  3246. transformLink: new Matrix4().fromArray(c.TransformLink.a)
  3247. // transform: new Matrix4().fromArray( boneNode.Transform.a ),
  3248. // linkMode: boneNode.Mode,
  3249. };
  3250. "Indexes" in c && (u.indices = c.Indexes.a, u.weights = c.Weights.a), s.push(u);
  3251. }), {
  3252. rawBones: s,
  3253. bones: []
  3254. };
  3255. }
  3256. // The top level morph deformer node has type "BlendShape" and sub nodes have type "BlendShapeChannel"
  3257. parseMorphTargets(i, r) {
  3258. const s = [];
  3259. for (let a = 0; a < i.children.length; a++) {
  3260. const c = i.children[a], u = r[c.ID], h = {
  3261. name: u.attrName,
  3262. initialWeight: u.DeformPercent,
  3263. id: u.id,
  3264. fullWeights: u.FullWeights.a
  3265. };
  3266. if (u.attrType !== "BlendShapeChannel")
  3267. return;
  3268. h.geoID = Ae.get(parseInt(c.ID)).children.filter(function(d) {
  3269. return d.relationship === void 0;
  3270. })[0].ID, s.push(h);
  3271. }
  3272. return s;
  3273. }
  3274. // create the main Group() to be returned by the loader
  3275. parseScene(i, r, s) {
  3276. We = new Group();
  3277. const a = this.parseModels(i.skeletons, r, s), c = se.Objects.Model, u = this;
  3278. a.forEach(function(d) {
  3279. const g = c[d.ID];
  3280. u.setLookAtProperties(d, g), Ae.get(d.ID).parents.forEach(function(_) {
  3281. const y = a.get(_.ID);
  3282. y !== void 0 && y.add(d);
  3283. }), d.parent === null && We.add(d);
  3284. }), this.bindSkeleton(i.skeletons, r, a), this.createAmbientLight(), We.traverse(function(d) {
  3285. if (d.userData.transformData) {
  3286. d.parent && (d.userData.transformData.parentMatrix = d.parent.matrix, d.userData.transformData.parentMatrixWorld = d.parent.matrixWorld);
  3287. const g = Za(d.userData.transformData);
  3288. d.applyMatrix4(g), d.updateWorldMatrix();
  3289. }
  3290. });
  3291. const h = new Ku().parse();
  3292. We.children.length === 1 && We.children[0].isGroup && (We.children[0].animations = h, We = We.children[0]), We.animations = h;
  3293. }
  3294. // parse nodes in FBXTree.Objects.Model
  3295. parseModels(i, r, s) {
  3296. const a = /* @__PURE__ */ new Map(), c = se.Objects.Model;
  3297. for (const u in c) {
  3298. const h = parseInt(u), d = c[u], g = Ae.get(h);
  3299. let w = this.buildSkeleton(g, i, h, d.attrName);
  3300. if (!w) {
  3301. switch (d.attrType) {
  3302. case "Camera":
  3303. w = this.createCamera(g);
  3304. break;
  3305. case "Light":
  3306. w = this.createLight(g);
  3307. break;
  3308. case "Mesh":
  3309. w = this.createMesh(g, r, s);
  3310. break;
  3311. case "NurbsCurve":
  3312. w = this.createCurve(g, r);
  3313. break;
  3314. case "LimbNode":
  3315. case "Root":
  3316. w = new Bone();
  3317. break;
  3318. case "Null":
  3319. default:
  3320. w = new Group();
  3321. break;
  3322. }
  3323. w.name = d.attrName ? PropertyBinding.sanitizeNodeName(d.attrName) : "", w.ID = h;
  3324. }
  3325. this.getTransformData(w, d), a.set(h, w);
  3326. }
  3327. return a;
  3328. }
  3329. buildSkeleton(i, r, s, a) {
  3330. let c = null;
  3331. return i.parents.forEach(function(u) {
  3332. for (const h in r) {
  3333. const d = r[h];
  3334. d.rawBones.forEach(function(g, w) {
  3335. if (g.ID === u.ID) {
  3336. const _ = c;
  3337. c = new Bone(), c.matrixWorld.copy(g.transformLink), c.name = a ? PropertyBinding.sanitizeNodeName(a) : "", c.ID = s, d.bones[w] = c, _ !== null && c.add(_);
  3338. }
  3339. });
  3340. }
  3341. }), c;
  3342. }
  3343. // create a PerspectiveCamera or OrthographicCamera
  3344. createCamera(i) {
  3345. let r, s;
  3346. if (i.children.forEach(function(a) {
  3347. const c = se.Objects.NodeAttribute[a.ID];
  3348. c !== void 0 && (s = c);
  3349. }), s === void 0)
  3350. r = new Object3D();
  3351. else {
  3352. let a = 0;
  3353. s.CameraProjectionType !== void 0 && s.CameraProjectionType.value === 1 && (a = 1);
  3354. let c = 1;
  3355. s.NearPlane !== void 0 && (c = s.NearPlane.value / 1e3);
  3356. let u = 1e3;
  3357. s.FarPlane !== void 0 && (u = s.FarPlane.value / 1e3);
  3358. let h = window.innerWidth, d = window.innerHeight;
  3359. s.AspectWidth !== void 0 && s.AspectHeight !== void 0 && (h = s.AspectWidth.value, d = s.AspectHeight.value);
  3360. const g = h / d;
  3361. let w = 45;
  3362. s.FieldOfView !== void 0 && (w = s.FieldOfView.value);
  3363. const _ = s.FocalLength ? s.FocalLength.value : null;
  3364. switch (a) {
  3365. case 0:
  3366. r = new PerspectiveCamera(w, g, c, u), _ !== null && r.setFocalLength(_);
  3367. break;
  3368. case 1:
  3369. r = new OrthographicCamera(-h / 2, h / 2, d / 2, -d / 2, c, u);
  3370. break;
  3371. default:
  3372. console.warn("THREE.FBXLoader: Unknown camera type " + a + "."), r = new Object3D();
  3373. break;
  3374. }
  3375. }
  3376. return r;
  3377. }
  3378. // Create a DirectionalLight, PointLight or SpotLight
  3379. createLight(i) {
  3380. let r, s;
  3381. if (i.children.forEach(function(a) {
  3382. const c = se.Objects.NodeAttribute[a.ID];
  3383. c !== void 0 && (s = c);
  3384. }), s === void 0)
  3385. r = new Object3D();
  3386. else {
  3387. let a;
  3388. s.LightType === void 0 ? a = 0 : a = s.LightType.value;
  3389. let c = 16777215;
  3390. s.Color !== void 0 && (c = new Color().fromArray(s.Color.value));
  3391. let u = s.Intensity === void 0 ? 1 : s.Intensity.value / 100;
  3392. s.CastLightOnObject !== void 0 && s.CastLightOnObject.value === 0 && (u = 0);
  3393. let h = 0;
  3394. s.FarAttenuationEnd !== void 0 && (s.EnableFarAttenuation !== void 0 && s.EnableFarAttenuation.value === 0 ? h = 0 : h = s.FarAttenuationEnd.value);
  3395. const d = 1;
  3396. switch (a) {
  3397. case 0:
  3398. r = new PointLight(c, u, h, d);
  3399. break;
  3400. case 1:
  3401. r = new DirectionalLight(c, u);
  3402. break;
  3403. case 2:
  3404. let g = Math.PI / 3;
  3405. s.InnerAngle !== void 0 && (g = MathUtils.degToRad(s.InnerAngle.value));
  3406. let w = 0;
  3407. s.OuterAngle !== void 0 && (w = MathUtils.degToRad(s.OuterAngle.value), w = Math.max(w, 1)), r = new SpotLight(c, u, h, g, w, d);
  3408. break;
  3409. default:
  3410. console.warn("THREE.FBXLoader: Unknown light type " + s.LightType.value + ", defaulting to a PointLight."), r = new PointLight(c, u);
  3411. break;
  3412. }
  3413. s.CastShadows !== void 0 && s.CastShadows.value === 1 && (r.castShadow = true);
  3414. }
  3415. return r;
  3416. }
  3417. createMesh(i, r, s) {
  3418. let a, c = null, u = null;
  3419. const h = [];
  3420. return i.children.forEach(function(d) {
  3421. r.has(d.ID) && (c = r.get(d.ID)), s.has(d.ID) && h.push(s.get(d.ID));
  3422. }), h.length > 1 ? u = h : h.length > 0 ? u = h[0] : (u = new MeshPhongMaterial({
  3423. color: 13421772
  3424. }), h.push(u)), "color" in c.attributes && h.forEach(function(d) {
  3425. d.vertexColors = true;
  3426. }), c.FBX_Deformer ? (a = new SkinnedMesh(c, u), a.normalizeSkinWeights()) : a = new Mesh(c, u), a;
  3427. }
  3428. createCurve(i, r) {
  3429. const s = i.children.reduce(function(c, u) {
  3430. return r.has(u.ID) && (c = r.get(u.ID)), c;
  3431. }, null), a = new LineBasicMaterial({
  3432. color: 3342591,
  3433. linewidth: 1
  3434. });
  3435. return new Line(s, a);
  3436. }
  3437. // parse the model node for transform data
  3438. getTransformData(i, r) {
  3439. const s = {};
  3440. "InheritType" in r && (s.inheritType = parseInt(r.InheritType.value)), "RotationOrder" in r ? s.eulerOrder = Wa(r.RotationOrder.value) : s.eulerOrder = "ZYX", "Lcl_Translation" in r && (s.translation = r.Lcl_Translation.value), "PreRotation" in r && (s.preRotation = r.PreRotation.value), "Lcl_Rotation" in r && (s.rotation = r.Lcl_Rotation.value), "PostRotation" in r && (s.postRotation = r.PostRotation.value), "Lcl_Scaling" in r && (s.scale = r.Lcl_Scaling.value), "ScalingOffset" in r && (s.scalingOffset = r.ScalingOffset.value), "ScalingPivot" in r && (s.scalingPivot = r.ScalingPivot.value), "RotationOffset" in r && (s.rotationOffset = r.RotationOffset.value), "RotationPivot" in r && (s.rotationPivot = r.RotationPivot.value), i.userData.transformData = s;
  3441. }
  3442. setLookAtProperties(i, r) {
  3443. "LookAtProperty" in r && Ae.get(i.ID).children.forEach(function(a) {
  3444. if (a.relationship === "LookAtProperty") {
  3445. const c = se.Objects.Model[a.ID];
  3446. if ("Lcl_Translation" in c) {
  3447. const u = c.Lcl_Translation.value;
  3448. i.target !== void 0 ? (i.target.position.fromArray(u), We.add(i.target)) : i.lookAt(new Vector3().fromArray(u));
  3449. }
  3450. }
  3451. });
  3452. }
  3453. bindSkeleton(i, r, s) {
  3454. const a = this.parsePoseNodes();
  3455. for (const c in i) {
  3456. const u = i[c];
  3457. Ae.get(parseInt(u.ID)).parents.forEach(function(d) {
  3458. if (r.has(d.ID)) {
  3459. const g = d.ID;
  3460. Ae.get(g).parents.forEach(function(_) {
  3461. s.has(_.ID) && s.get(_.ID).bind(new Skeleton(u.bones), a[_.ID]);
  3462. });
  3463. }
  3464. });
  3465. }
  3466. }
  3467. parsePoseNodes() {
  3468. const i = {};
  3469. if ("Pose" in se.Objects) {
  3470. const r = se.Objects.Pose;
  3471. for (const s in r)
  3472. if (r[s].attrType === "BindPose" && r[s].NbPoseNodes > 0) {
  3473. const a = r[s].PoseNode;
  3474. Array.isArray(a) ? a.forEach(function(c) {
  3475. i[c.Node] = new Matrix4().fromArray(c.Matrix.a);
  3476. }) : i[a.Node] = new Matrix4().fromArray(a.Matrix.a);
  3477. }
  3478. }
  3479. return i;
  3480. }
  3481. // Parse ambient color in FBXTree.GlobalSettings - if it's not set to black (default), create an ambient light
  3482. createAmbientLight() {
  3483. if ("GlobalSettings" in se && "AmbientColor" in se.GlobalSettings) {
  3484. const i = se.GlobalSettings.AmbientColor.value, r = i[0], s = i[1], a = i[2];
  3485. if (r !== 0 || s !== 0 || a !== 0) {
  3486. const c = new Color(r, s, a);
  3487. We.add(new AmbientLight(c, 1));
  3488. }
  3489. }
  3490. }
  3491. };
  3492. var Hu = class {
  3493. // Parse nodes in FBXTree.Objects.Geometry
  3494. parse(i) {
  3495. const r = /* @__PURE__ */ new Map();
  3496. if ("Geometry" in se.Objects) {
  3497. const s = se.Objects.Geometry;
  3498. for (const a in s) {
  3499. const c = Ae.get(parseInt(a)), u = this.parseGeometry(c, s[a], i);
  3500. r.set(parseInt(a), u);
  3501. }
  3502. }
  3503. return r;
  3504. }
  3505. // Parse single node in FBXTree.Objects.Geometry
  3506. parseGeometry(i, r, s) {
  3507. switch (r.attrType) {
  3508. case "Mesh":
  3509. return this.parseMeshGeometry(i, r, s);
  3510. case "NurbsCurve":
  3511. return this.parseNurbsGeometry(r);
  3512. }
  3513. }
  3514. // Parse single node mesh geometry in FBXTree.Objects.Geometry
  3515. parseMeshGeometry(i, r, s) {
  3516. const a = s.skeletons, c = [], u = i.parents.map(function(_) {
  3517. return se.Objects.Model[_.ID];
  3518. });
  3519. if (u.length === 0)
  3520. return;
  3521. const h = i.children.reduce(function(_, y) {
  3522. return a[y.ID] !== void 0 && (_ = a[y.ID]), _;
  3523. }, null);
  3524. i.children.forEach(function(_) {
  3525. s.morphTargets[_.ID] !== void 0 && c.push(s.morphTargets[_.ID]);
  3526. });
  3527. const d = u[0], g = {};
  3528. "RotationOrder" in d && (g.eulerOrder = Wa(d.RotationOrder.value)), "InheritType" in d && (g.inheritType = parseInt(d.InheritType.value)), "GeometricTranslation" in d && (g.translation = d.GeometricTranslation.value), "GeometricRotation" in d && (g.rotation = d.GeometricRotation.value), "GeometricScaling" in d && (g.scale = d.GeometricScaling.value);
  3529. const w = Za(g);
  3530. return this.genGeometry(r, h, c, w);
  3531. }
  3532. // Generate a BufferGeometry from a node in FBXTree.Objects.Geometry
  3533. genGeometry(i, r, s, a) {
  3534. const c = new BufferGeometry();
  3535. i.attrName && (c.name = i.attrName);
  3536. const u = this.parseGeoNode(i, r), h = this.genBuffers(u), d = new Float32BufferAttribute(h.vertex, 3);
  3537. if (d.applyMatrix4(a), c.setAttribute("position", d), h.colors.length > 0 && c.setAttribute("color", new Float32BufferAttribute(h.colors, 3)), r && (c.setAttribute("skinIndex", new Uint16BufferAttribute(h.weightsIndices, 4)), c.setAttribute("skinWeight", new Float32BufferAttribute(h.vertexWeights, 4)), c.FBX_Deformer = r), h.normal.length > 0) {
  3538. const g = new Matrix3().getNormalMatrix(a), w = new Float32BufferAttribute(h.normal, 3);
  3539. w.applyNormalMatrix(g), c.setAttribute("normal", w);
  3540. }
  3541. if (h.uvs.forEach(function(g, w) {
  3542. let _ = "uv" + (w + 1).toString();
  3543. w === 0 && (_ = "uv"), c.setAttribute(_, new Float32BufferAttribute(h.uvs[w], 2));
  3544. }), u.material && u.material.mappingType !== "AllSame") {
  3545. let g = h.materialIndex[0], w = 0;
  3546. if (h.materialIndex.forEach(function(_, y) {
  3547. _ !== g && (c.addGroup(w, y - w, g), g = _, w = y);
  3548. }), c.groups.length > 0) {
  3549. const _ = c.groups[c.groups.length - 1], y = _.start + _.count;
  3550. y !== h.materialIndex.length && c.addGroup(y, h.materialIndex.length - y, g);
  3551. }
  3552. c.groups.length === 0 && c.addGroup(0, h.materialIndex.length, h.materialIndex[0]);
  3553. }
  3554. return this.addMorphTargets(c, i, s, a), c;
  3555. }
  3556. parseGeoNode(i, r) {
  3557. const s = {};
  3558. if (s.vertexPositions = i.Vertices !== void 0 ? i.Vertices.a : [], s.vertexIndices = i.PolygonVertexIndex !== void 0 ? i.PolygonVertexIndex.a : [], i.LayerElementColor && (s.color = this.parseVertexColors(i.LayerElementColor[0])), i.LayerElementMaterial && (s.material = this.parseMaterialIndices(i.LayerElementMaterial[0])), i.LayerElementNormal && (s.normal = this.parseNormals(i.LayerElementNormal[0])), i.LayerElementUV) {
  3559. s.uv = [];
  3560. let a = 0;
  3561. for (; i.LayerElementUV[a]; )
  3562. i.LayerElementUV[a].UV && s.uv.push(this.parseUVs(i.LayerElementUV[a])), a++;
  3563. }
  3564. return s.weightTable = {}, r !== null && (s.skeleton = r, r.rawBones.forEach(function(a, c) {
  3565. a.indices.forEach(function(u, h) {
  3566. s.weightTable[u] === void 0 && (s.weightTable[u] = []), s.weightTable[u].push({
  3567. id: c,
  3568. weight: a.weights[h]
  3569. });
  3570. });
  3571. })), s;
  3572. }
  3573. genBuffers(i) {
  3574. const r = {
  3575. vertex: [],
  3576. normal: [],
  3577. colors: [],
  3578. uvs: [],
  3579. materialIndex: [],
  3580. vertexWeights: [],
  3581. weightsIndices: []
  3582. };
  3583. let s = 0, a = 0, c = false, u = [], h = [], d = [], g = [], w = [], _ = [];
  3584. const y = this;
  3585. return i.vertexIndices.forEach(function(C, I) {
  3586. let S, R = false;
  3587. C < 0 && (C = C ^ -1, R = true);
  3588. let j2 = [], F = [];
  3589. if (u.push(C * 3, C * 3 + 1, C * 3 + 2), i.color) {
  3590. const V = Vs(I, s, C, i.color);
  3591. d.push(V[0], V[1], V[2]);
  3592. }
  3593. if (i.skeleton) {
  3594. if (i.weightTable[C] !== void 0 && i.weightTable[C].forEach(function(V) {
  3595. F.push(V.weight), j2.push(V.id);
  3596. }), F.length > 4) {
  3597. c || (console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."), c = true);
  3598. const V = [0, 0, 0, 0], D = [0, 0, 0, 0];
  3599. F.forEach(function(Y, G) {
  3600. let N = Y, O = j2[G];
  3601. D.forEach(function(H, K, q) {
  3602. if (N > H) {
  3603. q[K] = N, N = H;
  3604. const ue = V[K];
  3605. V[K] = O, O = ue;
  3606. }
  3607. });
  3608. }), j2 = V, F = D;
  3609. }
  3610. for (; F.length < 4; )
  3611. F.push(0), j2.push(0);
  3612. for (let V = 0; V < 4; ++V)
  3613. w.push(F[V]), _.push(j2[V]);
  3614. }
  3615. if (i.normal) {
  3616. const V = Vs(I, s, C, i.normal);
  3617. h.push(V[0], V[1], V[2]);
  3618. }
  3619. i.material && i.material.mappingType !== "AllSame" && (S = Vs(I, s, C, i.material)[0]), i.uv && i.uv.forEach(function(V, D) {
  3620. const Y = Vs(I, s, C, V);
  3621. g[D] === void 0 && (g[D] = []), g[D].push(Y[0]), g[D].push(Y[1]);
  3622. }), a++, R && (y.genFace(r, i, u, S, h, d, g, w, _, a), s++, a = 0, u = [], h = [], d = [], g = [], w = [], _ = []);
  3623. }), r;
  3624. }
  3625. // Generate data for a single face in a geometry. If the face is a quad then split it into 2 tris
  3626. genFace(i, r, s, a, c, u, h, d, g, w) {
  3627. for (let _ = 2; _ < w; _++)
  3628. i.vertex.push(r.vertexPositions[s[0]]), i.vertex.push(r.vertexPositions[s[1]]), i.vertex.push(r.vertexPositions[s[2]]), i.vertex.push(r.vertexPositions[s[(_ - 1) * 3]]), i.vertex.push(r.vertexPositions[s[(_ - 1) * 3 + 1]]), i.vertex.push(r.vertexPositions[s[(_ - 1) * 3 + 2]]), i.vertex.push(r.vertexPositions[s[_ * 3]]), i.vertex.push(r.vertexPositions[s[_ * 3 + 1]]), i.vertex.push(r.vertexPositions[s[_ * 3 + 2]]), r.skeleton && (i.vertexWeights.push(d[0]), i.vertexWeights.push(d[1]), i.vertexWeights.push(d[2]), i.vertexWeights.push(d[3]), i.vertexWeights.push(d[(_ - 1) * 4]), i.vertexWeights.push(d[(_ - 1) * 4 + 1]), i.vertexWeights.push(d[(_ - 1) * 4 + 2]), i.vertexWeights.push(d[(_ - 1) * 4 + 3]), i.vertexWeights.push(d[_ * 4]), i.vertexWeights.push(d[_ * 4 + 1]), i.vertexWeights.push(d[_ * 4 + 2]), i.vertexWeights.push(d[_ * 4 + 3]), i.weightsIndices.push(g[0]), i.weightsIndices.push(g[1]), i.weightsIndices.push(g[2]), i.weightsIndices.push(g[3]), i.weightsIndices.push(g[(_ - 1) * 4]), i.weightsIndices.push(g[(_ - 1) * 4 + 1]), i.weightsIndices.push(g[(_ - 1) * 4 + 2]), i.weightsIndices.push(g[(_ - 1) * 4 + 3]), i.weightsIndices.push(g[_ * 4]), i.weightsIndices.push(g[_ * 4 + 1]), i.weightsIndices.push(g[_ * 4 + 2]), i.weightsIndices.push(g[_ * 4 + 3])), r.color && (i.colors.push(u[0]), i.colors.push(u[1]), i.colors.push(u[2]), i.colors.push(u[(_ - 1) * 3]), i.colors.push(u[(_ - 1) * 3 + 1]), i.colors.push(u[(_ - 1) * 3 + 2]), i.colors.push(u[_ * 3]), i.colors.push(u[_ * 3 + 1]), i.colors.push(u[_ * 3 + 2])), r.material && r.material.mappingType !== "AllSame" && (i.materialIndex.push(a), i.materialIndex.push(a), i.materialIndex.push(a)), r.normal && (i.normal.push(c[0]), i.normal.push(c[1]), i.normal.push(c[2]), i.normal.push(c[(_ - 1) * 3]), i.normal.push(c[(_ - 1) * 3 + 1]), i.normal.push(c[(_ - 1) * 3 + 2]), i.normal.push(c[_ * 3]), i.normal.push(c[_ * 3 + 1]), i.normal.push(c[_ * 3 + 2])), r.uv && r.uv.forEach(function(y, C) {
  3629. i.uvs[C] === void 0 && (i.uvs[C] = []), i.uvs[C].push(h[C][0]), i.uvs[C].push(h[C][1]), i.uvs[C].push(h[C][(_ - 1) * 2]), i.uvs[C].push(h[C][(_ - 1) * 2 + 1]), i.uvs[C].push(h[C][_ * 2]), i.uvs[C].push(h[C][_ * 2 + 1]);
  3630. });
  3631. }
  3632. addMorphTargets(i, r, s, a) {
  3633. if (s.length === 0)
  3634. return;
  3635. i.morphTargetsRelative = true, i.morphAttributes.position = [];
  3636. const c = this;
  3637. s.forEach(function(u) {
  3638. u.rawTargets.forEach(function(h) {
  3639. const d = se.Objects.Geometry[h.geoID];
  3640. d !== void 0 && c.genMorphGeometry(i, r, d, a, h.name);
  3641. });
  3642. });
  3643. }
  3644. // a morph geometry node is similar to a standard node, and the node is also contained
  3645. // in FBXTree.Objects.Geometry, however it can only have attributes for position, normal
  3646. // and a special attribute Index defining which vertices of the original geometry are affected
  3647. // Normal and position attributes only have data for the vertices that are affected by the morph
  3648. genMorphGeometry(i, r, s, a, c) {
  3649. const u = r.PolygonVertexIndex !== void 0 ? r.PolygonVertexIndex.a : [], h = s.Vertices !== void 0 ? s.Vertices.a : [], d = s.Indexes !== void 0 ? s.Indexes.a : [], g = i.attributes.position.count * 3, w = new Float32Array(g);
  3650. for (let I = 0; I < d.length; I++) {
  3651. const S = d[I] * 3;
  3652. w[S] = h[I * 3], w[S + 1] = h[I * 3 + 1], w[S + 2] = h[I * 3 + 2];
  3653. }
  3654. const _ = {
  3655. vertexIndices: u,
  3656. vertexPositions: w
  3657. }, y = this.genBuffers(_), C = new Float32BufferAttribute(y.vertex, 3);
  3658. C.name = c || s.attrName, C.applyMatrix4(a), i.morphAttributes.position.push(C);
  3659. }
  3660. // Parse normal from FBXTree.Objects.Geometry.LayerElementNormal if it exists
  3661. parseNormals(i) {
  3662. const r = i.MappingInformationType, s = i.ReferenceInformationType, a = i.Normals.a;
  3663. let c = [];
  3664. return s === "IndexToDirect" && ("NormalIndex" in i ? c = i.NormalIndex.a : "NormalsIndex" in i && (c = i.NormalsIndex.a)), {
  3665. dataSize: 3,
  3666. buffer: a,
  3667. indices: c,
  3668. mappingType: r,
  3669. referenceType: s
  3670. };
  3671. }
  3672. // Parse UVs from FBXTree.Objects.Geometry.LayerElementUV if it exists
  3673. parseUVs(i) {
  3674. const r = i.MappingInformationType, s = i.ReferenceInformationType, a = i.UV.a;
  3675. let c = [];
  3676. return s === "IndexToDirect" && (c = i.UVIndex.a), {
  3677. dataSize: 2,
  3678. buffer: a,
  3679. indices: c,
  3680. mappingType: r,
  3681. referenceType: s
  3682. };
  3683. }
  3684. // Parse Vertex Colors from FBXTree.Objects.Geometry.LayerElementColor if it exists
  3685. parseVertexColors(i) {
  3686. const r = i.MappingInformationType, s = i.ReferenceInformationType, a = i.Colors.a;
  3687. let c = [];
  3688. return s === "IndexToDirect" && (c = i.ColorIndex.a), {
  3689. dataSize: 4,
  3690. buffer: a,
  3691. indices: c,
  3692. mappingType: r,
  3693. referenceType: s
  3694. };
  3695. }
  3696. // Parse mapping and material data in FBXTree.Objects.Geometry.LayerElementMaterial if it exists
  3697. parseMaterialIndices(i) {
  3698. const r = i.MappingInformationType, s = i.ReferenceInformationType;
  3699. if (r === "NoMappingInformation")
  3700. return {
  3701. dataSize: 1,
  3702. buffer: [0],
  3703. indices: [0],
  3704. mappingType: "AllSame",
  3705. referenceType: s
  3706. };
  3707. const a = i.Materials.a, c = [];
  3708. for (let u = 0; u < a.length; ++u)
  3709. c.push(u);
  3710. return {
  3711. dataSize: 1,
  3712. buffer: a,
  3713. indices: c,
  3714. mappingType: r,
  3715. referenceType: s
  3716. };
  3717. }
  3718. // Generate a NurbGeometry from a node in FBXTree.Objects.Geometry
  3719. parseNurbsGeometry(i) {
  3720. if (ma === void 0)
  3721. return console.error("THREE.FBXLoader: The loader relies on NURBSCurve for any nurbs present in the model. Nurbs will show up as empty geometry."), new BufferGeometry();
  3722. const r = parseInt(i.Order);
  3723. if (isNaN(r))
  3724. return console.error("THREE.FBXLoader: Invalid Order %s given for geometry ID: %s", i.Order, i.id), new BufferGeometry();
  3725. const s = r - 1, a = i.KnotVector.a, c = [], u = i.Points.a;
  3726. for (let _ = 0, y = u.length; _ < y; _ += 4)
  3727. c.push(new Vector4().fromArray(u, _));
  3728. let h, d;
  3729. if (i.Form === "Closed")
  3730. c.push(c[0]);
  3731. else if (i.Form === "Periodic") {
  3732. h = s, d = a.length - 1 - h;
  3733. for (let _ = 0; _ < s; ++_)
  3734. c.push(c[_]);
  3735. }
  3736. const w = new ma(s, a, c, h, d).getPoints(c.length * 12);
  3737. return new BufferGeometry().setFromPoints(w);
  3738. }
  3739. };
  3740. var Ku = class {
  3741. // take raw animation clips and turn them into three.js animation clips
  3742. parse() {
  3743. const i = [], r = this.parseClips();
  3744. if (r !== void 0)
  3745. for (const s in r) {
  3746. const a = r[s], c = this.addClip(a);
  3747. i.push(c);
  3748. }
  3749. return i;
  3750. }
  3751. parseClips() {
  3752. if (se.Objects.AnimationCurve === void 0)
  3753. return;
  3754. const i = this.parseAnimationCurveNodes();
  3755. this.parseAnimationCurves(i);
  3756. const r = this.parseAnimationLayers(i);
  3757. return this.parseAnimStacks(r);
  3758. }
  3759. // parse nodes in FBXTree.Objects.AnimationCurveNode
  3760. // each AnimationCurveNode holds data for an animation transform for a model (e.g. left arm rotation )
  3761. // and is referenced by an AnimationLayer
  3762. parseAnimationCurveNodes() {
  3763. const i = se.Objects.AnimationCurveNode, r = /* @__PURE__ */ new Map();
  3764. for (const s in i) {
  3765. const a = i[s];
  3766. if (a.attrName.match(/S|R|T|DeformPercent/) !== null) {
  3767. const c = {
  3768. id: a.id,
  3769. attr: a.attrName,
  3770. curves: {}
  3771. };
  3772. r.set(c.id, c);
  3773. }
  3774. }
  3775. return r;
  3776. }
  3777. // parse nodes in FBXTree.Objects.AnimationCurve and connect them up to
  3778. // previously parsed AnimationCurveNodes. Each AnimationCurve holds data for a single animated
  3779. // axis ( e.g. times and values of x rotation)
  3780. parseAnimationCurves(i) {
  3781. const r = se.Objects.AnimationCurve;
  3782. for (const s in r) {
  3783. const a = {
  3784. id: r[s].id,
  3785. times: r[s].KeyTime.a.map(Qu),
  3786. values: r[s].KeyValueFloat.a
  3787. }, c = Ae.get(a.id);
  3788. if (c !== void 0) {
  3789. const u = c.parents[0].ID, h = c.parents[0].relationship;
  3790. h.match(/X/) ? i.get(u).curves.x = a : h.match(/Y/) ? i.get(u).curves.y = a : h.match(/Z/) ? i.get(u).curves.z = a : h.match(/d|DeformPercent/) && i.has(u) && (i.get(u).curves.morph = a);
  3791. }
  3792. }
  3793. }
  3794. // parse nodes in FBXTree.Objects.AnimationLayer. Each layers holds references
  3795. // to various AnimationCurveNodes and is referenced by an AnimationStack node
  3796. // note: theoretically a stack can have multiple layers, however in practice there always seems to be one per stack
  3797. parseAnimationLayers(i) {
  3798. const r = se.Objects.AnimationLayer, s = /* @__PURE__ */ new Map();
  3799. for (const a in r) {
  3800. const c = [], u = Ae.get(parseInt(a));
  3801. u !== void 0 && (u.children.forEach(function(d, g) {
  3802. if (i.has(d.ID)) {
  3803. const w = i.get(d.ID);
  3804. if (w.curves.x !== void 0 || w.curves.y !== void 0 || w.curves.z !== void 0) {
  3805. if (c[g] === void 0) {
  3806. const _ = Ae.get(d.ID).parents.filter(function(y) {
  3807. return y.relationship !== void 0;
  3808. })[0].ID;
  3809. if (_ !== void 0) {
  3810. const y = se.Objects.Model[_.toString()];
  3811. if (y === void 0) {
  3812. console.warn("THREE.FBXLoader: Encountered a unused curve.", d);
  3813. return;
  3814. }
  3815. const C = {
  3816. modelName: y.attrName ? PropertyBinding.sanitizeNodeName(y.attrName) : "",
  3817. ID: y.id,
  3818. initialPosition: [0, 0, 0],
  3819. initialRotation: [0, 0, 0],
  3820. initialScale: [1, 1, 1]
  3821. };
  3822. We.traverse(function(I) {
  3823. I.ID === y.id && (C.transform = I.matrix, I.userData.transformData && (C.eulerOrder = I.userData.transformData.eulerOrder));
  3824. }), C.transform || (C.transform = new Matrix4()), "PreRotation" in y && (C.preRotation = y.PreRotation.value), "PostRotation" in y && (C.postRotation = y.PostRotation.value), c[g] = C;
  3825. }
  3826. }
  3827. c[g] && (c[g][w.attr] = w);
  3828. } else if (w.curves.morph !== void 0) {
  3829. if (c[g] === void 0) {
  3830. const _ = Ae.get(d.ID).parents.filter(function(j2) {
  3831. return j2.relationship !== void 0;
  3832. })[0].ID, y = Ae.get(_).parents[0].ID, C = Ae.get(y).parents[0].ID, I = Ae.get(C).parents[0].ID, S = se.Objects.Model[I], R = {
  3833. modelName: S.attrName ? PropertyBinding.sanitizeNodeName(S.attrName) : "",
  3834. morphName: se.Objects.Deformer[_].attrName
  3835. };
  3836. c[g] = R;
  3837. }
  3838. c[g][w.attr] = w;
  3839. }
  3840. }
  3841. }), s.set(parseInt(a), c));
  3842. }
  3843. return s;
  3844. }
  3845. // parse nodes in FBXTree.Objects.AnimationStack. These are the top level node in the animation
  3846. // hierarchy. Each Stack node will be used to create a AnimationClip
  3847. parseAnimStacks(i) {
  3848. const r = se.Objects.AnimationStack, s = {};
  3849. for (const a in r) {
  3850. const c = Ae.get(parseInt(a)).children;
  3851. c.length > 1 && console.warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.");
  3852. const u = i.get(c[0].ID);
  3853. s[a] = {
  3854. name: r[a].attrName,
  3855. layer: u
  3856. };
  3857. }
  3858. return s;
  3859. }
  3860. addClip(i) {
  3861. let r = [];
  3862. const s = this;
  3863. return i.layer.forEach(function(a) {
  3864. r = r.concat(s.generateTracks(a));
  3865. }), new AnimationClip(i.name, -1, r);
  3866. }
  3867. generateTracks(i) {
  3868. const r = [];
  3869. let s = new Vector3(), a = new Quaternion(), c = new Vector3();
  3870. if (i.transform && i.transform.decompose(s, a, c), s = s.toArray(), a = new Euler().setFromQuaternion(a, i.eulerOrder).toArray(), c = c.toArray(), i.T !== void 0 && Object.keys(i.T.curves).length > 0) {
  3871. const u = this.generateVectorTrack(i.modelName, i.T.curves, s, "position");
  3872. u !== void 0 && r.push(u);
  3873. }
  3874. if (i.R !== void 0 && Object.keys(i.R.curves).length > 0) {
  3875. const u = this.generateRotationTrack(i.modelName, i.R.curves, a, i.preRotation, i.postRotation, i.eulerOrder);
  3876. u !== void 0 && r.push(u);
  3877. }
  3878. if (i.S !== void 0 && Object.keys(i.S.curves).length > 0) {
  3879. const u = this.generateVectorTrack(i.modelName, i.S.curves, c, "scale");
  3880. u !== void 0 && r.push(u);
  3881. }
  3882. if (i.DeformPercent !== void 0) {
  3883. const u = this.generateMorphTrack(i);
  3884. u !== void 0 && r.push(u);
  3885. }
  3886. return r;
  3887. }
  3888. generateVectorTrack(i, r, s, a) {
  3889. const c = this.getTimesForAllAxes(r), u = this.getKeyframeTrackValues(c, r, s);
  3890. return new VectorKeyframeTrack(i + "." + a, c, u);
  3891. }
  3892. generateRotationTrack(i, r, s, a, c, u) {
  3893. r.x !== void 0 && (this.interpolateRotations(r.x), r.x.values = r.x.values.map(MathUtils.degToRad)), r.y !== void 0 && (this.interpolateRotations(r.y), r.y.values = r.y.values.map(MathUtils.degToRad)), r.z !== void 0 && (this.interpolateRotations(r.z), r.z.values = r.z.values.map(MathUtils.degToRad));
  3894. const h = this.getTimesForAllAxes(r), d = this.getKeyframeTrackValues(h, r, s);
  3895. a !== void 0 && (a = a.map(MathUtils.degToRad), a.push(u), a = new Euler().fromArray(a), a = new Quaternion().setFromEuler(a)), c !== void 0 && (c = c.map(MathUtils.degToRad), c.push(u), c = new Euler().fromArray(c), c = new Quaternion().setFromEuler(c).invert());
  3896. const g = new Quaternion(), w = new Euler(), _ = [];
  3897. for (let y = 0; y < d.length; y += 3)
  3898. w.set(d[y], d[y + 1], d[y + 2], u), g.setFromEuler(w), a !== void 0 && g.premultiply(a), c !== void 0 && g.multiply(c), g.toArray(_, y / 3 * 4);
  3899. return new QuaternionKeyframeTrack(i + ".quaternion", h, _);
  3900. }
  3901. generateMorphTrack(i) {
  3902. const r = i.DeformPercent.curves.morph, s = r.values.map(function(c) {
  3903. return c / 100;
  3904. }), a = We.getObjectByName(i.modelName).morphTargetDictionary[i.morphName];
  3905. return new NumberKeyframeTrack(i.modelName + ".morphTargetInfluences[" + a + "]", r.times, s);
  3906. }
  3907. // For all animated objects, times are defined separately for each axis
  3908. // Here we'll combine the times into one sorted array without duplicates
  3909. getTimesForAllAxes(i) {
  3910. let r = [];
  3911. if (i.x !== void 0 && (r = r.concat(i.x.times)), i.y !== void 0 && (r = r.concat(i.y.times)), i.z !== void 0 && (r = r.concat(i.z.times)), r = r.sort(function(s, a) {
  3912. return s - a;
  3913. }), r.length > 1) {
  3914. let s = 1, a = r[0];
  3915. for (let c = 1; c < r.length; c++) {
  3916. const u = r[c];
  3917. u !== a && (r[s] = u, a = u, s++);
  3918. }
  3919. r = r.slice(0, s);
  3920. }
  3921. return r;
  3922. }
  3923. getKeyframeTrackValues(i, r, s) {
  3924. const a = s, c = [];
  3925. let u = -1, h = -1, d = -1;
  3926. return i.forEach(function(g) {
  3927. if (r.x && (u = r.x.times.indexOf(g)), r.y && (h = r.y.times.indexOf(g)), r.z && (d = r.z.times.indexOf(g)), u !== -1) {
  3928. const w = r.x.values[u];
  3929. c.push(w), a[0] = w;
  3930. } else
  3931. c.push(a[0]);
  3932. if (h !== -1) {
  3933. const w = r.y.values[h];
  3934. c.push(w), a[1] = w;
  3935. } else
  3936. c.push(a[1]);
  3937. if (d !== -1) {
  3938. const w = r.z.values[d];
  3939. c.push(w), a[2] = w;
  3940. } else
  3941. c.push(a[2]);
  3942. }), c;
  3943. }
  3944. // Rotations are defined as Euler angles which can have values of any size
  3945. // These will be converted to quaternions which don't support values greater than
  3946. // PI, so we'll interpolate large rotations
  3947. interpolateRotations(i) {
  3948. for (let r = 1; r < i.values.length; r++) {
  3949. const s = i.values[r - 1], a = i.values[r] - s, c = Math.abs(a);
  3950. if (c >= 180) {
  3951. const u = c / 180, h = a / u;
  3952. let d = s + h;
  3953. const g = i.times[r - 1], _ = (i.times[r] - g) / u;
  3954. let y = g + _;
  3955. const C = [], I = [];
  3956. for (; y < i.times[r]; )
  3957. C.push(y), y += _, I.push(d), d += h;
  3958. i.times = ba(i.times, r, C), i.values = ba(i.values, r, I);
  3959. }
  3960. }
  3961. }
  3962. };
  3963. var $u = class {
  3964. getPrevNode() {
  3965. return this.nodeStack[this.currentIndent - 2];
  3966. }
  3967. getCurrentNode() {
  3968. return this.nodeStack[this.currentIndent - 1];
  3969. }
  3970. getCurrentProp() {
  3971. return this.currentProp;
  3972. }
  3973. pushStack(i) {
  3974. this.nodeStack.push(i), this.currentIndent += 1;
  3975. }
  3976. popStack() {
  3977. this.nodeStack.pop(), this.currentIndent -= 1;
  3978. }
  3979. setCurrentProp(i, r) {
  3980. this.currentProp = i, this.currentPropName = r;
  3981. }
  3982. parse(i) {
  3983. this.currentIndent = 0, this.allNodes = new Qa(), this.nodeStack = [], this.currentProp = [], this.currentPropName = "";
  3984. const r = this, s = i.split(/[\r\n]+/);
  3985. return s.forEach(function(a, c) {
  3986. const u = a.match(/^[\s\t]*;/), h = a.match(/^[\s\t]*$/);
  3987. if (u || h)
  3988. return;
  3989. const d = a.match("^\\t{" + r.currentIndent + "}(\\w+):(.*){", ""), g = a.match("^\\t{" + r.currentIndent + "}(\\w+):[\\s\\t\\r\\n](.*)"), w = a.match("^\\t{" + (r.currentIndent - 1) + "}}");
  3990. d ? r.parseNodeBegin(a, d) : g ? r.parseNodeProperty(a, g, s[++c]) : w ? r.popStack() : a.match(/^[^\s\t}]/) && r.parseNodePropertyContinued(a);
  3991. }), this.allNodes;
  3992. }
  3993. parseNodeBegin(i, r) {
  3994. const s = r[1].trim().replace(/^"/, "").replace(/"$/, ""), a = r[2].split(",").map(function(d) {
  3995. return d.trim().replace(/^"/, "").replace(/"$/, "");
  3996. }), c = {
  3997. name: s
  3998. }, u = this.parseNodeAttr(a), h = this.getCurrentNode();
  3999. this.currentIndent === 0 ? this.allNodes.add(s, c) : s in h ? (s === "PoseNode" ? h.PoseNode.push(c) : h[s].id !== void 0 && (h[s] = {}, h[s][h[s].id] = h[s]), u.id !== "" && (h[s][u.id] = c)) : typeof u.id == "number" ? (h[s] = {}, h[s][u.id] = c) : s !== "Properties70" && (s === "PoseNode" ? h[s] = [c] : h[s] = c), typeof u.id == "number" && (c.id = u.id), u.name !== "" && (c.attrName = u.name), u.type !== "" && (c.attrType = u.type), this.pushStack(c);
  4000. }
  4001. parseNodeAttr(i) {
  4002. let r = i[0];
  4003. i[0] !== "" && (r = parseInt(i[0]), isNaN(r) && (r = i[0]));
  4004. let s = "", a = "";
  4005. return i.length > 1 && (s = i[1].replace(/^(\w+)::/, ""), a = i[2]), {
  4006. id: r,
  4007. name: s,
  4008. type: a
  4009. };
  4010. }
  4011. parseNodeProperty(i, r, s) {
  4012. let a = r[1].replace(/^"/, "").replace(/"$/, "").trim(), c = r[2].replace(/^"/, "").replace(/"$/, "").trim();
  4013. a === "Content" && c === "," && (c = s.replace(/"/g, "").replace(/,$/, "").trim());
  4014. const u = this.getCurrentNode();
  4015. if (u.name === "Properties70") {
  4016. this.parseNodeSpecialProperty(i, a, c);
  4017. return;
  4018. }
  4019. if (a === "C") {
  4020. const d = c.split(",").slice(1), g = parseInt(d[0]), w = parseInt(d[1]);
  4021. let _ = c.split(",").slice(3);
  4022. _ = _.map(function(y) {
  4023. return y.trim().replace(/^"/, "");
  4024. }), a = "connections", c = [g, w], Wu(c, _), u[a] === void 0 && (u[a] = []);
  4025. }
  4026. a === "Node" && (u.id = c), a in u && Array.isArray(u[a]) ? u[a].push(c) : a !== "a" ? u[a] = c : u.a = c, this.setCurrentProp(u, a), a === "a" && c.slice(-1) !== "," && (u.a = Wr(c));
  4027. }
  4028. parseNodePropertyContinued(i) {
  4029. const r = this.getCurrentNode();
  4030. r.a += i, i.slice(-1) !== "," && (r.a = Wr(r.a));
  4031. }
  4032. // parse "Property70"
  4033. parseNodeSpecialProperty(i, r, s) {
  4034. const a = s.split('",').map(function(w) {
  4035. return w.trim().replace(/^\"/, "").replace(/\s/, "_");
  4036. }), c = a[0], u = a[1], h = a[2], d = a[3];
  4037. let g = a[4];
  4038. switch (u) {
  4039. case "int":
  4040. case "enum":
  4041. case "bool":
  4042. case "ULongLong":
  4043. case "double":
  4044. case "Number":
  4045. case "FieldOfView":
  4046. g = parseFloat(g);
  4047. break;
  4048. case "Color":
  4049. case "ColorRGB":
  4050. case "Vector3D":
  4051. case "Lcl_Translation":
  4052. case "Lcl_Rotation":
  4053. case "Lcl_Scaling":
  4054. g = Wr(g);
  4055. break;
  4056. }
  4057. this.getPrevNode()[c] = {
  4058. type: u,
  4059. type2: h,
  4060. flag: d,
  4061. value: g
  4062. }, this.setCurrentProp(this.getPrevNode(), c);
  4063. }
  4064. };
  4065. var Xu = class {
  4066. parse(i) {
  4067. const r = new fa(i);
  4068. r.skip(23);
  4069. const s = r.getUint32();
  4070. if (s < 6400)
  4071. throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: " + s);
  4072. const a = new Qa();
  4073. for (; !this.endOfContent(r); ) {
  4074. const c = this.parseNode(r, s);
  4075. c !== null && a.add(c.name, c);
  4076. }
  4077. return a;
  4078. }
  4079. // Check if reader has reached the end of content.
  4080. endOfContent(i) {
  4081. return i.size() % 16 === 0 ? (i.getOffset() + 160 + 16 & -16) >= i.size() : i.getOffset() + 160 + 16 >= i.size();
  4082. }
  4083. // recursively parse nodes until the end of the file is reached
  4084. parseNode(i, r) {
  4085. const s = {}, a = r >= 7500 ? i.getUint64() : i.getUint32(), c = r >= 7500 ? i.getUint64() : i.getUint32();
  4086. r >= 7500 ? i.getUint64() : i.getUint32();
  4087. const u = i.getUint8(), h = i.getString(u);
  4088. if (a === 0)
  4089. return null;
  4090. const d = [];
  4091. for (let y = 0; y < c; y++)
  4092. d.push(this.parseProperty(i));
  4093. const g = d.length > 0 ? d[0] : "", w = d.length > 1 ? d[1] : "", _ = d.length > 2 ? d[2] : "";
  4094. for (s.singleProperty = c === 1 && i.getOffset() === a; a > i.getOffset(); ) {
  4095. const y = this.parseNode(i, r);
  4096. y !== null && this.parseSubNode(h, s, y);
  4097. }
  4098. return s.propertyList = d, typeof g == "number" && (s.id = g), w !== "" && (s.attrName = w), _ !== "" && (s.attrType = _), h !== "" && (s.name = h), s;
  4099. }
  4100. parseSubNode(i, r, s) {
  4101. if (s.singleProperty === true) {
  4102. const a = s.propertyList[0];
  4103. Array.isArray(a) ? (r[s.name] = s, s.a = a) : r[s.name] = a;
  4104. } else if (i === "Connections" && s.name === "C") {
  4105. const a = [];
  4106. s.propertyList.forEach(function(c, u) {
  4107. u !== 0 && a.push(c);
  4108. }), r.connections === void 0 && (r.connections = []), r.connections.push(a);
  4109. } else if (s.name === "Properties70")
  4110. Object.keys(s).forEach(function(c) {
  4111. r[c] = s[c];
  4112. });
  4113. else if (i === "Properties70" && s.name === "P") {
  4114. let a = s.propertyList[0], c = s.propertyList[1];
  4115. const u = s.propertyList[2], h = s.propertyList[3];
  4116. let d;
  4117. a.indexOf("Lcl ") === 0 && (a = a.replace("Lcl ", "Lcl_")), c.indexOf("Lcl ") === 0 && (c = c.replace("Lcl ", "Lcl_")), c === "Color" || c === "ColorRGB" || c === "Vector" || c === "Vector3D" || c.indexOf("Lcl_") === 0 ? d = [s.propertyList[4], s.propertyList[5], s.propertyList[6]] : d = s.propertyList[4], r[a] = {
  4118. type: c,
  4119. type2: u,
  4120. flag: h,
  4121. value: d
  4122. };
  4123. } else
  4124. r[s.name] === void 0 ? typeof s.id == "number" ? (r[s.name] = {}, r[s.name][s.id] = s) : r[s.name] = s : s.name === "PoseNode" ? (Array.isArray(r[s.name]) || (r[s.name] = [r[s.name]]), r[s.name].push(s)) : r[s.name][s.id] === void 0 && (r[s.name][s.id] = s);
  4125. }
  4126. parseProperty(i) {
  4127. const r = i.getString(1);
  4128. let s;
  4129. switch (r) {
  4130. case "C":
  4131. return i.getBoolean();
  4132. case "D":
  4133. return i.getFloat64();
  4134. case "F":
  4135. return i.getFloat32();
  4136. case "I":
  4137. return i.getInt32();
  4138. case "L":
  4139. return i.getInt64();
  4140. case "R":
  4141. return s = i.getUint32(), i.getArrayBuffer(s);
  4142. case "S":
  4143. return s = i.getUint32(), i.getString(s);
  4144. case "Y":
  4145. return i.getInt16();
  4146. case "b":
  4147. case "c":
  4148. case "d":
  4149. case "f":
  4150. case "i":
  4151. case "l":
  4152. const a = i.getUint32(), c = i.getUint32(), u = i.getUint32();
  4153. if (c === 0)
  4154. switch (r) {
  4155. case "b":
  4156. case "c":
  4157. return i.getBooleanArray(a);
  4158. case "d":
  4159. return i.getFloat64Array(a);
  4160. case "f":
  4161. return i.getFloat32Array(a);
  4162. case "i":
  4163. return i.getInt32Array(a);
  4164. case "l":
  4165. return i.getInt64Array(a);
  4166. }
  4167. const h = Zp(new Uint8Array(i.getArrayBuffer(u))), d = new fa(h.buffer);
  4168. switch (r) {
  4169. case "b":
  4170. case "c":
  4171. return d.getBooleanArray(a);
  4172. case "d":
  4173. return d.getFloat64Array(a);
  4174. case "f":
  4175. return d.getFloat32Array(a);
  4176. case "i":
  4177. return d.getInt32Array(a);
  4178. case "l":
  4179. return d.getInt64Array(a);
  4180. }
  4181. default:
  4182. throw new Error("THREE.FBXLoader: Unknown property type " + r);
  4183. }
  4184. }
  4185. };
  4186. var fa = class {
  4187. constructor(i, r) {
  4188. this.dv = new DataView(i), this.offset = 0, this.littleEndian = r !== void 0 ? r : true;
  4189. }
  4190. getOffset() {
  4191. return this.offset;
  4192. }
  4193. size() {
  4194. return this.dv.buffer.byteLength;
  4195. }
  4196. skip(i) {
  4197. this.offset += i;
  4198. }
  4199. // seems like true/false representation depends on exporter.
  4200. // true: 1 or 'Y'(=0x59), false: 0 or 'T'(=0x54)
  4201. // then sees LSB.
  4202. getBoolean() {
  4203. return (this.getUint8() & 1) === 1;
  4204. }
  4205. getBooleanArray(i) {
  4206. const r = [];
  4207. for (let s = 0; s < i; s++)
  4208. r.push(this.getBoolean());
  4209. return r;
  4210. }
  4211. getUint8() {
  4212. const i = this.dv.getUint8(this.offset);
  4213. return this.offset += 1, i;
  4214. }
  4215. getInt16() {
  4216. const i = this.dv.getInt16(this.offset, this.littleEndian);
  4217. return this.offset += 2, i;
  4218. }
  4219. getInt32() {
  4220. const i = this.dv.getInt32(this.offset, this.littleEndian);
  4221. return this.offset += 4, i;
  4222. }
  4223. getInt32Array(i) {
  4224. const r = [];
  4225. for (let s = 0; s < i; s++)
  4226. r.push(this.getInt32());
  4227. return r;
  4228. }
  4229. getUint32() {
  4230. const i = this.dv.getUint32(this.offset, this.littleEndian);
  4231. return this.offset += 4, i;
  4232. }
  4233. // JavaScript doesn't support 64-bit integer so calculate this here
  4234. // 1 << 32 will return 1 so using multiply operation instead here.
  4235. // There's a possibility that this method returns wrong value if the value
  4236. // is out of the range between Number.MAX_SAFE_INTEGER and Number.MIN_SAFE_INTEGER.
  4237. // TODO: safely handle 64-bit integer
  4238. getInt64() {
  4239. let i, r;
  4240. return this.littleEndian ? (i = this.getUint32(), r = this.getUint32()) : (r = this.getUint32(), i = this.getUint32()), r & 2147483648 ? (r = ~r & 4294967295, i = ~i & 4294967295, i === 4294967295 && (r = r + 1 & 4294967295), i = i + 1 & 4294967295, -(r * 4294967296 + i)) : r * 4294967296 + i;
  4241. }
  4242. getInt64Array(i) {
  4243. const r = [];
  4244. for (let s = 0; s < i; s++)
  4245. r.push(this.getInt64());
  4246. return r;
  4247. }
  4248. // Note: see getInt64() comment
  4249. getUint64() {
  4250. let i, r;
  4251. return this.littleEndian ? (i = this.getUint32(), r = this.getUint32()) : (r = this.getUint32(), i = this.getUint32()), r * 4294967296 + i;
  4252. }
  4253. getFloat32() {
  4254. const i = this.dv.getFloat32(this.offset, this.littleEndian);
  4255. return this.offset += 4, i;
  4256. }
  4257. getFloat32Array(i) {
  4258. const r = [];
  4259. for (let s = 0; s < i; s++)
  4260. r.push(this.getFloat32());
  4261. return r;
  4262. }
  4263. getFloat64() {
  4264. const i = this.dv.getFloat64(this.offset, this.littleEndian);
  4265. return this.offset += 8, i;
  4266. }
  4267. getFloat64Array(i) {
  4268. const r = [];
  4269. for (let s = 0; s < i; s++)
  4270. r.push(this.getFloat64());
  4271. return r;
  4272. }
  4273. getArrayBuffer(i) {
  4274. const r = this.dv.buffer.slice(this.offset, this.offset + i);
  4275. return this.offset += i, r;
  4276. }
  4277. getString(i) {
  4278. let r = [];
  4279. for (let a = 0; a < i; a++)
  4280. r[a] = this.getUint8();
  4281. const s = r.indexOf(0);
  4282. return s >= 0 && (r = r.slice(0, s)), LoaderUtils.decodeText(new Uint8Array(r));
  4283. }
  4284. };
  4285. var Qa = class {
  4286. add(i, r) {
  4287. this[i] = r;
  4288. }
  4289. };
  4290. function Yu(b) {
  4291. const i = "Kaydara FBX Binary \0";
  4292. return b.byteLength >= i.length && i === Ja(b, 0, i.length);
  4293. }
  4294. function qu(b) {
  4295. const i = ["K", "a", "y", "d", "a", "r", "a", "\\", "F", "B", "X", "\\", "B", "i", "n", "a", "r", "y", "\\", "\\"];
  4296. let r = 0;
  4297. function s(a) {
  4298. const c = b[a - 1];
  4299. return b = b.slice(r + a), r++, c;
  4300. }
  4301. for (let a = 0; a < i.length; ++a)
  4302. if (s(1) === i[a])
  4303. return false;
  4304. return true;
  4305. }
  4306. function va(b) {
  4307. const i = /FBXVersion: (\d+)/, r = b.match(i);
  4308. if (r)
  4309. return parseInt(r[1]);
  4310. throw new Error("THREE.FBXLoader: Cannot find the version number for the file given.");
  4311. }
  4312. function Qu(b) {
  4313. return b / 46186158e3;
  4314. }
  4315. var Zu = [];
  4316. function Vs(b, i, r, s) {
  4317. let a;
  4318. switch (s.mappingType) {
  4319. case "ByPolygonVertex":
  4320. a = b;
  4321. break;
  4322. case "ByPolygon":
  4323. a = i;
  4324. break;
  4325. case "ByVertice":
  4326. a = r;
  4327. break;
  4328. case "AllSame":
  4329. a = s.indices[0];
  4330. break;
  4331. default:
  4332. console.warn("THREE.FBXLoader: unknown attribute mapping type " + s.mappingType);
  4333. }
  4334. s.referenceType === "IndexToDirect" && (a = s.indices[a]);
  4335. const c = a * s.dataSize, u = c + s.dataSize;
  4336. return Ju(Zu, s.buffer, c, u);
  4337. }
  4338. var Zr = new Euler();
  4339. var ci = new Vector3();
  4340. function Za(b) {
  4341. const i = new Matrix4(), r = new Matrix4(), s = new Matrix4(), a = new Matrix4(), c = new Matrix4(), u = new Matrix4(), h = new Matrix4(), d = new Matrix4(), g = new Matrix4(), w = new Matrix4(), _ = new Matrix4(), y = new Matrix4(), C = b.inheritType ? b.inheritType : 0;
  4342. if (b.translation && i.setPosition(ci.fromArray(b.translation)), b.preRotation) {
  4343. const K = b.preRotation.map(MathUtils.degToRad);
  4344. K.push(b.eulerOrder), r.makeRotationFromEuler(Zr.fromArray(K));
  4345. }
  4346. if (b.rotation) {
  4347. const K = b.rotation.map(MathUtils.degToRad);
  4348. K.push(b.eulerOrder), s.makeRotationFromEuler(Zr.fromArray(K));
  4349. }
  4350. if (b.postRotation) {
  4351. const K = b.postRotation.map(MathUtils.degToRad);
  4352. K.push(b.eulerOrder), a.makeRotationFromEuler(Zr.fromArray(K)), a.invert();
  4353. }
  4354. b.scale && c.scale(ci.fromArray(b.scale)), b.scalingOffset && h.setPosition(ci.fromArray(b.scalingOffset)), b.scalingPivot && u.setPosition(ci.fromArray(b.scalingPivot)), b.rotationOffset && d.setPosition(ci.fromArray(b.rotationOffset)), b.rotationPivot && g.setPosition(ci.fromArray(b.rotationPivot)), b.parentMatrixWorld && (_.copy(b.parentMatrix), w.copy(b.parentMatrixWorld));
  4355. const I = r.clone().multiply(s).multiply(a), S = new Matrix4();
  4356. S.extractRotation(w);
  4357. const R = new Matrix4();
  4358. R.copyPosition(w);
  4359. const j2 = R.clone().invert().multiply(w), F = S.clone().invert().multiply(j2), V = c, D = new Matrix4();
  4360. if (C === 0)
  4361. D.copy(S).multiply(I).multiply(F).multiply(V);
  4362. else if (C === 1)
  4363. D.copy(S).multiply(F).multiply(I).multiply(V);
  4364. else {
  4365. const q = new Matrix4().scale(new Vector3().setFromMatrixScale(_)).clone().invert(), ue = F.clone().multiply(q);
  4366. D.copy(S).multiply(I).multiply(ue).multiply(V);
  4367. }
  4368. const Y = g.clone().invert(), G = u.clone().invert();
  4369. let N = i.clone().multiply(d).multiply(g).multiply(r).multiply(s).multiply(a).multiply(Y).multiply(h).multiply(u).multiply(c).multiply(G);
  4370. const O = new Matrix4().copyPosition(N), H = w.clone().multiply(O);
  4371. return y.copyPosition(H), N = y.clone().multiply(D), N.premultiply(w.invert()), N;
  4372. }
  4373. function Wa(b) {
  4374. b = b || 0;
  4375. const i = [
  4376. "ZYX",
  4377. // -> XYZ extrinsic
  4378. "YZX",
  4379. // -> XZY extrinsic
  4380. "XZY",
  4381. // -> YZX extrinsic
  4382. "ZXY",
  4383. // -> YXZ extrinsic
  4384. "YXZ",
  4385. // -> ZXY extrinsic
  4386. "XYZ"
  4387. // -> ZYX extrinsic
  4388. //'SphericXYZ', // not possible to support
  4389. ];
  4390. return b === 6 ? (console.warn("THREE.FBXLoader: unsupported Euler Order: Spherical XYZ. Animations and rotations may be incorrect."), i[0]) : i[b];
  4391. }
  4392. function Wr(b) {
  4393. return b.split(",").map(function(r) {
  4394. return parseFloat(r);
  4395. });
  4396. }
  4397. function Ja(b, i, r) {
  4398. return i === void 0 && (i = 0), r === void 0 && (r = b.byteLength), LoaderUtils.decodeText(new Uint8Array(b, i, r));
  4399. }
  4400. function Wu(b, i) {
  4401. for (let r = 0, s = b.length, a = i.length; r < a; r++, s++)
  4402. b[s] = i[r];
  4403. }
  4404. function Ju(b, i, r, s) {
  4405. for (let a = r, c = 0; a < s; a++, c++)
  4406. b[c] = i[a];
  4407. return b;
  4408. }
  4409. function ba(b, i, r) {
  4410. return b.slice(0, i).concat(r).concat(b.slice(i));
  4411. }
  4412. var eh = class extends Loader {
  4413. constructor(i) {
  4414. super(i);
  4415. }
  4416. load(i, r, s, a) {
  4417. const c = new FileLoader(this.manager);
  4418. c.setPath(this.path), c.setRequestHeader(this.requestHeader), c.setWithCredentials(this.withCredentials), c.load(i, (u) => {
  4419. if (typeof u != "string")
  4420. throw new Error("unsupported data type");
  4421. const h = JSON.parse(u), d = this.parse(h);
  4422. r && r(d);
  4423. }, s, a);
  4424. }
  4425. parse(i) {
  4426. return new go(i);
  4427. }
  4428. };
  4429. var go = class {
  4430. constructor(i) {
  4431. T(this, "data", void 0), this.data = i;
  4432. }
  4433. generateShapes(i, r = 100, s) {
  4434. const a = [], c = {
  4435. letterSpacing: 0,
  4436. lineHeight: 1,
  4437. ...s
  4438. }, u = th(i, r, this.data, c);
  4439. for (let h = 0, d = u.length; h < d; h++)
  4440. Array.prototype.push.apply(a, u[h].toShapes(false));
  4441. return a;
  4442. }
  4443. };
  4444. T(go, "isFont", void 0);
  4445. T(go, "type", void 0);
  4446. function th(b, i, r, s) {
  4447. const a = Array.from(b), c = i / r.resolution, u = (r.boundingBox.yMax - r.boundingBox.yMin + r.underlineThickness) * c, h = [];
  4448. let d = 0, g = 0;
  4449. for (let w = 0; w < a.length; w++) {
  4450. const _ = a[w];
  4451. if (_ === `
  4452. `)
  4453. d = 0, g -= u * s.lineHeight;
  4454. else {
  4455. const y = nh(_, c, d, g, r);
  4456. y && (d += y.offsetX + s.letterSpacing, h.push(y.path));
  4457. }
  4458. }
  4459. return h;
  4460. }
  4461. function nh(b, i, r, s, a) {
  4462. const c = a.glyphs[b] || a.glyphs["?"];
  4463. if (!c) {
  4464. console.error('THREE.Font: character "' + b + '" does not exists in font family ' + a.familyName + ".");
  4465. return;
  4466. }
  4467. const u = new ShapePath();
  4468. let h, d, g, w, _, y, C, I;
  4469. if (c.o) {
  4470. const S = c._cachedOutline || (c._cachedOutline = c.o.split(" "));
  4471. for (let R = 0, j2 = S.length; R < j2; )
  4472. switch (S[R++]) {
  4473. case "m":
  4474. h = parseInt(S[R++]) * i + r, d = parseInt(S[R++]) * i + s, u.moveTo(h, d);
  4475. break;
  4476. case "l":
  4477. h = parseInt(S[R++]) * i + r, d = parseInt(S[R++]) * i + s, u.lineTo(h, d);
  4478. break;
  4479. case "q":
  4480. g = parseInt(S[R++]) * i + r, w = parseInt(S[R++]) * i + s, _ = parseInt(S[R++]) * i + r, y = parseInt(S[R++]) * i + s, u.quadraticCurveTo(_, y, g, w);
  4481. break;
  4482. case "b":
  4483. g = parseInt(S[R++]) * i + r, w = parseInt(S[R++]) * i + s, _ = parseInt(S[R++]) * i + r, y = parseInt(S[R++]) * i + s, C = parseInt(S[R++]) * i + r, I = parseInt(S[R++]) * i + s, u.bezierCurveTo(_, y, C, I, g, w);
  4484. break;
  4485. }
  4486. }
  4487. return {
  4488. offsetX: c.ha * i,
  4489. path: u
  4490. };
  4491. }
  4492. var el = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
  4493. function ih(b) {
  4494. return b && b.__esModule && Object.prototype.hasOwnProperty.call(b, "default") ? b.default : b;
  4495. }
  4496. var sh = class extends DataTextureLoader {
  4497. constructor(i) {
  4498. super(i), this.type = HalfFloatType;
  4499. }
  4500. // adapted from http://www.graphics.cornell.edu/~bjw/rgbe.html
  4501. parse(i) {
  4502. const h = function(V, D) {
  4503. switch (V) {
  4504. case 1:
  4505. console.error("THREE.RGBELoader Read Error: " + (D || ""));
  4506. break;
  4507. case 2:
  4508. console.error("THREE.RGBELoader Write Error: " + (D || ""));
  4509. break;
  4510. case 3:
  4511. console.error("THREE.RGBELoader Bad File Format: " + (D || ""));
  4512. break;
  4513. default:
  4514. case 4:
  4515. console.error("THREE.RGBELoader: Error: " + (D || ""));
  4516. }
  4517. return -1;
  4518. }, _ = `
  4519. `, y = function(V, D, Y) {
  4520. D = D || 1024;
  4521. let N = V.pos, O = -1, H = 0, K = "", q = String.fromCharCode.apply(null, new Uint16Array(V.subarray(N, N + 128)));
  4522. for (; 0 > (O = q.indexOf(_)) && H < D && N < V.byteLength; )
  4523. K += q, H += q.length, N += 128, q += String.fromCharCode.apply(null, new Uint16Array(V.subarray(N, N + 128)));
  4524. return -1 < O ? (Y !== false && (V.pos += H + O + 1), K + q.slice(0, O)) : false;
  4525. }, C = function(V) {
  4526. const D = /^#\?(\S+)/, Y = /^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/, G = /^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/, N = /^\s*FORMAT=(\S+)\s*$/, O = /^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/, H = {
  4527. valid: 0,
  4528. string: "",
  4529. comments: "",
  4530. programtype: "RGBE",
  4531. format: "",
  4532. gamma: 1,
  4533. exposure: 1,
  4534. width: 0,
  4535. height: 0
  4536. /* image dimensions, width/height */
  4537. };
  4538. let K, q;
  4539. if (V.pos >= V.byteLength || !(K = y(V)))
  4540. return h(1, "no header found");
  4541. if (!(q = K.match(D)))
  4542. return h(3, "bad initial token");
  4543. for (H.valid |= 1, H.programtype = q[1], H.string += K + `
  4544. `; K = y(V), K !== false; ) {
  4545. if (H.string += K + `
  4546. `, K.charAt(0) === "#") {
  4547. H.comments += K + `
  4548. `;
  4549. continue;
  4550. }
  4551. if ((q = K.match(Y)) && (H.gamma = parseFloat(q[1])), (q = K.match(G)) && (H.exposure = parseFloat(q[1])), (q = K.match(N)) && (H.valid |= 2, H.format = q[1]), (q = K.match(O)) && (H.valid |= 4, H.height = parseInt(q[1], 10), H.width = parseInt(q[2], 10)), H.valid & 2 && H.valid & 4)
  4552. break;
  4553. }
  4554. return H.valid & 2 ? H.valid & 4 ? H : h(3, "missing image size specifier") : h(3, "missing format specifier");
  4555. }, I = function(V, D, Y) {
  4556. const G = D;
  4557. if (
  4558. // run length encoding is not allowed so read flat
  4559. G < 8 || G > 32767 || // this file is not run length encoded
  4560. V[0] !== 2 || V[1] !== 2 || V[2] & 128
  4561. )
  4562. return new Uint8Array(V);
  4563. if (G !== (V[2] << 8 | V[3]))
  4564. return h(3, "wrong scanline width");
  4565. const N = new Uint8Array(4 * D * Y);
  4566. if (!N.length)
  4567. return h(4, "unable to allocate buffer space");
  4568. let O = 0, H = 0;
  4569. const K = 4 * G, q = new Uint8Array(4), ue = new Uint8Array(K);
  4570. let ge = Y;
  4571. for (; ge > 0 && H < V.byteLength; ) {
  4572. if (H + 4 > V.byteLength)
  4573. return h(1);
  4574. if (q[0] = V[H++], q[1] = V[H++], q[2] = V[H++], q[3] = V[H++], q[0] != 2 || q[1] != 2 || (q[2] << 8 | q[3]) != G)
  4575. return h(3, "bad rgbe scanline format");
  4576. let ce = 0, me;
  4577. for (; ce < K && H < V.byteLength; ) {
  4578. me = V[H++];
  4579. const ee = me > 128;
  4580. if (ee && (me -= 128), me === 0 || ce + me > K)
  4581. return h(3, "bad scanline data");
  4582. if (ee) {
  4583. const X = V[H++];
  4584. for (let Pe = 0; Pe < me; Pe++)
  4585. ue[ce++] = X;
  4586. } else
  4587. ue.set(V.subarray(H, H + me), ce), ce += me, H += me;
  4588. }
  4589. const he = G;
  4590. for (let ee = 0; ee < he; ee++) {
  4591. let X = 0;
  4592. N[O] = ue[ee + X], X += G, N[O + 1] = ue[ee + X], X += G, N[O + 2] = ue[ee + X], X += G, N[O + 3] = ue[ee + X], O += 4;
  4593. }
  4594. ge--;
  4595. }
  4596. return N;
  4597. }, S = function(V, D, Y, G) {
  4598. const N = V[D + 3], O = Math.pow(2, N - 128) / 255;
  4599. Y[G + 0] = V[D + 0] * O, Y[G + 1] = V[D + 1] * O, Y[G + 2] = V[D + 2] * O, Y[G + 3] = 1;
  4600. }, R = function(V, D, Y, G) {
  4601. const N = V[D + 3], O = Math.pow(2, N - 128) / 255;
  4602. Y[G + 0] = DataUtils.toHalfFloat(Math.min(V[D + 0] * O, 65504)), Y[G + 1] = DataUtils.toHalfFloat(Math.min(V[D + 1] * O, 65504)), Y[G + 2] = DataUtils.toHalfFloat(Math.min(V[D + 2] * O, 65504)), Y[G + 3] = DataUtils.toHalfFloat(1);
  4603. }, j2 = new Uint8Array(i);
  4604. j2.pos = 0;
  4605. const F = C(j2);
  4606. if (F !== -1) {
  4607. const V = F.width, D = F.height, Y = I(j2.subarray(j2.pos), V, D);
  4608. if (Y !== -1) {
  4609. let G, N, O;
  4610. switch (this.type) {
  4611. case FloatType:
  4612. O = Y.length / 4;
  4613. const H = new Float32Array(O * 4);
  4614. for (let q = 0; q < O; q++)
  4615. S(Y, q * 4, H, q * 4);
  4616. G = H, N = FloatType;
  4617. break;
  4618. case HalfFloatType:
  4619. O = Y.length / 4;
  4620. const K = new Uint16Array(O * 4);
  4621. for (let q = 0; q < O; q++)
  4622. R(Y, q * 4, K, q * 4);
  4623. G = K, N = HalfFloatType;
  4624. break;
  4625. default:
  4626. console.error("THREE.RGBELoader: unsupported type: ", this.type);
  4627. break;
  4628. }
  4629. return {
  4630. width: V,
  4631. height: D,
  4632. data: G,
  4633. header: F.string,
  4634. gamma: F.gamma,
  4635. exposure: F.exposure,
  4636. type: N
  4637. };
  4638. }
  4639. }
  4640. return null;
  4641. }
  4642. setDataType(i) {
  4643. return this.type = i, this;
  4644. }
  4645. load(i, r, s, a) {
  4646. function c(u, h) {
  4647. switch (u.type) {
  4648. case FloatType:
  4649. case HalfFloatType:
  4650. u.encoding = LinearEncoding, u.minFilter = LinearFilter, u.magFilter = LinearFilter, u.generateMipmaps = false, u.flipY = true;
  4651. break;
  4652. }
  4653. r && r(u, h);
  4654. }
  4655. return super.load(i, c, s, a);
  4656. }
  4657. };
  4658. var Jr = /* @__PURE__ */ new WeakMap();
  4659. var rh = class extends Loader {
  4660. constructor(i) {
  4661. super(i), this.decoderPath = "", this.decoderConfig = {}, this.decoderBinary = null, this.decoderPending = null, this.workerLimit = 4, this.workerPool = [], this.workerNextTaskID = 1, this.workerSourceURL = "", this.defaultAttributeIDs = {
  4662. position: "POSITION",
  4663. normal: "NORMAL",
  4664. color: "COLOR",
  4665. uv: "TEX_COORD"
  4666. }, this.defaultAttributeTypes = {
  4667. position: "Float32Array",
  4668. normal: "Float32Array",
  4669. color: "Float32Array",
  4670. uv: "Float32Array"
  4671. };
  4672. }
  4673. setDecoderPath(i) {
  4674. return this.decoderPath = i, this;
  4675. }
  4676. setDecoderConfig(i) {
  4677. return this.decoderConfig = i, this;
  4678. }
  4679. setWorkerLimit(i) {
  4680. return this.workerLimit = i, this;
  4681. }
  4682. load(i, r, s, a) {
  4683. const c = new FileLoader(this.manager);
  4684. c.setPath(this.path), c.setResponseType("arraybuffer"), c.setRequestHeader(this.requestHeader), c.setWithCredentials(this.withCredentials), c.load(i, (u) => {
  4685. const h = {
  4686. attributeIDs: this.defaultAttributeIDs,
  4687. attributeTypes: this.defaultAttributeTypes,
  4688. useUniqueIDs: false
  4689. };
  4690. this.decodeGeometry(u, h).then(r).catch(a);
  4691. }, s, a);
  4692. }
  4693. /** @deprecated Kept for backward-compatibility with previous DRACOLoader versions. */
  4694. decodeDracoFile(i, r, s, a) {
  4695. const c = {
  4696. attributeIDs: s || this.defaultAttributeIDs,
  4697. attributeTypes: a || this.defaultAttributeTypes,
  4698. useUniqueIDs: !!s
  4699. };
  4700. this.decodeGeometry(i, c).then(r);
  4701. }
  4702. decodeGeometry(i, r) {
  4703. for (const d in r.attributeTypes) {
  4704. const g = r.attributeTypes[d];
  4705. g.BYTES_PER_ELEMENT !== void 0 && (r.attributeTypes[d] = g.name);
  4706. }
  4707. const s = JSON.stringify(r);
  4708. if (Jr.has(i)) {
  4709. const d = Jr.get(i);
  4710. if (d.key === s)
  4711. return d.promise;
  4712. if (i.byteLength === 0)
  4713. throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.");
  4714. }
  4715. let a;
  4716. const c = this.workerNextTaskID++, u = i.byteLength, h = this._getWorker(c, u).then((d) => (a = d, new Promise((g, w) => {
  4717. a._callbacks[c] = {
  4718. resolve: g,
  4719. reject: w
  4720. }, a.postMessage({
  4721. type: "decode",
  4722. id: c,
  4723. taskConfig: r,
  4724. buffer: i
  4725. }, [i]);
  4726. }))).then((d) => this._createGeometry(d.geometry));
  4727. return h.catch(() => true).then(() => {
  4728. a && c && this._releaseTask(a, c);
  4729. }), Jr.set(i, {
  4730. key: s,
  4731. promise: h
  4732. }), h;
  4733. }
  4734. _createGeometry(i) {
  4735. const r = new BufferGeometry();
  4736. i.index && r.setIndex(new BufferAttribute(i.index.array, 1));
  4737. for (let s = 0; s < i.attributes.length; s++) {
  4738. const a = i.attributes[s], c = a.name, u = a.array, h = a.itemSize;
  4739. r.setAttribute(c, new BufferAttribute(u, h));
  4740. }
  4741. return r;
  4742. }
  4743. _loadLibrary(i, r) {
  4744. const s = new FileLoader(this.manager);
  4745. return s.setPath(this.decoderPath), s.setResponseType(r), s.setWithCredentials(this.withCredentials), new Promise((a, c) => {
  4746. s.load(i, a, void 0, c);
  4747. });
  4748. }
  4749. preload() {
  4750. return this._initDecoder(), this;
  4751. }
  4752. _initDecoder() {
  4753. if (this.decoderPending)
  4754. return this.decoderPending;
  4755. const i = typeof WebAssembly != "object" || this.decoderConfig.type === "js", r = [];
  4756. return i ? r.push(this._loadLibrary("draco_decoder.js", "text")) : (r.push(this._loadLibrary("draco_wasm_wrapper.js", "text")), r.push(this._loadLibrary("draco_decoder.wasm", "arraybuffer"))), this.decoderPending = Promise.all(r).then((s) => {
  4757. const a = s[0];
  4758. i || (this.decoderConfig.wasmBinary = s[1]);
  4759. const c = oh.toString(), u = ["/* draco decoder */", a, "", "/* worker */", c.substring(c.indexOf("{") + 1, c.lastIndexOf("}"))].join(`
  4760. `);
  4761. this.workerSourceURL = URL.createObjectURL(new Blob([u]));
  4762. }), this.decoderPending;
  4763. }
  4764. _getWorker(i, r) {
  4765. return this._initDecoder().then(() => {
  4766. if (this.workerPool.length < this.workerLimit) {
  4767. const a = new Worker(this.workerSourceURL);
  4768. a._callbacks = {}, a._taskCosts = {}, a._taskLoad = 0, a.postMessage({
  4769. type: "init",
  4770. decoderConfig: this.decoderConfig
  4771. }), a.onmessage = function(c) {
  4772. const u = c.data;
  4773. switch (u.type) {
  4774. case "decode":
  4775. a._callbacks[u.id].resolve(u);
  4776. break;
  4777. case "error":
  4778. a._callbacks[u.id].reject(u);
  4779. break;
  4780. default:
  4781. console.error('THREE.DRACOLoader: Unexpected message, "' + u.type + '"');
  4782. }
  4783. }, this.workerPool.push(a);
  4784. } else
  4785. this.workerPool.sort(function(a, c) {
  4786. return a._taskLoad > c._taskLoad ? -1 : 1;
  4787. });
  4788. const s = this.workerPool[this.workerPool.length - 1];
  4789. return s._taskCosts[i] = r, s._taskLoad += r, s;
  4790. });
  4791. }
  4792. _releaseTask(i, r) {
  4793. i._taskLoad -= i._taskCosts[r], delete i._callbacks[r], delete i._taskCosts[r];
  4794. }
  4795. debug() {
  4796. console.log("Task load: ", this.workerPool.map((i) => i._taskLoad));
  4797. }
  4798. dispose() {
  4799. for (let i = 0; i < this.workerPool.length; ++i)
  4800. this.workerPool[i].terminate();
  4801. return this.workerPool.length = 0, this;
  4802. }
  4803. };
  4804. function oh() {
  4805. let b, i;
  4806. onmessage = function(u) {
  4807. const h = u.data;
  4808. switch (h.type) {
  4809. case "init":
  4810. b = h.decoderConfig, i = new Promise(function(w) {
  4811. b.onModuleLoaded = function(_) {
  4812. w({
  4813. draco: _
  4814. });
  4815. }, DracoDecoderModule(b);
  4816. });
  4817. break;
  4818. case "decode":
  4819. const d = h.buffer, g = h.taskConfig;
  4820. i.then((w) => {
  4821. const _ = w.draco, y = new _.Decoder(), C = new _.DecoderBuffer();
  4822. C.Init(new Int8Array(d), d.byteLength);
  4823. try {
  4824. const I = r(_, y, C, g), S = I.attributes.map((R) => R.array.buffer);
  4825. I.index && S.push(I.index.array.buffer), self.postMessage({
  4826. type: "decode",
  4827. id: h.id,
  4828. geometry: I
  4829. }, S);
  4830. } catch (I) {
  4831. console.error(I), self.postMessage({
  4832. type: "error",
  4833. id: h.id,
  4834. error: I.message
  4835. });
  4836. } finally {
  4837. _.destroy(C), _.destroy(y);
  4838. }
  4839. });
  4840. break;
  4841. }
  4842. };
  4843. function r(u, h, d, g) {
  4844. const w = g.attributeIDs, _ = g.attributeTypes;
  4845. let y, C;
  4846. const I = h.GetEncodedGeometryType(d);
  4847. if (I === u.TRIANGULAR_MESH)
  4848. y = new u.Mesh(), C = h.DecodeBufferToMesh(d, y);
  4849. else if (I === u.POINT_CLOUD)
  4850. y = new u.PointCloud(), C = h.DecodeBufferToPointCloud(d, y);
  4851. else
  4852. throw new Error("THREE.DRACOLoader: Unexpected geometry type.");
  4853. if (!C.ok() || y.ptr === 0)
  4854. throw new Error("THREE.DRACOLoader: Decoding failed: " + C.error_msg());
  4855. const S = {
  4856. index: null,
  4857. attributes: []
  4858. };
  4859. for (const R in w) {
  4860. const j2 = self[_[R]];
  4861. let F, V;
  4862. if (g.useUniqueIDs)
  4863. V = w[R], F = h.GetAttributeByUniqueId(y, V);
  4864. else {
  4865. if (V = h.GetAttributeId(y, u[w[R]]), V === -1)
  4866. continue;
  4867. F = h.GetAttribute(y, V);
  4868. }
  4869. S.attributes.push(a(u, h, y, R, j2, F));
  4870. }
  4871. return I === u.TRIANGULAR_MESH && (S.index = s(u, h, y)), u.destroy(y), S;
  4872. }
  4873. function s(u, h, d) {
  4874. const w = d.num_faces() * 3, _ = w * 4, y = u._malloc(_);
  4875. h.GetTrianglesUInt32Array(d, _, y);
  4876. const C = new Uint32Array(u.HEAPF32.buffer, y, w).slice();
  4877. return u._free(y), {
  4878. array: C,
  4879. itemSize: 1
  4880. };
  4881. }
  4882. function a(u, h, d, g, w, _) {
  4883. const y = _.num_components(), I = d.num_points() * y, S = I * w.BYTES_PER_ELEMENT, R = c(u, w), j2 = u._malloc(S);
  4884. h.GetAttributeDataArrayForAllPoints(d, _, R, S, j2);
  4885. const F = new w(u.HEAPF32.buffer, j2, I).slice();
  4886. return u._free(j2), {
  4887. name: g,
  4888. array: F,
  4889. itemSize: y
  4890. };
  4891. }
  4892. function c(u, h) {
  4893. switch (h) {
  4894. case Float32Array:
  4895. return u.DT_FLOAT32;
  4896. case Int8Array:
  4897. return u.DT_INT8;
  4898. case Int16Array:
  4899. return u.DT_INT16;
  4900. case Int32Array:
  4901. return u.DT_INT32;
  4902. case Uint8Array:
  4903. return u.DT_UINT8;
  4904. case Uint16Array:
  4905. return u.DT_UINT16;
  4906. case Uint32Array:
  4907. return u.DT_UINT32;
  4908. }
  4909. }
  4910. }
  4911. function Fn() {
  4912. const { state: b, setState: i } = inject("useTres", L()), r = inject("extend") || (() => {
  4913. });
  4914. return {
  4915. state: b,
  4916. setState: i,
  4917. extend: r
  4918. };
  4919. }
  4920. var ah = ["args"];
  4921. var ud = defineComponent({
  4922. __name: "OrbitControls",
  4923. props: {
  4924. makeDefault: { type: Boolean, default: false },
  4925. camera: null,
  4926. domElement: null,
  4927. target: null,
  4928. enableDamping: { type: Boolean }
  4929. },
  4930. setup(b) {
  4931. const i = b, { state: r, setState: s, extend: a } = Fn(), c = ref(null);
  4932. return a({ OrbitControls: iu }), watch(c, (u) => {
  4933. u && i.makeDefault ? s("controls", u) : s("controls", null);
  4934. }), (u, h) => {
  4935. var d;
  4936. return unref(r).camera && unref(r).renderer ? (openBlock(), createElementBlock("TresOrbitControls", {
  4937. key: 0,
  4938. ref_key: "controls",
  4939. ref: c,
  4940. args: [unref(unref(r).camera) || b.camera, ((d = unref(r).renderer) == null ? void 0 : d.domElement) || b.domElement]
  4941. }, null, 8, ah)) : createCommentVNode("", true);
  4942. };
  4943. }
  4944. });
  4945. function lh(b, i) {
  4946. const r = {};
  4947. for (const s of i)
  4948. Object.prototype.hasOwnProperty.call(b, s) && (r[s] = b[s]);
  4949. return r;
  4950. }
  4951. function ch(b, i) {
  4952. const r = `set${i[0].toUpperCase()}${i.slice(1)}`;
  4953. return b[r] !== void 0;
  4954. }
  4955. var hd = defineComponent({
  4956. __name: "TransformControls",
  4957. props: {
  4958. object: null,
  4959. mode: null,
  4960. enabled: { type: Boolean, default: true },
  4961. axis: null,
  4962. translationSnap: null,
  4963. rotationSnap: null,
  4964. scaleSnap: null,
  4965. space: null,
  4966. size: null,
  4967. showX: { type: Boolean },
  4968. showY: { type: Boolean },
  4969. showZ: { type: Boolean }
  4970. },
  4971. emits: ["dragging", "change", "mouseDown", "mouseUp", "objectChange"],
  4972. setup(b, { emit: i }) {
  4973. const r = b;
  4974. let s = shallowRef();
  4975. const { state: a } = Fn(), c = computed(
  4976. () => lh(r, [
  4977. "enabled",
  4978. "axis",
  4979. "mode",
  4980. "translationSnap",
  4981. "rotationSnap",
  4982. "scaleSnap",
  4983. "space",
  4984. "size",
  4985. "showX",
  4986. "showY",
  4987. "showZ"
  4988. ])
  4989. ), u = () => i("change", s.value), h = () => i("mouseDown", s.value), d = () => i("mouseUp", s.value), g = () => i("objectChange", s.value), w = (y) => {
  4990. a.controls && (a.controls.enabled = !y.value), i("dragging", y.value);
  4991. };
  4992. function _(y) {
  4993. y.addEventListener("dragging-changed", w), y.addEventListener("change", u), y.addEventListener("mouseDown", h), y.addEventListener("mouseUp", d), y.addEventListener("objectChange", g);
  4994. }
  4995. return watchEffect(() => {
  4996. a.camera && a.renderer && a.scene && r.object && (s.value = new eu(a.camera, a.renderer.domElement), s.value.attach(r.object), a.scene.add(s.value), _(s.value));
  4997. }), watch(
  4998. [c, s],
  4999. // TODO: properly type this
  5000. ([y, C]) => {
  5001. if (y && C)
  5002. for (const I in y)
  5003. if (!ch(C, I))
  5004. C[I] = y[I];
  5005. else {
  5006. const S = `set${I[0].toUpperCase()}${I.slice(1)}`;
  5007. typeof C[S] == "function" && y[I] !== void 0 && C[S](y[I]);
  5008. }
  5009. },
  5010. {
  5011. immediate: true
  5012. }
  5013. ), onUnmounted(() => {
  5014. s.value && (s.value.removeEventListener("dragging-changed", w), s.value.removeEventListener("change", u), s.value.removeEventListener("mouseDown", h), s.value.removeEventListener("mouseUp", d), s.value.removeEventListener("objectChange", g));
  5015. }), (y, C) => renderSlot(y.$slots, "default");
  5016. }
  5017. });
  5018. var ga;
  5019. var tl = typeof window < "u";
  5020. var ph = (b) => typeof b == "string";
  5021. var uh = () => {
  5022. };
  5023. tl && ((ga = window == null ? void 0 : window.navigator) != null && ga.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
  5024. function nl(b) {
  5025. return typeof b == "function" ? b() : unref(b);
  5026. }
  5027. function hh(b) {
  5028. return b;
  5029. }
  5030. function dh(b) {
  5031. return getCurrentScope() ? (onScopeDispose(b), true) : false;
  5032. }
  5033. function mh(b, i = true) {
  5034. getCurrentInstance() ? onMounted(b) : i ? b() : nextTick(b);
  5035. }
  5036. function fh(b) {
  5037. var i;
  5038. const r = nl(b);
  5039. return (i = r == null ? void 0 : r.$el) != null ? i : r;
  5040. }
  5041. var _o = tl ? window : void 0;
  5042. function Vn(...b) {
  5043. let i, r, s, a;
  5044. if (ph(b[0]) || Array.isArray(b[0]) ? ([r, s, a] = b, i = _o) : [i, r, s, a] = b, !i)
  5045. return uh;
  5046. Array.isArray(r) || (r = [r]), Array.isArray(s) || (s = [s]);
  5047. const c = [], u = () => {
  5048. c.forEach((w) => w()), c.length = 0;
  5049. }, h = (w, _, y, C) => (w.addEventListener(_, y, C), () => w.removeEventListener(_, y, C)), d = watch(() => [fh(i), nl(a)], ([w, _]) => {
  5050. u(), w && c.push(...r.flatMap((y) => s.map((C) => h(w, y, C, _))));
  5051. }, { immediate: true, flush: "post" }), g = () => {
  5052. d(), u();
  5053. };
  5054. return dh(g), g;
  5055. }
  5056. var _a = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
  5057. var wa = "__vueuse_ssr_handlers__";
  5058. _a[wa] = _a[wa] || {};
  5059. function vh(b = {}) {
  5060. const {
  5061. type: i = "page",
  5062. touch: r = true,
  5063. resetOnTouchEnds: s = false,
  5064. initialValue: a = { x: 0, y: 0 },
  5065. window: c = _o,
  5066. eventFilter: u
  5067. } = b, h = ref(a.x), d = ref(a.y), g = ref(null), w = (S) => {
  5068. i === "page" ? (h.value = S.pageX, d.value = S.pageY) : i === "client" ? (h.value = S.clientX, d.value = S.clientY) : i === "movement" && (h.value = S.movementX, d.value = S.movementY), g.value = "mouse";
  5069. }, _ = () => {
  5070. h.value = a.x, d.value = a.y;
  5071. }, y = (S) => {
  5072. if (S.touches.length > 0) {
  5073. const R = S.touches[0];
  5074. i === "page" ? (h.value = R.pageX, d.value = R.pageY) : i === "client" && (h.value = R.clientX, d.value = R.clientY), g.value = "touch";
  5075. }
  5076. }, C = (S) => u === void 0 ? w(S) : u(() => w(S), {}), I = (S) => u === void 0 ? y(S) : u(() => y(S), {});
  5077. return c && (Vn(c, "mousemove", C, { passive: true }), Vn(c, "dragover", C, { passive: true }), r && i !== "movement" && (Vn(c, "touchstart", I, { passive: true }), Vn(c, "touchmove", I, { passive: true }), s && Vn(c, "touchend", _, { passive: true }))), {
  5078. x: h,
  5079. y: d,
  5080. sourceType: g
  5081. };
  5082. }
  5083. var ya;
  5084. (function(b) {
  5085. b.UP = "UP", b.RIGHT = "RIGHT", b.DOWN = "DOWN", b.LEFT = "LEFT", b.NONE = "NONE";
  5086. })(ya || (ya = {}));
  5087. var bh = Object.defineProperty;
  5088. var xa = Object.getOwnPropertySymbols;
  5089. var gh = Object.prototype.hasOwnProperty;
  5090. var _h = Object.prototype.propertyIsEnumerable;
  5091. var Ea = (b, i, r) => i in b ? bh(b, i, { enumerable: true, configurable: true, writable: true, value: r }) : b[i] = r;
  5092. var wh = (b, i) => {
  5093. for (var r in i || (i = {}))
  5094. gh.call(i, r) && Ea(b, r, i[r]);
  5095. if (xa)
  5096. for (var r of xa(i))
  5097. _h.call(i, r) && Ea(b, r, i[r]);
  5098. return b;
  5099. };
  5100. var yh = {
  5101. easeInSine: [0.12, 0, 0.39, 0],
  5102. easeOutSine: [0.61, 1, 0.88, 1],
  5103. easeInOutSine: [0.37, 0, 0.63, 1],
  5104. easeInQuad: [0.11, 0, 0.5, 0],
  5105. easeOutQuad: [0.5, 1, 0.89, 1],
  5106. easeInOutQuad: [0.45, 0, 0.55, 1],
  5107. easeInCubic: [0.32, 0, 0.67, 0],
  5108. easeOutCubic: [0.33, 1, 0.68, 1],
  5109. easeInOutCubic: [0.65, 0, 0.35, 1],
  5110. easeInQuart: [0.5, 0, 0.75, 0],
  5111. easeOutQuart: [0.25, 1, 0.5, 1],
  5112. easeInOutQuart: [0.76, 0, 0.24, 1],
  5113. easeInQuint: [0.64, 0, 0.78, 0],
  5114. easeOutQuint: [0.22, 1, 0.36, 1],
  5115. easeInOutQuint: [0.83, 0, 0.17, 1],
  5116. easeInExpo: [0.7, 0, 0.84, 0],
  5117. easeOutExpo: [0.16, 1, 0.3, 1],
  5118. easeInOutExpo: [0.87, 0, 0.13, 1],
  5119. easeInCirc: [0.55, 0, 1, 0.45],
  5120. easeOutCirc: [0, 0.55, 0.45, 1],
  5121. easeInOutCirc: [0.85, 0, 0.15, 1],
  5122. easeInBack: [0.36, 0, 0.66, -0.56],
  5123. easeOutBack: [0.34, 1.56, 0.64, 1],
  5124. easeInOutBack: [0.68, -0.6, 0.32, 1.6]
  5125. };
  5126. wh({
  5127. linear: hh
  5128. }, yh);
  5129. function xh(b = {}) {
  5130. const {
  5131. window: i = _o,
  5132. initialWidth: r = 1 / 0,
  5133. initialHeight: s = 1 / 0,
  5134. listenOrientation: a = true,
  5135. includeScrollbar: c = true
  5136. } = b, u = ref(r), h = ref(s), d = () => {
  5137. i && (c ? (u.value = i.innerWidth, h.value = i.innerHeight) : (u.value = i.document.documentElement.clientWidth, h.value = i.document.documentElement.clientHeight));
  5138. };
  5139. return d(), mh(d), Vn("resize", d, { passive: true }), a && Vn("orientationchange", d, { passive: true }), { width: u, height: h };
  5140. }
  5141. function Eh(b = false, i = 5, r) {
  5142. const { x: s, y: a } = vh(), { logWarning: c } = j(), { width: u, height: h } = xh(), d = computed(() => (s.value / u.value - 0.5) * i), g = computed(() => -(a.value / h.value - 0.5) * i);
  5143. if (r) {
  5144. const { x: w, y: _ } = r.position;
  5145. watchEffect(() => {
  5146. b || r && (r.position.x = w + d.value, r.position.y = _ + g.value);
  5147. });
  5148. } else
  5149. c("Scene must contain a Camera component to use this composable");
  5150. }
  5151. var dd = defineComponent({
  5152. name: "PamCameraMouse",
  5153. props: ["disabled", "factor"],
  5154. setup(b) {
  5155. const { state: i } = Fn();
  5156. return watchEffect(() => {
  5157. if (i != null && i.camera) {
  5158. const r = i == null ? void 0 : i.camera;
  5159. Eh(b.disabled, b.factor, r);
  5160. }
  5161. }), () => {
  5162. };
  5163. }
  5164. });
  5165. var js = {};
  5166. var Ch = {
  5167. get exports() {
  5168. return js;
  5169. },
  5170. set exports(b) {
  5171. js = b;
  5172. }
  5173. };
  5174. (function(b, i) {
  5175. (function(r, s) {
  5176. s(i);
  5177. })(el, function(r) {
  5178. class s {
  5179. /**
  5180. * @hidden
  5181. */
  5182. constructor(e) {
  5183. const [t, l] = e.split("-"), v = t.split(".");
  5184. this.major = parseInt(v[0], 10), this.minor = parseInt(v[1], 10), this.patch = parseInt(v[2], 10), this.prerelease = l ?? null;
  5185. }
  5186. toString() {
  5187. const e = [this.major, this.minor, this.patch].join(".");
  5188. return this.prerelease !== null ? [e, this.prerelease].join("-") : e;
  5189. }
  5190. }
  5191. class a {
  5192. constructor(e) {
  5193. this.controller_ = e;
  5194. }
  5195. get element() {
  5196. return this.controller_.view.element;
  5197. }
  5198. get disabled() {
  5199. return this.controller_.viewProps.get("disabled");
  5200. }
  5201. set disabled(e) {
  5202. this.controller_.viewProps.set("disabled", e);
  5203. }
  5204. get hidden() {
  5205. return this.controller_.viewProps.get("hidden");
  5206. }
  5207. set hidden(e) {
  5208. this.controller_.viewProps.set("hidden", e);
  5209. }
  5210. dispose() {
  5211. this.controller_.viewProps.set("disposed", true);
  5212. }
  5213. }
  5214. class c {
  5215. constructor(e) {
  5216. this.target = e;
  5217. }
  5218. }
  5219. class u extends c {
  5220. constructor(e, t, l, v) {
  5221. super(e), this.value = t, this.presetKey = l, this.last = v ?? true;
  5222. }
  5223. }
  5224. class h extends c {
  5225. constructor(e, t, l) {
  5226. super(e), this.value = t, this.presetKey = l;
  5227. }
  5228. }
  5229. class d extends c {
  5230. constructor(e, t) {
  5231. super(e), this.expanded = t;
  5232. }
  5233. }
  5234. class g extends c {
  5235. constructor(e, t) {
  5236. super(e), this.index = t;
  5237. }
  5238. }
  5239. function w(n) {
  5240. return n;
  5241. }
  5242. function _(n) {
  5243. return n == null;
  5244. }
  5245. function y(n, e) {
  5246. if (n.length !== e.length)
  5247. return false;
  5248. for (let t = 0; t < n.length; t++)
  5249. if (n[t] !== e[t])
  5250. return false;
  5251. return true;
  5252. }
  5253. function C(n, e) {
  5254. let t = n;
  5255. do {
  5256. const l = Object.getOwnPropertyDescriptor(t, e);
  5257. if (l && (l.set !== void 0 || l.writable === true))
  5258. return true;
  5259. t = Object.getPrototypeOf(t);
  5260. } while (t !== null);
  5261. return false;
  5262. }
  5263. const I = {
  5264. alreadydisposed: () => "View has been already disposed",
  5265. invalidparams: (n) => `Invalid parameters for '${n.name}'`,
  5266. nomatchingcontroller: (n) => `No matching controller for '${n.key}'`,
  5267. nomatchingview: (n) => `No matching view for '${JSON.stringify(n.params)}'`,
  5268. notbindable: () => "Value is not bindable",
  5269. propertynotfound: (n) => `Property '${n.name}' not found`,
  5270. shouldneverhappen: () => "This error should never happen"
  5271. };
  5272. class S {
  5273. static alreadyDisposed() {
  5274. return new S({ type: "alreadydisposed" });
  5275. }
  5276. static notBindable() {
  5277. return new S({
  5278. type: "notbindable"
  5279. });
  5280. }
  5281. static propertyNotFound(e) {
  5282. return new S({
  5283. type: "propertynotfound",
  5284. context: {
  5285. name: e
  5286. }
  5287. });
  5288. }
  5289. static shouldNeverHappen() {
  5290. return new S({ type: "shouldneverhappen" });
  5291. }
  5292. constructor(e) {
  5293. var t;
  5294. this.message = (t = I[e.type](e.context)) !== null && t !== void 0 ? t : "Unexpected error", this.name = this.constructor.name, this.stack = new Error(this.message).stack, this.type = e.type;
  5295. }
  5296. }
  5297. class R {
  5298. constructor(e, t, l) {
  5299. this.obj_ = e, this.key_ = t, this.presetKey_ = l ?? t;
  5300. }
  5301. static isBindable(e) {
  5302. return !(e === null || typeof e != "object");
  5303. }
  5304. get key() {
  5305. return this.key_;
  5306. }
  5307. get presetKey() {
  5308. return this.presetKey_;
  5309. }
  5310. read() {
  5311. return this.obj_[this.key_];
  5312. }
  5313. write(e) {
  5314. this.obj_[this.key_] = e;
  5315. }
  5316. writeProperty(e, t) {
  5317. const l = this.read();
  5318. if (!R.isBindable(l))
  5319. throw S.notBindable();
  5320. if (!(e in l))
  5321. throw S.propertyNotFound(e);
  5322. l[e] = t;
  5323. }
  5324. }
  5325. class j2 extends a {
  5326. get label() {
  5327. return this.controller_.props.get("label");
  5328. }
  5329. set label(e) {
  5330. this.controller_.props.set("label", e);
  5331. }
  5332. get title() {
  5333. var e;
  5334. return (e = this.controller_.valueController.props.get("title")) !== null && e !== void 0 ? e : "";
  5335. }
  5336. set title(e) {
  5337. this.controller_.valueController.props.set("title", e);
  5338. }
  5339. on(e, t) {
  5340. const l = t.bind(this);
  5341. return this.controller_.valueController.emitter.on(e, () => {
  5342. l(new c(this));
  5343. }), this;
  5344. }
  5345. }
  5346. class F {
  5347. constructor() {
  5348. this.observers_ = {};
  5349. }
  5350. on(e, t) {
  5351. let l = this.observers_[e];
  5352. return l || (l = this.observers_[e] = []), l.push({
  5353. handler: t
  5354. }), this;
  5355. }
  5356. off(e, t) {
  5357. const l = this.observers_[e];
  5358. return l && (this.observers_[e] = l.filter((v) => v.handler !== t)), this;
  5359. }
  5360. emit(e, t) {
  5361. const l = this.observers_[e];
  5362. l && l.forEach((v) => {
  5363. v.handler(t);
  5364. });
  5365. }
  5366. }
  5367. const V = "tp";
  5368. function D(n) {
  5369. return (t, l) => [
  5370. V,
  5371. "-",
  5372. n,
  5373. "v",
  5374. t ? `_${t}` : "",
  5375. l ? `-${l}` : ""
  5376. ].join("");
  5377. }
  5378. function Y(n, e) {
  5379. return (t) => e(n(t));
  5380. }
  5381. function G(n) {
  5382. return n.rawValue;
  5383. }
  5384. function N(n, e) {
  5385. n.emitter.on("change", Y(G, e)), e(n.rawValue);
  5386. }
  5387. function O(n, e, t) {
  5388. N(n.value(e), t);
  5389. }
  5390. function H(n, e, t) {
  5391. t ? n.classList.add(e) : n.classList.remove(e);
  5392. }
  5393. function K(n, e) {
  5394. return (t) => {
  5395. H(n, e, t);
  5396. };
  5397. }
  5398. function q(n, e) {
  5399. N(n, (t) => {
  5400. e.textContent = t ?? "";
  5401. });
  5402. }
  5403. const ue = D("btn");
  5404. class ge {
  5405. constructor(e, t) {
  5406. this.element = e.createElement("div"), this.element.classList.add(ue()), t.viewProps.bindClassModifiers(this.element);
  5407. const l = e.createElement("button");
  5408. l.classList.add(ue("b")), t.viewProps.bindDisabled(l), this.element.appendChild(l), this.buttonElement = l;
  5409. const v = e.createElement("div");
  5410. v.classList.add(ue("t")), q(t.props.value("title"), v), this.buttonElement.appendChild(v);
  5411. }
  5412. }
  5413. class ce {
  5414. constructor(e, t) {
  5415. this.emitter = new F(), this.onClick_ = this.onClick_.bind(this), this.props = t.props, this.viewProps = t.viewProps, this.view = new ge(e, {
  5416. props: this.props,
  5417. viewProps: this.viewProps
  5418. }), this.view.buttonElement.addEventListener("click", this.onClick_);
  5419. }
  5420. onClick_() {
  5421. this.emitter.emit("click", {
  5422. sender: this
  5423. });
  5424. }
  5425. }
  5426. class me {
  5427. constructor(e, t) {
  5428. var l;
  5429. this.constraint_ = t == null ? void 0 : t.constraint, this.equals_ = (l = t == null ? void 0 : t.equals) !== null && l !== void 0 ? l : (v, E) => v === E, this.emitter = new F(), this.rawValue_ = e;
  5430. }
  5431. get constraint() {
  5432. return this.constraint_;
  5433. }
  5434. get rawValue() {
  5435. return this.rawValue_;
  5436. }
  5437. set rawValue(e) {
  5438. this.setRawValue(e, {
  5439. forceEmit: false,
  5440. last: true
  5441. });
  5442. }
  5443. setRawValue(e, t) {
  5444. const l = t ?? {
  5445. forceEmit: false,
  5446. last: true
  5447. }, v = this.constraint_ ? this.constraint_.constrain(e) : e, E = this.rawValue_;
  5448. this.equals_(E, v) && !l.forceEmit || (this.emitter.emit("beforechange", {
  5449. sender: this
  5450. }), this.rawValue_ = v, this.emitter.emit("change", {
  5451. options: l,
  5452. previousRawValue: E,
  5453. rawValue: v,
  5454. sender: this
  5455. }));
  5456. }
  5457. }
  5458. class he {
  5459. constructor(e) {
  5460. this.emitter = new F(), this.value_ = e;
  5461. }
  5462. get rawValue() {
  5463. return this.value_;
  5464. }
  5465. set rawValue(e) {
  5466. this.setRawValue(e, {
  5467. forceEmit: false,
  5468. last: true
  5469. });
  5470. }
  5471. setRawValue(e, t) {
  5472. const l = t ?? {
  5473. forceEmit: false,
  5474. last: true
  5475. }, v = this.value_;
  5476. v === e && !l.forceEmit || (this.emitter.emit("beforechange", {
  5477. sender: this
  5478. }), this.value_ = e, this.emitter.emit("change", {
  5479. options: l,
  5480. previousRawValue: v,
  5481. rawValue: this.value_,
  5482. sender: this
  5483. }));
  5484. }
  5485. }
  5486. function ee(n, e) {
  5487. const t = e == null ? void 0 : e.constraint, l = e == null ? void 0 : e.equals;
  5488. return !t && !l ? new he(n) : new me(n, e);
  5489. }
  5490. class X {
  5491. constructor(e) {
  5492. this.emitter = new F(), this.valMap_ = e;
  5493. for (const t in this.valMap_)
  5494. this.valMap_[t].emitter.on("change", () => {
  5495. this.emitter.emit("change", {
  5496. key: t,
  5497. sender: this
  5498. });
  5499. });
  5500. }
  5501. static createCore(e) {
  5502. return Object.keys(e).reduce((l, v) => Object.assign(l, {
  5503. [v]: ee(e[v])
  5504. }), {});
  5505. }
  5506. static fromObject(e) {
  5507. const t = this.createCore(e);
  5508. return new X(t);
  5509. }
  5510. get(e) {
  5511. return this.valMap_[e].rawValue;
  5512. }
  5513. set(e, t) {
  5514. this.valMap_[e].rawValue = t;
  5515. }
  5516. value(e) {
  5517. return this.valMap_[e];
  5518. }
  5519. }
  5520. function Pe(n, e) {
  5521. const l = Object.keys(e).reduce((v, E) => {
  5522. if (v === void 0)
  5523. return;
  5524. const k = e[E], B = k(n[E]);
  5525. return B.succeeded ? Object.assign(Object.assign({}, v), { [E]: B.value }) : void 0;
  5526. }, {});
  5527. return l;
  5528. }
  5529. function fe(n, e) {
  5530. return n.reduce((t, l) => {
  5531. if (t === void 0)
  5532. return;
  5533. const v = e(l);
  5534. if (!(!v.succeeded || v.value === void 0))
  5535. return [...t, v.value];
  5536. }, []);
  5537. }
  5538. function ae(n) {
  5539. return n === null ? false : typeof n == "object";
  5540. }
  5541. function ne(n) {
  5542. return (e) => (t) => {
  5543. if (!e && t === void 0)
  5544. return {
  5545. succeeded: false,
  5546. value: void 0
  5547. };
  5548. if (e && t === void 0)
  5549. return {
  5550. succeeded: true,
  5551. value: void 0
  5552. };
  5553. const l = n(t);
  5554. return l !== void 0 ? {
  5555. succeeded: true,
  5556. value: l
  5557. } : {
  5558. succeeded: false,
  5559. value: void 0
  5560. };
  5561. };
  5562. }
  5563. function be(n) {
  5564. return {
  5565. custom: (e) => ne(e)(n),
  5566. boolean: ne((e) => typeof e == "boolean" ? e : void 0)(n),
  5567. number: ne((e) => typeof e == "number" ? e : void 0)(n),
  5568. string: ne((e) => typeof e == "string" ? e : void 0)(n),
  5569. function: ne((e) => typeof e == "function" ? e : void 0)(n),
  5570. constant: (e) => ne((t) => t === e ? e : void 0)(n),
  5571. raw: ne((e) => e)(n),
  5572. object: (e) => ne((t) => {
  5573. if (ae(t))
  5574. return Pe(t, e);
  5575. })(n),
  5576. array: (e) => ne((t) => {
  5577. if (Array.isArray(t))
  5578. return fe(t, e);
  5579. })(n)
  5580. };
  5581. }
  5582. const M = {
  5583. optional: be(true),
  5584. required: be(false)
  5585. };
  5586. function le(n, e) {
  5587. const t = M.required.object(e)(n);
  5588. return t.succeeded ? t.value : void 0;
  5589. }
  5590. function Ve(n) {
  5591. console.warn([
  5592. `Missing '${n.key}' of ${n.target} in ${n.place}.`,
  5593. "Please rebuild plugins with the latest core package."
  5594. ].join(" "));
  5595. }
  5596. function Ne(n) {
  5597. return n && n.parentElement && n.parentElement.removeChild(n), null;
  5598. }
  5599. class we {
  5600. constructor(e) {
  5601. this.value_ = e;
  5602. }
  5603. static create(e) {
  5604. return [
  5605. new we(e),
  5606. (t, l) => {
  5607. e.setRawValue(t, l);
  5608. }
  5609. ];
  5610. }
  5611. get emitter() {
  5612. return this.value_.emitter;
  5613. }
  5614. get rawValue() {
  5615. return this.value_.rawValue;
  5616. }
  5617. }
  5618. const it = D("");
  5619. function Bn(n, e) {
  5620. return K(n, it(void 0, e));
  5621. }
  5622. class Xe extends X {
  5623. constructor(e) {
  5624. var t;
  5625. super(e), this.onDisabledChange_ = this.onDisabledChange_.bind(this), this.onParentChange_ = this.onParentChange_.bind(this), this.onParentGlobalDisabledChange_ = this.onParentGlobalDisabledChange_.bind(this), [this.globalDisabled_, this.setGlobalDisabled_] = we.create(ee(this.getGlobalDisabled_())), this.value("disabled").emitter.on("change", this.onDisabledChange_), this.value("parent").emitter.on("change", this.onParentChange_), (t = this.get("parent")) === null || t === void 0 || t.globalDisabled.emitter.on("change", this.onParentGlobalDisabledChange_);
  5626. }
  5627. static create(e) {
  5628. var t, l, v;
  5629. const E = e ?? {};
  5630. return new Xe(X.createCore({
  5631. disabled: (t = E.disabled) !== null && t !== void 0 ? t : false,
  5632. disposed: false,
  5633. hidden: (l = E.hidden) !== null && l !== void 0 ? l : false,
  5634. parent: (v = E.parent) !== null && v !== void 0 ? v : null
  5635. }));
  5636. }
  5637. get globalDisabled() {
  5638. return this.globalDisabled_;
  5639. }
  5640. bindClassModifiers(e) {
  5641. N(this.globalDisabled_, Bn(e, "disabled")), O(this, "hidden", Bn(e, "hidden"));
  5642. }
  5643. bindDisabled(e) {
  5644. N(this.globalDisabled_, (t) => {
  5645. e.disabled = t;
  5646. });
  5647. }
  5648. bindTabIndex(e) {
  5649. N(this.globalDisabled_, (t) => {
  5650. e.tabIndex = t ? -1 : 0;
  5651. });
  5652. }
  5653. handleDispose(e) {
  5654. this.value("disposed").emitter.on("change", (t) => {
  5655. t && e();
  5656. });
  5657. }
  5658. getGlobalDisabled_() {
  5659. const e = this.get("parent");
  5660. return (e ? e.globalDisabled.rawValue : false) || this.get("disabled");
  5661. }
  5662. updateGlobalDisabled_() {
  5663. this.setGlobalDisabled_(this.getGlobalDisabled_());
  5664. }
  5665. onDisabledChange_() {
  5666. this.updateGlobalDisabled_();
  5667. }
  5668. onParentGlobalDisabledChange_() {
  5669. this.updateGlobalDisabled_();
  5670. }
  5671. onParentChange_(e) {
  5672. var t;
  5673. const l = e.previousRawValue;
  5674. l == null || l.globalDisabled.emitter.off("change", this.onParentGlobalDisabledChange_), (t = this.get("parent")) === null || t === void 0 || t.globalDisabled.emitter.on("change", this.onParentGlobalDisabledChange_), this.updateGlobalDisabled_();
  5675. }
  5676. }
  5677. function jn() {
  5678. return ["veryfirst", "first", "last", "verylast"];
  5679. }
  5680. const an = D(""), dt2 = {
  5681. veryfirst: "vfst",
  5682. first: "fst",
  5683. last: "lst",
  5684. verylast: "vlst"
  5685. };
  5686. class Mt {
  5687. constructor(e) {
  5688. this.parent_ = null, this.blade = e.blade, this.view = e.view, this.viewProps = e.viewProps;
  5689. const t = this.view.element;
  5690. this.blade.value("positions").emitter.on("change", () => {
  5691. jn().forEach((l) => {
  5692. t.classList.remove(an(void 0, dt2[l]));
  5693. }), this.blade.get("positions").forEach((l) => {
  5694. t.classList.add(an(void 0, dt2[l]));
  5695. });
  5696. }), this.viewProps.handleDispose(() => {
  5697. Ne(t);
  5698. });
  5699. }
  5700. get parent() {
  5701. return this.parent_;
  5702. }
  5703. set parent(e) {
  5704. if (this.parent_ = e, !("parent" in this.viewProps.valMap_)) {
  5705. Ve({
  5706. key: "parent",
  5707. target: Xe.name,
  5708. place: "BladeController.parent"
  5709. });
  5710. return;
  5711. }
  5712. this.viewProps.set("parent", this.parent_ ? this.parent_.viewProps : null);
  5713. }
  5714. }
  5715. const ze = "http://www.w3.org/2000/svg";
  5716. function st(n) {
  5717. n.offsetHeight;
  5718. }
  5719. function ln(n, e) {
  5720. const t = n.style.transition;
  5721. n.style.transition = "none", e(), n.style.transition = t;
  5722. }
  5723. function mt(n) {
  5724. return n.ontouchstart !== void 0;
  5725. }
  5726. function zn() {
  5727. return globalThis;
  5728. }
  5729. function hi() {
  5730. return zn().document;
  5731. }
  5732. function Un(n) {
  5733. const e = n.ownerDocument.defaultView;
  5734. return e && "document" in e ? n.getContext("2d", {
  5735. willReadFrequently: true
  5736. }) : null;
  5737. }
  5738. const Gn = {
  5739. check: '<path d="M2 8l4 4l8 -8"/>',
  5740. dropdown: '<path d="M5 7h6l-3 3 z"/>',
  5741. p2dpad: '<path d="M8 4v8"/><path d="M4 8h8"/><circle cx="12" cy="12" r="1.2"/>'
  5742. };
  5743. function yt(n, e) {
  5744. const t = n.createElementNS(ze, "svg");
  5745. return t.innerHTML = Gn[e], t;
  5746. }
  5747. function St(n, e, t) {
  5748. n.insertBefore(e, n.children[t]);
  5749. }
  5750. function Hn(n) {
  5751. n.parentElement && n.parentElement.removeChild(n);
  5752. }
  5753. function cn(n) {
  5754. for (; n.children.length > 0; )
  5755. n.removeChild(n.children[0]);
  5756. }
  5757. function Kn(n) {
  5758. for (; n.childNodes.length > 0; )
  5759. n.removeChild(n.childNodes[0]);
  5760. }
  5761. function xt(n) {
  5762. return n.relatedTarget ? n.relatedTarget : "explicitOriginalTarget" in n ? n.explicitOriginalTarget : null;
  5763. }
  5764. const ft = D("lbl");
  5765. function At(n, e) {
  5766. const t = n.createDocumentFragment();
  5767. return e.split(`
  5768. `).map((v) => n.createTextNode(v)).forEach((v, E) => {
  5769. E > 0 && t.appendChild(n.createElement("br")), t.appendChild(v);
  5770. }), t;
  5771. }
  5772. class A {
  5773. constructor(e, t) {
  5774. this.element = e.createElement("div"), this.element.classList.add(ft()), t.viewProps.bindClassModifiers(this.element);
  5775. const l = e.createElement("div");
  5776. l.classList.add(ft("l")), O(t.props, "label", (E) => {
  5777. _(E) ? this.element.classList.add(ft(void 0, "nol")) : (this.element.classList.remove(ft(void 0, "nol")), Kn(l), l.appendChild(At(e, E)));
  5778. }), this.element.appendChild(l), this.labelElement = l;
  5779. const v = e.createElement("div");
  5780. v.classList.add(ft("v")), this.element.appendChild(v), this.valueElement = v;
  5781. }
  5782. }
  5783. class U extends Mt {
  5784. constructor(e, t) {
  5785. const l = t.valueController.viewProps;
  5786. super(Object.assign(Object.assign({}, t), { view: new A(e, {
  5787. props: t.props,
  5788. viewProps: l
  5789. }), viewProps: l })), this.props = t.props, this.valueController = t.valueController, this.view.valueElement.appendChild(this.valueController.view.element);
  5790. }
  5791. }
  5792. const W = {
  5793. id: "button",
  5794. type: "blade",
  5795. accept(n) {
  5796. const e = M, t = le(n, {
  5797. title: e.required.string,
  5798. view: e.required.constant("button"),
  5799. label: e.optional.string
  5800. });
  5801. return t ? { params: t } : null;
  5802. },
  5803. controller(n) {
  5804. return new U(n.document, {
  5805. blade: n.blade,
  5806. props: X.fromObject({
  5807. label: n.params.label
  5808. }),
  5809. valueController: new ce(n.document, {
  5810. props: X.fromObject({
  5811. title: n.params.title
  5812. }),
  5813. viewProps: n.viewProps
  5814. })
  5815. });
  5816. },
  5817. api(n) {
  5818. return !(n.controller instanceof U) || !(n.controller.valueController instanceof ce) ? null : new j2(n.controller);
  5819. }
  5820. };
  5821. class ie extends Mt {
  5822. constructor(e) {
  5823. super(e), this.value = e.value;
  5824. }
  5825. }
  5826. function ye() {
  5827. return new X({
  5828. positions: ee([], {
  5829. equals: y
  5830. })
  5831. });
  5832. }
  5833. class De extends X {
  5834. constructor(e) {
  5835. super(e);
  5836. }
  5837. static create(e) {
  5838. const t = {
  5839. completed: true,
  5840. expanded: e,
  5841. expandedHeight: null,
  5842. shouldFixHeight: false,
  5843. temporaryExpanded: null
  5844. }, l = X.createCore(t);
  5845. return new De(l);
  5846. }
  5847. get styleExpanded() {
  5848. var e;
  5849. return (e = this.get("temporaryExpanded")) !== null && e !== void 0 ? e : this.get("expanded");
  5850. }
  5851. get styleHeight() {
  5852. if (!this.styleExpanded)
  5853. return "0";
  5854. const e = this.get("expandedHeight");
  5855. return this.get("shouldFixHeight") && !_(e) ? `${e}px` : "auto";
  5856. }
  5857. bindExpandedClass(e, t) {
  5858. const l = () => {
  5859. this.styleExpanded ? e.classList.add(t) : e.classList.remove(t);
  5860. };
  5861. O(this, "expanded", l), O(this, "temporaryExpanded", l);
  5862. }
  5863. cleanUpTransition() {
  5864. this.set("shouldFixHeight", false), this.set("expandedHeight", null), this.set("completed", true);
  5865. }
  5866. }
  5867. function Ut(n, e) {
  5868. let t = 0;
  5869. return ln(e, () => {
  5870. n.set("expandedHeight", null), n.set("temporaryExpanded", true), st(e), t = e.clientHeight, n.set("temporaryExpanded", null), st(e);
  5871. }), t;
  5872. }
  5873. function pn(n, e) {
  5874. e.style.height = n.styleHeight;
  5875. }
  5876. function Ue(n, e) {
  5877. n.value("expanded").emitter.on("beforechange", () => {
  5878. if (n.set("completed", false), _(n.get("expandedHeight"))) {
  5879. const t = Ut(n, e);
  5880. t > 0 && n.set("expandedHeight", t);
  5881. }
  5882. n.set("shouldFixHeight", true), st(e);
  5883. }), n.emitter.on("change", () => {
  5884. pn(n, e);
  5885. }), pn(n, e), e.addEventListener("transitionend", (t) => {
  5886. t.propertyName === "height" && n.cleanUpTransition();
  5887. });
  5888. }
  5889. class Ge extends a {
  5890. constructor(e, t) {
  5891. super(e), this.rackApi_ = t;
  5892. }
  5893. }
  5894. function Gs(n, e) {
  5895. return n.addBlade(Object.assign(Object.assign({}, e), { view: "button" }));
  5896. }
  5897. function Hs(n, e) {
  5898. return n.addBlade(Object.assign(Object.assign({}, e), { view: "folder" }));
  5899. }
  5900. function Ks(n, e) {
  5901. const t = e ?? {};
  5902. return n.addBlade(Object.assign(Object.assign({}, t), { view: "separator" }));
  5903. }
  5904. function di(n, e) {
  5905. return n.addBlade(Object.assign(Object.assign({}, e), { view: "tab" }));
  5906. }
  5907. class Lt {
  5908. constructor(e) {
  5909. this.emitter = new F(), this.items_ = [], this.cache_ = /* @__PURE__ */ new Set(), this.onSubListAdd_ = this.onSubListAdd_.bind(this), this.onSubListRemove_ = this.onSubListRemove_.bind(this), this.extract_ = e;
  5910. }
  5911. get items() {
  5912. return this.items_;
  5913. }
  5914. allItems() {
  5915. return Array.from(this.cache_);
  5916. }
  5917. find(e) {
  5918. for (const t of this.allItems())
  5919. if (e(t))
  5920. return t;
  5921. return null;
  5922. }
  5923. includes(e) {
  5924. return this.cache_.has(e);
  5925. }
  5926. add(e, t) {
  5927. if (this.includes(e))
  5928. throw S.shouldNeverHappen();
  5929. const l = t !== void 0 ? t : this.items_.length;
  5930. this.items_.splice(l, 0, e), this.cache_.add(e);
  5931. const v = this.extract_(e);
  5932. v && (v.emitter.on("add", this.onSubListAdd_), v.emitter.on("remove", this.onSubListRemove_), v.allItems().forEach((E) => {
  5933. this.cache_.add(E);
  5934. })), this.emitter.emit("add", {
  5935. index: l,
  5936. item: e,
  5937. root: this,
  5938. target: this
  5939. });
  5940. }
  5941. remove(e) {
  5942. const t = this.items_.indexOf(e);
  5943. if (t < 0)
  5944. return;
  5945. this.items_.splice(t, 1), this.cache_.delete(e);
  5946. const l = this.extract_(e);
  5947. l && (l.emitter.off("add", this.onSubListAdd_), l.emitter.off("remove", this.onSubListRemove_)), this.emitter.emit("remove", {
  5948. index: t,
  5949. item: e,
  5950. root: this,
  5951. target: this
  5952. });
  5953. }
  5954. onSubListAdd_(e) {
  5955. this.cache_.add(e.item), this.emitter.emit("add", {
  5956. index: e.index,
  5957. item: e.item,
  5958. root: this,
  5959. target: e.target
  5960. });
  5961. }
  5962. onSubListRemove_(e) {
  5963. this.cache_.delete(e.item), this.emitter.emit("remove", {
  5964. index: e.index,
  5965. item: e.item,
  5966. root: this,
  5967. target: e.target
  5968. });
  5969. }
  5970. }
  5971. class mi extends a {
  5972. constructor(e) {
  5973. super(e), this.onBindingChange_ = this.onBindingChange_.bind(this), this.emitter_ = new F(), this.controller_.binding.emitter.on("change", this.onBindingChange_);
  5974. }
  5975. get label() {
  5976. return this.controller_.props.get("label");
  5977. }
  5978. set label(e) {
  5979. this.controller_.props.set("label", e);
  5980. }
  5981. on(e, t) {
  5982. const l = t.bind(this);
  5983. return this.emitter_.on(e, (v) => {
  5984. l(v.event);
  5985. }), this;
  5986. }
  5987. refresh() {
  5988. this.controller_.binding.read();
  5989. }
  5990. onBindingChange_(e) {
  5991. const t = e.sender.target.read();
  5992. this.emitter_.emit("change", {
  5993. event: new u(this, t, this.controller_.binding.target.presetKey, e.options.last)
  5994. });
  5995. }
  5996. }
  5997. class Fe extends U {
  5998. constructor(e, t) {
  5999. super(e, t), this.binding = t.binding;
  6000. }
  6001. }
  6002. class fi extends a {
  6003. constructor(e) {
  6004. super(e), this.onBindingUpdate_ = this.onBindingUpdate_.bind(this), this.emitter_ = new F(), this.controller_.binding.emitter.on("update", this.onBindingUpdate_);
  6005. }
  6006. get label() {
  6007. return this.controller_.props.get("label");
  6008. }
  6009. set label(e) {
  6010. this.controller_.props.set("label", e);
  6011. }
  6012. on(e, t) {
  6013. const l = t.bind(this);
  6014. return this.emitter_.on(e, (v) => {
  6015. l(v.event);
  6016. }), this;
  6017. }
  6018. refresh() {
  6019. this.controller_.binding.read();
  6020. }
  6021. onBindingUpdate_(e) {
  6022. const t = e.sender.target.read();
  6023. this.emitter_.emit("update", {
  6024. event: new h(this, t, this.controller_.binding.target.presetKey)
  6025. });
  6026. }
  6027. }
  6028. class rt extends U {
  6029. constructor(e, t) {
  6030. super(e, t), this.binding = t.binding, this.viewProps.bindDisabled(this.binding.ticker), this.viewProps.handleDispose(() => {
  6031. this.binding.dispose();
  6032. });
  6033. }
  6034. }
  6035. function ts(n) {
  6036. return n instanceof $n ? n.apiSet_ : n instanceof Ge ? n.rackApi_.apiSet_ : null;
  6037. }
  6038. function un(n, e) {
  6039. const t = n.find((l) => l.controller_ === e);
  6040. if (!t)
  6041. throw S.shouldNeverHappen();
  6042. return t;
  6043. }
  6044. function ns(n, e, t) {
  6045. if (!R.isBindable(n))
  6046. throw S.notBindable();
  6047. return new R(n, e, t);
  6048. }
  6049. class $n extends a {
  6050. constructor(e, t) {
  6051. super(e), this.onRackAdd_ = this.onRackAdd_.bind(this), this.onRackRemove_ = this.onRackRemove_.bind(this), this.onRackInputChange_ = this.onRackInputChange_.bind(this), this.onRackMonitorUpdate_ = this.onRackMonitorUpdate_.bind(this), this.emitter_ = new F(), this.apiSet_ = new Lt(ts), this.pool_ = t;
  6052. const l = this.controller_.rack;
  6053. l.emitter.on("add", this.onRackAdd_), l.emitter.on("remove", this.onRackRemove_), l.emitter.on("inputchange", this.onRackInputChange_), l.emitter.on("monitorupdate", this.onRackMonitorUpdate_), l.children.forEach((v) => {
  6054. this.setUpApi_(v);
  6055. });
  6056. }
  6057. get children() {
  6058. return this.controller_.rack.children.map((e) => un(this.apiSet_, e));
  6059. }
  6060. addInput(e, t, l) {
  6061. const v = l ?? {}, E = this.controller_.view.element.ownerDocument, k = this.pool_.createInput(E, ns(e, t, v.presetKey), v), B = new mi(k);
  6062. return this.add(B, v.index);
  6063. }
  6064. addMonitor(e, t, l) {
  6065. const v = l ?? {}, E = this.controller_.view.element.ownerDocument, k = this.pool_.createMonitor(E, ns(e, t), v), B = new fi(k);
  6066. return this.add(B, v.index);
  6067. }
  6068. addFolder(e) {
  6069. return Hs(this, e);
  6070. }
  6071. addButton(e) {
  6072. return Gs(this, e);
  6073. }
  6074. addSeparator(e) {
  6075. return Ks(this, e);
  6076. }
  6077. addTab(e) {
  6078. return di(this, e);
  6079. }
  6080. add(e, t) {
  6081. this.controller_.rack.add(e.controller_, t);
  6082. const l = this.apiSet_.find((v) => v.controller_ === e.controller_);
  6083. return l && this.apiSet_.remove(l), this.apiSet_.add(e), e;
  6084. }
  6085. remove(e) {
  6086. this.controller_.rack.remove(e.controller_);
  6087. }
  6088. addBlade(e) {
  6089. const t = this.controller_.view.element.ownerDocument, l = this.pool_.createBlade(t, e), v = this.pool_.createBladeApi(l);
  6090. return this.add(v, e.index);
  6091. }
  6092. on(e, t) {
  6093. const l = t.bind(this);
  6094. return this.emitter_.on(e, (v) => {
  6095. l(v.event);
  6096. }), this;
  6097. }
  6098. setUpApi_(e) {
  6099. this.apiSet_.find((l) => l.controller_ === e) || this.apiSet_.add(this.pool_.createBladeApi(e));
  6100. }
  6101. onRackAdd_(e) {
  6102. this.setUpApi_(e.bladeController);
  6103. }
  6104. onRackRemove_(e) {
  6105. if (e.isRoot) {
  6106. const t = un(this.apiSet_, e.bladeController);
  6107. this.apiSet_.remove(t);
  6108. }
  6109. }
  6110. onRackInputChange_(e) {
  6111. const t = e.bladeController;
  6112. if (t instanceof Fe) {
  6113. const l = un(this.apiSet_, t), v = t.binding;
  6114. this.emitter_.emit("change", {
  6115. event: new u(l, v.target.read(), v.target.presetKey, e.options.last)
  6116. });
  6117. } else if (t instanceof ie) {
  6118. const l = un(this.apiSet_, t);
  6119. this.emitter_.emit("change", {
  6120. event: new u(l, t.value.rawValue, void 0, e.options.last)
  6121. });
  6122. }
  6123. }
  6124. onRackMonitorUpdate_(e) {
  6125. if (!(e.bladeController instanceof rt))
  6126. throw S.shouldNeverHappen();
  6127. const t = un(this.apiSet_, e.bladeController), l = e.bladeController.binding;
  6128. this.emitter_.emit("update", {
  6129. event: new h(t, l.target.read(), l.target.presetKey)
  6130. });
  6131. }
  6132. }
  6133. class vi extends Ge {
  6134. constructor(e, t) {
  6135. super(e, new $n(e.rackController, t)), this.emitter_ = new F(), this.controller_.foldable.value("expanded").emitter.on("change", (l) => {
  6136. this.emitter_.emit("fold", {
  6137. event: new d(this, l.sender.rawValue)
  6138. });
  6139. }), this.rackApi_.on("change", (l) => {
  6140. this.emitter_.emit("change", {
  6141. event: l
  6142. });
  6143. }), this.rackApi_.on("update", (l) => {
  6144. this.emitter_.emit("update", {
  6145. event: l
  6146. });
  6147. });
  6148. }
  6149. get expanded() {
  6150. return this.controller_.foldable.get("expanded");
  6151. }
  6152. set expanded(e) {
  6153. this.controller_.foldable.set("expanded", e);
  6154. }
  6155. get title() {
  6156. return this.controller_.props.get("title");
  6157. }
  6158. set title(e) {
  6159. this.controller_.props.set("title", e);
  6160. }
  6161. get children() {
  6162. return this.rackApi_.children;
  6163. }
  6164. addInput(e, t, l) {
  6165. return this.rackApi_.addInput(e, t, l);
  6166. }
  6167. addMonitor(e, t, l) {
  6168. return this.rackApi_.addMonitor(e, t, l);
  6169. }
  6170. addFolder(e) {
  6171. return this.rackApi_.addFolder(e);
  6172. }
  6173. addButton(e) {
  6174. return this.rackApi_.addButton(e);
  6175. }
  6176. addSeparator(e) {
  6177. return this.rackApi_.addSeparator(e);
  6178. }
  6179. addTab(e) {
  6180. return this.rackApi_.addTab(e);
  6181. }
  6182. add(e, t) {
  6183. return this.rackApi_.add(e, t);
  6184. }
  6185. remove(e) {
  6186. this.rackApi_.remove(e);
  6187. }
  6188. addBlade(e) {
  6189. return this.rackApi_.addBlade(e);
  6190. }
  6191. on(e, t) {
  6192. const l = t.bind(this);
  6193. return this.emitter_.on(e, (v) => {
  6194. l(v.event);
  6195. }), this;
  6196. }
  6197. }
  6198. class bi extends Mt {
  6199. constructor(e) {
  6200. super({
  6201. blade: e.blade,
  6202. view: e.view,
  6203. viewProps: e.rackController.viewProps
  6204. }), this.rackController = e.rackController;
  6205. }
  6206. }
  6207. class $s {
  6208. constructor(e, t) {
  6209. const l = D(t.viewName);
  6210. this.element = e.createElement("div"), this.element.classList.add(l()), t.viewProps.bindClassModifiers(this.element);
  6211. }
  6212. }
  6213. function Xs(n, e) {
  6214. for (let t = 0; t < n.length; t++) {
  6215. const l = n[t];
  6216. if (l instanceof Fe && l.binding === e)
  6217. return l;
  6218. }
  6219. return null;
  6220. }
  6221. function Ys(n, e) {
  6222. for (let t = 0; t < n.length; t++) {
  6223. const l = n[t];
  6224. if (l instanceof rt && l.binding === e)
  6225. return l;
  6226. }
  6227. return null;
  6228. }
  6229. function qs(n, e) {
  6230. for (let t = 0; t < n.length; t++) {
  6231. const l = n[t];
  6232. if (l instanceof ie && l.value === e)
  6233. return l;
  6234. }
  6235. return null;
  6236. }
  6237. function gi(n) {
  6238. return n instanceof hn ? n.rack : n instanceof bi ? n.rackController.rack : null;
  6239. }
  6240. function Qs(n) {
  6241. const e = gi(n);
  6242. return e ? e.bcSet_ : null;
  6243. }
  6244. class Zs {
  6245. constructor(e) {
  6246. var t, l;
  6247. this.onBladePositionsChange_ = this.onBladePositionsChange_.bind(this), this.onSetAdd_ = this.onSetAdd_.bind(this), this.onSetRemove_ = this.onSetRemove_.bind(this), this.onChildDispose_ = this.onChildDispose_.bind(this), this.onChildPositionsChange_ = this.onChildPositionsChange_.bind(this), this.onChildInputChange_ = this.onChildInputChange_.bind(this), this.onChildMonitorUpdate_ = this.onChildMonitorUpdate_.bind(this), this.onChildValueChange_ = this.onChildValueChange_.bind(this), this.onChildViewPropsChange_ = this.onChildViewPropsChange_.bind(this), this.onDescendantLayout_ = this.onDescendantLayout_.bind(this), this.onDescendantInputChange_ = this.onDescendantInputChange_.bind(this), this.onDescendantMonitorUpdate_ = this.onDescendantMonitorUpdate_.bind(this), this.emitter = new F(), this.blade_ = (t = e.blade) !== null && t !== void 0 ? t : null, (l = this.blade_) === null || l === void 0 || l.value("positions").emitter.on("change", this.onBladePositionsChange_), this.viewProps = e.viewProps, this.bcSet_ = new Lt(Qs), this.bcSet_.emitter.on("add", this.onSetAdd_), this.bcSet_.emitter.on("remove", this.onSetRemove_);
  6248. }
  6249. get children() {
  6250. return this.bcSet_.items;
  6251. }
  6252. add(e, t) {
  6253. var l;
  6254. (l = e.parent) === null || l === void 0 || l.remove(e), C(e, "parent") ? e.parent = this : (e.parent_ = this, Ve({
  6255. key: "parent",
  6256. target: "BladeController",
  6257. place: "BladeRack.add"
  6258. })), this.bcSet_.add(e, t);
  6259. }
  6260. remove(e) {
  6261. C(e, "parent") ? e.parent = null : (e.parent_ = null, Ve({
  6262. key: "parent",
  6263. target: "BladeController",
  6264. place: "BladeRack.remove"
  6265. })), this.bcSet_.remove(e);
  6266. }
  6267. find(e) {
  6268. return this.bcSet_.allItems().filter((t) => t instanceof e);
  6269. }
  6270. onSetAdd_(e) {
  6271. this.updatePositions_();
  6272. const t = e.target === e.root;
  6273. if (this.emitter.emit("add", {
  6274. bladeController: e.item,
  6275. index: e.index,
  6276. isRoot: t,
  6277. sender: this
  6278. }), !t)
  6279. return;
  6280. const l = e.item;
  6281. if (l.viewProps.emitter.on("change", this.onChildViewPropsChange_), l.blade.value("positions").emitter.on("change", this.onChildPositionsChange_), l.viewProps.handleDispose(this.onChildDispose_), l instanceof Fe)
  6282. l.binding.emitter.on("change", this.onChildInputChange_);
  6283. else if (l instanceof rt)
  6284. l.binding.emitter.on("update", this.onChildMonitorUpdate_);
  6285. else if (l instanceof ie)
  6286. l.value.emitter.on("change", this.onChildValueChange_);
  6287. else {
  6288. const v = gi(l);
  6289. if (v) {
  6290. const E = v.emitter;
  6291. E.on("layout", this.onDescendantLayout_), E.on("inputchange", this.onDescendantInputChange_), E.on("monitorupdate", this.onDescendantMonitorUpdate_);
  6292. }
  6293. }
  6294. }
  6295. onSetRemove_(e) {
  6296. this.updatePositions_();
  6297. const t = e.target === e.root;
  6298. if (this.emitter.emit("remove", {
  6299. bladeController: e.item,
  6300. isRoot: t,
  6301. sender: this
  6302. }), !t)
  6303. return;
  6304. const l = e.item;
  6305. if (l instanceof Fe)
  6306. l.binding.emitter.off("change", this.onChildInputChange_);
  6307. else if (l instanceof rt)
  6308. l.binding.emitter.off("update", this.onChildMonitorUpdate_);
  6309. else if (l instanceof ie)
  6310. l.value.emitter.off("change", this.onChildValueChange_);
  6311. else {
  6312. const v = gi(l);
  6313. if (v) {
  6314. const E = v.emitter;
  6315. E.off("layout", this.onDescendantLayout_), E.off("inputchange", this.onDescendantInputChange_), E.off("monitorupdate", this.onDescendantMonitorUpdate_);
  6316. }
  6317. }
  6318. }
  6319. updatePositions_() {
  6320. const e = this.bcSet_.items.filter((v) => !v.viewProps.get("hidden")), t = e[0], l = e[e.length - 1];
  6321. this.bcSet_.items.forEach((v) => {
  6322. const E = [];
  6323. v === t && (E.push("first"), (!this.blade_ || this.blade_.get("positions").includes("veryfirst")) && E.push("veryfirst")), v === l && (E.push("last"), (!this.blade_ || this.blade_.get("positions").includes("verylast")) && E.push("verylast")), v.blade.set("positions", E);
  6324. });
  6325. }
  6326. onChildPositionsChange_() {
  6327. this.updatePositions_(), this.emitter.emit("layout", {
  6328. sender: this
  6329. });
  6330. }
  6331. onChildViewPropsChange_(e) {
  6332. this.updatePositions_(), this.emitter.emit("layout", {
  6333. sender: this
  6334. });
  6335. }
  6336. onChildDispose_() {
  6337. this.bcSet_.items.filter((t) => t.viewProps.get("disposed")).forEach((t) => {
  6338. this.bcSet_.remove(t);
  6339. });
  6340. }
  6341. onChildInputChange_(e) {
  6342. const t = Xs(this.find(Fe), e.sender);
  6343. if (!t)
  6344. throw S.alreadyDisposed();
  6345. this.emitter.emit("inputchange", {
  6346. bladeController: t,
  6347. options: e.options,
  6348. sender: this
  6349. });
  6350. }
  6351. onChildMonitorUpdate_(e) {
  6352. const t = Ys(this.find(rt), e.sender);
  6353. if (!t)
  6354. throw S.alreadyDisposed();
  6355. this.emitter.emit("monitorupdate", {
  6356. bladeController: t,
  6357. sender: this
  6358. });
  6359. }
  6360. onChildValueChange_(e) {
  6361. const t = qs(this.find(ie), e.sender);
  6362. if (!t)
  6363. throw S.alreadyDisposed();
  6364. this.emitter.emit("inputchange", {
  6365. bladeController: t,
  6366. options: e.options,
  6367. sender: this
  6368. });
  6369. }
  6370. onDescendantLayout_(e) {
  6371. this.updatePositions_(), this.emitter.emit("layout", {
  6372. sender: this
  6373. });
  6374. }
  6375. onDescendantInputChange_(e) {
  6376. this.emitter.emit("inputchange", {
  6377. bladeController: e.bladeController,
  6378. options: e.options,
  6379. sender: this
  6380. });
  6381. }
  6382. onDescendantMonitorUpdate_(e) {
  6383. this.emitter.emit("monitorupdate", {
  6384. bladeController: e.bladeController,
  6385. sender: this
  6386. });
  6387. }
  6388. onBladePositionsChange_() {
  6389. this.updatePositions_();
  6390. }
  6391. }
  6392. class hn extends Mt {
  6393. constructor(e, t) {
  6394. super(Object.assign(Object.assign({}, t), { view: new $s(e, {
  6395. viewName: "brk",
  6396. viewProps: t.viewProps
  6397. }) })), this.onRackAdd_ = this.onRackAdd_.bind(this), this.onRackRemove_ = this.onRackRemove_.bind(this);
  6398. const l = new Zs({
  6399. blade: t.root ? void 0 : t.blade,
  6400. viewProps: t.viewProps
  6401. });
  6402. l.emitter.on("add", this.onRackAdd_), l.emitter.on("remove", this.onRackRemove_), this.rack = l, this.viewProps.handleDispose(() => {
  6403. for (let v = this.rack.children.length - 1; v >= 0; v--)
  6404. this.rack.children[v].viewProps.set("disposed", true);
  6405. });
  6406. }
  6407. onRackAdd_(e) {
  6408. e.isRoot && St(this.view.element, e.bladeController.view.element, e.index);
  6409. }
  6410. onRackRemove_(e) {
  6411. e.isRoot && Hn(e.bladeController.view.element);
  6412. }
  6413. }
  6414. const is = D("cnt");
  6415. class Ws {
  6416. constructor(e, t) {
  6417. var l;
  6418. this.className_ = D((l = t.viewName) !== null && l !== void 0 ? l : "fld"), this.element = e.createElement("div"), this.element.classList.add(this.className_(), is()), t.viewProps.bindClassModifiers(this.element), this.foldable_ = t.foldable, this.foldable_.bindExpandedClass(this.element, this.className_(void 0, "expanded")), O(this.foldable_, "completed", K(this.element, this.className_(void 0, "cpl")));
  6419. const v = e.createElement("button");
  6420. v.classList.add(this.className_("b")), O(t.props, "title", (J) => {
  6421. _(J) ? this.element.classList.add(this.className_(void 0, "not")) : this.element.classList.remove(this.className_(void 0, "not"));
  6422. }), t.viewProps.bindDisabled(v), this.element.appendChild(v), this.buttonElement = v;
  6423. const E = e.createElement("div");
  6424. E.classList.add(this.className_("i")), this.element.appendChild(E);
  6425. const k = e.createElement("div");
  6426. k.classList.add(this.className_("t")), q(t.props.value("title"), k), this.buttonElement.appendChild(k), this.titleElement = k;
  6427. const B = e.createElement("div");
  6428. B.classList.add(this.className_("m")), this.buttonElement.appendChild(B);
  6429. const Q = t.containerElement;
  6430. Q.classList.add(this.className_("c")), this.element.appendChild(Q), this.containerElement = Q;
  6431. }
  6432. }
  6433. class Xn extends bi {
  6434. constructor(e, t) {
  6435. var l;
  6436. const v = De.create((l = t.expanded) !== null && l !== void 0 ? l : true), E = new hn(e, {
  6437. blade: t.blade,
  6438. root: t.root,
  6439. viewProps: t.viewProps
  6440. });
  6441. super(Object.assign(Object.assign({}, t), { rackController: E, view: new Ws(e, {
  6442. containerElement: E.view.element,
  6443. foldable: v,
  6444. props: t.props,
  6445. viewName: t.root ? "rot" : void 0,
  6446. viewProps: t.viewProps
  6447. }) })), this.onTitleClick_ = this.onTitleClick_.bind(this), this.props = t.props, this.foldable = v, Ue(this.foldable, this.view.containerElement), this.rackController.rack.emitter.on("add", () => {
  6448. this.foldable.cleanUpTransition();
  6449. }), this.rackController.rack.emitter.on("remove", () => {
  6450. this.foldable.cleanUpTransition();
  6451. }), this.view.buttonElement.addEventListener("click", this.onTitleClick_);
  6452. }
  6453. get document() {
  6454. return this.view.element.ownerDocument;
  6455. }
  6456. onTitleClick_() {
  6457. this.foldable.set("expanded", !this.foldable.get("expanded"));
  6458. }
  6459. }
  6460. const Js = {
  6461. id: "folder",
  6462. type: "blade",
  6463. accept(n) {
  6464. const e = M, t = le(n, {
  6465. title: e.required.string,
  6466. view: e.required.constant("folder"),
  6467. expanded: e.optional.boolean
  6468. });
  6469. return t ? { params: t } : null;
  6470. },
  6471. controller(n) {
  6472. return new Xn(n.document, {
  6473. blade: n.blade,
  6474. expanded: n.params.expanded,
  6475. props: X.fromObject({
  6476. title: n.params.title
  6477. }),
  6478. viewProps: n.viewProps
  6479. });
  6480. },
  6481. api(n) {
  6482. return n.controller instanceof Xn ? new vi(n.controller, n.pool) : null;
  6483. }
  6484. };
  6485. class Gt extends ie {
  6486. constructor(e, t) {
  6487. const l = t.valueController.viewProps;
  6488. super(Object.assign(Object.assign({}, t), { value: t.valueController.value, view: new A(e, {
  6489. props: t.props,
  6490. viewProps: l
  6491. }), viewProps: l })), this.props = t.props, this.valueController = t.valueController, this.view.valueElement.appendChild(this.valueController.view.element);
  6492. }
  6493. }
  6494. class ss extends a {
  6495. }
  6496. const _i = D("spr");
  6497. class er {
  6498. constructor(e, t) {
  6499. this.element = e.createElement("div"), this.element.classList.add(_i()), t.viewProps.bindClassModifiers(this.element);
  6500. const l = e.createElement("hr");
  6501. l.classList.add(_i("r")), this.element.appendChild(l);
  6502. }
  6503. }
  6504. class dn extends Mt {
  6505. constructor(e, t) {
  6506. super(Object.assign(Object.assign({}, t), { view: new er(e, {
  6507. viewProps: t.viewProps
  6508. }) }));
  6509. }
  6510. }
  6511. const tr = {
  6512. id: "separator",
  6513. type: "blade",
  6514. accept(n) {
  6515. const t = le(n, {
  6516. view: M.required.constant("separator")
  6517. });
  6518. return t ? { params: t } : null;
  6519. },
  6520. controller(n) {
  6521. return new dn(n.document, {
  6522. blade: n.blade,
  6523. viewProps: n.viewProps
  6524. });
  6525. },
  6526. api(n) {
  6527. return n.controller instanceof dn ? new ss(n.controller) : null;
  6528. }
  6529. }, Le = D("tbi");
  6530. class nr {
  6531. constructor(e, t) {
  6532. this.element = e.createElement("div"), this.element.classList.add(Le()), t.viewProps.bindClassModifiers(this.element), O(t.props, "selected", (E) => {
  6533. E ? this.element.classList.add(Le(void 0, "sel")) : this.element.classList.remove(Le(void 0, "sel"));
  6534. });
  6535. const l = e.createElement("button");
  6536. l.classList.add(Le("b")), t.viewProps.bindDisabled(l), this.element.appendChild(l), this.buttonElement = l;
  6537. const v = e.createElement("div");
  6538. v.classList.add(Le("t")), q(t.props.value("title"), v), this.buttonElement.appendChild(v), this.titleElement = v;
  6539. }
  6540. }
  6541. class Yn {
  6542. constructor(e, t) {
  6543. this.emitter = new F(), this.onClick_ = this.onClick_.bind(this), this.props = t.props, this.viewProps = t.viewProps, this.view = new nr(e, {
  6544. props: t.props,
  6545. viewProps: t.viewProps
  6546. }), this.view.buttonElement.addEventListener("click", this.onClick_);
  6547. }
  6548. onClick_() {
  6549. this.emitter.emit("click", {
  6550. sender: this
  6551. });
  6552. }
  6553. }
  6554. class rs {
  6555. constructor(e, t) {
  6556. this.onItemClick_ = this.onItemClick_.bind(this), this.ic_ = new Yn(e, {
  6557. props: t.itemProps,
  6558. viewProps: Xe.create()
  6559. }), this.ic_.emitter.on("click", this.onItemClick_), this.cc_ = new hn(e, {
  6560. blade: ye(),
  6561. viewProps: Xe.create()
  6562. }), this.props = t.props, O(this.props, "selected", (l) => {
  6563. this.itemController.props.set("selected", l), this.contentController.viewProps.set("hidden", !l);
  6564. });
  6565. }
  6566. get itemController() {
  6567. return this.ic_;
  6568. }
  6569. get contentController() {
  6570. return this.cc_;
  6571. }
  6572. onItemClick_() {
  6573. this.props.set("selected", true);
  6574. }
  6575. }
  6576. class wi {
  6577. constructor(e, t) {
  6578. this.controller_ = e, this.rackApi_ = t;
  6579. }
  6580. get title() {
  6581. var e;
  6582. return (e = this.controller_.itemController.props.get("title")) !== null && e !== void 0 ? e : "";
  6583. }
  6584. set title(e) {
  6585. this.controller_.itemController.props.set("title", e);
  6586. }
  6587. get selected() {
  6588. return this.controller_.props.get("selected");
  6589. }
  6590. set selected(e) {
  6591. this.controller_.props.set("selected", e);
  6592. }
  6593. get children() {
  6594. return this.rackApi_.children;
  6595. }
  6596. addButton(e) {
  6597. return this.rackApi_.addButton(e);
  6598. }
  6599. addFolder(e) {
  6600. return this.rackApi_.addFolder(e);
  6601. }
  6602. addSeparator(e) {
  6603. return this.rackApi_.addSeparator(e);
  6604. }
  6605. addTab(e) {
  6606. return this.rackApi_.addTab(e);
  6607. }
  6608. add(e, t) {
  6609. this.rackApi_.add(e, t);
  6610. }
  6611. remove(e) {
  6612. this.rackApi_.remove(e);
  6613. }
  6614. addInput(e, t, l) {
  6615. return this.rackApi_.addInput(e, t, l);
  6616. }
  6617. addMonitor(e, t, l) {
  6618. return this.rackApi_.addMonitor(e, t, l);
  6619. }
  6620. addBlade(e) {
  6621. return this.rackApi_.addBlade(e);
  6622. }
  6623. }
  6624. class os extends Ge {
  6625. constructor(e, t) {
  6626. super(e, new $n(e.rackController, t)), this.onPageAdd_ = this.onPageAdd_.bind(this), this.onPageRemove_ = this.onPageRemove_.bind(this), this.onSelect_ = this.onSelect_.bind(this), this.emitter_ = new F(), this.pageApiMap_ = /* @__PURE__ */ new Map(), this.rackApi_.on("change", (l) => {
  6627. this.emitter_.emit("change", {
  6628. event: l
  6629. });
  6630. }), this.rackApi_.on("update", (l) => {
  6631. this.emitter_.emit("update", {
  6632. event: l
  6633. });
  6634. }), this.controller_.tab.selectedIndex.emitter.on("change", this.onSelect_), this.controller_.pageSet.emitter.on("add", this.onPageAdd_), this.controller_.pageSet.emitter.on("remove", this.onPageRemove_), this.controller_.pageSet.items.forEach((l) => {
  6635. this.setUpPageApi_(l);
  6636. });
  6637. }
  6638. get pages() {
  6639. return this.controller_.pageSet.items.map((e) => {
  6640. const t = this.pageApiMap_.get(e);
  6641. if (!t)
  6642. throw S.shouldNeverHappen();
  6643. return t;
  6644. });
  6645. }
  6646. addPage(e) {
  6647. const t = this.controller_.view.element.ownerDocument, l = new rs(t, {
  6648. itemProps: X.fromObject({
  6649. selected: false,
  6650. title: e.title
  6651. }),
  6652. props: X.fromObject({
  6653. selected: false
  6654. })
  6655. });
  6656. this.controller_.add(l, e.index);
  6657. const v = this.pageApiMap_.get(l);
  6658. if (!v)
  6659. throw S.shouldNeverHappen();
  6660. return v;
  6661. }
  6662. removePage(e) {
  6663. this.controller_.remove(e);
  6664. }
  6665. on(e, t) {
  6666. const l = t.bind(this);
  6667. return this.emitter_.on(e, (v) => {
  6668. l(v.event);
  6669. }), this;
  6670. }
  6671. setUpPageApi_(e) {
  6672. const t = this.rackApi_.apiSet_.find((v) => v.controller_ === e.contentController);
  6673. if (!t)
  6674. throw S.shouldNeverHappen();
  6675. const l = new wi(e, t);
  6676. this.pageApiMap_.set(e, l);
  6677. }
  6678. onPageAdd_(e) {
  6679. this.setUpPageApi_(e.item);
  6680. }
  6681. onPageRemove_(e) {
  6682. if (!this.pageApiMap_.get(e.item))
  6683. throw S.shouldNeverHappen();
  6684. this.pageApiMap_.delete(e.item);
  6685. }
  6686. onSelect_(e) {
  6687. this.emitter_.emit("select", {
  6688. event: new g(this, e.rawValue)
  6689. });
  6690. }
  6691. }
  6692. const as = -1;
  6693. class ir {
  6694. constructor() {
  6695. this.onItemSelectedChange_ = this.onItemSelectedChange_.bind(this), this.empty = ee(true), this.selectedIndex = ee(as), this.items_ = [];
  6696. }
  6697. add(e, t) {
  6698. const l = t ?? this.items_.length;
  6699. this.items_.splice(l, 0, e), e.emitter.on("change", this.onItemSelectedChange_), this.keepSelection_();
  6700. }
  6701. remove(e) {
  6702. const t = this.items_.indexOf(e);
  6703. t < 0 || (this.items_.splice(t, 1), e.emitter.off("change", this.onItemSelectedChange_), this.keepSelection_());
  6704. }
  6705. keepSelection_() {
  6706. if (this.items_.length === 0) {
  6707. this.selectedIndex.rawValue = as, this.empty.rawValue = true;
  6708. return;
  6709. }
  6710. const e = this.items_.findIndex((t) => t.rawValue);
  6711. e < 0 ? (this.items_.forEach((t, l) => {
  6712. t.rawValue = l === 0;
  6713. }), this.selectedIndex.rawValue = 0) : (this.items_.forEach((t, l) => {
  6714. t.rawValue = l === e;
  6715. }), this.selectedIndex.rawValue = e), this.empty.rawValue = false;
  6716. }
  6717. onItemSelectedChange_(e) {
  6718. if (e.rawValue) {
  6719. const t = this.items_.findIndex((l) => l === e.sender);
  6720. this.items_.forEach((l, v) => {
  6721. l.rawValue = v === t;
  6722. }), this.selectedIndex.rawValue = t;
  6723. } else
  6724. this.keepSelection_();
  6725. }
  6726. }
  6727. const Ht = D("tab");
  6728. class Kt {
  6729. constructor(e, t) {
  6730. this.element = e.createElement("div"), this.element.classList.add(Ht(), is()), t.viewProps.bindClassModifiers(this.element), N(t.empty, K(this.element, Ht(void 0, "nop")));
  6731. const l = e.createElement("div");
  6732. l.classList.add(Ht("t")), this.element.appendChild(l), this.itemsElement = l;
  6733. const v = e.createElement("div");
  6734. v.classList.add(Ht("i")), this.element.appendChild(v);
  6735. const E = t.contentsElement;
  6736. E.classList.add(Ht("c")), this.element.appendChild(E), this.contentsElement = E;
  6737. }
  6738. }
  6739. class mn extends bi {
  6740. constructor(e, t) {
  6741. const l = new hn(e, {
  6742. blade: t.blade,
  6743. viewProps: t.viewProps
  6744. }), v = new ir();
  6745. super({
  6746. blade: t.blade,
  6747. rackController: l,
  6748. view: new Kt(e, {
  6749. contentsElement: l.view.element,
  6750. empty: v.empty,
  6751. viewProps: t.viewProps
  6752. })
  6753. }), this.onPageAdd_ = this.onPageAdd_.bind(this), this.onPageRemove_ = this.onPageRemove_.bind(this), this.pageSet_ = new Lt(() => null), this.pageSet_.emitter.on("add", this.onPageAdd_), this.pageSet_.emitter.on("remove", this.onPageRemove_), this.tab = v;
  6754. }
  6755. get pageSet() {
  6756. return this.pageSet_;
  6757. }
  6758. add(e, t) {
  6759. this.pageSet_.add(e, t);
  6760. }
  6761. remove(e) {
  6762. this.pageSet_.remove(this.pageSet_.items[e]);
  6763. }
  6764. onPageAdd_(e) {
  6765. const t = e.item;
  6766. St(this.view.itemsElement, t.itemController.view.element, e.index), t.itemController.viewProps.set("parent", this.viewProps), this.rackController.rack.add(t.contentController, e.index), this.tab.add(t.props.value("selected"));
  6767. }
  6768. onPageRemove_(e) {
  6769. const t = e.item;
  6770. Hn(t.itemController.view.element), t.itemController.viewProps.set("parent", null), this.rackController.rack.remove(t.contentController), this.tab.remove(t.props.value("selected"));
  6771. }
  6772. }
  6773. const yi = {
  6774. id: "tab",
  6775. type: "blade",
  6776. accept(n) {
  6777. const e = M, t = le(n, {
  6778. pages: e.required.array(e.required.object({ title: e.required.string })),
  6779. view: e.required.constant("tab")
  6780. });
  6781. return !t || t.pages.length === 0 ? null : { params: t };
  6782. },
  6783. controller(n) {
  6784. const e = new mn(n.document, {
  6785. blade: n.blade,
  6786. viewProps: n.viewProps
  6787. });
  6788. return n.params.pages.forEach((t) => {
  6789. const l = new rs(n.document, {
  6790. itemProps: X.fromObject({
  6791. selected: false,
  6792. title: t.title
  6793. }),
  6794. props: X.fromObject({
  6795. selected: false
  6796. })
  6797. });
  6798. e.add(l);
  6799. }), e;
  6800. },
  6801. api(n) {
  6802. return n.controller instanceof mn ? new os(n.controller, n.pool) : null;
  6803. }
  6804. };
  6805. function sr(n, e) {
  6806. const t = n.accept(e.params);
  6807. if (!t)
  6808. return null;
  6809. const l = M.optional.boolean(e.params.disabled).value, v = M.optional.boolean(e.params.hidden).value;
  6810. return n.controller({
  6811. blade: ye(),
  6812. document: e.document,
  6813. params: Object.assign(Object.assign({}, t.params), { disabled: l, hidden: v }),
  6814. viewProps: Xe.create({
  6815. disabled: l,
  6816. hidden: v
  6817. })
  6818. });
  6819. }
  6820. class ls {
  6821. constructor() {
  6822. this.disabled = false, this.emitter = new F();
  6823. }
  6824. dispose() {
  6825. }
  6826. tick() {
  6827. this.disabled || this.emitter.emit("tick", {
  6828. sender: this
  6829. });
  6830. }
  6831. }
  6832. class xi {
  6833. constructor(e, t) {
  6834. this.disabled_ = false, this.timerId_ = null, this.onTick_ = this.onTick_.bind(this), this.doc_ = e, this.emitter = new F(), this.interval_ = t, this.setTimer_();
  6835. }
  6836. get disabled() {
  6837. return this.disabled_;
  6838. }
  6839. set disabled(e) {
  6840. this.disabled_ = e, this.disabled_ ? this.clearTimer_() : this.setTimer_();
  6841. }
  6842. dispose() {
  6843. this.clearTimer_();
  6844. }
  6845. clearTimer_() {
  6846. if (this.timerId_ === null)
  6847. return;
  6848. const e = this.doc_.defaultView;
  6849. e && e.clearInterval(this.timerId_), this.timerId_ = null;
  6850. }
  6851. setTimer_() {
  6852. if (this.clearTimer_(), this.interval_ <= 0)
  6853. return;
  6854. const e = this.doc_.defaultView;
  6855. e && (this.timerId_ = e.setInterval(this.onTick_, this.interval_));
  6856. }
  6857. onTick_() {
  6858. this.disabled_ || this.emitter.emit("tick", {
  6859. sender: this
  6860. });
  6861. }
  6862. }
  6863. class qn {
  6864. constructor(e) {
  6865. this.onValueChange_ = this.onValueChange_.bind(this), this.reader = e.reader, this.writer = e.writer, this.emitter = new F(), this.value = e.value, this.value.emitter.on("change", this.onValueChange_), this.target = e.target, this.read();
  6866. }
  6867. read() {
  6868. const e = this.target.read();
  6869. e !== void 0 && (this.value.rawValue = this.reader(e));
  6870. }
  6871. write_(e) {
  6872. this.writer(this.target, e);
  6873. }
  6874. onValueChange_(e) {
  6875. this.write_(e.rawValue), this.emitter.emit("change", {
  6876. options: e.options,
  6877. rawValue: e.rawValue,
  6878. sender: this
  6879. });
  6880. }
  6881. }
  6882. function Me(n, e) {
  6883. for (; n.length < e; )
  6884. n.push(void 0);
  6885. }
  6886. function cs(n) {
  6887. const e = [];
  6888. return Me(e, n), ee(e);
  6889. }
  6890. function $t(n) {
  6891. const e = n.indexOf(void 0);
  6892. return e < 0 ? n : n.slice(0, e);
  6893. }
  6894. function Ye(n, e) {
  6895. const t = [...$t(n), e];
  6896. return t.length > n.length ? t.splice(0, t.length - n.length) : Me(t, n.length), t;
  6897. }
  6898. class rr {
  6899. constructor(e) {
  6900. this.onTick_ = this.onTick_.bind(this), this.reader_ = e.reader, this.target = e.target, this.emitter = new F(), this.value = e.value, this.ticker = e.ticker, this.ticker.emitter.on("tick", this.onTick_), this.read();
  6901. }
  6902. dispose() {
  6903. this.ticker.dispose();
  6904. }
  6905. read() {
  6906. const e = this.target.read();
  6907. if (e === void 0)
  6908. return;
  6909. const t = this.value.rawValue, l = this.reader_(e);
  6910. this.value.rawValue = Ye(t, l), this.emitter.emit("update", {
  6911. rawValue: l,
  6912. sender: this
  6913. });
  6914. }
  6915. onTick_(e) {
  6916. this.read();
  6917. }
  6918. }
  6919. class fn {
  6920. constructor(e) {
  6921. this.constraints = e;
  6922. }
  6923. constrain(e) {
  6924. return this.constraints.reduce((t, l) => l.constrain(t), e);
  6925. }
  6926. }
  6927. function et(n, e) {
  6928. if (n instanceof e)
  6929. return n;
  6930. if (n instanceof fn) {
  6931. const t = n.constraints.reduce((l, v) => l || (v instanceof e ? v : null), null);
  6932. if (t)
  6933. return t;
  6934. }
  6935. return null;
  6936. }
  6937. class Xt {
  6938. constructor(e) {
  6939. this.values = X.fromObject({
  6940. max: e.max,
  6941. min: e.min
  6942. });
  6943. }
  6944. constrain(e) {
  6945. const t = this.values.get("max"), l = this.values.get("min");
  6946. return Math.min(Math.max(e, l), t);
  6947. }
  6948. }
  6949. class vn {
  6950. constructor(e) {
  6951. this.values = X.fromObject({
  6952. options: e
  6953. });
  6954. }
  6955. get options() {
  6956. return this.values.get("options");
  6957. }
  6958. constrain(e) {
  6959. const t = this.values.get("options");
  6960. return t.length === 0 || t.filter((v) => v.value === e).length > 0 ? e : t[0].value;
  6961. }
  6962. }
  6963. class Ei {
  6964. constructor(e) {
  6965. this.values = X.fromObject({
  6966. max: e.max,
  6967. min: e.min
  6968. });
  6969. }
  6970. get maxValue() {
  6971. return this.values.get("max");
  6972. }
  6973. get minValue() {
  6974. return this.values.get("min");
  6975. }
  6976. constrain(e) {
  6977. const t = this.values.get("max"), l = this.values.get("min");
  6978. let v = e;
  6979. return _(l) || (v = Math.max(v, l)), _(t) || (v = Math.min(v, t)), v;
  6980. }
  6981. }
  6982. class Qn {
  6983. constructor(e, t = 0) {
  6984. this.step = e, this.origin = t;
  6985. }
  6986. constrain(e) {
  6987. const t = this.origin % this.step, l = Math.round((e - t) / this.step);
  6988. return t + l * this.step;
  6989. }
  6990. }
  6991. const Yt = D("lst");
  6992. class ps {
  6993. constructor(e, t) {
  6994. this.onValueChange_ = this.onValueChange_.bind(this), this.props_ = t.props, this.element = e.createElement("div"), this.element.classList.add(Yt()), t.viewProps.bindClassModifiers(this.element);
  6995. const l = e.createElement("select");
  6996. l.classList.add(Yt("s")), O(this.props_, "options", (E) => {
  6997. cn(l), E.forEach((k, B) => {
  6998. const Q = e.createElement("option");
  6999. Q.dataset.index = String(B), Q.textContent = k.text, Q.value = String(k.value), l.appendChild(Q);
  7000. });
  7001. }), t.viewProps.bindDisabled(l), this.element.appendChild(l), this.selectElement = l;
  7002. const v = e.createElement("div");
  7003. v.classList.add(Yt("m")), v.appendChild(yt(e, "dropdown")), this.element.appendChild(v), t.value.emitter.on("change", this.onValueChange_), this.value_ = t.value, this.update_();
  7004. }
  7005. update_() {
  7006. this.selectElement.value = String(this.value_.rawValue);
  7007. }
  7008. onValueChange_() {
  7009. this.update_();
  7010. }
  7011. }
  7012. class bn {
  7013. constructor(e, t) {
  7014. this.onSelectChange_ = this.onSelectChange_.bind(this), this.props = t.props, this.value = t.value, this.viewProps = t.viewProps, this.view = new ps(e, {
  7015. props: this.props,
  7016. value: this.value,
  7017. viewProps: this.viewProps
  7018. }), this.view.selectElement.addEventListener("change", this.onSelectChange_);
  7019. }
  7020. onSelectChange_(e) {
  7021. const l = e.currentTarget.selectedOptions.item(0);
  7022. if (!l)
  7023. return;
  7024. const v = Number(l.dataset.index);
  7025. this.value.rawValue = this.props.get("options")[v].value;
  7026. }
  7027. }
  7028. const us = D("pop");
  7029. class or {
  7030. constructor(e, t) {
  7031. this.element = e.createElement("div"), this.element.classList.add(us()), t.viewProps.bindClassModifiers(this.element), N(t.shows, K(this.element, us(void 0, "v")));
  7032. }
  7033. }
  7034. class hs {
  7035. constructor(e, t) {
  7036. this.shows = ee(false), this.viewProps = t.viewProps, this.view = new or(e, {
  7037. shows: this.shows,
  7038. viewProps: this.viewProps
  7039. });
  7040. }
  7041. }
  7042. const ds = D("txt");
  7043. class ar {
  7044. constructor(e, t) {
  7045. this.onChange_ = this.onChange_.bind(this), this.element = e.createElement("div"), this.element.classList.add(ds()), t.viewProps.bindClassModifiers(this.element), this.props_ = t.props, this.props_.emitter.on("change", this.onChange_);
  7046. const l = e.createElement("input");
  7047. l.classList.add(ds("i")), l.type = "text", t.viewProps.bindDisabled(l), this.element.appendChild(l), this.inputElement = l, t.value.emitter.on("change", this.onChange_), this.value_ = t.value, this.refresh();
  7048. }
  7049. refresh() {
  7050. const e = this.props_.get("formatter");
  7051. this.inputElement.value = e(this.value_.rawValue);
  7052. }
  7053. onChange_() {
  7054. this.refresh();
  7055. }
  7056. }
  7057. class Zn {
  7058. constructor(e, t) {
  7059. this.onInputChange_ = this.onInputChange_.bind(this), this.parser_ = t.parser, this.props = t.props, this.value = t.value, this.viewProps = t.viewProps, this.view = new ar(e, {
  7060. props: t.props,
  7061. value: this.value,
  7062. viewProps: this.viewProps
  7063. }), this.view.inputElement.addEventListener("change", this.onInputChange_);
  7064. }
  7065. onInputChange_(e) {
  7066. const l = e.currentTarget.value, v = this.parser_(l);
  7067. _(v) || (this.value.rawValue = v), this.view.refresh();
  7068. }
  7069. }
  7070. function lr(n) {
  7071. return String(n);
  7072. }
  7073. function ms(n) {
  7074. return n === "false" ? false : !!n;
  7075. }
  7076. function fs(n) {
  7077. return lr(n);
  7078. }
  7079. class cr {
  7080. constructor(e) {
  7081. this.text = e;
  7082. }
  7083. evaluate() {
  7084. return Number(this.text);
  7085. }
  7086. toString() {
  7087. return this.text;
  7088. }
  7089. }
  7090. const pr = {
  7091. "**": (n, e) => Math.pow(n, e),
  7092. "*": (n, e) => n * e,
  7093. "/": (n, e) => n / e,
  7094. "%": (n, e) => n % e,
  7095. "+": (n, e) => n + e,
  7096. "-": (n, e) => n - e,
  7097. "<<": (n, e) => n << e,
  7098. ">>": (n, e) => n >> e,
  7099. ">>>": (n, e) => n >>> e,
  7100. "&": (n, e) => n & e,
  7101. "^": (n, e) => n ^ e,
  7102. "|": (n, e) => n | e
  7103. };
  7104. class ur {
  7105. constructor(e, t, l) {
  7106. this.left = t, this.operator = e, this.right = l;
  7107. }
  7108. evaluate() {
  7109. const e = pr[this.operator];
  7110. if (!e)
  7111. throw new Error(`unexpected binary operator: '${this.operator}`);
  7112. return e(this.left.evaluate(), this.right.evaluate());
  7113. }
  7114. toString() {
  7115. return [
  7116. "b(",
  7117. this.left.toString(),
  7118. this.operator,
  7119. this.right.toString(),
  7120. ")"
  7121. ].join(" ");
  7122. }
  7123. }
  7124. const vs = {
  7125. "+": (n) => n,
  7126. "-": (n) => -n,
  7127. "~": (n) => ~n
  7128. };
  7129. class hr {
  7130. constructor(e, t) {
  7131. this.operator = e, this.expression = t;
  7132. }
  7133. evaluate() {
  7134. const e = vs[this.operator];
  7135. if (!e)
  7136. throw new Error(`unexpected unary operator: '${this.operator}`);
  7137. return e(this.expression.evaluate());
  7138. }
  7139. toString() {
  7140. return ["u(", this.operator, this.expression.toString(), ")"].join(" ");
  7141. }
  7142. }
  7143. function Ci(n) {
  7144. return (e, t) => {
  7145. for (let l = 0; l < n.length; l++) {
  7146. const v = n[l](e, t);
  7147. if (v !== "")
  7148. return v;
  7149. }
  7150. return "";
  7151. };
  7152. }
  7153. function Rt(n, e) {
  7154. var t;
  7155. const l = n.substr(e).match(/^\s+/);
  7156. return (t = l && l[0]) !== null && t !== void 0 ? t : "";
  7157. }
  7158. function dr(n, e) {
  7159. const t = n.substr(e, 1);
  7160. return t.match(/^[1-9]$/) ? t : "";
  7161. }
  7162. function gn(n, e) {
  7163. var t;
  7164. const l = n.substr(e).match(/^[0-9]+/);
  7165. return (t = l && l[0]) !== null && t !== void 0 ? t : "";
  7166. }
  7167. function mr(n, e) {
  7168. const t = gn(n, e);
  7169. if (t !== "")
  7170. return t;
  7171. const l = n.substr(e, 1);
  7172. if (e += 1, l !== "-" && l !== "+")
  7173. return "";
  7174. const v = gn(n, e);
  7175. return v === "" ? "" : l + v;
  7176. }
  7177. function ot(n, e) {
  7178. const t = n.substr(e, 1);
  7179. if (e += 1, t.toLowerCase() !== "e")
  7180. return "";
  7181. const l = mr(n, e);
  7182. return l === "" ? "" : t + l;
  7183. }
  7184. function bs(n, e) {
  7185. const t = n.substr(e, 1);
  7186. if (t === "0")
  7187. return t;
  7188. const l = dr(n, e);
  7189. return e += l.length, l === "" ? "" : l + gn(n, e);
  7190. }
  7191. function fr(n, e) {
  7192. const t = bs(n, e);
  7193. if (e += t.length, t === "")
  7194. return "";
  7195. const l = n.substr(e, 1);
  7196. if (e += l.length, l !== ".")
  7197. return "";
  7198. const v = gn(n, e);
  7199. return e += v.length, t + l + v + ot(n, e);
  7200. }
  7201. function gs(n, e) {
  7202. const t = n.substr(e, 1);
  7203. if (e += t.length, t !== ".")
  7204. return "";
  7205. const l = gn(n, e);
  7206. return e += l.length, l === "" ? "" : t + l + ot(n, e);
  7207. }
  7208. function vr(n, e) {
  7209. const t = bs(n, e);
  7210. return e += t.length, t === "" ? "" : t + ot(n, e);
  7211. }
  7212. const _s = Ci([
  7213. fr,
  7214. gs,
  7215. vr
  7216. ]);
  7217. function Pi(n, e) {
  7218. var t;
  7219. const l = n.substr(e).match(/^[01]+/);
  7220. return (t = l && l[0]) !== null && t !== void 0 ? t : "";
  7221. }
  7222. function br(n, e) {
  7223. const t = n.substr(e, 2);
  7224. if (e += t.length, t.toLowerCase() !== "0b")
  7225. return "";
  7226. const l = Pi(n, e);
  7227. return l === "" ? "" : t + l;
  7228. }
  7229. function ws(n, e) {
  7230. var t;
  7231. const l = n.substr(e).match(/^[0-7]+/);
  7232. return (t = l && l[0]) !== null && t !== void 0 ? t : "";
  7233. }
  7234. function qe(n, e) {
  7235. const t = n.substr(e, 2);
  7236. if (e += t.length, t.toLowerCase() !== "0o")
  7237. return "";
  7238. const l = ws(n, e);
  7239. return l === "" ? "" : t + l;
  7240. }
  7241. function gr(n, e) {
  7242. var t;
  7243. const l = n.substr(e).match(/^[0-9a-f]+/i);
  7244. return (t = l && l[0]) !== null && t !== void 0 ? t : "";
  7245. }
  7246. function _r(n, e) {
  7247. const t = n.substr(e, 2);
  7248. if (e += t.length, t.toLowerCase() !== "0x")
  7249. return "";
  7250. const l = gr(n, e);
  7251. return l === "" ? "" : t + l;
  7252. }
  7253. const Ti = Ci([
  7254. br,
  7255. qe,
  7256. _r
  7257. ]), wr = Ci([
  7258. Ti,
  7259. _s
  7260. ]);
  7261. function Et(n, e) {
  7262. const t = wr(n, e);
  7263. return e += t.length, t === "" ? null : {
  7264. evaluable: new cr(t),
  7265. cursor: e
  7266. };
  7267. }
  7268. function ki(n, e) {
  7269. const t = n.substr(e, 1);
  7270. if (e += t.length, t !== "(")
  7271. return null;
  7272. const l = Wn(n, e);
  7273. if (!l)
  7274. return null;
  7275. e = l.cursor, e += Rt(n, e).length;
  7276. const v = n.substr(e, 1);
  7277. return e += v.length, v !== ")" ? null : {
  7278. evaluable: l.evaluable,
  7279. cursor: e
  7280. };
  7281. }
  7282. function yr(n, e) {
  7283. var t;
  7284. return (t = Et(n, e)) !== null && t !== void 0 ? t : ki(n, e);
  7285. }
  7286. function Mi(n, e) {
  7287. const t = yr(n, e);
  7288. if (t)
  7289. return t;
  7290. const l = n.substr(e, 1);
  7291. if (e += l.length, l !== "+" && l !== "-" && l !== "~")
  7292. return null;
  7293. const v = Mi(n, e);
  7294. return v ? (e = v.cursor, {
  7295. cursor: e,
  7296. evaluable: new hr(l, v.evaluable)
  7297. }) : null;
  7298. }
  7299. function xr(n, e, t) {
  7300. t += Rt(e, t).length;
  7301. const l = n.filter((v) => e.startsWith(v, t))[0];
  7302. return l ? (t += l.length, t += Rt(e, t).length, {
  7303. cursor: t,
  7304. operator: l
  7305. }) : null;
  7306. }
  7307. function It(n, e) {
  7308. return (t, l) => {
  7309. const v = n(t, l);
  7310. if (!v)
  7311. return null;
  7312. l = v.cursor;
  7313. let E = v.evaluable;
  7314. for (; ; ) {
  7315. const k = xr(e, t, l);
  7316. if (!k)
  7317. break;
  7318. l = k.cursor;
  7319. const B = n(t, l);
  7320. if (!B)
  7321. return null;
  7322. l = B.cursor, E = new ur(k.operator, E, B.evaluable);
  7323. }
  7324. return E ? {
  7325. cursor: l,
  7326. evaluable: E
  7327. } : null;
  7328. };
  7329. }
  7330. const ys = [
  7331. ["**"],
  7332. ["*", "/", "%"],
  7333. ["+", "-"],
  7334. ["<<", ">>>", ">>"],
  7335. ["&"],
  7336. ["^"],
  7337. ["|"]
  7338. ].reduce((n, e) => It(n, e), Mi);
  7339. function Wn(n, e) {
  7340. return e += Rt(n, e).length, ys(n, e);
  7341. }
  7342. function xs(n) {
  7343. const e = Wn(n, 0);
  7344. return !e || e.cursor + Rt(n, e.cursor).length !== n.length ? null : e.evaluable;
  7345. }
  7346. function at(n) {
  7347. var e;
  7348. const t = xs(n);
  7349. return (e = t == null ? void 0 : t.evaluate()) !== null && e !== void 0 ? e : null;
  7350. }
  7351. function vt(n) {
  7352. if (typeof n == "number")
  7353. return n;
  7354. if (typeof n == "string") {
  7355. const e = at(n);
  7356. if (!_(e))
  7357. return e;
  7358. }
  7359. return 0;
  7360. }
  7361. function Er(n) {
  7362. return String(n);
  7363. }
  7364. function Re(n) {
  7365. return (e) => e.toFixed(Math.max(Math.min(n, 20), 0));
  7366. }
  7367. const Es = Re(0);
  7368. function _n(n) {
  7369. return Es(n) + "%";
  7370. }
  7371. function Si(n) {
  7372. return String(n);
  7373. }
  7374. function Ct(n) {
  7375. return n;
  7376. }
  7377. function qt({ primary: n, secondary: e, forward: t, backward: l }) {
  7378. let v = false;
  7379. function E(k) {
  7380. v || (v = true, k(), v = false);
  7381. }
  7382. n.emitter.on("change", (k) => {
  7383. E(() => {
  7384. e.setRawValue(t(n, e), k.options);
  7385. });
  7386. }), e.emitter.on("change", (k) => {
  7387. E(() => {
  7388. n.setRawValue(l(n, e), k.options);
  7389. }), E(() => {
  7390. e.setRawValue(t(n, e), k.options);
  7391. });
  7392. }), E(() => {
  7393. e.setRawValue(t(n, e), {
  7394. forceEmit: false,
  7395. last: true
  7396. });
  7397. });
  7398. }
  7399. function Oe(n, e) {
  7400. const t = n * (e.altKey ? 0.1 : 1) * (e.shiftKey ? 10 : 1);
  7401. return e.upKey ? +t : e.downKey ? -t : 0;
  7402. }
  7403. function wn(n) {
  7404. return {
  7405. altKey: n.altKey,
  7406. downKey: n.key === "ArrowDown",
  7407. shiftKey: n.shiftKey,
  7408. upKey: n.key === "ArrowUp"
  7409. };
  7410. }
  7411. function lt(n) {
  7412. return {
  7413. altKey: n.altKey,
  7414. downKey: n.key === "ArrowLeft",
  7415. shiftKey: n.shiftKey,
  7416. upKey: n.key === "ArrowRight"
  7417. };
  7418. }
  7419. function Cs(n) {
  7420. return n === "ArrowUp" || n === "ArrowDown";
  7421. }
  7422. function Jn(n) {
  7423. return Cs(n) || n === "ArrowLeft" || n === "ArrowRight";
  7424. }
  7425. function Ai(n, e) {
  7426. var t, l;
  7427. const v = e.ownerDocument.defaultView, E = e.getBoundingClientRect();
  7428. return {
  7429. x: n.pageX - (((t = v && v.scrollX) !== null && t !== void 0 ? t : 0) + E.left),
  7430. y: n.pageY - (((l = v && v.scrollY) !== null && l !== void 0 ? l : 0) + E.top)
  7431. };
  7432. }
  7433. class Vt {
  7434. constructor(e) {
  7435. this.lastTouch_ = null, this.onDocumentMouseMove_ = this.onDocumentMouseMove_.bind(this), this.onDocumentMouseUp_ = this.onDocumentMouseUp_.bind(this), this.onMouseDown_ = this.onMouseDown_.bind(this), this.onTouchEnd_ = this.onTouchEnd_.bind(this), this.onTouchMove_ = this.onTouchMove_.bind(this), this.onTouchStart_ = this.onTouchStart_.bind(this), this.elem_ = e, this.emitter = new F(), e.addEventListener("touchstart", this.onTouchStart_, {
  7436. passive: false
  7437. }), e.addEventListener("touchmove", this.onTouchMove_, {
  7438. passive: true
  7439. }), e.addEventListener("touchend", this.onTouchEnd_), e.addEventListener("mousedown", this.onMouseDown_);
  7440. }
  7441. computePosition_(e) {
  7442. const t = this.elem_.getBoundingClientRect();
  7443. return {
  7444. bounds: {
  7445. width: t.width,
  7446. height: t.height
  7447. },
  7448. point: e ? {
  7449. x: e.x,
  7450. y: e.y
  7451. } : null
  7452. };
  7453. }
  7454. onMouseDown_(e) {
  7455. var t;
  7456. e.preventDefault(), (t = e.currentTarget) === null || t === void 0 || t.focus();
  7457. const l = this.elem_.ownerDocument;
  7458. l.addEventListener("mousemove", this.onDocumentMouseMove_), l.addEventListener("mouseup", this.onDocumentMouseUp_), this.emitter.emit("down", {
  7459. altKey: e.altKey,
  7460. data: this.computePosition_(Ai(e, this.elem_)),
  7461. sender: this,
  7462. shiftKey: e.shiftKey
  7463. });
  7464. }
  7465. onDocumentMouseMove_(e) {
  7466. this.emitter.emit("move", {
  7467. altKey: e.altKey,
  7468. data: this.computePosition_(Ai(e, this.elem_)),
  7469. sender: this,
  7470. shiftKey: e.shiftKey
  7471. });
  7472. }
  7473. onDocumentMouseUp_(e) {
  7474. const t = this.elem_.ownerDocument;
  7475. t.removeEventListener("mousemove", this.onDocumentMouseMove_), t.removeEventListener("mouseup", this.onDocumentMouseUp_), this.emitter.emit("up", {
  7476. altKey: e.altKey,
  7477. data: this.computePosition_(Ai(e, this.elem_)),
  7478. sender: this,
  7479. shiftKey: e.shiftKey
  7480. });
  7481. }
  7482. onTouchStart_(e) {
  7483. e.preventDefault();
  7484. const t = e.targetTouches.item(0), l = this.elem_.getBoundingClientRect();
  7485. this.emitter.emit("down", {
  7486. altKey: e.altKey,
  7487. data: this.computePosition_(t ? {
  7488. x: t.clientX - l.left,
  7489. y: t.clientY - l.top
  7490. } : void 0),
  7491. sender: this,
  7492. shiftKey: e.shiftKey
  7493. }), this.lastTouch_ = t;
  7494. }
  7495. onTouchMove_(e) {
  7496. const t = e.targetTouches.item(0), l = this.elem_.getBoundingClientRect();
  7497. this.emitter.emit("move", {
  7498. altKey: e.altKey,
  7499. data: this.computePosition_(t ? {
  7500. x: t.clientX - l.left,
  7501. y: t.clientY - l.top
  7502. } : void 0),
  7503. sender: this,
  7504. shiftKey: e.shiftKey
  7505. }), this.lastTouch_ = t;
  7506. }
  7507. onTouchEnd_(e) {
  7508. var t;
  7509. const l = (t = e.targetTouches.item(0)) !== null && t !== void 0 ? t : this.lastTouch_, v = this.elem_.getBoundingClientRect();
  7510. this.emitter.emit("up", {
  7511. altKey: e.altKey,
  7512. data: this.computePosition_(l ? {
  7513. x: l.clientX - v.left,
  7514. y: l.clientY - v.top
  7515. } : void 0),
  7516. sender: this,
  7517. shiftKey: e.shiftKey
  7518. });
  7519. }
  7520. }
  7521. function _e(n, e, t, l, v) {
  7522. const E = (n - e) / (t - e);
  7523. return l + E * (v - l);
  7524. }
  7525. function Li(n) {
  7526. return String(n.toFixed(10)).split(".")[1].replace(/0+$/, "").length;
  7527. }
  7528. function Se(n, e, t) {
  7529. return Math.min(Math.max(n, e), t);
  7530. }
  7531. function Qt(n, e) {
  7532. return (n % e + e) % e;
  7533. }
  7534. const He = D("txt");
  7535. class Ri {
  7536. constructor(e, t) {
  7537. this.onChange_ = this.onChange_.bind(this), this.props_ = t.props, this.props_.emitter.on("change", this.onChange_), this.element = e.createElement("div"), this.element.classList.add(He(), He(void 0, "num")), t.arrayPosition && this.element.classList.add(He(void 0, t.arrayPosition)), t.viewProps.bindClassModifiers(this.element);
  7538. const l = e.createElement("input");
  7539. l.classList.add(He("i")), l.type = "text", t.viewProps.bindDisabled(l), this.element.appendChild(l), this.inputElement = l, this.onDraggingChange_ = this.onDraggingChange_.bind(this), this.dragging_ = t.dragging, this.dragging_.emitter.on("change", this.onDraggingChange_), this.element.classList.add(He()), this.inputElement.classList.add(He("i"));
  7540. const v = e.createElement("div");
  7541. v.classList.add(He("k")), this.element.appendChild(v), this.knobElement = v;
  7542. const E = e.createElementNS(ze, "svg");
  7543. E.classList.add(He("g")), this.knobElement.appendChild(E);
  7544. const k = e.createElementNS(ze, "path");
  7545. k.classList.add(He("gb")), E.appendChild(k), this.guideBodyElem_ = k;
  7546. const B = e.createElementNS(ze, "path");
  7547. B.classList.add(He("gh")), E.appendChild(B), this.guideHeadElem_ = B;
  7548. const Q = e.createElement("div");
  7549. Q.classList.add(D("tt")()), this.knobElement.appendChild(Q), this.tooltipElem_ = Q, t.value.emitter.on("change", this.onChange_), this.value = t.value, this.refresh();
  7550. }
  7551. onDraggingChange_(e) {
  7552. if (e.rawValue === null) {
  7553. this.element.classList.remove(He(void 0, "drg"));
  7554. return;
  7555. }
  7556. this.element.classList.add(He(void 0, "drg"));
  7557. const t = e.rawValue / this.props_.get("draggingScale"), l = t + (t > 0 ? -1 : t < 0 ? 1 : 0), v = Se(-l, -4, 4);
  7558. this.guideHeadElem_.setAttributeNS(null, "d", [`M ${l + v},0 L${l},4 L${l + v},8`, `M ${t},-1 L${t},9`].join(" ")), this.guideBodyElem_.setAttributeNS(null, "d", `M 0,4 L${t},4`);
  7559. const E = this.props_.get("formatter");
  7560. this.tooltipElem_.textContent = E(this.value.rawValue), this.tooltipElem_.style.left = `${t}px`;
  7561. }
  7562. refresh() {
  7563. const e = this.props_.get("formatter");
  7564. this.inputElement.value = e(this.value.rawValue);
  7565. }
  7566. onChange_() {
  7567. this.refresh();
  7568. }
  7569. }
  7570. class yn {
  7571. constructor(e, t) {
  7572. var l;
  7573. this.originRawValue_ = 0, this.onInputChange_ = this.onInputChange_.bind(this), this.onInputKeyDown_ = this.onInputKeyDown_.bind(this), this.onInputKeyUp_ = this.onInputKeyUp_.bind(this), this.onPointerDown_ = this.onPointerDown_.bind(this), this.onPointerMove_ = this.onPointerMove_.bind(this), this.onPointerUp_ = this.onPointerUp_.bind(this), this.baseStep_ = t.baseStep, this.parser_ = t.parser, this.props = t.props, this.sliderProps_ = (l = t.sliderProps) !== null && l !== void 0 ? l : null, this.value = t.value, this.viewProps = t.viewProps, this.dragging_ = ee(null), this.view = new Ri(e, {
  7574. arrayPosition: t.arrayPosition,
  7575. dragging: this.dragging_,
  7576. props: this.props,
  7577. value: this.value,
  7578. viewProps: this.viewProps
  7579. }), this.view.inputElement.addEventListener("change", this.onInputChange_), this.view.inputElement.addEventListener("keydown", this.onInputKeyDown_), this.view.inputElement.addEventListener("keyup", this.onInputKeyUp_);
  7580. const v = new Vt(this.view.knobElement);
  7581. v.emitter.on("down", this.onPointerDown_), v.emitter.on("move", this.onPointerMove_), v.emitter.on("up", this.onPointerUp_);
  7582. }
  7583. constrainValue_(e) {
  7584. var t, l;
  7585. const v = (t = this.sliderProps_) === null || t === void 0 ? void 0 : t.get("minValue"), E = (l = this.sliderProps_) === null || l === void 0 ? void 0 : l.get("maxValue");
  7586. let k = e;
  7587. return v !== void 0 && (k = Math.max(k, v)), E !== void 0 && (k = Math.min(k, E)), k;
  7588. }
  7589. onInputChange_(e) {
  7590. const l = e.currentTarget.value, v = this.parser_(l);
  7591. _(v) || (this.value.rawValue = this.constrainValue_(v)), this.view.refresh();
  7592. }
  7593. onInputKeyDown_(e) {
  7594. const t = Oe(this.baseStep_, wn(e));
  7595. t !== 0 && this.value.setRawValue(this.constrainValue_(this.value.rawValue + t), {
  7596. forceEmit: false,
  7597. last: false
  7598. });
  7599. }
  7600. onInputKeyUp_(e) {
  7601. Oe(this.baseStep_, wn(e)) !== 0 && this.value.setRawValue(this.value.rawValue, {
  7602. forceEmit: true,
  7603. last: true
  7604. });
  7605. }
  7606. onPointerDown_() {
  7607. this.originRawValue_ = this.value.rawValue, this.dragging_.rawValue = 0;
  7608. }
  7609. computeDraggingValue_(e) {
  7610. if (!e.point)
  7611. return null;
  7612. const t = e.point.x - e.bounds.width / 2;
  7613. return this.constrainValue_(this.originRawValue_ + t * this.props.get("draggingScale"));
  7614. }
  7615. onPointerMove_(e) {
  7616. const t = this.computeDraggingValue_(e.data);
  7617. t !== null && (this.value.setRawValue(t, {
  7618. forceEmit: false,
  7619. last: false
  7620. }), this.dragging_.rawValue = this.value.rawValue - this.originRawValue_);
  7621. }
  7622. onPointerUp_(e) {
  7623. const t = this.computeDraggingValue_(e.data);
  7624. t !== null && (this.value.setRawValue(t, {
  7625. forceEmit: true,
  7626. last: true
  7627. }), this.dragging_.rawValue = null);
  7628. }
  7629. }
  7630. const Ii = D("sld");
  7631. class Ke {
  7632. constructor(e, t) {
  7633. this.onChange_ = this.onChange_.bind(this), this.props_ = t.props, this.props_.emitter.on("change", this.onChange_), this.element = e.createElement("div"), this.element.classList.add(Ii()), t.viewProps.bindClassModifiers(this.element);
  7634. const l = e.createElement("div");
  7635. l.classList.add(Ii("t")), t.viewProps.bindTabIndex(l), this.element.appendChild(l), this.trackElement = l;
  7636. const v = e.createElement("div");
  7637. v.classList.add(Ii("k")), this.trackElement.appendChild(v), this.knobElement = v, t.value.emitter.on("change", this.onChange_), this.value = t.value, this.update_();
  7638. }
  7639. update_() {
  7640. const e = Se(_e(this.value.rawValue, this.props_.get("minValue"), this.props_.get("maxValue"), 0, 100), 0, 100);
  7641. this.knobElement.style.width = `${e}%`;
  7642. }
  7643. onChange_() {
  7644. this.update_();
  7645. }
  7646. }
  7647. class Vi {
  7648. constructor(e, t) {
  7649. this.onKeyDown_ = this.onKeyDown_.bind(this), this.onKeyUp_ = this.onKeyUp_.bind(this), this.onPointerDownOrMove_ = this.onPointerDownOrMove_.bind(this), this.onPointerUp_ = this.onPointerUp_.bind(this), this.baseStep_ = t.baseStep, this.value = t.value, this.viewProps = t.viewProps, this.props = t.props, this.view = new Ke(e, {
  7650. props: this.props,
  7651. value: this.value,
  7652. viewProps: this.viewProps
  7653. }), this.ptHandler_ = new Vt(this.view.trackElement), this.ptHandler_.emitter.on("down", this.onPointerDownOrMove_), this.ptHandler_.emitter.on("move", this.onPointerDownOrMove_), this.ptHandler_.emitter.on("up", this.onPointerUp_), this.view.trackElement.addEventListener("keydown", this.onKeyDown_), this.view.trackElement.addEventListener("keyup", this.onKeyUp_);
  7654. }
  7655. handlePointerEvent_(e, t) {
  7656. e.point && this.value.setRawValue(_e(Se(e.point.x, 0, e.bounds.width), 0, e.bounds.width, this.props.get("minValue"), this.props.get("maxValue")), t);
  7657. }
  7658. onPointerDownOrMove_(e) {
  7659. this.handlePointerEvent_(e.data, {
  7660. forceEmit: false,
  7661. last: false
  7662. });
  7663. }
  7664. onPointerUp_(e) {
  7665. this.handlePointerEvent_(e.data, {
  7666. forceEmit: true,
  7667. last: true
  7668. });
  7669. }
  7670. onKeyDown_(e) {
  7671. const t = Oe(this.baseStep_, lt(e));
  7672. t !== 0 && this.value.setRawValue(this.value.rawValue + t, {
  7673. forceEmit: false,
  7674. last: false
  7675. });
  7676. }
  7677. onKeyUp_(e) {
  7678. Oe(this.baseStep_, lt(e)) !== 0 && this.value.setRawValue(this.value.rawValue, {
  7679. forceEmit: true,
  7680. last: true
  7681. });
  7682. }
  7683. }
  7684. const xn = D("sldtxt");
  7685. class Di {
  7686. constructor(e, t) {
  7687. this.element = e.createElement("div"), this.element.classList.add(xn());
  7688. const l = e.createElement("div");
  7689. l.classList.add(xn("s")), this.sliderView_ = t.sliderView, l.appendChild(this.sliderView_.element), this.element.appendChild(l);
  7690. const v = e.createElement("div");
  7691. v.classList.add(xn("t")), this.textView_ = t.textView, v.appendChild(this.textView_.element), this.element.appendChild(v);
  7692. }
  7693. }
  7694. class ei {
  7695. constructor(e, t) {
  7696. this.value = t.value, this.viewProps = t.viewProps, this.sliderC_ = new Vi(e, {
  7697. baseStep: t.baseStep,
  7698. props: t.sliderProps,
  7699. value: t.value,
  7700. viewProps: this.viewProps
  7701. }), this.textC_ = new yn(e, {
  7702. baseStep: t.baseStep,
  7703. parser: t.parser,
  7704. props: t.textProps,
  7705. sliderProps: t.sliderProps,
  7706. value: t.value,
  7707. viewProps: t.viewProps
  7708. }), this.view = new Di(e, {
  7709. sliderView: this.sliderC_.view,
  7710. textView: this.textC_.view
  7711. });
  7712. }
  7713. get sliderController() {
  7714. return this.sliderC_;
  7715. }
  7716. get textController() {
  7717. return this.textC_;
  7718. }
  7719. }
  7720. function tt(n, e) {
  7721. n.write(e);
  7722. }
  7723. function En(n) {
  7724. const e = M;
  7725. if (Array.isArray(n))
  7726. return e.required.array(e.required.object({
  7727. text: e.required.string,
  7728. value: e.required.raw
  7729. }))(n).value;
  7730. if (typeof n == "object")
  7731. return e.required.raw(n).value;
  7732. }
  7733. function Oi(n) {
  7734. if (n === "inline" || n === "popup")
  7735. return n;
  7736. }
  7737. function bt(n) {
  7738. const e = M;
  7739. return e.required.object({
  7740. max: e.optional.number,
  7741. min: e.optional.number,
  7742. step: e.optional.number
  7743. })(n).value;
  7744. }
  7745. function Ps(n) {
  7746. if (Array.isArray(n))
  7747. return n;
  7748. const e = [];
  7749. return Object.keys(n).forEach((t) => {
  7750. e.push({ text: t, value: n[t] });
  7751. }), e;
  7752. }
  7753. function Ni(n) {
  7754. return _(n) ? null : new vn(Ps(n));
  7755. }
  7756. function Cr(n) {
  7757. const e = n ? et(n, Qn) : null;
  7758. return e ? e.step : null;
  7759. }
  7760. function ti(n, e) {
  7761. const t = n && et(n, Qn);
  7762. return t ? Li(t.step) : Math.max(Li(e), 2);
  7763. }
  7764. function Dt(n) {
  7765. const e = Cr(n);
  7766. return e ?? 1;
  7767. }
  7768. function Ot(n, e) {
  7769. var t;
  7770. const l = n && et(n, Qn), v = Math.abs((t = l == null ? void 0 : l.step) !== null && t !== void 0 ? t : e);
  7771. return v === 0 ? 0.1 : Math.pow(10, Math.floor(Math.log10(v)) - 1);
  7772. }
  7773. const Cn = D("ckb");
  7774. class Pn {
  7775. constructor(e, t) {
  7776. this.onValueChange_ = this.onValueChange_.bind(this), this.element = e.createElement("div"), this.element.classList.add(Cn()), t.viewProps.bindClassModifiers(this.element);
  7777. const l = e.createElement("label");
  7778. l.classList.add(Cn("l")), this.element.appendChild(l);
  7779. const v = e.createElement("input");
  7780. v.classList.add(Cn("i")), v.type = "checkbox", l.appendChild(v), this.inputElement = v, t.viewProps.bindDisabled(this.inputElement);
  7781. const E = e.createElement("div");
  7782. E.classList.add(Cn("w")), l.appendChild(E);
  7783. const k = yt(e, "check");
  7784. E.appendChild(k), t.value.emitter.on("change", this.onValueChange_), this.value = t.value, this.update_();
  7785. }
  7786. update_() {
  7787. this.inputElement.checked = this.value.rawValue;
  7788. }
  7789. onValueChange_() {
  7790. this.update_();
  7791. }
  7792. }
  7793. class Ts {
  7794. constructor(e, t) {
  7795. this.onInputChange_ = this.onInputChange_.bind(this), this.value = t.value, this.viewProps = t.viewProps, this.view = new Pn(e, {
  7796. value: this.value,
  7797. viewProps: this.viewProps
  7798. }), this.view.inputElement.addEventListener("change", this.onInputChange_);
  7799. }
  7800. onInputChange_(e) {
  7801. const t = e.currentTarget;
  7802. this.value.rawValue = t.checked;
  7803. }
  7804. }
  7805. function ks(n) {
  7806. const e = [], t = Ni(n.options);
  7807. return t && e.push(t), new fn(e);
  7808. }
  7809. const ni = {
  7810. id: "input-bool",
  7811. type: "input",
  7812. accept: (n, e) => {
  7813. if (typeof n != "boolean")
  7814. return null;
  7815. const l = le(e, {
  7816. options: M.optional.custom(En)
  7817. });
  7818. return l ? {
  7819. initialValue: n,
  7820. params: l
  7821. } : null;
  7822. },
  7823. binding: {
  7824. reader: (n) => ms,
  7825. constraint: (n) => ks(n.params),
  7826. writer: (n) => tt
  7827. },
  7828. controller: (n) => {
  7829. const e = n.document, t = n.value, l = n.constraint, v = l && et(l, vn);
  7830. return v ? new bn(e, {
  7831. props: new X({
  7832. options: v.values.value("options")
  7833. }),
  7834. value: t,
  7835. viewProps: n.viewProps
  7836. }) : new Ts(e, {
  7837. value: t,
  7838. viewProps: n.viewProps
  7839. });
  7840. }
  7841. }, Nt = D("col");
  7842. class Fi {
  7843. constructor(e, t) {
  7844. this.element = e.createElement("div"), this.element.classList.add(Nt()), t.foldable.bindExpandedClass(this.element, Nt(void 0, "expanded")), O(t.foldable, "completed", K(this.element, Nt(void 0, "cpl")));
  7845. const l = e.createElement("div");
  7846. l.classList.add(Nt("h")), this.element.appendChild(l);
  7847. const v = e.createElement("div");
  7848. v.classList.add(Nt("s")), l.appendChild(v), this.swatchElement = v;
  7849. const E = e.createElement("div");
  7850. if (E.classList.add(Nt("t")), l.appendChild(E), this.textElement = E, t.pickerLayout === "inline") {
  7851. const k = e.createElement("div");
  7852. k.classList.add(Nt("p")), this.element.appendChild(k), this.pickerElement = k;
  7853. } else
  7854. this.pickerElement = null;
  7855. }
  7856. }
  7857. function Pr(n, e, t) {
  7858. const l = Se(n / 255, 0, 1), v = Se(e / 255, 0, 1), E = Se(t / 255, 0, 1), k = Math.max(l, v, E), B = Math.min(l, v, E), Q = k - B;
  7859. let J = 0, de = 0;
  7860. const ve = (B + k) / 2;
  7861. return Q !== 0 && (de = Q / (1 - Math.abs(k + B - 1)), l === k ? J = (v - E) / Q : v === k ? J = 2 + (E - l) / Q : J = 4 + (l - v) / Q, J = J / 6 + (J < 0 ? 1 : 0)), [J * 360, de * 100, ve * 100];
  7862. }
  7863. function Tr(n, e, t) {
  7864. const l = (n % 360 + 360) % 360, v = Se(e / 100, 0, 1), E = Se(t / 100, 0, 1), k = (1 - Math.abs(2 * E - 1)) * v, B = k * (1 - Math.abs(l / 60 % 2 - 1)), Q = E - k / 2;
  7865. let J, de, ve;
  7866. return l >= 0 && l < 60 ? [J, de, ve] = [k, B, 0] : l >= 60 && l < 120 ? [J, de, ve] = [B, k, 0] : l >= 120 && l < 180 ? [J, de, ve] = [0, k, B] : l >= 180 && l < 240 ? [J, de, ve] = [0, B, k] : l >= 240 && l < 300 ? [J, de, ve] = [B, 0, k] : [J, de, ve] = [k, 0, B], [(J + Q) * 255, (de + Q) * 255, (ve + Q) * 255];
  7867. }
  7868. function kr(n, e, t) {
  7869. const l = Se(n / 255, 0, 1), v = Se(e / 255, 0, 1), E = Se(t / 255, 0, 1), k = Math.max(l, v, E), B = Math.min(l, v, E), Q = k - B;
  7870. let J;
  7871. Q === 0 ? J = 0 : k === l ? J = 60 * (((v - E) / Q % 6 + 6) % 6) : k === v ? J = 60 * ((E - l) / Q + 2) : J = 60 * ((l - v) / Q + 4);
  7872. const de = k === 0 ? 0 : Q / k, ve = k;
  7873. return [J, de * 100, ve * 100];
  7874. }
  7875. function Ms(n, e, t) {
  7876. const l = Qt(n, 360), v = Se(e / 100, 0, 1), E = Se(t / 100, 0, 1), k = E * v, B = k * (1 - Math.abs(l / 60 % 2 - 1)), Q = E - k;
  7877. let J, de, ve;
  7878. return l >= 0 && l < 60 ? [J, de, ve] = [k, B, 0] : l >= 60 && l < 120 ? [J, de, ve] = [B, k, 0] : l >= 120 && l < 180 ? [J, de, ve] = [0, k, B] : l >= 180 && l < 240 ? [J, de, ve] = [0, B, k] : l >= 240 && l < 300 ? [J, de, ve] = [B, 0, k] : [J, de, ve] = [k, 0, B], [(J + Q) * 255, (de + Q) * 255, (ve + Q) * 255];
  7879. }
  7880. function m(n, e, t) {
  7881. const l = t + e * (100 - Math.abs(2 * t - 100)) / 200;
  7882. return [
  7883. n,
  7884. l !== 0 ? e * (100 - Math.abs(2 * t - 100)) / l : 0,
  7885. t + e * (100 - Math.abs(2 * t - 100)) / (2 * 100)
  7886. ];
  7887. }
  7888. function o(n, e, t) {
  7889. const l = 100 - Math.abs(t * (200 - e) / 100 - 100);
  7890. return [n, l !== 0 ? e * t / l : 0, t * (200 - e) / (2 * 100)];
  7891. }
  7892. function p(n) {
  7893. return [n[0], n[1], n[2]];
  7894. }
  7895. function f(n, e) {
  7896. return [n[0], n[1], n[2], e];
  7897. }
  7898. const x = {
  7899. hsl: {
  7900. hsl: (n, e, t) => [n, e, t],
  7901. hsv: m,
  7902. rgb: Tr
  7903. },
  7904. hsv: {
  7905. hsl: o,
  7906. hsv: (n, e, t) => [n, e, t],
  7907. rgb: Ms
  7908. },
  7909. rgb: {
  7910. hsl: Pr,
  7911. hsv: kr,
  7912. rgb: (n, e, t) => [n, e, t]
  7913. }
  7914. };
  7915. function P(n, e) {
  7916. return [
  7917. e === "float" ? 1 : n === "rgb" ? 255 : 360,
  7918. e === "float" ? 1 : n === "rgb" ? 255 : 100,
  7919. e === "float" ? 1 : n === "rgb" ? 255 : 100
  7920. ];
  7921. }
  7922. function L2(n, e) {
  7923. return n === e ? e : Qt(n, e);
  7924. }
  7925. function z(n, e, t) {
  7926. var l;
  7927. const v = P(e, t);
  7928. return [
  7929. e === "rgb" ? Se(n[0], 0, v[0]) : L2(n[0], v[0]),
  7930. Se(n[1], 0, v[1]),
  7931. Se(n[2], 0, v[2]),
  7932. Se((l = n[3]) !== null && l !== void 0 ? l : 1, 0, 1)
  7933. ];
  7934. }
  7935. function oe(n, e, t, l) {
  7936. const v = P(e, t), E = P(e, l);
  7937. return n.map((k, B) => k / v[B] * E[B]);
  7938. }
  7939. function Qe(n, e, t) {
  7940. const l = oe(n, e.mode, e.type, "int"), v = x[e.mode][t.mode](...l);
  7941. return oe(v, t.mode, "int", t.type);
  7942. }
  7943. function Ze(n, e) {
  7944. return typeof n != "object" || _(n) ? false : e in n && typeof n[e] == "number";
  7945. }
  7946. class te {
  7947. static black(e = "int") {
  7948. return new te([0, 0, 0], "rgb", e);
  7949. }
  7950. static fromObject(e, t = "int") {
  7951. const l = "a" in e ? [e.r, e.g, e.b, e.a] : [e.r, e.g, e.b];
  7952. return new te(l, "rgb", t);
  7953. }
  7954. static toRgbaObject(e, t = "int") {
  7955. return e.toRgbaObject(t);
  7956. }
  7957. static isRgbColorObject(e) {
  7958. return Ze(e, "r") && Ze(e, "g") && Ze(e, "b");
  7959. }
  7960. static isRgbaColorObject(e) {
  7961. return this.isRgbColorObject(e) && Ze(e, "a");
  7962. }
  7963. static isColorObject(e) {
  7964. return this.isRgbColorObject(e);
  7965. }
  7966. static equals(e, t) {
  7967. if (e.mode !== t.mode)
  7968. return false;
  7969. const l = e.comps_, v = t.comps_;
  7970. for (let E = 0; E < l.length; E++)
  7971. if (l[E] !== v[E])
  7972. return false;
  7973. return true;
  7974. }
  7975. constructor(e, t, l = "int") {
  7976. this.mode = t, this.type = l, this.comps_ = z(e, t, l);
  7977. }
  7978. getComponents(e, t = "int") {
  7979. return f(Qe(p(this.comps_), { mode: this.mode, type: this.type }, { mode: e ?? this.mode, type: t }), this.comps_[3]);
  7980. }
  7981. toRgbaObject(e = "int") {
  7982. const t = this.getComponents("rgb", e);
  7983. return {
  7984. r: t[0],
  7985. g: t[1],
  7986. b: t[2],
  7987. a: t[3]
  7988. };
  7989. }
  7990. }
  7991. const Pt = D("colp");
  7992. class Mr {
  7993. constructor(e, t) {
  7994. this.alphaViews_ = null, this.element = e.createElement("div"), this.element.classList.add(Pt()), t.viewProps.bindClassModifiers(this.element);
  7995. const l = e.createElement("div");
  7996. l.classList.add(Pt("hsv"));
  7997. const v = e.createElement("div");
  7998. v.classList.add(Pt("sv")), this.svPaletteView_ = t.svPaletteView, v.appendChild(this.svPaletteView_.element), l.appendChild(v);
  7999. const E = e.createElement("div");
  8000. E.classList.add(Pt("h")), this.hPaletteView_ = t.hPaletteView, E.appendChild(this.hPaletteView_.element), l.appendChild(E), this.element.appendChild(l);
  8001. const k = e.createElement("div");
  8002. if (k.classList.add(Pt("rgb")), this.textView_ = t.textView, k.appendChild(this.textView_.element), this.element.appendChild(k), t.alphaViews) {
  8003. this.alphaViews_ = {
  8004. palette: t.alphaViews.palette,
  8005. text: t.alphaViews.text
  8006. };
  8007. const B = e.createElement("div");
  8008. B.classList.add(Pt("a"));
  8009. const Q = e.createElement("div");
  8010. Q.classList.add(Pt("ap")), Q.appendChild(this.alphaViews_.palette.element), B.appendChild(Q);
  8011. const J = e.createElement("div");
  8012. J.classList.add(Pt("at")), J.appendChild(this.alphaViews_.text.element), B.appendChild(J), this.element.appendChild(B);
  8013. }
  8014. }
  8015. get allFocusableElements() {
  8016. const e = [
  8017. this.svPaletteView_.element,
  8018. this.hPaletteView_.element,
  8019. this.textView_.modeSelectElement,
  8020. ...this.textView_.textViews.map((t) => t.inputElement)
  8021. ];
  8022. return this.alphaViews_ && e.push(this.alphaViews_.palette.element, this.alphaViews_.text.inputElement), e;
  8023. }
  8024. }
  8025. function il(n) {
  8026. return n === "int" ? "int" : n === "float" ? "float" : void 0;
  8027. }
  8028. function Sr(n) {
  8029. const e = M;
  8030. return le(n, {
  8031. alpha: e.optional.boolean,
  8032. color: e.optional.object({
  8033. alpha: e.optional.boolean,
  8034. type: e.optional.custom(il)
  8035. }),
  8036. expanded: e.optional.boolean,
  8037. picker: e.optional.custom(Oi)
  8038. });
  8039. }
  8040. function Tn(n) {
  8041. return n ? 0.1 : 1;
  8042. }
  8043. function kn(n) {
  8044. var e;
  8045. return (e = n.color) === null || e === void 0 ? void 0 : e.type;
  8046. }
  8047. function sl(n, e) {
  8048. return n.alpha === e.alpha && n.mode === e.mode && n.notation === e.notation && n.type === e.type;
  8049. }
  8050. function ct(n, e) {
  8051. const t = n.match(/^(.+)%$/);
  8052. return Math.min(t ? parseFloat(t[1]) * 0.01 * e : parseFloat(n), e);
  8053. }
  8054. const rl = {
  8055. deg: (n) => n,
  8056. grad: (n) => n * 360 / 400,
  8057. rad: (n) => n * 360 / (2 * Math.PI),
  8058. turn: (n) => n * 360
  8059. };
  8060. function wo(n) {
  8061. const e = n.match(/^([0-9.]+?)(deg|grad|rad|turn)$/);
  8062. if (!e)
  8063. return parseFloat(n);
  8064. const t = parseFloat(e[1]), l = e[2];
  8065. return rl[l](t);
  8066. }
  8067. function yo(n) {
  8068. const e = n.match(/^rgb\(\s*([0-9A-Fa-f.]+%?)\s*,\s*([0-9A-Fa-f.]+%?)\s*,\s*([0-9A-Fa-f.]+%?)\s*\)$/);
  8069. if (!e)
  8070. return null;
  8071. const t = [
  8072. ct(e[1], 255),
  8073. ct(e[2], 255),
  8074. ct(e[3], 255)
  8075. ];
  8076. return isNaN(t[0]) || isNaN(t[1]) || isNaN(t[2]) ? null : t;
  8077. }
  8078. function xo(n) {
  8079. return (e) => {
  8080. const t = yo(e);
  8081. return t ? new te(t, "rgb", n) : null;
  8082. };
  8083. }
  8084. function Eo(n) {
  8085. const e = n.match(/^rgba\(\s*([0-9A-Fa-f.]+%?)\s*,\s*([0-9A-Fa-f.]+%?)\s*,\s*([0-9A-Fa-f.]+%?)\s*,\s*([0-9A-Fa-f.]+%?)\s*\)$/);
  8086. if (!e)
  8087. return null;
  8088. const t = [
  8089. ct(e[1], 255),
  8090. ct(e[2], 255),
  8091. ct(e[3], 255),
  8092. ct(e[4], 1)
  8093. ];
  8094. return isNaN(t[0]) || isNaN(t[1]) || isNaN(t[2]) || isNaN(t[3]) ? null : t;
  8095. }
  8096. function Co(n) {
  8097. return (e) => {
  8098. const t = Eo(e);
  8099. return t ? new te(t, "rgb", n) : null;
  8100. };
  8101. }
  8102. function Po(n) {
  8103. const e = n.match(/^hsl\(\s*([0-9A-Fa-f.]+(?:deg|grad|rad|turn)?)\s*,\s*([0-9A-Fa-f.]+%?)\s*,\s*([0-9A-Fa-f.]+%?)\s*\)$/);
  8104. if (!e)
  8105. return null;
  8106. const t = [
  8107. wo(e[1]),
  8108. ct(e[2], 100),
  8109. ct(e[3], 100)
  8110. ];
  8111. return isNaN(t[0]) || isNaN(t[1]) || isNaN(t[2]) ? null : t;
  8112. }
  8113. function To(n) {
  8114. return (e) => {
  8115. const t = Po(e);
  8116. return t ? new te(t, "hsl", n) : null;
  8117. };
  8118. }
  8119. function ko(n) {
  8120. const e = n.match(/^hsla\(\s*([0-9A-Fa-f.]+(?:deg|grad|rad|turn)?)\s*,\s*([0-9A-Fa-f.]+%?)\s*,\s*([0-9A-Fa-f.]+%?)\s*,\s*([0-9A-Fa-f.]+%?)\s*\)$/);
  8121. if (!e)
  8122. return null;
  8123. const t = [
  8124. wo(e[1]),
  8125. ct(e[2], 100),
  8126. ct(e[3], 100),
  8127. ct(e[4], 1)
  8128. ];
  8129. return isNaN(t[0]) || isNaN(t[1]) || isNaN(t[2]) || isNaN(t[3]) ? null : t;
  8130. }
  8131. function Mo(n) {
  8132. return (e) => {
  8133. const t = ko(e);
  8134. return t ? new te(t, "hsl", n) : null;
  8135. };
  8136. }
  8137. function So(n) {
  8138. const e = n.match(/^#([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])$/);
  8139. if (e)
  8140. return [
  8141. parseInt(e[1] + e[1], 16),
  8142. parseInt(e[2] + e[2], 16),
  8143. parseInt(e[3] + e[3], 16)
  8144. ];
  8145. const t = n.match(/^(?:#|0x)([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})$/);
  8146. return t ? [
  8147. parseInt(t[1], 16),
  8148. parseInt(t[2], 16),
  8149. parseInt(t[3], 16)
  8150. ] : null;
  8151. }
  8152. function ol(n) {
  8153. const e = So(n);
  8154. return e ? new te(e, "rgb", "int") : null;
  8155. }
  8156. function Ao(n) {
  8157. const e = n.match(/^#?([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])$/);
  8158. if (e)
  8159. return [
  8160. parseInt(e[1] + e[1], 16),
  8161. parseInt(e[2] + e[2], 16),
  8162. parseInt(e[3] + e[3], 16),
  8163. _e(parseInt(e[4] + e[4], 16), 0, 255, 0, 1)
  8164. ];
  8165. const t = n.match(/^(?:#|0x)?([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})$/);
  8166. return t ? [
  8167. parseInt(t[1], 16),
  8168. parseInt(t[2], 16),
  8169. parseInt(t[3], 16),
  8170. _e(parseInt(t[4], 16), 0, 255, 0, 1)
  8171. ] : null;
  8172. }
  8173. function al(n) {
  8174. const e = Ao(n);
  8175. return e ? new te(e, "rgb", "int") : null;
  8176. }
  8177. function Lo(n) {
  8178. const e = n.match(/^\{\s*r\s*:\s*([0-9A-Fa-f.]+%?)\s*,\s*g\s*:\s*([0-9A-Fa-f.]+%?)\s*,\s*b\s*:\s*([0-9A-Fa-f.]+%?)\s*\}$/);
  8179. if (!e)
  8180. return null;
  8181. const t = [
  8182. parseFloat(e[1]),
  8183. parseFloat(e[2]),
  8184. parseFloat(e[3])
  8185. ];
  8186. return isNaN(t[0]) || isNaN(t[1]) || isNaN(t[2]) ? null : t;
  8187. }
  8188. function Ro(n) {
  8189. return (e) => {
  8190. const t = Lo(e);
  8191. return t ? new te(t, "rgb", n) : null;
  8192. };
  8193. }
  8194. function Io(n) {
  8195. const e = n.match(/^\{\s*r\s*:\s*([0-9A-Fa-f.]+%?)\s*,\s*g\s*:\s*([0-9A-Fa-f.]+%?)\s*,\s*b\s*:\s*([0-9A-Fa-f.]+%?)\s*,\s*a\s*:\s*([0-9A-Fa-f.]+%?)\s*\}$/);
  8196. if (!e)
  8197. return null;
  8198. const t = [
  8199. parseFloat(e[1]),
  8200. parseFloat(e[2]),
  8201. parseFloat(e[3]),
  8202. parseFloat(e[4])
  8203. ];
  8204. return isNaN(t[0]) || isNaN(t[1]) || isNaN(t[2]) || isNaN(t[3]) ? null : t;
  8205. }
  8206. function Vo(n) {
  8207. return (e) => {
  8208. const t = Io(e);
  8209. return t ? new te(t, "rgb", n) : null;
  8210. };
  8211. }
  8212. const ll = [
  8213. {
  8214. parser: So,
  8215. result: {
  8216. alpha: false,
  8217. mode: "rgb",
  8218. notation: "hex"
  8219. }
  8220. },
  8221. {
  8222. parser: Ao,
  8223. result: {
  8224. alpha: true,
  8225. mode: "rgb",
  8226. notation: "hex"
  8227. }
  8228. },
  8229. {
  8230. parser: yo,
  8231. result: {
  8232. alpha: false,
  8233. mode: "rgb",
  8234. notation: "func"
  8235. }
  8236. },
  8237. {
  8238. parser: Eo,
  8239. result: {
  8240. alpha: true,
  8241. mode: "rgb",
  8242. notation: "func"
  8243. }
  8244. },
  8245. {
  8246. parser: Po,
  8247. result: {
  8248. alpha: false,
  8249. mode: "hsl",
  8250. notation: "func"
  8251. }
  8252. },
  8253. {
  8254. parser: ko,
  8255. result: {
  8256. alpha: true,
  8257. mode: "hsl",
  8258. notation: "func"
  8259. }
  8260. },
  8261. {
  8262. parser: Lo,
  8263. result: {
  8264. alpha: false,
  8265. mode: "rgb",
  8266. notation: "object"
  8267. }
  8268. },
  8269. {
  8270. parser: Io,
  8271. result: {
  8272. alpha: true,
  8273. mode: "rgb",
  8274. notation: "object"
  8275. }
  8276. }
  8277. ];
  8278. function cl(n) {
  8279. return ll.reduce((e, { parser: t, result: l }) => e || (t(n) ? l : null), null);
  8280. }
  8281. function Ar(n, e = "int") {
  8282. const t = cl(n);
  8283. return t ? t.notation === "hex" && e !== "float" ? Object.assign(Object.assign({}, t), { type: "int" }) : t.notation === "func" ? Object.assign(Object.assign({}, t), { type: e }) : null : null;
  8284. }
  8285. const Do = {
  8286. int: [
  8287. ol,
  8288. al,
  8289. xo("int"),
  8290. Co("int"),
  8291. To("int"),
  8292. Mo("int"),
  8293. Ro("int"),
  8294. Vo("int")
  8295. ],
  8296. float: [
  8297. xo("float"),
  8298. Co("float"),
  8299. To("float"),
  8300. Mo("float"),
  8301. Ro("float"),
  8302. Vo("float")
  8303. ]
  8304. };
  8305. function pl(n) {
  8306. const e = Do[n];
  8307. return (t) => {
  8308. if (typeof t != "string")
  8309. return te.black(n);
  8310. const l = e.reduce((v, E) => v || E(t), null);
  8311. return l ?? te.black(n);
  8312. };
  8313. }
  8314. function Lr(n) {
  8315. const e = Do[n];
  8316. return (t) => e.reduce((l, v) => l || v(t), null);
  8317. }
  8318. function Oo(n) {
  8319. const e = Se(Math.floor(n), 0, 255).toString(16);
  8320. return e.length === 1 ? `0${e}` : e;
  8321. }
  8322. function No(n, e = "#") {
  8323. const t = p(n.getComponents("rgb")).map(Oo).join("");
  8324. return `${e}${t}`;
  8325. }
  8326. function Rr(n, e = "#") {
  8327. const t = n.getComponents("rgb"), l = [t[0], t[1], t[2], t[3] * 255].map(Oo).join("");
  8328. return `${e}${l}`;
  8329. }
  8330. function Fo(n, e) {
  8331. const t = Re(e === "float" ? 2 : 0);
  8332. return `rgb(${p(n.getComponents("rgb", e)).map((v) => t(v)).join(", ")})`;
  8333. }
  8334. function ul(n) {
  8335. return (e) => Fo(e, n);
  8336. }
  8337. function Ss(n, e) {
  8338. const t = Re(2), l = Re(e === "float" ? 2 : 0);
  8339. return `rgba(${n.getComponents("rgb", e).map((E, k) => (k === 3 ? t : l)(E)).join(", ")})`;
  8340. }
  8341. function hl(n) {
  8342. return (e) => Ss(e, n);
  8343. }
  8344. function dl(n) {
  8345. const e = [
  8346. Re(0),
  8347. _n,
  8348. _n
  8349. ];
  8350. return `hsl(${p(n.getComponents("hsl")).map((l, v) => e[v](l)).join(", ")})`;
  8351. }
  8352. function ml(n) {
  8353. const e = [
  8354. Re(0),
  8355. _n,
  8356. _n,
  8357. Re(2)
  8358. ];
  8359. return `hsla(${n.getComponents("hsl").map((l, v) => e[v](l)).join(", ")})`;
  8360. }
  8361. function Bo(n, e) {
  8362. const t = Re(e === "float" ? 2 : 0), l = ["r", "g", "b"];
  8363. return `{${p(n.getComponents("rgb", e)).map((E, k) => `${l[k]}: ${t(E)}`).join(", ")}}`;
  8364. }
  8365. function fl(n) {
  8366. return (e) => Bo(e, n);
  8367. }
  8368. function jo(n, e) {
  8369. const t = Re(2), l = Re(e === "float" ? 2 : 0), v = ["r", "g", "b", "a"];
  8370. return `{${n.getComponents("rgb", e).map((k, B) => {
  8371. const Q = B === 3 ? t : l;
  8372. return `${v[B]}: ${Q(k)}`;
  8373. }).join(", ")}}`;
  8374. }
  8375. function vl(n) {
  8376. return (e) => jo(e, n);
  8377. }
  8378. const bl = [
  8379. {
  8380. format: {
  8381. alpha: false,
  8382. mode: "rgb",
  8383. notation: "hex",
  8384. type: "int"
  8385. },
  8386. stringifier: No
  8387. },
  8388. {
  8389. format: {
  8390. alpha: true,
  8391. mode: "rgb",
  8392. notation: "hex",
  8393. type: "int"
  8394. },
  8395. stringifier: Rr
  8396. },
  8397. {
  8398. format: {
  8399. alpha: false,
  8400. mode: "hsl",
  8401. notation: "func",
  8402. type: "int"
  8403. },
  8404. stringifier: dl
  8405. },
  8406. {
  8407. format: {
  8408. alpha: true,
  8409. mode: "hsl",
  8410. notation: "func",
  8411. type: "int"
  8412. },
  8413. stringifier: ml
  8414. },
  8415. ...["int", "float"].reduce((n, e) => [
  8416. ...n,
  8417. {
  8418. format: {
  8419. alpha: false,
  8420. mode: "rgb",
  8421. notation: "func",
  8422. type: e
  8423. },
  8424. stringifier: ul(e)
  8425. },
  8426. {
  8427. format: {
  8428. alpha: true,
  8429. mode: "rgb",
  8430. notation: "func",
  8431. type: e
  8432. },
  8433. stringifier: hl(e)
  8434. },
  8435. {
  8436. format: {
  8437. alpha: false,
  8438. mode: "rgb",
  8439. notation: "object",
  8440. type: e
  8441. },
  8442. stringifier: fl(e)
  8443. },
  8444. {
  8445. format: {
  8446. alpha: true,
  8447. mode: "rgb",
  8448. notation: "object",
  8449. type: e
  8450. },
  8451. stringifier: vl(e)
  8452. }
  8453. ], [])
  8454. ];
  8455. function Ir(n) {
  8456. return bl.reduce((e, t) => e || (sl(t.format, n) ? t.stringifier : null), null);
  8457. }
  8458. const Bi = D("apl");
  8459. class gl {
  8460. constructor(e, t) {
  8461. this.onValueChange_ = this.onValueChange_.bind(this), this.value = t.value, this.value.emitter.on("change", this.onValueChange_), this.element = e.createElement("div"), this.element.classList.add(Bi()), t.viewProps.bindClassModifiers(this.element), t.viewProps.bindTabIndex(this.element);
  8462. const l = e.createElement("div");
  8463. l.classList.add(Bi("b")), this.element.appendChild(l);
  8464. const v = e.createElement("div");
  8465. v.classList.add(Bi("c")), l.appendChild(v), this.colorElem_ = v;
  8466. const E = e.createElement("div");
  8467. E.classList.add(Bi("m")), this.element.appendChild(E), this.markerElem_ = E;
  8468. const k = e.createElement("div");
  8469. k.classList.add(Bi("p")), this.markerElem_.appendChild(k), this.previewElem_ = k, this.update_();
  8470. }
  8471. update_() {
  8472. const e = this.value.rawValue, t = e.getComponents("rgb"), l = new te([t[0], t[1], t[2], 0], "rgb"), v = new te([t[0], t[1], t[2], 255], "rgb"), E = [
  8473. "to right",
  8474. Ss(l),
  8475. Ss(v)
  8476. ];
  8477. this.colorElem_.style.background = `linear-gradient(${E.join(",")})`, this.previewElem_.style.backgroundColor = Ss(e);
  8478. const k = _e(t[3], 0, 1, 0, 100);
  8479. this.markerElem_.style.left = `${k}%`;
  8480. }
  8481. onValueChange_() {
  8482. this.update_();
  8483. }
  8484. }
  8485. class _l {
  8486. constructor(e, t) {
  8487. this.onKeyDown_ = this.onKeyDown_.bind(this), this.onKeyUp_ = this.onKeyUp_.bind(this), this.onPointerDown_ = this.onPointerDown_.bind(this), this.onPointerMove_ = this.onPointerMove_.bind(this), this.onPointerUp_ = this.onPointerUp_.bind(this), this.value = t.value, this.viewProps = t.viewProps, this.view = new gl(e, {
  8488. value: this.value,
  8489. viewProps: this.viewProps
  8490. }), this.ptHandler_ = new Vt(this.view.element), this.ptHandler_.emitter.on("down", this.onPointerDown_), this.ptHandler_.emitter.on("move", this.onPointerMove_), this.ptHandler_.emitter.on("up", this.onPointerUp_), this.view.element.addEventListener("keydown", this.onKeyDown_), this.view.element.addEventListener("keyup", this.onKeyUp_);
  8491. }
  8492. handlePointerEvent_(e, t) {
  8493. if (!e.point)
  8494. return;
  8495. const l = e.point.x / e.bounds.width, v = this.value.rawValue, [E, k, B] = v.getComponents("hsv");
  8496. this.value.setRawValue(new te([E, k, B, l], "hsv"), t);
  8497. }
  8498. onPointerDown_(e) {
  8499. this.handlePointerEvent_(e.data, {
  8500. forceEmit: false,
  8501. last: false
  8502. });
  8503. }
  8504. onPointerMove_(e) {
  8505. this.handlePointerEvent_(e.data, {
  8506. forceEmit: false,
  8507. last: false
  8508. });
  8509. }
  8510. onPointerUp_(e) {
  8511. this.handlePointerEvent_(e.data, {
  8512. forceEmit: true,
  8513. last: true
  8514. });
  8515. }
  8516. onKeyDown_(e) {
  8517. const t = Oe(Tn(true), lt(e));
  8518. if (t === 0)
  8519. return;
  8520. const l = this.value.rawValue, [v, E, k, B] = l.getComponents("hsv");
  8521. this.value.setRawValue(new te([v, E, k, B + t], "hsv"), {
  8522. forceEmit: false,
  8523. last: false
  8524. });
  8525. }
  8526. onKeyUp_(e) {
  8527. Oe(Tn(true), lt(e)) !== 0 && this.value.setRawValue(this.value.rawValue, {
  8528. forceEmit: true,
  8529. last: true
  8530. });
  8531. }
  8532. }
  8533. const ii = D("coltxt");
  8534. function wl(n) {
  8535. const e = n.createElement("select"), t = [
  8536. { text: "RGB", value: "rgb" },
  8537. { text: "HSL", value: "hsl" },
  8538. { text: "HSV", value: "hsv" }
  8539. ];
  8540. return e.appendChild(t.reduce((l, v) => {
  8541. const E = n.createElement("option");
  8542. return E.textContent = v.text, E.value = v.value, l.appendChild(E), l;
  8543. }, n.createDocumentFragment())), e;
  8544. }
  8545. class yl {
  8546. constructor(e, t) {
  8547. this.element = e.createElement("div"), this.element.classList.add(ii()), t.viewProps.bindClassModifiers(this.element);
  8548. const l = e.createElement("div");
  8549. l.classList.add(ii("m")), this.modeElem_ = wl(e), this.modeElem_.classList.add(ii("ms")), l.appendChild(this.modeSelectElement), t.viewProps.bindDisabled(this.modeElem_);
  8550. const v = e.createElement("div");
  8551. v.classList.add(ii("mm")), v.appendChild(yt(e, "dropdown")), l.appendChild(v), this.element.appendChild(l);
  8552. const E = e.createElement("div");
  8553. E.classList.add(ii("w")), this.element.appendChild(E), this.textsElem_ = E, this.textViews_ = t.textViews, this.applyTextViews_(), N(t.colorMode, (k) => {
  8554. this.modeElem_.value = k;
  8555. });
  8556. }
  8557. get modeSelectElement() {
  8558. return this.modeElem_;
  8559. }
  8560. get textViews() {
  8561. return this.textViews_;
  8562. }
  8563. set textViews(e) {
  8564. this.textViews_ = e, this.applyTextViews_();
  8565. }
  8566. applyTextViews_() {
  8567. cn(this.textsElem_);
  8568. const e = this.element.ownerDocument;
  8569. this.textViews_.forEach((t) => {
  8570. const l = e.createElement("div");
  8571. l.classList.add(ii("c")), l.appendChild(t.element), this.textsElem_.appendChild(l);
  8572. });
  8573. }
  8574. }
  8575. function xl(n) {
  8576. return Re(n === "float" ? 2 : 0);
  8577. }
  8578. function El(n, e, t) {
  8579. const l = P(n, e)[t];
  8580. return new Xt({
  8581. min: 0,
  8582. max: l
  8583. });
  8584. }
  8585. function Vr(n, e, t) {
  8586. return new yn(n, {
  8587. arrayPosition: t === 0 ? "fst" : t === 3 - 1 ? "lst" : "mid",
  8588. baseStep: Tn(false),
  8589. parser: e.parser,
  8590. props: X.fromObject({
  8591. draggingScale: e.colorType === "float" ? 0.01 : 1,
  8592. formatter: xl(e.colorType)
  8593. }),
  8594. value: ee(0, {
  8595. constraint: El(e.colorMode, e.colorType, t)
  8596. }),
  8597. viewProps: e.viewProps
  8598. });
  8599. }
  8600. class Cl {
  8601. constructor(e, t) {
  8602. this.onModeSelectChange_ = this.onModeSelectChange_.bind(this), this.colorType_ = t.colorType, this.parser_ = t.parser, this.value = t.value, this.viewProps = t.viewProps, this.colorMode = ee(this.value.rawValue.mode), this.ccs_ = this.createComponentControllers_(e), this.view = new yl(e, {
  8603. colorMode: this.colorMode,
  8604. textViews: [this.ccs_[0].view, this.ccs_[1].view, this.ccs_[2].view],
  8605. viewProps: this.viewProps
  8606. }), this.view.modeSelectElement.addEventListener("change", this.onModeSelectChange_);
  8607. }
  8608. createComponentControllers_(e) {
  8609. const t = {
  8610. colorMode: this.colorMode.rawValue,
  8611. colorType: this.colorType_,
  8612. parser: this.parser_,
  8613. viewProps: this.viewProps
  8614. }, l = [
  8615. Vr(e, t, 0),
  8616. Vr(e, t, 1),
  8617. Vr(e, t, 2)
  8618. ];
  8619. return l.forEach((v, E) => {
  8620. qt({
  8621. primary: this.value,
  8622. secondary: v.value,
  8623. forward: (k) => k.rawValue.getComponents(this.colorMode.rawValue, this.colorType_)[E],
  8624. backward: (k, B) => {
  8625. const Q = this.colorMode.rawValue, J = k.rawValue.getComponents(Q, this.colorType_);
  8626. return J[E] = B.rawValue, new te(f(p(J), J[3]), Q, this.colorType_);
  8627. }
  8628. });
  8629. }), l;
  8630. }
  8631. onModeSelectChange_(e) {
  8632. const t = e.currentTarget;
  8633. this.colorMode.rawValue = t.value, this.ccs_ = this.createComponentControllers_(this.view.element.ownerDocument), this.view.textViews = [
  8634. this.ccs_[0].view,
  8635. this.ccs_[1].view,
  8636. this.ccs_[2].view
  8637. ];
  8638. }
  8639. }
  8640. const Dr = D("hpl");
  8641. class Pl {
  8642. constructor(e, t) {
  8643. this.onValueChange_ = this.onValueChange_.bind(this), this.value = t.value, this.value.emitter.on("change", this.onValueChange_), this.element = e.createElement("div"), this.element.classList.add(Dr()), t.viewProps.bindClassModifiers(this.element), t.viewProps.bindTabIndex(this.element);
  8644. const l = e.createElement("div");
  8645. l.classList.add(Dr("c")), this.element.appendChild(l);
  8646. const v = e.createElement("div");
  8647. v.classList.add(Dr("m")), this.element.appendChild(v), this.markerElem_ = v, this.update_();
  8648. }
  8649. update_() {
  8650. const e = this.value.rawValue, [t] = e.getComponents("hsv");
  8651. this.markerElem_.style.backgroundColor = Fo(new te([t, 100, 100], "hsv"));
  8652. const l = _e(t, 0, 360, 0, 100);
  8653. this.markerElem_.style.left = `${l}%`;
  8654. }
  8655. onValueChange_() {
  8656. this.update_();
  8657. }
  8658. }
  8659. class Tl {
  8660. constructor(e, t) {
  8661. this.onKeyDown_ = this.onKeyDown_.bind(this), this.onKeyUp_ = this.onKeyUp_.bind(this), this.onPointerDown_ = this.onPointerDown_.bind(this), this.onPointerMove_ = this.onPointerMove_.bind(this), this.onPointerUp_ = this.onPointerUp_.bind(this), this.value = t.value, this.viewProps = t.viewProps, this.view = new Pl(e, {
  8662. value: this.value,
  8663. viewProps: this.viewProps
  8664. }), this.ptHandler_ = new Vt(this.view.element), this.ptHandler_.emitter.on("down", this.onPointerDown_), this.ptHandler_.emitter.on("move", this.onPointerMove_), this.ptHandler_.emitter.on("up", this.onPointerUp_), this.view.element.addEventListener("keydown", this.onKeyDown_), this.view.element.addEventListener("keyup", this.onKeyUp_);
  8665. }
  8666. handlePointerEvent_(e, t) {
  8667. if (!e.point)
  8668. return;
  8669. const l = _e(Se(e.point.x, 0, e.bounds.width), 0, e.bounds.width, 0, 360), v = this.value.rawValue, [, E, k, B] = v.getComponents("hsv");
  8670. this.value.setRawValue(new te([l, E, k, B], "hsv"), t);
  8671. }
  8672. onPointerDown_(e) {
  8673. this.handlePointerEvent_(e.data, {
  8674. forceEmit: false,
  8675. last: false
  8676. });
  8677. }
  8678. onPointerMove_(e) {
  8679. this.handlePointerEvent_(e.data, {
  8680. forceEmit: false,
  8681. last: false
  8682. });
  8683. }
  8684. onPointerUp_(e) {
  8685. this.handlePointerEvent_(e.data, {
  8686. forceEmit: true,
  8687. last: true
  8688. });
  8689. }
  8690. onKeyDown_(e) {
  8691. const t = Oe(Tn(false), lt(e));
  8692. if (t === 0)
  8693. return;
  8694. const l = this.value.rawValue, [v, E, k, B] = l.getComponents("hsv");
  8695. this.value.setRawValue(new te([v + t, E, k, B], "hsv"), {
  8696. forceEmit: false,
  8697. last: false
  8698. });
  8699. }
  8700. onKeyUp_(e) {
  8701. Oe(Tn(false), lt(e)) !== 0 && this.value.setRawValue(this.value.rawValue, {
  8702. forceEmit: true,
  8703. last: true
  8704. });
  8705. }
  8706. }
  8707. const Or = D("svp"), zo = 64;
  8708. class kl {
  8709. constructor(e, t) {
  8710. this.onValueChange_ = this.onValueChange_.bind(this), this.value = t.value, this.value.emitter.on("change", this.onValueChange_), this.element = e.createElement("div"), this.element.classList.add(Or()), t.viewProps.bindClassModifiers(this.element), t.viewProps.bindTabIndex(this.element);
  8711. const l = e.createElement("canvas");
  8712. l.height = zo, l.width = zo, l.classList.add(Or("c")), this.element.appendChild(l), this.canvasElement = l;
  8713. const v = e.createElement("div");
  8714. v.classList.add(Or("m")), this.element.appendChild(v), this.markerElem_ = v, this.update_();
  8715. }
  8716. update_() {
  8717. const e = Un(this.canvasElement);
  8718. if (!e)
  8719. return;
  8720. const l = this.value.rawValue.getComponents("hsv"), v = this.canvasElement.width, E = this.canvasElement.height, k = e.getImageData(0, 0, v, E), B = k.data;
  8721. for (let de = 0; de < E; de++)
  8722. for (let ve = 0; ve < v; ve++) {
  8723. const Mn = _e(ve, 0, v, 0, 100), zi = _e(de, 0, E, 100, 0), Ui = Ms(l[0], Mn, zi), As = (de * v + ve) * 4;
  8724. B[As] = Ui[0], B[As + 1] = Ui[1], B[As + 2] = Ui[2], B[As + 3] = 255;
  8725. }
  8726. e.putImageData(k, 0, 0);
  8727. const Q = _e(l[1], 0, 100, 0, 100);
  8728. this.markerElem_.style.left = `${Q}%`;
  8729. const J = _e(l[2], 0, 100, 100, 0);
  8730. this.markerElem_.style.top = `${J}%`;
  8731. }
  8732. onValueChange_() {
  8733. this.update_();
  8734. }
  8735. }
  8736. class Ml {
  8737. constructor(e, t) {
  8738. this.onKeyDown_ = this.onKeyDown_.bind(this), this.onKeyUp_ = this.onKeyUp_.bind(this), this.onPointerDown_ = this.onPointerDown_.bind(this), this.onPointerMove_ = this.onPointerMove_.bind(this), this.onPointerUp_ = this.onPointerUp_.bind(this), this.value = t.value, this.viewProps = t.viewProps, this.view = new kl(e, {
  8739. value: this.value,
  8740. viewProps: this.viewProps
  8741. }), this.ptHandler_ = new Vt(this.view.element), this.ptHandler_.emitter.on("down", this.onPointerDown_), this.ptHandler_.emitter.on("move", this.onPointerMove_), this.ptHandler_.emitter.on("up", this.onPointerUp_), this.view.element.addEventListener("keydown", this.onKeyDown_), this.view.element.addEventListener("keyup", this.onKeyUp_);
  8742. }
  8743. handlePointerEvent_(e, t) {
  8744. if (!e.point)
  8745. return;
  8746. const l = _e(e.point.x, 0, e.bounds.width, 0, 100), v = _e(e.point.y, 0, e.bounds.height, 100, 0), [E, , , k] = this.value.rawValue.getComponents("hsv");
  8747. this.value.setRawValue(new te([E, l, v, k], "hsv"), t);
  8748. }
  8749. onPointerDown_(e) {
  8750. this.handlePointerEvent_(e.data, {
  8751. forceEmit: false,
  8752. last: false
  8753. });
  8754. }
  8755. onPointerMove_(e) {
  8756. this.handlePointerEvent_(e.data, {
  8757. forceEmit: false,
  8758. last: false
  8759. });
  8760. }
  8761. onPointerUp_(e) {
  8762. this.handlePointerEvent_(e.data, {
  8763. forceEmit: true,
  8764. last: true
  8765. });
  8766. }
  8767. onKeyDown_(e) {
  8768. Jn(e.key) && e.preventDefault();
  8769. const [t, l, v, E] = this.value.rawValue.getComponents("hsv"), k = Tn(false), B = Oe(k, lt(e)), Q = Oe(k, wn(e));
  8770. B === 0 && Q === 0 || this.value.setRawValue(new te([t, l + B, v + Q, E], "hsv"), {
  8771. forceEmit: false,
  8772. last: false
  8773. });
  8774. }
  8775. onKeyUp_(e) {
  8776. const t = Tn(false), l = Oe(t, lt(e)), v = Oe(t, wn(e));
  8777. l === 0 && v === 0 || this.value.setRawValue(this.value.rawValue, {
  8778. forceEmit: true,
  8779. last: true
  8780. });
  8781. }
  8782. }
  8783. class Sl {
  8784. constructor(e, t) {
  8785. this.value = t.value, this.viewProps = t.viewProps, this.hPaletteC_ = new Tl(e, {
  8786. value: this.value,
  8787. viewProps: this.viewProps
  8788. }), this.svPaletteC_ = new Ml(e, {
  8789. value: this.value,
  8790. viewProps: this.viewProps
  8791. }), this.alphaIcs_ = t.supportsAlpha ? {
  8792. palette: new _l(e, {
  8793. value: this.value,
  8794. viewProps: this.viewProps
  8795. }),
  8796. text: new yn(e, {
  8797. parser: at,
  8798. baseStep: 0.1,
  8799. props: X.fromObject({
  8800. draggingScale: 0.01,
  8801. formatter: Re(2)
  8802. }),
  8803. value: ee(0, {
  8804. constraint: new Xt({ min: 0, max: 1 })
  8805. }),
  8806. viewProps: this.viewProps
  8807. })
  8808. } : null, this.alphaIcs_ && qt({
  8809. primary: this.value,
  8810. secondary: this.alphaIcs_.text.value,
  8811. forward: (l) => l.rawValue.getComponents()[3],
  8812. backward: (l, v) => {
  8813. const E = l.rawValue.getComponents();
  8814. return E[3] = v.rawValue, new te(E, l.rawValue.mode);
  8815. }
  8816. }), this.textC_ = new Cl(e, {
  8817. colorType: t.colorType,
  8818. parser: at,
  8819. value: this.value,
  8820. viewProps: this.viewProps
  8821. }), this.view = new Mr(e, {
  8822. alphaViews: this.alphaIcs_ ? {
  8823. palette: this.alphaIcs_.palette.view,
  8824. text: this.alphaIcs_.text.view
  8825. } : null,
  8826. hPaletteView: this.hPaletteC_.view,
  8827. supportsAlpha: t.supportsAlpha,
  8828. svPaletteView: this.svPaletteC_.view,
  8829. textView: this.textC_.view,
  8830. viewProps: this.viewProps
  8831. });
  8832. }
  8833. get textController() {
  8834. return this.textC_;
  8835. }
  8836. }
  8837. const Nr = D("colsw");
  8838. class Al {
  8839. constructor(e, t) {
  8840. this.onValueChange_ = this.onValueChange_.bind(this), t.value.emitter.on("change", this.onValueChange_), this.value = t.value, this.element = e.createElement("div"), this.element.classList.add(Nr()), t.viewProps.bindClassModifiers(this.element);
  8841. const l = e.createElement("div");
  8842. l.classList.add(Nr("sw")), this.element.appendChild(l), this.swatchElem_ = l;
  8843. const v = e.createElement("button");
  8844. v.classList.add(Nr("b")), t.viewProps.bindDisabled(v), this.element.appendChild(v), this.buttonElement = v, this.update_();
  8845. }
  8846. update_() {
  8847. const e = this.value.rawValue;
  8848. this.swatchElem_.style.backgroundColor = Rr(e);
  8849. }
  8850. onValueChange_() {
  8851. this.update_();
  8852. }
  8853. }
  8854. class Ll {
  8855. constructor(e, t) {
  8856. this.value = t.value, this.viewProps = t.viewProps, this.view = new Al(e, {
  8857. value: this.value,
  8858. viewProps: this.viewProps
  8859. });
  8860. }
  8861. }
  8862. class Fr {
  8863. constructor(e, t) {
  8864. this.onButtonBlur_ = this.onButtonBlur_.bind(this), this.onButtonClick_ = this.onButtonClick_.bind(this), this.onPopupChildBlur_ = this.onPopupChildBlur_.bind(this), this.onPopupChildKeydown_ = this.onPopupChildKeydown_.bind(this), this.value = t.value, this.viewProps = t.viewProps, this.foldable_ = De.create(t.expanded), this.swatchC_ = new Ll(e, {
  8865. value: this.value,
  8866. viewProps: this.viewProps
  8867. });
  8868. const l = this.swatchC_.view.buttonElement;
  8869. l.addEventListener("blur", this.onButtonBlur_), l.addEventListener("click", this.onButtonClick_), this.textC_ = new Zn(e, {
  8870. parser: t.parser,
  8871. props: X.fromObject({
  8872. formatter: t.formatter
  8873. }),
  8874. value: this.value,
  8875. viewProps: this.viewProps
  8876. }), this.view = new Fi(e, {
  8877. foldable: this.foldable_,
  8878. pickerLayout: t.pickerLayout
  8879. }), this.view.swatchElement.appendChild(this.swatchC_.view.element), this.view.textElement.appendChild(this.textC_.view.element), this.popC_ = t.pickerLayout === "popup" ? new hs(e, {
  8880. viewProps: this.viewProps
  8881. }) : null;
  8882. const v = new Sl(e, {
  8883. colorType: t.colorType,
  8884. supportsAlpha: t.supportsAlpha,
  8885. value: this.value,
  8886. viewProps: this.viewProps
  8887. });
  8888. v.view.allFocusableElements.forEach((E) => {
  8889. E.addEventListener("blur", this.onPopupChildBlur_), E.addEventListener("keydown", this.onPopupChildKeydown_);
  8890. }), this.pickerC_ = v, this.popC_ ? (this.view.element.appendChild(this.popC_.view.element), this.popC_.view.element.appendChild(v.view.element), qt({
  8891. primary: this.foldable_.value("expanded"),
  8892. secondary: this.popC_.shows,
  8893. forward: (E) => E.rawValue,
  8894. backward: (E, k) => k.rawValue
  8895. })) : this.view.pickerElement && (this.view.pickerElement.appendChild(this.pickerC_.view.element), Ue(this.foldable_, this.view.pickerElement));
  8896. }
  8897. get textController() {
  8898. return this.textC_;
  8899. }
  8900. onButtonBlur_(e) {
  8901. if (!this.popC_)
  8902. return;
  8903. const t = this.view.element, l = e.relatedTarget;
  8904. (!l || !t.contains(l)) && (this.popC_.shows.rawValue = false);
  8905. }
  8906. onButtonClick_() {
  8907. this.foldable_.set("expanded", !this.foldable_.get("expanded")), this.foldable_.get("expanded") && this.pickerC_.view.allFocusableElements[0].focus();
  8908. }
  8909. onPopupChildBlur_(e) {
  8910. if (!this.popC_)
  8911. return;
  8912. const t = this.popC_.view.element, l = xt(e);
  8913. l && t.contains(l) || l && l === this.swatchC_.view.buttonElement && !mt(t.ownerDocument) || (this.popC_.shows.rawValue = false);
  8914. }
  8915. onPopupChildKeydown_(e) {
  8916. this.popC_ ? e.key === "Escape" && (this.popC_.shows.rawValue = false) : this.view.pickerElement && e.key === "Escape" && this.swatchC_.view.buttonElement.focus();
  8917. }
  8918. }
  8919. function Rl(n, e) {
  8920. return te.isColorObject(n) ? te.fromObject(n, e) : te.black(e);
  8921. }
  8922. function Il(n) {
  8923. return p(n.getComponents("rgb")).reduce((e, t) => e << 8 | Math.floor(t) & 255, 0);
  8924. }
  8925. function Vl(n) {
  8926. return n.getComponents("rgb").reduce((e, t, l) => {
  8927. const v = Math.floor(l === 3 ? t * 255 : t) & 255;
  8928. return e << 8 | v;
  8929. }, 0) >>> 0;
  8930. }
  8931. function Dl(n) {
  8932. return new te([n >> 16 & 255, n >> 8 & 255, n & 255], "rgb");
  8933. }
  8934. function Ol(n) {
  8935. return new te([
  8936. n >> 24 & 255,
  8937. n >> 16 & 255,
  8938. n >> 8 & 255,
  8939. _e(n & 255, 0, 255, 0, 1)
  8940. ], "rgb");
  8941. }
  8942. function Nl(n) {
  8943. return typeof n != "number" ? te.black() : Dl(n);
  8944. }
  8945. function Fl(n) {
  8946. return typeof n != "number" ? te.black() : Ol(n);
  8947. }
  8948. function Bl(n) {
  8949. const e = Ir(n);
  8950. return e ? (t, l) => {
  8951. tt(t, e(l));
  8952. } : null;
  8953. }
  8954. function jl(n) {
  8955. const e = n ? Vl : Il;
  8956. return (t, l) => {
  8957. tt(t, e(l));
  8958. };
  8959. }
  8960. function zl(n, e, t) {
  8961. const l = e.toRgbaObject(t);
  8962. n.writeProperty("r", l.r), n.writeProperty("g", l.g), n.writeProperty("b", l.b), n.writeProperty("a", l.a);
  8963. }
  8964. function Ul(n, e, t) {
  8965. const l = e.toRgbaObject(t);
  8966. n.writeProperty("r", l.r), n.writeProperty("g", l.g), n.writeProperty("b", l.b);
  8967. }
  8968. function Gl(n, e) {
  8969. return (t, l) => {
  8970. n ? zl(t, l, e) : Ul(t, l, e);
  8971. };
  8972. }
  8973. function Br(n) {
  8974. var e;
  8975. return !!(n != null && n.alpha || !((e = n == null ? void 0 : n.color) === null || e === void 0) && e.alpha);
  8976. }
  8977. function Hl(n) {
  8978. return n ? (e) => Rr(e, "0x") : (e) => No(e, "0x");
  8979. }
  8980. function Kl(n) {
  8981. return "color" in n || "view" in n && n.view === "color";
  8982. }
  8983. const $l = {
  8984. id: "input-color-number",
  8985. type: "input",
  8986. accept: (n, e) => {
  8987. if (typeof n != "number" || !Kl(e))
  8988. return null;
  8989. const t = Sr(e);
  8990. return t ? {
  8991. initialValue: n,
  8992. params: t
  8993. } : null;
  8994. },
  8995. binding: {
  8996. reader: (n) => Br(n.params) ? Fl : Nl,
  8997. equals: te.equals,
  8998. writer: (n) => jl(Br(n.params))
  8999. },
  9000. controller: (n) => {
  9001. const e = Br(n.params), t = "expanded" in n.params ? n.params.expanded : void 0, l = "picker" in n.params ? n.params.picker : void 0;
  9002. return new Fr(n.document, {
  9003. colorType: "int",
  9004. expanded: t ?? false,
  9005. formatter: Hl(e),
  9006. parser: Lr("int"),
  9007. pickerLayout: l ?? "popup",
  9008. supportsAlpha: e,
  9009. value: n.value,
  9010. viewProps: n.viewProps
  9011. });
  9012. }
  9013. };
  9014. function Xl(n) {
  9015. return te.isRgbaColorObject(n);
  9016. }
  9017. function Yl(n) {
  9018. return (e) => Rl(e, n);
  9019. }
  9020. function ql(n, e) {
  9021. return (t) => n ? jo(t, e) : Bo(t, e);
  9022. }
  9023. const Ql = {
  9024. id: "input-color-object",
  9025. type: "input",
  9026. accept: (n, e) => {
  9027. if (!te.isColorObject(n))
  9028. return null;
  9029. const t = Sr(e);
  9030. return t ? {
  9031. initialValue: n,
  9032. params: t
  9033. } : null;
  9034. },
  9035. binding: {
  9036. reader: (n) => Yl(kn(n.params)),
  9037. equals: te.equals,
  9038. writer: (n) => Gl(Xl(n.initialValue), kn(n.params))
  9039. },
  9040. controller: (n) => {
  9041. var e;
  9042. const t = te.isRgbaColorObject(n.initialValue), l = "expanded" in n.params ? n.params.expanded : void 0, v = "picker" in n.params ? n.params.picker : void 0, E = (e = kn(n.params)) !== null && e !== void 0 ? e : "int";
  9043. return new Fr(n.document, {
  9044. colorType: E,
  9045. expanded: l ?? false,
  9046. formatter: ql(t, E),
  9047. parser: Lr(E),
  9048. pickerLayout: v ?? "popup",
  9049. supportsAlpha: t,
  9050. value: n.value,
  9051. viewProps: n.viewProps
  9052. });
  9053. }
  9054. }, Zl = {
  9055. id: "input-color-string",
  9056. type: "input",
  9057. accept: (n, e) => {
  9058. if (typeof n != "string" || "view" in e && e.view === "text")
  9059. return null;
  9060. const t = Ar(n, kn(e));
  9061. if (!t || !Ir(t))
  9062. return null;
  9063. const v = Sr(e);
  9064. return v ? {
  9065. initialValue: n,
  9066. params: v
  9067. } : null;
  9068. },
  9069. binding: {
  9070. reader: (n) => {
  9071. var e;
  9072. return pl((e = kn(n.params)) !== null && e !== void 0 ? e : "int");
  9073. },
  9074. equals: te.equals,
  9075. writer: (n) => {
  9076. const e = Ar(n.initialValue, kn(n.params));
  9077. if (!e)
  9078. throw S.shouldNeverHappen();
  9079. const t = Bl(e);
  9080. if (!t)
  9081. throw S.notBindable();
  9082. return t;
  9083. }
  9084. },
  9085. controller: (n) => {
  9086. const e = Ar(n.initialValue, kn(n.params));
  9087. if (!e)
  9088. throw S.shouldNeverHappen();
  9089. const t = Ir(e);
  9090. if (!t)
  9091. throw S.shouldNeverHappen();
  9092. const l = "expanded" in n.params ? n.params.expanded : void 0, v = "picker" in n.params ? n.params.picker : void 0;
  9093. return new Fr(n.document, {
  9094. colorType: e.type,
  9095. expanded: l ?? false,
  9096. formatter: t,
  9097. parser: Lr(e.type),
  9098. pickerLayout: v ?? "popup",
  9099. supportsAlpha: e.alpha,
  9100. value: n.value,
  9101. viewProps: n.viewProps
  9102. });
  9103. }
  9104. };
  9105. class Zt {
  9106. constructor(e) {
  9107. this.components = e.components, this.asm_ = e.assembly;
  9108. }
  9109. constrain(e) {
  9110. const t = this.asm_.toComponents(e).map((l, v) => {
  9111. var E, k;
  9112. return (k = (E = this.components[v]) === null || E === void 0 ? void 0 : E.constrain(l)) !== null && k !== void 0 ? k : l;
  9113. });
  9114. return this.asm_.fromComponents(t);
  9115. }
  9116. }
  9117. const Uo = D("pndtxt");
  9118. class Wl {
  9119. constructor(e, t) {
  9120. this.textViews = t.textViews, this.element = e.createElement("div"), this.element.classList.add(Uo()), this.textViews.forEach((l) => {
  9121. const v = e.createElement("div");
  9122. v.classList.add(Uo("a")), v.appendChild(l.element), this.element.appendChild(v);
  9123. });
  9124. }
  9125. }
  9126. function Jl(n, e, t) {
  9127. return new yn(n, {
  9128. arrayPosition: t === 0 ? "fst" : t === e.axes.length - 1 ? "lst" : "mid",
  9129. baseStep: e.axes[t].baseStep,
  9130. parser: e.parser,
  9131. props: e.axes[t].textProps,
  9132. value: ee(0, {
  9133. constraint: e.axes[t].constraint
  9134. }),
  9135. viewProps: e.viewProps
  9136. });
  9137. }
  9138. class jr {
  9139. constructor(e, t) {
  9140. this.value = t.value, this.viewProps = t.viewProps, this.acs_ = t.axes.map((l, v) => Jl(e, t, v)), this.acs_.forEach((l, v) => {
  9141. qt({
  9142. primary: this.value,
  9143. secondary: l.value,
  9144. forward: (E) => t.assembly.toComponents(E.rawValue)[v],
  9145. backward: (E, k) => {
  9146. const B = t.assembly.toComponents(E.rawValue);
  9147. return B[v] = k.rawValue, t.assembly.fromComponents(B);
  9148. }
  9149. });
  9150. }), this.view = new Wl(e, {
  9151. textViews: this.acs_.map((l) => l.view)
  9152. });
  9153. }
  9154. }
  9155. function Go(n, e) {
  9156. return "step" in n && !_(n.step) ? new Qn(n.step, e) : null;
  9157. }
  9158. function Ho(n) {
  9159. return !_(n.max) && !_(n.min) ? new Xt({
  9160. max: n.max,
  9161. min: n.min
  9162. }) : !_(n.max) || !_(n.min) ? new Ei({
  9163. max: n.max,
  9164. min: n.min
  9165. }) : null;
  9166. }
  9167. function ec(n) {
  9168. const e = et(n, Xt);
  9169. if (e)
  9170. return [e.values.get("min"), e.values.get("max")];
  9171. const t = et(n, Ei);
  9172. return t ? [t.minValue, t.maxValue] : [void 0, void 0];
  9173. }
  9174. function tc(n, e) {
  9175. const t = [], l = Go(n, e);
  9176. l && t.push(l);
  9177. const v = Ho(n);
  9178. v && t.push(v);
  9179. const E = Ni(n.options);
  9180. return E && t.push(E), new fn(t);
  9181. }
  9182. const nc = {
  9183. id: "input-number",
  9184. type: "input",
  9185. accept: (n, e) => {
  9186. if (typeof n != "number")
  9187. return null;
  9188. const t = M, l = le(e, {
  9189. format: t.optional.function,
  9190. max: t.optional.number,
  9191. min: t.optional.number,
  9192. options: t.optional.custom(En),
  9193. step: t.optional.number
  9194. });
  9195. return l ? {
  9196. initialValue: n,
  9197. params: l
  9198. } : null;
  9199. },
  9200. binding: {
  9201. reader: (n) => vt,
  9202. constraint: (n) => tc(n.params, n.initialValue),
  9203. writer: (n) => tt
  9204. },
  9205. controller: (n) => {
  9206. var e;
  9207. const t = n.value, l = n.constraint, v = l && et(l, vn);
  9208. if (v)
  9209. return new bn(n.document, {
  9210. props: new X({
  9211. options: v.values.value("options")
  9212. }),
  9213. value: t,
  9214. viewProps: n.viewProps
  9215. });
  9216. const E = (e = "format" in n.params ? n.params.format : void 0) !== null && e !== void 0 ? e : Re(ti(l, t.rawValue)), k = l && et(l, Xt);
  9217. return k ? new ei(n.document, {
  9218. baseStep: Dt(l),
  9219. parser: at,
  9220. sliderProps: new X({
  9221. maxValue: k.values.value("max"),
  9222. minValue: k.values.value("min")
  9223. }),
  9224. textProps: X.fromObject({
  9225. draggingScale: Ot(l, t.rawValue),
  9226. formatter: E
  9227. }),
  9228. value: t,
  9229. viewProps: n.viewProps
  9230. }) : new yn(n.document, {
  9231. baseStep: Dt(l),
  9232. parser: at,
  9233. props: X.fromObject({
  9234. draggingScale: Ot(l, t.rawValue),
  9235. formatter: E
  9236. }),
  9237. value: t,
  9238. viewProps: n.viewProps
  9239. });
  9240. }
  9241. };
  9242. class Wt {
  9243. constructor(e = 0, t = 0) {
  9244. this.x = e, this.y = t;
  9245. }
  9246. getComponents() {
  9247. return [this.x, this.y];
  9248. }
  9249. static isObject(e) {
  9250. if (_(e))
  9251. return false;
  9252. const t = e.x, l = e.y;
  9253. return !(typeof t != "number" || typeof l != "number");
  9254. }
  9255. static equals(e, t) {
  9256. return e.x === t.x && e.y === t.y;
  9257. }
  9258. toObject() {
  9259. return {
  9260. x: this.x,
  9261. y: this.y
  9262. };
  9263. }
  9264. }
  9265. const Ko = {
  9266. toComponents: (n) => n.getComponents(),
  9267. fromComponents: (n) => new Wt(...n)
  9268. }, si = D("p2d");
  9269. class ic {
  9270. constructor(e, t) {
  9271. this.element = e.createElement("div"), this.element.classList.add(si()), t.viewProps.bindClassModifiers(this.element), N(t.expanded, K(this.element, si(void 0, "expanded")));
  9272. const l = e.createElement("div");
  9273. l.classList.add(si("h")), this.element.appendChild(l);
  9274. const v = e.createElement("button");
  9275. v.classList.add(si("b")), v.appendChild(yt(e, "p2dpad")), t.viewProps.bindDisabled(v), l.appendChild(v), this.buttonElement = v;
  9276. const E = e.createElement("div");
  9277. if (E.classList.add(si("t")), l.appendChild(E), this.textElement = E, t.pickerLayout === "inline") {
  9278. const k = e.createElement("div");
  9279. k.classList.add(si("p")), this.element.appendChild(k), this.pickerElement = k;
  9280. } else
  9281. this.pickerElement = null;
  9282. }
  9283. }
  9284. const Jt = D("p2dp");
  9285. class sc {
  9286. constructor(e, t) {
  9287. this.onFoldableChange_ = this.onFoldableChange_.bind(this), this.onValueChange_ = this.onValueChange_.bind(this), this.invertsY_ = t.invertsY, this.maxValue_ = t.maxValue, this.element = e.createElement("div"), this.element.classList.add(Jt()), t.layout === "popup" && this.element.classList.add(Jt(void 0, "p")), t.viewProps.bindClassModifiers(this.element);
  9288. const l = e.createElement("div");
  9289. l.classList.add(Jt("p")), t.viewProps.bindTabIndex(l), this.element.appendChild(l), this.padElement = l;
  9290. const v = e.createElementNS(ze, "svg");
  9291. v.classList.add(Jt("g")), this.padElement.appendChild(v), this.svgElem_ = v;
  9292. const E = e.createElementNS(ze, "line");
  9293. E.classList.add(Jt("ax")), E.setAttributeNS(null, "x1", "0"), E.setAttributeNS(null, "y1", "50%"), E.setAttributeNS(null, "x2", "100%"), E.setAttributeNS(null, "y2", "50%"), this.svgElem_.appendChild(E);
  9294. const k = e.createElementNS(ze, "line");
  9295. k.classList.add(Jt("ax")), k.setAttributeNS(null, "x1", "50%"), k.setAttributeNS(null, "y1", "0"), k.setAttributeNS(null, "x2", "50%"), k.setAttributeNS(null, "y2", "100%"), this.svgElem_.appendChild(k);
  9296. const B = e.createElementNS(ze, "line");
  9297. B.classList.add(Jt("l")), B.setAttributeNS(null, "x1", "50%"), B.setAttributeNS(null, "y1", "50%"), this.svgElem_.appendChild(B), this.lineElem_ = B;
  9298. const Q = e.createElement("div");
  9299. Q.classList.add(Jt("m")), this.padElement.appendChild(Q), this.markerElem_ = Q, t.value.emitter.on("change", this.onValueChange_), this.value = t.value, this.update_();
  9300. }
  9301. get allFocusableElements() {
  9302. return [this.padElement];
  9303. }
  9304. update_() {
  9305. const [e, t] = this.value.rawValue.getComponents(), l = this.maxValue_, v = _e(e, -l, +l, 0, 100), E = _e(t, -l, +l, 0, 100), k = this.invertsY_ ? 100 - E : E;
  9306. this.lineElem_.setAttributeNS(null, "x2", `${v}%`), this.lineElem_.setAttributeNS(null, "y2", `${k}%`), this.markerElem_.style.left = `${v}%`, this.markerElem_.style.top = `${k}%`;
  9307. }
  9308. onValueChange_() {
  9309. this.update_();
  9310. }
  9311. onFoldableChange_() {
  9312. this.update_();
  9313. }
  9314. }
  9315. function $o(n, e, t) {
  9316. return [
  9317. Oe(e[0], lt(n)),
  9318. Oe(e[1], wn(n)) * (t ? 1 : -1)
  9319. ];
  9320. }
  9321. class rc {
  9322. constructor(e, t) {
  9323. this.onPadKeyDown_ = this.onPadKeyDown_.bind(this), this.onPadKeyUp_ = this.onPadKeyUp_.bind(this), this.onPointerDown_ = this.onPointerDown_.bind(this), this.onPointerMove_ = this.onPointerMove_.bind(this), this.onPointerUp_ = this.onPointerUp_.bind(this), this.value = t.value, this.viewProps = t.viewProps, this.baseSteps_ = t.baseSteps, this.maxValue_ = t.maxValue, this.invertsY_ = t.invertsY, this.view = new sc(e, {
  9324. invertsY: this.invertsY_,
  9325. layout: t.layout,
  9326. maxValue: this.maxValue_,
  9327. value: this.value,
  9328. viewProps: this.viewProps
  9329. }), this.ptHandler_ = new Vt(this.view.padElement), this.ptHandler_.emitter.on("down", this.onPointerDown_), this.ptHandler_.emitter.on("move", this.onPointerMove_), this.ptHandler_.emitter.on("up", this.onPointerUp_), this.view.padElement.addEventListener("keydown", this.onPadKeyDown_), this.view.padElement.addEventListener("keyup", this.onPadKeyUp_);
  9330. }
  9331. handlePointerEvent_(e, t) {
  9332. if (!e.point)
  9333. return;
  9334. const l = this.maxValue_, v = _e(e.point.x, 0, e.bounds.width, -l, +l), E = _e(this.invertsY_ ? e.bounds.height - e.point.y : e.point.y, 0, e.bounds.height, -l, +l);
  9335. this.value.setRawValue(new Wt(v, E), t);
  9336. }
  9337. onPointerDown_(e) {
  9338. this.handlePointerEvent_(e.data, {
  9339. forceEmit: false,
  9340. last: false
  9341. });
  9342. }
  9343. onPointerMove_(e) {
  9344. this.handlePointerEvent_(e.data, {
  9345. forceEmit: false,
  9346. last: false
  9347. });
  9348. }
  9349. onPointerUp_(e) {
  9350. this.handlePointerEvent_(e.data, {
  9351. forceEmit: true,
  9352. last: true
  9353. });
  9354. }
  9355. onPadKeyDown_(e) {
  9356. Jn(e.key) && e.preventDefault();
  9357. const [t, l] = $o(e, this.baseSteps_, this.invertsY_);
  9358. t === 0 && l === 0 || this.value.setRawValue(new Wt(this.value.rawValue.x + t, this.value.rawValue.y + l), {
  9359. forceEmit: false,
  9360. last: false
  9361. });
  9362. }
  9363. onPadKeyUp_(e) {
  9364. const [t, l] = $o(e, this.baseSteps_, this.invertsY_);
  9365. t === 0 && l === 0 || this.value.setRawValue(this.value.rawValue, {
  9366. forceEmit: true,
  9367. last: true
  9368. });
  9369. }
  9370. }
  9371. class oc {
  9372. constructor(e, t) {
  9373. var l, v;
  9374. this.onPopupChildBlur_ = this.onPopupChildBlur_.bind(this), this.onPopupChildKeydown_ = this.onPopupChildKeydown_.bind(this), this.onPadButtonBlur_ = this.onPadButtonBlur_.bind(this), this.onPadButtonClick_ = this.onPadButtonClick_.bind(this), this.value = t.value, this.viewProps = t.viewProps, this.foldable_ = De.create(t.expanded), this.popC_ = t.pickerLayout === "popup" ? new hs(e, {
  9375. viewProps: this.viewProps
  9376. }) : null;
  9377. const E = new rc(e, {
  9378. baseSteps: [t.axes[0].baseStep, t.axes[1].baseStep],
  9379. invertsY: t.invertsY,
  9380. layout: t.pickerLayout,
  9381. maxValue: t.maxValue,
  9382. value: this.value,
  9383. viewProps: this.viewProps
  9384. });
  9385. E.view.allFocusableElements.forEach((k) => {
  9386. k.addEventListener("blur", this.onPopupChildBlur_), k.addEventListener("keydown", this.onPopupChildKeydown_);
  9387. }), this.pickerC_ = E, this.textC_ = new jr(e, {
  9388. assembly: Ko,
  9389. axes: t.axes,
  9390. parser: t.parser,
  9391. value: this.value,
  9392. viewProps: this.viewProps
  9393. }), this.view = new ic(e, {
  9394. expanded: this.foldable_.value("expanded"),
  9395. pickerLayout: t.pickerLayout,
  9396. viewProps: this.viewProps
  9397. }), this.view.textElement.appendChild(this.textC_.view.element), (l = this.view.buttonElement) === null || l === void 0 || l.addEventListener("blur", this.onPadButtonBlur_), (v = this.view.buttonElement) === null || v === void 0 || v.addEventListener("click", this.onPadButtonClick_), this.popC_ ? (this.view.element.appendChild(this.popC_.view.element), this.popC_.view.element.appendChild(this.pickerC_.view.element), qt({
  9398. primary: this.foldable_.value("expanded"),
  9399. secondary: this.popC_.shows,
  9400. forward: (k) => k.rawValue,
  9401. backward: (k, B) => B.rawValue
  9402. })) : this.view.pickerElement && (this.view.pickerElement.appendChild(this.pickerC_.view.element), Ue(this.foldable_, this.view.pickerElement));
  9403. }
  9404. onPadButtonBlur_(e) {
  9405. if (!this.popC_)
  9406. return;
  9407. const t = this.view.element, l = e.relatedTarget;
  9408. (!l || !t.contains(l)) && (this.popC_.shows.rawValue = false);
  9409. }
  9410. onPadButtonClick_() {
  9411. this.foldable_.set("expanded", !this.foldable_.get("expanded")), this.foldable_.get("expanded") && this.pickerC_.view.allFocusableElements[0].focus();
  9412. }
  9413. onPopupChildBlur_(e) {
  9414. if (!this.popC_)
  9415. return;
  9416. const t = this.popC_.view.element, l = xt(e);
  9417. l && t.contains(l) || l && l === this.view.buttonElement && !mt(t.ownerDocument) || (this.popC_.shows.rawValue = false);
  9418. }
  9419. onPopupChildKeydown_(e) {
  9420. this.popC_ ? e.key === "Escape" && (this.popC_.shows.rawValue = false) : this.view.pickerElement && e.key === "Escape" && this.view.buttonElement.focus();
  9421. }
  9422. }
  9423. class ri {
  9424. constructor(e = 0, t = 0, l = 0) {
  9425. this.x = e, this.y = t, this.z = l;
  9426. }
  9427. getComponents() {
  9428. return [this.x, this.y, this.z];
  9429. }
  9430. static isObject(e) {
  9431. if (_(e))
  9432. return false;
  9433. const t = e.x, l = e.y, v = e.z;
  9434. return !(typeof t != "number" || typeof l != "number" || typeof v != "number");
  9435. }
  9436. static equals(e, t) {
  9437. return e.x === t.x && e.y === t.y && e.z === t.z;
  9438. }
  9439. toObject() {
  9440. return {
  9441. x: this.x,
  9442. y: this.y,
  9443. z: this.z
  9444. };
  9445. }
  9446. }
  9447. const Xo = {
  9448. toComponents: (n) => n.getComponents(),
  9449. fromComponents: (n) => new ri(...n)
  9450. };
  9451. function ac(n) {
  9452. return ri.isObject(n) ? new ri(n.x, n.y, n.z) : new ri();
  9453. }
  9454. function lc(n, e) {
  9455. n.writeProperty("x", e.x), n.writeProperty("y", e.y), n.writeProperty("z", e.z);
  9456. }
  9457. function cc(n, e) {
  9458. return new Zt({
  9459. assembly: Xo,
  9460. components: [
  9461. Ft("x" in n ? n.x : void 0, e.x),
  9462. Ft("y" in n ? n.y : void 0, e.y),
  9463. Ft("z" in n ? n.z : void 0, e.z)
  9464. ]
  9465. });
  9466. }
  9467. function zr(n, e) {
  9468. return {
  9469. baseStep: Dt(e),
  9470. constraint: e,
  9471. textProps: X.fromObject({
  9472. draggingScale: Ot(e, n),
  9473. formatter: Re(ti(e, n))
  9474. })
  9475. };
  9476. }
  9477. const pc = {
  9478. id: "input-point3d",
  9479. type: "input",
  9480. accept: (n, e) => {
  9481. if (!ri.isObject(n))
  9482. return null;
  9483. const t = M, l = le(e, {
  9484. x: t.optional.custom(bt),
  9485. y: t.optional.custom(bt),
  9486. z: t.optional.custom(bt)
  9487. });
  9488. return l ? {
  9489. initialValue: n,
  9490. params: l
  9491. } : null;
  9492. },
  9493. binding: {
  9494. reader: (n) => ac,
  9495. constraint: (n) => cc(n.params, n.initialValue),
  9496. equals: ri.equals,
  9497. writer: (n) => lc
  9498. },
  9499. controller: (n) => {
  9500. const e = n.value, t = n.constraint;
  9501. if (!(t instanceof Zt))
  9502. throw S.shouldNeverHappen();
  9503. return new jr(n.document, {
  9504. assembly: Xo,
  9505. axes: [
  9506. zr(e.rawValue.x, t.components[0]),
  9507. zr(e.rawValue.y, t.components[1]),
  9508. zr(e.rawValue.z, t.components[2])
  9509. ],
  9510. parser: at,
  9511. value: e,
  9512. viewProps: n.viewProps
  9513. });
  9514. }
  9515. };
  9516. class oi {
  9517. constructor(e = 0, t = 0, l = 0, v = 0) {
  9518. this.x = e, this.y = t, this.z = l, this.w = v;
  9519. }
  9520. getComponents() {
  9521. return [this.x, this.y, this.z, this.w];
  9522. }
  9523. static isObject(e) {
  9524. if (_(e))
  9525. return false;
  9526. const t = e.x, l = e.y, v = e.z, E = e.w;
  9527. return !(typeof t != "number" || typeof l != "number" || typeof v != "number" || typeof E != "number");
  9528. }
  9529. static equals(e, t) {
  9530. return e.x === t.x && e.y === t.y && e.z === t.z && e.w === t.w;
  9531. }
  9532. toObject() {
  9533. return {
  9534. x: this.x,
  9535. y: this.y,
  9536. z: this.z,
  9537. w: this.w
  9538. };
  9539. }
  9540. }
  9541. const Yo = {
  9542. toComponents: (n) => n.getComponents(),
  9543. fromComponents: (n) => new oi(...n)
  9544. };
  9545. function uc(n) {
  9546. return oi.isObject(n) ? new oi(n.x, n.y, n.z, n.w) : new oi();
  9547. }
  9548. function hc(n, e) {
  9549. n.writeProperty("x", e.x), n.writeProperty("y", e.y), n.writeProperty("z", e.z), n.writeProperty("w", e.w);
  9550. }
  9551. function dc(n, e) {
  9552. return new Zt({
  9553. assembly: Yo,
  9554. components: [
  9555. Ft("x" in n ? n.x : void 0, e.x),
  9556. Ft("y" in n ? n.y : void 0, e.y),
  9557. Ft("z" in n ? n.z : void 0, e.z),
  9558. Ft("w" in n ? n.w : void 0, e.w)
  9559. ]
  9560. });
  9561. }
  9562. function mc(n, e) {
  9563. return {
  9564. baseStep: Dt(e),
  9565. constraint: e,
  9566. textProps: X.fromObject({
  9567. draggingScale: Ot(e, n),
  9568. formatter: Re(ti(e, n))
  9569. })
  9570. };
  9571. }
  9572. const fc = {
  9573. id: "input-point4d",
  9574. type: "input",
  9575. accept: (n, e) => {
  9576. if (!oi.isObject(n))
  9577. return null;
  9578. const t = M, l = le(e, {
  9579. x: t.optional.custom(bt),
  9580. y: t.optional.custom(bt),
  9581. z: t.optional.custom(bt),
  9582. w: t.optional.custom(bt)
  9583. });
  9584. return l ? {
  9585. initialValue: n,
  9586. params: l
  9587. } : null;
  9588. },
  9589. binding: {
  9590. reader: (n) => uc,
  9591. constraint: (n) => dc(n.params, n.initialValue),
  9592. equals: oi.equals,
  9593. writer: (n) => hc
  9594. },
  9595. controller: (n) => {
  9596. const e = n.value, t = n.constraint;
  9597. if (!(t instanceof Zt))
  9598. throw S.shouldNeverHappen();
  9599. return new jr(n.document, {
  9600. assembly: Yo,
  9601. axes: e.rawValue.getComponents().map((l, v) => mc(l, t.components[v])),
  9602. parser: at,
  9603. value: e,
  9604. viewProps: n.viewProps
  9605. });
  9606. }
  9607. };
  9608. function vc(n) {
  9609. const e = [], t = Ni(n.options);
  9610. return t && e.push(t), new fn(e);
  9611. }
  9612. const bc = {
  9613. id: "input-string",
  9614. type: "input",
  9615. accept: (n, e) => {
  9616. if (typeof n != "string")
  9617. return null;
  9618. const l = le(e, {
  9619. options: M.optional.custom(En)
  9620. });
  9621. return l ? {
  9622. initialValue: n,
  9623. params: l
  9624. } : null;
  9625. },
  9626. binding: {
  9627. reader: (n) => Si,
  9628. constraint: (n) => vc(n.params),
  9629. writer: (n) => tt
  9630. },
  9631. controller: (n) => {
  9632. const e = n.document, t = n.value, l = n.constraint, v = l && et(l, vn);
  9633. return v ? new bn(e, {
  9634. props: new X({
  9635. options: v.values.value("options")
  9636. }),
  9637. value: t,
  9638. viewProps: n.viewProps
  9639. }) : new Zn(e, {
  9640. parser: (E) => E,
  9641. props: X.fromObject({
  9642. formatter: Ct
  9643. }),
  9644. value: t,
  9645. viewProps: n.viewProps
  9646. });
  9647. }
  9648. }, ji = {
  9649. monitor: {
  9650. defaultInterval: 200,
  9651. defaultLineCount: 3
  9652. }
  9653. }, qo = D("mll");
  9654. class gc {
  9655. constructor(e, t) {
  9656. this.onValueUpdate_ = this.onValueUpdate_.bind(this), this.formatter_ = t.formatter, this.element = e.createElement("div"), this.element.classList.add(qo()), t.viewProps.bindClassModifiers(this.element);
  9657. const l = e.createElement("textarea");
  9658. l.classList.add(qo("i")), l.style.height = `calc(var(--bld-us) * ${t.lineCount})`, l.readOnly = true, t.viewProps.bindDisabled(l), this.element.appendChild(l), this.textareaElem_ = l, t.value.emitter.on("change", this.onValueUpdate_), this.value = t.value, this.update_();
  9659. }
  9660. update_() {
  9661. const e = this.textareaElem_, t = e.scrollTop === e.scrollHeight - e.clientHeight, l = [];
  9662. this.value.rawValue.forEach((v) => {
  9663. v !== void 0 && l.push(this.formatter_(v));
  9664. }), e.textContent = l.join(`
  9665. `), t && (e.scrollTop = e.scrollHeight);
  9666. }
  9667. onValueUpdate_() {
  9668. this.update_();
  9669. }
  9670. }
  9671. class Ur {
  9672. constructor(e, t) {
  9673. this.value = t.value, this.viewProps = t.viewProps, this.view = new gc(e, {
  9674. formatter: t.formatter,
  9675. lineCount: t.lineCount,
  9676. value: this.value,
  9677. viewProps: this.viewProps
  9678. });
  9679. }
  9680. }
  9681. const Qo = D("sgl");
  9682. class _c {
  9683. constructor(e, t) {
  9684. this.onValueUpdate_ = this.onValueUpdate_.bind(this), this.formatter_ = t.formatter, this.element = e.createElement("div"), this.element.classList.add(Qo()), t.viewProps.bindClassModifiers(this.element);
  9685. const l = e.createElement("input");
  9686. l.classList.add(Qo("i")), l.readOnly = true, l.type = "text", t.viewProps.bindDisabled(l), this.element.appendChild(l), this.inputElement = l, t.value.emitter.on("change", this.onValueUpdate_), this.value = t.value, this.update_();
  9687. }
  9688. update_() {
  9689. const e = this.value.rawValue, t = e[e.length - 1];
  9690. this.inputElement.value = t !== void 0 ? this.formatter_(t) : "";
  9691. }
  9692. onValueUpdate_() {
  9693. this.update_();
  9694. }
  9695. }
  9696. class Gr {
  9697. constructor(e, t) {
  9698. this.value = t.value, this.viewProps = t.viewProps, this.view = new _c(e, {
  9699. formatter: t.formatter,
  9700. value: this.value,
  9701. viewProps: this.viewProps
  9702. });
  9703. }
  9704. }
  9705. const wc = {
  9706. id: "monitor-bool",
  9707. type: "monitor",
  9708. accept: (n, e) => {
  9709. if (typeof n != "boolean")
  9710. return null;
  9711. const l = le(e, {
  9712. lineCount: M.optional.number
  9713. });
  9714. return l ? {
  9715. initialValue: n,
  9716. params: l
  9717. } : null;
  9718. },
  9719. binding: {
  9720. reader: (n) => ms
  9721. },
  9722. controller: (n) => {
  9723. var e;
  9724. return n.value.rawValue.length === 1 ? new Gr(n.document, {
  9725. formatter: fs,
  9726. value: n.value,
  9727. viewProps: n.viewProps
  9728. }) : new Ur(n.document, {
  9729. formatter: fs,
  9730. lineCount: (e = n.params.lineCount) !== null && e !== void 0 ? e : ji.monitor.defaultLineCount,
  9731. value: n.value,
  9732. viewProps: n.viewProps
  9733. });
  9734. }
  9735. }, en = D("grl");
  9736. class yc {
  9737. constructor(e, t) {
  9738. this.onCursorChange_ = this.onCursorChange_.bind(this), this.onValueUpdate_ = this.onValueUpdate_.bind(this), this.element = e.createElement("div"), this.element.classList.add(en()), t.viewProps.bindClassModifiers(this.element), this.formatter_ = t.formatter, this.props_ = t.props, this.cursor_ = t.cursor, this.cursor_.emitter.on("change", this.onCursorChange_);
  9739. const l = e.createElementNS(ze, "svg");
  9740. l.classList.add(en("g")), l.style.height = `calc(var(--bld-us) * ${t.lineCount})`, this.element.appendChild(l), this.svgElem_ = l;
  9741. const v = e.createElementNS(ze, "polyline");
  9742. this.svgElem_.appendChild(v), this.lineElem_ = v;
  9743. const E = e.createElement("div");
  9744. E.classList.add(en("t"), D("tt")()), this.element.appendChild(E), this.tooltipElem_ = E, t.value.emitter.on("change", this.onValueUpdate_), this.value = t.value, this.update_();
  9745. }
  9746. get graphElement() {
  9747. return this.svgElem_;
  9748. }
  9749. update_() {
  9750. const e = this.svgElem_.getBoundingClientRect(), t = this.value.rawValue.length - 1, l = this.props_.get("minValue"), v = this.props_.get("maxValue"), E = [];
  9751. this.value.rawValue.forEach((de, ve) => {
  9752. if (de === void 0)
  9753. return;
  9754. const Mn = _e(ve, 0, t, 0, e.width), zi = _e(de, l, v, e.height, 0);
  9755. E.push([Mn, zi].join(","));
  9756. }), this.lineElem_.setAttributeNS(null, "points", E.join(" "));
  9757. const k = this.tooltipElem_, B = this.value.rawValue[this.cursor_.rawValue];
  9758. if (B === void 0) {
  9759. k.classList.remove(en("t", "a"));
  9760. return;
  9761. }
  9762. const Q = _e(this.cursor_.rawValue, 0, t, 0, e.width), J = _e(B, l, v, e.height, 0);
  9763. k.style.left = `${Q}px`, k.style.top = `${J}px`, k.textContent = `${this.formatter_(B)}`, k.classList.contains(en("t", "a")) || (k.classList.add(en("t", "a"), en("t", "in")), st(k), k.classList.remove(en("t", "in")));
  9764. }
  9765. onValueUpdate_() {
  9766. this.update_();
  9767. }
  9768. onCursorChange_() {
  9769. this.update_();
  9770. }
  9771. }
  9772. class xc {
  9773. constructor(e, t) {
  9774. if (this.onGraphMouseMove_ = this.onGraphMouseMove_.bind(this), this.onGraphMouseLeave_ = this.onGraphMouseLeave_.bind(this), this.onGraphPointerDown_ = this.onGraphPointerDown_.bind(this), this.onGraphPointerMove_ = this.onGraphPointerMove_.bind(this), this.onGraphPointerUp_ = this.onGraphPointerUp_.bind(this), this.props_ = t.props, this.value = t.value, this.viewProps = t.viewProps, this.cursor_ = ee(-1), this.view = new yc(e, {
  9775. cursor: this.cursor_,
  9776. formatter: t.formatter,
  9777. lineCount: t.lineCount,
  9778. props: this.props_,
  9779. value: this.value,
  9780. viewProps: this.viewProps
  9781. }), !mt(e))
  9782. this.view.element.addEventListener("mousemove", this.onGraphMouseMove_), this.view.element.addEventListener("mouseleave", this.onGraphMouseLeave_);
  9783. else {
  9784. const l = new Vt(this.view.element);
  9785. l.emitter.on("down", this.onGraphPointerDown_), l.emitter.on("move", this.onGraphPointerMove_), l.emitter.on("up", this.onGraphPointerUp_);
  9786. }
  9787. }
  9788. onGraphMouseLeave_() {
  9789. this.cursor_.rawValue = -1;
  9790. }
  9791. onGraphMouseMove_(e) {
  9792. const t = this.view.element.getBoundingClientRect();
  9793. this.cursor_.rawValue = Math.floor(_e(e.offsetX, 0, t.width, 0, this.value.rawValue.length));
  9794. }
  9795. onGraphPointerDown_(e) {
  9796. this.onGraphPointerMove_(e);
  9797. }
  9798. onGraphPointerMove_(e) {
  9799. if (!e.data.point) {
  9800. this.cursor_.rawValue = -1;
  9801. return;
  9802. }
  9803. this.cursor_.rawValue = Math.floor(_e(e.data.point.x, 0, e.data.bounds.width, 0, this.value.rawValue.length));
  9804. }
  9805. onGraphPointerUp_() {
  9806. this.cursor_.rawValue = -1;
  9807. }
  9808. }
  9809. function Hr(n) {
  9810. return "format" in n && !_(n.format) ? n.format : Re(2);
  9811. }
  9812. function Ec(n) {
  9813. var e;
  9814. return n.value.rawValue.length === 1 ? new Gr(n.document, {
  9815. formatter: Hr(n.params),
  9816. value: n.value,
  9817. viewProps: n.viewProps
  9818. }) : new Ur(n.document, {
  9819. formatter: Hr(n.params),
  9820. lineCount: (e = n.params.lineCount) !== null && e !== void 0 ? e : ji.monitor.defaultLineCount,
  9821. value: n.value,
  9822. viewProps: n.viewProps
  9823. });
  9824. }
  9825. function Cc(n) {
  9826. var e, t, l;
  9827. return new xc(n.document, {
  9828. formatter: Hr(n.params),
  9829. lineCount: (e = n.params.lineCount) !== null && e !== void 0 ? e : ji.monitor.defaultLineCount,
  9830. props: X.fromObject({
  9831. maxValue: (t = "max" in n.params ? n.params.max : null) !== null && t !== void 0 ? t : 100,
  9832. minValue: (l = "min" in n.params ? n.params.min : null) !== null && l !== void 0 ? l : 0
  9833. }),
  9834. value: n.value,
  9835. viewProps: n.viewProps
  9836. });
  9837. }
  9838. function Zo(n) {
  9839. return "view" in n && n.view === "graph";
  9840. }
  9841. const Pc = {
  9842. id: "monitor-number",
  9843. type: "monitor",
  9844. accept: (n, e) => {
  9845. if (typeof n != "number")
  9846. return null;
  9847. const t = M, l = le(e, {
  9848. format: t.optional.function,
  9849. lineCount: t.optional.number,
  9850. max: t.optional.number,
  9851. min: t.optional.number,
  9852. view: t.optional.string
  9853. });
  9854. return l ? {
  9855. initialValue: n,
  9856. params: l
  9857. } : null;
  9858. },
  9859. binding: {
  9860. defaultBufferSize: (n) => Zo(n) ? 64 : 1,
  9861. reader: (n) => vt
  9862. },
  9863. controller: (n) => Zo(n.params) ? Cc(n) : Ec(n)
  9864. }, Tc = {
  9865. id: "monitor-string",
  9866. type: "monitor",
  9867. accept: (n, e) => {
  9868. if (typeof n != "string")
  9869. return null;
  9870. const t = M, l = le(e, {
  9871. lineCount: t.optional.number,
  9872. multiline: t.optional.boolean
  9873. });
  9874. return l ? {
  9875. initialValue: n,
  9876. params: l
  9877. } : null;
  9878. },
  9879. binding: {
  9880. reader: (n) => Si
  9881. },
  9882. controller: (n) => {
  9883. var e;
  9884. const t = n.value;
  9885. return t.rawValue.length > 1 || "multiline" in n.params && n.params.multiline ? new Ur(n.document, {
  9886. formatter: Ct,
  9887. lineCount: (e = n.params.lineCount) !== null && e !== void 0 ? e : ji.monitor.defaultLineCount,
  9888. value: t,
  9889. viewProps: n.viewProps
  9890. }) : new Gr(n.document, {
  9891. formatter: Ct,
  9892. value: t,
  9893. viewProps: n.viewProps
  9894. });
  9895. }
  9896. };
  9897. function kc(n, e) {
  9898. var t;
  9899. const l = n.accept(e.target.read(), e.params);
  9900. if (_(l))
  9901. return null;
  9902. const v = M, E = {
  9903. target: e.target,
  9904. initialValue: l.initialValue,
  9905. params: l.params
  9906. }, k = n.binding.reader(E), B = n.binding.constraint ? n.binding.constraint(E) : void 0, Q = ee(k(l.initialValue), {
  9907. constraint: B,
  9908. equals: n.binding.equals
  9909. }), J = new qn({
  9910. reader: k,
  9911. target: e.target,
  9912. value: Q,
  9913. writer: n.binding.writer(E)
  9914. }), de = v.optional.boolean(e.params.disabled).value, ve = v.optional.boolean(e.params.hidden).value, Mn = n.controller({
  9915. constraint: B,
  9916. document: e.document,
  9917. initialValue: l.initialValue,
  9918. params: l.params,
  9919. value: J.value,
  9920. viewProps: Xe.create({
  9921. disabled: de,
  9922. hidden: ve
  9923. })
  9924. });
  9925. return new Fe(e.document, {
  9926. binding: J,
  9927. blade: ye(),
  9928. props: X.fromObject({
  9929. label: "label" in e.params ? (t = v.optional.string(e.params.label).value) !== null && t !== void 0 ? t : null : e.target.key
  9930. }),
  9931. valueController: Mn
  9932. });
  9933. }
  9934. function Mc(n, e) {
  9935. return e === 0 ? new ls() : new xi(n, e ?? ji.monitor.defaultInterval);
  9936. }
  9937. function Sc(n, e) {
  9938. var t, l, v;
  9939. const E = M, k = n.accept(e.target.read(), e.params);
  9940. if (_(k))
  9941. return null;
  9942. const B = {
  9943. target: e.target,
  9944. initialValue: k.initialValue,
  9945. params: k.params
  9946. }, Q = n.binding.reader(B), J = (l = (t = E.optional.number(e.params.bufferSize).value) !== null && t !== void 0 ? t : n.binding.defaultBufferSize && n.binding.defaultBufferSize(k.params)) !== null && l !== void 0 ? l : 1, de = E.optional.number(e.params.interval).value, ve = new rr({
  9947. reader: Q,
  9948. target: e.target,
  9949. ticker: Mc(e.document, de),
  9950. value: cs(J)
  9951. }), Mn = E.optional.boolean(e.params.disabled).value, zi = E.optional.boolean(e.params.hidden).value, Ui = n.controller({
  9952. document: e.document,
  9953. params: k.params,
  9954. value: ve.value,
  9955. viewProps: Xe.create({
  9956. disabled: Mn,
  9957. hidden: zi
  9958. })
  9959. });
  9960. return new rt(e.document, {
  9961. binding: ve,
  9962. blade: ye(),
  9963. props: X.fromObject({
  9964. label: "label" in e.params ? (v = E.optional.string(e.params.label).value) !== null && v !== void 0 ? v : null : e.target.key
  9965. }),
  9966. valueController: Ui
  9967. });
  9968. }
  9969. class Ac {
  9970. constructor() {
  9971. this.pluginsMap_ = {
  9972. blades: [],
  9973. inputs: [],
  9974. monitors: []
  9975. };
  9976. }
  9977. getAll() {
  9978. return [
  9979. ...this.pluginsMap_.blades,
  9980. ...this.pluginsMap_.inputs,
  9981. ...this.pluginsMap_.monitors
  9982. ];
  9983. }
  9984. register(e) {
  9985. e.type === "blade" ? this.pluginsMap_.blades.unshift(e) : e.type === "input" ? this.pluginsMap_.inputs.unshift(e) : e.type === "monitor" && this.pluginsMap_.monitors.unshift(e);
  9986. }
  9987. createInput(e, t, l) {
  9988. const v = t.read();
  9989. if (_(v))
  9990. throw new S({
  9991. context: {
  9992. key: t.key
  9993. },
  9994. type: "nomatchingcontroller"
  9995. });
  9996. const E = this.pluginsMap_.inputs.reduce((k, B) => k ?? kc(B, {
  9997. document: e,
  9998. target: t,
  9999. params: l
  10000. }), null);
  10001. if (E)
  10002. return E;
  10003. throw new S({
  10004. context: {
  10005. key: t.key
  10006. },
  10007. type: "nomatchingcontroller"
  10008. });
  10009. }
  10010. createMonitor(e, t, l) {
  10011. const v = this.pluginsMap_.monitors.reduce((E, k) => E ?? Sc(k, {
  10012. document: e,
  10013. params: l,
  10014. target: t
  10015. }), null);
  10016. if (v)
  10017. return v;
  10018. throw new S({
  10019. context: {
  10020. key: t.key
  10021. },
  10022. type: "nomatchingcontroller"
  10023. });
  10024. }
  10025. createBlade(e, t) {
  10026. const l = this.pluginsMap_.blades.reduce((v, E) => v ?? sr(E, {
  10027. document: e,
  10028. params: t
  10029. }), null);
  10030. if (!l)
  10031. throw new S({
  10032. type: "nomatchingview",
  10033. context: {
  10034. params: t
  10035. }
  10036. });
  10037. return l;
  10038. }
  10039. createBladeApi(e) {
  10040. if (e instanceof Fe)
  10041. return new mi(e);
  10042. if (e instanceof rt)
  10043. return new fi(e);
  10044. if (e instanceof hn)
  10045. return new $n(e, this);
  10046. const t = this.pluginsMap_.blades.reduce((l, v) => l ?? v.api({
  10047. controller: e,
  10048. pool: this
  10049. }), null);
  10050. if (!t)
  10051. throw S.shouldNeverHappen();
  10052. return t;
  10053. }
  10054. }
  10055. function Lc() {
  10056. const n = new Ac();
  10057. return [
  10058. Nc,
  10059. pc,
  10060. fc,
  10061. bc,
  10062. nc,
  10063. Zl,
  10064. Ql,
  10065. $l,
  10066. ni,
  10067. wc,
  10068. Tc,
  10069. Pc,
  10070. W,
  10071. Js,
  10072. tr,
  10073. yi
  10074. ].forEach((e) => {
  10075. n.register(e);
  10076. }), n;
  10077. }
  10078. function Rc(n) {
  10079. return Wt.isObject(n) ? new Wt(n.x, n.y) : new Wt();
  10080. }
  10081. function Ic(n, e) {
  10082. n.writeProperty("x", e.x), n.writeProperty("y", e.y);
  10083. }
  10084. function Ft(n, e) {
  10085. if (!n)
  10086. return;
  10087. const t = [], l = Go(n, e);
  10088. l && t.push(l);
  10089. const v = Ho(n);
  10090. return v && t.push(v), new fn(t);
  10091. }
  10092. function Vc(n, e) {
  10093. return new Zt({
  10094. assembly: Ko,
  10095. components: [
  10096. Ft("x" in n ? n.x : void 0, e.x),
  10097. Ft("y" in n ? n.y : void 0, e.y)
  10098. ]
  10099. });
  10100. }
  10101. function Wo(n, e) {
  10102. const [t, l] = n ? ec(n) : [];
  10103. if (!_(t) || !_(l))
  10104. return Math.max(Math.abs(t ?? 0), Math.abs(l ?? 0));
  10105. const v = Dt(n);
  10106. return Math.max(Math.abs(v) * 10, Math.abs(e) * 10);
  10107. }
  10108. function Dc(n, e) {
  10109. const t = e instanceof Zt ? e.components[0] : void 0, l = e instanceof Zt ? e.components[1] : void 0, v = Wo(t, n.x), E = Wo(l, n.y);
  10110. return Math.max(v, E);
  10111. }
  10112. function Jo(n, e) {
  10113. return {
  10114. baseStep: Dt(e),
  10115. constraint: e,
  10116. textProps: X.fromObject({
  10117. draggingScale: Ot(e, n),
  10118. formatter: Re(ti(e, n))
  10119. })
  10120. };
  10121. }
  10122. function Oc(n) {
  10123. if (!("y" in n))
  10124. return false;
  10125. const e = n.y;
  10126. return e && "inverted" in e ? !!e.inverted : false;
  10127. }
  10128. const Nc = {
  10129. id: "input-point2d",
  10130. type: "input",
  10131. accept: (n, e) => {
  10132. if (!Wt.isObject(n))
  10133. return null;
  10134. const t = M, l = le(e, {
  10135. expanded: t.optional.boolean,
  10136. picker: t.optional.custom(Oi),
  10137. x: t.optional.custom(bt),
  10138. y: t.optional.object({
  10139. inverted: t.optional.boolean,
  10140. max: t.optional.number,
  10141. min: t.optional.number,
  10142. step: t.optional.number
  10143. })
  10144. });
  10145. return l ? {
  10146. initialValue: n,
  10147. params: l
  10148. } : null;
  10149. },
  10150. binding: {
  10151. reader: (n) => Rc,
  10152. constraint: (n) => Vc(n.params, n.initialValue),
  10153. equals: Wt.equals,
  10154. writer: (n) => Ic
  10155. },
  10156. controller: (n) => {
  10157. const e = n.document, t = n.value, l = n.constraint;
  10158. if (!(l instanceof Zt))
  10159. throw S.shouldNeverHappen();
  10160. const v = "expanded" in n.params ? n.params.expanded : void 0, E = "picker" in n.params ? n.params.picker : void 0;
  10161. return new oc(e, {
  10162. axes: [
  10163. Jo(t.rawValue.x, l.components[0]),
  10164. Jo(t.rawValue.y, l.components[1])
  10165. ],
  10166. expanded: v ?? false,
  10167. invertsY: Oc(n.params),
  10168. maxValue: Dc(t.rawValue, l),
  10169. parser: at,
  10170. pickerLayout: E ?? "popup",
  10171. value: t,
  10172. viewProps: n.viewProps
  10173. });
  10174. }
  10175. };
  10176. class ea extends a {
  10177. constructor(e) {
  10178. super(e), this.emitter_ = new F(), this.controller_.valueController.value.emitter.on("change", (t) => {
  10179. this.emitter_.emit("change", {
  10180. event: new u(this, t.rawValue)
  10181. });
  10182. });
  10183. }
  10184. get label() {
  10185. return this.controller_.props.get("label");
  10186. }
  10187. set label(e) {
  10188. this.controller_.props.set("label", e);
  10189. }
  10190. get options() {
  10191. return this.controller_.valueController.props.get("options");
  10192. }
  10193. set options(e) {
  10194. this.controller_.valueController.props.set("options", e);
  10195. }
  10196. get value() {
  10197. return this.controller_.valueController.value.rawValue;
  10198. }
  10199. set value(e) {
  10200. this.controller_.valueController.value.rawValue = e;
  10201. }
  10202. on(e, t) {
  10203. const l = t.bind(this);
  10204. return this.emitter_.on(e, (v) => {
  10205. l(v.event);
  10206. }), this;
  10207. }
  10208. }
  10209. class ta extends a {
  10210. constructor(e) {
  10211. super(e), this.emitter_ = new F(), this.controller_.valueController.value.emitter.on("change", (t) => {
  10212. this.emitter_.emit("change", {
  10213. event: new u(this, t.rawValue)
  10214. });
  10215. });
  10216. }
  10217. get label() {
  10218. return this.controller_.props.get("label");
  10219. }
  10220. set label(e) {
  10221. this.controller_.props.set("label", e);
  10222. }
  10223. get maxValue() {
  10224. return this.controller_.valueController.sliderController.props.get("maxValue");
  10225. }
  10226. set maxValue(e) {
  10227. this.controller_.valueController.sliderController.props.set("maxValue", e);
  10228. }
  10229. get minValue() {
  10230. return this.controller_.valueController.sliderController.props.get("minValue");
  10231. }
  10232. set minValue(e) {
  10233. this.controller_.valueController.sliderController.props.set("minValue", e);
  10234. }
  10235. get value() {
  10236. return this.controller_.valueController.value.rawValue;
  10237. }
  10238. set value(e) {
  10239. this.controller_.valueController.value.rawValue = e;
  10240. }
  10241. on(e, t) {
  10242. const l = t.bind(this);
  10243. return this.emitter_.on(e, (v) => {
  10244. l(v.event);
  10245. }), this;
  10246. }
  10247. }
  10248. class na extends a {
  10249. constructor(e) {
  10250. super(e), this.emitter_ = new F(), this.controller_.valueController.value.emitter.on("change", (t) => {
  10251. this.emitter_.emit("change", {
  10252. event: new u(this, t.rawValue)
  10253. });
  10254. });
  10255. }
  10256. get label() {
  10257. return this.controller_.props.get("label");
  10258. }
  10259. set label(e) {
  10260. this.controller_.props.set("label", e);
  10261. }
  10262. get formatter() {
  10263. return this.controller_.valueController.props.get("formatter");
  10264. }
  10265. set formatter(e) {
  10266. this.controller_.valueController.props.set("formatter", e);
  10267. }
  10268. get value() {
  10269. return this.controller_.valueController.value.rawValue;
  10270. }
  10271. set value(e) {
  10272. this.controller_.valueController.value.rawValue = e;
  10273. }
  10274. on(e, t) {
  10275. const l = t.bind(this);
  10276. return this.emitter_.on(e, (v) => {
  10277. l(v.event);
  10278. }), this;
  10279. }
  10280. }
  10281. const Fc = function() {
  10282. return {
  10283. id: "list",
  10284. type: "blade",
  10285. accept(n) {
  10286. const e = M, t = le(n, {
  10287. options: e.required.custom(En),
  10288. value: e.required.raw,
  10289. view: e.required.constant("list"),
  10290. label: e.optional.string
  10291. });
  10292. return t ? { params: t } : null;
  10293. },
  10294. controller(n) {
  10295. const e = new vn(Ps(n.params.options)), t = ee(n.params.value, {
  10296. constraint: e
  10297. }), l = new bn(n.document, {
  10298. props: new X({
  10299. options: e.values.value("options")
  10300. }),
  10301. value: t,
  10302. viewProps: n.viewProps
  10303. });
  10304. return new Gt(n.document, {
  10305. blade: n.blade,
  10306. props: X.fromObject({
  10307. label: n.params.label
  10308. }),
  10309. valueController: l
  10310. });
  10311. },
  10312. api(n) {
  10313. return !(n.controller instanceof Gt) || !(n.controller.valueController instanceof bn) ? null : new ea(n.controller);
  10314. }
  10315. };
  10316. }();
  10317. function Bc(n) {
  10318. return n.reduce((e, t) => Object.assign(e, {
  10319. [t.presetKey]: t.read()
  10320. }), {});
  10321. }
  10322. function jc(n, e) {
  10323. n.forEach((t) => {
  10324. const l = e[t.target.presetKey];
  10325. l !== void 0 && t.writer(t.target, t.reader(l));
  10326. });
  10327. }
  10328. class zc extends vi {
  10329. /**
  10330. * @hidden
  10331. */
  10332. constructor(e, t) {
  10333. super(e, t);
  10334. }
  10335. get element() {
  10336. return this.controller_.view.element;
  10337. }
  10338. /**
  10339. * Imports a preset of all inputs.
  10340. * @param preset The preset object to import.
  10341. */
  10342. importPreset(e) {
  10343. const t = this.controller_.rackController.rack.find(Fe).map((l) => l.binding);
  10344. jc(t, e), this.refresh();
  10345. }
  10346. /**
  10347. * Exports a preset of all inputs.
  10348. * @return An exported preset object.
  10349. */
  10350. exportPreset() {
  10351. const e = this.controller_.rackController.rack.find(Fe).map((t) => t.binding.target);
  10352. return Bc(e);
  10353. }
  10354. /**
  10355. * Refreshes all bindings of the pane.
  10356. */
  10357. refresh() {
  10358. this.controller_.rackController.rack.find(Fe).forEach((e) => {
  10359. e.binding.read();
  10360. }), this.controller_.rackController.rack.find(rt).forEach((e) => {
  10361. e.binding.read();
  10362. });
  10363. }
  10364. }
  10365. class Uc extends Xn {
  10366. constructor(e, t) {
  10367. super(e, {
  10368. expanded: t.expanded,
  10369. blade: t.blade,
  10370. props: t.props,
  10371. root: true,
  10372. viewProps: t.viewProps
  10373. });
  10374. }
  10375. }
  10376. const Gc = {
  10377. id: "slider",
  10378. type: "blade",
  10379. accept(n) {
  10380. const e = M, t = le(n, {
  10381. max: e.required.number,
  10382. min: e.required.number,
  10383. view: e.required.constant("slider"),
  10384. format: e.optional.function,
  10385. label: e.optional.string,
  10386. value: e.optional.number
  10387. });
  10388. return t ? { params: t } : null;
  10389. },
  10390. controller(n) {
  10391. var e, t;
  10392. const l = (e = n.params.value) !== null && e !== void 0 ? e : 0, v = new Xt({
  10393. max: n.params.max,
  10394. min: n.params.min
  10395. }), E = new ei(n.document, {
  10396. baseStep: 1,
  10397. parser: at,
  10398. sliderProps: new X({
  10399. maxValue: v.values.value("max"),
  10400. minValue: v.values.value("min")
  10401. }),
  10402. textProps: X.fromObject({
  10403. draggingScale: Ot(void 0, l),
  10404. formatter: (t = n.params.format) !== null && t !== void 0 ? t : Er
  10405. }),
  10406. value: ee(l, {
  10407. constraint: v
  10408. }),
  10409. viewProps: n.viewProps
  10410. });
  10411. return new Gt(n.document, {
  10412. blade: n.blade,
  10413. props: X.fromObject({
  10414. label: n.params.label
  10415. }),
  10416. valueController: E
  10417. });
  10418. },
  10419. api(n) {
  10420. return !(n.controller instanceof Gt) || !(n.controller.valueController instanceof ei) ? null : new ta(n.controller);
  10421. }
  10422. }, Hc = function() {
  10423. return {
  10424. id: "text",
  10425. type: "blade",
  10426. accept(n) {
  10427. const e = M, t = le(n, {
  10428. parse: e.required.function,
  10429. value: e.required.raw,
  10430. view: e.required.constant("text"),
  10431. format: e.optional.function,
  10432. label: e.optional.string
  10433. });
  10434. return t ? { params: t } : null;
  10435. },
  10436. controller(n) {
  10437. var e;
  10438. const t = new Zn(n.document, {
  10439. parser: n.params.parse,
  10440. props: X.fromObject({
  10441. formatter: (e = n.params.format) !== null && e !== void 0 ? e : (l) => String(l)
  10442. }),
  10443. value: ee(n.params.value),
  10444. viewProps: n.viewProps
  10445. });
  10446. return new Gt(n.document, {
  10447. blade: n.blade,
  10448. props: X.fromObject({
  10449. label: n.params.label
  10450. }),
  10451. valueController: t
  10452. });
  10453. },
  10454. api(n) {
  10455. return !(n.controller instanceof Gt) || !(n.controller.valueController instanceof Zn) ? null : new na(n.controller);
  10456. }
  10457. };
  10458. }();
  10459. function Kc(n) {
  10460. const e = n.createElement("div");
  10461. return e.classList.add(D("dfw")()), n.body && n.body.appendChild(e), e;
  10462. }
  10463. function ia(n, e, t) {
  10464. if (n.querySelector(`style[data-tp-style=${e}]`))
  10465. return;
  10466. const l = n.createElement("style");
  10467. l.dataset.tpStyle = e, l.textContent = t, n.head.appendChild(l);
  10468. }
  10469. class $c extends zc {
  10470. constructor(e) {
  10471. var t, l;
  10472. const v = e ?? {}, E = (t = v.document) !== null && t !== void 0 ? t : hi(), k = Lc(), B = new Uc(E, {
  10473. expanded: v.expanded,
  10474. blade: ye(),
  10475. props: X.fromObject({
  10476. title: v.title
  10477. }),
  10478. viewProps: Xe.create()
  10479. });
  10480. super(B, k), this.pool_ = k, this.containerElem_ = (l = v.container) !== null && l !== void 0 ? l : Kc(E), this.containerElem_.appendChild(this.element), this.doc_ = E, this.usesDefaultWrapper_ = !v.container, this.setUpDefaultPlugins_();
  10481. }
  10482. get document() {
  10483. if (!this.doc_)
  10484. throw S.alreadyDisposed();
  10485. return this.doc_;
  10486. }
  10487. dispose() {
  10488. const e = this.containerElem_;
  10489. if (!e)
  10490. throw S.alreadyDisposed();
  10491. if (this.usesDefaultWrapper_) {
  10492. const t = e.parentElement;
  10493. t && t.removeChild(e);
  10494. }
  10495. this.containerElem_ = null, this.doc_ = null, super.dispose();
  10496. }
  10497. registerPlugin(e) {
  10498. ("plugin" in e ? [e.plugin] : "plugins" in e ? e.plugins : []).forEach((l) => {
  10499. this.pool_.register(l), this.embedPluginStyle_(l);
  10500. });
  10501. }
  10502. embedPluginStyle_(e) {
  10503. e.css && ia(this.document, `plugin-${e.id}`, e.css);
  10504. }
  10505. setUpDefaultPlugins_() {
  10506. ia(this.document, "default", '.tp-tbiv_b,.tp-coltxtv_ms,.tp-ckbv_i,.tp-rotv_b,.tp-fldv_b,.tp-mllv_i,.tp-sglv_i,.tp-grlv_g,.tp-txtv_i,.tp-p2dpv_p,.tp-colswv_sw,.tp-p2dv_b,.tp-btnv_b,.tp-lstv_s{-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:rgba(0,0,0,0);border-width:0;font-family:inherit;font-size:inherit;font-weight:inherit;margin:0;outline:none;padding:0}.tp-p2dv_b,.tp-btnv_b,.tp-lstv_s{background-color:var(--btn-bg);border-radius:var(--elm-br);color:var(--btn-fg);cursor:pointer;display:block;font-weight:bold;height:var(--bld-us);line-height:var(--bld-us);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.tp-p2dv_b:hover,.tp-btnv_b:hover,.tp-lstv_s:hover{background-color:var(--btn-bg-h)}.tp-p2dv_b:focus,.tp-btnv_b:focus,.tp-lstv_s:focus{background-color:var(--btn-bg-f)}.tp-p2dv_b:active,.tp-btnv_b:active,.tp-lstv_s:active{background-color:var(--btn-bg-a)}.tp-p2dv_b:disabled,.tp-btnv_b:disabled,.tp-lstv_s:disabled{opacity:.5}.tp-txtv_i,.tp-p2dpv_p,.tp-colswv_sw{background-color:var(--in-bg);border-radius:var(--elm-br);box-sizing:border-box;color:var(--in-fg);font-family:inherit;height:var(--bld-us);line-height:var(--bld-us);min-width:0;width:100%}.tp-txtv_i:hover,.tp-p2dpv_p:hover,.tp-colswv_sw:hover{background-color:var(--in-bg-h)}.tp-txtv_i:focus,.tp-p2dpv_p:focus,.tp-colswv_sw:focus{background-color:var(--in-bg-f)}.tp-txtv_i:active,.tp-p2dpv_p:active,.tp-colswv_sw:active{background-color:var(--in-bg-a)}.tp-txtv_i:disabled,.tp-p2dpv_p:disabled,.tp-colswv_sw:disabled{opacity:.5}.tp-mllv_i,.tp-sglv_i,.tp-grlv_g{background-color:var(--mo-bg);border-radius:var(--elm-br);box-sizing:border-box;color:var(--mo-fg);height:var(--bld-us);scrollbar-color:currentColor rgba(0,0,0,0);scrollbar-width:thin;width:100%}.tp-mllv_i::-webkit-scrollbar,.tp-sglv_i::-webkit-scrollbar,.tp-grlv_g::-webkit-scrollbar{height:8px;width:8px}.tp-mllv_i::-webkit-scrollbar-corner,.tp-sglv_i::-webkit-scrollbar-corner,.tp-grlv_g::-webkit-scrollbar-corner{background-color:rgba(0,0,0,0)}.tp-mllv_i::-webkit-scrollbar-thumb,.tp-sglv_i::-webkit-scrollbar-thumb,.tp-grlv_g::-webkit-scrollbar-thumb{background-clip:padding-box;background-color:currentColor;border:rgba(0,0,0,0) solid 2px;border-radius:4px}.tp-rotv{--font-family: var(--tp-font-family, Roboto Mono, Source Code Pro, Menlo, Courier, monospace);--bs-br: var(--tp-base-border-radius, 6px);--cnt-h-p: var(--tp-container-horizontal-padding, 4px);--cnt-v-p: var(--tp-container-vertical-padding, 4px);--elm-br: var(--tp-element-border-radius, 2px);--bld-s: var(--tp-blade-spacing, 4px);--bld-us: var(--tp-blade-unit-size, 20px);--bs-bg: var(--tp-base-background-color, hsl(230, 7%, 17%));--bs-sh: var(--tp-base-shadow-color, rgba(0, 0, 0, 0.2));--btn-bg: var(--tp-button-background-color, hsl(230, 7%, 70%));--btn-bg-a: var(--tp-button-background-color-active, #d6d7db);--btn-bg-f: var(--tp-button-background-color-focus, #c8cad0);--btn-bg-h: var(--tp-button-background-color-hover, #bbbcc4);--btn-fg: var(--tp-button-foreground-color, hsl(230, 7%, 17%));--cnt-bg: var(--tp-container-background-color, rgba(187, 188, 196, 0.1));--cnt-bg-a: var(--tp-container-background-color-active, rgba(187, 188, 196, 0.25));--cnt-bg-f: var(--tp-container-background-color-focus, rgba(187, 188, 196, 0.2));--cnt-bg-h: var(--tp-container-background-color-hover, rgba(187, 188, 196, 0.15));--cnt-fg: var(--tp-container-foreground-color, hsl(230, 7%, 75%));--in-bg: var(--tp-input-background-color, rgba(187, 188, 196, 0.1));--in-bg-a: var(--tp-input-background-color-active, rgba(187, 188, 196, 0.25));--in-bg-f: var(--tp-input-background-color-focus, rgba(187, 188, 196, 0.2));--in-bg-h: var(--tp-input-background-color-hover, rgba(187, 188, 196, 0.15));--in-fg: var(--tp-input-foreground-color, hsl(230, 7%, 75%));--lbl-fg: var(--tp-label-foreground-color, rgba(187, 188, 196, 0.7));--mo-bg: var(--tp-monitor-background-color, rgba(0, 0, 0, 0.2));--mo-fg: var(--tp-monitor-foreground-color, rgba(187, 188, 196, 0.7));--grv-fg: var(--tp-groove-foreground-color, rgba(187, 188, 196, 0.1))}.tp-rotv_c>.tp-cntv.tp-v-lst,.tp-tabv_c .tp-brkv>.tp-cntv.tp-v-lst,.tp-fldv_c>.tp-cntv.tp-v-lst{margin-bottom:calc(-1*var(--cnt-v-p))}.tp-rotv_c>.tp-fldv.tp-v-lst .tp-fldv_c,.tp-tabv_c .tp-brkv>.tp-fldv.tp-v-lst .tp-fldv_c,.tp-fldv_c>.tp-fldv.tp-v-lst .tp-fldv_c{border-bottom-left-radius:0}.tp-rotv_c>.tp-fldv.tp-v-lst .tp-fldv_b,.tp-tabv_c .tp-brkv>.tp-fldv.tp-v-lst .tp-fldv_b,.tp-fldv_c>.tp-fldv.tp-v-lst .tp-fldv_b{border-bottom-left-radius:0}.tp-rotv_c>*:not(.tp-v-fst),.tp-tabv_c .tp-brkv>*:not(.tp-v-fst),.tp-fldv_c>*:not(.tp-v-fst){margin-top:var(--bld-s)}.tp-rotv_c>.tp-sprv:not(.tp-v-fst),.tp-tabv_c .tp-brkv>.tp-sprv:not(.tp-v-fst),.tp-fldv_c>.tp-sprv:not(.tp-v-fst),.tp-rotv_c>.tp-cntv:not(.tp-v-fst),.tp-tabv_c .tp-brkv>.tp-cntv:not(.tp-v-fst),.tp-fldv_c>.tp-cntv:not(.tp-v-fst){margin-top:var(--cnt-v-p)}.tp-rotv_c>.tp-sprv+*:not(.tp-v-hidden),.tp-tabv_c .tp-brkv>.tp-sprv+*:not(.tp-v-hidden),.tp-fldv_c>.tp-sprv+*:not(.tp-v-hidden),.tp-rotv_c>.tp-cntv+*:not(.tp-v-hidden),.tp-tabv_c .tp-brkv>.tp-cntv+*:not(.tp-v-hidden),.tp-fldv_c>.tp-cntv+*:not(.tp-v-hidden){margin-top:var(--cnt-v-p)}.tp-rotv_c>.tp-sprv:not(.tp-v-hidden)+.tp-sprv,.tp-tabv_c .tp-brkv>.tp-sprv:not(.tp-v-hidden)+.tp-sprv,.tp-fldv_c>.tp-sprv:not(.tp-v-hidden)+.tp-sprv,.tp-rotv_c>.tp-cntv:not(.tp-v-hidden)+.tp-cntv,.tp-tabv_c .tp-brkv>.tp-cntv:not(.tp-v-hidden)+.tp-cntv,.tp-fldv_c>.tp-cntv:not(.tp-v-hidden)+.tp-cntv{margin-top:0}.tp-tabv_c .tp-brkv>.tp-cntv,.tp-fldv_c>.tp-cntv{margin-left:4px}.tp-tabv_c .tp-brkv>.tp-fldv>.tp-fldv_b,.tp-fldv_c>.tp-fldv>.tp-fldv_b{border-top-left-radius:var(--elm-br);border-bottom-left-radius:var(--elm-br)}.tp-tabv_c .tp-brkv>.tp-fldv.tp-fldv-expanded>.tp-fldv_b,.tp-fldv_c>.tp-fldv.tp-fldv-expanded>.tp-fldv_b{border-bottom-left-radius:0}.tp-tabv_c .tp-brkv .tp-fldv>.tp-fldv_c,.tp-fldv_c .tp-fldv>.tp-fldv_c{border-bottom-left-radius:var(--elm-br)}.tp-tabv_c .tp-brkv>.tp-cntv+.tp-fldv>.tp-fldv_b,.tp-fldv_c>.tp-cntv+.tp-fldv>.tp-fldv_b{border-top-left-radius:0}.tp-tabv_c .tp-brkv>.tp-cntv+.tp-tabv>.tp-tabv_t,.tp-fldv_c>.tp-cntv+.tp-tabv>.tp-tabv_t{border-top-left-radius:0}.tp-tabv_c .tp-brkv>.tp-tabv>.tp-tabv_t,.tp-fldv_c>.tp-tabv>.tp-tabv_t{border-top-left-radius:var(--elm-br)}.tp-tabv_c .tp-brkv .tp-tabv>.tp-tabv_c,.tp-fldv_c .tp-tabv>.tp-tabv_c{border-bottom-left-radius:var(--elm-br)}.tp-rotv_b,.tp-fldv_b{background-color:var(--cnt-bg);color:var(--cnt-fg);cursor:pointer;display:block;height:calc(var(--bld-us) + 4px);line-height:calc(var(--bld-us) + 4px);overflow:hidden;padding-left:var(--cnt-h-p);padding-right:calc(4px + var(--bld-us) + var(--cnt-h-p));position:relative;text-align:left;text-overflow:ellipsis;white-space:nowrap;width:100%;transition:border-radius .2s ease-in-out .2s}.tp-rotv_b:hover,.tp-fldv_b:hover{background-color:var(--cnt-bg-h)}.tp-rotv_b:focus,.tp-fldv_b:focus{background-color:var(--cnt-bg-f)}.tp-rotv_b:active,.tp-fldv_b:active{background-color:var(--cnt-bg-a)}.tp-rotv_b:disabled,.tp-fldv_b:disabled{opacity:.5}.tp-rotv_m,.tp-fldv_m{background:linear-gradient(to left, var(--cnt-fg), var(--cnt-fg) 2px, transparent 2px, transparent 4px, var(--cnt-fg) 4px);border-radius:2px;bottom:0;content:"";display:block;height:6px;right:calc(var(--cnt-h-p) + (var(--bld-us) + 4px - 6px)/2 - 2px);margin:auto;opacity:.5;position:absolute;top:0;transform:rotate(90deg);transition:transform .2s ease-in-out;width:6px}.tp-rotv.tp-rotv-expanded .tp-rotv_m,.tp-fldv.tp-fldv-expanded>.tp-fldv_b>.tp-fldv_m{transform:none}.tp-rotv_c,.tp-fldv_c{box-sizing:border-box;height:0;opacity:0;overflow:hidden;padding-bottom:0;padding-top:0;position:relative;transition:height .2s ease-in-out,opacity .2s linear,padding .2s ease-in-out}.tp-rotv.tp-rotv-cpl:not(.tp-rotv-expanded) .tp-rotv_c,.tp-fldv.tp-fldv-cpl:not(.tp-fldv-expanded)>.tp-fldv_c{display:none}.tp-rotv.tp-rotv-expanded .tp-rotv_c,.tp-fldv.tp-fldv-expanded>.tp-fldv_c{opacity:1;padding-bottom:var(--cnt-v-p);padding-top:var(--cnt-v-p);transform:none;overflow:visible;transition:height .2s ease-in-out,opacity .2s linear .2s,padding .2s ease-in-out}.tp-lstv,.tp-coltxtv_m{position:relative}.tp-lstv_s{padding:0 20px 0 4px;width:100%}.tp-lstv_m,.tp-coltxtv_mm{bottom:0;margin:auto;pointer-events:none;position:absolute;right:2px;top:0}.tp-lstv_m svg,.tp-coltxtv_mm svg{bottom:0;height:16px;margin:auto;position:absolute;right:0;top:0;width:16px}.tp-lstv_m svg path,.tp-coltxtv_mm svg path{fill:currentColor}.tp-pndtxtv,.tp-coltxtv_w{display:flex}.tp-pndtxtv_a,.tp-coltxtv_c{width:100%}.tp-pndtxtv_a+.tp-pndtxtv_a,.tp-coltxtv_c+.tp-pndtxtv_a,.tp-pndtxtv_a+.tp-coltxtv_c,.tp-coltxtv_c+.tp-coltxtv_c{margin-left:2px}.tp-btnv_b{width:100%}.tp-btnv_t{text-align:center}.tp-ckbv_l{display:block;position:relative}.tp-ckbv_i{left:0;opacity:0;position:absolute;top:0}.tp-ckbv_w{background-color:var(--in-bg);border-radius:var(--elm-br);cursor:pointer;display:block;height:var(--bld-us);position:relative;width:var(--bld-us)}.tp-ckbv_w svg{bottom:0;display:block;height:16px;left:0;margin:auto;opacity:0;position:absolute;right:0;top:0;width:16px}.tp-ckbv_w svg path{fill:none;stroke:var(--in-fg);stroke-width:2}.tp-ckbv_i:hover+.tp-ckbv_w{background-color:var(--in-bg-h)}.tp-ckbv_i:focus+.tp-ckbv_w{background-color:var(--in-bg-f)}.tp-ckbv_i:active+.tp-ckbv_w{background-color:var(--in-bg-a)}.tp-ckbv_i:checked+.tp-ckbv_w svg{opacity:1}.tp-ckbv.tp-v-disabled .tp-ckbv_w{opacity:.5}.tp-colv{position:relative}.tp-colv_h{display:flex}.tp-colv_s{flex-grow:0;flex-shrink:0;width:var(--bld-us)}.tp-colv_t{flex:1;margin-left:4px}.tp-colv_p{height:0;margin-top:0;opacity:0;overflow:hidden;transition:height .2s ease-in-out,opacity .2s linear,margin .2s ease-in-out}.tp-colv.tp-colv-cpl .tp-colv_p{overflow:visible}.tp-colv.tp-colv-expanded .tp-colv_p{margin-top:var(--bld-s);opacity:1}.tp-colv .tp-popv{left:calc(-1*var(--cnt-h-p));right:calc(-1*var(--cnt-h-p));top:var(--bld-us)}.tp-colpv_h,.tp-colpv_ap{margin-left:6px;margin-right:6px}.tp-colpv_h{margin-top:var(--bld-s)}.tp-colpv_rgb{display:flex;margin-top:var(--bld-s);width:100%}.tp-colpv_a{display:flex;margin-top:var(--cnt-v-p);padding-top:calc(var(--cnt-v-p) + 2px);position:relative}.tp-colpv_a::before{background-color:var(--grv-fg);content:"";height:2px;left:calc(-1*var(--cnt-h-p));position:absolute;right:calc(-1*var(--cnt-h-p));top:0}.tp-colpv.tp-v-disabled .tp-colpv_a::before{opacity:.5}.tp-colpv_ap{align-items:center;display:flex;flex:3}.tp-colpv_at{flex:1;margin-left:4px}.tp-svpv{border-radius:var(--elm-br);outline:none;overflow:hidden;position:relative}.tp-svpv.tp-v-disabled{opacity:.5}.tp-svpv_c{cursor:crosshair;display:block;height:calc(var(--bld-us)*4);width:100%}.tp-svpv_m{border-radius:100%;border:rgba(255,255,255,.75) solid 2px;box-sizing:border-box;filter:drop-shadow(0 0 1px rgba(0, 0, 0, 0.3));height:12px;margin-left:-6px;margin-top:-6px;pointer-events:none;position:absolute;width:12px}.tp-svpv:focus .tp-svpv_m{border-color:#fff}.tp-hplv{cursor:pointer;height:var(--bld-us);outline:none;position:relative}.tp-hplv.tp-v-disabled{opacity:.5}.tp-hplv_c{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAAABCAYAAABubagXAAAAQ0lEQVQoU2P8z8Dwn0GCgQEDi2OK/RBgYHjBgIpfovFh8j8YBIgzFGQxuqEgPhaDOT5gOhPkdCxOZeBg+IDFZZiGAgCaSSMYtcRHLgAAAABJRU5ErkJggg==);background-position:left top;background-repeat:no-repeat;background-size:100% 100%;border-radius:2px;display:block;height:4px;left:0;margin-top:-2px;position:absolute;top:50%;width:100%}.tp-hplv_m{border-radius:var(--elm-br);border:rgba(255,255,255,.75) solid 2px;box-shadow:0 0 2px rgba(0,0,0,.1);box-sizing:border-box;height:12px;left:50%;margin-left:-6px;margin-top:-6px;pointer-events:none;position:absolute;top:50%;width:12px}.tp-hplv:focus .tp-hplv_m{border-color:#fff}.tp-aplv{cursor:pointer;height:var(--bld-us);outline:none;position:relative;width:100%}.tp-aplv.tp-v-disabled{opacity:.5}.tp-aplv_b{background-color:#fff;background-image:linear-gradient(to top right, #ddd 25%, transparent 25%, transparent 75%, #ddd 75%),linear-gradient(to top right, #ddd 25%, transparent 25%, transparent 75%, #ddd 75%);background-size:4px 4px;background-position:0 0,2px 2px;border-radius:2px;display:block;height:4px;left:0;margin-top:-2px;overflow:hidden;position:absolute;top:50%;width:100%}.tp-aplv_c{bottom:0;left:0;position:absolute;right:0;top:0}.tp-aplv_m{background-color:#fff;background-image:linear-gradient(to top right, #ddd 25%, transparent 25%, transparent 75%, #ddd 75%),linear-gradient(to top right, #ddd 25%, transparent 25%, transparent 75%, #ddd 75%);background-size:12px 12px;background-position:0 0,6px 6px;border-radius:var(--elm-br);box-shadow:0 0 2px rgba(0,0,0,.1);height:12px;left:50%;margin-left:-6px;margin-top:-6px;overflow:hidden;pointer-events:none;position:absolute;top:50%;width:12px}.tp-aplv_p{border-radius:var(--elm-br);border:rgba(255,255,255,.75) solid 2px;box-sizing:border-box;bottom:0;left:0;position:absolute;right:0;top:0}.tp-aplv:focus .tp-aplv_p{border-color:#fff}.tp-colswv{background-color:#fff;background-image:linear-gradient(to top right, #ddd 25%, transparent 25%, transparent 75%, #ddd 75%),linear-gradient(to top right, #ddd 25%, transparent 25%, transparent 75%, #ddd 75%);background-size:10px 10px;background-position:0 0,5px 5px;border-radius:var(--elm-br);overflow:hidden}.tp-colswv.tp-v-disabled{opacity:.5}.tp-colswv_sw{border-radius:0}.tp-colswv_b{-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:rgba(0,0,0,0);border-width:0;cursor:pointer;display:block;height:var(--bld-us);left:0;margin:0;outline:none;padding:0;position:absolute;top:0;width:var(--bld-us)}.tp-colswv_b:focus::after{border:rgba(255,255,255,.75) solid 2px;border-radius:var(--elm-br);bottom:0;content:"";display:block;left:0;position:absolute;right:0;top:0}.tp-coltxtv{display:flex;width:100%}.tp-coltxtv_m{margin-right:4px}.tp-coltxtv_ms{border-radius:var(--elm-br);color:var(--lbl-fg);cursor:pointer;height:var(--bld-us);line-height:var(--bld-us);padding:0 18px 0 4px}.tp-coltxtv_ms:hover{background-color:var(--in-bg-h)}.tp-coltxtv_ms:focus{background-color:var(--in-bg-f)}.tp-coltxtv_ms:active{background-color:var(--in-bg-a)}.tp-coltxtv_mm{color:var(--lbl-fg)}.tp-coltxtv.tp-v-disabled .tp-coltxtv_mm{opacity:.5}.tp-coltxtv_w{flex:1}.tp-dfwv{position:absolute;top:8px;right:8px;width:256px}.tp-fldv{position:relative}.tp-fldv.tp-fldv-not .tp-fldv_b{display:none}.tp-fldv_t{padding-left:4px}.tp-fldv_b:disabled .tp-fldv_m{display:none}.tp-fldv_c{padding-left:4px}.tp-fldv_i{bottom:0;color:var(--cnt-bg);left:0;overflow:hidden;position:absolute;top:calc(var(--bld-us) + 4px);width:var(--bs-br)}.tp-fldv_i::before{background-color:currentColor;bottom:0;content:"";left:0;position:absolute;top:0;width:4px}.tp-fldv_b:hover+.tp-fldv_i{color:var(--cnt-bg-h)}.tp-fldv_b:focus+.tp-fldv_i{color:var(--cnt-bg-f)}.tp-fldv_b:active+.tp-fldv_i{color:var(--cnt-bg-a)}.tp-fldv.tp-v-disabled>.tp-fldv_i{opacity:.5}.tp-grlv{position:relative}.tp-grlv_g{display:block;height:calc(var(--bld-us)*3)}.tp-grlv_g polyline{fill:none;stroke:var(--mo-fg);stroke-linejoin:round}.tp-grlv_t{margin-top:-4px;transition:left .05s,top .05s;visibility:hidden}.tp-grlv_t.tp-grlv_t-a{visibility:visible}.tp-grlv_t.tp-grlv_t-in{transition:none}.tp-grlv.tp-v-disabled .tp-grlv_g{opacity:.5}.tp-grlv .tp-ttv{background-color:var(--mo-fg)}.tp-grlv .tp-ttv::before{border-top-color:var(--mo-fg)}.tp-lblv{align-items:center;display:flex;line-height:1.3;padding-left:var(--cnt-h-p);padding-right:var(--cnt-h-p)}.tp-lblv.tp-lblv-nol{display:block}.tp-lblv_l{color:var(--lbl-fg);flex:1;-webkit-hyphens:auto;hyphens:auto;overflow:hidden;padding-left:4px;padding-right:16px}.tp-lblv.tp-v-disabled .tp-lblv_l{opacity:.5}.tp-lblv.tp-lblv-nol .tp-lblv_l{display:none}.tp-lblv_v{align-self:flex-start;flex-grow:0;flex-shrink:0;width:160px}.tp-lblv.tp-lblv-nol .tp-lblv_v{width:100%}.tp-lstv_s{padding:0 20px 0 4px;width:100%}.tp-lstv_m{color:var(--btn-fg)}.tp-sglv_i{padding:0 4px}.tp-sglv.tp-v-disabled .tp-sglv_i{opacity:.5}.tp-mllv_i{display:block;height:calc(var(--bld-us)*3);line-height:var(--bld-us);padding:0 4px;resize:none;white-space:pre}.tp-mllv.tp-v-disabled .tp-mllv_i{opacity:.5}.tp-p2dv{position:relative}.tp-p2dv_h{display:flex}.tp-p2dv_b{height:var(--bld-us);margin-right:4px;position:relative;width:var(--bld-us)}.tp-p2dv_b svg{display:block;height:16px;left:50%;margin-left:-8px;margin-top:-8px;position:absolute;top:50%;width:16px}.tp-p2dv_b svg path{stroke:currentColor;stroke-width:2}.tp-p2dv_b svg circle{fill:currentColor}.tp-p2dv_t{flex:1}.tp-p2dv_p{height:0;margin-top:0;opacity:0;overflow:hidden;transition:height .2s ease-in-out,opacity .2s linear,margin .2s ease-in-out}.tp-p2dv.tp-p2dv-expanded .tp-p2dv_p{margin-top:var(--bld-s);opacity:1}.tp-p2dv .tp-popv{left:calc(-1*var(--cnt-h-p));right:calc(-1*var(--cnt-h-p));top:var(--bld-us)}.tp-p2dpv{padding-left:calc(var(--bld-us) + 4px)}.tp-p2dpv_p{cursor:crosshair;height:0;overflow:hidden;padding-bottom:100%;position:relative}.tp-p2dpv.tp-v-disabled .tp-p2dpv_p{opacity:.5}.tp-p2dpv_g{display:block;height:100%;left:0;pointer-events:none;position:absolute;top:0;width:100%}.tp-p2dpv_ax{opacity:.1;stroke:var(--in-fg);stroke-dasharray:1}.tp-p2dpv_l{opacity:.5;stroke:var(--in-fg);stroke-dasharray:1}.tp-p2dpv_m{border:var(--in-fg) solid 1px;border-radius:50%;box-sizing:border-box;height:4px;margin-left:-2px;margin-top:-2px;position:absolute;width:4px}.tp-p2dpv_p:focus .tp-p2dpv_m{background-color:var(--in-fg);border-width:0}.tp-popv{background-color:var(--bs-bg);border-radius:6px;box-shadow:0 2px 4px var(--bs-sh);display:none;max-width:168px;padding:var(--cnt-v-p) var(--cnt-h-p);position:absolute;visibility:hidden;z-index:1000}.tp-popv.tp-popv-v{display:block;visibility:visible}.tp-sprv_r{background-color:var(--grv-fg);border-width:0;display:block;height:2px;margin:0;width:100%}.tp-sprv.tp-v-disabled .tp-sprv_r{opacity:.5}.tp-sldv.tp-v-disabled{opacity:.5}.tp-sldv_t{box-sizing:border-box;cursor:pointer;height:var(--bld-us);margin:0 6px;outline:none;position:relative}.tp-sldv_t::before{background-color:var(--in-bg);border-radius:1px;bottom:0;content:"";display:block;height:2px;left:0;margin:auto;position:absolute;right:0;top:0}.tp-sldv_k{height:100%;left:0;position:absolute;top:0}.tp-sldv_k::before{background-color:var(--in-fg);border-radius:1px;bottom:0;content:"";display:block;height:2px;left:0;margin-bottom:auto;margin-top:auto;position:absolute;right:0;top:0}.tp-sldv_k::after{background-color:var(--btn-bg);border-radius:var(--elm-br);bottom:0;content:"";display:block;height:12px;margin-bottom:auto;margin-top:auto;position:absolute;right:-6px;top:0;width:12px}.tp-sldv_t:hover .tp-sldv_k::after{background-color:var(--btn-bg-h)}.tp-sldv_t:focus .tp-sldv_k::after{background-color:var(--btn-bg-f)}.tp-sldv_t:active .tp-sldv_k::after{background-color:var(--btn-bg-a)}.tp-sldtxtv{display:flex}.tp-sldtxtv_s{flex:2}.tp-sldtxtv_t{flex:1;margin-left:4px}.tp-tabv{position:relative}.tp-tabv_t{align-items:flex-end;color:var(--cnt-bg);display:flex;overflow:hidden;position:relative}.tp-tabv_t:hover{color:var(--cnt-bg-h)}.tp-tabv_t:has(*:focus){color:var(--cnt-bg-f)}.tp-tabv_t:has(*:active){color:var(--cnt-bg-a)}.tp-tabv_t::before{background-color:currentColor;bottom:0;content:"";height:2px;left:0;pointer-events:none;position:absolute;right:0}.tp-tabv.tp-v-disabled .tp-tabv_t::before{opacity:.5}.tp-tabv.tp-tabv-nop .tp-tabv_t{height:calc(var(--bld-us) + 4px);position:relative}.tp-tabv.tp-tabv-nop .tp-tabv_t::before{background-color:var(--cnt-bg);bottom:0;content:"";height:2px;left:0;position:absolute;right:0}.tp-tabv_c{padding-bottom:var(--cnt-v-p);padding-left:4px;padding-top:var(--cnt-v-p)}.tp-tabv_i{bottom:0;color:var(--cnt-bg);left:0;overflow:hidden;position:absolute;top:calc(var(--bld-us) + 4px);width:var(--bs-br)}.tp-tabv_i::before{background-color:currentColor;bottom:0;content:"";left:0;position:absolute;top:0;width:4px}.tp-tabv_t:hover+.tp-tabv_i{color:var(--cnt-bg-h)}.tp-tabv_t:has(*:focus)+.tp-tabv_i{color:var(--cnt-bg-f)}.tp-tabv_t:has(*:active)+.tp-tabv_i{color:var(--cnt-bg-a)}.tp-tabv.tp-v-disabled>.tp-tabv_i{opacity:.5}.tp-tbiv{flex:1;min-width:0;position:relative}.tp-tbiv+.tp-tbiv{margin-left:2px}.tp-tbiv+.tp-tbiv.tp-v-disabled::before{opacity:.5}.tp-tbiv_b{display:block;padding-left:calc(var(--cnt-h-p) + 4px);padding-right:calc(var(--cnt-h-p) + 4px);position:relative;width:100%}.tp-tbiv_b:disabled{opacity:.5}.tp-tbiv_b::before{background-color:var(--cnt-bg);bottom:2px;content:"";left:0;pointer-events:none;position:absolute;right:0;top:0}.tp-tbiv_b:hover::before{background-color:var(--cnt-bg-h)}.tp-tbiv_b:focus::before{background-color:var(--cnt-bg-f)}.tp-tbiv_b:active::before{background-color:var(--cnt-bg-a)}.tp-tbiv_t{color:var(--cnt-fg);height:calc(var(--bld-us) + 4px);line-height:calc(var(--bld-us) + 4px);opacity:.5;overflow:hidden;text-overflow:ellipsis}.tp-tbiv.tp-tbiv-sel .tp-tbiv_t{opacity:1}.tp-txtv{position:relative}.tp-txtv_i{padding:0 4px}.tp-txtv.tp-txtv-fst .tp-txtv_i{border-bottom-right-radius:0;border-top-right-radius:0}.tp-txtv.tp-txtv-mid .tp-txtv_i{border-radius:0}.tp-txtv.tp-txtv-lst .tp-txtv_i{border-bottom-left-radius:0;border-top-left-radius:0}.tp-txtv.tp-txtv-num .tp-txtv_i{text-align:right}.tp-txtv.tp-txtv-drg .tp-txtv_i{opacity:.3}.tp-txtv_k{cursor:pointer;height:100%;left:-3px;position:absolute;top:0;width:12px}.tp-txtv_k::before{background-color:var(--in-fg);border-radius:1px;bottom:0;content:"";height:calc(var(--bld-us) - 4px);left:50%;margin-bottom:auto;margin-left:-1px;margin-top:auto;opacity:.1;position:absolute;top:0;transition:border-radius .1s,height .1s,transform .1s,width .1s;width:2px}.tp-txtv_k:hover::before,.tp-txtv.tp-txtv-drg .tp-txtv_k::before{opacity:1}.tp-txtv.tp-txtv-drg .tp-txtv_k::before{border-radius:50%;height:4px;transform:translateX(-1px);width:4px}.tp-txtv_g{bottom:0;display:block;height:8px;left:50%;margin:auto;overflow:visible;pointer-events:none;position:absolute;top:0;visibility:hidden;width:100%}.tp-txtv.tp-txtv-drg .tp-txtv_g{visibility:visible}.tp-txtv_gb{fill:none;stroke:var(--in-fg);stroke-dasharray:1}.tp-txtv_gh{fill:none;stroke:var(--in-fg)}.tp-txtv .tp-ttv{margin-left:6px;visibility:hidden}.tp-txtv.tp-txtv-drg .tp-ttv{visibility:visible}.tp-ttv{background-color:var(--in-fg);border-radius:var(--elm-br);color:var(--bs-bg);padding:2px 4px;pointer-events:none;position:absolute;transform:translate(-50%, -100%)}.tp-ttv::before{border-color:var(--in-fg) rgba(0,0,0,0) rgba(0,0,0,0) rgba(0,0,0,0);border-style:solid;border-width:2px;box-sizing:border-box;content:"";font-size:.9em;height:4px;left:50%;margin-left:-2px;position:absolute;top:100%;width:4px}.tp-rotv{background-color:var(--bs-bg);border-radius:var(--bs-br);box-shadow:0 2px 4px var(--bs-sh);font-family:var(--font-family);font-size:11px;font-weight:500;line-height:1;text-align:left}.tp-rotv_b{border-bottom-left-radius:var(--bs-br);border-bottom-right-radius:var(--bs-br);border-top-left-radius:var(--bs-br);border-top-right-radius:var(--bs-br);padding-left:calc(4px + var(--bld-us) + var(--cnt-h-p));text-align:center}.tp-rotv.tp-rotv-expanded .tp-rotv_b{border-bottom-left-radius:0;border-bottom-right-radius:0}.tp-rotv.tp-rotv-not .tp-rotv_b{display:none}.tp-rotv_b:disabled .tp-rotv_m{display:none}.tp-rotv_c>.tp-fldv.tp-v-lst>.tp-fldv_c{border-bottom-left-radius:var(--bs-br);border-bottom-right-radius:var(--bs-br)}.tp-rotv_c>.tp-fldv.tp-v-lst>.tp-fldv_i{border-bottom-left-radius:var(--bs-br)}.tp-rotv_c>.tp-fldv.tp-v-lst:not(.tp-fldv-expanded)>.tp-fldv_b{border-bottom-left-radius:var(--bs-br);border-bottom-right-radius:var(--bs-br)}.tp-rotv_c .tp-fldv.tp-v-vlst:not(.tp-fldv-expanded)>.tp-fldv_b{border-bottom-right-radius:var(--bs-br)}.tp-rotv.tp-rotv-not .tp-rotv_c>.tp-fldv.tp-v-fst{margin-top:calc(-1*var(--cnt-v-p))}.tp-rotv.tp-rotv-not .tp-rotv_c>.tp-fldv.tp-v-fst>.tp-fldv_b{border-top-left-radius:var(--bs-br);border-top-right-radius:var(--bs-br)}.tp-rotv_c>.tp-tabv.tp-v-lst>.tp-tabv_c{border-bottom-left-radius:var(--bs-br);border-bottom-right-radius:var(--bs-br)}.tp-rotv_c>.tp-tabv.tp-v-lst>.tp-tabv_i{border-bottom-left-radius:var(--bs-br)}.tp-rotv.tp-rotv-not .tp-rotv_c>.tp-tabv.tp-v-fst{margin-top:calc(-1*var(--cnt-v-p))}.tp-rotv.tp-rotv-not .tp-rotv_c>.tp-tabv.tp-v-fst>.tp-tabv_t{border-top-left-radius:var(--bs-br);border-top-right-radius:var(--bs-br)}.tp-rotv.tp-v-disabled,.tp-rotv .tp-v-disabled{pointer-events:none}.tp-rotv.tp-v-hidden,.tp-rotv .tp-v-hidden{display:none}'), this.pool_.getAll().forEach((e) => {
  10507. this.embedPluginStyle_(e);
  10508. }), this.registerPlugin({
  10509. plugins: [
  10510. Gc,
  10511. Fc,
  10512. yi,
  10513. Hc
  10514. ]
  10515. });
  10516. }
  10517. }
  10518. const Xc = new s("3.1.7");
  10519. r.BladeApi = a, r.ButtonApi = j2, r.FolderApi = vi, r.InputBindingApi = mi, r.ListApi = ea, r.MonitorBindingApi = fi, r.Pane = $c, r.SeparatorApi = ss, r.SliderApi = ta, r.TabApi = os, r.TabPageApi = wi, r.TextApi = na, r.TpChangeEvent = u, r.VERSION = Xc, Object.defineProperty(r, "__esModule", { value: true });
  10520. });
  10521. })(Ch, js);
  10522. var Ji = {};
  10523. var Ph = {
  10524. get exports() {
  10525. return Ji;
  10526. },
  10527. set exports(b) {
  10528. Ji = b;
  10529. }
  10530. };
  10531. (function(b, i) {
  10532. (function(r, s) {
  10533. s(i);
  10534. })(el, function(r) {
  10535. class s {
  10536. constructor(o) {
  10537. this.controller_ = o;
  10538. }
  10539. get element() {
  10540. return this.controller_.view.element;
  10541. }
  10542. get disabled() {
  10543. return this.controller_.viewProps.get("disabled");
  10544. }
  10545. set disabled(o) {
  10546. this.controller_.viewProps.set("disabled", o);
  10547. }
  10548. get hidden() {
  10549. return this.controller_.viewProps.get("hidden");
  10550. }
  10551. set hidden(o) {
  10552. this.controller_.viewProps.set("hidden", o);
  10553. }
  10554. dispose() {
  10555. this.controller_.viewProps.set("disposed", true);
  10556. }
  10557. }
  10558. class a {
  10559. constructor(o) {
  10560. this.target = o;
  10561. }
  10562. }
  10563. class c extends a {
  10564. constructor(o, p, f, x) {
  10565. super(o), this.value = p, this.presetKey = f, this.last = x ?? true;
  10566. }
  10567. }
  10568. function u(m) {
  10569. return m;
  10570. }
  10571. function h(m) {
  10572. return m == null;
  10573. }
  10574. const d = {
  10575. alreadydisposed: () => "View has been already disposed",
  10576. invalidparams: (m) => `Invalid parameters for '${m.name}'`,
  10577. nomatchingcontroller: (m) => `No matching controller for '${m.key}'`,
  10578. nomatchingview: (m) => `No matching view for '${JSON.stringify(m.params)}'`,
  10579. notbindable: () => "Value is not bindable",
  10580. propertynotfound: (m) => `Property '${m.name}' not found`,
  10581. shouldneverhappen: () => "This error should never happen"
  10582. };
  10583. class g {
  10584. constructor(o) {
  10585. var p;
  10586. this.message = (p = d[o.type](o.context)) !== null && p !== void 0 ? p : "Unexpected error", this.name = this.constructor.name, this.stack = new Error(this.message).stack, this.type = o.type;
  10587. }
  10588. static alreadyDisposed() {
  10589. return new g({ type: "alreadydisposed" });
  10590. }
  10591. static notBindable() {
  10592. return new g({
  10593. type: "notbindable"
  10594. });
  10595. }
  10596. static propertyNotFound(o) {
  10597. return new g({
  10598. type: "propertynotfound",
  10599. context: {
  10600. name: o
  10601. }
  10602. });
  10603. }
  10604. static shouldNeverHappen() {
  10605. return new g({ type: "shouldneverhappen" });
  10606. }
  10607. }
  10608. class w {
  10609. constructor() {
  10610. this.observers_ = {};
  10611. }
  10612. on(o, p) {
  10613. let f = this.observers_[o];
  10614. return f || (f = this.observers_[o] = []), f.push({
  10615. handler: p
  10616. }), this;
  10617. }
  10618. off(o, p) {
  10619. const f = this.observers_[o];
  10620. return f && (this.observers_[o] = f.filter((x) => x.handler !== p)), this;
  10621. }
  10622. emit(o, p) {
  10623. const f = this.observers_[o];
  10624. f && f.forEach((x) => {
  10625. x.handler(p);
  10626. });
  10627. }
  10628. }
  10629. const _ = "tp";
  10630. function y(m) {
  10631. return (p, f) => [
  10632. _,
  10633. "-",
  10634. m,
  10635. "v",
  10636. p ? `_${p}` : "",
  10637. f ? `-${f}` : ""
  10638. ].join("");
  10639. }
  10640. function C(m, o) {
  10641. return (p) => o(m(p));
  10642. }
  10643. function I(m) {
  10644. return m.rawValue;
  10645. }
  10646. function S(m, o) {
  10647. m.emitter.on("change", C(I, o)), o(m.rawValue);
  10648. }
  10649. function R(m, o, p) {
  10650. S(m.value(o), p);
  10651. }
  10652. function j2(m, o, p) {
  10653. p ? m.classList.add(o) : m.classList.remove(o);
  10654. }
  10655. function F(m, o) {
  10656. return (p) => {
  10657. j2(m, o, p);
  10658. };
  10659. }
  10660. function V(m, o) {
  10661. S(m, (p) => {
  10662. o.textContent = p ?? "";
  10663. });
  10664. }
  10665. const D = y("btn");
  10666. class Y {
  10667. constructor(o, p) {
  10668. this.element = o.createElement("div"), this.element.classList.add(D()), p.viewProps.bindClassModifiers(this.element);
  10669. const f = o.createElement("button");
  10670. f.classList.add(D("b")), p.viewProps.bindDisabled(f), this.element.appendChild(f), this.buttonElement = f;
  10671. const x = o.createElement("div");
  10672. x.classList.add(D("t")), V(p.props.value("title"), x), this.buttonElement.appendChild(x);
  10673. }
  10674. }
  10675. class G {
  10676. constructor(o, p) {
  10677. this.emitter = new w(), this.onClick_ = this.onClick_.bind(this), this.props = p.props, this.viewProps = p.viewProps, this.view = new Y(o, {
  10678. props: this.props,
  10679. viewProps: this.viewProps
  10680. }), this.view.buttonElement.addEventListener("click", this.onClick_);
  10681. }
  10682. onClick_() {
  10683. this.emitter.emit("click", {
  10684. sender: this
  10685. });
  10686. }
  10687. }
  10688. class N {
  10689. constructor(o, p) {
  10690. var f;
  10691. this.constraint_ = p == null ? void 0 : p.constraint, this.equals_ = (f = p == null ? void 0 : p.equals) !== null && f !== void 0 ? f : (x, P) => x === P, this.emitter = new w(), this.rawValue_ = o;
  10692. }
  10693. get constraint() {
  10694. return this.constraint_;
  10695. }
  10696. get rawValue() {
  10697. return this.rawValue_;
  10698. }
  10699. set rawValue(o) {
  10700. this.setRawValue(o, {
  10701. forceEmit: false,
  10702. last: true
  10703. });
  10704. }
  10705. setRawValue(o, p) {
  10706. const f = p ?? {
  10707. forceEmit: false,
  10708. last: true
  10709. }, x = this.constraint_ ? this.constraint_.constrain(o) : o, P = this.rawValue_;
  10710. this.equals_(P, x) && !f.forceEmit || (this.emitter.emit("beforechange", {
  10711. sender: this
  10712. }), this.rawValue_ = x, this.emitter.emit("change", {
  10713. options: f,
  10714. previousRawValue: P,
  10715. rawValue: x,
  10716. sender: this
  10717. }));
  10718. }
  10719. }
  10720. class O {
  10721. constructor(o) {
  10722. this.emitter = new w(), this.value_ = o;
  10723. }
  10724. get rawValue() {
  10725. return this.value_;
  10726. }
  10727. set rawValue(o) {
  10728. this.setRawValue(o, {
  10729. forceEmit: false,
  10730. last: true
  10731. });
  10732. }
  10733. setRawValue(o, p) {
  10734. const f = p ?? {
  10735. forceEmit: false,
  10736. last: true
  10737. }, x = this.value_;
  10738. x === o && !f.forceEmit || (this.emitter.emit("beforechange", {
  10739. sender: this
  10740. }), this.value_ = o, this.emitter.emit("change", {
  10741. options: f,
  10742. previousRawValue: x,
  10743. rawValue: this.value_,
  10744. sender: this
  10745. }));
  10746. }
  10747. }
  10748. function H(m, o) {
  10749. const p = o == null ? void 0 : o.constraint, f = o == null ? void 0 : o.equals;
  10750. return !p && !f ? new O(m) : new N(m, o);
  10751. }
  10752. class K {
  10753. constructor(o) {
  10754. this.emitter = new w(), this.valMap_ = o;
  10755. for (const p in this.valMap_)
  10756. this.valMap_[p].emitter.on("change", () => {
  10757. this.emitter.emit("change", {
  10758. key: p,
  10759. sender: this
  10760. });
  10761. });
  10762. }
  10763. static createCore(o) {
  10764. return Object.keys(o).reduce((f, x) => Object.assign(f, {
  10765. [x]: H(o[x])
  10766. }), {});
  10767. }
  10768. static fromObject(o) {
  10769. const p = this.createCore(o);
  10770. return new K(p);
  10771. }
  10772. get(o) {
  10773. return this.valMap_[o].rawValue;
  10774. }
  10775. set(o, p) {
  10776. this.valMap_[o].rawValue = p;
  10777. }
  10778. value(o) {
  10779. return this.valMap_[o];
  10780. }
  10781. }
  10782. function q(m, o) {
  10783. const f = Object.keys(o).reduce((x, P) => {
  10784. if (x === void 0)
  10785. return;
  10786. const L2 = o[P], z = L2(m[P]);
  10787. return z.succeeded ? Object.assign(Object.assign({}, x), { [P]: z.value }) : void 0;
  10788. }, {});
  10789. return f;
  10790. }
  10791. function ue(m, o) {
  10792. return m.reduce((p, f) => {
  10793. if (p === void 0)
  10794. return;
  10795. const x = o(f);
  10796. if (!(!x.succeeded || x.value === void 0))
  10797. return [...p, x.value];
  10798. }, []);
  10799. }
  10800. function ge(m) {
  10801. return m === null ? false : typeof m == "object";
  10802. }
  10803. function ce(m) {
  10804. return (o) => (p) => {
  10805. if (!o && p === void 0)
  10806. return {
  10807. succeeded: false,
  10808. value: void 0
  10809. };
  10810. if (o && p === void 0)
  10811. return {
  10812. succeeded: true,
  10813. value: void 0
  10814. };
  10815. const f = m(p);
  10816. return f !== void 0 ? {
  10817. succeeded: true,
  10818. value: f
  10819. } : {
  10820. succeeded: false,
  10821. value: void 0
  10822. };
  10823. };
  10824. }
  10825. function me(m) {
  10826. return {
  10827. custom: (o) => ce(o)(m),
  10828. boolean: ce((o) => typeof o == "boolean" ? o : void 0)(m),
  10829. number: ce((o) => typeof o == "number" ? o : void 0)(m),
  10830. string: ce((o) => typeof o == "string" ? o : void 0)(m),
  10831. function: ce((o) => typeof o == "function" ? o : void 0)(m),
  10832. constant: (o) => ce((p) => p === o ? o : void 0)(m),
  10833. raw: ce((o) => o)(m),
  10834. object: (o) => ce((p) => {
  10835. if (ge(p))
  10836. return q(p, o);
  10837. })(m),
  10838. array: (o) => ce((p) => {
  10839. if (Array.isArray(p))
  10840. return ue(p, o);
  10841. })(m)
  10842. };
  10843. }
  10844. const he = {
  10845. optional: me(true),
  10846. required: me(false)
  10847. };
  10848. function ee(m, o) {
  10849. const p = he.required.object(o)(m);
  10850. return p.succeeded ? p.value : void 0;
  10851. }
  10852. function X(m) {
  10853. console.warn([
  10854. `Missing '${m.key}' of ${m.target} in ${m.place}.`,
  10855. "Please rebuild plugins with the latest core package."
  10856. ].join(" "));
  10857. }
  10858. function Pe(m) {
  10859. return m && m.parentElement && m.parentElement.removeChild(m), null;
  10860. }
  10861. class fe {
  10862. constructor(o) {
  10863. this.value_ = o;
  10864. }
  10865. static create(o) {
  10866. return [
  10867. new fe(o),
  10868. (p, f) => {
  10869. o.setRawValue(p, f);
  10870. }
  10871. ];
  10872. }
  10873. get emitter() {
  10874. return this.value_.emitter;
  10875. }
  10876. get rawValue() {
  10877. return this.value_.rawValue;
  10878. }
  10879. }
  10880. const ae = y("");
  10881. function ne(m, o) {
  10882. return F(m, ae(void 0, o));
  10883. }
  10884. class be extends K {
  10885. constructor(o) {
  10886. var p;
  10887. super(o), this.onDisabledChange_ = this.onDisabledChange_.bind(this), this.onParentChange_ = this.onParentChange_.bind(this), this.onParentGlobalDisabledChange_ = this.onParentGlobalDisabledChange_.bind(this), [this.globalDisabled_, this.setGlobalDisabled_] = fe.create(H(this.getGlobalDisabled_())), this.value("disabled").emitter.on("change", this.onDisabledChange_), this.value("parent").emitter.on("change", this.onParentChange_), (p = this.get("parent")) === null || p === void 0 || p.globalDisabled.emitter.on("change", this.onParentGlobalDisabledChange_);
  10888. }
  10889. static create(o) {
  10890. var p, f, x;
  10891. const P = o ?? {};
  10892. return new be(K.createCore({
  10893. disabled: (p = P.disabled) !== null && p !== void 0 ? p : false,
  10894. disposed: false,
  10895. hidden: (f = P.hidden) !== null && f !== void 0 ? f : false,
  10896. parent: (x = P.parent) !== null && x !== void 0 ? x : null
  10897. }));
  10898. }
  10899. get globalDisabled() {
  10900. return this.globalDisabled_;
  10901. }
  10902. bindClassModifiers(o) {
  10903. S(this.globalDisabled_, ne(o, "disabled")), R(this, "hidden", ne(o, "hidden"));
  10904. }
  10905. bindDisabled(o) {
  10906. S(this.globalDisabled_, (p) => {
  10907. o.disabled = p;
  10908. });
  10909. }
  10910. bindTabIndex(o) {
  10911. S(this.globalDisabled_, (p) => {
  10912. o.tabIndex = p ? -1 : 0;
  10913. });
  10914. }
  10915. handleDispose(o) {
  10916. this.value("disposed").emitter.on("change", (p) => {
  10917. p && o();
  10918. });
  10919. }
  10920. getGlobalDisabled_() {
  10921. const o = this.get("parent");
  10922. return (o ? o.globalDisabled.rawValue : false) || this.get("disabled");
  10923. }
  10924. updateGlobalDisabled_() {
  10925. this.setGlobalDisabled_(this.getGlobalDisabled_());
  10926. }
  10927. onDisabledChange_() {
  10928. this.updateGlobalDisabled_();
  10929. }
  10930. onParentGlobalDisabledChange_() {
  10931. this.updateGlobalDisabled_();
  10932. }
  10933. onParentChange_(o) {
  10934. var p;
  10935. const f = o.previousRawValue;
  10936. f == null || f.globalDisabled.emitter.off("change", this.onParentGlobalDisabledChange_), (p = this.get("parent")) === null || p === void 0 || p.globalDisabled.emitter.on("change", this.onParentGlobalDisabledChange_), this.updateGlobalDisabled_();
  10937. }
  10938. }
  10939. function M() {
  10940. return ["veryfirst", "first", "last", "verylast"];
  10941. }
  10942. const le = y(""), Ve = {
  10943. veryfirst: "vfst",
  10944. first: "fst",
  10945. last: "lst",
  10946. verylast: "vlst"
  10947. };
  10948. class Ne {
  10949. constructor(o) {
  10950. this.parent_ = null, this.blade = o.blade, this.view = o.view, this.viewProps = o.viewProps;
  10951. const p = this.view.element;
  10952. this.blade.value("positions").emitter.on("change", () => {
  10953. M().forEach((f) => {
  10954. p.classList.remove(le(void 0, Ve[f]));
  10955. }), this.blade.get("positions").forEach((f) => {
  10956. p.classList.add(le(void 0, Ve[f]));
  10957. });
  10958. }), this.viewProps.handleDispose(() => {
  10959. Pe(p);
  10960. });
  10961. }
  10962. get parent() {
  10963. return this.parent_;
  10964. }
  10965. set parent(o) {
  10966. if (this.parent_ = o, !("parent" in this.viewProps.valMap_)) {
  10967. X({
  10968. key: "parent",
  10969. target: be.name,
  10970. place: "BladeController.parent"
  10971. });
  10972. return;
  10973. }
  10974. this.viewProps.set("parent", this.parent_ ? this.parent_.viewProps : null);
  10975. }
  10976. }
  10977. const we = "http://www.w3.org/2000/svg";
  10978. function it(m) {
  10979. m.offsetHeight;
  10980. }
  10981. function Bn(m, o) {
  10982. const p = m.style.transition;
  10983. m.style.transition = "none", o(), m.style.transition = p;
  10984. }
  10985. function Xe(m) {
  10986. return m.ontouchstart !== void 0;
  10987. }
  10988. function jn(m) {
  10989. for (; m.childNodes.length > 0; )
  10990. m.removeChild(m.childNodes[0]);
  10991. }
  10992. function an(m) {
  10993. return m.relatedTarget ? m.relatedTarget : "explicitOriginalTarget" in m ? m.explicitOriginalTarget : null;
  10994. }
  10995. const dt2 = y("lbl");
  10996. function Mt(m, o) {
  10997. const p = m.createDocumentFragment();
  10998. return o.split(`
  10999. `).map((x) => m.createTextNode(x)).forEach((x, P) => {
  11000. P > 0 && p.appendChild(m.createElement("br")), p.appendChild(x);
  11001. }), p;
  11002. }
  11003. class ze {
  11004. constructor(o, p) {
  11005. this.element = o.createElement("div"), this.element.classList.add(dt2()), p.viewProps.bindClassModifiers(this.element);
  11006. const f = o.createElement("div");
  11007. f.classList.add(dt2("l")), R(p.props, "label", (P) => {
  11008. h(P) ? this.element.classList.add(dt2(void 0, "nol")) : (this.element.classList.remove(dt2(void 0, "nol")), jn(f), f.appendChild(Mt(o, P)));
  11009. }), this.element.appendChild(f), this.labelElement = f;
  11010. const x = o.createElement("div");
  11011. x.classList.add(dt2("v")), this.element.appendChild(x), this.valueElement = x;
  11012. }
  11013. }
  11014. class st extends Ne {
  11015. constructor(o, p) {
  11016. const f = p.valueController.viewProps;
  11017. super(Object.assign(Object.assign({}, p), { view: new ze(o, {
  11018. props: p.props,
  11019. viewProps: f
  11020. }), viewProps: f })), this.props = p.props, this.valueController = p.valueController, this.view.valueElement.appendChild(this.valueController.view.element);
  11021. }
  11022. }
  11023. class ln extends Ne {
  11024. constructor(o) {
  11025. super(o), this.value = o.value;
  11026. }
  11027. }
  11028. class mt extends K {
  11029. constructor(o) {
  11030. super(o);
  11031. }
  11032. static create(o) {
  11033. const p = {
  11034. completed: true,
  11035. expanded: o,
  11036. expandedHeight: null,
  11037. shouldFixHeight: false,
  11038. temporaryExpanded: null
  11039. }, f = K.createCore(p);
  11040. return new mt(f);
  11041. }
  11042. get styleExpanded() {
  11043. var o;
  11044. return (o = this.get("temporaryExpanded")) !== null && o !== void 0 ? o : this.get("expanded");
  11045. }
  11046. get styleHeight() {
  11047. if (!this.styleExpanded)
  11048. return "0";
  11049. const o = this.get("expandedHeight");
  11050. return this.get("shouldFixHeight") && !h(o) ? `${o}px` : "auto";
  11051. }
  11052. bindExpandedClass(o, p) {
  11053. const f = () => {
  11054. this.styleExpanded ? o.classList.add(p) : o.classList.remove(p);
  11055. };
  11056. R(this, "expanded", f), R(this, "temporaryExpanded", f);
  11057. }
  11058. cleanUpTransition() {
  11059. this.set("shouldFixHeight", false), this.set("expandedHeight", null), this.set("completed", true);
  11060. }
  11061. }
  11062. function zn(m) {
  11063. return mt.create(m);
  11064. }
  11065. function hi(m, o) {
  11066. let p = 0;
  11067. return Bn(o, () => {
  11068. m.set("expandedHeight", null), m.set("temporaryExpanded", true), it(o), p = o.clientHeight, m.set("temporaryExpanded", null), it(o);
  11069. }), p;
  11070. }
  11071. function Un(m, o) {
  11072. o.style.height = m.styleHeight;
  11073. }
  11074. function Gn(m, o) {
  11075. m.value("expanded").emitter.on("beforechange", () => {
  11076. m.set("completed", false), h(m.get("expandedHeight")) && m.set("expandedHeight", hi(m, o)), m.set("shouldFixHeight", true), it(o);
  11077. }), m.emitter.on("change", () => {
  11078. Un(m, o);
  11079. }), Un(m, o), o.addEventListener("transitionend", (p) => {
  11080. p.propertyName === "height" && m.cleanUpTransition();
  11081. });
  11082. }
  11083. class yt {
  11084. constructor(o, p) {
  11085. const f = y(p.viewName);
  11086. this.element = o.createElement("div"), this.element.classList.add(f()), p.viewProps.bindClassModifiers(this.element);
  11087. }
  11088. }
  11089. class St extends ln {
  11090. constructor(o, p) {
  11091. const f = p.valueController.viewProps;
  11092. super(Object.assign(Object.assign({}, p), { value: p.valueController.value, view: new ze(o, {
  11093. props: p.props,
  11094. viewProps: f
  11095. }), viewProps: f })), this.props = p.props, this.valueController = p.valueController, this.view.valueElement.appendChild(this.valueController.view.element);
  11096. }
  11097. }
  11098. class Hn {
  11099. constructor() {
  11100. this.disabled = false, this.emitter = new w();
  11101. }
  11102. dispose() {
  11103. }
  11104. tick() {
  11105. this.disabled || this.emitter.emit("tick", {
  11106. sender: this
  11107. });
  11108. }
  11109. }
  11110. class cn {
  11111. constructor(o, p) {
  11112. this.disabled_ = false, this.timerId_ = null, this.onTick_ = this.onTick_.bind(this), this.doc_ = o, this.emitter = new w(), this.interval_ = p, this.setTimer_();
  11113. }
  11114. get disabled() {
  11115. return this.disabled_;
  11116. }
  11117. set disabled(o) {
  11118. this.disabled_ = o, this.disabled_ ? this.clearTimer_() : this.setTimer_();
  11119. }
  11120. dispose() {
  11121. this.clearTimer_();
  11122. }
  11123. clearTimer_() {
  11124. if (this.timerId_ === null)
  11125. return;
  11126. const o = this.doc_.defaultView;
  11127. o && o.clearInterval(this.timerId_), this.timerId_ = null;
  11128. }
  11129. setTimer_() {
  11130. if (this.clearTimer_(), this.interval_ <= 0)
  11131. return;
  11132. const o = this.doc_.defaultView;
  11133. o && (this.timerId_ = o.setInterval(this.onTick_, this.interval_));
  11134. }
  11135. onTick_() {
  11136. this.disabled_ || this.emitter.emit("tick", {
  11137. sender: this
  11138. });
  11139. }
  11140. }
  11141. class Kn {
  11142. constructor(o) {
  11143. this.constraints = o;
  11144. }
  11145. constrain(o) {
  11146. return this.constraints.reduce((p, f) => f.constrain(p), o);
  11147. }
  11148. }
  11149. function xt(m, o) {
  11150. if (m instanceof o)
  11151. return m;
  11152. if (m instanceof Kn) {
  11153. const p = m.constraints.reduce((f, x) => f || (x instanceof o ? x : null), null);
  11154. if (p)
  11155. return p;
  11156. }
  11157. return null;
  11158. }
  11159. class ft {
  11160. constructor(o) {
  11161. this.values = K.fromObject({
  11162. max: o.max,
  11163. min: o.min
  11164. });
  11165. }
  11166. constrain(o) {
  11167. const p = this.values.get("max"), f = this.values.get("min");
  11168. return Math.min(Math.max(o, f), p);
  11169. }
  11170. }
  11171. class At {
  11172. constructor(o) {
  11173. this.values = K.fromObject({
  11174. max: o.max,
  11175. min: o.min
  11176. });
  11177. }
  11178. get maxValue() {
  11179. return this.values.get("max");
  11180. }
  11181. get minValue() {
  11182. return this.values.get("min");
  11183. }
  11184. constrain(o) {
  11185. const p = this.values.get("max"), f = this.values.get("min");
  11186. let x = o;
  11187. return h(f) || (x = Math.max(x, f)), h(p) || (x = Math.min(x, p)), x;
  11188. }
  11189. }
  11190. class A {
  11191. constructor(o, p = 0) {
  11192. this.step = o, this.origin = p;
  11193. }
  11194. constrain(o) {
  11195. const p = this.origin % this.step, f = Math.round((o - p) / this.step);
  11196. return p + f * this.step;
  11197. }
  11198. }
  11199. const U = y("pop");
  11200. class W {
  11201. constructor(o, p) {
  11202. this.element = o.createElement("div"), this.element.classList.add(U()), p.viewProps.bindClassModifiers(this.element), S(p.shows, F(this.element, U(void 0, "v")));
  11203. }
  11204. }
  11205. class ie {
  11206. constructor(o, p) {
  11207. this.shows = H(false), this.viewProps = p.viewProps, this.view = new W(o, {
  11208. shows: this.shows,
  11209. viewProps: this.viewProps
  11210. });
  11211. }
  11212. }
  11213. const ye = y("txt");
  11214. class De {
  11215. constructor(o, p) {
  11216. this.onChange_ = this.onChange_.bind(this), this.element = o.createElement("div"), this.element.classList.add(ye()), p.viewProps.bindClassModifiers(this.element), this.props_ = p.props, this.props_.emitter.on("change", this.onChange_);
  11217. const f = o.createElement("input");
  11218. f.classList.add(ye("i")), f.type = "text", p.viewProps.bindDisabled(f), this.element.appendChild(f), this.inputElement = f, p.value.emitter.on("change", this.onChange_), this.value_ = p.value, this.refresh();
  11219. }
  11220. refresh() {
  11221. const o = this.props_.get("formatter");
  11222. this.inputElement.value = o(this.value_.rawValue);
  11223. }
  11224. onChange_() {
  11225. this.refresh();
  11226. }
  11227. }
  11228. class Ut {
  11229. constructor(o, p) {
  11230. this.onInputChange_ = this.onInputChange_.bind(this), this.parser_ = p.parser, this.props = p.props, this.value = p.value, this.viewProps = p.viewProps, this.view = new De(o, {
  11231. props: p.props,
  11232. value: this.value,
  11233. viewProps: this.viewProps
  11234. }), this.view.inputElement.addEventListener("change", this.onInputChange_);
  11235. }
  11236. onInputChange_(o) {
  11237. const f = o.currentTarget.value, x = this.parser_(f);
  11238. h(x) || (this.value.rawValue = x), this.view.refresh();
  11239. }
  11240. }
  11241. function pn(m) {
  11242. return m === "false" ? false : !!m;
  11243. }
  11244. class Ue {
  11245. constructor(o) {
  11246. this.text = o;
  11247. }
  11248. evaluate() {
  11249. return Number(this.text);
  11250. }
  11251. toString() {
  11252. return this.text;
  11253. }
  11254. }
  11255. const Ge = {
  11256. "**": (m, o) => Math.pow(m, o),
  11257. "*": (m, o) => m * o,
  11258. "/": (m, o) => m / o,
  11259. "%": (m, o) => m % o,
  11260. "+": (m, o) => m + o,
  11261. "-": (m, o) => m - o,
  11262. "<<": (m, o) => m << o,
  11263. ">>": (m, o) => m >> o,
  11264. ">>>": (m, o) => m >>> o,
  11265. "&": (m, o) => m & o,
  11266. "^": (m, o) => m ^ o,
  11267. "|": (m, o) => m | o
  11268. };
  11269. class Gs {
  11270. constructor(o, p, f) {
  11271. this.left = p, this.operator = o, this.right = f;
  11272. }
  11273. evaluate() {
  11274. const o = Ge[this.operator];
  11275. if (!o)
  11276. throw new Error(`unexpected binary operator: '${this.operator}`);
  11277. return o(this.left.evaluate(), this.right.evaluate());
  11278. }
  11279. toString() {
  11280. return [
  11281. "b(",
  11282. this.left.toString(),
  11283. this.operator,
  11284. this.right.toString(),
  11285. ")"
  11286. ].join(" ");
  11287. }
  11288. }
  11289. const Hs = {
  11290. "+": (m) => m,
  11291. "-": (m) => -m,
  11292. "~": (m) => ~m
  11293. };
  11294. class Ks {
  11295. constructor(o, p) {
  11296. this.operator = o, this.expression = p;
  11297. }
  11298. evaluate() {
  11299. const o = Hs[this.operator];
  11300. if (!o)
  11301. throw new Error(`unexpected unary operator: '${this.operator}`);
  11302. return o(this.expression.evaluate());
  11303. }
  11304. toString() {
  11305. return ["u(", this.operator, this.expression.toString(), ")"].join(" ");
  11306. }
  11307. }
  11308. function di(m) {
  11309. return (o, p) => {
  11310. for (let f = 0; f < m.length; f++) {
  11311. const x = m[f](o, p);
  11312. if (x !== "")
  11313. return x;
  11314. }
  11315. return "";
  11316. };
  11317. }
  11318. function Lt(m, o) {
  11319. var p;
  11320. const f = m.substr(o).match(/^\s+/);
  11321. return (p = f && f[0]) !== null && p !== void 0 ? p : "";
  11322. }
  11323. function mi(m, o) {
  11324. const p = m.substr(o, 1);
  11325. return p.match(/^[1-9]$/) ? p : "";
  11326. }
  11327. function Fe(m, o) {
  11328. var p;
  11329. const f = m.substr(o).match(/^[0-9]+/);
  11330. return (p = f && f[0]) !== null && p !== void 0 ? p : "";
  11331. }
  11332. function fi(m, o) {
  11333. const p = Fe(m, o);
  11334. if (p !== "")
  11335. return p;
  11336. const f = m.substr(o, 1);
  11337. if (o += 1, f !== "-" && f !== "+")
  11338. return "";
  11339. const x = Fe(m, o);
  11340. return x === "" ? "" : f + x;
  11341. }
  11342. function rt(m, o) {
  11343. const p = m.substr(o, 1);
  11344. if (o += 1, p.toLowerCase() !== "e")
  11345. return "";
  11346. const f = fi(m, o);
  11347. return f === "" ? "" : p + f;
  11348. }
  11349. function ts(m, o) {
  11350. const p = m.substr(o, 1);
  11351. if (p === "0")
  11352. return p;
  11353. const f = mi(m, o);
  11354. return o += f.length, f === "" ? "" : f + Fe(m, o);
  11355. }
  11356. function un(m, o) {
  11357. const p = ts(m, o);
  11358. if (o += p.length, p === "")
  11359. return "";
  11360. const f = m.substr(o, 1);
  11361. if (o += f.length, f !== ".")
  11362. return "";
  11363. const x = Fe(m, o);
  11364. return o += x.length, p + f + x + rt(m, o);
  11365. }
  11366. function ns(m, o) {
  11367. const p = m.substr(o, 1);
  11368. if (o += p.length, p !== ".")
  11369. return "";
  11370. const f = Fe(m, o);
  11371. return o += f.length, f === "" ? "" : p + f + rt(m, o);
  11372. }
  11373. function $n(m, o) {
  11374. const p = ts(m, o);
  11375. return o += p.length, p === "" ? "" : p + rt(m, o);
  11376. }
  11377. const vi = di([
  11378. un,
  11379. ns,
  11380. $n
  11381. ]);
  11382. function bi(m, o) {
  11383. var p;
  11384. const f = m.substr(o).match(/^[01]+/);
  11385. return (p = f && f[0]) !== null && p !== void 0 ? p : "";
  11386. }
  11387. function $s(m, o) {
  11388. const p = m.substr(o, 2);
  11389. if (o += p.length, p.toLowerCase() !== "0b")
  11390. return "";
  11391. const f = bi(m, o);
  11392. return f === "" ? "" : p + f;
  11393. }
  11394. function Xs(m, o) {
  11395. var p;
  11396. const f = m.substr(o).match(/^[0-7]+/);
  11397. return (p = f && f[0]) !== null && p !== void 0 ? p : "";
  11398. }
  11399. function Ys(m, o) {
  11400. const p = m.substr(o, 2);
  11401. if (o += p.length, p.toLowerCase() !== "0o")
  11402. return "";
  11403. const f = Xs(m, o);
  11404. return f === "" ? "" : p + f;
  11405. }
  11406. function qs(m, o) {
  11407. var p;
  11408. const f = m.substr(o).match(/^[0-9a-f]+/i);
  11409. return (p = f && f[0]) !== null && p !== void 0 ? p : "";
  11410. }
  11411. function gi(m, o) {
  11412. const p = m.substr(o, 2);
  11413. if (o += p.length, p.toLowerCase() !== "0x")
  11414. return "";
  11415. const f = qs(m, o);
  11416. return f === "" ? "" : p + f;
  11417. }
  11418. const Qs = di([
  11419. $s,
  11420. Ys,
  11421. gi
  11422. ]), Zs = di([
  11423. Qs,
  11424. vi
  11425. ]);
  11426. function hn(m, o) {
  11427. const p = Zs(m, o);
  11428. return o += p.length, p === "" ? null : {
  11429. evaluable: new Ue(p),
  11430. cursor: o
  11431. };
  11432. }
  11433. function is(m, o) {
  11434. const p = m.substr(o, 1);
  11435. if (o += p.length, p !== "(")
  11436. return null;
  11437. const f = _i(m, o);
  11438. if (!f)
  11439. return null;
  11440. o = f.cursor, o += Lt(m, o).length;
  11441. const x = m.substr(o, 1);
  11442. return o += x.length, x !== ")" ? null : {
  11443. evaluable: f.evaluable,
  11444. cursor: o
  11445. };
  11446. }
  11447. function Ws(m, o) {
  11448. var p;
  11449. return (p = hn(m, o)) !== null && p !== void 0 ? p : is(m, o);
  11450. }
  11451. function Xn(m, o) {
  11452. const p = Ws(m, o);
  11453. if (p)
  11454. return p;
  11455. const f = m.substr(o, 1);
  11456. if (o += f.length, f !== "+" && f !== "-" && f !== "~")
  11457. return null;
  11458. const x = Xn(m, o);
  11459. return x ? (o = x.cursor, {
  11460. cursor: o,
  11461. evaluable: new Ks(f, x.evaluable)
  11462. }) : null;
  11463. }
  11464. function Js(m, o, p) {
  11465. p += Lt(o, p).length;
  11466. const f = m.filter((x) => o.startsWith(x, p))[0];
  11467. return f ? (p += f.length, p += Lt(o, p).length, {
  11468. cursor: p,
  11469. operator: f
  11470. }) : null;
  11471. }
  11472. function Gt(m, o) {
  11473. return (p, f) => {
  11474. const x = m(p, f);
  11475. if (!x)
  11476. return null;
  11477. f = x.cursor;
  11478. let P = x.evaluable;
  11479. for (; ; ) {
  11480. const L2 = Js(o, p, f);
  11481. if (!L2)
  11482. break;
  11483. f = L2.cursor;
  11484. const z = m(p, f);
  11485. if (!z)
  11486. return null;
  11487. f = z.cursor, P = new Gs(L2.operator, P, z.evaluable);
  11488. }
  11489. return P ? {
  11490. cursor: f,
  11491. evaluable: P
  11492. } : null;
  11493. };
  11494. }
  11495. const ss = [
  11496. ["**"],
  11497. ["*", "/", "%"],
  11498. ["+", "-"],
  11499. ["<<", ">>>", ">>"],
  11500. ["&"],
  11501. ["^"],
  11502. ["|"]
  11503. ].reduce((m, o) => Gt(m, o), Xn);
  11504. function _i(m, o) {
  11505. return o += Lt(m, o).length, ss(m, o);
  11506. }
  11507. function er(m) {
  11508. const o = _i(m, 0);
  11509. return !o || o.cursor + Lt(m, o.cursor).length !== m.length ? null : o.evaluable;
  11510. }
  11511. function dn(m) {
  11512. var o;
  11513. const p = er(m);
  11514. return (o = p == null ? void 0 : p.evaluate()) !== null && o !== void 0 ? o : null;
  11515. }
  11516. function tr(m) {
  11517. if (typeof m == "number")
  11518. return m;
  11519. if (typeof m == "string") {
  11520. const o = dn(m);
  11521. if (!h(o))
  11522. return o;
  11523. }
  11524. return 0;
  11525. }
  11526. function Le(m) {
  11527. return (o) => o.toFixed(Math.max(Math.min(m, 20), 0));
  11528. }
  11529. const nr = Le(0);
  11530. function Yn(m) {
  11531. return nr(m) + "%";
  11532. }
  11533. function rs(m) {
  11534. return String(m);
  11535. }
  11536. function wi(m, o) {
  11537. for (; m.length < o; )
  11538. m.push(void 0);
  11539. }
  11540. function os(m) {
  11541. const o = [];
  11542. return wi(o, m), H(o);
  11543. }
  11544. function as(m) {
  11545. const o = m.indexOf(void 0);
  11546. return o < 0 ? m : m.slice(0, o);
  11547. }
  11548. function ir(m, o) {
  11549. const p = [...as(m), o];
  11550. return p.length > m.length ? p.splice(0, p.length - m.length) : wi(p, m.length), p;
  11551. }
  11552. function Ht({ primary: m, secondary: o, forward: p, backward: f }) {
  11553. let x = false;
  11554. function P(L2) {
  11555. x || (x = true, L2(), x = false);
  11556. }
  11557. m.emitter.on("change", (L2) => {
  11558. P(() => {
  11559. o.setRawValue(p(m, o), L2.options);
  11560. });
  11561. }), o.emitter.on("change", (L2) => {
  11562. P(() => {
  11563. m.setRawValue(f(m, o), L2.options);
  11564. }), P(() => {
  11565. o.setRawValue(p(m, o), L2.options);
  11566. });
  11567. }), P(() => {
  11568. o.setRawValue(p(m, o), {
  11569. forceEmit: false,
  11570. last: true
  11571. });
  11572. });
  11573. }
  11574. function Kt(m, o) {
  11575. const p = m * (o.altKey ? 0.1 : 1) * (o.shiftKey ? 10 : 1);
  11576. return o.upKey ? +p : o.downKey ? -p : 0;
  11577. }
  11578. function mn(m) {
  11579. return {
  11580. altKey: m.altKey,
  11581. downKey: m.key === "ArrowDown",
  11582. shiftKey: m.shiftKey,
  11583. upKey: m.key === "ArrowUp"
  11584. };
  11585. }
  11586. function yi(m) {
  11587. return {
  11588. altKey: m.altKey,
  11589. downKey: m.key === "ArrowLeft",
  11590. shiftKey: m.shiftKey,
  11591. upKey: m.key === "ArrowRight"
  11592. };
  11593. }
  11594. function sr(m) {
  11595. return m === "ArrowUp" || m === "ArrowDown";
  11596. }
  11597. function ls(m) {
  11598. return sr(m) || m === "ArrowLeft" || m === "ArrowRight";
  11599. }
  11600. function xi(m, o) {
  11601. var p, f;
  11602. const x = o.ownerDocument.defaultView, P = o.getBoundingClientRect();
  11603. return {
  11604. x: m.pageX - (((p = x && x.scrollX) !== null && p !== void 0 ? p : 0) + P.left),
  11605. y: m.pageY - (((f = x && x.scrollY) !== null && f !== void 0 ? f : 0) + P.top)
  11606. };
  11607. }
  11608. class qn {
  11609. constructor(o) {
  11610. this.lastTouch_ = null, this.onDocumentMouseMove_ = this.onDocumentMouseMove_.bind(this), this.onDocumentMouseUp_ = this.onDocumentMouseUp_.bind(this), this.onMouseDown_ = this.onMouseDown_.bind(this), this.onTouchEnd_ = this.onTouchEnd_.bind(this), this.onTouchMove_ = this.onTouchMove_.bind(this), this.onTouchStart_ = this.onTouchStart_.bind(this), this.elem_ = o, this.emitter = new w(), o.addEventListener("touchstart", this.onTouchStart_, {
  11611. passive: false
  11612. }), o.addEventListener("touchmove", this.onTouchMove_, {
  11613. passive: true
  11614. }), o.addEventListener("touchend", this.onTouchEnd_), o.addEventListener("mousedown", this.onMouseDown_);
  11615. }
  11616. computePosition_(o) {
  11617. const p = this.elem_.getBoundingClientRect();
  11618. return {
  11619. bounds: {
  11620. width: p.width,
  11621. height: p.height
  11622. },
  11623. point: o ? {
  11624. x: o.x,
  11625. y: o.y
  11626. } : null
  11627. };
  11628. }
  11629. onMouseDown_(o) {
  11630. var p;
  11631. o.preventDefault(), (p = o.currentTarget) === null || p === void 0 || p.focus();
  11632. const f = this.elem_.ownerDocument;
  11633. f.addEventListener("mousemove", this.onDocumentMouseMove_), f.addEventListener("mouseup", this.onDocumentMouseUp_), this.emitter.emit("down", {
  11634. altKey: o.altKey,
  11635. data: this.computePosition_(xi(o, this.elem_)),
  11636. sender: this,
  11637. shiftKey: o.shiftKey
  11638. });
  11639. }
  11640. onDocumentMouseMove_(o) {
  11641. this.emitter.emit("move", {
  11642. altKey: o.altKey,
  11643. data: this.computePosition_(xi(o, this.elem_)),
  11644. sender: this,
  11645. shiftKey: o.shiftKey
  11646. });
  11647. }
  11648. onDocumentMouseUp_(o) {
  11649. const p = this.elem_.ownerDocument;
  11650. p.removeEventListener("mousemove", this.onDocumentMouseMove_), p.removeEventListener("mouseup", this.onDocumentMouseUp_), this.emitter.emit("up", {
  11651. altKey: o.altKey,
  11652. data: this.computePosition_(xi(o, this.elem_)),
  11653. sender: this,
  11654. shiftKey: o.shiftKey
  11655. });
  11656. }
  11657. onTouchStart_(o) {
  11658. o.preventDefault();
  11659. const p = o.targetTouches.item(0), f = this.elem_.getBoundingClientRect();
  11660. this.emitter.emit("down", {
  11661. altKey: o.altKey,
  11662. data: this.computePosition_(p ? {
  11663. x: p.clientX - f.left,
  11664. y: p.clientY - f.top
  11665. } : void 0),
  11666. sender: this,
  11667. shiftKey: o.shiftKey
  11668. }), this.lastTouch_ = p;
  11669. }
  11670. onTouchMove_(o) {
  11671. const p = o.targetTouches.item(0), f = this.elem_.getBoundingClientRect();
  11672. this.emitter.emit("move", {
  11673. altKey: o.altKey,
  11674. data: this.computePosition_(p ? {
  11675. x: p.clientX - f.left,
  11676. y: p.clientY - f.top
  11677. } : void 0),
  11678. sender: this,
  11679. shiftKey: o.shiftKey
  11680. }), this.lastTouch_ = p;
  11681. }
  11682. onTouchEnd_(o) {
  11683. var p;
  11684. const f = (p = o.targetTouches.item(0)) !== null && p !== void 0 ? p : this.lastTouch_, x = this.elem_.getBoundingClientRect();
  11685. this.emitter.emit("up", {
  11686. altKey: o.altKey,
  11687. data: this.computePosition_(f ? {
  11688. x: f.clientX - x.left,
  11689. y: f.clientY - x.top
  11690. } : void 0),
  11691. sender: this,
  11692. shiftKey: o.shiftKey
  11693. });
  11694. }
  11695. }
  11696. function Me(m, o, p, f, x) {
  11697. const P = (m - o) / (p - o);
  11698. return f + P * (x - f);
  11699. }
  11700. function cs(m) {
  11701. return String(m.toFixed(10)).split(".")[1].replace(/0+$/, "").length;
  11702. }
  11703. function $t(m, o, p) {
  11704. return Math.min(Math.max(m, o), p);
  11705. }
  11706. const Ye = y("txt");
  11707. class rr {
  11708. constructor(o, p) {
  11709. this.onChange_ = this.onChange_.bind(this), this.props_ = p.props, this.props_.emitter.on("change", this.onChange_), this.element = o.createElement("div"), this.element.classList.add(Ye(), Ye(void 0, "num")), p.arrayPosition && this.element.classList.add(Ye(void 0, p.arrayPosition)), p.viewProps.bindClassModifiers(this.element);
  11710. const f = o.createElement("input");
  11711. f.classList.add(Ye("i")), f.type = "text", p.viewProps.bindDisabled(f), this.element.appendChild(f), this.inputElement = f, this.onDraggingChange_ = this.onDraggingChange_.bind(this), this.dragging_ = p.dragging, this.dragging_.emitter.on("change", this.onDraggingChange_), this.element.classList.add(Ye()), this.inputElement.classList.add(Ye("i"));
  11712. const x = o.createElement("div");
  11713. x.classList.add(Ye("k")), this.element.appendChild(x), this.knobElement = x;
  11714. const P = o.createElementNS(we, "svg");
  11715. P.classList.add(Ye("g")), this.knobElement.appendChild(P);
  11716. const L2 = o.createElementNS(we, "path");
  11717. L2.classList.add(Ye("gb")), P.appendChild(L2), this.guideBodyElem_ = L2;
  11718. const z = o.createElementNS(we, "path");
  11719. z.classList.add(Ye("gh")), P.appendChild(z), this.guideHeadElem_ = z;
  11720. const oe = o.createElement("div");
  11721. oe.classList.add(y("tt")()), this.knobElement.appendChild(oe), this.tooltipElem_ = oe, p.value.emitter.on("change", this.onChange_), this.value = p.value, this.refresh();
  11722. }
  11723. onDraggingChange_(o) {
  11724. if (o.rawValue === null) {
  11725. this.element.classList.remove(Ye(void 0, "drg"));
  11726. return;
  11727. }
  11728. this.element.classList.add(Ye(void 0, "drg"));
  11729. const p = o.rawValue / this.props_.get("draggingScale"), f = p + (p > 0 ? -1 : p < 0 ? 1 : 0), x = $t(-f, -4, 4);
  11730. this.guideHeadElem_.setAttributeNS(null, "d", [`M ${f + x},0 L${f},4 L${f + x},8`, `M ${p},-1 L${p},9`].join(" ")), this.guideBodyElem_.setAttributeNS(null, "d", `M 0,4 L${p},4`);
  11731. const P = this.props_.get("formatter");
  11732. this.tooltipElem_.textContent = P(this.value.rawValue), this.tooltipElem_.style.left = `${p}px`;
  11733. }
  11734. refresh() {
  11735. const o = this.props_.get("formatter");
  11736. this.inputElement.value = o(this.value.rawValue);
  11737. }
  11738. onChange_() {
  11739. this.refresh();
  11740. }
  11741. }
  11742. class fn {
  11743. constructor(o, p) {
  11744. var f;
  11745. this.originRawValue_ = 0, this.onInputChange_ = this.onInputChange_.bind(this), this.onInputKeyDown_ = this.onInputKeyDown_.bind(this), this.onInputKeyUp_ = this.onInputKeyUp_.bind(this), this.onPointerDown_ = this.onPointerDown_.bind(this), this.onPointerMove_ = this.onPointerMove_.bind(this), this.onPointerUp_ = this.onPointerUp_.bind(this), this.baseStep_ = p.baseStep, this.parser_ = p.parser, this.props = p.props, this.sliderProps_ = (f = p.sliderProps) !== null && f !== void 0 ? f : null, this.value = p.value, this.viewProps = p.viewProps, this.dragging_ = H(null), this.view = new rr(o, {
  11746. arrayPosition: p.arrayPosition,
  11747. dragging: this.dragging_,
  11748. props: this.props,
  11749. value: this.value,
  11750. viewProps: this.viewProps
  11751. }), this.view.inputElement.addEventListener("change", this.onInputChange_), this.view.inputElement.addEventListener("keydown", this.onInputKeyDown_), this.view.inputElement.addEventListener("keyup", this.onInputKeyUp_);
  11752. const x = new qn(this.view.knobElement);
  11753. x.emitter.on("down", this.onPointerDown_), x.emitter.on("move", this.onPointerMove_), x.emitter.on("up", this.onPointerUp_);
  11754. }
  11755. constrainValue_(o) {
  11756. var p, f;
  11757. const x = (p = this.sliderProps_) === null || p === void 0 ? void 0 : p.get("minValue"), P = (f = this.sliderProps_) === null || f === void 0 ? void 0 : f.get("maxValue");
  11758. let L2 = o;
  11759. return x !== void 0 && (L2 = Math.max(L2, x)), P !== void 0 && (L2 = Math.min(L2, P)), L2;
  11760. }
  11761. onInputChange_(o) {
  11762. const f = o.currentTarget.value, x = this.parser_(f);
  11763. h(x) || (this.value.rawValue = this.constrainValue_(x)), this.view.refresh();
  11764. }
  11765. onInputKeyDown_(o) {
  11766. const p = Kt(this.baseStep_, mn(o));
  11767. p !== 0 && this.value.setRawValue(this.constrainValue_(this.value.rawValue + p), {
  11768. forceEmit: false,
  11769. last: false
  11770. });
  11771. }
  11772. onInputKeyUp_(o) {
  11773. Kt(this.baseStep_, mn(o)) !== 0 && this.value.setRawValue(this.value.rawValue, {
  11774. forceEmit: true,
  11775. last: true
  11776. });
  11777. }
  11778. onPointerDown_() {
  11779. this.originRawValue_ = this.value.rawValue, this.dragging_.rawValue = 0;
  11780. }
  11781. computeDraggingValue_(o) {
  11782. if (!o.point)
  11783. return null;
  11784. const p = o.point.x - o.bounds.width / 2;
  11785. return this.constrainValue_(this.originRawValue_ + p * this.props.get("draggingScale"));
  11786. }
  11787. onPointerMove_(o) {
  11788. const p = this.computeDraggingValue_(o.data);
  11789. p !== null && (this.value.setRawValue(p, {
  11790. forceEmit: false,
  11791. last: false
  11792. }), this.dragging_.rawValue = this.value.rawValue - this.originRawValue_);
  11793. }
  11794. onPointerUp_(o) {
  11795. const p = this.computeDraggingValue_(o.data);
  11796. p !== null && (this.value.setRawValue(p, {
  11797. forceEmit: true,
  11798. last: true
  11799. }), this.dragging_.rawValue = null);
  11800. }
  11801. }
  11802. function et(m, o) {
  11803. m.write(o);
  11804. }
  11805. function Xt(m) {
  11806. const o = m ? xt(m, A) : null;
  11807. return o ? o.step : null;
  11808. }
  11809. function vn(m, o) {
  11810. const p = m && xt(m, A);
  11811. return p ? cs(p.step) : Math.max(cs(o), 2);
  11812. }
  11813. function Ei(m) {
  11814. const o = Xt(m);
  11815. return o ?? 1;
  11816. }
  11817. function Qn(m, o) {
  11818. var p;
  11819. const f = m && xt(m, A), x = Math.abs((p = f == null ? void 0 : f.step) !== null && p !== void 0 ? p : o);
  11820. return x === 0 ? 0.1 : Math.pow(10, Math.floor(Math.log10(x)) - 1);
  11821. }
  11822. function Yt(m) {
  11823. return [m[0], m[1], m[2]];
  11824. }
  11825. function ps(m) {
  11826. const o = $t(Math.floor(m), 0, 255).toString(16);
  11827. return o.length === 1 ? `0${o}` : o;
  11828. }
  11829. function bn(m, o = "#") {
  11830. const p = Yt(m.getComponents("rgb")).map(ps).join("");
  11831. return `${o}${p}`;
  11832. }
  11833. function us(m, o = "#") {
  11834. const p = m.getComponents("rgb"), f = [p[0], p[1], p[2], p[3] * 255].map(ps).join("");
  11835. return `${o}${f}`;
  11836. }
  11837. function or(m, o) {
  11838. const p = Le(o === "float" ? 2 : 0);
  11839. return `rgb(${Yt(m.getComponents("rgb", o)).map((x) => p(x)).join(", ")})`;
  11840. }
  11841. function hs(m) {
  11842. return (o) => or(o, m);
  11843. }
  11844. function ds(m, o) {
  11845. const p = Le(2), f = Le(o === "float" ? 2 : 0);
  11846. return `rgba(${m.getComponents("rgb", o).map((P, L2) => (L2 === 3 ? p : f)(P)).join(", ")})`;
  11847. }
  11848. function ar(m) {
  11849. return (o) => ds(o, m);
  11850. }
  11851. function Zn(m) {
  11852. const o = [
  11853. Le(0),
  11854. Yn,
  11855. Yn
  11856. ];
  11857. return `hsl(${Yt(m.getComponents("hsl")).map((f, x) => o[x](f)).join(", ")})`;
  11858. }
  11859. function lr(m) {
  11860. const o = [
  11861. Le(0),
  11862. Yn,
  11863. Yn,
  11864. Le(2)
  11865. ];
  11866. return `hsla(${m.getComponents("hsl").map((f, x) => o[x](f)).join(", ")})`;
  11867. }
  11868. function ms(m, o) {
  11869. const p = Le(o === "float" ? 2 : 0), f = ["r", "g", "b"];
  11870. return `{${Yt(m.getComponents("rgb", o)).map((P, L2) => `${f[L2]}: ${p(P)}`).join(", ")}}`;
  11871. }
  11872. function fs(m) {
  11873. return (o) => ms(o, m);
  11874. }
  11875. function cr(m, o) {
  11876. const p = Le(2), f = Le(o === "float" ? 2 : 0), x = ["r", "g", "b", "a"];
  11877. return `{${m.getComponents("rgb", o).map((L2, z) => {
  11878. const oe = z === 3 ? p : f;
  11879. return `${x[z]}: ${oe(L2)}`;
  11880. }).join(", ")}}`;
  11881. }
  11882. function pr(m) {
  11883. return (o) => cr(o, m);
  11884. }
  11885. [
  11886. ...["int", "float"].reduce((m, o) => [
  11887. ...m,
  11888. {
  11889. format: {
  11890. alpha: false,
  11891. mode: "rgb",
  11892. notation: "func",
  11893. type: o
  11894. },
  11895. stringifier: hs(o)
  11896. },
  11897. {
  11898. format: {
  11899. alpha: true,
  11900. mode: "rgb",
  11901. notation: "func",
  11902. type: o
  11903. },
  11904. stringifier: ar(o)
  11905. },
  11906. {
  11907. format: {
  11908. alpha: false,
  11909. mode: "rgb",
  11910. notation: "object",
  11911. type: o
  11912. },
  11913. stringifier: fs(o)
  11914. },
  11915. {
  11916. format: {
  11917. alpha: true,
  11918. mode: "rgb",
  11919. notation: "object",
  11920. type: o
  11921. },
  11922. stringifier: pr(o)
  11923. }
  11924. ], [])
  11925. ];
  11926. class ur {
  11927. constructor(o) {
  11928. this.components = o.components, this.asm_ = o.assembly;
  11929. }
  11930. constrain(o) {
  11931. const p = this.asm_.toComponents(o).map((f, x) => {
  11932. var P, L2;
  11933. return (L2 = (P = this.components[x]) === null || P === void 0 ? void 0 : P.constrain(f)) !== null && L2 !== void 0 ? L2 : f;
  11934. });
  11935. return this.asm_.fromComponents(p);
  11936. }
  11937. }
  11938. const vs = y("pndtxt");
  11939. class hr {
  11940. constructor(o, p) {
  11941. this.textViews = p.textViews, this.element = o.createElement("div"), this.element.classList.add(vs()), this.textViews.forEach((f) => {
  11942. const x = o.createElement("div");
  11943. x.classList.add(vs("a")), x.appendChild(f.element), this.element.appendChild(x);
  11944. });
  11945. }
  11946. }
  11947. function Ci(m, o, p) {
  11948. return new fn(m, {
  11949. arrayPosition: p === 0 ? "fst" : p === o.axes.length - 1 ? "lst" : "mid",
  11950. baseStep: o.axes[p].baseStep,
  11951. parser: o.parser,
  11952. props: o.axes[p].textProps,
  11953. value: H(0, {
  11954. constraint: o.axes[p].constraint
  11955. }),
  11956. viewProps: o.viewProps
  11957. });
  11958. }
  11959. class Rt {
  11960. constructor(o, p) {
  11961. this.value = p.value, this.viewProps = p.viewProps, this.acs_ = p.axes.map((f, x) => Ci(o, p, x)), this.acs_.forEach((f, x) => {
  11962. Ht({
  11963. primary: this.value,
  11964. secondary: f.value,
  11965. forward: (P) => p.assembly.toComponents(P.rawValue)[x],
  11966. backward: (P, L2) => {
  11967. const z = p.assembly.toComponents(P.rawValue);
  11968. return z[x] = L2.rawValue, p.assembly.fromComponents(z);
  11969. }
  11970. });
  11971. }), this.view = new hr(o, {
  11972. textViews: this.acs_.map((f) => f.view)
  11973. });
  11974. }
  11975. }
  11976. function dr(m, o) {
  11977. return "step" in m && !h(m.step) ? new A(m.step, o) : null;
  11978. }
  11979. function gn(m) {
  11980. return !h(m.max) && !h(m.min) ? new ft({
  11981. max: m.max,
  11982. min: m.min
  11983. }) : !h(m.max) || !h(m.min) ? new At({
  11984. max: m.max,
  11985. min: m.min
  11986. }) : null;
  11987. }
  11988. const mr = {
  11989. monitor: {
  11990. defaultInterval: 200,
  11991. defaultLineCount: 3
  11992. }
  11993. }, ot = y("grl");
  11994. class bs {
  11995. constructor(o, p) {
  11996. this.onCursorChange_ = this.onCursorChange_.bind(this), this.onValueUpdate_ = this.onValueUpdate_.bind(this), this.element = o.createElement("div"), this.element.classList.add(ot()), p.viewProps.bindClassModifiers(this.element), this.formatter_ = p.formatter, this.props_ = p.props, this.cursor_ = p.cursor, this.cursor_.emitter.on("change", this.onCursorChange_);
  11997. const f = o.createElementNS(we, "svg");
  11998. f.classList.add(ot("g")), f.style.height = `calc(var(--bld-us) * ${p.lineCount})`, this.element.appendChild(f), this.svgElem_ = f;
  11999. const x = o.createElementNS(we, "polyline");
  12000. this.svgElem_.appendChild(x), this.lineElem_ = x;
  12001. const P = o.createElement("div");
  12002. P.classList.add(ot("t"), y("tt")()), this.element.appendChild(P), this.tooltipElem_ = P, p.value.emitter.on("change", this.onValueUpdate_), this.value = p.value, this.update_();
  12003. }
  12004. get graphElement() {
  12005. return this.svgElem_;
  12006. }
  12007. update_() {
  12008. const o = this.svgElem_.getBoundingClientRect(), p = this.value.rawValue.length - 1, f = this.props_.get("minValue"), x = this.props_.get("maxValue"), P = [];
  12009. this.value.rawValue.forEach((Ze, te) => {
  12010. if (Ze === void 0)
  12011. return;
  12012. const Pt = Me(te, 0, p, 0, o.width), Mr = Me(Ze, f, x, o.height, 0);
  12013. P.push([Pt, Mr].join(","));
  12014. }), this.lineElem_.setAttributeNS(null, "points", P.join(" "));
  12015. const L2 = this.tooltipElem_, z = this.value.rawValue[this.cursor_.rawValue];
  12016. if (z === void 0) {
  12017. L2.classList.remove(ot("t", "a"));
  12018. return;
  12019. }
  12020. const oe = Me(this.cursor_.rawValue, 0, p, 0, o.width), Qe = Me(z, f, x, o.height, 0);
  12021. L2.style.left = `${oe}px`, L2.style.top = `${Qe}px`, L2.textContent = `${this.formatter_(z)}`, L2.classList.contains(ot("t", "a")) || (L2.classList.add(ot("t", "a"), ot("t", "in")), it(L2), L2.classList.remove(ot("t", "in")));
  12022. }
  12023. onValueUpdate_() {
  12024. this.update_();
  12025. }
  12026. onCursorChange_() {
  12027. this.update_();
  12028. }
  12029. }
  12030. class fr {
  12031. constructor(o, p) {
  12032. if (this.onGraphMouseMove_ = this.onGraphMouseMove_.bind(this), this.onGraphMouseLeave_ = this.onGraphMouseLeave_.bind(this), this.onGraphPointerDown_ = this.onGraphPointerDown_.bind(this), this.onGraphPointerMove_ = this.onGraphPointerMove_.bind(this), this.onGraphPointerUp_ = this.onGraphPointerUp_.bind(this), this.props_ = p.props, this.value = p.value, this.viewProps = p.viewProps, this.cursor_ = H(-1), this.view = new bs(o, {
  12033. cursor: this.cursor_,
  12034. formatter: p.formatter,
  12035. lineCount: p.lineCount,
  12036. props: this.props_,
  12037. value: this.value,
  12038. viewProps: this.viewProps
  12039. }), !Xe(o))
  12040. this.view.element.addEventListener("mousemove", this.onGraphMouseMove_), this.view.element.addEventListener("mouseleave", this.onGraphMouseLeave_);
  12041. else {
  12042. const f = new qn(this.view.element);
  12043. f.emitter.on("down", this.onGraphPointerDown_), f.emitter.on("move", this.onGraphPointerMove_), f.emitter.on("up", this.onGraphPointerUp_);
  12044. }
  12045. }
  12046. onGraphMouseLeave_() {
  12047. this.cursor_.rawValue = -1;
  12048. }
  12049. onGraphMouseMove_(o) {
  12050. const p = this.view.element.getBoundingClientRect();
  12051. this.cursor_.rawValue = Math.floor(Me(o.offsetX, 0, p.width, 0, this.value.rawValue.length));
  12052. }
  12053. onGraphPointerDown_(o) {
  12054. this.onGraphPointerMove_(o);
  12055. }
  12056. onGraphPointerMove_(o) {
  12057. if (!o.data.point) {
  12058. this.cursor_.rawValue = -1;
  12059. return;
  12060. }
  12061. this.cursor_.rawValue = Math.floor(Me(o.data.point.x, 0, o.data.bounds.width, 0, this.value.rawValue.length));
  12062. }
  12063. onGraphPointerUp_() {
  12064. this.cursor_.rawValue = -1;
  12065. }
  12066. }
  12067. class gs {
  12068. constructor(o) {
  12069. this.controller_ = o;
  12070. }
  12071. get disabled() {
  12072. return this.controller_.viewProps.get("disabled");
  12073. }
  12074. set disabled(o) {
  12075. this.controller_.viewProps.set("disabled", o);
  12076. }
  12077. get title() {
  12078. var o;
  12079. return (o = this.controller_.props.get("title")) !== null && o !== void 0 ? o : "";
  12080. }
  12081. set title(o) {
  12082. this.controller_.props.set("title", o);
  12083. }
  12084. on(o, p) {
  12085. const f = p.bind(this);
  12086. return this.controller_.emitter.on(o, () => {
  12087. f(new a(this));
  12088. }), this;
  12089. }
  12090. }
  12091. class vr extends a {
  12092. constructor(o, p, f) {
  12093. super(o), this.cell = p, this.index = f;
  12094. }
  12095. }
  12096. class _s extends s {
  12097. constructor(o) {
  12098. super(o), this.cellToApiMap_ = /* @__PURE__ */ new Map(), this.emitter_ = new w();
  12099. const p = this.controller_.valueController;
  12100. p.cellControllers.forEach((f, x) => {
  12101. const P = new gs(f);
  12102. this.cellToApiMap_.set(f, P), f.emitter.on("click", () => {
  12103. const L2 = x % p.size[0], z = Math.floor(x / p.size[0]);
  12104. this.emitter_.emit("click", {
  12105. event: new vr(this, P, [L2, z])
  12106. });
  12107. });
  12108. });
  12109. }
  12110. cell(o, p) {
  12111. const f = this.controller_.valueController, x = f.cellControllers[p * f.size[0] + o];
  12112. return this.cellToApiMap_.get(x);
  12113. }
  12114. on(o, p) {
  12115. const f = p.bind(this);
  12116. return this.emitter_.on(o, (x) => {
  12117. f(x.event);
  12118. }), this;
  12119. }
  12120. }
  12121. class Pi {
  12122. constructor(o, p) {
  12123. this.size = p.size;
  12124. const [f, x] = this.size, P = [];
  12125. for (let L2 = 0; L2 < x; L2++)
  12126. for (let z = 0; z < f; z++) {
  12127. const oe = new G(o, {
  12128. props: K.fromObject(Object.assign({}, p.cellConfig(z, L2))),
  12129. viewProps: be.create()
  12130. });
  12131. P.push(oe);
  12132. }
  12133. this.cellCs_ = P, this.viewProps = be.create(), this.viewProps.handleDispose(() => {
  12134. this.cellCs_.forEach((L2) => {
  12135. L2.viewProps.set("disposed", true);
  12136. });
  12137. }), this.view = new yt(o, {
  12138. viewProps: this.viewProps,
  12139. viewName: "btngrid"
  12140. }), this.view.element.style.gridTemplateColumns = `repeat(${f}, 1fr)`, this.cellCs_.forEach((L2) => {
  12141. this.view.element.appendChild(L2.view.element);
  12142. });
  12143. }
  12144. get cellControllers() {
  12145. return this.cellCs_;
  12146. }
  12147. }
  12148. const br = {
  12149. id: "buttongrid",
  12150. type: "blade",
  12151. // TODO:
  12152. css: '.tp-cbzgv,.tp-radv_b,.tp-rslv_k,.tp-cbzv_b{-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:rgba(0,0,0,0);border-width:0;font-family:inherit;font-size:inherit;font-weight:inherit;margin:0;outline:none;padding:0}.tp-radv_b,.tp-rslv_k,.tp-cbzv_b{background-color:var(--btn-bg);border-radius:var(--elm-br);color:var(--btn-fg);cursor:pointer;display:block;font-weight:bold;height:var(--bld-us);line-height:var(--bld-us);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.tp-radv_b:hover,.tp-rslv_k:hover,.tp-cbzv_b:hover{background-color:var(--btn-bg-h)}.tp-radv_b:focus,.tp-rslv_k:focus,.tp-cbzv_b:focus{background-color:var(--btn-bg-f)}.tp-radv_b:active,.tp-rslv_k:active,.tp-cbzv_b:active{background-color:var(--btn-bg-a)}.tp-radv_b:disabled,.tp-rslv_k:disabled,.tp-cbzv_b:disabled{opacity:.5}.tp-cbzgv{background-color:var(--in-bg);border-radius:var(--elm-br);box-sizing:border-box;color:var(--in-fg);font-family:inherit;height:var(--bld-us);line-height:var(--bld-us);min-width:0;width:100%}.tp-cbzgv:hover{background-color:var(--in-bg-h)}.tp-cbzgv:focus{background-color:var(--in-bg-f)}.tp-cbzgv:active{background-color:var(--in-bg-a)}.tp-cbzgv:disabled{opacity:.5}.tp-btngridv{border-radius:var(--elm-br);display:grid;overflow:hidden;gap:2px}.tp-btngridv.tp-v-disabled{opacity:.5}.tp-btngridv .tp-btnv_b:disabled{opacity:1}.tp-btngridv .tp-btnv_b:disabled .tp-btnv_t{opacity:.5}.tp-btngridv .tp-btnv_b{border-radius:0}.tp-cbzv{position:relative}.tp-cbzv_h{display:flex}.tp-cbzv_b{margin-right:4px;position:relative;width:var(--bld-us)}.tp-cbzv_b svg{display:block;height:16px;left:50%;margin-left:-8px;margin-top:-8px;position:absolute;top:50%;width:16px}.tp-cbzv_b svg path{stroke:var(--bs-bg);stroke-width:2}.tp-cbzv_t{flex:1}.tp-cbzv_p{height:0;margin-top:0;opacity:0;overflow:hidden;transition:height .2s ease-in-out,opacity .2s linear,margin .2s ease-in-out}.tp-cbzv.tp-cbzv-expanded .tp-cbzv_p{margin-top:var(--bld-s);opacity:1}.tp-cbzv.tp-cbzv-cpl .tp-cbzv_p{overflow:visible}.tp-cbzv .tp-popv{left:calc(-1*var(--cnt-h-p));position:absolute;right:calc(-1*var(--cnt-h-p));top:var(--bld-us)}.tp-cbzpv_t{margin-top:var(--bld-s)}.tp-cbzgv{height:auto;overflow:hidden;position:relative}.tp-cbzgv.tp-v-disabled{opacity:.5}.tp-cbzgv_p{left:16px;position:absolute;right:16px;top:0}.tp-cbzgv_g{cursor:pointer;display:block;height:calc(var(--bld-us)*5);width:100%}.tp-cbzgv_u{opacity:.1;stroke:var(--in-fg);stroke-dasharray:1}.tp-cbzgv_l{fill:rgba(0,0,0,0);stroke:var(--in-fg)}.tp-cbzgv_v{opacity:.5;stroke:var(--in-fg);stroke-dasharray:1}.tp-cbzgv_h{border:var(--in-fg) solid 1px;border-radius:50%;box-sizing:border-box;height:4px;margin-left:-2px;margin-top:-2px;pointer-events:none;position:absolute;width:4px}.tp-cbzgv:focus .tp-cbzgv_h-sel{background-color:var(--in-fg);border-width:0}.tp-cbzprvv{cursor:pointer;height:4px;padding:4px 0;position:relative}.tp-cbzprvv_g{display:block;height:100%;overflow:visible;width:100%}.tp-cbzprvv_t{opacity:.5;stroke:var(--mo-fg)}.tp-cbzprvv_m{background-color:var(--mo-fg);border-radius:50%;height:4px;margin-left:-2px;margin-top:-2px;opacity:0;position:absolute;top:50%;transition:opacity .2s ease-out;width:4px}.tp-cbzprvv_m.tp-cbzprvv_m-a{opacity:1}.tp-fpsv{position:relative}.tp-fpsv_l{bottom:4px;color:var(--mo-fg);line-height:1;right:4px;pointer-events:none;position:absolute}.tp-fpsv_u{margin-left:.2em;opacity:.7}.tp-rslv{cursor:pointer;padding-left:8px;padding-right:8px}.tp-rslv.tp-v-disabled{opacity:.5}.tp-rslv_t{height:calc(var(--bld-us));position:relative}.tp-rslv_t::before{background-color:var(--in-bg);border-radius:1px;content:"";height:2px;margin-top:-1px;position:absolute;top:50%;left:-4px;right:-4px}.tp-rslv_b{bottom:0;top:0;position:absolute}.tp-rslv_b::before{background-color:var(--in-fg);content:"";height:2px;margin-top:-1px;position:absolute;top:50%;left:0;right:0}.tp-rslv_k{height:calc(var(--bld-us) - 8px);margin-top:calc((var(--bld-us) - 8px)/-2);position:absolute;top:50%;width:8px}.tp-rslv_k.tp-rslv_k-min{margin-left:-8px}.tp-rslv_k.tp-rslv_k-max{margin-left:0}.tp-rslv.tp-rslv-zero .tp-rslv_k.tp-rslv_k-min{border-bottom-right-radius:0;border-top-right-radius:0}.tp-rslv.tp-rslv-zero .tp-rslv_k.tp-rslv_k-max{border-bottom-left-radius:0;border-top-left-radius:0}.tp-rsltxtv{display:flex}.tp-rsltxtv_s{flex:1}.tp-rsltxtv_t{flex:1;margin-left:4px}.tp-radv_l{display:block;position:relative}.tp-radv_i{left:0;opacity:0;position:absolute;top:0}.tp-radv_b{opacity:.5}.tp-radv_i:hover+.tp-radv_b{background-color:var(--btn-bg-h)}.tp-radv_i:focus+.tp-radv_b{background-color:var(--btn-bg-f)}.tp-radv_i:active+.tp-radv_b{background-color:var(--btn-bg-a)}.tp-radv_i:checked+.tp-radv_b{opacity:1}.tp-radv_t{bottom:0;color:inherit;left:0;overflow:hidden;position:absolute;right:0;text-align:center;text-overflow:ellipsis;top:0}.tp-radv_i:disabled+.tp-radv_b>.tp-radv_t{opacity:.5}.tp-radgridv{border-radius:var(--elm-br);display:grid;overflow:hidden;gap:2px}.tp-radgridv.tp-v-disabled{opacity:.5}.tp-radgridv .tp-radv_b{border-radius:0}',
  12153. accept(m) {
  12154. const o = he, p = ee(m, {
  12155. cells: o.required.function,
  12156. size: o.required.array(o.required.number),
  12157. view: o.required.constant("buttongrid"),
  12158. label: o.optional.string
  12159. });
  12160. return p ? { params: p } : null;
  12161. },
  12162. controller(m) {
  12163. return new st(m.document, {
  12164. blade: m.blade,
  12165. props: K.fromObject({
  12166. label: m.params.label
  12167. }),
  12168. valueController: new Pi(m.document, {
  12169. cellConfig: m.params.cells,
  12170. size: m.params.size
  12171. })
  12172. });
  12173. },
  12174. api(m) {
  12175. return !(m.controller instanceof st) || !(m.controller.valueController instanceof Pi) ? null : new _s(m.controller);
  12176. }
  12177. };
  12178. class ws extends s {
  12179. get label() {
  12180. return this.controller_.props.get("label");
  12181. }
  12182. set label(o) {
  12183. this.controller_.props.set("label", o);
  12184. }
  12185. get value() {
  12186. return this.controller_.valueController.value.rawValue;
  12187. }
  12188. set value(o) {
  12189. this.controller_.valueController.value.rawValue = o;
  12190. }
  12191. on(o, p) {
  12192. const f = p.bind(this);
  12193. return this.controller_.valueController.value.emitter.on(o, (x) => {
  12194. f(new c(this, x.rawValue, void 0, x.options.last));
  12195. }), this;
  12196. }
  12197. }
  12198. function qe(m, o, p) {
  12199. return m * (1 - p) + o * p;
  12200. }
  12201. const gr = 20, _r = 1e-3, Ti = 100;
  12202. function wr(m, o) {
  12203. let p = 0.25, f = 0.5, x = -1;
  12204. for (let P = 0; P < gr; P++) {
  12205. const [L2, z] = m.curve(f);
  12206. if (f += p * (L2 < o ? 1 : -1), x = z, p *= 0.5, Math.abs(o - L2) < _r)
  12207. break;
  12208. }
  12209. return x;
  12210. }
  12211. class Et {
  12212. constructor(o = 0, p = 0, f = 1, x = 1) {
  12213. this.cache_ = [], this.comps_ = [o, p, f, x];
  12214. }
  12215. get x1() {
  12216. return this.comps_[0];
  12217. }
  12218. get y1() {
  12219. return this.comps_[1];
  12220. }
  12221. get x2() {
  12222. return this.comps_[2];
  12223. }
  12224. get y2() {
  12225. return this.comps_[3];
  12226. }
  12227. static isObject(o) {
  12228. return h(o) || !Array.isArray(o) ? false : typeof o[0] == "number" && typeof o[1] == "number" && typeof o[2] == "number" && typeof o[3] == "number";
  12229. }
  12230. static equals(o, p) {
  12231. return o.x1 === p.x1 && o.y1 === p.y1 && o.x2 === p.x2 && o.y2 === p.y2;
  12232. }
  12233. curve(o) {
  12234. const p = qe(0, this.x1, o), f = qe(0, this.y1, o), x = qe(this.x1, this.x2, o), P = qe(this.y1, this.y2, o), L2 = qe(this.x2, 1, o), z = qe(this.y2, 1, o), oe = qe(p, x, o), Qe = qe(f, P, o), Ze = qe(x, L2, o), te = qe(P, z, o);
  12235. return [qe(oe, Ze, o), qe(Qe, te, o)];
  12236. }
  12237. y(o) {
  12238. if (this.cache_.length === 0) {
  12239. const p = [];
  12240. for (let f = 0; f < Ti; f++)
  12241. p.push(wr(this, Me(f, 0, Ti - 1, 0, 1)));
  12242. this.cache_ = p;
  12243. }
  12244. return this.cache_[Math.round(Me($t(o, 0, 1), 0, 1, 0, Ti - 1))];
  12245. }
  12246. toObject() {
  12247. return [this.comps_[0], this.comps_[1], this.comps_[2], this.comps_[3]];
  12248. }
  12249. }
  12250. const ki = {
  12251. toComponents: (m) => m.toObject(),
  12252. fromComponents: (m) => new Et(...m)
  12253. };
  12254. function yr(m) {
  12255. const o = Le(2);
  12256. return `cubic-bezier(${m.toObject().map((f) => o(f)).join(", ")})`;
  12257. }
  12258. const Mi = [0, 0.5, 0.5, 1];
  12259. function xr(m) {
  12260. const o = m.match(/^cubic-bezier\s*\(\s*([0-9.]+)\s*,\s*([0-9.]+)\s*,\s*([0-9.]+)\s*,\s*([0-9.]+)\s*\)$/);
  12261. if (!o)
  12262. return new Et(...Mi);
  12263. const p = [o[1], o[2], o[3], o[4]].reduce((f, x) => {
  12264. if (!f)
  12265. return null;
  12266. const P = Number(x);
  12267. return isNaN(P) ? null : [...f, P];
  12268. }, []);
  12269. return new Et(...p ?? Mi);
  12270. }
  12271. const It = y("cbz");
  12272. class ys {
  12273. constructor(o, p) {
  12274. this.element = o.createElement("div"), this.element.classList.add(It()), p.viewProps.bindClassModifiers(this.element), p.foldable.bindExpandedClass(this.element, It(void 0, "expanded")), R(p.foldable, "completed", F(this.element, It(void 0, "cpl")));
  12275. const f = o.createElement("div");
  12276. f.classList.add(It("h")), this.element.appendChild(f);
  12277. const x = o.createElement("button");
  12278. x.classList.add(It("b")), p.viewProps.bindDisabled(x);
  12279. const P = o.createElementNS(we, "svg");
  12280. P.innerHTML = '<path d="M2 13C8 13 8 3 14 3"/>', x.appendChild(P), f.appendChild(x), this.buttonElement = x;
  12281. const L2 = o.createElement("div");
  12282. if (L2.classList.add(It("t")), f.appendChild(L2), this.textElement = L2, p.pickerLayout === "inline") {
  12283. const z = o.createElement("div");
  12284. z.classList.add(It("p")), this.element.appendChild(z), this.pickerElement = z;
  12285. } else
  12286. this.pickerElement = null;
  12287. }
  12288. }
  12289. const Wn = y("cbzp");
  12290. class xs {
  12291. constructor(o, p) {
  12292. this.element = o.createElement("div"), this.element.classList.add(Wn()), p.viewProps.bindClassModifiers(this.element);
  12293. const f = o.createElement("div");
  12294. f.classList.add(Wn("g")), this.element.appendChild(f), this.graphElement = f;
  12295. const x = o.createElement("div");
  12296. x.classList.add(Wn("t")), this.element.appendChild(x), this.textElement = x;
  12297. }
  12298. }
  12299. function at(m, o) {
  12300. const p = new MutationObserver((x) => {
  12301. for (const P of x)
  12302. P.type === "childList" && P.addedNodes.forEach((L2) => {
  12303. L2.contains(L2) && (o(), p.disconnect());
  12304. });
  12305. }), f = m.ownerDocument;
  12306. p.observe(f.body, {
  12307. attributes: true,
  12308. childList: true,
  12309. subtree: true
  12310. });
  12311. }
  12312. const vt = y("cbzg");
  12313. function Er(m, o) {
  12314. return (p) => o(m(p));
  12315. }
  12316. class Re {
  12317. constructor(o, p) {
  12318. this.element = o.createElement("div"), this.element.classList.add(vt()), p.viewProps.bindClassModifiers(this.element), p.viewProps.bindTabIndex(this.element);
  12319. const f = o.createElement("div");
  12320. f.classList.add(vt("p")), this.element.appendChild(f), this.previewElement = f;
  12321. const x = o.createElementNS(we, "svg");
  12322. x.classList.add(vt("g")), this.element.appendChild(x), this.svgElem_ = x;
  12323. const P = o.createElementNS(we, "path");
  12324. P.classList.add(vt("u")), this.svgElem_.appendChild(P), this.guideElem_ = P;
  12325. const L2 = o.createElementNS(we, "polyline");
  12326. L2.classList.add(vt("l")), this.svgElem_.appendChild(L2), this.lineElem_ = L2, this.handleElems_ = [o.createElement("div"), o.createElement("div")], this.handleElems_.forEach((z) => {
  12327. z.classList.add(vt("h")), this.element.appendChild(z);
  12328. }), this.vectorElems_ = [
  12329. o.createElementNS(we, "line"),
  12330. o.createElementNS(we, "line")
  12331. ], this.vectorElems_.forEach((z) => {
  12332. z.classList.add(vt("v")), this.svgElem_.appendChild(z);
  12333. }), this.value_ = p.value, this.value_.emitter.on("change", this.onValueChange_.bind(this)), this.sel_ = p.selection, this.handleElems_.forEach((z, oe) => {
  12334. S(this.sel_, Er((Qe) => Qe === oe, F(z, vt("h", "sel"))));
  12335. }), at(this.element, () => {
  12336. this.refresh();
  12337. });
  12338. }
  12339. getVertMargin_(o) {
  12340. return o * 0.25;
  12341. }
  12342. valueToPosition(o, p) {
  12343. const f = this.element.getBoundingClientRect(), x = f.width, P = f.height, L2 = this.getVertMargin_(P);
  12344. return {
  12345. x: Me(o, 0, 1, 0, x),
  12346. y: Me(p, 0, 1, P - L2, L2)
  12347. };
  12348. }
  12349. positionToValue(o, p) {
  12350. const f = this.element.getBoundingClientRect(), x = f.width, P = f.height, L2 = this.getVertMargin_(P);
  12351. return {
  12352. x: $t(Me(o, 0, x, 0, 1), 0, 1),
  12353. y: Me(p, P - L2, L2, 0, 1)
  12354. };
  12355. }
  12356. refresh() {
  12357. this.guideElem_.setAttributeNS(null, "d", [0, 1].map((P) => {
  12358. const L2 = this.valueToPosition(0, P), z = this.valueToPosition(1, P);
  12359. return [`M ${L2.x},${L2.y}`, `L ${z.x},${z.y}`].join(" ");
  12360. }).join(" "));
  12361. const o = this.value_.rawValue, p = [];
  12362. let f = 0;
  12363. for (; ; ) {
  12364. const P = this.valueToPosition(...o.curve(f));
  12365. if (p.push([P.x, P.y].join(",")), f >= 1)
  12366. break;
  12367. f = Math.min(f + 0.05, 1);
  12368. }
  12369. this.lineElem_.setAttributeNS(null, "points", p.join(" "));
  12370. const x = o.toObject();
  12371. [0, 1].forEach((P) => {
  12372. const L2 = this.valueToPosition(P, P), z = this.valueToPosition(x[P * 2], x[P * 2 + 1]), oe = this.vectorElems_[P];
  12373. oe.setAttributeNS(null, "x1", String(L2.x)), oe.setAttributeNS(null, "y1", String(L2.y)), oe.setAttributeNS(null, "x2", String(z.x)), oe.setAttributeNS(null, "y2", String(z.y));
  12374. const Qe = this.handleElems_[P];
  12375. Qe.style.left = `${z.x}px`, Qe.style.top = `${z.y}px`;
  12376. });
  12377. }
  12378. onValueChange_() {
  12379. this.refresh();
  12380. }
  12381. }
  12382. const Es = 24, _n = 400, Si = 1e3, Ct = y("cbzprv");
  12383. class qt {
  12384. constructor(o, p) {
  12385. this.stopped_ = true, this.startTime_ = -1, this.onDispose_ = this.onDispose_.bind(this), this.onTimer_ = this.onTimer_.bind(this), this.onValueChange_ = this.onValueChange_.bind(this), this.element = o.createElement("div"), this.element.classList.add(Ct()), p.viewProps.bindClassModifiers(this.element);
  12386. const f = o.createElementNS(we, "svg");
  12387. f.classList.add(Ct("g")), this.element.appendChild(f), this.svgElem_ = f;
  12388. const x = o.createElementNS(we, "path");
  12389. x.classList.add(Ct("t")), this.svgElem_.appendChild(x), this.ticksElem_ = x;
  12390. const P = o.createElement("div");
  12391. P.classList.add(Ct("m")), this.element.appendChild(P), this.markerElem_ = P, this.value_ = p.value, this.value_.emitter.on("change", this.onValueChange_), p.viewProps.handleDispose(this.onDispose_), at(this.element, () => {
  12392. this.refresh();
  12393. });
  12394. }
  12395. play() {
  12396. this.stop(), this.updateMarker_(0), this.markerElem_.classList.add(Ct("m", "a")), this.startTime_ = new Date().getTime() + _n, this.stopped_ = false, requestAnimationFrame(this.onTimer_);
  12397. }
  12398. stop() {
  12399. this.stopped_ = true, this.markerElem_.classList.remove(Ct("m", "a"));
  12400. }
  12401. onDispose_() {
  12402. this.stop();
  12403. }
  12404. updateMarker_(o) {
  12405. const p = this.value_.rawValue.y($t(o, 0, 1));
  12406. this.markerElem_.style.left = `${p * 100}%`;
  12407. }
  12408. refresh() {
  12409. const o = this.svgElem_.getBoundingClientRect(), p = o.width, f = o.height, x = [], P = this.value_.rawValue;
  12410. for (let L2 = 0; L2 < Es; L2++) {
  12411. const z = Me(L2, 0, Es - 1, 0, 1), oe = Me(P.y(z), 0, 1, 0, p);
  12412. x.push(`M ${oe},0 v${f}`);
  12413. }
  12414. this.ticksElem_.setAttributeNS(null, "d", x.join(" "));
  12415. }
  12416. onTimer_() {
  12417. if (this.startTime_ === null)
  12418. return;
  12419. const o = new Date().getTime() - this.startTime_, p = o / Si;
  12420. this.updateMarker_(p), o > Si + _n && this.stop(), this.stopped_ || requestAnimationFrame(this.onTimer_);
  12421. }
  12422. onValueChange_() {
  12423. this.refresh(), this.play();
  12424. }
  12425. }
  12426. function Oe(m, o, p, f) {
  12427. const x = p - m, P = f - o;
  12428. return Math.sqrt(x * x + P * P);
  12429. }
  12430. function wn(m, o, p, f) {
  12431. const x = Oe(m, o, p, f), P = Math.atan2(f - o, p - m), L2 = Math.round(P / (Math.PI / 4)) * Math.PI / 4;
  12432. return {
  12433. x: m + Math.cos(L2) * x,
  12434. y: o + Math.sin(L2) * x
  12435. };
  12436. }
  12437. class lt {
  12438. constructor(o, p) {
  12439. this.onKeyDown_ = this.onKeyDown_.bind(this), this.onKeyUp_ = this.onKeyUp_.bind(this), this.onPointerDown_ = this.onPointerDown_.bind(this), this.onPointerMove_ = this.onPointerMove_.bind(this), this.onPointerUp_ = this.onPointerUp_.bind(this), this.baseStep_ = p.baseStep, this.value = p.value, this.sel_ = H(0), this.viewProps = p.viewProps, this.view = new Re(o, {
  12440. selection: this.sel_,
  12441. value: this.value,
  12442. viewProps: this.viewProps
  12443. }), this.view.element.addEventListener("keydown", this.onKeyDown_), this.view.element.addEventListener("keyup", this.onKeyUp_), this.prevView_ = new qt(o, {
  12444. value: this.value,
  12445. viewProps: this.viewProps
  12446. }), this.prevView_.element.addEventListener("mousedown", (x) => {
  12447. x.stopImmediatePropagation(), x.preventDefault(), this.prevView_.play();
  12448. }), this.view.previewElement.appendChild(this.prevView_.element);
  12449. const f = new qn(this.view.element);
  12450. f.emitter.on("down", this.onPointerDown_), f.emitter.on("move", this.onPointerMove_), f.emitter.on("up", this.onPointerUp_);
  12451. }
  12452. refresh() {
  12453. this.view.refresh(), this.prevView_.refresh(), this.prevView_.play();
  12454. }
  12455. updateValue_(o, p, f) {
  12456. const x = this.sel_.rawValue, P = this.value.rawValue.toObject(), L2 = this.view.positionToValue(o.x, o.y), z = p ? wn(x, x, L2.x, L2.y) : L2;
  12457. P[x * 2] = z.x, P[x * 2 + 1] = z.y, this.value.setRawValue(new Et(...P), f);
  12458. }
  12459. onPointerDown_(o) {
  12460. const p = o.data;
  12461. if (!p.point)
  12462. return;
  12463. const f = this.value.rawValue, x = this.view.valueToPosition(f.x1, f.y1), P = Oe(p.point.x, p.point.y, x.x, x.y), L2 = this.view.valueToPosition(f.x2, f.y2), z = Oe(p.point.x, p.point.y, L2.x, L2.y);
  12464. this.sel_.rawValue = P <= z ? 0 : 1, this.updateValue_(p.point, o.shiftKey, {
  12465. forceEmit: false,
  12466. last: false
  12467. });
  12468. }
  12469. onPointerMove_(o) {
  12470. const p = o.data;
  12471. p.point && this.updateValue_(p.point, o.shiftKey, {
  12472. forceEmit: false,
  12473. last: false
  12474. });
  12475. }
  12476. onPointerUp_(o) {
  12477. const p = o.data;
  12478. p.point && this.updateValue_(p.point, o.shiftKey, {
  12479. forceEmit: true,
  12480. last: true
  12481. });
  12482. }
  12483. onKeyDown_(o) {
  12484. ls(o.key) && o.preventDefault();
  12485. const p = this.sel_.rawValue, f = this.value.rawValue.toObject();
  12486. f[p * 2] += Kt(this.baseStep_, yi(o)), f[p * 2 + 1] += Kt(this.baseStep_, mn(o)), this.value.setRawValue(new Et(...f), {
  12487. forceEmit: false,
  12488. last: false
  12489. });
  12490. }
  12491. onKeyUp_(o) {
  12492. ls(o.key) && o.preventDefault();
  12493. const p = Kt(this.baseStep_, yi(o)), f = Kt(this.baseStep_, mn(o));
  12494. p === 0 && f === 0 || this.value.setRawValue(this.value.rawValue, {
  12495. forceEmit: true,
  12496. last: true
  12497. });
  12498. }
  12499. }
  12500. class Cs {
  12501. constructor(o, p) {
  12502. this.value = p.value, this.viewProps = p.viewProps, this.view = new xs(o, {
  12503. viewProps: this.viewProps
  12504. }), this.gc_ = new lt(o, {
  12505. baseStep: p.axis.baseStep,
  12506. value: this.value,
  12507. viewProps: this.viewProps
  12508. }), this.view.graphElement.appendChild(this.gc_.view.element);
  12509. const f = Object.assign(Object.assign({}, p.axis), { constraint: new At({ max: 1, min: 0 }) }), x = Object.assign(Object.assign({}, p.axis), { constraint: void 0 });
  12510. this.tc_ = new Rt(o, {
  12511. assembly: ki,
  12512. axes: [f, x, f, x],
  12513. parser: dn,
  12514. value: this.value,
  12515. viewProps: this.viewProps
  12516. }), this.view.textElement.appendChild(this.tc_.view.element);
  12517. }
  12518. get allFocusableElements() {
  12519. return [
  12520. this.gc_.view.element,
  12521. ...this.tc_.view.textViews.map((o) => o.inputElement)
  12522. ];
  12523. }
  12524. refresh() {
  12525. this.gc_.refresh();
  12526. }
  12527. }
  12528. class Jn {
  12529. constructor(o, p) {
  12530. this.onButtonBlur_ = this.onButtonBlur_.bind(this), this.onButtonClick_ = this.onButtonClick_.bind(this), this.onPopupChildBlur_ = this.onPopupChildBlur_.bind(this), this.onPopupChildKeydown_ = this.onPopupChildKeydown_.bind(this), this.value = p.value, this.viewProps = p.viewProps, this.foldable_ = zn(p.expanded), this.view = new ys(o, {
  12531. foldable: this.foldable_,
  12532. pickerLayout: p.pickerLayout,
  12533. viewProps: this.viewProps
  12534. }), this.view.buttonElement.addEventListener("blur", this.onButtonBlur_), this.view.buttonElement.addEventListener("click", this.onButtonClick_), this.tc_ = new Ut(o, {
  12535. parser: xr,
  12536. props: K.fromObject({
  12537. formatter: yr
  12538. }),
  12539. value: this.value,
  12540. viewProps: this.viewProps
  12541. }), this.view.textElement.appendChild(this.tc_.view.element), this.popC_ = p.pickerLayout === "popup" ? new ie(o, {
  12542. viewProps: this.viewProps
  12543. }) : null;
  12544. const f = new Cs(o, {
  12545. axis: p.axis,
  12546. value: this.value,
  12547. viewProps: this.viewProps
  12548. });
  12549. f.allFocusableElements.forEach((x) => {
  12550. x.addEventListener("blur", this.onPopupChildBlur_), x.addEventListener("keydown", this.onPopupChildKeydown_);
  12551. }), this.pickerC_ = f, this.popC_ ? (this.view.element.appendChild(this.popC_.view.element), this.popC_.view.element.appendChild(this.pickerC_.view.element), S(this.popC_.shows, (x) => {
  12552. x && f.refresh();
  12553. }), Ht({
  12554. primary: this.foldable_.value("expanded"),
  12555. secondary: this.popC_.shows,
  12556. forward: (x) => x.rawValue,
  12557. backward: (x, P) => P.rawValue
  12558. })) : this.view.pickerElement && (this.view.pickerElement.appendChild(this.pickerC_.view.element), Gn(this.foldable_, this.view.pickerElement));
  12559. }
  12560. onButtonBlur_(o) {
  12561. if (!this.popC_)
  12562. return;
  12563. const p = o.relatedTarget;
  12564. (!p || !this.popC_.view.element.contains(p)) && (this.popC_.shows.rawValue = false);
  12565. }
  12566. onButtonClick_() {
  12567. this.foldable_.set("expanded", !this.foldable_.get("expanded")), this.foldable_.get("expanded") && this.pickerC_.allFocusableElements[0].focus();
  12568. }
  12569. onPopupChildBlur_(o) {
  12570. if (!this.popC_)
  12571. return;
  12572. const p = this.popC_.view.element, f = an(o);
  12573. f && p.contains(f) || f && f === this.view.buttonElement && !Xe(p.ownerDocument) || (this.popC_.shows.rawValue = false);
  12574. }
  12575. onPopupChildKeydown_(o) {
  12576. this.popC_ && o.key === "Escape" && (this.popC_.shows.rawValue = false);
  12577. }
  12578. }
  12579. function Ai() {
  12580. return new ur({
  12581. assembly: ki,
  12582. components: [0, 1, 2, 3].map((m) => m % 2 === 0 ? new At({
  12583. min: 0,
  12584. max: 1
  12585. }) : void 0)
  12586. });
  12587. }
  12588. const Vt = {
  12589. id: "cubic-bezier",
  12590. type: "blade",
  12591. css: '.tp-cbzgv,.tp-radv_b,.tp-rslv_k,.tp-cbzv_b{-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:rgba(0,0,0,0);border-width:0;font-family:inherit;font-size:inherit;font-weight:inherit;margin:0;outline:none;padding:0}.tp-radv_b,.tp-rslv_k,.tp-cbzv_b{background-color:var(--btn-bg);border-radius:var(--elm-br);color:var(--btn-fg);cursor:pointer;display:block;font-weight:bold;height:var(--bld-us);line-height:var(--bld-us);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.tp-radv_b:hover,.tp-rslv_k:hover,.tp-cbzv_b:hover{background-color:var(--btn-bg-h)}.tp-radv_b:focus,.tp-rslv_k:focus,.tp-cbzv_b:focus{background-color:var(--btn-bg-f)}.tp-radv_b:active,.tp-rslv_k:active,.tp-cbzv_b:active{background-color:var(--btn-bg-a)}.tp-radv_b:disabled,.tp-rslv_k:disabled,.tp-cbzv_b:disabled{opacity:.5}.tp-cbzgv{background-color:var(--in-bg);border-radius:var(--elm-br);box-sizing:border-box;color:var(--in-fg);font-family:inherit;height:var(--bld-us);line-height:var(--bld-us);min-width:0;width:100%}.tp-cbzgv:hover{background-color:var(--in-bg-h)}.tp-cbzgv:focus{background-color:var(--in-bg-f)}.tp-cbzgv:active{background-color:var(--in-bg-a)}.tp-cbzgv:disabled{opacity:.5}.tp-btngridv{border-radius:var(--elm-br);display:grid;overflow:hidden;gap:2px}.tp-btngridv.tp-v-disabled{opacity:.5}.tp-btngridv .tp-btnv_b:disabled{opacity:1}.tp-btngridv .tp-btnv_b:disabled .tp-btnv_t{opacity:.5}.tp-btngridv .tp-btnv_b{border-radius:0}.tp-cbzv{position:relative}.tp-cbzv_h{display:flex}.tp-cbzv_b{margin-right:4px;position:relative;width:var(--bld-us)}.tp-cbzv_b svg{display:block;height:16px;left:50%;margin-left:-8px;margin-top:-8px;position:absolute;top:50%;width:16px}.tp-cbzv_b svg path{stroke:var(--bs-bg);stroke-width:2}.tp-cbzv_t{flex:1}.tp-cbzv_p{height:0;margin-top:0;opacity:0;overflow:hidden;transition:height .2s ease-in-out,opacity .2s linear,margin .2s ease-in-out}.tp-cbzv.tp-cbzv-expanded .tp-cbzv_p{margin-top:var(--bld-s);opacity:1}.tp-cbzv.tp-cbzv-cpl .tp-cbzv_p{overflow:visible}.tp-cbzv .tp-popv{left:calc(-1*var(--cnt-h-p));position:absolute;right:calc(-1*var(--cnt-h-p));top:var(--bld-us)}.tp-cbzpv_t{margin-top:var(--bld-s)}.tp-cbzgv{height:auto;overflow:hidden;position:relative}.tp-cbzgv.tp-v-disabled{opacity:.5}.tp-cbzgv_p{left:16px;position:absolute;right:16px;top:0}.tp-cbzgv_g{cursor:pointer;display:block;height:calc(var(--bld-us)*5);width:100%}.tp-cbzgv_u{opacity:.1;stroke:var(--in-fg);stroke-dasharray:1}.tp-cbzgv_l{fill:rgba(0,0,0,0);stroke:var(--in-fg)}.tp-cbzgv_v{opacity:.5;stroke:var(--in-fg);stroke-dasharray:1}.tp-cbzgv_h{border:var(--in-fg) solid 1px;border-radius:50%;box-sizing:border-box;height:4px;margin-left:-2px;margin-top:-2px;pointer-events:none;position:absolute;width:4px}.tp-cbzgv:focus .tp-cbzgv_h-sel{background-color:var(--in-fg);border-width:0}.tp-cbzprvv{cursor:pointer;height:4px;padding:4px 0;position:relative}.tp-cbzprvv_g{display:block;height:100%;overflow:visible;width:100%}.tp-cbzprvv_t{opacity:.5;stroke:var(--mo-fg)}.tp-cbzprvv_m{background-color:var(--mo-fg);border-radius:50%;height:4px;margin-left:-2px;margin-top:-2px;opacity:0;position:absolute;top:50%;transition:opacity .2s ease-out;width:4px}.tp-cbzprvv_m.tp-cbzprvv_m-a{opacity:1}.tp-fpsv{position:relative}.tp-fpsv_l{bottom:4px;color:var(--mo-fg);line-height:1;right:4px;pointer-events:none;position:absolute}.tp-fpsv_u{margin-left:.2em;opacity:.7}.tp-rslv{cursor:pointer;padding-left:8px;padding-right:8px}.tp-rslv.tp-v-disabled{opacity:.5}.tp-rslv_t{height:calc(var(--bld-us));position:relative}.tp-rslv_t::before{background-color:var(--in-bg);border-radius:1px;content:"";height:2px;margin-top:-1px;position:absolute;top:50%;left:-4px;right:-4px}.tp-rslv_b{bottom:0;top:0;position:absolute}.tp-rslv_b::before{background-color:var(--in-fg);content:"";height:2px;margin-top:-1px;position:absolute;top:50%;left:0;right:0}.tp-rslv_k{height:calc(var(--bld-us) - 8px);margin-top:calc((var(--bld-us) - 8px)/-2);position:absolute;top:50%;width:8px}.tp-rslv_k.tp-rslv_k-min{margin-left:-8px}.tp-rslv_k.tp-rslv_k-max{margin-left:0}.tp-rslv.tp-rslv-zero .tp-rslv_k.tp-rslv_k-min{border-bottom-right-radius:0;border-top-right-radius:0}.tp-rslv.tp-rslv-zero .tp-rslv_k.tp-rslv_k-max{border-bottom-left-radius:0;border-top-left-radius:0}.tp-rsltxtv{display:flex}.tp-rsltxtv_s{flex:1}.tp-rsltxtv_t{flex:1;margin-left:4px}.tp-radv_l{display:block;position:relative}.tp-radv_i{left:0;opacity:0;position:absolute;top:0}.tp-radv_b{opacity:.5}.tp-radv_i:hover+.tp-radv_b{background-color:var(--btn-bg-h)}.tp-radv_i:focus+.tp-radv_b{background-color:var(--btn-bg-f)}.tp-radv_i:active+.tp-radv_b{background-color:var(--btn-bg-a)}.tp-radv_i:checked+.tp-radv_b{opacity:1}.tp-radv_t{bottom:0;color:inherit;left:0;overflow:hidden;position:absolute;right:0;text-align:center;text-overflow:ellipsis;top:0}.tp-radv_i:disabled+.tp-radv_b>.tp-radv_t{opacity:.5}.tp-radgridv{border-radius:var(--elm-br);display:grid;overflow:hidden;gap:2px}.tp-radgridv.tp-v-disabled{opacity:.5}.tp-radgridv .tp-radv_b{border-radius:0}',
  12592. accept(m) {
  12593. const o = he, p = ee(m, {
  12594. value: o.required.array(o.required.number),
  12595. view: o.required.constant("cubicbezier"),
  12596. expanded: o.optional.boolean,
  12597. label: o.optional.string,
  12598. picker: o.optional.custom((f) => f === "inline" || f === "popup" ? f : void 0)
  12599. });
  12600. return p ? { params: p } : null;
  12601. },
  12602. controller(m) {
  12603. var o, p;
  12604. const f = new Et(...m.params.value), x = H(f, {
  12605. constraint: Ai(),
  12606. equals: Et.equals
  12607. }), P = new Jn(m.document, {
  12608. axis: {
  12609. baseStep: 0.1,
  12610. textProps: K.fromObject({
  12611. draggingScale: 0.01,
  12612. formatter: Le(2)
  12613. })
  12614. },
  12615. expanded: (o = m.params.expanded) !== null && o !== void 0 ? o : false,
  12616. pickerLayout: (p = m.params.picker) !== null && p !== void 0 ? p : "popup",
  12617. value: x,
  12618. viewProps: m.viewProps
  12619. });
  12620. return new St(m.document, {
  12621. blade: m.blade,
  12622. props: K.fromObject({
  12623. label: m.params.label
  12624. }),
  12625. valueController: P
  12626. });
  12627. },
  12628. api(m) {
  12629. return !(m.controller instanceof St) || !(m.controller.valueController instanceof Jn) ? null : new ws(m.controller);
  12630. }
  12631. };
  12632. class _e extends s {
  12633. begin() {
  12634. this.controller_.valueController.begin();
  12635. }
  12636. end() {
  12637. this.controller_.valueController.end();
  12638. }
  12639. }
  12640. const Li = 20;
  12641. class Se {
  12642. constructor() {
  12643. this.start_ = null, this.duration_ = 0, this.fps_ = null, this.frameCount_ = 0, this.timestamps_ = [];
  12644. }
  12645. get duration() {
  12646. return this.duration_;
  12647. }
  12648. get fps() {
  12649. return this.fps_;
  12650. }
  12651. begin(o) {
  12652. this.start_ = o.getTime();
  12653. }
  12654. calculateFps_(o) {
  12655. if (this.timestamps_.length === 0)
  12656. return null;
  12657. const p = this.timestamps_[0];
  12658. return 1e3 * (this.frameCount_ - p.frameCount) / (o - p.time);
  12659. }
  12660. compactTimestamps_() {
  12661. if (this.timestamps_.length <= Li)
  12662. return;
  12663. const o = this.timestamps_.length - Li;
  12664. this.timestamps_.splice(0, o);
  12665. const p = this.timestamps_[0].frameCount;
  12666. this.timestamps_.forEach((f) => {
  12667. f.frameCount -= p;
  12668. }), this.frameCount_ -= p;
  12669. }
  12670. end(o) {
  12671. if (this.start_ === null)
  12672. return;
  12673. const p = o.getTime();
  12674. this.duration_ = p - this.start_, this.start_ = null, this.fps_ = this.calculateFps_(p), this.timestamps_.push({
  12675. frameCount: this.frameCount_,
  12676. time: p
  12677. }), ++this.frameCount_, this.compactTimestamps_();
  12678. }
  12679. }
  12680. const Qt = y("fps");
  12681. class He {
  12682. constructor(o, p) {
  12683. this.element = o.createElement("div"), this.element.classList.add(Qt()), p.viewProps.bindClassModifiers(this.element), this.graphElement = o.createElement("div"), this.graphElement.classList.add(Qt("g")), this.element.appendChild(this.graphElement);
  12684. const f = o.createElement("div");
  12685. f.classList.add(Qt("l")), this.element.appendChild(f);
  12686. const x = o.createElement("span");
  12687. x.classList.add(Qt("v")), x.textContent = "--", f.appendChild(x), this.valueElement = x;
  12688. const P = o.createElement("span");
  12689. P.classList.add(Qt("u")), P.textContent = "FPS", f.appendChild(P);
  12690. }
  12691. }
  12692. class Ri {
  12693. constructor(o, p) {
  12694. this.stopwatch_ = new Se(), this.onTick_ = this.onTick_.bind(this), this.ticker_ = p.ticker, this.ticker_.emitter.on("tick", this.onTick_), this.value_ = p.value, this.viewProps = p.viewProps, this.view = new He(o, {
  12695. viewProps: this.viewProps
  12696. }), this.graphC_ = new fr(o, {
  12697. formatter: Le(0),
  12698. lineCount: p.lineCount,
  12699. props: K.fromObject({
  12700. maxValue: p.maxValue,
  12701. minValue: p.minValue
  12702. }),
  12703. value: this.value_,
  12704. viewProps: this.viewProps
  12705. }), this.view.graphElement.appendChild(this.graphC_.view.element), this.viewProps.handleDispose(() => {
  12706. this.graphC_.viewProps.set("disposed", true), this.ticker_.dispose();
  12707. });
  12708. }
  12709. begin() {
  12710. this.stopwatch_.begin(new Date());
  12711. }
  12712. end() {
  12713. this.stopwatch_.end(new Date());
  12714. }
  12715. onTick_() {
  12716. const o = this.stopwatch_.fps;
  12717. if (o !== null) {
  12718. const p = this.value_.rawValue;
  12719. this.value_.rawValue = ir(p, o), this.view.valueElement.textContent = o.toFixed(0);
  12720. }
  12721. }
  12722. }
  12723. function yn(m, o) {
  12724. return o === 0 ? new Hn() : new cn(m, o ?? mr.monitor.defaultInterval);
  12725. }
  12726. const Ii = {
  12727. id: "fpsgraph",
  12728. type: "blade",
  12729. accept(m) {
  12730. const o = he, p = ee(m, {
  12731. view: o.required.constant("fpsgraph"),
  12732. interval: o.optional.number,
  12733. label: o.optional.string,
  12734. lineCount: o.optional.number,
  12735. max: o.optional.number,
  12736. min: o.optional.number
  12737. });
  12738. return p ? { params: p } : null;
  12739. },
  12740. controller(m) {
  12741. var o, p, f, x;
  12742. const P = (o = m.params.interval) !== null && o !== void 0 ? o : 500;
  12743. return new st(m.document, {
  12744. blade: m.blade,
  12745. props: K.fromObject({
  12746. label: m.params.label
  12747. }),
  12748. valueController: new Ri(m.document, {
  12749. lineCount: (p = m.params.lineCount) !== null && p !== void 0 ? p : 2,
  12750. maxValue: (f = m.params.max) !== null && f !== void 0 ? f : 90,
  12751. minValue: (x = m.params.min) !== null && x !== void 0 ? x : 0,
  12752. ticker: yn(m.document, P),
  12753. value: os(80),
  12754. viewProps: m.viewProps
  12755. })
  12756. });
  12757. },
  12758. api(m) {
  12759. return !(m.controller instanceof st) || !(m.controller.valueController instanceof Ri) ? null : new _e(m.controller);
  12760. }
  12761. };
  12762. class Ke {
  12763. constructor(o, p) {
  12764. this.min = o, this.max = p;
  12765. }
  12766. static isObject(o) {
  12767. if (typeof o != "object" || o === null)
  12768. return false;
  12769. const p = o.min, f = o.max;
  12770. return !(typeof p != "number" || typeof f != "number");
  12771. }
  12772. static equals(o, p) {
  12773. return o.min === p.min && o.max === p.max;
  12774. }
  12775. get length() {
  12776. return this.max - this.min;
  12777. }
  12778. toObject() {
  12779. return {
  12780. min: this.min,
  12781. max: this.max
  12782. };
  12783. }
  12784. }
  12785. const Vi = {
  12786. fromComponents: (m) => new Ke(m[0], m[1]),
  12787. toComponents: (m) => [m.min, m.max]
  12788. };
  12789. class xn {
  12790. constructor(o) {
  12791. this.edge = o;
  12792. }
  12793. constrain(o) {
  12794. var p, f, x, P, L2, z, oe, Qe;
  12795. if (o.min <= o.max)
  12796. return new Ke((f = (p = this.edge) === null || p === void 0 ? void 0 : p.constrain(o.min)) !== null && f !== void 0 ? f : o.min, (P = (x = this.edge) === null || x === void 0 ? void 0 : x.constrain(o.max)) !== null && P !== void 0 ? P : o.max);
  12797. const Ze = (o.min + o.max) / 2;
  12798. return new Ke((z = (L2 = this.edge) === null || L2 === void 0 ? void 0 : L2.constrain(Ze)) !== null && z !== void 0 ? z : Ze, (Qe = (oe = this.edge) === null || oe === void 0 ? void 0 : oe.constrain(Ze)) !== null && Qe !== void 0 ? Qe : Ze);
  12799. }
  12800. }
  12801. const Di = y("rsltxt");
  12802. class ei {
  12803. constructor(o, p) {
  12804. this.sliderView_ = p.sliderView, this.textView_ = p.textView, this.element = o.createElement("div"), this.element.classList.add(Di());
  12805. const f = o.createElement("div");
  12806. f.classList.add(Di("s")), f.appendChild(this.sliderView_.element), this.element.appendChild(f);
  12807. const x = o.createElement("div");
  12808. x.classList.add(Di("t")), x.appendChild(this.textView_.element), this.element.appendChild(x);
  12809. }
  12810. }
  12811. const tt = y("rsl");
  12812. class En {
  12813. constructor(o, p) {
  12814. this.onSliderPropsChange_ = this.onSliderPropsChange_.bind(this), this.onValueChange_ = this.onValueChange_.bind(this), this.sliderProps_ = p.sliderProps, this.sliderProps_.emitter.on("change", this.onSliderPropsChange_), this.element = o.createElement("div"), this.element.classList.add(tt()), p.viewProps.bindClassModifiers(this.element), this.value_ = p.value, this.value_.emitter.on("change", this.onValueChange_);
  12815. const f = o.createElement("div");
  12816. f.classList.add(tt("t")), this.element.appendChild(f), this.trackElement = f;
  12817. const x = o.createElement("div");
  12818. x.classList.add(tt("b")), f.appendChild(x), this.barElement = x;
  12819. const P = ["min", "max"].map((L2) => {
  12820. const z = o.createElement("div");
  12821. return z.classList.add(tt("k"), tt("k", L2)), f.appendChild(z), z;
  12822. });
  12823. this.knobElements = [P[0], P[1]], this.update_();
  12824. }
  12825. valueToX_(o) {
  12826. const p = this.sliderProps_.get("minValue"), f = this.sliderProps_.get("maxValue");
  12827. return $t(Me(o, p, f, 0, 1), 0, 1) * 100;
  12828. }
  12829. update_() {
  12830. const o = this.value_.rawValue;
  12831. o.length === 0 ? this.element.classList.add(tt(void 0, "zero")) : this.element.classList.remove(tt(void 0, "zero"));
  12832. const p = [this.valueToX_(o.min), this.valueToX_(o.max)];
  12833. this.barElement.style.left = `${p[0]}%`, this.barElement.style.right = `${100 - p[1]}%`, this.knobElements.forEach((f, x) => {
  12834. f.style.left = `${p[x]}%`;
  12835. });
  12836. }
  12837. onSliderPropsChange_() {
  12838. this.update_();
  12839. }
  12840. onValueChange_() {
  12841. this.update_();
  12842. }
  12843. }
  12844. class Oi {
  12845. constructor(o, p) {
  12846. this.grabbing_ = null, this.grabOffset_ = 0, this.onPointerDown_ = this.onPointerDown_.bind(this), this.onPointerMove_ = this.onPointerMove_.bind(this), this.onPointerUp_ = this.onPointerUp_.bind(this), this.sliderProps = p.sliderProps, this.viewProps = p.viewProps, this.value = p.value, this.view = new En(o, {
  12847. sliderProps: this.sliderProps,
  12848. value: this.value,
  12849. viewProps: p.viewProps
  12850. });
  12851. const f = new qn(this.view.trackElement);
  12852. f.emitter.on("down", this.onPointerDown_), f.emitter.on("move", this.onPointerMove_), f.emitter.on("up", this.onPointerUp_);
  12853. }
  12854. ofs_() {
  12855. return this.grabbing_ === "min" ? this.view.knobElements[0].getBoundingClientRect().width / 2 : this.grabbing_ === "max" ? -this.view.knobElements[1].getBoundingClientRect().width / 2 : 0;
  12856. }
  12857. valueFromData_(o) {
  12858. if (!o.point)
  12859. return null;
  12860. const p = (o.point.x + this.ofs_()) / o.bounds.width, f = this.sliderProps.get("minValue"), x = this.sliderProps.get("maxValue");
  12861. return Me(p, 0, 1, f, x);
  12862. }
  12863. onPointerDown_(o) {
  12864. if (!o.data.point)
  12865. return;
  12866. const p = o.data.point.x / o.data.bounds.width, f = this.value.rawValue, x = this.sliderProps.get("minValue"), P = this.sliderProps.get("maxValue"), L2 = Me(f.min, x, P, 0, 1), z = Me(f.max, x, P, 0, 1);
  12867. Math.abs(z - p) <= 0.025 ? this.grabbing_ = "max" : Math.abs(L2 - p) <= 0.025 ? this.grabbing_ = "min" : p >= L2 && p <= z ? (this.grabbing_ = "length", this.grabOffset_ = Me(p - L2, 0, 1, 0, P - x)) : p < L2 ? (this.grabbing_ = "min", this.onPointerMove_(o)) : p > z && (this.grabbing_ = "max", this.onPointerMove_(o));
  12868. }
  12869. applyPointToValue_(o, p) {
  12870. const f = this.valueFromData_(o);
  12871. if (f === null)
  12872. return;
  12873. const x = this.sliderProps.get("minValue"), P = this.sliderProps.get("maxValue");
  12874. if (this.grabbing_ === "min")
  12875. this.value.setRawValue(new Ke(f, this.value.rawValue.max), p);
  12876. else if (this.grabbing_ === "max")
  12877. this.value.setRawValue(new Ke(this.value.rawValue.min, f), p);
  12878. else if (this.grabbing_ === "length") {
  12879. const L2 = this.value.rawValue.length;
  12880. let z = f - this.grabOffset_, oe = z + L2;
  12881. z < x ? (z = x, oe = x + L2) : oe > P && (z = P - L2, oe = P), this.value.setRawValue(new Ke(z, oe), p);
  12882. }
  12883. }
  12884. onPointerMove_(o) {
  12885. this.applyPointToValue_(o.data, {
  12886. forceEmit: false,
  12887. last: false
  12888. });
  12889. }
  12890. onPointerUp_(o) {
  12891. this.applyPointToValue_(o.data, {
  12892. forceEmit: true,
  12893. last: true
  12894. }), this.grabbing_ = null;
  12895. }
  12896. }
  12897. class bt {
  12898. constructor(o, p) {
  12899. this.value = p.value, this.viewProps = p.viewProps, this.sc_ = new Oi(o, p);
  12900. const f = {
  12901. baseStep: p.baseStep,
  12902. constraint: p.constraint,
  12903. textProps: K.fromObject({
  12904. draggingScale: p.draggingScale,
  12905. formatter: p.formatter
  12906. })
  12907. };
  12908. this.tc_ = new Rt(o, {
  12909. assembly: Vi,
  12910. axes: [f, f],
  12911. parser: p.parser,
  12912. value: this.value,
  12913. viewProps: p.viewProps
  12914. }), this.view = new ei(o, {
  12915. sliderView: this.sc_.view,
  12916. textView: this.tc_.view
  12917. });
  12918. }
  12919. get textController() {
  12920. return this.tc_;
  12921. }
  12922. }
  12923. function Ps(m) {
  12924. return Ke.isObject(m) ? new Ke(m.min, m.max) : new Ke(0, 0);
  12925. }
  12926. function Ni(m, o) {
  12927. m.writeProperty("max", o.max), m.writeProperty("min", o.min);
  12928. }
  12929. function Cr(m) {
  12930. const o = [], p = gn(m);
  12931. p && o.push(p);
  12932. const f = dr(m);
  12933. return f && o.push(f), new xn(new Kn(o));
  12934. }
  12935. const ti = {
  12936. id: "input-interval",
  12937. type: "input",
  12938. css: '.tp-cbzgv,.tp-radv_b,.tp-rslv_k,.tp-cbzv_b{-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:rgba(0,0,0,0);border-width:0;font-family:inherit;font-size:inherit;font-weight:inherit;margin:0;outline:none;padding:0}.tp-radv_b,.tp-rslv_k,.tp-cbzv_b{background-color:var(--btn-bg);border-radius:var(--elm-br);color:var(--btn-fg);cursor:pointer;display:block;font-weight:bold;height:var(--bld-us);line-height:var(--bld-us);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.tp-radv_b:hover,.tp-rslv_k:hover,.tp-cbzv_b:hover{background-color:var(--btn-bg-h)}.tp-radv_b:focus,.tp-rslv_k:focus,.tp-cbzv_b:focus{background-color:var(--btn-bg-f)}.tp-radv_b:active,.tp-rslv_k:active,.tp-cbzv_b:active{background-color:var(--btn-bg-a)}.tp-radv_b:disabled,.tp-rslv_k:disabled,.tp-cbzv_b:disabled{opacity:.5}.tp-cbzgv{background-color:var(--in-bg);border-radius:var(--elm-br);box-sizing:border-box;color:var(--in-fg);font-family:inherit;height:var(--bld-us);line-height:var(--bld-us);min-width:0;width:100%}.tp-cbzgv:hover{background-color:var(--in-bg-h)}.tp-cbzgv:focus{background-color:var(--in-bg-f)}.tp-cbzgv:active{background-color:var(--in-bg-a)}.tp-cbzgv:disabled{opacity:.5}.tp-btngridv{border-radius:var(--elm-br);display:grid;overflow:hidden;gap:2px}.tp-btngridv.tp-v-disabled{opacity:.5}.tp-btngridv .tp-btnv_b:disabled{opacity:1}.tp-btngridv .tp-btnv_b:disabled .tp-btnv_t{opacity:.5}.tp-btngridv .tp-btnv_b{border-radius:0}.tp-cbzv{position:relative}.tp-cbzv_h{display:flex}.tp-cbzv_b{margin-right:4px;position:relative;width:var(--bld-us)}.tp-cbzv_b svg{display:block;height:16px;left:50%;margin-left:-8px;margin-top:-8px;position:absolute;top:50%;width:16px}.tp-cbzv_b svg path{stroke:var(--bs-bg);stroke-width:2}.tp-cbzv_t{flex:1}.tp-cbzv_p{height:0;margin-top:0;opacity:0;overflow:hidden;transition:height .2s ease-in-out,opacity .2s linear,margin .2s ease-in-out}.tp-cbzv.tp-cbzv-expanded .tp-cbzv_p{margin-top:var(--bld-s);opacity:1}.tp-cbzv.tp-cbzv-cpl .tp-cbzv_p{overflow:visible}.tp-cbzv .tp-popv{left:calc(-1*var(--cnt-h-p));position:absolute;right:calc(-1*var(--cnt-h-p));top:var(--bld-us)}.tp-cbzpv_t{margin-top:var(--bld-s)}.tp-cbzgv{height:auto;overflow:hidden;position:relative}.tp-cbzgv.tp-v-disabled{opacity:.5}.tp-cbzgv_p{left:16px;position:absolute;right:16px;top:0}.tp-cbzgv_g{cursor:pointer;display:block;height:calc(var(--bld-us)*5);width:100%}.tp-cbzgv_u{opacity:.1;stroke:var(--in-fg);stroke-dasharray:1}.tp-cbzgv_l{fill:rgba(0,0,0,0);stroke:var(--in-fg)}.tp-cbzgv_v{opacity:.5;stroke:var(--in-fg);stroke-dasharray:1}.tp-cbzgv_h{border:var(--in-fg) solid 1px;border-radius:50%;box-sizing:border-box;height:4px;margin-left:-2px;margin-top:-2px;pointer-events:none;position:absolute;width:4px}.tp-cbzgv:focus .tp-cbzgv_h-sel{background-color:var(--in-fg);border-width:0}.tp-cbzprvv{cursor:pointer;height:4px;padding:4px 0;position:relative}.tp-cbzprvv_g{display:block;height:100%;overflow:visible;width:100%}.tp-cbzprvv_t{opacity:.5;stroke:var(--mo-fg)}.tp-cbzprvv_m{background-color:var(--mo-fg);border-radius:50%;height:4px;margin-left:-2px;margin-top:-2px;opacity:0;position:absolute;top:50%;transition:opacity .2s ease-out;width:4px}.tp-cbzprvv_m.tp-cbzprvv_m-a{opacity:1}.tp-fpsv{position:relative}.tp-fpsv_l{bottom:4px;color:var(--mo-fg);line-height:1;right:4px;pointer-events:none;position:absolute}.tp-fpsv_u{margin-left:.2em;opacity:.7}.tp-rslv{cursor:pointer;padding-left:8px;padding-right:8px}.tp-rslv.tp-v-disabled{opacity:.5}.tp-rslv_t{height:calc(var(--bld-us));position:relative}.tp-rslv_t::before{background-color:var(--in-bg);border-radius:1px;content:"";height:2px;margin-top:-1px;position:absolute;top:50%;left:-4px;right:-4px}.tp-rslv_b{bottom:0;top:0;position:absolute}.tp-rslv_b::before{background-color:var(--in-fg);content:"";height:2px;margin-top:-1px;position:absolute;top:50%;left:0;right:0}.tp-rslv_k{height:calc(var(--bld-us) - 8px);margin-top:calc((var(--bld-us) - 8px)/-2);position:absolute;top:50%;width:8px}.tp-rslv_k.tp-rslv_k-min{margin-left:-8px}.tp-rslv_k.tp-rslv_k-max{margin-left:0}.tp-rslv.tp-rslv-zero .tp-rslv_k.tp-rslv_k-min{border-bottom-right-radius:0;border-top-right-radius:0}.tp-rslv.tp-rslv-zero .tp-rslv_k.tp-rslv_k-max{border-bottom-left-radius:0;border-top-left-radius:0}.tp-rsltxtv{display:flex}.tp-rsltxtv_s{flex:1}.tp-rsltxtv_t{flex:1;margin-left:4px}.tp-radv_l{display:block;position:relative}.tp-radv_i{left:0;opacity:0;position:absolute;top:0}.tp-radv_b{opacity:.5}.tp-radv_i:hover+.tp-radv_b{background-color:var(--btn-bg-h)}.tp-radv_i:focus+.tp-radv_b{background-color:var(--btn-bg-f)}.tp-radv_i:active+.tp-radv_b{background-color:var(--btn-bg-a)}.tp-radv_i:checked+.tp-radv_b{opacity:1}.tp-radv_t{bottom:0;color:inherit;left:0;overflow:hidden;position:absolute;right:0;text-align:center;text-overflow:ellipsis;top:0}.tp-radv_i:disabled+.tp-radv_b>.tp-radv_t{opacity:.5}.tp-radgridv{border-radius:var(--elm-br);display:grid;overflow:hidden;gap:2px}.tp-radgridv.tp-v-disabled{opacity:.5}.tp-radgridv .tp-radv_b{border-radius:0}',
  12939. accept: (m, o) => {
  12940. if (!Ke.isObject(m))
  12941. return null;
  12942. const p = he, f = ee(o, {
  12943. format: p.optional.function,
  12944. max: p.optional.number,
  12945. min: p.optional.number,
  12946. step: p.optional.number
  12947. });
  12948. return f ? {
  12949. initialValue: new Ke(m.min, m.max),
  12950. params: f
  12951. } : null;
  12952. },
  12953. binding: {
  12954. reader: (m) => Ps,
  12955. constraint: (m) => Cr(m.params),
  12956. equals: Ke.equals,
  12957. writer: (m) => Ni
  12958. },
  12959. controller(m) {
  12960. var o;
  12961. const p = m.value, f = m.constraint;
  12962. if (!(f instanceof xn))
  12963. throw g.shouldNeverHappen();
  12964. const x = (p.rawValue.min + p.rawValue.max) / 2, P = (o = m.params.format) !== null && o !== void 0 ? o : Le(vn(f.edge, x)), L2 = f.edge && xt(f.edge, ft);
  12965. if (L2)
  12966. return new bt(m.document, {
  12967. baseStep: Ei(f.edge),
  12968. constraint: f.edge,
  12969. draggingScale: Qn(f.edge, x),
  12970. formatter: P,
  12971. parser: dn,
  12972. sliderProps: new K({
  12973. maxValue: L2.values.value("max"),
  12974. minValue: L2.values.value("min")
  12975. }),
  12976. value: p,
  12977. viewProps: m.viewProps
  12978. });
  12979. const z = {
  12980. baseStep: Ei(f.edge),
  12981. constraint: f.edge,
  12982. textProps: K.fromObject({
  12983. draggingScale: x,
  12984. formatter: P
  12985. })
  12986. };
  12987. return new Rt(m.document, {
  12988. assembly: Vi,
  12989. axes: [z, z],
  12990. parser: dn,
  12991. value: p,
  12992. viewProps: m.viewProps
  12993. });
  12994. }
  12995. };
  12996. class Dt {
  12997. constructor(o) {
  12998. this.controller_ = o;
  12999. }
  13000. get disabled() {
  13001. return this.controller_.viewProps.get("disabled");
  13002. }
  13003. set disabled(o) {
  13004. this.controller_.viewProps.set("disabled", o);
  13005. }
  13006. get title() {
  13007. var o;
  13008. return (o = this.controller_.props.get("title")) !== null && o !== void 0 ? o : "";
  13009. }
  13010. set title(o) {
  13011. this.controller_.props.set("title", o);
  13012. }
  13013. }
  13014. class Ot extends c {
  13015. constructor(o, p, f, x, P) {
  13016. super(o, x, P), this.cell = p, this.index = f;
  13017. }
  13018. }
  13019. class Cn extends s {
  13020. constructor(o) {
  13021. super(o), this.cellToApiMap_ = /* @__PURE__ */ new Map(), this.controller_.valueController.cellControllers.forEach((f) => {
  13022. const x = new Dt(f);
  13023. this.cellToApiMap_.set(f, x);
  13024. });
  13025. }
  13026. get value() {
  13027. return this.controller_.value;
  13028. }
  13029. cell(o, p) {
  13030. const f = this.controller_.valueController, x = f.cellControllers[p * f.size[0] + o];
  13031. return this.cellToApiMap_.get(x);
  13032. }
  13033. on(o, p) {
  13034. const f = p.bind(this);
  13035. this.controller_.value.emitter.on(o, (x) => {
  13036. const P = this.controller_.valueController, L2 = P.findCellByValue(x.rawValue);
  13037. if (!L2)
  13038. return;
  13039. const z = this.cellToApiMap_.get(L2);
  13040. if (!z)
  13041. return;
  13042. const oe = P.cellControllers.indexOf(L2);
  13043. f(new Ot(this, z, [oe % P.size[0], Math.floor(oe / P.size[0])], x.rawValue, void 0));
  13044. });
  13045. }
  13046. }
  13047. const Pn = y("rad");
  13048. class Ts {
  13049. constructor(o, p) {
  13050. this.element = o.createElement("div"), this.element.classList.add(Pn()), p.viewProps.bindClassModifiers(this.element);
  13051. const f = o.createElement("label");
  13052. f.classList.add(Pn("l")), this.element.appendChild(f);
  13053. const x = o.createElement("input");
  13054. x.classList.add(Pn("i")), x.name = p.name, x.type = "radio", p.viewProps.bindDisabled(x), f.appendChild(x), this.inputElement = x;
  13055. const P = o.createElement("div");
  13056. P.classList.add(Pn("b")), f.appendChild(P);
  13057. const L2 = o.createElement("div");
  13058. L2.classList.add(Pn("t")), P.appendChild(L2), R(p.props, "title", (z) => {
  13059. L2.textContent = z;
  13060. });
  13061. }
  13062. }
  13063. class ks {
  13064. constructor(o, p) {
  13065. this.props = p.props, this.viewProps = p.viewProps, this.view = new Ts(o, {
  13066. name: p.name,
  13067. props: this.props,
  13068. viewProps: this.viewProps
  13069. });
  13070. }
  13071. }
  13072. class ni {
  13073. constructor(o, p) {
  13074. this.cellCs_ = [], this.cellValues_ = [], this.onCellInputChange_ = this.onCellInputChange_.bind(this), this.size = p.size;
  13075. const [f, x] = this.size;
  13076. for (let P = 0; P < x; P++)
  13077. for (let L2 = 0; L2 < f; L2++) {
  13078. const z = new ks(o, {
  13079. name: p.groupName,
  13080. props: K.fromObject(Object.assign({}, p.cellConfig(L2, P))),
  13081. viewProps: be.create()
  13082. });
  13083. this.cellCs_.push(z), this.cellValues_.push(p.cellConfig(L2, P).value);
  13084. }
  13085. this.value = p.value, S(this.value, (P) => {
  13086. const L2 = this.findCellByValue(P);
  13087. L2 && (L2.view.inputElement.checked = true);
  13088. }), this.viewProps = be.create(), this.view = new yt(o, {
  13089. viewProps: this.viewProps,
  13090. viewName: "radgrid"
  13091. }), this.view.element.style.gridTemplateColumns = `repeat(${f}, 1fr)`, this.cellCs_.forEach((P) => {
  13092. P.view.inputElement.addEventListener("change", this.onCellInputChange_), this.view.element.appendChild(P.view.element);
  13093. });
  13094. }
  13095. get cellControllers() {
  13096. return this.cellCs_;
  13097. }
  13098. findCellByValue(o) {
  13099. const p = this.cellValues_.findIndex((f) => f === o);
  13100. return p < 0 ? null : this.cellCs_[p];
  13101. }
  13102. onCellInputChange_(o) {
  13103. const p = o.currentTarget, f = this.cellCs_.findIndex((x) => x.view.inputElement === p);
  13104. f < 0 || (this.value.rawValue = this.cellValues_[f]);
  13105. }
  13106. }
  13107. const Nt = function() {
  13108. return {
  13109. id: "radiogrid",
  13110. type: "blade",
  13111. accept(m) {
  13112. const o = he, p = ee(m, {
  13113. cells: o.required.function,
  13114. groupName: o.required.string,
  13115. size: o.required.array(o.required.number),
  13116. value: o.required.raw,
  13117. view: o.required.constant("radiogrid"),
  13118. label: o.optional.string
  13119. });
  13120. return p ? { params: p } : null;
  13121. },
  13122. controller(m) {
  13123. return new St(m.document, {
  13124. blade: m.blade,
  13125. props: K.fromObject({
  13126. label: m.params.label
  13127. }),
  13128. valueController: new ni(m.document, {
  13129. groupName: m.params.groupName,
  13130. cellConfig: m.params.cells,
  13131. size: m.params.size,
  13132. value: H(m.params.value)
  13133. })
  13134. });
  13135. },
  13136. api(m) {
  13137. return !(m.controller instanceof St) || !(m.controller.valueController instanceof ni) ? null : new Cn(m.controller);
  13138. }
  13139. };
  13140. }();
  13141. function Fi(m) {
  13142. return {
  13143. id: "input-radiogrid",
  13144. type: "input",
  13145. accept(o, p) {
  13146. if (!m.isType(o))
  13147. return null;
  13148. const f = he, x = ee(p, {
  13149. cells: f.required.function,
  13150. groupName: f.required.string,
  13151. size: f.required.array(f.required.number),
  13152. view: f.required.constant("radiogrid")
  13153. });
  13154. return x ? {
  13155. initialValue: o,
  13156. params: x
  13157. } : null;
  13158. },
  13159. binding: m.binding,
  13160. controller: (o) => new ni(o.document, {
  13161. cellConfig: o.params.cells,
  13162. groupName: o.params.groupName,
  13163. size: o.params.size,
  13164. value: o.value
  13165. })
  13166. };
  13167. }
  13168. const Pr = Fi({
  13169. isType: (m) => typeof m == "number",
  13170. binding: {
  13171. reader: (m) => tr,
  13172. writer: (m) => et
  13173. }
  13174. }), Tr = Fi({
  13175. isType: (m) => typeof m == "string",
  13176. binding: {
  13177. reader: (m) => rs,
  13178. writer: (m) => et
  13179. }
  13180. }), kr = Fi({
  13181. isType: (m) => typeof m == "boolean",
  13182. binding: {
  13183. reader: (m) => pn,
  13184. writer: (m) => et
  13185. }
  13186. }), Ms = [
  13187. br,
  13188. Vt,
  13189. Ii,
  13190. ti,
  13191. Nt,
  13192. kr,
  13193. Pr,
  13194. Tr
  13195. ];
  13196. r.ButtonCellApi = gs, r.ButtonGridApi = _s, r.ButtonGridController = Pi, r.CubicBezier = Et, r.CubicBezierApi = ws, r.CubicBezierAssembly = ki, r.CubicBezierController = Jn, r.CubicBezierGraphController = lt, r.CubicBezierGraphView = Re, r.CubicBezierPickerController = Cs, r.CubicBezierPickerView = xs, r.CubicBezierPreviewView = qt, r.CubicBezierView = ys, r.FpsGraphBladeApi = _e, r.FpsGraphController = Ri, r.FpsView = He, r.Fpswatch = Se, r.Interval = Ke, r.IntervalAssembly = Vi, r.IntervalConstraint = xn, r.RadioCellApi = Dt, r.RadioController = ks, r.RadioGridApi = Cn, r.RadioGridController = ni, r.RadioView = Ts, r.RangeSliderController = Oi, r.RangeSliderTextController = bt, r.RangeSliderTextView = ei, r.RangeSliderView = En, r.TpRadioGridChangeEvent = Ot, r.plugins = Ms, Object.defineProperty(r, "__esModule", { value: true });
  13197. });
  13198. })(Ph, Ji);
  13199. var Th = ih(Ji);
  13200. var kh = Np({
  13201. __proto__: null,
  13202. default: Th
  13203. }, [Ji]);
  13204. var Ln;
  13205. var Ds;
  13206. var md = (b = "tres-container") => {
  13207. Ln || (Ln = new js.Pane({
  13208. container: document.querySelector(b) || void 0
  13209. }), Ln.registerPlugin(kh), Ds = Ln.addBlade({
  13210. view: "fpsgraph",
  13211. label: "fpsgraph"
  13212. }));
  13213. function i() {
  13214. Ln && Ln.dispose();
  13215. }
  13216. return onMounted(() => {
  13217. const { onBeforeLoop: r, onAfterLoop: s, resume: a } = $();
  13218. a(), r(() => Ds.begin()), s(() => Ds.end());
  13219. }), onUnmounted(() => {
  13220. i();
  13221. }), { pane: Ln, fpsGraph: Ds, disposeTweakPane: i };
  13222. };
  13223. function fd(b, i) {
  13224. const r = ref(i), s = new AnimationMixer(r.value), a = shallowReactive({});
  13225. b.forEach((u) => {
  13226. const h = s.clipAction(u, r.value);
  13227. a[u.name] = h;
  13228. });
  13229. const { onLoop: c } = $();
  13230. return c(({ delta: u }) => {
  13231. s.update(u);
  13232. }), {
  13233. actions: a,
  13234. mixer: s
  13235. };
  13236. }
  13237. var Os = null;
  13238. function Mh(b, i) {
  13239. return (r) => {
  13240. i && i(r), b.draco && (Os || (Os = new rh()), Os.setDecoderPath(b.decoderPath || "https://www.gstatic.com/draco/versioned/decoders/1.4.3/"), r.setDRACOLoader(Os));
  13241. };
  13242. }
  13243. async function Sh(b, i = {
  13244. draco: false
  13245. }, r) {
  13246. return await dt(su, b, Mh(i, r));
  13247. }
  13248. var vd = defineComponent({
  13249. name: "GLTFModel",
  13250. props: ["path", "draco", "decoderPath"],
  13251. async setup(b, { expose: i }) {
  13252. const { state: r } = Fn(), s = ref();
  13253. i({ model: s });
  13254. const { scene: a } = await Sh(b.path, { draco: b.draco, decoderPath: b.decoderPath });
  13255. return s.value = a, r.scene && r.scene.add(a), () => {
  13256. };
  13257. }
  13258. });
  13259. async function Ah(b) {
  13260. return await dt(Uu, b);
  13261. }
  13262. var bd = defineComponent({
  13263. name: "FBXModel",
  13264. props: ["path"],
  13265. async setup(b, { expose: i }) {
  13266. const { state: r } = Fn();
  13267. let s = null;
  13268. function a() {
  13269. return s;
  13270. }
  13271. return i({ getModel: a }), s = await Ah(b.path), r.scene && s.isObject3D && r.scene.add(s), () => {
  13272. };
  13273. }
  13274. });
  13275. var Lh = { key: 0 };
  13276. var Rh = ["args", "center"];
  13277. var gd = defineComponent({
  13278. __name: "Text3D",
  13279. props: {
  13280. font: null,
  13281. text: null,
  13282. size: { default: 0.5 },
  13283. height: { default: 0.2 },
  13284. curveSegments: { default: 5 },
  13285. bevelEnabled: { type: Boolean, default: true },
  13286. bevelThickness: { default: 0.05 },
  13287. bevelSize: { default: 0.02 },
  13288. bevelOffset: { default: 0 },
  13289. bevelSegments: { default: 4 },
  13290. center: { type: Boolean, default: false }
  13291. },
  13292. async setup(b) {
  13293. let i, r;
  13294. const s = b, { extend: a } = Fn();
  13295. a({ TextGeometry: Vu });
  13296. const c = new eh(), u = useSlots(), h = computed(() => {
  13297. var w;
  13298. return s.text ? s.text : u.default ? (w = u.default()[0].children) == null ? void 0 : w.trim() : "TresJS";
  13299. }), d = ([i, r] = withAsyncContext(() => new Promise((w, _) => {
  13300. try {
  13301. typeof s.font == "string" ? c.load(s.font, (y) => {
  13302. w(y);
  13303. }) : w(s.font);
  13304. } catch (y) {
  13305. _(console.error("cientos", y));
  13306. }
  13307. })), i = await i, r(), i), g = computed(() => ({
  13308. font: d,
  13309. size: s.size,
  13310. height: s.height,
  13311. curveSegments: s.curveSegments,
  13312. bevelEnabled: s.bevelEnabled,
  13313. bevelThickness: s.bevelThickness,
  13314. bevelSize: s.bevelSize,
  13315. bevelOffset: s.bevelOffset,
  13316. bevelSegments: s.bevelSegments
  13317. }));
  13318. return (w, _) => unref(d) ? (openBlock(), createElementBlock("TresMesh", Lh, [
  13319. unref(h) ? (openBlock(), createElementBlock("TresTextGeometry", {
  13320. key: 0,
  13321. args: [unref(h), unref(g)],
  13322. center: b.center
  13323. }, null, 8, Rh)) : createCommentVNode("", true),
  13324. renderSlot(w.$slots, "default")
  13325. ])) : createCommentVNode("", true);
  13326. }
  13327. });
  13328. var Ih = ["rotation"];
  13329. var Vh = ["args"];
  13330. var Dh = ["color"];
  13331. var _d = defineComponent({
  13332. __name: "Plane",
  13333. props: {
  13334. args: { default: () => [1, 1] },
  13335. color: { default: "0xffffff" }
  13336. },
  13337. setup(b, { expose: i }) {
  13338. const r = shallowRef();
  13339. return i({
  13340. value: r
  13341. }), (s, a) => (openBlock(), createElementBlock("TresMesh", mergeProps({
  13342. ref_key: "planeRef",
  13343. ref: r,
  13344. rotation: [-Math.PI / 2, 0, 0]
  13345. }, s.$attrs), [
  13346. createBaseVNode("TresPlaneGeometry", { args: b.args }, null, 8, Vh),
  13347. renderSlot(s.$slots, "default", {}, () => [
  13348. createBaseVNode("TresMeshBasicMaterial", { color: b.color }, null, 8, Dh)
  13349. ])
  13350. ], 16, Ih));
  13351. }
  13352. });
  13353. var Oh = ["args"];
  13354. var Nh = ["color"];
  13355. var wd = defineComponent({
  13356. __name: "Box",
  13357. props: {
  13358. args: { default: () => [1, 1, 1] },
  13359. color: { default: "0xffffff" }
  13360. },
  13361. setup(b, { expose: i }) {
  13362. const r = shallowRef();
  13363. return i({
  13364. value: r
  13365. }), (s, a) => (openBlock(), createElementBlock("TresMesh", mergeProps({
  13366. ref_key: "boxRef",
  13367. ref: r
  13368. }, s.$attrs), [
  13369. createBaseVNode("TresBoxGeometry", { args: b.args }, null, 8, Oh),
  13370. renderSlot(s.$slots, "default", {}, () => [
  13371. createBaseVNode("TresMeshBasicMaterial", { color: b.color }, null, 8, Nh)
  13372. ])
  13373. ], 16));
  13374. }
  13375. });
  13376. var Fh = ["args"];
  13377. var Bh = ["color"];
  13378. var yd = defineComponent({
  13379. __name: "Sphere",
  13380. props: {
  13381. args: { default: () => [2, 32, 16] },
  13382. color: { default: "0xffffff" }
  13383. },
  13384. setup(b, { expose: i }) {
  13385. const r = shallowRef();
  13386. return i({
  13387. value: r
  13388. }), (s, a) => (openBlock(), createElementBlock("TresMesh", mergeProps({
  13389. ref_key: "sphereRef",
  13390. ref: r
  13391. }, s.$attrs), [
  13392. createBaseVNode("TresSphereGeometry", { args: b.args }, null, 8, Fh),
  13393. renderSlot(s.$slots, "default", {}, () => [
  13394. createBaseVNode("TresMeshBasicMaterial", { color: b.color }, null, 8, Bh)
  13395. ])
  13396. ], 16));
  13397. }
  13398. });
  13399. var jh = ["args"];
  13400. var zh = ["color"];
  13401. var xd = defineComponent({
  13402. __name: "Torus",
  13403. props: {
  13404. args: { default: () => [1, 1, 16, 80] },
  13405. color: { default: "0xffffff" }
  13406. },
  13407. setup(b, { expose: i }) {
  13408. const r = shallowRef();
  13409. return i({
  13410. value: r
  13411. }), (s, a) => (openBlock(), createElementBlock("TresMesh", mergeProps({
  13412. ref_key: "torusRef",
  13413. ref: r
  13414. }, s.$attrs), [
  13415. createBaseVNode("TresTorusGeometry", { args: b.args }, null, 8, jh),
  13416. renderSlot(s.$slots, "default", {}, () => [
  13417. createBaseVNode("TresMeshBasicMaterial", { color: b.color }, null, 8, zh)
  13418. ])
  13419. ], 16));
  13420. }
  13421. });
  13422. var Uh = ["args"];
  13423. var Gh = ["color"];
  13424. var Ed = defineComponent({
  13425. __name: "TorusKnot",
  13426. props: {
  13427. args: { default: () => [1, 0.4, 64, 8] },
  13428. color: { default: "0xffffff" }
  13429. },
  13430. setup(b, { expose: i }) {
  13431. const r = shallowRef();
  13432. return i({
  13433. value: r
  13434. }), (s, a) => (openBlock(), createElementBlock("TresMesh", mergeProps({
  13435. ref_key: "torusKnotRef",
  13436. ref: r
  13437. }, s.$attrs), [
  13438. createBaseVNode("TresTorusKnotGeometry", { args: b.args }, null, 8, Uh),
  13439. renderSlot(s.$slots, "default", {}, () => [
  13440. createBaseVNode("TresMeshBasicMaterial", { color: b.color }, null, 8, Gh)
  13441. ])
  13442. ], 16));
  13443. }
  13444. });
  13445. var Hh = ["args"];
  13446. var Kh = ["color"];
  13447. var Cd = defineComponent({
  13448. __name: "Circle",
  13449. props: {
  13450. args: { default: () => [1, 32, 0, Math.PI * 2] },
  13451. color: { default: "0xffffff" }
  13452. },
  13453. setup(b, { expose: i }) {
  13454. const r = shallowRef();
  13455. return i({
  13456. value: r
  13457. }), (s, a) => (openBlock(), createElementBlock("TresMesh", mergeProps({
  13458. ref_key: "circleRef",
  13459. ref: r
  13460. }, s.$attrs), [
  13461. createBaseVNode("TresCircleGeometry", { args: b.args }, null, 8, Hh),
  13462. renderSlot(s.$slots, "default", {}, () => [
  13463. createBaseVNode("TresMeshBasicMaterial", { color: b.color }, null, 8, Kh)
  13464. ])
  13465. ], 16));
  13466. }
  13467. });
  13468. var $h = ["args"];
  13469. var Xh = ["color"];
  13470. var Pd = defineComponent({
  13471. __name: "Cone",
  13472. props: {
  13473. args: { default: () => [1, 1, 12, false, 0, Math.PI * 2] },
  13474. color: { default: "0xffffff" }
  13475. },
  13476. setup(b, { expose: i }) {
  13477. const r = shallowRef();
  13478. return i({
  13479. value: r
  13480. }), (s, a) => (openBlock(), createElementBlock("TresMesh", mergeProps({
  13481. ref_key: "coneRef",
  13482. ref: r
  13483. }, s.$attrs), [
  13484. createBaseVNode("TresConeGeometry", { args: b.args }, null, 8, $h),
  13485. renderSlot(s.$slots, "default", {}, () => [
  13486. createBaseVNode("TresMeshBasicMaterial", { color: b.color }, null, 8, Xh)
  13487. ])
  13488. ], 16));
  13489. }
  13490. });
  13491. var Yh = ["args"];
  13492. var qh = ["color"];
  13493. var Td = defineComponent({
  13494. __name: "Tube",
  13495. props: {
  13496. args: { default: () => [
  13497. new QuadraticBezierCurve3(new Vector3(-1, 0, 0), new Vector3(0, 1, 0), new Vector3(1, 0, 0)),
  13498. 20,
  13499. 0.2,
  13500. 8,
  13501. false
  13502. ] },
  13503. color: { default: "0xffffff" }
  13504. },
  13505. setup(b, { expose: i }) {
  13506. const r = shallowRef();
  13507. return i({
  13508. value: r
  13509. }), (s, a) => (openBlock(), createElementBlock("TresMesh", mergeProps({
  13510. ref_key: "tubeRef",
  13511. ref: r
  13512. }, s.$attrs), [
  13513. createBaseVNode("TresTubeGeometry", { args: b.args }, null, 8, Yh),
  13514. renderSlot(s.$slots, "default", {}, () => [
  13515. createBaseVNode("TresMeshBasicMaterial", { color: b.color }, null, 8, qh)
  13516. ])
  13517. ], 16));
  13518. }
  13519. });
  13520. var Qh = ["args"];
  13521. var Zh = ["color"];
  13522. var kd = defineComponent({
  13523. __name: "Ring",
  13524. props: {
  13525. args: { default: () => [0.5, 1, 32] },
  13526. color: { default: "0xffffff" }
  13527. },
  13528. setup(b, { expose: i }) {
  13529. const r = shallowRef();
  13530. return i({
  13531. value: r
  13532. }), (s, a) => (openBlock(), createElementBlock("TresMesh", mergeProps({
  13533. ref_key: "ringRef",
  13534. ref: r
  13535. }, s.$attrs), [
  13536. createBaseVNode("TresRingGeometry", { args: b.args }, null, 8, Qh),
  13537. renderSlot(s.$slots, "default", {}, () => [
  13538. createBaseVNode("TresMeshBasicMaterial", { color: b.color }, null, 8, Zh)
  13539. ])
  13540. ], 16));
  13541. }
  13542. });
  13543. var Wh = ["rotation"];
  13544. var Jh = ["args"];
  13545. var ed = ["color"];
  13546. var Md = defineComponent({
  13547. __name: "Tetrahedron",
  13548. props: {
  13549. args: { default: () => [1, 0] },
  13550. color: { default: "0xffffff" }
  13551. },
  13552. setup(b, { expose: i }) {
  13553. const r = shallowRef();
  13554. return i({
  13555. value: r
  13556. }), (s, a) => (openBlock(), createElementBlock("TresMesh", mergeProps({
  13557. ref_key: "tetrahedronRef",
  13558. ref: r,
  13559. rotation: [-Math.PI / 2, 0, 0]
  13560. }, s.$attrs), [
  13561. createBaseVNode("TresTetrahedronGeometry", { args: b.args }, null, 8, Jh),
  13562. renderSlot(s.$slots, "default", {}, () => [
  13563. createBaseVNode("TresMeshBasicMaterial", { color: b.color }, null, 8, ed)
  13564. ])
  13565. ], 16, Wh));
  13566. }
  13567. });
  13568. var td = ["args"];
  13569. var nd = ["color"];
  13570. var Sd = defineComponent({
  13571. __name: "Icosahedron",
  13572. props: {
  13573. args: { default: () => [1, 0] },
  13574. color: { default: "0xffffff" }
  13575. },
  13576. setup(b, { expose: i }) {
  13577. const r = shallowRef();
  13578. return i({
  13579. value: r
  13580. }), (s, a) => (openBlock(), createElementBlock("TresMesh", mergeProps({
  13581. ref_key: "icosahedronRef",
  13582. ref: r
  13583. }, s.$attrs), [
  13584. createBaseVNode("TresIcosahedronGeometry", { args: b.args }, null, 8, td),
  13585. renderSlot(s.$slots, "default", {}, () => [
  13586. createBaseVNode("TresMeshBasicMaterial", { color: b.color }, null, 8, nd)
  13587. ])
  13588. ], 16));
  13589. }
  13590. });
  13591. var id = ["args"];
  13592. var sd = ["color"];
  13593. var Ad = defineComponent({
  13594. __name: "Octahedron",
  13595. props: {
  13596. args: { default: () => [1, 0] },
  13597. color: { default: "0xffffff" }
  13598. },
  13599. setup(b, { expose: i }) {
  13600. const r = shallowRef();
  13601. return i({
  13602. value: r
  13603. }), (s, a) => (openBlock(), createElementBlock("TresMesh", mergeProps({
  13604. ref_key: "octahedronRef",
  13605. ref: r
  13606. }, s.$attrs), [
  13607. createBaseVNode("TresOctahedronGeometry", { args: b.args }, null, 8, id),
  13608. renderSlot(s.$slots, "default", {}, () => [
  13609. createBaseVNode("TresMeshBasicMaterial", { color: b.color }, null, 8, sd)
  13610. ])
  13611. ], 16));
  13612. }
  13613. });
  13614. var rd = ["args"];
  13615. var od = ["color"];
  13616. var Ld = defineComponent({
  13617. __name: "Dodecahedron",
  13618. props: {
  13619. args: { default: () => [1, 0] },
  13620. color: { default: "0xffffff" }
  13621. },
  13622. setup(b, { expose: i }) {
  13623. const r = shallowRef();
  13624. return i({
  13625. value: r
  13626. }), (s, a) => (openBlock(), createElementBlock("TresMesh", mergeProps({
  13627. ref_key: "dodecahedronRef",
  13628. ref: r
  13629. }, s.$attrs), [
  13630. createBaseVNode("TresDodecahedronGeometry", { args: b.args }, null, 8, rd),
  13631. renderSlot(s.$slots, "default", {}, () => [
  13632. createBaseVNode("TresMeshBasicMaterial", { color: b.color }, null, 8, od)
  13633. ])
  13634. ], 16));
  13635. }
  13636. });
  13637. var eo = {
  13638. sunset: "venice/venice_sunset_4k.hdr"
  13639. };
  13640. async function ad({
  13641. files: b = ["/px.png", "/nx.png", "/py.png", "/ny.png", "/pz.png", "/nz.png"],
  13642. blur: i = 0,
  13643. background: r = false,
  13644. path: s = "/",
  13645. preset: a = void 0,
  13646. encoding: c = void 0
  13647. }) {
  13648. const { state: u } = Fn();
  13649. if (a) {
  13650. if (!(a in eo))
  13651. throw new Error("Preset must be one of: " + Object.keys(eo).join(", "));
  13652. b = eo[a], s = "https://raw.githubusercontent.com/Tresjs/assets/main/textures/hdr/";
  13653. }
  13654. const h = Array.isArray(b), g = await dt(
  13655. h ? CubeTextureLoader : sh,
  13656. h ? [b] : b,
  13657. (_) => {
  13658. s && _.setPath(s), c && (_.encoding = c);
  13659. }
  13660. ), w = h ? g[0] : g;
  13661. return w && (w.mapping = h ? CubeReflectionMapping : EquirectangularReflectionMapping, w.encoding = c ?? h ? sRGBEncoding : LinearEncoding), u.scene && (u.scene.environment = w, r !== void 0 && (u.scene.background = w), i && (u.scene.backgroundBlurriness = i | 0)), w;
  13662. }
  13663. var Rd = defineComponent({
  13664. name: "Environment",
  13665. props: ["background", "blur", "files", "encoding", "path", "preset"],
  13666. async setup(b, { expose: i }) {
  13667. let r = null;
  13668. return i({ getTexture: () => r }), r = await ad(b), () => {
  13669. };
  13670. }
  13671. });
  13672. export {
  13673. wd as Box,
  13674. Cd as Circle,
  13675. Pd as Cone,
  13676. Ld as Dodecahedron,
  13677. Rd as Environment,
  13678. bd as FBXModel,
  13679. vd as GLTFModel,
  13680. Sd as Icosahedron,
  13681. Ad as Octahedron,
  13682. ud as OrbitControls,
  13683. dd as PamCameraMouse,
  13684. _d as Plane,
  13685. kd as Ring,
  13686. yd as Sphere,
  13687. Md as Tetrahedron,
  13688. gd as Text3D,
  13689. xd as Torus,
  13690. Ed as TorusKnot,
  13691. hd as TransformControls,
  13692. Td as Tube,
  13693. fd as useAnimations,
  13694. ad as useEnvironment,
  13695. Ah as useFBX,
  13696. Sh as useGLTF,
  13697. Eh as usePamCameraMouse,
  13698. md as useTweakPane
  13699. };
  13700. /*! Bundled license information:
  13701. @tresjs/cientos/dist/trescientos.js:
  13702. (*! Tweakpane 3.1.7 (c) 2016 cocopon, licensed under the MIT license. *)
  13703. */
  13704. //# sourceMappingURL=@tresjs_cientos.js.map